소스 검색

Fixed Bug.

zhou.xiaoning 4 년 전
부모
커밋
fc05e4dae2

+ 88 - 31
src/views/order/pre_sale_warehouse_receipt/components/pre_sale_warehouse_receipt_order_summary/components/listed/index.vue

@@ -22,12 +22,14 @@
               <a-form-item label="挂牌方式"
                            name="WRPriceType">
                 <a-select class="inlineFormSelect"
-                          default-value="1"
-                          v-model:value="formState.WRPriceType"
-                          style="width: 140px">
-                  <a-select-option :value="1">一口价</a-select-option>
+                          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>
+                  <a-select-option :value="3">贸易圈</a-select-option> -->
+                  <a-select-option v-for="item in spotMarkets" :key="item.marketid" :value="item.marketid">{{item.marketname}}</a-select-option>
                 </a-select>
               </a-form-item>
             </a-col>
@@ -158,7 +160,6 @@
               </a-form-item>
             </a-col>
           </a-row>
-          <template v-if="isBlocs()">
             <a-row :gutter="24">
               <a-col :span="12">
                 <a-form-item label="履约保证金"
@@ -187,32 +188,33 @@
                              class="inputIconBox">
                   <span :class="['clickBox', formState.permanceTempName ? 'white' : '']"
                         style="width: 140px"
-                        @click="openPermance">{{formState.permanceTempName ? formState.permanceTempName : '选择履约模板'}}</span>
+                        @click="handlePermance">{{formState.permanceTempName ? formState.permanceTempName : '选择履约模板'}}</span>
                   <svg class="icon svg-icon"
                        aria-hidden="true"
-                       @click="openPermance">
+                       @click="handlePermance">
                     <use xlink:href="#icon-moban" />
                   </svg>
                 </a-form-item>
               </a-col>
-              <a-col :span="12">
-                <a-form-item label="指定朋友"
-                             class="inputIconBox">
-                  <span :class="['clickBox', getFriendLength() ? 'white' : '']"
-                        style="width: 140px"
-                        @click="openFriend">{{getFriendLength() ? `已选${getFriendLength() }人` : '选择朋友'}}</span>
-                  <svg class="icon svg-icon"
-                       aria-hidden="true"
-                       @click="openFriend">
-                    <use xlink:href="#icon-pengyou1" />
-                  </svg>
-                  <a-checkbox class="commonCheckbox"
-                              v-model:checked="friendCheck"
-                              @change="limiteFriends">不限</a-checkbox>
-                </a-form-item>
-              </a-col>
+              <template v-if="isBlocs()">
+                <a-col :span="12">
+                  <a-form-item label="指定朋友"
+                              class="inputIconBox">
+                    <span :class="['clickBox', getFriendLength() ? 'white' : '']"
+                          style="width: 140px"
+                          @click="openFriend">{{getFriendLength() ? `已选${getFriendLength() }人` : '选择朋友'}}</span>
+                    <svg class="icon svg-icon"
+                        aria-hidden="true"
+                        @click="openFriend">
+                      <use xlink:href="#icon-pengyou1" />
+                    </svg>
+                    <a-checkbox class="commonCheckbox"
+                                v-model:checked="friendCheck"
+                                @change="limiteFriends">不限</a-checkbox>
+                  </a-form-item>
+                </a-col>
+              </template>
             </a-row>
-          </template>
           <a-row :gutter="24">
             <a-col :span="24"
                    v-if="isFloat()"
@@ -290,6 +292,7 @@
   <!-- 选择履约模板 -->
   <Permance v-if="showPermance"
             :position="'bottom'"
+            :marketid="formState.marketid"
             @cancel="choosePermance"
             @update="choosePermance" />
 </template>
@@ -317,7 +320,7 @@ import moment from 'moment';
 import { v4 as uuidv4, v4 } from 'uuid';
 import { defineComponent, onMounted, PropType, ref } from 'vue';
 import { ListingForm } from './interface';
-import { handleForm, handleGoods, handleNumAndPrice } from './setup';
+import { handleForm, handleGoods, handleNumAndPrice, queryMarketSection } from './setup';
 
 export default defineComponent({
     name: ModalEnum.spot_warrant_spot_details_listed,
@@ -344,6 +347,37 @@ export default defineComponent({
         const { numCheck, increaseNumber, decreaseNumber } = useBlocksNumber(formState);
 
         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
+          }
+        }
+
+        // 点选履约模板
+        function handlePermance() {
+          // 必须先选择市场再选择对应的履约模板
+          if (!formState.marketid) {
+            message.info('请先选择市场')
+            return
+          }
+
+          openPermance()
+        }
+
+
         // 切换商品组
         function handleGoodsGroups(value: number) {
             formState.goodsid = undefined;
@@ -386,7 +420,27 @@ export default defineComponent({
             return item.taaccounttype === 2 ? item : list[0];
         }
         function submit() {
-            const marketInfo = getMarketRunByTradeMode(17);
+            debugger;
+            // 市场信息
+            if (!formState.marketid) { 
+              message.info("请选择市场")
+              return
+            }
+
+            // const marketInfo = getMarketRunByTradeMode(17);
+            const market = spotMarkets.value.find(item => item.marketid === formState.marketid)
+            if (!market) {
+              message.info("市场信息异常,请稍后重试")
+              return
+            }
+
+            // 履约模板
+            if (!formState.permanceTempName) {
+              message.info('请选择履约模板')
+              return
+            }
+
+            const marketInfo = getMarketRunByTradeMode(market!.trademode)
             if (marketInfo) {
                 // 无仓单挂牌
                 validateAction<ListingForm>(formRef, formState).then((res) => {
@@ -442,10 +496,10 @@ export default defineComponent({
                     };
                     if (isBlocs()) {
                         // 贸易圈 是后加的, 处理贸易圈
-                        if (!formState.permanceTempName) {
-                            message.error('请选择履约模板');
-                            return;
-                        }
+                        // if (!formState.permanceTempName) {
+                        //     message.error('请选择履约模板');
+                        //     return;
+                        // }
                         if (!friendCheck.value) {
                             if (formState.friends.length === 0) {
                                 message.error('请选择朋友');
@@ -509,6 +563,9 @@ export default defineComponent({
             getFriendLength,
             limiteFriends,
             getPrice,
+            spotMarkets,
+            handleMarket,
+            handlePermance,
         };
     },
 });

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

@@ -7,4 +7,5 @@ export interface ListingForm extends BlocsListingForm {
     PriceMove: number,// 升贴水(浮动价时填写)
     goodsgroupid: number | undefined,
     goodsid: number | undefined,
+    marketid: number | undefined,   // 当前选择挂牌市场ID
 }

+ 28 - 1
src/views/order/pre_sale_warehouse_receipt/components/pre_sale_warehouse_receipt_order_summary/components/listed/setup.ts

@@ -3,13 +3,16 @@ import { validateCommon } from '@/common/setup/validate';
 import { handleForm as useForm } from '@/common/setup/warehouse_receipt_trade/listing';
 import { useVerifyBeginDelistingNum, useVerifyListingBasis, useVerifyListingNum } from '@/hooks/form/verify';
 import { getGoodsGroupsByTradeMode, getIPOGoodsList, getQuoteDayInfoByCodeFindPrice } from '@/services/bus/goods';
+import { getAllMarkets } from '@/services/bus/market';
 import { getRules } from '@/services/bus/rules';
 import { Goods } from "@/services/go/ermcp/goodsInfo/interface";
+import { TjmdMarketSection, TjmdMarketSectionConfig } from '@/services/go/Tjmd/interface';
 import { WrPosition } from "@/services/go/wrtrade/interface";
 import { RuleObject } from 'ant-design-vue/lib/form/interface';
 import moment from 'moment';
 import { onBeforeUnmount, reactive, ref, UnwrapRef } from "vue";
 import { ListingForm } from "./interface";
+import { queryTjmdMarketSection } from "@/services/go/Tjmd"
 
 
 function initFormData(): ListingForm {
@@ -29,6 +32,7 @@ function initFormData(): ListingForm {
         friends: [],
         permanceTempName: '',
         permaceTempId: 0,
+        marketid: undefined,
     }
 }
 
@@ -57,7 +61,7 @@ export function handleForm(data: WrPosition) {
         DelistMinQty: v_beginDelistingRules,
         DeliveryMonth: [{ required: true, message: '请选择交收月', }],
         goodsid: [{ required: true, validator: v_group }],
-
+        marketid: [{ required: true, message: '请选择挂牌市场', }],
     }
     Object.assign(rules, rule)
     onBeforeUnmount(() => {
@@ -125,3 +129,26 @@ export function handleNumAndPrice() {
     }
     return { getWrMoney, getWrMargin, isFloat, isFixed, isBlocs }
 }
+
+/**
+ * 查询市场板块,用于挂牌时挂牌方式选择,替代之前的“一口价、浮动价和贸易圈”
+ */
+ 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 => 
+            item.auctionwrtype === (isPre ? 1 : 2) && (item.trademode === TradeMode.WarehouseReceiptTrade)
+        ).filter(item => 
+            markets.findIndex(m => m.marketid === item.marketid) !== -1
+        )
+        spotMarkets.value = resMarkets
+        debugger;
+    })
+
+    return { spotMarkets };
+}

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

@@ -419,7 +419,7 @@ export default defineComponent({
 
             // 履约模板
             if (!formState.permanceTempName) {
-              message.error('请选择履约模板')
+              message.info('请选择履约模板')
               return
             }
 
@@ -481,10 +481,10 @@ export default defineComponent({
                     };
                     if (isBlocs()) {
                         // 贸易圈 是后加的, 处理贸易圈
-                        if (!formState.permanceTempName) {
-                            message.error('请选择履约模板');
-                            return;
-                        }
+                        // if (!formState.permanceTempName) {
+                        //     message.error('请选择履约模板');
+                        //     return;
+                        // }
                         if (!friendCheck.value) {
                             if (formState.friends.length === 0) {
                                 message.error('请选择朋友');