|
|
@@ -10,26 +10,24 @@
|
|
|
<slot name="header"></slot>
|
|
|
</CellGroup>
|
|
|
<CellGroup title="交收信息" inset>
|
|
|
- <Field name="wrstandardname" label="点选仓单" placeholder="请选择" :rules="formRules.wrstandardname"
|
|
|
+ <Field name="wrstandardname" label="点选仓单" placeholder="请选择" input-align="right" :rules="formRules.wrstandardname"
|
|
|
v-model="checkedRow.wrstandardname" @click="showWarehouseReceipt = true" is-link readonly />
|
|
|
<template v-if="checkedRow.deliverygoodsid">
|
|
|
- <Field label="持有人" v-model="checkedRow.username" readonly />
|
|
|
- <Field label="仓库" v-model="checkedRow.warehousename" readonly />
|
|
|
- <Field label="数量" v-model="checkedRow.avalidqty" readonly />
|
|
|
+ <Cell title="持有人" :value="checkedRow.username" />
|
|
|
+ <Cell title="仓库" :value="checkedRow.warehousename" />
|
|
|
+ <Cell title="数量" :value="checkedRow.avalidqty + (deliveryRelation?.enumdicname ?? '')" />
|
|
|
</template>
|
|
|
</CellGroup>
|
|
|
<CellGroup inset>
|
|
|
- <Field name="DeliveryQty" type="digit" :rules="formRules.DeliveryQty" label="交收量">
|
|
|
+ <Cell title="可交收数量" :value="(total * qtyStep) + (deliveryRelation?.enumdicname ?? '')" />
|
|
|
+ <Field name="DeliveryQty" type="digit" :rules="formRules.DeliveryQty" label="交收数量">
|
|
|
<template #input>
|
|
|
<Stepper v-model="formData.DeliveryQty" theme="round" button-size="22" :min="0" :max="maxQty"
|
|
|
- integer />
|
|
|
- </template>
|
|
|
- </Field>
|
|
|
- <Field label="升贴水">
|
|
|
- <template #input>
|
|
|
- {{ discount.toFixed(2) }}
|
|
|
+ :step="qtyStep" integer />
|
|
|
</template>
|
|
|
</Field>
|
|
|
+ <Cell title="所需合约量" :value="(formData.DeliveryQty ?? 0) / qtyStep" />
|
|
|
+ <Cell title="升贴水" :value="discount.toFixed(2)" />
|
|
|
<slot name="form" :discount="discount" :qty="formData.DeliveryQty ?? 0"></slot>
|
|
|
</CellGroup>
|
|
|
</Form>
|
|
|
@@ -44,12 +42,14 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { reactive, shallowRef, computed, defineAsyncComponent } from 'vue'
|
|
|
import { v4 } from 'uuid'
|
|
|
-import { CellGroup, Button, FieldRule, Form, Field, Stepper, FormInstance } from 'vant'
|
|
|
+import { CellGroup, Cell, Button, FieldRule, Form, Field, Stepper, FormInstance } from 'vant'
|
|
|
import { handleRequestBigNumber } from '@/filters'
|
|
|
import { dialog, fullloading } from '@/utils/vant'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
import { ClientType } from '@/constants/client'
|
|
|
import { deliveryOrder } from '@/services/api/trade'
|
|
|
-import { useAccountStore } from '@/stores'
|
|
|
+import { queryDeliveryRelation } from '@/services/api/goods'
|
|
|
+import { useAccountStore, useFuturesStore } from '@/stores'
|
|
|
import moment from 'moment'
|
|
|
import AppModal from '@/components/base/modal/index.vue'
|
|
|
|
|
|
@@ -67,6 +67,7 @@ const props = defineProps({
|
|
|
const WarehouseReceipt = defineAsyncComponent(() => import('./warehouse-receipt.vue'))
|
|
|
|
|
|
const accountStore = useAccountStore()
|
|
|
+const futuresStore = useFuturesStore()
|
|
|
const showModal = shallowRef(true)
|
|
|
const refresh = shallowRef(false) // 是否刷新父组件数据
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
@@ -79,10 +80,31 @@ const formData = reactive<Partial<Proto.DeliveryOrderReq>>({
|
|
|
XGoodsID: props.goodsId
|
|
|
})
|
|
|
|
|
|
+// 查询商品交割关系
|
|
|
+const { data: deliveryRelation } = useRequest(queryDeliveryRelation, {
|
|
|
+ params: {
|
|
|
+ goodsid: props.goodsId,
|
|
|
+ },
|
|
|
+ onSuccess: (res) => {
|
|
|
+ deliveryRelation.value = res.data[0]
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+// 数量步长
|
|
|
+const qtyStep = computed(() => {
|
|
|
+ const quote = futuresStore.getGoodsQuote(props.goodsId)
|
|
|
+ const { agreeunit = 1 } = quote.value ?? {}
|
|
|
+ const { mindeliveryqty = 0, rratio1 = 0, rratio2 = 0 } = deliveryRelation.value ?? {}
|
|
|
+ if (rratio2 && rratio1) {
|
|
|
+ return agreeunit * mindeliveryqty * (rratio2 / rratio1)
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+})
|
|
|
+
|
|
|
// 可选最大交收数量
|
|
|
const maxQty = computed(() => {
|
|
|
const avalidqty = checkedRow.value.avalidqty ?? 0
|
|
|
- const enableqty = props.total
|
|
|
+ const enableqty = props.total * qtyStep.value
|
|
|
return avalidqty > enableqty ? enableqty : avalidqty
|
|
|
})
|
|
|
|
|
|
@@ -98,7 +120,7 @@ const formRules: { [key: string]: FieldRule[] } = {
|
|
|
}
|
|
|
}],
|
|
|
DeliveryQty: [{
|
|
|
- message: '请输入交收量',
|
|
|
+ message: '请输入交收数量',
|
|
|
validator: () => {
|
|
|
return !!formData.DeliveryQty
|
|
|
}
|
|
|
@@ -119,7 +141,7 @@ const onSubmit = () => {
|
|
|
fullloading((hideLoading) => {
|
|
|
const item = checkedRow.value
|
|
|
formData.DeliveryGoodsID = item.deliverygoodsid
|
|
|
- formData.XQty = formData.DeliveryQty
|
|
|
+ formData.XQty = (formData.DeliveryQty ?? 0) / qtyStep.value
|
|
|
formData.DeliveryOrderDetail = {
|
|
|
AccountID: item.accountid, // 对手方账号
|
|
|
Qty: formData.DeliveryQty, // 点选数量
|