li.shaoyi il y a 10 mois
Parent
commit
d1d0fdf173

+ 2 - 2
oem/tss/config/appconfig.json

@@ -1,8 +1,8 @@
 {
   "appId": "com.muchinfo.tss",
   "appName": "TCE",
-  "version": "1.0.38",
-  "versionCode": "100038",
+  "version": "1.0.40",
+  "versionCode": "100040",
   "apiUrl": "http://192.168.31.210:8080/cfg?key=test_210",
   "tradeChannel": "ws",
   "showLoginAlert": true,

+ 3 - 3
src/business/trade/index.ts

@@ -563,12 +563,9 @@ export function useOrder() {
 
     const formData = reactive<Partial<Proto.OrderReq>>({
         ClientType: ClientType.Web,
-        LoginID: loginStore.loginId,
-        AccountID: accountStore.currentAccountId,
         BuyOrSell: BuyOrSell.Buy,
         OperateType: EOrderOperateType.ORDEROPERATETYPE_NORMAL,
         OrderSrc: OrderSrc.ORDERSRC_CLIENT,
-        OperatorID: loginStore.loginId,
         ListingSelectType: EListingSelectType.LISTINGSELECTTYPE_DELISTING,
         DelistingType: EDelistingType.DELISTINGTYPE_SELECTED,
         BuildType: EBuildType.BUILDTYPE_OPEN,
@@ -583,6 +580,9 @@ export function useOrder() {
             const res = await order({
                 data: {
                     ...formData,
+                    LoginID: loginStore.loginId,
+                    OperatorID: loginStore.loginId,
+                    AccountID: accountStore.currentAccountId,
                     ClientSerialNo: v4(),
                     ClientOrderTime: formatDate(new Date().toISOString()),
                 }

+ 3 - 11
src/packages/tss/views/order/position/Index.vue

@@ -87,18 +87,17 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent } from 'vue'
+import { shallowRef, defineAsyncComponent, onActivated } from 'vue'
 import { Button, Image } from 'vant'
 import { getFileUrl } from '@/filters'
 import { useComponent } from '@/hooks/component'
 import { getBuyOrSellName, BuyOrSell, PriceMode } from '@/constants/order'
 import { formatDecimal, formatDate, handleRequestBigNumber, handlePriceColor } from '@/filters'
-import { useSBYJOrderStore, i18n, useFuturesStore, useLoginStore, useAccountStore } from '@/stores'
+import { useSBYJOrderStore, i18n, useFuturesStore } from '@/stores'
 import { useOrder } from '@/business/trade'
 import { dialog, fullloading } from '@/utils/vant'
 import { EBuildType, EDelistingType, EListingSelectType, EValidType } from '@/constants/client'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
-import eventBus from '@/services/bus'
 import { getGoodsUnitName } from '@/constants/unit'
 
 defineProps({
@@ -165,9 +164,6 @@ const goodsname = (item: Model.SBYJMyOrderRsp) => {
 }
 
 const onCloseSumit = (item: Model.SBYJMyOrderRsp) => {
-    const loginStore = useLoginStore()
-    const accountStore = useAccountStore()
-
     dialog({
         message: t('position.goods.tips3'),
         showCancelButton: true,
@@ -175,9 +171,6 @@ const onCloseSumit = (item: Model.SBYJMyOrderRsp) => {
         const { marketID, goodsID, buyOrSell, tradeID } = item.tHDetailEx
         /// 市场ID
         formData.Header = { GoodsID: goodsID }
-        formData.LoginID = loginStore.loginId
-        formData.AccountID = accountStore.currentAccountId
-        formData.OperatorID = loginStore.loginId
         formData.MarketID = marketID
         formData.BuyOrSell = buyOrSell === BuyOrSell.Buy ? BuyOrSell.Sell : BuyOrSell.Buy
         formData.GoodsID = goodsID
@@ -195,8 +188,6 @@ const onCloseSumit = (item: Model.SBYJMyOrderRsp) => {
         fullloading((hideLoading) => {
             formSubmit().then(() => {
                 hideLoading(t('position.goods.tips4'), 'success')
-                // 成交通知
-                eventBus.$emit('OrderDealedNtf')
                 getSBYJMyOrders()
             }).catch((err) => {
                 hideLoading(err, 'fail')
@@ -205,6 +196,7 @@ const onCloseSumit = (item: Model.SBYJMyOrderRsp) => {
     })
 }
 
+onActivated(() => getSBYJMyOrders())
 </script>
 
 <style lang="less" scoped>

+ 21 - 17
src/stores/modules/account.ts

@@ -19,17 +19,23 @@ export const useAccountStore = defineStore(() => {
         loading: boolean;
         accountList: Model.TaAccountsRsp[];
         currentAccountId: number;
-        currentAccountConfig?: Model.TodayAccountConfigInfoRsp;
+        currentAccountConfig: Model.TodayAccountConfigInfoRsp;
     }>({
         loading: false,
         accountList: [],
-        currentAccountId: 0
+        currentAccountId: 0,
+        currentAccountConfig: {
+            riskRatioType: {},
+            todayAccountMargins: [],
+            todayAccountTradeRules: [],
+            todayAccountTradefees: []
+        }
     })
 
     // 资金账户计算列表
     const accountComputedList = computed(() => {
-        const { riskRatioType } = state.currentAccountConfig ?? {}
-        const { addmarginriskratio = 0, notemarginriskratio = 0, cutriskratio = 0 } = riskRatioType ?? {}
+        const { riskRatioType } = state.currentAccountConfig
+        const { addmarginriskratio = 0, notemarginriskratio = 0, cutriskratio = 0 } = riskRatioType
 
         const result: (Model.TaAccountsRsp & {
             freezeMargin: number; // 冻结资金
@@ -150,25 +156,23 @@ export const useAccountStore = defineStore(() => {
     const getAccountList = async () => {
         try {
             state.loading = true
-            const res = await queryTaAccounts({
+
+            await queryTaAccounts({
                 data: {
                     loginID: loginStore.loginId
                 }
+            }).then((res) => {
+                state.accountList = res.data
+                // 查找当前选中的资金账户
+                if (!res.data.every((e) => e.accountid === state.currentAccountId)) {
+                    state.currentAccountId = res.data[0]?.accountid ?? 0
+                }
             })
-            const data = res.data
-            state.accountList = data
-
-            // 查找当前选中的资金账户
-            if (!data.every((e) => e.accountid === state.currentAccountId)) {
-                state.currentAccountId = data[0]?.accountid ?? 0
-            }
 
             // 任务 #5511
-            if (!state.currentAccountConfig) {
-                getTodayAccountConfigInfo().then((res) => {
-                    state.currentAccountConfig = res.data
-                })
-            }
+            await getTodayAccountConfigInfo().then((res) => {
+                state.currentAccountConfig = res.data
+            })
         } finally {
             state.loading = false
         }