|
|
@@ -1,63 +1,66 @@
|
|
|
<template>
|
|
|
<app-modal direction="right" height="100%" v-model:show="showModal" :refresh="refresh">
|
|
|
- <app-view class="g-form">
|
|
|
- <template #header>
|
|
|
- <app-navbar title="提货" @back="closed" />
|
|
|
- </template>
|
|
|
- <Form ref="formRef" class="g-form__container" @submit="formSubmit">
|
|
|
- <CellGroup inset>
|
|
|
- <Field label="商品" readonly>
|
|
|
- <template #input>
|
|
|
- {{ selectedRow.wrstandardname }}
|
|
|
- </template>
|
|
|
- </Field>
|
|
|
- <Field label="仓库" readonly>
|
|
|
- <template #input>
|
|
|
- {{ selectedRow.warehousename }}
|
|
|
- </template>
|
|
|
- </Field>
|
|
|
- <Field name="OrderQty" label="提货数量" v-model="orderQty" placeholder="请输入提货数量"
|
|
|
- :rules="formRules.orderQty" />
|
|
|
+ <template #default="{ animation }">
|
|
|
+ <app-view class="g-form">
|
|
|
+ <template #header>
|
|
|
+ <app-navbar title="提货" @back="closed" />
|
|
|
+ </template>
|
|
|
+ <Form ref="formRef" class="g-form__container" @submit="formSubmit">
|
|
|
+ <CellGroup inset>
|
|
|
+ <Field label="商品" readonly>
|
|
|
+ <template #input>
|
|
|
+ {{ selectedRow.wrstandardname }}
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ <Field label="仓库" readonly>
|
|
|
+ <template #input>
|
|
|
+ {{ selectedRow.warehousename }}
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ <Field name="OrderQty" label="提货数量" v-model="orderQty" placeholder="请输入提货数量"
|
|
|
+ :rules="formRules.orderQty" />
|
|
|
|
|
|
- <Field label="提货方式" readonly>
|
|
|
- <template #input>
|
|
|
- <RadioGroup v-model="checked" direction="horizontal">
|
|
|
- <Radio :name="3">代办运输</Radio>
|
|
|
- <Radio :name="2">自提</Radio>
|
|
|
- </RadioGroup>
|
|
|
- </template>
|
|
|
- </Field>
|
|
|
- <Field name="ContractName" label="联系人" v-model="formData.ContactName" placeholder="请输入联系人"
|
|
|
- :rules="formRules.ContactName">
|
|
|
- <template #button>
|
|
|
- <Button size="normal" icon="add-o" @click="showContact = true" />
|
|
|
- </template>
|
|
|
- </Field>
|
|
|
- <Field name="ContactNum" label="联系方式" v-model="formData.ContactNum" placeholder="请输入联系方式"
|
|
|
- :rules="formRules.ContactNum" />
|
|
|
- <Field name="Address" label="目的地地址" v-model="formData.Address" placeholder="请输入目的地地址"
|
|
|
- :rules="formRules.Address" v-if="checked === 3" />
|
|
|
- <Field name="AppointmentRemark" label="发票信息" rows="10" autosize v-model="formData.AppointmentRemark"
|
|
|
- placeholder="请填入发票信息" :rules="formRules.AppointmentRemark">
|
|
|
- <template #button>
|
|
|
- <Button size="normal" icon="add-o" @click="showReceipt = true" />
|
|
|
+ <Field label="提货方式" readonly>
|
|
|
+ <template #input>
|
|
|
+ <RadioGroup v-model="formData.AppointmentModel" direction="horizontal">
|
|
|
+ <Radio :name="1">代办运输</Radio>
|
|
|
+ <Radio :name="3">自提</Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ <Field name="ContractName" label="联系人" v-model="formData.ContactName" placeholder="请输入联系人"
|
|
|
+ :rules="formRules.ContactName" right-icon="add-o" @click-right-icon="showContact = true" />
|
|
|
+ <Field name="ContactNum" label="联系方式" v-model="formData.ContactNum" placeholder="请输入联系方式"
|
|
|
+ :rules="formRules.ContactNum" />
|
|
|
+ <template v-if="formData.AppointmentModel === 1">
|
|
|
+ <Field :rules="formRules.Region" name="Region" label="目的地地区" is-link v-if="!animation">
|
|
|
+ <template #input>
|
|
|
+ <component :is="AppRegion" v-model="formData.DistrictID" v-model:label="regionName"
|
|
|
+ @finish="onRegionFinish" />
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ <Field name="Address" type="textarea" label="目的地地址" row="2" v-model="formData.Address"
|
|
|
+ placeholder="请输入目的地地址" :rules="formRules.Address" />
|
|
|
</template>
|
|
|
- </Field>
|
|
|
- </CellGroup>
|
|
|
- </Form>
|
|
|
- <template #footer>
|
|
|
- <div class="g-form__footer">
|
|
|
- <Button type="primary" round block @click="formRef?.submit()">提货</Button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </app-view>
|
|
|
- <app-contact v-model:show="showContact" @change="contactChange" />
|
|
|
- <app-receipt v-model:show="showReceipt" @change="receiptChange" />
|
|
|
+ <Field name="AppointmentRemark" type="textarea" label="发票信息" rows="2" autosize
|
|
|
+ v-model="formData.AppointmentRemark" placeholder="请填入发票信息" :rules="formRules.AppointmentRemark"
|
|
|
+ right-icon="add-o" @click-right-icon="showReceipt = true" />
|
|
|
+ </CellGroup>
|
|
|
+ </Form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="g-form__footer">
|
|
|
+ <Button type="primary" round block @click="formRef?.submit()">提货</Button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </app-view>
|
|
|
+ <app-contact v-model:show="showContact" @change="contactChange" />
|
|
|
+ <app-receipt v-model:show="showReceipt" @change="receiptChange" />
|
|
|
+ </template>
|
|
|
</app-modal>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, PropType } from 'vue'
|
|
|
+import { shallowRef, PropType, defineAsyncComponent } from 'vue'
|
|
|
import { CellGroup, Button, Field, Form, FormInstance, FieldRule, showFailToast, Radio, RadioGroup } from 'vant'
|
|
|
import { useWrOutInApply } from "@/business/trade";
|
|
|
import { fullloading, dialog } from '@/utils/vant'
|
|
|
@@ -67,6 +70,9 @@ import AppModal from '@/components/base/modal/index.vue'
|
|
|
import AppContact from '@mobile/components/modules/contact/index.vue'
|
|
|
import AppReceipt from '@mobile/components/modules/receipt/index.vue'
|
|
|
|
|
|
+// 地区选择
|
|
|
+const AppRegion = defineAsyncComponent(() => import('@mobile/components/base/region/index.vue'))
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
selectedRow: {
|
|
|
type: Object as PropType<Model.HoldLBRsp>,
|
|
|
@@ -79,11 +85,12 @@ const showContact = shallowRef(false) // 显示联系人选择列表
|
|
|
const showReceipt = shallowRef(false) // 显示发票选择列表
|
|
|
const showModal = shallowRef(true)
|
|
|
const refresh = shallowRef(false) // 是否刷新父组件数据
|
|
|
+const regionName = shallowRef('') // 地区名称
|
|
|
|
|
|
-const { formData, applySubmit, orderQty, checked } = useWrOutInApply(props.selectedRow)
|
|
|
+const { formData, applySubmit, orderQty } = useWrOutInApply(props.selectedRow)
|
|
|
|
|
|
// 表单验证规则
|
|
|
-const formRules: { [key in keyof Proto.WROutApplyReq | 'orderQty']?: FieldRule[] } = {
|
|
|
+const formRules: { [key in keyof Proto.WROutApplyReq | 'orderQty' | 'Region']?: FieldRule[] } = {
|
|
|
orderQty: [{
|
|
|
required: true,
|
|
|
message: '请输入提货数量',
|
|
|
@@ -102,8 +109,14 @@ const formRules: { [key in keyof Proto.WROutApplyReq | 'orderQty']?: FieldRule[]
|
|
|
return validateRules.phone.message
|
|
|
}
|
|
|
}],
|
|
|
+ Region: [{
|
|
|
+ message: '请选择目的地地区',
|
|
|
+ validator: () => {
|
|
|
+ return !!formData.ProvinceID && !!formData.CityID && !!formData.DistrictID
|
|
|
+ }
|
|
|
+ }],
|
|
|
Address: [{
|
|
|
- required: checked.value === 3,
|
|
|
+ required: true,
|
|
|
message: '请输入目的地地址',
|
|
|
}],
|
|
|
AppointmentRemark: [{
|
|
|
@@ -112,16 +125,23 @@ const formRules: { [key in keyof Proto.WROutApplyReq | 'orderQty']?: FieldRule[]
|
|
|
}],
|
|
|
}
|
|
|
|
|
|
+// 选择地区
|
|
|
+const onRegionFinish = ([province, city, district]: number[]) => {
|
|
|
+ formData.ProvinceID = province
|
|
|
+ formData.CityID = city
|
|
|
+ formData.DistrictID = district
|
|
|
+ formRef.value?.validate('Region')
|
|
|
+}
|
|
|
+
|
|
|
// 选择联系信息
|
|
|
const contactChange = (item: Model.UserReceiveInfoRsp) => {
|
|
|
formData.ContactName = item.receivername
|
|
|
formData.ContactNum = item.phonenum
|
|
|
-
|
|
|
- if (checked.value === 3) {
|
|
|
- formData.Address = [item.provincename, item.cityname, item.districtname, item.address].join(' ')
|
|
|
- } else {
|
|
|
- formData.Address = ''
|
|
|
- }
|
|
|
+ formData.ProvinceID = item.provinceid
|
|
|
+ formData.CityID = item.cityid
|
|
|
+ formData.DistrictID = item.districtid
|
|
|
+ formData.Address = item.address
|
|
|
+ regionName.value = [item.provincename, item.cityname, item.districtname].join(' ')
|
|
|
}
|
|
|
|
|
|
// 选择发票信息
|