li.shaoyi 1 rok pred
rodič
commit
dff01f1b64

+ 7 - 2
src/packages/sbyj/views/market/detail/index.vue

@@ -271,8 +271,13 @@ const onSubmit = () => {
 const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
     OrderQty: [{
         validator: () => {
-            if (orderQty.value) {
-                return orderQty.value % agreeunit.value === 0 ? true : '重量只能是' + agreeunit.value + '的整数倍'
+            const qty=orderQty.value
+            if (qty) {
+                const { traderules = [], agreeunit = 0 } = quote.value ?? {}
+                const { ParamValue = 1 } = traderules.find((e) => e.RuleID === 103) ?? {}
+                if (qty % agreeunit !== 0) return '重量只能是' + agreeunit + '的整数倍'
+                if ((qty / agreeunit) % ParamValue !== 0) return '最小重量只能是' + ParamValue + '的整数倍'
+                return true
             }
             return '请输入重量'
         }

+ 6 - 1
src/packages/sbyj/views/order/list/components/close-holder/index.vue

@@ -71,6 +71,7 @@ const props = defineProps({
 
 const futuresStore = useFuturesStore()
 const quote = futuresStore.getGoodsQuote(props.selectedRow.goodsCode)
+
 const { formData, formSubmit } = useOrder()
 const formRef = shallowRef<FormInstance>()
 const showModal = shallowRef(true)
@@ -97,7 +98,11 @@ const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
                 if (val > enableqty.value) {
                     return '可用重量不足'
                 }
-                return orderQty.value % agreeunit.value === 0 ? true : '重量只能是' + agreeunit.value + '的整数倍'
+                const { traderules = [], agreeunit = 0 } = quote.value ?? {}
+                const { ParamValue = 1 } = traderules.find((e) => e.RuleID === 103) ?? {}
+                if (val % agreeunit !== 0) return '重量只能是' + agreeunit + '的整数倍'
+                if ((val / agreeunit) % ParamValue !== 0) return '最小重量只能是' + ParamValue + '的整数倍'
+                return true
             }
             return '请输入终止重量'
         }

+ 9 - 2
src/packages/sbyj/views/order/list/components/market-order-delivery/index.vue

@@ -49,7 +49,7 @@ import { BuyOrSell } from '@/constants/order'
 import { getGoodsUnitName } from '@/constants/unit'
 import { getServerTime } from '@/services/api/common'
 import { marketOrderDeliveryApply } from '@/services/api/trade'
-import { useUserStore } from '@/stores'
+import { useUserStore, useFuturesStore } from '@/stores'
 import AppModal from '@/components/base/modal/index.vue'
 import moment from 'moment'
 
@@ -64,6 +64,9 @@ const userStore = useUserStore()
 const param326 = userStore.getSystemParamValue('326')
 const param327 = userStore.getSystemParamValue('327')
 
+const futuresStore = useFuturesStore()
+const quote = futuresStore.getGoodsQuote(props.selectedRow.goodsCode)
+
 const formData = reactive<Proto.MarketOrderDeliveryApplyReq>({ HoldDetails: [] })
 const formRef = shallowRef<FormInstance>()
 const showModal = shallowRef(true)
@@ -89,7 +92,11 @@ const formRules: { OrderQty?: FieldRule[] } = {
                 if (val > enableqty.value) {
                     return '可用重量不足'
                 }
-                return orderQty.value % agreeunit.value === 0 ? true : '重量只能是' + agreeunit.value + '的整数倍'
+                const { traderules = [], agreeunit = 0 } = quote.value ?? {}
+                const { ParamValue = 1 } = traderules.find((e) => e.RuleID === 103) ?? {}
+                if (val % agreeunit !== 0) return '重量只能是' + agreeunit + '的整数倍'
+                if ((val / agreeunit) % ParamValue !== 0) return '最小重量只能是' + ParamValue + '的整数倍'
+                return true
             }
             return `请输入${getTagName()}重量`
         }

+ 1 - 1
src/packages/sbyj/views/user/login/index.less

@@ -10,7 +10,7 @@
         top: 0;
         left: -20%;
         width: 140%;
-        height: 200px;
+        height: 240px;
         border-radius: 0 0 50% 50%;
         background: linear-gradient(35deg, #243862, #3e5ea2);
     }

+ 23 - 9
src/stores/modules/futures.ts

@@ -94,15 +94,27 @@ export const useFuturesStore = defineStore(() => {
                 continue
             }
             // 更新商品配置
-            const findAccountConfig = accountConfig.todayAccountMargins.find((e) => e.accountid === accountStore.currentAccountId && e.goodsid === item.goodsid)
-            const config = findAccountConfig ?? accountConfig.todayAccountMargins.find((e) => e.accountid === 0 && e.goodsid === item.goodsid)
-            if (config) {
-                const wordArray = CryptoJS.enc.Base64.parse(config.infocontent) // 解析base64
-                const uint8Array = wordArrayToUint8Array(wordArray)
-                const res = await decodeProto<Proto.MarginInfoStruct>('MarginInfoStruct', uint8Array) // proto数据解析
-                item.marketmarginalgorithm = res.MarginAlgorithm
-                item.marketmarginvalue = res.MarketMarginValue
+            const findMargin = accountConfig.todayAccountMargins.find((e) => e.accountid === accountStore.currentAccountId && e.goodsid === item.goodsid)
+            const margin = findMargin ?? accountConfig.todayAccountMargins.find((e) => e.accountid === 0 && e.goodsid === item.goodsid)
+            if (margin) {
+                const marginWordArray = CryptoJS.enc.Base64.parse(margin.infocontent) // 解析base64
+                const marginUint8Array = wordArrayToUint8Array(marginWordArray)
+                const marginData = await decodeProto<Proto.MarginInfoStruct>('MarginInfoStruct', marginUint8Array) // proto数据解析
+                item.marketmarginalgorithm = marginData.MarginAlgorithm
+                item.marketmarginvalue = marginData.MarketMarginValue
             }
+
+            const findRule = accountConfig.todayAccountTradeRules.find((e) => e.accountid === accountStore.currentAccountId && e.goodsid === item.goodsid)
+            const rule = findRule ?? accountConfig.todayAccountTradeRules.find((e) => e.accountid === 0 && e.goodsid === item.goodsid)
+            if (rule) {
+                const ruleWordArray = CryptoJS.enc.Base64.parse(rule.infocontent) // 解析base64
+                const ruleUint8Array = wordArrayToUint8Array(ruleWordArray)
+                const ruleData = await decodeProto<Proto.TradeRuleInfoStruct>('TradeRuleInfoStruct', ruleUint8Array) // proto数据解析
+                item.traderules = ruleData.TradeRules
+            } else {
+                item.traderules = []
+            }
+
             // 组合商品属性
             state.goodsList.push({
                 ...item,
@@ -305,6 +317,7 @@ export const useFuturesStore = defineStore(() => {
             openedColor: '',
             highestColor: '',
             lowestColor: '',
+            traderules: []
         }
 
         if (item.goodsid) {
@@ -340,7 +353,8 @@ export const useFuturesStore = defineStore(() => {
                     provideraccountid: item.provideraccountid,
                     provideruserid: item.provideruserid,
                     goodstradetype: item.goodstradetype,
-                    currencyid: item.currencyid
+                    currencyid: item.currencyid,
+                    traderules: item.traderules
                 } = goods)
 
                 item.iscannotbuy = goods.iscannotbuy ?? 0

+ 1 - 0
src/types/model/goods.d.ts

@@ -68,6 +68,7 @@ declare namespace Model {
         tradeproperty: number; // 交易属性 - 1:收益权(可做空) 2:所有权(不可做空) 3:期权 4:现货 5:参考行情 6:通道交易 7:币交易 8:场外期权
         provideraccountid: number; // 发售方资金账户ID(49)\供货商资金账户ID(50)
         provideruserid: number; // 发售方用户ID(49)\供货商(50)
+        traderules: Proto.TradeRuleInfoStruct['TradeRules'] // 交易规则
     }
 
     /** 现货商品详情 */

+ 1 - 0
src/types/model/market.d.ts

@@ -143,6 +143,7 @@ declare namespace Model {
         provideruserid: number; // 发售方用户ID(49)\供货商(50)
         goodstradetype: number;//商品交易权限类型 - 1:可建可平 3:不可建可平
         currencyid: number;//报价货币ID
+        traderules: Proto.TradeRuleInfoStruct['TradeRules'] // 交易规则
     }
 
     /** 查询新板块设置 响应 */