li.shaoyi 3 лет назад
Родитель
Сommit
8a7efccad6

+ 29 - 27
src/hooks/form/verify.ts

@@ -39,41 +39,43 @@ export const useVerifyListingNum = <T extends object, k extends keyof T>(formSta
 
 /**
  * 验证 挂牌基差
- * @param formState 表单状态
- * @param key 商品ID对应的key
- * @returns
  */
-export const useVerifyListingBasis = <T, k extends keyof T>(formState: T, key: k) => {
+export const useVerifyListingBasis = (getFormState: () => { goodsid?: number, marketid?: number }) => {
     const v_basis = async (rule: RuleObject, value: number) => {
-        if (formState[key]) {
-            if (typeof value === 'number') {
-                const goodsCode = getGoodsById(formState[key] as unknown as number)?.goodscode as string;
-                const quote = getQuoteDayInfoByCode(goodsCode);
-                if (quote) {
-                    const { basisdownratio, basisupratio } = getRules()[0];
-                    // 最小值 = 基差下限百分比 * 昨日收盘价 * -1
-                    const minValue = (basisdownratio * quote.presettle * -1).toFixed(2);
-                    // 最大值 = 基差上限百分比 * 昨日收盘价
-                    const maxValue = (basisupratio * quote.presettle).toFixed(2);
+        const { goodsid, marketid } = getFormState();
+        if (marketid) {
+            const config = getRules().find((e) => e.marketid === marketid);
+            if (config) {
+                if (goodsid) {
+                    const goodsCode = getGoodsById(goodsid)?.goodscode as string;
+                    const quote = getQuoteDayInfoByCode(goodsCode);
+                    if (quote) {
+                        if (typeof value === 'number') {
+                            // 最小值 = 基差下限百分比 * 昨日收盘价 * -1
+                            const minValue = (config.basisdownratio * quote.presettle * -1).toFixed(2);
+                            // 最大值 = 基差上限百分比 * 昨日收盘价
+                            const maxValue = (config.basisupratio * quote.presettle).toFixed(2);
 
-                    if (value >= Number(minValue) && value <= Number(maxValue)) {
-                        return Promise.resolve();
-                    } else {
-                        if (value < Number(minValue)) {
-                            return Promise.reject(`基差不能小于${minValue}`);
-                        }
-                        if (value > Number(maxValue)) {
-                            return Promise.reject(`基差不能大于${maxValue}`);
+                            if (value >= Number(minValue) && value <= Number(maxValue)) {
+                                return Promise.resolve();
+                            } else {
+                                if (value < Number(minValue)) {
+                                    return Promise.reject(`基差不能小于${minValue}`);
+                                }
+                                if (value > Number(maxValue)) {
+                                    return Promise.reject(`基差不能大于${maxValue}`);
+                                }
+                            }
                         }
+                        return Promise.reject('请输入基差');
                     }
+                    return Promise.reject('商品盘面不存在');
                 }
-                return Promise.reject('合约不存在');
-            } else {
-                return Promise.reject('请输入基差');
+                return Promise.reject('请选择合约');
             }
-        } else {
-            return Promise.reject('请选择合约');
+            return Promise.reject('市场参数未配置');
         }
+        return Promise.reject('请选择交易市场');
     };
     return { v_basis }
 }

+ 2 - 2
src/views/market/spot_trade/components/buy-sell-market/components/delisting/index.vue

@@ -36,9 +36,9 @@
               </a-form-item>
             </a-col>
           </a-row>
-          <a-row :gutter="24" v-if="isBuy() && isWR()">
+          <a-row :gutter="24" v-if="isBuy()">
             <a-col :span="24">
-              <a-form-item label="现货仓单" name="LadingBillId">
+              <a-form-item :label="isWR() ? '现货仓单' : '预售仓单'" name="LadingBillId">
                 <a-select class="inlineFormSelect" style="width: 260px" v-model:value="formState.LadingBillId" placeholder="请选择">
                   <a-select-option v-for="item in wrHoldList" :value="item.id" :key="item.id">{{item.name}}</a-select-option>
                 </a-select>

+ 1 - 1
src/views/market/spot_trade/components/buy-sell-market/components/delisting/interface.ts

@@ -3,7 +3,7 @@ import { WrOrderQuoteDetail } from "@/services/go/wrtrade/interface";
 export interface ListingForm {
     accountid: undefined | number,
     num: number,
-    LadingBillId: string,
+    LadingBillId: undefined | string,
 }
 
 export interface Wrhold {

+ 12 - 14
src/views/market/spot_trade/components/buy-sell-market/components/delisting/setup.ts

@@ -16,7 +16,7 @@ export function handleForm(data: WrOrderQuoteDetail) {
     const formState: UnwrapRef<ListingForm> = reactive({
         accountid: undefined,
         num: 0,
-        LadingBillId: '',
+        LadingBillId: undefined,
     })
     const rules = {
         accountid: [{ required: true, message: '请选择交易账户' }],
@@ -45,22 +45,20 @@ export function getWrPosition(enumName: EnumRouterName, buyOrSell: BuyOrSell, lo
 const allWR = ref<WrHoldLB[]>([])
 // 处理现货仓单
 export function handleSpotWarrant(enumName: EnumRouterName, buyOrSell: BuyOrSell, selectedRow: WrOrderQuote, loading: Ref<boolean>) {
-    const { isWR, isBuy } = handleIs(enumName, buyOrSell)
+    const { isBuy } = handleIs(enumName, buyOrSell)
     const wrHoldList = ref<Wrhold[]>([])
     if (isBuy()) {
-        if (isWR()) {
-            queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
-                allWR.value = res;
-                wrHoldList.value.length = 0
-                res.forEach(e => {
-                    if (e.wrfactortypeid === String(selectedRow.wrfactortypeid)) {
-                        const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = e
-                        const result = { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
-                        wrHoldList.value.push(result)
-                    }
-                })
+        queryResultLoadingAndInfo(queryHoldLB, loading).then(res => {
+            allWR.value = res;
+            wrHoldList.value.length = 0
+            res.forEach(e => {
+                if (e.wrfactortypeid === String(selectedRow.wrfactortypeid)) {
+                    const { wrholdeno, enableqty, ladingbillid, enumdicname, subnum } = e
+                    const result = { id: ladingbillid, name: `${wrholdeno}(${enableqty}${enumdicname})`, subnum }
+                    wrHoldList.value.push(result)
+                }
             })
-        }
+        })
     }
     return { wrHoldList }
 }

+ 42 - 51
src/views/market/spot_trade/components/detail/index.vue

@@ -1,15 +1,9 @@
 <template>
   <!-- 买卖大厅详情 -->
-  <Drawer :title="'详情'"
-          :placement="'right'"
-          :visible="visible"
-          class="top top486"
-          @cancel="cancel">
+  <Drawer :title="'详情'" :placement="'right'" :visible="visible" class="top top486" @cancel="cancel">
     <div class="detailCont">
       <div class="rows">
-        <div class="row"
-             v-for="item in lstitem"
-             :key="item.name">
+        <div class="row" v-for="item in lstitem" :key="item.name">
           <div class="left">{{item.name}}</div>
           <div class="right">{{item.value}}</div>
         </div>
@@ -17,11 +11,8 @@
       <div class="ruleTitle">履约规则:</div>
       <div class="rulesCont">
         <a-row>
-          <a-col :span="24"
-                 class="ruleCol">
-            <div class="line"
-                 v-for="item in lststep"
-                 :key="item.autoid">
+          <a-col :span="24" class="ruleCol">
+            <div class="line" v-for="item in lststep" :key="item.autoid">
               <!-- <div class="no">{{index + 1}}</div> -->
               <div class="name">{{item.stepinfo}}</div>
               <div class="time">{{item.stepdate}}</div>
@@ -44,46 +35,46 @@ import { queryWrGoodsInfo } from '@/services/go/wrtrade';
 import { EnumRouterName } from '@/common/constants/enumRouterName';
 
 export default defineComponent({
-    name: ModalEnum.spot_trade_warehouse_delisting,
-    components: { Drawer },
-    emits: ['cancel', 'update'],
-    props: {
-        selectedRow: {
-            type: Object as PropType<WrOrderQuote>,
-            default: {},
-        },
-        enumName: {
-            default: '',
-            type: String as PropType<EnumRouterName>,
-        },
+  name: ModalEnum.spot_trade_warehouse_delisting,
+  components: { Drawer },
+  emits: ['cancel', 'update'],
+  props: {
+    selectedRow: {
+      type: Object as PropType<WrOrderQuote>,
+      default: {},
     },
-    setup(props, context) {
-        const loading = ref<boolean>(false);
-        const { visible, cancel } = _closeModal(context);
-        const lstitem = ref<WrTypeItem[]>();
-        const lststep = ref<WrGoodsPerformanceStep[]>();
-        function isSale(): boolean {
-            return props.enumName === EnumRouterName.warehouse_pre_sale_price || props.enumName === EnumRouterName.warehouse_pre_sale_floating_price;
-        }
-        const param: QueryWrGoodsInfoReq = {
-            haswr: isSale() ? 0 : 1,
-            wrfactortypeid: props.selectedRow.wrfactortypeid,
-            // tmplateid: props.selectedRow.performancetemplateid ? props.selectedRow.performancetemplateid : 0,
-        };
-        queryResultLoadingAndInfo(queryWrGoodsInfo, loading, param).then((res) => {
-            if (res.length) {
-                lstitem.value = res[0].lstitem;
-                lststep.value = res[0].lststep;
-            }
-        });
-
-        return {
-            lstitem,
-            lststep,
-            visible,
-            cancel,
-        };
+    enumName: {
+      default: '',
+      type: String as PropType<EnumRouterName>,
     },
+  },
+  setup(props, context) {
+    const loading = ref<boolean>(false);
+    const { visible, cancel } = _closeModal(context);
+    const lstitem = ref<WrTypeItem[]>();
+    const lststep = ref<WrGoodsPerformanceStep[]>();
+    function isSale(): boolean {
+      return props.enumName === EnumRouterName.warehouse_pre_sale_price || props.enumName === EnumRouterName.warehouse_pre_sale_floating_price;
+    }
+    const param: QueryWrGoodsInfoReq = {
+      haswr: isSale() ? 0 : 1,
+      wrfactortypeid: props.selectedRow.wrfactortypeid,
+      // tmplateid: props.selectedRow.performancetemplateid ? props.selectedRow.performancetemplateid : 0,
+    };
+    queryResultLoadingAndInfo(queryWrGoodsInfo, loading, param).then((res) => {
+      if (res.length) {
+        lstitem.value = res[0].lstitem;
+        lststep.value = res[0].lststep;
+      }
+    });
+
+    return {
+      lstitem,
+      lststep,
+      visible,
+      cancel,
+    };
+  },
 });
 </script>
 

+ 3 - 3
src/views/market/spot_trade/components/post_buying/setup.ts

@@ -21,7 +21,7 @@ function initFormData(): FormParam {
         DelistMinQty: 0,
         DeliveryMonth: moment(),
         permanceTempName: '',
-        permaceTempId:0,
+        permaceTempId: 0,
         marketid: undefined,
     }
 }
@@ -30,7 +30,7 @@ export function handleForm(selectedRow: TempWrOrderQuoteDetail) {
     const formRef = ref();
     //
     const { v_num } = useVerifyListingNum<FormParam, 'DelistMinQty'>(formState, 'DelistMinQty', selectedRow.minivalue);
-    const { v_basis } = useVerifyListingBasis(selectedRow, 'goodsid');
+    const { v_basis } = useVerifyListingBasis(() => ({ goodsid: selectedRow.goodsid, marketid: formState.marketid }));
     const { v_beginDelistingRules, v_beginDelistingNum } = useVerifyBeginDelistingNum(selectedRow.minivalue)
     const v_price = async (rule: RuleObject, value: number) => {
         return validateCommon(value, '请输入挂牌价格');
@@ -84,7 +84,7 @@ export function handleNumAndPrice(enumName: EnumRouterName, selectedRow: WrOrder
             // 当市场设置的买保证金为0时,不做数量限制
             return 10000
         }
-        
+
     }
     //  摘牌金额
     function getMoney() {

+ 40 - 57
src/views/order/pre_sale_warehouse_receipt/components/pre_sale_warehouse_receipt_order_summary/components/listed/index.vue

@@ -12,8 +12,8 @@
         <div class="formBar">
           <a-row :gutter="24">
             <a-col :span="12">
-              <a-form-item label="挂牌方式" name="WRPriceType">
-                <a-select class="inlineFormSelect" v-model:value="formState.marketid" @change="handleMarket" style="width: 140px" placeholder="请选择挂牌市场">
+              <a-form-item label="交易市场" name="marketid">
+                <a-select class="inlineFormSelect" v-model:value="formState.marketid" @change="handleMarket" style="width: 140px" placeholder="请选择交易市场">
                   <!-- <a-select-option :value="1">一口价</a-select-option>
                   <a-select-option :value="2">浮动价</a-select-option>
                   <a-select-option :value="3">贸易圈</a-select-option> -->
@@ -54,8 +54,8 @@
           </a-row>
           <a-row :gutter="24">
             <a-col :span="12">
-              <a-form-item label="挂牌数量" name="OrderQty">
-                <a-input-number class="dialogInput" style="width: 140px !important" :min="0" v-model:value="formState.OrderQty" placeholder="请输入挂牌数量" />
+              <a-form-item ref="OrderQty" label="挂牌数量" name="OrderQty">
+                <a-input-number class="dialogInput" style="width: 140px !important" :min="0" v-model:value="formState.OrderQty" />
                 <span class="input-enumdicname">{{selectedRow.enumdicname}}</span>
                 <a-checkbox class="commonCheckbox" v-if="isBlocs()" v-model:checked="numCheck">整单</a-checkbox>
               </a-form-item>
@@ -71,13 +71,13 @@
               </a-form-item>
             </a-col>
           </a-row>
-          <a-row :gutter="24">
+          <a-row :gutter="24" v-if="Number.isInteger(formState.OrderQty)">
             <a-col :span="12" class="mt-20">
               <a-form-item>
-                <a-slider v-model:value="formState.OrderQty" :min="0" :max="selectedRow.enableqty" class="formSlider" style="width: 140px;" />
+                <a-slider v-model:value="formState.OrderQty" :min="0" :max="selectedRow.enalbeqty" class="formSlider" style="width: 140px;" @afterChange="() => $refs.OrderQty.onFieldBlur()" />
                 <div class="unit">
                   <span>0</span>
-                  <span>{{selectedRow.enableqty}}{{selectedRow.enumdicname}}</span>
+                  <span>{{selectedRow.enalbeqty}}{{selectedRow.enumdicname}}</span>
                 </div>
               </a-form-item>
             </a-col>
@@ -89,13 +89,16 @@
                 <a-month-picker style="width: 140px" v-model:value="formState.DeliveryMonth" :allowClear="false" class="commonDatePicker dialogDatePicker" />
               </a-form-item>
             </a-col>
-            <a-col :span="12" v-if="isFloat()">
-              <a-form-item label="基差" name="PriceMove">
-                <a-input-number class="commonInput" v-model:value="formState.PriceMove" style="width: 140px" />
+            <a-col :span="12">
+              <a-form-item label="履约模板" class="inputIconBox">
+                <span :class="['clickBox', formState.permanceTempName ? 'white' : '']" style="width: 140px" @click="handlePermance">{{formState.permanceTempName ? formState.permanceTempName : '选择履约模板'}}</span>
+                <svg class="icon svg-icon" aria-hidden="true" @click="handlePermance">
+                  <use xlink:href="#icon-moban" />
+                </svg>
               </a-form-item>
             </a-col>
           </a-row>
-          <a-row :gutter="24">
+          <a-row :gutter="24" v-if="isBlocs()">
             <a-col :span="12">
               <a-form-item label="履约保证金" name="margin">
                 <a-input-number class="commonInput" v-model:value="formState.margin" :min="0" style="width: 140px" />
@@ -109,12 +112,9 @@
             </a-col>
           </a-row>
           <a-row :gutter="24">
-            <a-col :span="12">
-              <a-form-item label="履约模板" class="inputIconBox">
-                <span :class="['clickBox', formState.permanceTempName ? 'white' : '']" style="width: 140px" @click="handlePermance">{{formState.permanceTempName ? formState.permanceTempName : '选择履约模板'}}</span>
-                <svg class="icon svg-icon" aria-hidden="true" @click="handlePermance">
-                  <use xlink:href="#icon-moban" />
-                </svg>
+            <a-col :span="12" v-if="isFloat()">
+              <a-form-item label="基差" name="PriceMove">
+                <a-input-number class="commonInput" v-model:value="formState.PriceMove" style="width: 140px" />
               </a-form-item>
             </a-col>
             <template v-if="isBlocs()">
@@ -131,37 +131,30 @@
           </a-row>
           <a-row :gutter="24">
             <a-col :span="24" v-if="isFloat()" class="relative">
-              <a-form-item :label="'估算价'">
+              <a-form-item label="估算价">
                 <span class="white ml8">{{getPrice()}}</span>
               </a-form-item>
             </a-col>
-          </a-row>
-          <a-row :gutter="24">
             <a-col :span="24" v-if="isFloat()" class="relative">
-              <a-form-item :label="'估算金额'">
+              <a-form-item label="估算金额">
                 <span class="white ml8">{{getWrMoney()}}</span>
               </a-form-item>
             </a-col>
-            <a-col :span="24" v-if="isFixed()" class="relative">
-              <a-form-item :label="'挂牌金额'">
+            <a-col :span="24" v-else class="relative">
+              <a-form-item label="挂牌金额">
                 <span class="white ml8">{{getWrMoney()}}</span>
               </a-form-item>
             </a-col>
-            <a-col :span="24" v-if="isBlocs()" class="relative">
-              <a-form-item :label="'挂牌金额'">
-                <span class="white ml8">{{getMoney()}}</span>
-              </a-form-item>
-            </a-col>
-            <a-col :span="24" v-if="getWrMargin() && !isBlocs()">
-              <a-form-item :label="getWrMargin() ? '履约保证金' : ''">
-                <span class="white ml8">{{getWrMargin()}}</span>
-              </a-form-item>
-            </a-col>
             <a-col :span="24" v-if="isBlocs()">
               <a-form-item label="履约保证金">
                 <span class="white ml8">{{getMargin()}}</span>
               </a-form-item>
             </a-col>
+            <a-col :span="24" v-else-if="getWrMargin()">
+              <a-form-item label="履约保证金">
+                <span class="white ml8">{{getWrMargin()}}</span>
+              </a-form-item>
+            </a-col>
             <a-col :span="24">
               <a-form-item label="可用资金">
                 <span class="white ml8">{{getCanUseMoney(handleSelectedAccount())}}</span>
@@ -173,7 +166,7 @@
           <a-col :span="24" class="fixedBtns">
             <a-form-item class="btnCenter">
               <a-button class="listedBtn" :loading="loading" :disabled="loading" @click="submit">卖出</a-button>
-              <a-button class="ml10 cancelBtn" :loading="loading" :disabled="loading" @click="cancel">取消</a-button>
+              <a-button class="ml10 cancelBtn" :loading="loading" :disabled="loading" @click="cancel(false)">取消</a-button>
             </a-form-item>
           </a-col>
         </a-row>
@@ -238,22 +231,7 @@ export default defineComponent({
     const { goodsGroup, goodsList, groupsChange, findGoodsCode } = handleGoods();
 
     // 获取仓单贸易市场
-    const { spotMarkets } = queryMarketSection(true)
-
-    // 切换市场
-    function handleMarket(value: number) {
-      const market = spotMarkets.value.find(item => item.marketid === value)
-      if (!market) return
-
-      // 判断所选择市场挂牌方式 1:一口价 2:浮动价 3:贸易圈 4:协议指定
-      if (market.listingmode === 1) {
-        formState.WRPriceType = 1
-      } else if (market.listingmode === 2) {
-        formState.WRPriceType = 2
-      } else {
-        formState.WRPriceType = 3
-      }
-    }
+    const { spotMarkets, handleMarket } = queryMarketSection(true)
 
     // 点选履约模板
     function handlePermance() {
@@ -288,7 +266,7 @@ export default defineComponent({
     // 估算价
     function getPrice() {
       let result = '--';
-      if (goodsCode.value) {
+      if (goodsCode.value && typeof formState.PriceMove === 'number') {
         const goodsPrice = getQuoteDayInfoByCodeFindPrice(goodsCode.value);
         if (goodsPrice && goodsPrice !== '--') {
           // 有实时行情价格
@@ -301,7 +279,7 @@ export default defineComponent({
     onBeforeUnmount(() => {
       removeSubscribeQuotation(uuid);
     });
-    const { getWrMoney, getWrMargin, isFloat, isFixed, isBlocs } = handleNumAndPrice();
+    const { getWrMoney, getWrMargin, isFloat, isFixed, isBlocs, isAgreemt } = handleNumAndPrice();
     // 处理内部资金账号
     function handleSelectedAccount() {
       const item = getSelectedAccount();
@@ -352,8 +330,8 @@ export default defineComponent({
             SubNum: props.selectedRow.subnum ? props.selectedRow.subnum : 0,
             // WRFactorTypeId: '2121626946446000001', // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
             WRFactorTypeId: props.selectedRow.wrfactortypeid, // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
-            IsSpecified: 0, // 是否指定对手 0:不指定 1:指定 uint32
-            MatchAccIDs: [], // 仓单贸易对手资金账号ID集合(指定对手时填写) uint32
+            IsSpecified: res.isSpecified, // 是否指定对手 0:不指定 1:指定 uint32
+            MatchAccIDs: res.friends, // 仓单贸易对手资金账号ID集合(指定对手时填写) uint32
             OrderQty: res.OrderQty, // 委托数量(可挂部分数据量) ======
             DeliveryGoodsID: props.selectedRow.deliverygoodsid, // 交割商品商品ID
             WRPriceType: res.WRPriceType, // 价格方式 1:固定价 2:浮动价
@@ -382,6 +360,14 @@ export default defineComponent({
             MarginFlag: 0,
             DelistMinQty: res.DelistMinQty, // 起摘数量
           };
+
+          if (isAgreemt()) {
+            if (!formState.friends.length) {
+              message.error('请选择用户');
+              return;
+            }
+          }
+
           if (isBlocs()) {
             // 贸易圈 是后加的, 处理贸易圈
             // if (!formState.permanceTempName) {
@@ -395,9 +381,6 @@ export default defineComponent({
               }
             }
             const obj = {
-              IsSpecified: 1,
-              MatchAccIDs: res.friends,
-              WRPriceType: 1,
               TimevalidType: 3, // 时间有效类型 1:当日有效 2:本周有效 3:指定时间有效 4:一直有效
               MarginFlag: 1, // 挂牌是否指定保证金 0:否 1:是
               MarginAlgorithm: 1, // 指定保证金方式 1:比率 2:固定

+ 2 - 0
src/views/order/pre_sale_warehouse_receipt/components/pre_sale_warehouse_receipt_order_summary/components/listed/interface.ts

@@ -8,4 +8,6 @@ export interface ListingForm extends BlocsListingForm {
     goodsgroupid: number | undefined,
     goodsid: number | undefined,
     marketid: number | undefined,   // 当前选择挂牌市场ID
+    isSpecified: number, // 是否指定对手
+    listingmode: number, // 挂牌方式 1:一口价 2:浮动价 3:贸易圈 4:协议指定
 }

+ 64 - 14
src/views/order/pre_sale_warehouse_receipt/components/pre_sale_warehouse_receipt_order_summary/components/listed/setup.ts

@@ -33,6 +33,8 @@ function initFormData(): ListingForm {
         permanceTempName: '',
         permaceTempId: 0,
         marketid: undefined,
+        isSpecified: 0,
+        listingmode: 0,
     }
 }
 
@@ -51,7 +53,7 @@ export function handleForm(data: WrPosition) {
     };
 
     const { v_num } = useVerifyListingNum<ListingForm, 'DelistMinQty'>(formState, 'DelistMinQty', minivalue, creditenableqty);
-    const { v_basis } = useVerifyListingBasis(formState, 'goodsid');
+    const { v_basis } = useVerifyListingBasis(() => ({ goodsid: formState.goodsid, marketid: formState.marketid }));
     // 验证 起摘数量
     const { v_beginDelistingRules } = useVerifyBeginDelistingNum(data.minivalue);
     const rule = {
@@ -86,14 +88,19 @@ export function handleGoods() {
 
 export function handleNumAndPrice() {
     function isFloat() {
-        return formState.WRPriceType === 2;
+        return formState.listingmode === 2;
     }
     function isFixed() {
-        return formState.WRPriceType === 1;
+        return formState.listingmode === 1;
     }
     function isBlocs() {
         return formState.WRPriceType === 3;
     }
+    // 协议指定
+    function isAgreemt() {
+        return formState.listingmode === 4;
+    }
+
     // 获取选中的资金账号
     const hasRules = () => getRules().length > 0
     //  摘牌金额
@@ -101,11 +108,13 @@ export function handleNumAndPrice() {
         let result = 0
         if (isFloat()) {
             if (hasRules()) {
-                const goodsCode = goodsList.value.find(e => e.goodsid === formState.goodsid)?.goodscode as string
-                const goodsPrice = getQuoteDayInfoByCodeFindPrice(goodsCode);
-                if (goodsPrice && goodsPrice !== '--') {
-                    // 浮动价挂牌金额=(基差价格+期货合约最新价)*挂牌数量
-                    result = (formState.PriceMove + (goodsPrice as number)) * formState.OrderQty
+                const goods = goodsList.value.find(e => e.goodsid === formState.goodsid);
+                if (goods) {
+                    const goodsPrice = getQuoteDayInfoByCodeFindPrice(goods.goodscode);
+                    if (goodsPrice && goodsPrice !== '--') {
+                        // 浮动价挂牌金额=(基差价格+期货合约最新价)*挂牌数量
+                        result = (formState.PriceMove + (goodsPrice as number)) * formState.OrderQty
+                    }
                 }
             }
         } else {
@@ -127,27 +136,68 @@ export function handleNumAndPrice() {
         }
 
     }
-    return { getWrMoney, getWrMargin, isFloat, isFixed, isBlocs }
+    return { getWrMoney, getWrMargin, isFloat, isFixed, isBlocs, isAgreemt }
 }
 
 /**
  * 查询市场板块,用于挂牌时挂牌方式选择,替代之前的“一口价、浮动价和贸易圈”
  */
- export function queryMarketSection(isPre: boolean) {
-    const spotMarkets = ref<TjmdMarketSectionConfig[]>([]); 
+export function queryMarketSection(isPre: boolean) {
+    const spotMarkets = ref<TjmdMarketSectionConfig[]>([]);
     queryTjmdMarketSection().then(res => {
         let resMarkets: TjmdMarketSectionConfig[] = []
         res.forEach(item => { resMarkets.push(...item.mlist) })
         // 根据有无仓单过滤出仓单市场
         // 过滤掉没有权限的市场
         const markets = getAllMarkets()
-        resMarkets = resMarkets.filter(item => 
+        resMarkets = resMarkets.filter(item =>
             item.auctionwrtype === (isPre ? 1 : 2) && (item.trademode === TradeMode.WarehouseReceiptTrade)
-        ).filter(item => 
+        ).filter(item =>
             markets.findIndex(m => m.marketid === item.marketid) !== -1
         )
         spotMarkets.value = resMarkets
+
+        if (resMarkets.length) {
+            const marketid = resMarkets[0].marketid;
+            handleMarket(marketid);
+        }
     })
 
-    return { spotMarkets };
+    const handleMarket = (marketid: number) => {
+        formState.friends = [];
+        formState.marketid = marketid;
+        const market = spotMarkets.value.find((e) => e.marketid === marketid);
+        if (market) {
+            formState.listingmode = market.listingmode
+            switch (market.listingmode) {
+                // 浮动价
+                case 2: {
+                    formState.WRPriceType = 2;
+                    formState.isSpecified = 0;
+                    break;
+                }
+                // 贸易圈
+                case 3: {
+                    formState.WRPriceType = 1;
+                    formState.isSpecified = 1;
+                    break;
+                }
+                // 指定价
+                case 4: {
+                    formState.WRPriceType = 1;
+                    formState.isSpecified = 2;
+                    break;
+                }
+                default: {
+                    formState.WRPriceType = 1;
+                    formState.isSpecified = 0;
+                }
+            }
+        }
+    }
+
+    return {
+        spotMarkets,
+        handleMarket
+    }
 }

+ 14 - 17
src/views/order/pre_sale_warehouse_receipt/index.vue

@@ -1,12 +1,9 @@
 <template>
   <!-- 预售仓单 -->
   <section class="pre_sale_warehouse_receipt">
-    <component :is="componentId"
-               v-if="componentId">
+    <component :is="componentId" v-if="componentId">
     </component>
-    <thirdMenu :list="tabList"
-               @selectMenu="changeTab"
-               :value="'title'"></thirdMenu>
+    <thirdMenu :list="tabList" @selectMenu="changeTab" :value="'title'"></thirdMenu>
   </section>
 </template>
 
@@ -16,17 +13,17 @@ import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
 import thirdMenu from '@/common/components/thirdMenu/index.vue';
 import { handleOrderDetailList } from '@/common/setup/order/orderData';
 export default defineComponent({
-    name: enumOrderComponents.pre_sale_warehouse_receipt,
-    components: {
-        thirdMenu,
-        [enumOrderComponents.pre_sale_warehouse_receipt_deal]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_deal/index.vue')),
-        [enumOrderComponents.pre_sale_warehouse_receipt_designated_deal]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_designated_deal/index.vue')),
-        [enumOrderComponents.pre_sale_warehouse_receipt_order_summary]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_order_summary/index.vue')),
-        [enumOrderComponents.pre_sale_warehouse_receipt_pending_order]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_pending_order/index.vue')),
-        [enumOrderComponents.pre_sale_warehouse_receipt_bargain]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_bargain/index.vue')),
-    },
-    setup() {
-        return { ...handleOrderDetailList(enumOrderComponents.pre_sale_warehouse_receipt) };
-    },
+  name: enumOrderComponents.pre_sale_warehouse_receipt,
+  components: {
+    thirdMenu,
+    [enumOrderComponents.pre_sale_warehouse_receipt_deal]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_deal/index.vue')), // 成交
+    [enumOrderComponents.pre_sale_warehouse_receipt_designated_deal]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_designated_deal/index.vue')), // 指定成交
+    [enumOrderComponents.pre_sale_warehouse_receipt_order_summary]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_order_summary/index.vue')), // 订单汇总
+    [enumOrderComponents.pre_sale_warehouse_receipt_pending_order]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_pending_order/index.vue')), // 挂单
+    [enumOrderComponents.pre_sale_warehouse_receipt_bargain]: defineAsyncComponent(() => import('./components/pre_sale_warehouse_receipt_bargain/index.vue')), // 议价
+  },
+  setup() {
+    return { ...handleOrderDetailList(enumOrderComponents.pre_sale_warehouse_receipt) };
+  },
 });
 </script>

+ 21 - 46
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/index.vue

@@ -51,8 +51,8 @@
           </a-row>
           <a-row :gutter="24">
             <a-col :span="12">
-              <a-form-item label="挂牌数量" class="inputIconBox" name="OrderQty">
-                <a-input-number class="dialogInput" style="width: 140px !important" :min="0" v-model:value="formState.OrderQty" placeholder="请输入挂牌数量" />
+              <a-form-item ref="OrderQty" label="挂牌数量" class="inputIconBox" name="OrderQty">
+                <a-input-number class="dialogInput" style="width: 140px !important" :min="0" v-model:value="formState.OrderQty" />
                 <span class="input-enumdicname">{{ selectedRow.enumdicname }}</span>
                 <a-checkbox class="commonCheckbox" v-if="isBlocs()" v-model:checked="numCheck">整单</a-checkbox>
               </a-form-item>
@@ -68,10 +68,10 @@
               </a-form-item>
             </a-col>
           </a-row>
-          <a-row :gutter="24">
+          <a-row :gutter="24" v-if="Number.isInteger(formState.OrderQty)">
             <a-col :span="12" class="mt-20">
               <a-form-item>
-                <a-slider v-model:value="formState.OrderQty" :min="0" :max="selectedRow.enableqty" class="formSlider" style="width: 140px" />
+                <a-slider v-model:value="formState.OrderQty" :min="0" :max="selectedRow.enableqty" class="formSlider" style="width: 140px" @afterChange="() => $refs.OrderQty.onFieldBlur()" />
                 <div class="unit">
                   <span>0</span>
                   <span>{{ selectedRow.enableqty }}{{ selectedRow.enumdicname }}</span>
@@ -125,40 +125,33 @@
           </a-row>
           <a-row :gutter="24">
             <a-col :span="24" v-if="isFloat()" class="relative">
-              <a-form-item :label="'估算价'">
-                <span class="white ml8">{{ getPrice() }}</span>
+              <a-form-item label="估算价">
+                <span class="white ml8">{{getPrice()}}</span>
               </a-form-item>
             </a-col>
-          </a-row>
-          <a-row :gutter="24">
             <a-col :span="24" v-if="isFloat()" class="relative">
-              <a-form-item :label="'估算金额'">
-                <span class="white ml8">{{ getWrMoney() }}</span>
+              <a-form-item label="估算金额">
+                <span class="white ml8">{{getWrMoney()}}</span>
               </a-form-item>
             </a-col>
-            <a-col :span="24" v-if="isFixed()" class="relative">
-              <a-form-item :label="'挂牌金额'">
-                <span class="white ml8">{{ getWrMoney() }}</span>
+            <a-col :span="24" v-else class="relative">
+              <a-form-item label="挂牌金额">
+                <span class="white ml8">{{getWrMoney()}}</span>
               </a-form-item>
             </a-col>
-            <a-col :span="24" v-if="isBlocs()" class="relative">
-              <a-form-item :label="'挂牌金额'">
-                <span class="white ml8">{{ getMoney() }}</span>
-              </a-form-item>
-            </a-col>
-            <a-col :span="24" v-if="getWrMargin() && !isBlocs()">
-              <a-form-item :label="getWrMargin() ? '履约保证金' : ''">
-                <span class="white ml8">{{ getWrMargin() }}</span>
+            <a-col :span="24" v-if="isBlocs()">
+              <a-form-item label="履约保证金">
+                <span class="white ml8">{{getMargin()}}</span>
               </a-form-item>
             </a-col>
-            <a-col :span="24" v-if="isBlocs()">
+            <a-col :span="24" v-else-if="getWrMargin()">
               <a-form-item label="履约保证金">
-                <span class="white ml8">{{ getMargin() }}</span>
+                <span class="white ml8">{{getWrMargin()}}</span>
               </a-form-item>
             </a-col>
             <a-col :span="24">
               <a-form-item label="可用资金">
-                <span class="white ml8">{{ getCanUseMoney(handleSelectedAccount()) }}</span>
+                <span class="white ml8">{{getCanUseMoney(handleSelectedAccount())}}</span>
               </a-form-item>
             </a-col>
           </a-row>
@@ -167,7 +160,7 @@
           <a-col :span="24" class="fixedBtns">
             <a-form-item class="btnCenter">
               <a-button class="listedBtn" :loading="loading" :disabled="loading" @click="submit">卖出</a-button>
-              <a-button class="ml10 cancelBtn" :loading="loading" :disabled="loading" @click="cancel">取消</a-button>
+              <a-button class="ml10 cancelBtn" :loading="loading" :disabled="loading" @click="cancel(false)">取消</a-button>
             </a-form-item>
           </a-col>
         </a-row>
@@ -232,22 +225,7 @@ export default defineComponent({
     const { goodsGroup, goodsList, groupsChange, findGoodsCode } = handleGoods();
 
     // 获取仓单贸易市场
-    const { spotMarkets } = queryMarketSection(false)
-
-    // 切换市场
-    function handleMarket(value: number) {
-      const market = spotMarkets.value.find(item => item.marketid === value)
-      if (!market) return
-
-      // 判断所选择市场挂牌方式 1:一口价 2:浮动价 3:贸易圈 4:协议指定
-      if (market.listingmode === 1) {
-        formState.WRPriceType = 1
-      } else if (market.listingmode === 2) {
-        formState.WRPriceType = 2
-      } else {
-        formState.WRPriceType = 3
-      }
-    }
+    const { spotMarkets, handleMarket } = queryMarketSection(false)
 
     // 点选履约模板
     function handlePermance() {
@@ -339,8 +317,8 @@ export default defineComponent({
             SubNum: props.selectedRow.subnum,
             // WRFactorTypeId: '2121626946446000001', // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
             WRFactorTypeId: props.selectedRow.wrfactortypeid, // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
-            IsSpecified: 0, // 是否指定对手 0:不指定 1:指定 uint32
-            MatchAccIDs: [], // 仓单贸易对手资金账号ID集合(指定对手时填写) uint32
+            IsSpecified: res.isSpecified, // 是否指定对手 0:不指定 1:指定 uint32
+            MatchAccIDs: res.friends, // 仓单贸易对手资金账号ID集合(指定对手时填写) uint32
             OrderQty: res.OrderQty, // 委托数量(可挂部分数据量) ======
             DeliveryGoodsID: props.selectedRow.deliverygoodsid, // 交割商品商品ID
             WRPriceType: res.WRPriceType, // 价格方式 1:固定价 2:浮动价
@@ -382,9 +360,6 @@ export default defineComponent({
               }
             }
             const obj = {
-              IsSpecified: 1,
-              MatchAccIDs: res.friends,
-              WRPriceType: 1,
               TimevalidType: 3, // 时间有效类型 1:当日有效 2:本周有效 3:指定时间有效 4:一直有效
               MarginFlag: 1, // 挂牌是否指定保证金 0:否 1:是
               MarginAlgorithm: 1, // 指定保证金方式 1:比率 2:固定

+ 2 - 0
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/interface.ts

@@ -8,4 +8,6 @@ export interface ListingForm extends BlocsListingForm {
     goodsgroupid: number | undefined,
     goodsid: number | undefined,
     marketid: number | undefined,   // 当前选择挂牌市场ID
+    isSpecified: number, // 是否指定对手
+    listingmode: number, // 挂牌方式 1:一口价 2:浮动价 3:贸易圈 4:协议指定
 }

+ 49 - 7
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/setup.ts

@@ -32,6 +32,8 @@ function initFormData(): ListingForm {
         permanceTempName: '',
         permaceTempId: 0,
         marketid: undefined,
+        isSpecified: 0,
+        listingmode: 0,
     }
 }
 
@@ -51,7 +53,7 @@ export function handleForm(data: WrHoldLB) {
     };
 
     const { v_num } = useVerifyListingNum<ListingForm, 'DelistMinQty'>(formState, 'DelistMinQty', minivalue, enableqty);
-    const { v_basis } = useVerifyListingBasis(formState, 'goodsid');
+    const { v_basis } = useVerifyListingBasis(() => ({ goodsid: formState.goodsid, marketid: formState.marketid }));
 
     // 验证 起摘数量
     const { v_beginDelistingRules, v_beginDelistingNum } = useVerifyBeginDelistingNum(data.minivalue);
@@ -87,14 +89,19 @@ export function handleGoods() {
 
 export function handleNumAndPrice() {
     function isFloat() {
-        return formState.WRPriceType === 2;
+        return formState.listingmode === 2;
     }
     function isFixed() {
-        return formState.WRPriceType === 1;
+        return formState.listingmode === 1;
     }
     function isBlocs() {
         return formState.WRPriceType === 3;
     }
+    // 协议指定
+    function isAgreemt() {
+        return formState.listingmode === 4;
+    }
+
     // 获取选中的资金账号
     const hasRules = () => getRules().length > 0
     //  摘牌金额
@@ -130,7 +137,7 @@ export function handleNumAndPrice() {
         }
 
     }
-    return { getWrMoney, getWrMargin, isFloat, isFixed, isBlocs }
+    return { getWrMoney, getWrMargin, isFloat, isFixed, isBlocs, isAgreemt }
 }
 
 /**
@@ -150,10 +157,45 @@ export function queryMarketSection(isPre: boolean) {
             markets.findIndex(m => m.marketid === item.marketid) !== -1
         )
         spotMarkets.value = resMarkets
-        if (resMarkets.length === 1) {
-            formState.marketid = resMarkets[0].marketid;
+
+        if (resMarkets.length) {
+            const marketid = resMarkets[0].marketid;
+            handleMarket(marketid);
         }
     })
 
-    return { spotMarkets };
+    const handleMarket = (marketid: number) => {
+        formState.friends = [];
+        formState.marketid = marketid;
+        const market = spotMarkets.value.find((e) => e.marketid === marketid);
+        if (market) {
+            formState.listingmode = market.listingmode
+            switch (market.listingmode) {
+                // 浮动价
+                case 2: {
+                    formState.WRPriceType = 2;
+                    formState.isSpecified = 0;
+                    break;
+                }
+                // 贸易圈
+                case 3: {
+                    formState.WRPriceType = 1;
+                    formState.isSpecified = 1;
+                    break;
+                }
+                // 指定价
+                case 4: {
+                    formState.WRPriceType = 1;
+                    formState.isSpecified = 2;
+                    break;
+                }
+                default: {
+                    formState.WRPriceType = 1;
+                    formState.isSpecified = 0;
+                }
+            }
+        }
+    }
+
+    return { spotMarkets, handleMarket };
 }

+ 1 - 1
src/views/order/spot_warran/components/spot_warrant_spot_details/index.vue

@@ -32,7 +32,7 @@ export default defineComponent({
     MtpTableScroll,
     BtnList,
     [ModalEnum.spot_warrant_spot_details_listed]: defineAsyncComponent(() => import('./components/listing/index.vue')), // 挂牌
-    [ModalEnum.spot_warrant_spot_details_pick_up]: defineAsyncComponent(() => import('./components/pick_up/index.vue')), // 摘牌
+    [ModalEnum.spot_warrant_spot_details_pick_up]: defineAsyncComponent(() => import('./components/pick_up/index.vue')), // 提货
   },
   setup() {
     // 表格列表数据