Переглянути джерело

Merge remote-tracking branch 'origin/master'

xkwg 4 роки тому
батько
коміт
4ab35ba985

+ 10 - 4
src/views/information/spot-contract/components/add/index.vue

@@ -233,6 +233,7 @@
               <a-input class="dialogInput suffixGrey"
                        v-model:value="formState.Qty"
                        style="width: 200px"
+                       @change="getAmout"
                        placeholder="请输入数量"
                        :suffix="numberUnit" />
             </a-form-item>
@@ -298,6 +299,7 @@
                            name="Price">
                 <a-input class="dialogInput suffixGrey"
                          v-model:value="formState.Price"
+                         @change="getAmout"
                          placeholder="请输入价格"
                          :suffix="`${payCurrencyUnit}/${numberUnit}`"
                          style="width: 200px" />
@@ -305,8 +307,10 @@
             </a-col>
             <a-col :span="12">
               <a-form-item label="金额"
-                           class="relative">
+                           class="relative"
+                           name="Amount">
                 <a-input class="dialogInput suffixGrey"
+                         v-model:value="formState.Amount"
                          readonly
                          placeholder="输入数量和价格后自动算"
                          :suffix="payCurrencyUnit"
@@ -400,7 +404,7 @@
 import {defineComponent, PropType, ref, toRaw} from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods';
-import { handleFromState, handleContract, handlevalidate, handleDeliveryGoods, handlePrice, handleDate, addContractReq } from './setup';
+import { handleFromState, handleContract, handlevalidate, handleDeliveryGoods, handleAmout, handlePrice, handleDate, addContractReq } from './setup';
 import { getUserName, getUsrId } from '@/services/bus/user';
 import { getGoodsList } from '@/services/bus/goods';
 import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
@@ -432,7 +436,7 @@ export default defineComponent({
         const rules = {
             ContractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
             ContractType: [{ required: true, validator: v_ContractType, trigger: 'change' }],
-            BizType: [{ required: true, validator: v_BizType, trigger: 'change' }],
+            // BizType: [{ required: true, validator: v_BizType, trigger: 'change' }],
             BuyUserID: [{ required: true, validator: v_BuyUser, trigger: 'change' }],
             SellUserID: [{ required: true, validator: v_SellUser, trigger: 'change' }],
             DeliveryGoodsID: [{ required: true, validator: v_DeliveryGoods, trigger: 'change' }],
@@ -453,6 +457,8 @@ export default defineComponent({
         const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
         // 日期
         const { deliveryDate, priceDate, disabledDate } = handleDate();
+        // 处理金额
+        const { getAmout } = handleAmout(formState);
         // 现货商品列表
         const goodsList = ref<Goods[]>([]);
         function submit(OperateType: number) {
@@ -496,7 +502,6 @@ export default defineComponent({
             queryCustomList();
             getDeliveryGoods();
             goodsList.value = getGoodsList();
-            console.log('goodsList.value', goodsList.value);
         });
         return {
             visible,
@@ -527,6 +532,7 @@ export default defineComponent({
             priceDate,
             disabledDate,
             goodsList,
+            getAmout,
         };
     },
 });

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

@@ -1,19 +1,17 @@
-import {validateCommon} from '@/common/setup/validate';
-import {getItemEnum} from '@/services/bus/allEnum';
-import {QueryCustomInfo} from '@/services/go/ermcp/customInfo';
-import {QueryCustomInfoType} from '@/services/go/ermcp/customInfo/interface';
-import {QueryDeliveryGoods, QueryDeliveryGoodsDetail} from '@/services/go/ermcp/goodsInfo';
-import {Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsRsp} from '@/services/go/ermcp/goodsInfo/interface';
-import {message} from 'ant-design-vue';
-import {RuleObject} from 'ant-design-vue/lib/form/interface';
-import moment, {Moment} from 'moment';
-import {reactive, ref, UnwrapRef} from 'vue';
-import {FormState} from "./interface";
-import {changeOrderContract} from "@/views/information/spot-contract/components/setup";
-import {GldErmcpSpotContractOperateReq, GldSpotContractInfo} from "@/services/proto/spotcontract/interface";
-import {getServerTime} from "@/services/go/commonService";
+import { validateCommon } from '@/common/setup/validate';
 import APP from "@/services";
-import {orderContract} from "@/services/proto/spotcontract";
+import { getItemEnum } from '@/services/bus/allEnum';
+import { QueryCustomInfo } from '@/services/go/ermcp/customInfo';
+import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
+import { QueryDeliveryGoods, QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
+import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsRsp } from '@/services/go/ermcp/goodsInfo/interface';
+import { GldSpotContractInfo } from "@/services/proto/spotcontract/interface";
+import { changeOrderContract } from "@/views/information/spot-contract/components/setup";
+import { message } from 'ant-design-vue';
+import { RuleObject } from 'ant-design-vue/lib/form/interface';
+import moment, { Moment } from 'moment';
+import { reactive, ref, UnwrapRef } from 'vue';
+import { FormState } from "./interface";
 
 export function handleFromState() {
     const formState: UnwrapRef<FormState> = reactive({
@@ -48,17 +46,17 @@ export function handleFromState() {
     })
     // 业务类型
     const businessType = [
-        {key: 1, value: '套保'},
-        {key: 2, value: '套利'},
+        { key: 1, value: '套保' },
+        { key: 2, value: '套利' },
     ];
-    return {formState, businessType}
+    return { formState, businessType }
 }
 
 /**
  * 新增现货合同 表单提交
  */
 export function addContractReq() {
-    const {loading, orderContractState} = changeOrderContract()
+    const { loading, orderContractState } = changeOrderContract()
     /**
      * @param form 表单信息
      *  @Param type  1: 保存草稿  2: 提交申请
@@ -89,7 +87,7 @@ export function addContractReq() {
             // ContractAttachment: ,  // 合同附件
             ContractMargin: form.ContractMargin as number, //         合同保证金
 
-            Amount: [1,3].includes(form.PriceType)  ? Number(form.Price) * Number(form.Qty) : 0, //    金额
+            Amount: [1, 3].includes(form.PriceType) ? Number(form.Price) * Number(form.Qty) : 0, //    金额
             PriceMove: form.PriceMove as number, //  升贴水
 
             StartDate: form.StartDate, //                       点价开始时间
@@ -103,7 +101,6 @@ export function addContractReq() {
             // TradeUserID: form.TradeUserID, //           交易员ID
             // SaleUserID: form.SaleUserID,//             业务员id
         }
-        debugger
         return orderContractState('0', type, info)
             .then(res => {
                 return Promise.resolve(res);
@@ -113,7 +110,7 @@ export function addContractReq() {
             })
     }
 
-    return {loading, sendReq}
+    return { loading, sendReq }
 }
 
 /**
@@ -122,8 +119,8 @@ export function addContractReq() {
 export function handleContract() {
     // 合同类型
     const contractType = [
-        {key: 1, value: '采购'},
-        {key: -1, value: '销售'},
+        { key: 1, value: '采购' },
+        { key: -1, value: '销售' },
     ];
     const isSell = ref<boolean>(false)  // true => 销售 false => 采购
     /**
@@ -146,7 +143,7 @@ export function handleContract() {
             })
     }
 
-    return {contractType, isSell, contractChange, customList, queryCustomList}
+    return { contractType, isSell, contractChange, customList, queryCustomList }
 }
 
 /**
@@ -289,9 +286,9 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
 export function handlePrice(formState: UnwrapRef<FormState>) {
     // 定价类型
     const priceType = [
-        {key: 1, value: '一口价'},
-        {key: 2, value: '点价'},
-        {key: 3, value: '暂定价'},
+        { key: 1, value: '一口价' },
+        { key: 2, value: '点价' },
+        { key: 3, value: '暂定价' },
     ];
     // 币种
     const payCurrency = getItemEnum('paycurrency')
@@ -307,13 +304,7 @@ export function handlePrice(formState: UnwrapRef<FormState>) {
         // payCurrencyUnit.value = obj?.enumdicname
     }
 
-    return {priceType, payCurrency, payCurrencyUnit, parCurrencyChange}
-}
-
-export function handleAddAction() {
-    function addAction() {
-        // orderContract()
-    }
+    return { priceType, payCurrency, payCurrencyUnit, parCurrencyChange }
 }
 
 /**
@@ -330,5 +321,15 @@ export function handleDate() {
         return current && current < moment().endOf('day');
     }
 
-    return {deliveryDate, priceDate, disabledDate}
+    return { deliveryDate, priceDate, disabledDate }
 }
+/**
+ * 处理金额
+ */
+export function handleAmout(formState: UnwrapRef<FormState>) {
+    function getAmout() {
+        const { Price, Qty } = formState
+        formState.Amount = (Price && Qty) ? Price * Qty : 0
+    }
+    return { getAmout }
+}

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

@@ -82,3 +82,4 @@ export function OrderContractControl() {
 
     return { loading, orderContractState }
 }
+