li.shaoyi 2 gadi atpakaļ
vecāks
revīzija
87cfcf74ff

+ 3 - 2
src/packages/pc/views/market/trade/goods/list/listing/index.vue

@@ -51,7 +51,8 @@
                     <template v-if="formData.BuyOrSell === BuyOrSell.Buy">
                         <el-button ref="submitRef" type="danger" :loading="loading"
                             :disabled="!selectedGoodsId || !formData.OrderQty"
-                            @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)">订立</el-button>
+                            @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)"
+                            v-if="!selectedGoods?.iscannotbuy">订立</el-button>
                         <el-button type="primary" :loading="loading"
                             :disabled="!formData.OrderQty || !sellQty || (formData.OrderQty > sellQty)"
                             @click="onBeforeSubmit(EBuildType.BUILDTYPE_CLOSE)" v-if="!isTrademode16">
@@ -62,7 +63,7 @@
                     <template v-if="formData.BuyOrSell === BuyOrSell.Sell">
                         <el-button ref="submitRef" type="warning" :loading="loading"
                             :disabled="!selectedGoodsId || !formData.OrderQty"
-                            @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)" v-if="!isTrademode16">订立</el-button>
+                            @click="onBeforeSubmit(EBuildType.BUILDTYPE_OPEN)" v-if="!isTrademode16 && !selectedGoods?.iscannotsell">订立</el-button>
                         <el-button type="primary" :loading="loading"
                             :disabled="!formData.OrderQty || !buyQty || (formData.OrderQty > buyQty)"
                             @click="onBeforeSubmit(EBuildType.BUILDTYPE_CLOSE)">

+ 2 - 1
src/packages/pc/views/market/trade/presell/transfer/listing/index.vue

@@ -47,7 +47,8 @@
                 </el-form-item>
                 <el-form-item class="footer-btnbar">
                     <el-button ref="submitRef" type="danger" :loading="loading" :disabled="!selectedGoodsId"
-                        @click="onSubmit" v-if="formData.BuyOrSell === BuyOrSell.Buy">订立</el-button>
+                        @click="onSubmit"
+                        v-if="formData.BuyOrSell === BuyOrSell.Buy && !selectedGoods?.iscannotbuy">订立</el-button>
                     <el-button ref="submitRef" type="primary" :loading="loading"
                         :disabled="!formData.OrderQty || !enableqty || (formData.OrderQty > enableqty)" @click="onSubmit"
                         v-if="formData.BuyOrSell === BuyOrSell.Sell">

+ 14 - 1
src/services/api/common/index.ts

@@ -1,4 +1,4 @@
-import { getUserId, getLoginId } from '@/services/methods/user'
+import { getUserId, getLoginId, getMemberUserId } from '@/services/methods/user'
 import { RequestConfig } from '@/services/http/types'
 import service from '@/services'
 import http from '@/services/http'
@@ -257,4 +257,17 @@ export function getJ10News(config: RequestConfig<Model.J10NewsReq> = {}) {
         url: '/Common/GetJ10News',
         params: config.data,
     })
+}
+
+/**
+ * 查询会员商品限制配置表
+ */
+export function queryMemberGoodsLimitConfig(config: RequestConfig<Model.MemberGoodsLimitConfigReq> = {}) {
+    return http.commonRequest<Model.MemberGoodsLimitConfigRsp[]>({
+        url: '/Common/QueryMemberGoodsLimitConfig',
+        params: {
+            userid: getMemberUserId(),
+            ...config.data
+        }
+    })
 }

+ 10 - 1
src/services/methods/user.ts

@@ -1,4 +1,4 @@
-import { useLoginStore, useAccountStore } from '@/stores'
+import { useLoginStore, useAccountStore, useUserStore } from '@/stores'
 
 /**
  * 获取登录ID
@@ -25,4 +25,13 @@ export function getUserId() {
 export function getAccountId() {
     const store = useAccountStore()
     return store.currentAccountId
+}
+
+/**
+ * 获取所属会员ID
+ * @returns 
+ */
+export function getMemberUserId() {
+    const store = useUserStore()
+    return store.memberUserId
 }

+ 33 - 6
src/stores/modules/futures.ts

@@ -1,6 +1,7 @@
 import { shallowRef, reactive, computed, toRefs, onUnmounted } from 'vue'
 import { v4 } from 'uuid'
 import { handlePriceColor } from '@/filters'
+import { queryMemberGoodsLimitConfig } from '@/services/api/common'
 import { queryErmcpGoods, queryQuoteDay } from '@/services/api/goods'
 import { defineStore } from '../store'
 import { timerTask } from '@/utils/timer'
@@ -21,7 +22,7 @@ export const useFuturesStore = defineStore(() => {
 
     const state = reactive({
         loading: false,
-        goodsList: <Model.GoodsRsp[]>[], // 商品列表
+        goodsList: <(Model.GoodsRsp & Partial<Model.MemberGoodsLimitConfigRsp>)[]>[], // 商品列表
         goodsQuoteList: <Model.GoodsQuote[]>[], // 商品行情列表
         selectedGoodsId: <number | undefined>undefined, // 当前选中的商品ID
     })
@@ -73,12 +74,33 @@ export const useFuturesStore = defineStore(() => {
     const getGoodsList = () => {
         state.loading = true
         timerTask.clearTimeout('quoteDay')
-        queryErmcpGoods().then((res) => {
-            state.goodsList = res.data
-            const codes = res.data.map((e) => e.goodscode)
-            if (codes.length) {
-                getQuoteDay(codes)
+        // 任务 #5197
+        queryMemberGoodsLimitConfig({
+            data: {
+                roletype: 7
             }
+        }).then((cfg) => {
+            queryErmcpGoods().then((res) => {
+                state.goodsList = res.data.reduce<(Model.GoodsRsp & Partial<Model.MemberGoodsLimitConfigRsp>)[]>((pre, cur) => {
+                    const item = cfg.data.find((e) => e.goodsid === cur.goodsid)
+                    // 跳过不显示的商品
+                    if (item && item.isnodisplay) {
+                        return pre
+                    }
+                    // 组合商品属性
+                    pre.push({
+                        ...cur,
+                        iscannotbuy: item?.iscannotbuy ?? 0,
+                        iscannotsell: item?.iscannotsell ?? 0
+                    })
+                    return pre
+                }, [])
+
+                const codes = res.data.map((e) => e.goodscode)
+                if (codes.length) {
+                    getQuoteDay(codes)
+                }
+            })
         })
         // 获取商品盘面信息
         const getQuoteDay = (codes: string[]) => {
@@ -216,6 +238,8 @@ export const useFuturesStore = defineStore(() => {
             rise: 0,
             change: 0,
             amplitude: 0,
+            iscannotbuy: 0,
+            iscannotsell: 0,
             bidColor: '',
             bid2Color: '',
             bid3Color: '',
@@ -261,6 +285,9 @@ export const useFuturesStore = defineStore(() => {
                     marketmarginvalue: item.marketmarginvalue,
                 } = goods)
 
+                item.iscannotbuy = goods.iscannotbuy ?? 0
+                item.iscannotsell = goods.iscannotsell ?? 0
+
                 // 向列表添加新数据
                 state.goodsQuoteList.push(item)
             }

+ 7 - 0
src/stores/modules/user.ts

@@ -51,6 +51,12 @@ export const useUserStore = defineStore(() => {
         return userAccount?.hasauth === 1
     })
 
+    // 所属会员ID
+    const memberUserId = computed(() => {
+        const { userAccount } = state.userData
+        return userAccount?.memberuserid ?? 0
+    })
+
     // 获取用户数据
     const getUserData = async () => {
         try {
@@ -95,6 +101,7 @@ export const useUserStore = defineStore(() => {
         userType,
         userAvatar,
         hasAuth,
+        memberUserId,
         getUserData,
         getUserDataInfo,
         getSystemParamValue,

+ 18 - 0
src/types/model/common.d.ts

@@ -334,5 +334,23 @@ declare global {
             orderPriceType: number; // 下单默认价格类型,1=现价,2=对手价,3=实时价,4=实时对手价
             orderQtyIsEmpty: boolean; // 下单后是否清空数量输入框
         }
+
+        /** 查询会员商品限制配置表 请求 */
+        interface MemberGoodsLimitConfigReq {
+            userid?: number; // 用户ID
+            roletype: number; // 会员角色 - 6:自营会员 7:经纪会员
+        }
+
+        /** 查询会员商品限制配置表 响应 */
+        interface MemberGoodsLimitConfigRsp {
+            autoid: number; // AutoID(SEQ_MEMBERGOODSLIMITCONFIG)
+            goodsid: number; // 商品ID
+            iscannotbuy: number; // 是否不能挂买 0:否 1:是
+            iscannotsell: number; // 是否不能挂卖 0:否 1:是
+            isnodisplay: number; // 是否显示 0:否 1:是
+            roletype: number; // 会员角色 - 6:自营会员 7:经纪会员
+            updatetime: string; // 更新时间
+            userid: number; // 会员用户ID
+        }
     }
 }

+ 4 - 2
src/types/model/market.d.ts

@@ -129,7 +129,9 @@ declare namespace Model {
         totalvolume: number; // 总量
         totalturnover: number; // 总金额
         holdvolume: number; // 持仓
-        marketmarginalgorithm:number; // 保证金计算方式
-        marketmarginvalue:number; // 即市保证金值
+        marketmarginalgorithm: number; // 保证金计算方式
+        marketmarginvalue: number; // 即市保证金值
+        iscannotbuy: number; // 是否不能挂买 0:否 1:是
+        iscannotsell: number; // 是否不能挂卖 0:否 1:是
     }
 }