|
@@ -6,18 +6,19 @@
|
|
|
<Form ref="formRef" @submit="onSubmit">
|
|
<Form ref="formRef" @submit="onSubmit">
|
|
|
<CellGroup>
|
|
<CellGroup>
|
|
|
<app-select v-model="formData.THJDeliveryMode" name="THJDeliveryMode" label="交割方式"
|
|
<app-select v-model="formData.THJDeliveryMode" name="THJDeliveryMode" label="交割方式"
|
|
|
- :rules="formRules.THJDeliveryMode" :options="details?.deliverymodes"
|
|
|
|
|
|
|
+ :rules="formRules.THJDeliveryMode" :options="details.deliverymodes"
|
|
|
:optionProps="{ label: 'enumdicname', value: 'enumitemname' }" />
|
|
:optionProps="{ label: 'enumdicname', value: 'enumitemname' }" />
|
|
|
<Field label="交割月份">
|
|
<Field label="交割月份">
|
|
|
<template #input>
|
|
<template #input>
|
|
|
- <app-select v-model="selectedMonth" placeholder="开始月份" :options="months" :is-link="false"
|
|
|
|
|
- @confirm="monthChange" />
|
|
|
|
|
- <app-select v-model="formData.PresaleApplyID" placeholder="结束日期" :options="days"
|
|
|
|
|
- :optionProps="{ label: 'enddate', value: 'presaleapplyid' }" :is-link="false" />
|
|
|
|
|
|
|
+ <app-select placeholder="开始月份" :options="deliveryMonths" :is-link="false"
|
|
|
|
|
+ @confirm="onMonthChange" />
|
|
|
|
|
+ <app-select v-model="presaleApplyId" placeholder="结束日期" :options="deliveryDays"
|
|
|
|
|
+ :optionProps="{ label: 'enddate', value: 'presaleapplyid' }" :is-link="false"
|
|
|
|
|
+ @confirm="onDayChange" />
|
|
|
</template>
|
|
</template>
|
|
|
</Field>
|
|
</Field>
|
|
|
- <Field v-model="formData.DepositID" name="refernum" label="支付方式" placeholder="必填"
|
|
|
|
|
- :rules="formRules.DepositID" />
|
|
|
|
|
|
|
+ <app-select v-model="formData.DepositID" name="DepositID" label="支付方式" :rules="formRules.DepositID"
|
|
|
|
|
+ :options="presaleApplyDeposits" />
|
|
|
<Field v-model="formData.Qty" name="Qty" type="digit" label="采购数量" placeholder="必填"
|
|
<Field v-model="formData.Qty" name="Qty" type="digit" label="采购数量" placeholder="必填"
|
|
|
:rules="formRules.Qty" />
|
|
:rules="formRules.Qty" />
|
|
|
</CellGroup>
|
|
</CellGroup>
|
|
@@ -34,11 +35,11 @@ import { useNavigation } from '@/hooks/navigation'
|
|
|
import { useWrstandardDetails } from '@/business/goods'
|
|
import { useWrstandardDetails } from '@/business/goods'
|
|
|
import { usePurchaseOrderDesting } from '@/business/trade'
|
|
import { usePurchaseOrderDesting } from '@/business/trade'
|
|
|
import AppSelect from '@mobile/components/base/select/index.vue'
|
|
import AppSelect from '@mobile/components/base/select/index.vue'
|
|
|
|
|
+import Long from 'long'
|
|
|
|
|
|
|
|
const { getQueryStringToNumber } = useNavigation()
|
|
const { getQueryStringToNumber } = useNavigation()
|
|
|
const wrstandardid = getQueryStringToNumber('wrstandardid')
|
|
const wrstandardid = getQueryStringToNumber('wrstandardid')
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
-const selectedMonth = shallowRef('') // 当前选中的交割月份
|
|
|
|
|
|
|
|
|
|
const { details, getWrstandardDetails } = useWrstandardDetails(wrstandardid)
|
|
const { details, getWrstandardDetails } = useWrstandardDetails(wrstandardid)
|
|
|
const { formData, formSubmit } = usePurchaseOrderDesting()
|
|
const { formData, formSubmit } = usePurchaseOrderDesting()
|
|
@@ -53,11 +54,11 @@ const formRules: { [key in keyof Proto.SpotPresaleDestingOrderReq]?: FieldRule[]
|
|
|
}],
|
|
}],
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 交割月份
|
|
|
|
|
-const months = computed(() => {
|
|
|
|
|
- const deliveryMonths = details.value?.deliverymonth ?? []
|
|
|
|
|
|
|
+// 交割月份列表
|
|
|
|
|
+const deliveryMonths = computed(() => {
|
|
|
|
|
+ const months = details.value.deliverymonth ?? []
|
|
|
const monthMap = new Map<string, { label: string, value: string; }>()
|
|
const monthMap = new Map<string, { label: string, value: string; }>()
|
|
|
- deliveryMonths.forEach(({ endmonth }) => {
|
|
|
|
|
|
|
+ months.forEach(({ endmonth }) => {
|
|
|
if (!monthMap.has(endmonth)) {
|
|
if (!monthMap.has(endmonth)) {
|
|
|
monthMap.set(endmonth, {
|
|
monthMap.set(endmonth, {
|
|
|
label: endmonth,
|
|
label: endmonth,
|
|
@@ -68,18 +69,35 @@ const months = computed(() => {
|
|
|
return [...monthMap.values()]
|
|
return [...monthMap.values()]
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-// 交割日期
|
|
|
|
|
-const days = computed(() => {
|
|
|
|
|
- const deliveryMonths = details.value?.deliverymonth ?? []
|
|
|
|
|
- return deliveryMonths.filter((e) => e.endmonth === selectedMonth.value)
|
|
|
|
|
|
|
+// 交割日期列表
|
|
|
|
|
+const deliveryDays = shallowRef<Model.THJWrstandardDetailRsp['deliverymonth']>([])
|
|
|
|
|
+// 当前选中的预售申请ID
|
|
|
|
|
+const presaleApplyId = shallowRef('')
|
|
|
|
|
+
|
|
|
|
|
+// 预售申请列表
|
|
|
|
|
+const presaleApplyDeposits = computed(() => {
|
|
|
|
|
+ const deposits = details.value.presaleapplydeposits ?? []
|
|
|
|
|
+ return deposits.map(({ depositrate, discountamount }) => ({
|
|
|
|
|
+ label: `${depositrate},${discountamount}`,
|
|
|
|
|
+ value: discountamount
|
|
|
|
|
+ }))
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const monthChange = (value: string) => {
|
|
|
|
|
- console.log(value)
|
|
|
|
|
|
|
+// 切换交割月份
|
|
|
|
|
+const onMonthChange = (value: string) => {
|
|
|
|
|
+ const months = details.value.deliverymonth ?? []
|
|
|
|
|
+ deliveryDays.value = months.filter((e) => e.endmonth === value)
|
|
|
|
|
+ presaleApplyId.value = ''
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 切换交割日期
|
|
|
|
|
+const onDayChange = (value: string) => {
|
|
|
|
|
+ presaleApplyId.value = value
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const onSubmit = () => {
|
|
const onSubmit = () => {
|
|
|
fullloading(() => {
|
|
fullloading(() => {
|
|
|
|
|
+ formData.PresaleApplyID = Long.fromString(presaleApplyId.value)
|
|
|
formSubmit().then(() => {
|
|
formSubmit().then(() => {
|
|
|
Toast.success('下单成功')
|
|
Toast.success('下单成功')
|
|
|
}).catch((err) => {
|
|
}).catch((err) => {
|