Browse Source

fixed: 修改交收货款总额

huangbin 4 năm trước cách đây
mục cha
commit
4f92d3f005

+ 1 - 1
src/views/order/commodity_contract/components/commodity_contract_summary/components/commodity_contract_summary_settlement/index.vue

@@ -68,7 +68,7 @@
                 <span>,需合约数量</span>
                 <span class="white">{{getNeedContractNum()}}</span>
               </div>
-              <div class="yellow">升贴水{{selected ? selected.pricemove : '--'}}</div>
+              <div class="yellow">升贴水{{selected ? selected.pricemove * selected.num : '--'}}</div>
             </div>
             <div class="line2"
                  v-if="isBaseSpread()">

+ 20 - 3
src/views/order/commodity_contract/components/commodity_contract_summary/components/commodity_contract_summary_settlement/setup.ts

@@ -1,6 +1,6 @@
 import { handleDeliveryRelation } from "@/common/setup/deliveryRelation";
 import { getSelectedAccountId } from "@/services/bus/account";
-import { getQuoteDayInfoByCode } from "@/services/bus/goods";
+import { getGoodsByCode, getQuoteDayInfoByCode } from "@/services/bus/goods";
 import { QueryDeliveryRelationRsp } from "@/services/go/delivery/interface";
 import { QueryTradePositionRsp } from "@/services/go/ermcp/order/interface";
 import { queryWrDeliveryAvalidHoldLB } from "@/services/go/wrtrade";
@@ -72,12 +72,26 @@ export function handleCheck() {
 
 export function handleCalculation(selectedRow: QueryTradePositionRsp) {
     // 商品合约单位
-    const { agreeunit, goodscode, decimalplace, enableqty } = selectedRow
+    const { decimalplace, enableqty } = selectedRow
+    function getAgreeunit() {
+        let result = 1
+        const pgoodscode = selected.value?.pgoodscode
+        if (pgoodscode) {
+            const item = getGoodsByCode(pgoodscode)
+            if (item) {
+                result = item.agreeunit
+            }
+        }
+        return result
+    }
+
+
     function selctedNum() {
         return selected.value ? selected.value.num.toFixed(0) : '--'
     }
     // 选中数量的 最小变动值 = 合约单位 * 最小交割系数 * 仓单商品的单位r2
     function getStepValue() {
+        const agreeunit = getAgreeunit()
         if (deliveryGoods.value) {
             const { rratio2, mindeliveryqty } = deliveryGoods.value
             return agreeunit * mindeliveryqty * rratio2
@@ -88,6 +102,7 @@ export function handleCalculation(selectedRow: QueryTradePositionRsp) {
     // 可交收数量 = 合约可用手数 * 合约单位 * 最小交割系数 * (仓单商品的单位r2/合约商品的单位r1)
     function getCanSettlementNum() {
         if (deliveryGoods.value) {
+            const agreeunit = getAgreeunit()
             const { rratio1, rratio2, mindeliveryqty } = deliveryGoods.value
             const result = enableqty * agreeunit * mindeliveryqty * (rratio2 / rratio1)
             return result.toFixed(0)
@@ -100,6 +115,7 @@ export function handleCalculation(selectedRow: QueryTradePositionRsp) {
         let result = 0
         if (selected.value?.num) {
             if (deliveryGoods.value) {
+                const agreeunit = getAgreeunit()
                 const { rratio1, rratio2, mindeliveryqty, xdeliveryratio, pdeliveryratio } = deliveryGoods.value
                 result = selected.value.num / (agreeunit * mindeliveryqty * (rratio2 / rratio1))
             }
@@ -130,7 +146,8 @@ export function handleCalculation(selectedRow: QueryTradePositionRsp) {
         if (selected.value) {
             if (num !== '--' && price !== '--') {
                 if (deliveryGoods.value) {
-                    result = (+num) * (+price) * agreeunit + selected.value.pricemove
+                    const agreeunit = getAgreeunit()
+                    result = (+num) * (+price) * agreeunit + (selected.value.pricemove + selected.value.num)
                 }
             }
         }