li.shaoyi 1 سال پیش
والد
کامیت
30d8414bd8

+ 38 - 16
src/packages/mobile/components/modules/delivery/index.vue

@@ -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, // 点选数量

+ 1 - 1
src/packages/mobile/components/modules/delivery/warehouse-receipt.vue

@@ -24,7 +24,7 @@
                                     </li>
                                     <li>
                                         <span>数量:</span>
-                                        <span>{{ item.avalidqty }}</span>
+                                        <span>{{ item.avalidqty + item.enumdicname }}</span>
                                     </li>
                                     <li>
                                         <span>升贴水:</span>

+ 1 - 1
src/packages/mobile/views/order/position/components/transfer/delivery/Index.vue

@@ -6,7 +6,7 @@
             <Cell title="持仓量" :value="selectedRow.buycurpositionqty" />
             <Cell title="可用量" :value="enableqty" />
         </template>
-        <template #form="{ qty, discount }">
+        <template #form="{ qty, discount }" v-if="false">
             <Field label="总货款">
                 <template #input>
                     {{ payment(qty).toFixed(2) }}

+ 33 - 8
src/packages/pc/components/modules/delivery/index.vue

@@ -1,8 +1,8 @@
 <!-- 交收操作 -->
 <template>
-    <app-drawer class="app-delivery" title="交收" :width="600" v-model:show="show" :loading="loading" :refresh="refresh">
+    <app-drawer class="app-delivery" title="交收" :width="680" v-model:show="show" :loading="loading" :refresh="refresh">
         <div class="app-delivery__header">
-            <slot name="header"></slot>
+            <slot name="header" :qtyStep="qtyStep" :goodunit="deliveryRelation?.enumdicname ?? ''"></slot>
         </div>
         <div class="app-delivery__form el-form--vertical" v-if="dataList.length">
             <table cellspacing="0" cellpadding="0">
@@ -12,12 +12,13 @@
                         <th>升贴水</th>
                         <th>数量</th>
                         <th>交收数量</th>
+                        <th></th>
                     </tr>
                 </thead>
                 <template v-for="(item, index) in dataList" :key="index">
                     <tbody>
                         <tr>
-                            <td colspan="4">
+                            <td colspan="5">
                                 <span>{{ item.username }}</span>
                             </td>
                         </tr>
@@ -30,8 +31,9 @@
                             <td>{{ item.avalidqty }}</td>
                             <td>
                                 <el-input-number placeholder="请输入" v-model="item.deliveryLot" :precision="0"
-                                    :max="maxQty(index)" :min="0" />
+                                    :max="maxQty(index)" :min="0" :step="qtyStep" step-strictly />
                             </td>
+                            <td>{{ item.enumdicname }}</td>
                         </tr>
                     </tbody>
                     <tbody class="spacing" v-if="(dataList.length - 1) > index"></tbody>
@@ -41,7 +43,7 @@
         <div class="app-delivery__empty" v-else>暂无数据</div>
         <template #footer>
             <div class="app-delivery__details">
-                <slot name="footer" :discount="discount" :qty="qty"></slot>
+                <slot name="footer" :discount="discount" :qty="qty" :qtyStep="qtyStep" :goodunit="deliveryRelation?.enumdicname ?? ''"></slot>
             </div>
             <div class="app-delivery__btnbar">
                 <el-button type="info" @click="onCancel(false)">取消</el-button>
@@ -60,7 +62,8 @@ import { ClientType } from '@/constants/client'
 import { useRequest } from '@/hooks/request'
 import { queryWrDeliveryAvalidHoldLB } from '@/services/api/transfer'
 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 AppDrawer from '@pc/components/base/drawer/index.vue'
 
@@ -76,6 +79,7 @@ const props = defineProps({
 })
 
 const accountStore = useAccountStore()
+const futuresStore = useFuturesStore()
 const show = ref(true)
 const refresh = ref(false)
 const loading = ref(false)
@@ -93,6 +97,27 @@ useRequest(queryWrDeliveryAvalidHoldLB, {
     }
 })
 
+// 查询商品交割关系
+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 qty = computed(() => dataList.value.reduce((pre, cur) => pre + cur.deliveryLot, 0))
 
@@ -105,7 +130,7 @@ const discount = computed(() => {
 const maxQty = (index: number) => {
     const item = dataList.value[index]
     const count = dataList.value.reduce((pre, cur, i) => i === index ? pre : pre + cur.deliveryLot, 0) // 计算已点选数量
-    const max = props.total - count
+    const max = props.total * qtyStep.value - count
     return max >= item.avalidqty ? item.avalidqty : max
 }
 
@@ -129,7 +154,7 @@ const onSubmit = async () => {
                         DeliveryGoodsID: e.deliverygoodsid,
                         ClientSerialNo: v4(),
                         ClientOrderTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
-                        XQty: e.deliveryLot,
+                        XQty: e.deliveryLot / qtyStep.value,
                         DeliveryQty: e.deliveryLot,
                         DeliveryOrderDetail: {
                             AccountID: e.accountid, // 对手方账号

+ 4 - 0
src/packages/pc/views/footer/goods/delivery/index.vue

@@ -2,6 +2,10 @@
 <template>
     <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading" :row-key="rowKey"
         :expand-row-keys="expandKeys" @row-click="rowClick">
+        <!-- 交收数量 -->
+        <template #deliveryqty="{ row }">
+            {{ row.deliveryqty + row.goodsunit }}
+        </template>
         <!-- 申请时间 -->
         <template #reqtime="{ value }">
             {{ formatDate(value) }}

+ 10 - 6
src/packages/pc/views/footer/goods/position/components/delivery16/index.vue

@@ -1,24 +1,28 @@
 <!-- 商品订单-合约汇总-交收 -->
 <template>
     <Delivery v-bind="{ goodsId: selectedRow.goodsid, total: selectedRow.enableqty }">
-        <template #header>
+        <template #header="{ qtyStep, goodunit }">
+            <span>{{ selectedRow.goodsname }}</span>
             <span>持仓量:{{ selectedRow.curpositionqty }}</span>
             <span>可用量:{{ selectedRow.enableqty }}</span>
+            <span>可交收数量:{{ (selectedRow.enableqty * qtyStep) + goodunit }}</span>
         </template>
-        <template #footer="{ discount, qty }">
+        <template #footer="{ qty, qtyStep, discount, goodunit }">
             <ul>
                 <li>
-                    <span>{{ selectedRow.goodsname }}</span>
-                    <span :class="selectedRow.lastColor">{{ selectedRow.lastprice }}</span>
+                    <span :class="selectedRow.lastColor">现价:{{ selectedRow.lastprice }}</span>
                 </li>
                 <li>
-                    <span>已点数量:{{ qty }}</span>
+                    <span>所需合约量:{{ qty / qtyStep }}</span>
                 </li>
             </ul>
             <ul>
-                <li style="margin-left: auto;">
+                <li>
                     <span>升贴水:{{ discount.toFixed(2) }}</span>
                 </li>
+                <li>
+                    <span>已点数量:{{ qty + goodunit }}</span>
+                </li>
             </ul>
         </template>
     </Delivery>

+ 6 - 2
src/packages/pc/views/footer/presell/onlinedelivery/index.vue

@@ -1,6 +1,10 @@
 <!-- 预售转让- 点选交收 -->
 <template>
     <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading">
+        <!-- 交收数量 -->
+        <template #deliveryqty="{ row }">
+            {{ row.deliveryqty + row.enumdicname }}
+        </template>
         <!-- 交收合约 -->
         <template #xgoodsname="{ row }">
             {{ row.xgoodscode }}/{{ row.xgoodsname }}
@@ -26,8 +30,8 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'deliveryqty', label: '交收数量' },
     { prop: 'xdeliveryprice', label: '订货价' },
     { prop: 'deliverypricemove', label: '升贴水' },
-    { prop: 'deliveryamount', label: '总货款' },
-    { prop: 'xgoodsremainamount', label: '剩余货款' },
+    // { prop: 'deliveryamount', label: '总货款' },
+    // { prop: 'xgoodsremainamount', label: '剩余货款' },
     { prop: 'deliverytotalamount', label: '总金额' },
     { prop: 'remaintotalamount', label: '剩余金额' },
     { prop: 'warehousename', label: '仓库' },

+ 14 - 12
src/packages/pc/views/footer/presell/transferposition/delivery/index.vue

@@ -1,35 +1,37 @@
 <!-- 预售转让-转让持仓-交收申请 -->
 <template>
     <Delivery v-bind="{ goodsId: selectedRow.goodsid, total: enableqty }">
-        <template #header>
+        <template #header="{ qtyStep, goodunit }">
+            <span>{{ selectedRow.goodscode }}/{{ selectedRow.goodsname }}</span>
             <span>持仓量:{{ selectedRow.buycurpositionqty }}</span>
             <span>可用量:{{ enableqty }}</span>
+            <span>可交收数量:{{ (enableqty * qtyStep) + goodunit }}</span>
         </template>
-        <template #footer="{ qty, discount }">
+        <template #footer="{ qty, qtyStep, discount, goodunit }">
             <ul>
                 <li>
-                    <span>{{ selectedRow.goodscode }}/{{ selectedRow.goodsname }}</span>
+                    <span>升贴水:{{ discount.toFixed(2) }}</span>
                 </li>
                 <li>
-                    <span>已点数量:{{ qty }}</span>
+                    <span>所需合约量:{{ qty / qtyStep }}</span>
                 </li>
             </ul>
             <ul>
-                <li>
-                    <span>总货款:{{ payment(qty).toFixed(2) }}</span>
-                </li>
-                <li>
-                    <span>升贴水:{{ discount.toFixed(2) }}</span>
+                <!-- <li>
+                    <span>已付定金:{{ deposit(qty).toFixed(2) }}</span>
+                </li> -->
+                <li style="margin-left: auto;">
+                    <span>已点数量:{{ qty + goodunit }}</span>
                 </li>
             </ul>
-            <ul>
+            <!-- <ul>
                 <li>
-                    <span>已付定金:{{ deposit(qty).toFixed(2) }}</span>
+                    <span>总货款:{{ payment(qty).toFixed(2) }}</span>
                 </li>
                 <li>
                     <span>剩余金额:{{ available(qty, discount).toFixed(2) }}</span>
                 </li>
-            </ul>
+            </ul> -->
         </template>
     </Delivery>
 </template>

+ 10 - 0
src/services/api/goods/index.ts

@@ -178,3 +178,13 @@ export function queryTouristQuoteDay(config: RequestConfig<Model.QuoteDayReq> =
         params: config.data,
     })
 }
+
+/**
+ * 查询商品交割关系表
+ */
+export function queryDeliveryRelation(config: RequestConfig<Model.DeliveryRelationReq> = {}) {
+    return http.commonRequest<Model.DeliveryRelationRsp[]>({
+        url: '/Delivery/QueryDeliveryRelation',
+        params: config.data,
+    })
+}

+ 41 - 0
src/types/model/goods.d.ts

@@ -524,4 +524,45 @@ declare namespace Model {
         itemtypename: string; // 要素项类型名称
         wrstandardid: number; // 品类
     }
+
+    /** 查询商品交割关系表 请求 */
+    interface DeliveryRelationReq {
+        goodsid?: number; // 商品ID
+        deliverygoodsid?: number; // 品种ID
+        marketid?: number; // 市场ID
+    }
+
+    /** 查询商品交割关系表 响应 */
+    interface DeliveryRelationRsp {
+        begindate: string; // 起始日期(yyyyMMdd)
+        buytemplateid: number; // 买履约计划模板ID
+        deliverygoodscode: string; // 品种代码
+        deliverygoodsid: number; // 交割商品
+        deliverygoodsname: string; // 品种名称
+        deliverymode: number; // 交割方式 - 1:点选式 2:申报式
+        deliverypricerule: number; // 交割价规则- 1:行情价 2:建仓价
+        deliverytype: number; // 交割模式 - 1:X交割 2:X+P交割 3:X+C交割 4:X+P+C交割
+        enddate: string; // 结束日期(yyyyMMdd)
+        enumdicname: string; // 品类单位名称
+        goodscode: string; // 商品代码
+        goodsid: number; // 交易合约ID
+        goodsname: string; // 商品名称
+        marketid: number; // 市场ID
+        mindeliveryqty: number; // 最小交割系数(K)
+        p2deliveryprice: number; // P2合约价格(商品价时填写0,固定值时填写固定值)
+        p2deliveryratio: number; // P2合约系数(p)
+        p2goodsid: number; // P2合约ID
+        p2pricemode: number; // P2合约价格方式 - 1:商品价 2:固定值
+        pdeliveryprice: number; // P合约价格(商品价时填写0,固定值时填写固定值)
+        pdeliveryratio: number; // P合约系数(n)
+        pgoodscode: string; // p合约代码
+        pgoodsid: number; // P合约ID
+        ppricemode: number; // P合约价格方式 - 1:商品价 2:固定值
+        rratio: number; // 兑换系数(R)
+        rratio1: number; // 兑换系数(交易合约)(R1)
+        rratio2: number; // 兑换系数(仓单标准)(R2)
+        selltemplateid: number; // 卖履约计划模板ID
+        wrstandardid: number; // 仓单标准ID
+        xdeliveryratio: number; // 交易合约系数(m)
+    }
 }