li.shaoyi před 1 rokem
rodič
revize
f58ec3a00a

+ 2 - 2
src/packages/mobile/router/section.ts

@@ -5,7 +5,7 @@ const homeRoutes: RouteRecordRaw[] = [
     {
         path: 'pricing',
         name: 'home-pricing',
-        component: () => import('@mobile/views/pricing/list/Index.vue'),
+        component: () => import('@mobile/views/pricing/list/v2/index.vue'),
     },
     {
         path: 'ballot',
@@ -52,7 +52,7 @@ const pageRoutes: RouteRecordRaw[] = [
             {
                 path: 'list',
                 name: 'pricing-list',
-                component: () => import('@mobile/views/pricing/list/Index.vue'),
+                component: () => import('@mobile/views/pricing/list/v2/index.vue'),
                 props: {
                     showBackButton: true
                 }

+ 50 - 0
src/packages/mobile/views/pricing/list/v2/index.less

@@ -0,0 +1,50 @@
+.pricing-v2 {
+    display: flex;
+    flex-wrap: wrap;
+    color: #e5e5e5;
+    line-height: normal;
+    padding: 5px;
+
+    &-item {
+        width: 50%;
+        padding: 5px;
+
+        article {
+            background-color: #fff;
+            border-radius: 5px;
+            padding: 15px;
+
+            h3 {
+                display: flex;
+                justify-content: space-between;
+                align-items: center;
+                font-size: 14px;
+                font-weight: bold;
+                color: #222;
+                border-bottom: 1px solid #f1f1f1;
+                padding-bottom: 10px;
+            }
+
+            section {
+                padding-top: 10px;
+
+                dl {
+                    display: flex;
+                    justify-content: space-between;
+                    align-items: center;
+
+                    dt {
+                        font-size: 12px;
+                        color: #71848f;
+                    }
+
+                    dd {
+                        font-size: 16px;
+                        font-weight: bold;
+                        line-height: 1.5;
+                    }
+                }
+            }
+        }
+    }
+}

+ 102 - 0
src/packages/mobile/views/pricing/list/v2/index.vue

@@ -0,0 +1,102 @@
+<template>
+    <app-view>
+        <template #header>
+            <app-navbar :title="titleName" :show-back-button="showBackButton" />
+        </template>
+        <div class="pricing-v2">
+            <div class="pricing-v2-item" v-for="(item, index) in dataList" :key="index">
+                <article>
+                    <h3>
+                        <span>{{ item.goodscode }}</span>
+                    </h3>
+                    <section @click="rowClick(item)">
+                        <dl>
+                            <dt>{{ t('quote.ask') }}</dt>
+                            <dd :class="item.bidColor">{{ item.bid }}</dd>
+                        </dl>
+                        <dl>
+                            <dt>{{ t('quote.bid') }}</dt>
+                            <dd :class="item.askColor">{{ item.ask }}</dd>
+                        </dl>
+                    </section>
+                </article>
+            </div>
+        </div>
+    </app-view>
+</template>
+
+<script lang="ts" setup>
+import { computed, onUnmounted, onActivated, PropType } from 'vue'
+import { parsePercent, handleNumberValue, formatDecimal } from '@/filters'
+import { useNavigation } from '@mobile/router/navigation'
+import { useFuturesStore, i18n } from '@/stores'
+import { ETradeMode } from '@/constants/client'
+import quoteSocket from '@/services/websocket/quote'
+import { BuyOrSell, BuildType } from '@/constants/order'
+
+const props = defineProps({
+    showBackButton: {
+        type: Boolean,
+        default: false
+    },
+    marketSection: {
+        type: Object as PropType<Model.Marketsectionconfignew>
+    }
+})
+
+const { global: { t } } = i18n
+const { router, getQueryString } = useNavigation()
+const futuresStore = useFuturesStore()
+
+const title = getQueryString('title')
+const titleName = computed(() => title ? decodeURIComponent(title) : props.marketSection?.displayname ?? '订单点价')
+
+const dataList = computed(() => {
+    const list = futuresStore.getGoodsListByTradeMode(ETradeMode.TRADEMODE_MARKETMAKE)
+    return list.map((item) => {
+        const quote = futuresStore.getGoodsQuote(item.goodscode)
+        const { lastColor, openedColor, lowestColor, highestColor, last = 0, presettle = 0, rise = 0, change, amplitude, highest = 0, lowest = 0, opened = 0, ask = 0, bid = 0, bidColor, askColor, decimalplace } = quote.value ?? {}
+        return {
+            ...item,
+            lastColor,
+            openedColor,
+            lowestColor,
+            highestColor,
+            last: handleNumberValue(formatDecimal(last, decimalplace)),
+            rise: handleNumberValue(formatDecimal(rise, decimalplace)),
+            change: parsePercent(change),
+            opened: handleNumberValue(formatDecimal(opened, decimalplace)),
+            presettle: handleNumberValue(formatDecimal(presettle, decimalplace)),
+            lowest: handleNumberValue(formatDecimal(lowest, decimalplace)),
+            highest: handleNumberValue(formatDecimal(highest, decimalplace)),
+            amplitude: parsePercent(amplitude),
+            ask: handleNumberValue(formatDecimal(ask, decimalplace)),
+            bid: handleNumberValue(formatDecimal(bid, decimalplace)),
+            bidColor,
+            askColor
+        }
+    })
+})
+
+const goodsCodes = dataList.value.map((e) => e.goodscode.toUpperCase())
+const subscribe = quoteSocket.createSubscribe()
+
+const rowClick = (row: Model.GoodsQuote) => {
+    router.push({
+        name: 'pricing-trade',
+        query: {
+            goodsid: row.goodsid,
+            goodscode: row.goodscode,
+            buyOrSell: BuyOrSell.Buy,
+            buildType: BuildType.Open
+        }
+    })
+}
+
+onActivated(() => subscribe.start(...goodsCodes))
+onUnmounted(() => subscribe.stop())
+</script>
+
+<style lang="less">
+@import './index.less';
+</style>

+ 1 - 1
src/packages/pc/views/market/trade/pricing/v2/index.less

@@ -1,4 +1,4 @@
-.market-trade-pricing {
+.market-pricing-v2 {
     display: flex;
     flex-wrap: wrap;
     color: #e5e5e5;

+ 1 - 1
src/packages/pc/views/market/trade/pricing/v2/index.vue

@@ -1,7 +1,7 @@
 <!-- 交易市场 - 挂牌点价 -->
 <template>
     <el-scrollbar>
-        <div class="market-trade-pricing">
+        <div class="market-pricing-v2">
             <article v-for="(item, index) in futuresStore.marketGoodsList" :key="index">
                 <h3 @click="openImageViewer(item.pictureurl)">
                     <span>{{ item.goodscode }}</span>

+ 2 - 2
src/services/websocket/quote.ts

@@ -63,7 +63,7 @@ export default new (class {
             list.forEach((code) => {
                 if (!goodsList.some((e) => e.goodsCode === code)) {
                     goodsList.push({
-                        exchangeCode: 251,
+                        exchangeCode: 250,
                         goodsCode: code,
                         subState: 0,
                     })
@@ -75,7 +75,7 @@ export default new (class {
         this.connect().then(() => {
             // 订阅列表不能为空,如果空值会导致连接断开
             const codes = goodsList.length ? goodsList : [{
-                exchangeCode: 251,
+                exchangeCode: 250,
                 goodsCode: '0',
                 subState: 0,
             }]