Quellcode durchsuchen

修改现货合同

huangbin vor 4 Jahren
Ursprung
Commit
66f72b45d0

+ 22 - 6
src/views/information/spot-contract/components/add/index.vue

@@ -230,8 +230,10 @@
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="数量">
+            <a-form-item label="数量"
+                         name="Qty">
               <a-input class="dialogInput suffixGrey"
+                       v-model:value="formState.Qty"
                        placeholder="请输入数量"
                        :suffix="numberUnit" />
             </a-form-item>
@@ -310,8 +312,10 @@
           <!-- 以上是点价的价格信息 end -->
           <template v-if="formState.PriceType === 1">
             <a-col :span="12">
-              <a-form-item label="价格">
+              <a-form-item label="价格"
+                           name="Price">
                 <a-input class="dialogInput suffixGrey"
+                         v-model:value="formState.Price"
                          placeholder="请输入价格"
                          :suffix="`${payCurrencyUnit}/${numberUnit}`"
                          style="width: 200px" />
@@ -329,7 +333,11 @@
             </a-col>
             <a-col :span="24">
               <a-form-item label="交收期">
-                <a-select class="inlineFormSelect"
+                <a-range-picker v-model:value="deliveryDate"
+                                :disabled-date="disabledDate"
+                                :show-time="{hideDisabledOptions: true}"
+                                format="YYYY-MM-DD" />
+                <!-- <a-select class="inlineFormSelect"
                           style="width: 95px"
                           placeholder="请选择定价类型">
                   <a-select-option value="1">
@@ -343,7 +351,7 @@
                   <a-select-option value="1">
                     日期二
                   </a-select-option>
-                </a-select>
+                </a-select> -->
               </a-form-item>
             </a-col>
           </template>
@@ -422,7 +430,7 @@
 import { defineComponent, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods';
-import { handleFromState, handleContract, handlevalidate, handleDeliveryGoods, handlePrice } from './setup';
+import { handleFromState, handleContract, handlevalidate, handleDeliveryGoods, handlePrice, handleDate } from './setup';
 import { getUserName } from '@/services/bus/user';
 
 export default defineComponent({
@@ -438,7 +446,7 @@ export default defineComponent({
         // 合同类型
         const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract();
         // 自定义表单验证方法
-        const { v_ContractType, v_BizType, v_BuyUser, v_SellUser, v_DeliveryGoods, v_WrStandard, v_SpotGoodsBrand } = handlevalidate(formState);
+        const { v_ContractType, v_BizType, v_BuyUser, v_SellUser, v_DeliveryGoods, v_WrStandard, v_SpotGoodsBrand, v_PriceType, v_Currency } = handlevalidate(formState);
         const rules = {
             ContractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
             ContractType: [{ required: true, validator: v_ContractType, trigger: 'change' }],
@@ -450,11 +458,17 @@ export default defineComponent({
             SpotGoodsBrandID: [{ required: true, validator: v_SpotGoodsBrand, trigger: 'blur' }],
             ConvertFactor: [{ required: true, message: '请选择品类', trigger: 'blur' }],
             SpotGoodsDesc: [{ required: true, message: '请输入商品规格', trigger: 'blur' }],
+            PriceType: [{ required: true, validator: v_PriceType, trigger: 'blur' }],
+            CurrencyID: [{ required: true, validator: v_Currency, trigger: 'blur' }],
+            Qty: [{ required: true, message: '请输入数量', trigger: 'blur' }],
+            Price: [{ required: true, message: '请输入价格', trigger: 'blur' }],
         };
         //  处理现货商品
         const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
         // 价格信息
         const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
+        // 日期
+        const { deliveryDate, disabledDate } = handleDate();
         function submit() {
             loading.value = true;
             setTimeout(() => {
@@ -490,6 +504,8 @@ export default defineComponent({
             parCurrencyChange,
             numberUnit,
             getUserName,
+            deliveryDate,
+            disabledDate,
         };
     },
 });

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

@@ -6,6 +6,7 @@ import { QueryDeliveryGoods, QueryDeliveryGoodsDetail } from '@/services/go/ermc
 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";
 
@@ -106,10 +107,18 @@ export function handlevalidate(formState: UnwrapRef<FormState>) {
         const errorInfo = formState.DeliveryGoodsID ? '请选择品牌' : '请先选择现货品种'
         return validateCommon(value, errorInfo)
     }
+    // 验证定价类型
+    async function v_PriceType(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择定价类型')
+    }
+    // 验证结算币种
+    async function v_Currency(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择结算币种')
+    }
 
     return {
         v_ContractType, v_BizType, v_BuyUser, v_SellUser, v_DeliveryGoods, v_WrStandard,
-        v_SpotGoodsBrand
+        v_SpotGoodsBrand, v_PriceType, v_Currency
     }
 }
 
@@ -200,4 +209,16 @@ export function handleAddAction() {
     function addAction() {
         // orderContract()
     }
+}
+
+/**
+ * 处理日期
+ */
+export function handleDate() {
+    const deliveryDate = ref<Moment[]>([])
+    function disabledDate(current: Moment) {
+        // Can not select days before today and today
+        return current && current < moment().endOf('day');
+    }
+    return { deliveryDate, disabledDate }
 }