li.shaoyi il y a 1 an
Parent
commit
27c020b92c

+ 3 - 1
src/business/login/index.ts

@@ -2,7 +2,7 @@ import { shallowRef, reactive } from 'vue'
 import { v4 } from 'uuid'
 import { timerTask } from '@/utils/timer'
 import { wsLogin, httpLogin, queryLoginId } from '@/services/api/account'
-import { useGlobalStore, useLoginStore, useEnumStore, useErrorInfoStore, useUserStore, useFuturesStore, useAccountStore } from '@/stores'
+import { useGlobalStore, useLoginStore, useEnumStore, useErrorInfoStore, useUserStore, useFuturesStore, useAccountStore,useDeliveryRelationStore } from '@/stores'
 import service from '@/services'
 import quoteSocket from '@/services/websocket/quote'
 import tradeSocket from '@/services/websocket/trade'
@@ -25,6 +25,7 @@ export function useLogin(persist = false) {
     const userStore = useUserStore()
     const accountStore = useAccountStore()
     const futuresStore = useFuturesStore()
+    const deliveryRelationStore = useDeliveryRelationStore()
 
     const { logining, token } = loginStore.$toRefs()
 
@@ -48,6 +49,7 @@ export function useLogin(persist = false) {
         await Promise.all([
             userStore.getUserData(),
             accountStore.getAccountList(),
+            deliveryRelationStore.getDeliveryRelation()
         ])
         futuresStore.getGoodsList()
         checkTokenLoop()

+ 1 - 0
src/packages/mobile/components/base/pull-refresh/index.vue

@@ -1,3 +1,4 @@
+<!-- 待优化 -->
 <template>
     <PullRefresh class="app-pull-refresh" v-model="refreshing" @refresh="onRefresh">
         <slot name="header"></slot>

+ 35 - 11
src/packages/mobile/views/order/position/components/goods/list/Index.vue

@@ -44,14 +44,17 @@
                     </ul>
                 </div>
                 <div class="g-order-list__btnbar" v-if="item.enableqty">
-                    <Button size="small" @click="showComponent('close', item)" round>{{ $t('operation.transfer') }}</Button>
-                    <Button size="small" @click="showComponent(item.trademode === 16 ? 'delivery16' : 'delivery50', item)"
-                        round v-if="showDelivery(item)">{{ $t('operation.delivery') }}</Button>
+                    <Button size="small" @click="showCloseComponent(item)" round>
+                        {{ $t('operation.transfer') }}
+                    </Button>
+                    <Button size="small" @click="showDeliveryComponent(item)" round v-if="showDelivery(item)">
+                        {{ $t('operation.delivery') }}
+                    </Button>
                 </div>
             </div>
         </div>
-        <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)" @closed="closeComponent"
-            v-if="componentId" />
+        <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)"
+            @closed="closeComponent" v-if="componentId" />
     </app-pull-refresh>
 </template>
 
@@ -62,7 +65,7 @@ import { useComponent } from '@/hooks/component'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
 import { formatDecimal, handleNumberValue } from '@/filters'
-import { useGlobalStore, useUserStore, usePositionStore, useFuturesStore } from '@/stores'
+import { useGlobalStore, useUserStore, usePositionStore, useFuturesStore, useDeliveryRelationStore } from '@/stores'
 
 const componentMap = new Map<string, unknown>([
     ['close', defineAsyncComponent(() => import('../close/Index.vue'))],
@@ -74,6 +77,7 @@ const globalStore = useGlobalStore()
 const userStore = useUserStore()
 const positionStore = usePositionStore()
 const futuresStore = useFuturesStore()
+const deliveryRelationStore = useDeliveryRelationStore()
 const selectedRow = shallowRef<Model.TradePositionRsp>()
 const pullRefreshRef = shallowRef()
 
@@ -86,6 +90,15 @@ const { componentRef, componentId, openComponent, closeComponent } = useComponen
 
 const showDelivery = (row: Model.TradePositionRsp) => {
     if (globalStore.hasSystemModule('delivery')) {
+        // #6084
+        if (row.trademode === 16) {
+            const item = deliveryRelationStore.getDeliveryRelationByGoodsId(row.goodsid)
+            if (item && [1, 4].includes(item.deliverymode)) {
+                if (item.deliverymode === 1) return true
+            } else {
+                return false
+            }
+        }
         // #5741
         const { markets, userInfo } = userStore.userData
         const market = markets.find((e) => e.marketid === row.marketid)
@@ -97,13 +110,24 @@ const showDelivery = (row: Model.TradePositionRsp) => {
     return false
 }
 
-// 持仓列表刷新
-const onRefresh = () => {
-    positionStore.getTradePosition()
+const showCloseComponent = (row: Model.TradePositionRsp) => {
+    selectedRow.value = row
+    openComponent('close')
 }
 
-const showComponent = (componentName: string, row: Model.TradePositionRsp) => {
+const showDeliveryComponent = (row: Model.TradePositionRsp) => {
+    const item = deliveryRelationStore.getDeliveryRelationByGoodsId(row.goodsid)
     selectedRow.value = row
-    openComponent(componentName)
+    // #6084
+    if (row.trademode === 16 && item?.deliverymode === 1) {
+        openComponent('delivery16')
+    } else {
+        openComponent('delivery50')
+    }
+}
+
+// 持仓列表刷新
+const onRefresh = () => {
+    positionStore.getTradePosition()
 }
 </script>

+ 2 - 2
src/packages/sbyj/views/mine/index.vue

@@ -117,11 +117,11 @@
                         <Iconfont icon="g-icon-yszc">关于隐私</Iconfont>
                     </template>
                 </Cell>
-                <Cell is-link :to="{ name: 'rules-fwrx' }">
+                <!-- <Cell is-link :to="{ name: 'rules-fwrx' }">
                     <template #title>
                         <Iconfont icon="g-icon-fwrx">服务热线</Iconfont>
                     </template>
-                </Cell>
+                </Cell> -->
                 <Cell is-link :to="{ name: 'mine-setting' }">
                     <template #title>
                         <Iconfont icon="g-icon-setting">设置</Iconfont>

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

@@ -28,7 +28,7 @@
                     </Field>
                 </CellGroup>
                 <CellGroup inset>
-                    <Cell title="交易时间" :value="`${param326} - ${param327}`" />
+                    <Cell title="交收时间" :value="param326 && param327 ? `${param326} - ${param327}` : '--'" />
                 </CellGroup>
             </Form>
             <template #footer>
@@ -134,10 +134,10 @@ const onSubmit = () => {
                         hideLoading(err, 'fail')
                     })
                 } else {
-                    hideLoading('不在交时间段内', 'fail')
+                    hideLoading('不在交时间段内', 'fail')
                 }
             } else {
-                hideLoading('交时间错误,请联系管理员', 'fail')
+                hideLoading('交时间错误,请联系管理员', 'fail')
             }
         }).catch(() => {
             hideLoading('服务器时间错误', 'fail')

+ 1 - 0
src/stores/index.ts

@@ -5,6 +5,7 @@ export { useGlobalStore } from './modules/global'
 export { useMenuStore } from './modules/menu'
 export { useAccountStore } from './modules/account'
 export { useFuturesStore } from './modules/futures'
+export { useDeliveryRelationStore } from './modules/delivery'
 export { i18n } from './modules/language'
 export { useErrorInfoStore } from './modules/errorInfo'
 export { useNoticeStore } from './modules/notice'

+ 30 - 0
src/stores/modules/delivery.ts

@@ -0,0 +1,30 @@
+import { reactive, toRefs } from 'vue'
+import { queryDeliveryRelation } from '@/services/api/goods'
+import { defineStore } from '../store'
+
+export const useDeliveryRelationStore = defineStore(() => {
+    const state = reactive({
+        loading: false,
+        deliveryRelationList: <Model.DeliveryRelationRsp[]>[], // 商品交割关系列表
+    })
+
+    const getDeliveryRelation = async () => {
+        try {
+            state.loading = true
+            const res = await queryDeliveryRelation()
+            state.deliveryRelationList = res.data
+        } finally {
+            state.loading = false
+        }
+    }
+
+    const getDeliveryRelationByGoodsId = (goodsid: number) => {
+        return state.deliveryRelationList.find((e) => e.goodsid === goodsid)
+    }
+
+    return {
+        ...toRefs(state),
+        getDeliveryRelation,
+        getDeliveryRelationByGoodsId,
+    }
+})