223 lines
5.5 KiB
Vue
223 lines
5.5 KiB
Vue
<!-- 页面:需求提报(Demand) -->
|
||
<script setup lang="ts">
|
||
import { onMounted } from 'vue'
|
||
import { storeToRefs } from 'pinia'
|
||
import { useDemandStore } from '@/stores/modules/demand'
|
||
import type { Demand, DemandAttachment } from '@/types/business/demand'
|
||
import DemandActionBar from './cpns/DemandActionBar.vue'
|
||
import DemandBizTypes from './cpns/DemandBizTypes.vue'
|
||
import DemandConfirmForm from './cpns/DemandConfirmForm.vue'
|
||
import DemandInfoForm from './cpns/DemandInfoForm.vue'
|
||
|
||
const demandStore = useDemandStore()
|
||
const {
|
||
form,
|
||
bizTypeOptions,
|
||
budgetOptions,
|
||
loading,
|
||
saving,
|
||
submitting,
|
||
uploading,
|
||
} = storeToRefs(demandStore)
|
||
|
||
function onBizType(value: string): void {
|
||
demandStore.patchForm({ bizType: value })
|
||
}
|
||
|
||
function onUpdate(partial: Partial<Demand>): void {
|
||
demandStore.patchForm(partial)
|
||
}
|
||
|
||
function onUpload(file: File): void {
|
||
void demandStore.addAttachment(file)
|
||
}
|
||
|
||
function onRemoveFile(file: DemandAttachment): void {
|
||
demandStore.removeAttachment(file)
|
||
}
|
||
|
||
function onSaveDraft(): void {
|
||
void demandStore.saveDraft()
|
||
}
|
||
|
||
function onReset(): void {
|
||
void demandStore.reset()
|
||
}
|
||
|
||
async function onSubmit(): Promise<void> {
|
||
await demandStore.submit()
|
||
}
|
||
|
||
onMounted(() => {
|
||
void demandStore.init()
|
||
})
|
||
</script>
|
||
|
||
<template>
|
||
<div class="demand-page" :class="{ 'is-loading': loading }">
|
||
<header class="demand-page__hero">
|
||
<div class="container demand-page__hero-inner">
|
||
<h1 class="demand-page__title">
|
||
需求提报
|
||
</h1>
|
||
<p class="demand-page__subtitle">
|
||
填写您的需求信息,专业顾问将快速与您联系
|
||
</p>
|
||
</div>
|
||
</header>
|
||
|
||
<div class="container">
|
||
<div class="demand">
|
||
<section class="demand__section">
|
||
<h2 class="demand__heading">
|
||
<span class="demand__index">01</span>
|
||
<span class="demand__label">选择业务类型<span class="demand__required">*</span></span>
|
||
</h2>
|
||
<DemandBizTypes
|
||
:options="bizTypeOptions"
|
||
:model-value="form.bizType"
|
||
@update:model-value="onBizType"
|
||
/>
|
||
</section>
|
||
|
||
<section class="demand__section">
|
||
<h2 class="demand__heading">
|
||
<span class="demand__index">02</span>
|
||
<span class="demand__label">填写需求信息<span class="demand__required">*</span></span>
|
||
</h2>
|
||
<DemandInfoForm
|
||
:demand="form"
|
||
:budget-options="budgetOptions"
|
||
:uploading="uploading"
|
||
@update="onUpdate"
|
||
@upload="onUpload"
|
||
@remove-file="onRemoveFile"
|
||
/>
|
||
</section>
|
||
|
||
<section class="demand__section">
|
||
<h2 class="demand__heading">
|
||
<span class="demand__index">03</span>
|
||
<span class="demand__label">确认信息并补充备注</span>
|
||
</h2>
|
||
<DemandConfirmForm
|
||
:demand="form"
|
||
@update="onUpdate"
|
||
/>
|
||
</section>
|
||
|
||
<DemandActionBar
|
||
:saving="saving"
|
||
:submitting="submitting"
|
||
@save-draft="onSaveDraft"
|
||
@reset="onReset"
|
||
@submit="onSubmit"
|
||
/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style lang="less" scoped>
|
||
.demand-page {
|
||
// 操作栏已收进卡片内(设计稿 el36 y=2280),不需要为fixed 底栏预留空白。
|
||
|
||
&.is-loading .demand {
|
||
opacity: 0.6;
|
||
pointer-events: none;
|
||
}
|
||
|
||
&__hero {
|
||
height: 179px;
|
||
box-sizing: border-box;
|
||
padding-top: 32px;
|
||
background: @white;
|
||
}
|
||
|
||
&__hero-inner {
|
||
// 设计稿 el82:标题左边界 112px(hero 白底 1920 宽,标题左起 112)。
|
||
padding-left: 112px;
|
||
}
|
||
|
||
&__title {
|
||
margin: 0;
|
||
font-size: 36px;
|
||
font-weight: 700;
|
||
line-height: 52px;
|
||
color: @demand-ink;
|
||
}
|
||
|
||
&__subtitle {
|
||
margin: 15px 0 0;
|
||
font-size: 24px;
|
||
font-weight: 500;
|
||
line-height: 35px;
|
||
color: @demand-subtitle;
|
||
}
|
||
}
|
||
|
||
.demand {
|
||
margin-top: 20px; // 271 − (72+179) = 20
|
||
// 设计稿 el83 卡片 x=70 w=1780;内容左边界 194(el68 输入框 x=194 w=1605),
|
||
// 右边界 1799。故左内边距 56、右内边距 51(不对称是设计稿本身如此)。
|
||
padding: 48px 51px 114px 56px;
|
||
background: @white;
|
||
|
||
&__heading {
|
||
// 设计稿三个 heading 的标签都比序号低 23px(el80 "01" y=319 →
|
||
// el79 "选择业务类型*" y=342),不是垂直居中,故用flex-start + margin-top。
|
||
.flex(row, flex-start, flex-start);
|
||
gap: 4px;
|
||
margin: 0 0 50px;
|
||
padding-left: 8px;
|
||
}
|
||
|
||
&__index {
|
||
flex-shrink: 0;
|
||
font-size: 48px;
|
||
font-weight: 500;
|
||
line-height: 70px;
|
||
font-variant-numeric: tabular-nums;
|
||
color: @demand-accent;
|
||
}
|
||
|
||
&__label {
|
||
// 与序号的顶部落差 23px(el80 y=319 → el79 y=342)。
|
||
margin-top: 23px;
|
||
font-size: 28px;
|
||
font-weight: 500;
|
||
line-height: 41px;
|
||
color: @demand-heading;
|
||
}
|
||
|
||
&__required {
|
||
margin-left: 2px;
|
||
color: @danger-color;
|
||
}
|
||
|
||
// 内容左边界 194:卡片 x=70 + padding-left 56 + 内容缩进 68。
|
||
&__heading + * {
|
||
margin-left: 68px;
|
||
}
|
||
|
||
// el29业务类型卡片底 645 → el78 "02" 顶 705 = 60px。
|
||
&__section + &__section {
|
||
margin-top: 60px;
|
||
}
|
||
|
||
// el53 附件灰块底 1619 → el76 "03" 顶 1689 = 70px。
|
||
&__section + &__section:last-of-type {
|
||
margin-top: 70px;
|
||
}
|
||
|
||
&__section + &__section &__heading {
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
// el78 "02" 底 775 → el70 "项目名称*" 顶 789 = 14px。
|
||
&__section + &__section &__heading + * {
|
||
margin-top: 14px;
|
||
}
|
||
}
|
||
</style>
|