Forráskód Böngészése

修改现货合同

huangbin 4 éve
szülő
commit
d13c6161ce

+ 2 - 12
src/views/information/goods/components/modify/index.vue

@@ -285,6 +285,7 @@ import { FormState, WRSConvertDetailEx } from './interface';
 import { validateCommon } from '@/common/setup/validate';
 import { initDG } from '../../list/spot-variety/setup';
 import { ErmcpDeliveryGoodsDetailEx, ErmcpDeliveryGoods } from '@/services/go/ermcp/goodsInfo/interface';
+import { mergeTwoObj } from '@/utils/objHandle';
 interface Obj {
     [props: string]: any;
 }
@@ -374,18 +375,7 @@ export default defineComponent({
         watchEffect(() => {
             if (props.selctedDeliveryGoods.data.deliverygoodsname) {
                 const { data, gblist, gmlist, mgList } = props.selctedDeliveryGoods;
-                console.log('props.selctedDeliveryGoods', props.selctedDeliveryGoods);
-                // 处理第一次加载的
-                const obj: Obj = {};
-                Object.keys(formState).forEach((el) => {
-                    const key = el.toLocaleLowerCase() as keyof ErmcpDeliveryGoods;
-                    if (Reflect.has(data, key)) {
-                        obj[el] = data[key];
-                    } else {
-                        console.warn(`${key}不对应`);
-                    }
-                });
-                Object.assign(formState, obj);
+                mergeTwoObj(formState, props.selctedDeliveryGoods);
                 // 单位
                 formState.unitid = data.agreeunit;
                 // 品类

+ 2 - 2
src/views/information/spot-contract/components/add/setup.ts

@@ -32,8 +32,8 @@ export function addContractReq() {
             SpotGoodsDesc: form.SpotGoodsDesc, //                商品规格
             PriceType: form.PriceType,//                         定价类型
             CurrencyID: form.CurrencyID as number,//             结算币种
-            Qty: Number(form.Qty as number), //                     数量
-            Price: Number(form.Price as number), //                 价格
+            Qty: Number(form.Qty), //                     数量
+            Price: Number(form.Price), //                 价格
             TradeDate: moment().format("YYYYMMDD"),//             交易日
             SignDate: moment().format("YYYY-MM-DD HH:mm:ss"), //  签订日期
             // 以上必填

+ 2 - 2
src/views/information/spot-contract/components/interface.ts

@@ -14,8 +14,8 @@ export interface FormState {
     ConvertFactor: number | undefined  // double 标仓系数
     SpotGoodsDesc: string // string 商品型号
     PriceType: number // uint32 定价类型-1:一口价2:点价3:暂定价
-    Qty: number | null // double 数量
-    Price: number | null// double 价格暂定价[1:一口价、3:暂定价]
+    Qty: string // double 数量
+    Price: string// double 价格暂定价[1:一口价、3:暂定价]
     Amount: number | null// double 金额[1:一口价、3:暂定价]
     DeliveryStartDate: string// string 交收期(开始)
     DeliveryEndDate: string // string 交收期(结束)

+ 9 - 15
src/views/information/spot-contract/components/modify/index.vue

@@ -1,7 +1,7 @@
 <template>
-  <!-- 修改现货合同-->
+  <!-- 重新提交现货合同-->
   <a-modal class="commonModal modify-custom"
-           title="修改现货合同"
+           title="重新提交现货合同"
            v-if="visible"
            v-model:visible="visible"
            @cancel="cancel"
@@ -418,7 +418,8 @@ import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 import { handleAccountManager } from '../setup';
 import { Moment } from 'moment';
 import { handleFormRule, handleContract, handleDeliveryGoods, handleAmout, handlePrice, handleDate, handleFromState } from '../setup';
-import {addContractReq} from "@/views/information/spot-contract/components/add/setup";
+import { addContractReq } from '@/views/information/spot-contract/components/add/setup';
+import { mergeTwoObj } from '@/utils/objHandle';
 
 interface Obj {
     [props: string]: any;
@@ -463,18 +464,11 @@ export default defineComponent({
             // formState.ContractAttachment = new Uint8Array()
             // formState.SpotGoodsBrandID = +props.selectedRow.spotcontractid
             if (props.selectedRow.contractno) {
-                // 处理第一次加载的
-                const obj: Obj = {};
-                Object.keys(formState).forEach((el) => {
-                    const key = el.toLocaleLowerCase() as keyof Ermcp3ContractRsp;
-                    if (Reflect.has(props.selectedRow, key)) {
-                        obj[el] = props.selectedRow[key];
-                    } else {
-                        console.warn(`${key}不对应`);
-                    }
-                });
-                Object.assign(formState, obj);
-                props.selectedRow.deliverygoodsid && deliveryGoodsChange(props.selectedRow.deliverygoodsid);
+                mergeTwoObj(formState, props.selectedRow);
+                const { deliverygoodsid, qty, price } = props.selectedRow;
+                deliverygoodsid && deliveryGoodsChange(deliverygoodsid);
+                formState.Qty = qty.toString();
+                formState.Price = price.toString();
             }
         });
         function submit() {

+ 3 - 3
src/views/information/spot-contract/components/setup.ts

@@ -149,8 +149,8 @@ export function handleFromState() {
         ConvertFactor: undefined,// double 标仓系数
         SpotGoodsDesc: '', // string 商品型号
         PriceType: 1, // uint32 定价类型-1:一口价2:点价3:暂定价
-        Qty: null, // double 数量
-        Price: null,// double 价格暂定价[1:一口价、3:暂定价]
+        Qty: '', // double 数量
+        Price: '',// double 价格暂定价[1:一口价、3:暂定价]
         Amount: null, // double 金额[1:一口价、3:暂定价]
         DeliveryStartDate: '', // string 交收期(开始)
         DeliveryEndDate: '', // string 交收期(结束)
@@ -406,7 +406,7 @@ export function handleDate() {
 export function handleAmout(formState: UnwrapRef<FormState>) {
     function getAmout() {
         const { Price, Qty } = formState
-        formState.Amount = (Price && Qty) ? Price * Qty : 0
+        formState.Amount = (Price && Qty) ? Number(Price) * Number(Qty) : 0
     }
     return { getAmout }
 }