Sfoglia il codice sorgente

修改新增现货合同

huangbin 4 anni fa
parent
commit
6dc2b6588c

+ 8 - 0
src/common/methods/format/index.ts

@@ -73,4 +73,12 @@ export function formatTime(value: string | Date, type: TIME) {
     }
     if (value) return moment(value).format(str);
     return value;
+}
+
+/**
+ * 获取number类型时间戳
+ * @returns 
+ */
+export function getTimeValue(): number {
+    return moment().valueOf()
 }

+ 2 - 7
src/services/go/ermcp/goodsInfo/index.ts

@@ -1,17 +1,15 @@
 /** ================================= 信息 - 现货商品信息 ================================**/
 
-import APP from '@/services';
 import { getUserId } from "@/services/bus/account";
+import { getUserAccountType } from "@/services/bus/user";
 import { commonSearch_go } from '@/services/go/index';
 import {
-    DeliveryGoodsDetailReq,
     Ermcp3Brand, Ermcp3GoodsGroup, Ermcp3MiddleGoodsDetailEx,
     Ermcp3Wrstandard,
     ErmcpDeliveryGoodsDetailEx,
     ErmcpDeliveryGoodsReq,
     ErmcpDeliveryGoodsRsp, ErmcpMiddleGoodsModel
 } from './interface';
-import {getUserAccountType} from "@/services/bus/user";
 
 /**
  * 查询现货商品 /Ermcp3/QueryDeliveryGoods
@@ -57,10 +55,7 @@ export function QueryGoodsbrand(): Promise<Ermcp3Brand[]> {
  * @constructor
  */
 export function QueryDeliveryGoodsDetail(deliverygoodsid?: number): Promise<ErmcpDeliveryGoodsDetailEx[]> {
-    const req :DeliveryGoodsDetailReq = {
-        deliverygoodsid: deliverygoodsid,
-        userid: getUserId()
-    }
+    const req = deliverygoodsid ? { deliverygoodsid, userid: getUserId() } : { userid: getUserId() }
     return commonSearch_go('/Ermcp3/QueryDeliveryGoodsDetail', req).catch((err) => {
         throw new Error(`查询现货商品详情: ${err.message}`);
     });

+ 250 - 174
src/views/information/spot-contract/components/add/index.vue

@@ -24,19 +24,20 @@
         <legend>基本信息</legend>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="合同编号">
+            <a-form-item label="合同编号"
+                         name="ContractNo">
               <a-input class="dialogInput"
                        style="width: 200px"
-                       name="ContractNo"
                        v-model:value="formState.ContractNo"
                        placeholder="请输入合同编号" />
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="合同类型">
+            <a-form-item label="合同类型"
+                         name="ContractType">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
-                        name="ContractType"
+                        @change="contractChange"
                         v-model:value="formState.ContractType"
                         placeholder="请选择合同类型">
                 <a-select-option v-for="item in contractType"
@@ -47,13 +48,11 @@
               </a-select>
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="业务类型">
+            <a-form-item label="业务类型"
+                         name="BizType">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
-                        name="BizType"
                         v-model:value="formState.BizType"
                         placeholder="请选择业务类型">
                 <a-select-option v-for="item in businessType"
@@ -64,28 +63,54 @@
               </a-select>
             </a-form-item>
           </a-col>
-          <a-col :span="12">
-            <a-form-item label="采购方">
-              <span class="white">河北石家庄刚强矿石公司</span>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="销售方">
-              <a-select class="inlineFormSelect"
-                        style="width: 200px"
-                        placeholder="请选择销售方">
-                <!-- 客户资料列表 正常 -->
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
+          <template v-if="isSell">
+            <a-col :span="12">
+              <a-form-item label="采购方"
+                           name="BuyUserID">
+                <a-select class="inlineFormSelect"
+                          style="width: 200px"
+                          v-model:value="formState.BuyUserID"
+                          placeholder="请选择客户">
+                  <!-- 客户资料列表 正常 -->
+                  <a-select-option :value="i"
+                                   v-for="(item, i) in customList"
+                                   :key="item.userid">
+                    {{item.customername}}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="销售方"
+                           name="SellUserID">
+                <span class="white">河北石家庄刚强矿石公司</span>
+              </a-form-item>
+            </a-col>
+          </template>
+          <template v-else>
+            <a-col :span="12">
+              <a-form-item label="采购方"
+                           name="BuyUserID">
+                <span class="white">河北石家庄刚强矿石公司</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="销售方"
+                           name="SellUserID">
+                <a-select class="inlineFormSelect"
+                          v-model:value="formState.SellUserID"
+                          style="width: 200px"
+                          placeholder="请选择客户">
+                  <!-- 客户资料列表 正常 -->
+                  <a-select-option :value="i"
+                                   v-for="(item, i) in customList"
+                                   :key="item.userid">
+                    {{item.customername}}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </template>
           <a-col :span="12">
             <a-form-item label="合同附件"
                          name="ContractAttachment">
@@ -104,60 +129,68 @@
         <legend>现货信息</legend>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="现货品种">
+            <a-form-item label="现货品种"
+                         name="DeliveryGoodsID">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        @change="deliveryGoodsChange"
+                        v-model:value="formState.DeliveryGoodsID"
                         placeholder="请选择现货品种">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in deliveryGoodsList"
+                                 :key="item.deliverygoodsid"
+                                 :value="item.deliverygoodsid">
+                  {{item.deliverygoodsname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="品类">
+            <a-form-item label="品类"
+                         name="WrStandardID">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        @change="WrStandardChange"
+                        v-model:value="formState.WrStandardID"
                         placeholder="请选择品类">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in gmlist"
+                                 :key="item.wrstandardid"
+                                 :value="item.wrstandardid">
+                  {{item.wrstandardname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="品牌">
+            <a-form-item label="品牌"
+                         name="SpotGoodsBrandID">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.SpotGoodsBrandID"
                         placeholder="请选择品牌">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in gblist"
+                                 :key="item.brandid"
+                                 :value="item.brandid">
+                  {{item.brandname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="标仓系数">
-              <span class="white">输入数量和价格后自动算</span>
+            <a-form-item label="标仓系数"
+                         name="ConvertFactor">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.ConvertFactor"
+                       readonly
+                       placeholder="选择品类后自动填入" />
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
           <a-col :span="24">
-            <a-form-item label="商品规格">
+            <a-form-item label="商品规格"
+                         name="SpotGoodsDesc">
               <a-input class="dialogInput"
                        style="width: 200px"
+                       v-model:value="formState.SpotGoodsDesc"
                        placeholder="请输入商品规格" />
             </a-form-item>
           </a-col>
@@ -167,9 +200,11 @@
         <legend>价格信息</legend>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="定价类型">
+            <a-form-item label="定价类型"
+                         name="PriceType">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.PriceType"
                         placeholder="请选择定价类型">
                 <a-select-option v-for="item in priceType"
                                  :key="item.key"
@@ -180,113 +215,132 @@
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="数量">
-              <a-input class="dialogInput suffixGrey"
-                       placeholder="请输入数量"
-                       suffix="单位" />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <!-- 以下是点价的价格信息 start -->
-        <!-- <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价合约">
+            <a-form-item label="结算币种">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
-                        placeholder="请选择点价合约">
-                <a-select-option value="1">
-                  合约一
-                </a-select-option>
-                <a-select-option value="2">
-                  合约二
+                        placeholder="请选择结算币种">
+                <a-select-option v-for="item in payCurrency"
+                                 :key="item.enumdicid"
+                                 :value="item.enumdicname">
+                  {{item.enumdicname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="升贴水">
-              <a-input class="dialogInput suffixGrey" placeholder="请输入升贴水" suffix="元/单位" style="width: 200px"/>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价期">
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择点价期">
-                <a-select-option value="1">
-                  日期一
-                </a-select-option>
-              </a-select>
-              <span class="to">-</span>
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期二
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="交收期">
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期一
-                </a-select-option>
-              </a-select>
-              <span class="to">-</span>
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期二
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row> -->
-        <!-- 以上是点价的价格信息 end -->
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="价格">
+            <a-form-item label="数量">
               <a-input class="dialogInput suffixGrey"
-                       placeholder="请输入价格"
-                       suffix="元/单位"
-                       style="width: 200px" />
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="金额"
-                         class="relative">
-              <span class="white">输入数量和价格后自动算</span>
-              <span class="unit">元</span>
+                       placeholder="请输入数量"
+                       suffix="单位" />
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="交收期">
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期一
-                </a-select-option>
-              </a-select>
-              <span class="to">-</span>
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期二
-                </a-select-option>
-              </a-select>
+          <a-col :span="12"
+                 v-if="formState.PriceType === 3">
+            <a-form-item label="暂定价">
+              <a-input class="dialogInput suffixGrey"
+                       placeholder="请输入暂定价" />
             </a-form-item>
           </a-col>
+          <!-- 以下是点价的价格信息 start -->
+          <template v-if="formState.PriceType === 2 || formState.PriceType === 3">
+            <a-col :span="12">
+              <a-form-item label="点价合约">
+                <a-select class="inlineFormSelect"
+                          style="width: 200px"
+                          placeholder="请选择点价合约">
+                  <a-select-option value="1">
+                    合约一
+                  </a-select-option>
+                  <a-select-option value="2">
+                    合约二
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="升贴水">
+                <a-input class="dialogInput suffixGrey"
+                         placeholder="请输入升贴水"
+                         suffix="元/单位"
+                         style="width: 200px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="点价期">
+                <a-select class="inlineFormSelect"
+                          style="width: 95px"
+                          placeholder="请选择点价期">
+                  <a-select-option value="1">
+                    日期一
+                  </a-select-option>
+                </a-select>
+                <span class="to">-</span>
+                <a-select class="inlineFormSelect"
+                          style="width: 95px"
+                          placeholder="请选择定价类型">
+                  <a-select-option value="1">
+                    日期二
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="交收期">
+                <a-select class="inlineFormSelect"
+                          style="width: 95px"
+                          placeholder="请选择定价类型">
+                  <a-select-option value="1">
+                    日期一
+                  </a-select-option>
+                </a-select>
+                <span class="to">-</span>
+                <a-select class="inlineFormSelect"
+                          style="width: 95px"
+                          placeholder="请选择定价类型">
+                  <a-select-option value="1">
+                    日期二
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </template>
+          <!-- 以上是点价的价格信息 end -->
+          <template v-if="formState.PriceType === 1">
+            <a-col :span="12">
+              <a-form-item label="价格">
+                <a-input class="dialogInput suffixGrey"
+                         placeholder="请输入价格"
+                         suffix="元/单位"
+                         style="width: 200px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="金额"
+                           class="relative">
+                <span class="white">输入数量和价格后自动算</span>
+                <span class="unit">元</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="交收期">
+                <a-select class="inlineFormSelect"
+                          style="width: 95px"
+                          placeholder="请选择定价类型">
+                  <a-select-option value="1">
+                    日期一
+                  </a-select-option>
+                </a-select>
+                <span class="to">-</span>
+                <a-select class="inlineFormSelect"
+                          style="width: 95px"
+                          placeholder="请选择定价类型">
+                  <a-select-option value="1">
+                    日期二
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </template>
         </a-row>
       </fieldset>
       <fieldset class="formFieldSet">
@@ -362,7 +416,7 @@
 import { defineComponent, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods';
-import { handleFromState } from './setup';
+import { handleFromState, handleContract, handlevalidate, handleDeliveryGoods, handlePrice } from './setup';
 
 export default defineComponent({
     name: 'add-spot-contract',
@@ -373,25 +427,33 @@ export default defineComponent({
 
         // 表单
         const formRef = ref();
-        const { formState, contractType, priceType, businessType } = handleFromState();
-        // const rules = {
-        //     deliverygoodsname: [{ required: true, message: '请输入现货品种名称', trigger: 'blur' }],
-        //     // unitid: [{ required: true, message: '请选择单位', trigger: 'change' }],
-        //     unitid: [{ required: true, validator: validateUnit, trigger: 'change' }],
-        //     gldwrstandards: {
-        //         unitid: { required: true, validator: validateUnit, trigger: 'change' },
-        //         wrstandardname: { required: true, message: '请输入品类', trigger: 'blur' },
-        //         convertfactor: { required: true, message: '请输入标仓系数', trigger: 'blur' },
-        //     },
-        //     glddgfactoryItems: {
-        //         dgfactoryitemvalue: { required: true, message: '请输入品牌', trigger: 'blur' },
-        //     },
-        //     wrsconvertdetails: {
-        //         middlegoodsid: { required: true, validator: valideteWR, trigger: 'change' },
-        //         convertratio: { required: true, message: '请输入套保系数', trigger: 'blur' },
-        //     },
-        // };
-
+        const { formState, businessType } = handleFromState();
+        // 合同类型
+        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 rules = {
+            ContractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
+            ContractType: [{ required: true, validator: v_ContractType, 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' }],
+            WrStandardID: [{ required: true, validator: v_WrStandard, trigger: 'blur' }],
+            SpotGoodsBrandID: [{ required: true, validator: v_SpotGoodsBrand, trigger: 'blur' }],
+            ConvertFactor: [{ required: true, message: '请选择品类', trigger: 'blur' }],
+            SpotGoodsDesc: [{ required: true, message: '请输入商品规格', trigger: 'blur' }],
+        };
+        //  处理现货商品
+        const { deliveryGoodsList, gblist, gmlist, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods();
+        // 品类变更
+        function WrStandardChange(value: number) {
+            const obj = gmlist.value.find((e) => e.wrstandardid === value);
+            //标仓系数
+            formState.ConvertFactor = obj?.convertfactor;
+        }
+        // 价格信息
+        const { priceType, payCurrency, isPriceType } = handlePrice(formState);
         function submit() {
             loading.value = true;
             setTimeout(() => {
@@ -399,17 +461,31 @@ export default defineComponent({
                 cancel();
             }, 2000);
         }
-        initData(() => {});
+        initData(() => {
+            queryCustomList();
+            getDeliveryGoods();
+        });
         return {
             visible,
             cancel,
             submit,
             loading,
             maskClosableFlag: false,
+            formState,
+            rules,
+            businessType,
             contractType,
+            isSell,
+            contractChange,
+            customList,
+            deliveryGoodsList,
+            gblist,
+            gmlist,
+            deliveryGoodsChange,
+            WrStandardChange,
             priceType,
-            businessType,
-            formState,
+            payCurrency,
+            isPriceType,
         };
     },
 });

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

@@ -1,4 +1,12 @@
-import { reactive, UnwrapRef } from 'vue';
+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 { reactive, ref, UnwrapRef } from 'vue';
 import { FormState } from "./interface";
 
 export function handleFromState() {
@@ -26,21 +34,144 @@ export function handleFromState() {
         AccountID: undefined, // uint64 期货账户ID
         Remark: '' // string 合同备注
     })
+    // 业务类型
+    const businessType = [
+        { key: 1, value: '套保' },
+        { key: 2, value: '套利' },
+    ];
+    return { formState, businessType }
+}
+/**
+ * 合同类型
+ */
+export function handleContract() {
     // 合同类型
     const contractType = [
         { key: 1, value: '采购' },
         { key: -1, value: '销售' },
     ];
+    const isSell = ref<boolean>(false)  // true => 销售 false => 采购
+    /**
+     * 合同类型变更
+     */
+    function contractChange(value: number) {
+        isSell.value = value === 1 ? false : true;
+    }
+    const customList = ref<QueryCustomInfoType[]>([])
+    function queryCustomList() {
+        QueryCustomInfo(3)
+            .then((res) => {
+                customList.value = res
+                console.log('客户资料', customList);
+            })
+            .catch((err) => {
+                message.error(err);
+            })
+    }
+    return { contractType, isSell, contractChange, customList, queryCustomList }
+}
+
+/**
+ * 自定义表单验证方法
+ */
+export function handlevalidate(formState: UnwrapRef<FormState>) {
+    // 验证合同类型
+    async function v_ContractType(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择合同类型')
+    }
+    // 验证业务类型
+    async function v_BizType(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择业务类型')
+    }
+    // 验证业务类型
+    async function v_BuyUser(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择采购方')
+    }
+    // 验证业务类型
+    async function v_SellUser(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择销售方')
+    }
+    // 验证现货品种
+    async function v_DeliveryGoods(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择现货品种')
+    }
+    // 验证品类
+    async function v_WrStandard(rule: RuleObject, value: number) {
+        const errorInfo = formState.DeliveryGoodsID ? '请选择品类' : '请先选择现货品种'
+        return validateCommon(value, errorInfo)
+    }
+    // 验证品牌
+    async function v_SpotGoodsBrand(rule: RuleObject, value: number) {
+        const errorInfo = formState.DeliveryGoodsID ? '请选择品牌' : '请先选择现货品种'
+        return validateCommon(value, errorInfo)
+    }
+
+    return {
+        v_ContractType, v_BizType, v_BuyUser, v_SellUser, v_DeliveryGoods, v_WrStandard,
+        v_SpotGoodsBrand
+    }
+}
+
+/**
+ * 处理现货商品
+ */
+export function handleDeliveryGoods() {
+    // 现货品种
+    const deliveryGoodsList = ref<ErmcpDeliveryGoodsRsp[]>([])
+    // 品牌
+    const gblist = ref<Ermcp3Brand[]>([])
+    // 品类列表
+    const gmlist = ref<Ermcp3Wrstandard[]>([])
+
+    // 查询现货商品
+    function getDeliveryGoods() {
+        QueryDeliveryGoods({}).then(res => {
+            console.log('查询现货商品', res);
+            deliveryGoodsList.value = res;
+        }).catch(err => {
+            message.error(err)
+        })
+    }
+    // 切换现货商品
+    function deliveryGoodsChange(value: number | undefined) {
+        if (value !== undefined) {
+            getDeliveryGoodsDetail(value)
+        } else {
+            gblist.value.length = 0
+            gmlist.value.length = 0
+        }
+    }
+    // 查询现货商品详情
+    function getDeliveryGoodsDetail(deliverygoodsid: number) {
+        QueryDeliveryGoodsDetail(deliverygoodsid).then(res => {
+            if (res.length) {
+                gblist.value = res[0].gblist
+                gmlist.value = res[0].gmlist
+            }
+            console.log('查询品类', res);
+        }).catch(err => {
+            message.error(err)
+        })
+    }
+    return { deliveryGoodsList, gblist, gmlist, getDeliveryGoods, getDeliveryGoodsDetail, deliveryGoodsChange }
+}
+
+/**
+ * 价格信息
+ */
+export function handlePrice(formState: UnwrapRef<FormState>) {
     // 定价类型
     const priceType = [
         { key: 1, value: '一口价' },
         { key: 2, value: '点价' },
         { key: 3, value: '暂定价' },
     ];
-    // 业务类型
-    const businessType = [
-        { key: 1, value: '套保' },
-        { key: 2, value: '套利' },
-    ];
-    return { formState, contractType, priceType, businessType }
+    // value: 1 => 一口价; 2 => 点价; 3 => 暂定价
+    function isPriceType(value: number) {
+        formState.PriceType == value
+    }
+    // 币种
+    const payCurrency = getItemEnum('paycurrency')
+    console.log('payCurrency', payCurrency)
+    return { priceType, payCurrency, isPriceType }
 }