li.shaoyi 2 éve
szülő
commit
69c7d18d56

+ 1 - 1
doc/android/fxgl.txt

@@ -16,7 +16,7 @@ http://103.40.249.126:18280/cfg?key=mtp_20
 
 
 甘肃碳交
-cn.muchinfo.cgeex_trial_v1.0.0.apk
+cn.muchinfo.gstj_demo_v1.0.0.apk
 http://8.130.36.162:8280/cfg?key=mtp_20
 
 

+ 1 - 1
oem/gstj/manifest.json

@@ -2,7 +2,7 @@
     "@platforms" : [ "android", "iPhone", "iPad" ],
     "id" : "H5E4A9458",
     /*应用的标识*/
-    "name" : "多元世纪",
+    "name" : "甘肃碳交",
     /*应用名称,程序桌面图标名称*/
     "version" : {
         "name" : "1.0.0",

+ 1 - 1
src/hooks/echarts/candlestick/options.ts

@@ -57,7 +57,7 @@ export function useOptions(dataset: EchartsDataset) {
             dataZoom: {
                 type: 'inside',
                 startValue: source.length - 60, // 起始显示K线条数(最新60条)
-                endValue: source.length,
+                end: 100,
                 minValueSpan: 30, // 限制窗口缩放显示最少数据条数
                 maxValueSpan: 200, // 限制窗口缩放显示最大数据条数
             },

+ 1 - 1
src/hooks/echarts/line/options.ts

@@ -70,7 +70,7 @@ export function useOptions(dataset: EchartsDataset) {
             dataZoom: {
                 type: 'inside',
                 startValue: price.length - 120, // 起始显示K线条数(最新120条)
-                endValue: price.length,
+                end: 100,
                 minValueSpan: 10, // 限制窗口缩放显示最少数据条数
                 maxValueSpan: 400, // 限制窗口缩放显示最大数据条数
             },

+ 1 - 1
src/hooks/echarts/smoothedline/options.ts

@@ -70,7 +70,7 @@ export function useOptions(dataset: EchartsDataset) {
             dataZoom: {
                 type: 'inside',
                 startValue: price.length - 120, // 起始显示K线条数(最新120条)
-                endValue: price.length,
+                end: 100,
                 minValueSpan: 10, // 限制窗口缩放显示最少数据条数
                 maxValueSpan: 400, // 限制窗口缩放显示最大数据条数
             },

+ 11 - 0
src/packages/gstj/router/index.ts

@@ -45,6 +45,17 @@ const routes: Array<RouteRecordRaw> = [
             path: 'goods',
             name: 'home-goods',
             component: () => import('../views/goods/list/Index.vue'),
+            props: {
+              marketId: 50101
+            }
+          },
+          {
+            path: 'forward',
+            name: 'home-forward',
+            component: () => import('../views/goods/list/Index.vue'),
+            props: {
+              marketId: 50102
+            }
           },
           {
             path: 'spot',

+ 17 - 3
src/packages/gstj/views/goods/list/Index.vue

@@ -62,7 +62,7 @@
 </template>
 
 <script lang="ts" setup>
-import { computed, onUnmounted } from 'vue'
+import { computed, onUnmounted, watch } from 'vue'
 import { parsePercent, handleNumberValue } from '@/filters'
 import { useRequest } from '@/hooks/request'
 import { useNavigation } from '../../../router/navigation'
@@ -71,15 +71,22 @@ import { useFuturesStore, useUserStore } from '@/stores'
 import quoteSocket from '@/services/websocket/quote'
 import AppList from '../../../components/base/list/index.vue'
 
+const props = defineProps({
+    marketId: {
+        type: Number,
+        required: true
+    }
+})
+
 const { router } = useNavigation()
 const futuresStore = useFuturesStore()
 const userStore = useUserStore()
 const subscribe = quoteSocket.createSubscribe()
 
-const { dataList } = useRequest(queryQuoteGoodsList, {
+const { dataList, run } = useRequest(queryQuoteGoodsList, {
     params: {
         usertype: userStore.userType ?? 0,
-        marketids: '50101'
+        marketids: props.marketId.toString()
     },
     onSuccess: (res) => {
         const goodsCodes = res.data.map((e) => e.goodscode)
@@ -147,5 +154,12 @@ const rowClick = (row: Model.QuoteGoodsListRsp) => {
     })
 }
 
+watch(() => props.marketId, () => {
+    subscribe.stop()
+    run({
+        marketids: props.marketId.toString()
+    })
+})
+
 onUnmounted(() => subscribe.stop())
 </script>

+ 6 - 0
src/packages/gstj/views/home/Index.vue

@@ -44,6 +44,12 @@ const tabList: Tabbar[] = [
     activeIcon: 'icon-a-zu818',
   },
   {
+    name: 'home-forward',
+    label: '中远期挂牌',
+    icon: 'icon-a-zu820',
+    activeIcon: 'icon-a-zu825',
+  },
+  {
     name: 'home-spot',
     label: '现货挂牌',
     icon: 'icon-a-zu8201',

+ 6 - 0
src/packages/mobile/router/index.ts

@@ -50,6 +50,9 @@ const routes: Array<RouteRecordRaw> = [
             path: 'goods',
             name: 'home-goods',
             component: () => import('../views/goods/list/Index.vue'),
+            props: {
+              marketId: 50101
+            }
           },
           // {
           //   path: 'spot',
@@ -351,6 +354,9 @@ const routes: Array<RouteRecordRaw> = [
         path: '',
         name: 'forward-list',
         component: () => import('../views/goods/list/Index.vue'),
+        props: {
+          marketId: 50102
+        }
       },
     ],
   },

+ 18 - 4
src/packages/mobile/views/goods/list/Index.vue

@@ -1,7 +1,7 @@
 <template>
     <app-view>
         <template #header>
-            <app-navbar title="订单挂牌" :show-back-button="false" />
+            <app-navbar title="订单挂牌" :show-back-button="marketId === 50102" />
         </template>
         <app-list :columns="columns" :data-list="tableList" @row-click="rowClick">
             <!-- 商品名称/代码 -->
@@ -62,7 +62,7 @@
 </template>
 
 <script lang="ts" setup>
-import { computed, onUnmounted } from 'vue'
+import { computed, onUnmounted, watch } from 'vue'
 import { parsePercent, handleNumberValue } from '@/filters'
 import { useRequest } from '@/hooks/request'
 import { useNavigation } from '../../../router/navigation'
@@ -71,15 +71,22 @@ import { useFuturesStore, useUserStore } from '@/stores'
 import quoteSocket from '@/services/websocket/quote'
 import AppList from '../../../components/base/list/index.vue'
 
+const props = defineProps({
+    marketId: {
+        type: Number,
+        required: true
+    }
+})
+
 const { router } = useNavigation()
 const futuresStore = useFuturesStore()
 const userStore = useUserStore()
 const subscribe = quoteSocket.createSubscribe()
 
-const { dataList } = useRequest(queryQuoteGoodsList, {
+const { dataList, run } = useRequest(queryQuoteGoodsList, {
     params: {
         usertype: userStore.userType ?? 0,
-        marketids: '50101'
+        marketids: props.marketId.toString()
     },
     onSuccess: (res) => {
         const goodsCodes = res.data.map((e) => e.goodscode)
@@ -147,5 +154,12 @@ const rowClick = (row: Model.QuoteGoodsListRsp) => {
     })
 }
 
+watch(() => props.marketId, () => {
+    subscribe.stop()
+    run({
+        marketids: props.marketId.toString()
+    })
+})
+
 onUnmounted(() => subscribe.stop())
 </script>

+ 17 - 17
src/stores/modules/futures.ts

@@ -103,23 +103,6 @@ export const useFuturesStore = defineStore(() => {
         }
     }
 
-    // 接收行情推送通知
-    const quotePushNotify = eventBus.$on('QuotePushNotify', (res) => {
-        const data = res as Proto.Quote[]
-        data.forEach((item) => {
-            const quote = handleQuote(item)
-            if (!state.loading) {
-                updateGoodsQuote(quote)
-            }
-            // 触发行情监听事件
-            for (const e of quoteWatchMap.values()) {
-                if (e.keys.includes(item.goodscode ?? '')) {
-                    e.callback(quote)
-                }
-            }
-        })
-    })
-
     // 更新商品行情数据
     const updateGoodsQuote = (quote: Partial<Model.QuoteDayRsp>) => {
         // 查找对应的商品行情
@@ -322,6 +305,23 @@ export const useFuturesStore = defineStore(() => {
         }
     }
 
+    // 接收行情推送通知
+    const quotePushNotify = eventBus.$on('QuotePushNotify', (res) => {
+        const data = res as Proto.Quote[]
+        data.forEach((item) => {
+            const quote = handleQuote(item)
+            if (!state.loading) {
+                updateGoodsQuote(quote)
+            }
+            // 触发行情监听事件
+            for (const e of quoteWatchMap.values()) {
+                if (e.keys.includes(item.goodscode ?? '')) {
+                    e.callback(quote)
+                }
+            }
+        })
+    })
+
     return {
         ...toRefs(state),
         getQuotePrice,

+ 0 - 315
src/stores/modules/futures@next.ts

@@ -1,315 +0,0 @@
-import { reactive, computed, toRefs } from 'vue'
-import { handlePriceColor } from '@/filters'
-import { queryErmcpGoods, queryQuoteDay } from '@/services/api/goods'
-import { defineStore } from '../store'
-import { timerTask } from '@/utils/timer'
-import eventBus from '@/services/bus'
-import moment from 'moment'
-
-/**
- * 期货存储对象
- * @returns 
- */
-export const useFuturesStore = defineStore(() => {
-    const state = reactive({
-        loading: false,
-        goodsList: <Model.GoodsRsp[]>[], // 商品列表
-        quotes: <Partial<Model.QuoteDayRsp>[]>[], // 行情数据
-        goodsQuoteList: <Model.GoodsQuote[]>[], // 商品行情列表
-    })
-
-    // 获取商品列表
-    const getGoodsList = () => {
-        timerTask.clearTimeout('quoteDay')
-        queryErmcpGoods().then((res) => {
-            state.goodsList = res.data
-            const codes = res.data.map((e) => e.goodscode)
-            if (codes.length) {
-                getQuoteDay(codes)
-            }
-        })
-        // 获取商品盘面信息
-        const getQuoteDay = (codes: string[]) => {
-            state.loading = true
-            queryQuoteDay({
-                data: {
-                    goodsCodes: codes.join(',')
-                }
-            }).then((res) => {
-                res.data.forEach((item) => {
-                    updateGoodsQuote(item)
-                })
-            }).finally(() => {
-                state.loading = false
-                // 每5分钟获取一次盘面
-                timerTask.setTimeout(() => getQuoteDay(codes), 5 * 60 * 1000, 'quoteDay')
-            })
-        }
-    }
-
-    // 通过 goodscode 获取实时盘面
-    const getGoodsQuote = (code: string | number) => {
-        return computed(() => state.goodsQuoteList.find((e) => e.goodscode === code || e.goodsid === code))
-    }
-
-    // 通过 goodscode 获取实时行情报价
-    const getQuotePrice = (goodsCode: string) => {
-        return computed(() => {
-            const quote = getGoodsQuote(goodsCode)
-            return quote.value?.last ?? 0
-        })
-    }
-
-    // 通过 goodscode 获取实时行情
-    const getQuote = (goodsCode: string) => {
-        return computed(() => {
-            const quote = state.quotes.find((e) => e.goodscode === goodsCode)
-            return {
-                ...quote
-            }
-        })
-    }
-
-    // 获取商品名称
-    const getGoodsName = (code: string | number) => {
-        const quote = state.goodsList.find((e) => e.goodscode === code || e.goodsid === code)
-        return quote?.goodsname ?? ''
-    }
-
-    // 获取商品市场ID
-    const getGoodsMarket = (code: string | number) => {
-        const quote = state.goodsList.find((e) => e.goodscode === code || e.goodsid === code)
-        return quote?.marketid ?? 0
-    }
-
-    // 接收行情推送通知
-    const quotePushNotify = eventBus.$on('QuotePushNotify', (res) => {
-        const data = res as Proto.Quote[]
-        data.forEach((item) => {
-            const quote = handleQuote(item)
-            const index = state.quotes.findIndex((e) => e.goodscode === item.goodscode)
-            if (index > -1) {
-                state.quotes[index] = quote
-            } else {
-                state.quotes.push(quote)
-            }
-            if (!state.loading) {
-                updateGoodsQuote(quote)
-            }
-        })
-    })
-
-    // 更新商品行情数据
-    const updateGoodsQuote = (quote: Partial<Model.QuoteDayRsp>) => {
-        // 查找对应的商品行情
-        const item: Model.GoodsQuote = state.goodsQuoteList.find((e) => e.goodscode === quote.goodscode) ?? {
-            goodsid: 0,
-            goodscode: quote.goodscode ?? '',
-            goodsname: '',
-            goodsgroupid: 0,
-            goodunitid: 0,
-            marketid: 0,
-            trademode: 0,
-            agreeunit: 0,
-            decimalplace: 0,
-            quoteminunit: 0,
-            quotegear: 0,
-            last: quote.last ?? 0,
-            lasttime: quote.lasttime ?? '',
-            bid: quote.bid ?? 0,
-            bid2: quote.bid2 ?? 0,
-            bid3: quote.bid3 ?? 0,
-            bid4: quote.bid4 ?? 0,
-            bid5: quote.bid5 ?? 0,
-            bidvolume: quote.bidvolume ?? 0,
-            bidvolume2: quote.bidvolume2 ?? 0,
-            bidvolume3: quote.bidvolume3 ?? 0,
-            bidvolume4: quote.bidvolume4 ?? 0,
-            bidvolume5: quote.bidvolume5 ?? 0,
-            ask: quote.ask ?? 0,
-            ask2: quote.ask2 ?? 0,
-            ask3: quote.ask3 ?? 0,
-            ask4: quote.ask4 ?? 0,
-            ask5: quote.ask5 ?? 0,
-            askvolume: quote.askvolume ?? 0,
-            askvolume2: quote.askvolume2 ?? 0,
-            askvolume3: quote.askvolume3 ?? 0,
-            askvolume4: quote.askvolume4 ?? 0,
-            askvolume5: quote.askvolume5 ?? 0,
-            lastvolume: quote.lastvolume ?? 0,
-            presettle: quote.presettle ?? 0,
-            opened: quote.opened ?? 0,
-            highest: quote.highest ?? 0,
-            lowest: quote.lowest ?? 0,
-            limitup: quote.limitup ?? 0,
-            limitdown: quote.limitdown ?? 0,
-            averageprice: quote.averageprice ?? 0,
-            totalvolume: quote.totalvolume ?? 0,
-            totalturnover: quote.totalturnover ?? 0,
-            holdvolume: quote.holdvolume ?? 0,
-            rise: 0,
-            change: 0,
-            amplitude: 0,
-            bidColor: '',
-            bid2Color: '',
-            bid3Color: '',
-            bid4Color: '',
-            bid5Color: '',
-            askColor: '',
-            ask2Color: '',
-            ask3Color: '',
-            ask4Color: '',
-            ask5Color: '',
-            lastColor: '',
-            averagepriceColor: '',
-            openedColor: '',
-            highestColor: '',
-            lowestColor: '',
-        }
-
-        if (item.goodsid) {
-            // 更新对象属性
-            Object.entries(quote).forEach(([key, value]) => {
-                if (value !== undefined) {
-                    type TKey = keyof Model.GoodsQuote
-                    (<K extends TKey>(prop: K, value: Model.GoodsQuote[K]) => {
-                        item[prop] = value
-                    })(key as TKey, value)
-                }
-            })
-        } else {
-            const goods = state.goodsList.find((e) => e.goodscode === quote.goodscode)
-            if (goods) {
-                ({
-                    goodsid: item.goodsid,
-                    goodsname: item.goodsname,
-                    goodsgroupid: item.goodsgroupid,
-                    goodunitid: item.goodunitid,
-                    marketid: item.marketid,
-                    trademode: item.trademode,
-                    agreeunit: item.agreeunit,
-                    decimalplace: item.decimalplace,
-                    quoteminunit: item.quoteminunit,
-                    quotegear: item.quotegear,
-                } = goods)
-
-                // 向列表添加新数据
-                state.goodsQuoteList.push(item)
-            }
-        }
-
-        item.opened = item.opened || item.last // 没有开盘价默认取最新价
-        item.highest = item.highest || item.last // 没有最高价默认取最新价
-        item.lowest = item.lowest || item.last // 没有最低价价默认取最新价
-
-        // 处理最高最低价
-        if (item.last) {
-            if (item.last > item.highest) {
-                item.highest = item.last
-            }
-            if (item.last < item.lowest) {
-                item.lowest = item.last
-            }
-        }
-
-        item.averageprice = item.totalvolume ? item.totalturnover / (item.totalvolume * item.agreeunit) : 0 // 计算均价
-        item.rise = item.last ? item.last - item.presettle : 0   // 涨跌额/涨跌: 最新价 - 昨结价
-        item.change = item.presettle ? item.rise / item.presettle : 0 // 涨跌幅/幅度: (最新价 - 昨结价) / 昨结价
-        item.amplitude = item.presettle ? (item.highest - item.lowest) / item.presettle : 0 // 振幅: (最高价 - 最低价 ) / 最新价
-
-        // 处理行情价格颜色
-        const handleColor = (value: number) => handlePriceColor(value, item.presettle)
-
-        item.bidColor = handleColor(item.bid)
-        item.bid2Color = handleColor(item.bid2)
-        item.bid3Color = handleColor(item.bid3)
-        item.bid4Color = handleColor(item.bid4)
-        item.bid5Color = handleColor(item.bid5)
-        item.askColor = handleColor(item.ask)
-        item.ask2Color = handleColor(item.ask2)
-        item.ask3Color = handleColor(item.ask3)
-        item.ask4Color = handleColor(item.ask4)
-        item.ask5Color = handleColor(item.ask5)
-        item.lastColor = handleColor(item.last)
-        item.averagepriceColor = handleColor(item.averageprice)
-        item.openedColor = handleColor(item.opened)
-        item.highestColor = handleColor(item.highest)
-        item.lowestColor = handleColor(item.lowest)
-    }
-
-    // 处理行情数据
-    const handleQuote = (quote: Proto.Quote): Partial<Model.QuoteDayRsp> => {
-        const goods = state.goodsList.find((e) => e.goodscode.toUpperCase() === quote.goodscode?.toUpperCase())
-        // 处理报价小数位
-        const handleDeimalplace = (value?: number) => {
-            if (goods && value) {
-                const decimal = Math.pow(10, goods.decimalplace)
-                return value / decimal
-            }
-            return value
-        }
-        return {
-            goodscode: quote.goodscode,
-            last: handleDeimalplace(quote.last),
-            lasttime: (quote.date && quote.time) ? moment(quote.date + quote.time, 'YYYYMMDDHHmmss').format('YYYY-MM-DD HH:mm:ss') : undefined,
-            ask: handleDeimalplace(quote.ask),
-            ask2: handleDeimalplace(quote.ask2),
-            ask3: handleDeimalplace(quote.ask3),
-            ask4: handleDeimalplace(quote.ask4),
-            ask5: handleDeimalplace(quote.ask5),
-            askvolume: quote.askvolume,
-            askvolume2: quote.askvolume2,
-            askvolume3: quote.askvolume3,
-            askvolume4: quote.askvolume4,
-            askvolume5: quote.askvolume5,
-            bid: handleDeimalplace(quote.bid),
-            bid2: handleDeimalplace(quote.bid2),
-            bid3: handleDeimalplace(quote.bid3),
-            bid4: handleDeimalplace(quote.bid4),
-            bid5: handleDeimalplace(quote.bid5),
-            bidvolume: quote.bidvolume,
-            bidvolume2: quote.bidvolume2,
-            bidvolume3: quote.bidvolume3,
-            bidvolume4: quote.bidvolume4,
-            bidvolume5: quote.bidvolume5,
-            calloptionpremiums: quote.calloptionpremiums,
-            calloptionpremiums2: quote.calloptionpremiums2,
-            calloptionpremiums3: quote.calloptionpremiums3,
-            calloptionpremiums4: quote.calloptionpremiums4,
-            calloptionpremiums5: quote.calloptionpremiums5,
-            exchangecode: quote.exchangecode,
-            exchangedate: quote.exchangedate,
-            highest: handleDeimalplace(quote.highest),
-            holdvolume: quote.holdvolume,
-            inventory: quote.inventory,
-            lastvolume: quote.lastvolume,
-            limitdown: handleDeimalplace(quote.limitlow),
-            limitup: handleDeimalplace(quote.limithigh),
-            lowest: handleDeimalplace(quote.lowest),
-            opened: handleDeimalplace(quote.opened),
-            preclose: handleDeimalplace(quote.preclose),
-            preholdvolume: quote.preholdvolume,
-            presettle: handleDeimalplace(quote.presettle),
-            putoptionpremiums: handleDeimalplace(quote.putoptionpremiums),
-            putoptionpremiums2: handleDeimalplace(quote.putoptionpremiums2),
-            putoptionpremiums3: handleDeimalplace(quote.putoptionpremiums3),
-            putoptionpremiums4: handleDeimalplace(quote.putoptionpremiums4),
-            putoptionpremiums5: handleDeimalplace(quote.putoptionpremiums5),
-            settle: handleDeimalplace(quote.settle),
-            totalturnover: handleDeimalplace(quote.totalturnover),
-            totalvolume: quote.totalvolume,
-        }
-    }
-
-    return {
-        ...toRefs(state),
-        getQuote,
-        getQuotePrice,
-        getGoodsList,
-        getGoodsQuote,
-        getGoodsName,
-        getGoodsMarket,
-        updateGoodsQuote,
-        quotePushNotify,
-    }
-})