Handy_Cao 2 년 전
부모
커밋
60b5b87447

+ 26 - 0
src/packages/mobile/views/goods/detail/Index.css

@@ -0,0 +1,26 @@
+.goods-detail {
+  background-color: #fff;
+}
+.goods-detail .van-tabs__nav {
+  background-color: #f2f2f2;
+}
+.goods-detail__quote {
+  padding: 0.2rem 0;
+}
+.goods-detail__quote .price {
+  display: flex;
+  align-items: center;
+  padding: 0 0.2rem;
+}
+.goods-detail__quote .price li:first-child {
+  font-size: 0.44rem;
+}
+.goods-detail__quote .price li + li {
+  margin-left: 0.2rem;
+}
+.goods-detail__quote .time {
+  font-size: 0.24rem;
+  color: #999;
+  padding: 0 0.2rem;
+  margin-top: 0.1rem;
+}

+ 36 - 0
src/packages/mobile/views/goods/detail/Index.less

@@ -0,0 +1,36 @@
+.goods-detail {
+    background-color: #fff;
+
+    .van-tabs {
+        &__nav {
+            background-color: #f2f2f2;
+        }
+    }
+
+    &__quote {
+        padding: .2rem 0;
+
+        .price {
+            display: flex;
+            align-items: center;
+            padding: 0 .2rem;
+
+            li {
+                &:first-child {
+                    font-size: .44rem;
+                }
+
+                +li {
+                    margin-left: .2rem;
+                }
+            }
+        }
+
+        .time {
+            font-size: .24rem;
+            color: #999;
+            padding: 0 .2rem;
+            margin-top: .1rem;
+        }
+    }
+}

+ 34 - 14
src/packages/mobile/views/goods/detail/Index.vue

@@ -1,24 +1,30 @@
 <template>
-    <app-view>
+    <app-view class="goods-detail">
         <template #header>
-            <app-navbar title="订单挂牌大厅" >
+            <app-navbar :title="item.goodscode+'/'+item.goodsname" >
                 <template #right>
                     <div class="button-more" @click="onListing">
                         <span>挂牌</span>
                     </div>
                 </template>
             </app-navbar>
-            <div>
-                <span>{{ item.goodsname }}/{{ item.goodscode }}</span>
-                <span>--</span>
-            </div>
         </template>
-        <Tabs v-model:active="tabIndex" @click="onTabChange">
-            <Tab title="买大厅" />
-            <Tab title="卖大厅" />
-        </Tabs>
+        <div class="goods-detail_quote" v-if="quote">
+            <ul class="price">
+                <li :class="quote.lastColor">{{ quote.last }}</li>
+                <li :class="quote.lastColor">{{ handleNumberValue(quote.rise.toFixed(quote.decimalplace)) }}</li>
+                <li :class="quote.lastColor">{{ parsePercent(quote.change) }}</li>
+            </ul>
+            <ul class="time">
+                <li>{{ formatDate(quote.lasttime, 'MM-DD HH:mm:ss') }}</li>
+            </ul>
+        </div>
         <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error" v-model:pageIndex="pageIndex"
         :page-count="pageCount" @refresh="onTabChange">
+            <Tabs v-model:active="tabIndex" @click="onTabChange">
+                <Tab title="买大厅" />
+                <Tab title="卖大厅" />
+            </Tabs>
             <div class="trade-section sell" v-if="dataList.length">
                 <app-list :columns="columns" :data-list="dataList">
                     <template #username="{ row }">
@@ -36,21 +42,27 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent } from 'vue'
+import { shallowRef, onMounted, onUnmounted,defineAsyncComponent } from 'vue'
 import { Tab, Tabs, Button, showToast } from 'vant'
 import { useRequest } from '@/hooks/request'
 import { useNavigation } from '@/hooks/navigation'
 import { useComponent } from '@/hooks/component'
-import AppList from '@mobile/components/base/list/index.vue'
 import { queryWrTradeOrderDetail } from '@/services/api/transfer'
-import { useLoginStore } from '@/stores'
+import { useLoginStore, useFuturesStore } from '@/stores'
+import { parsePercent, handleNumberValue, formatDate } from '@/filters'
+
+import AppList from '@mobile/components/base/list/index.vue'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
+import quoteSocket from '@/services/websocket/quote'
 
+const futuresStore = useFuturesStore()
 const componentMap = new Map<string, unknown>([
     ['delisting', defineAsyncComponent(() => import('./components/delisting/Index.vue'))],
     ['listing', defineAsyncComponent(() => import('./components/listing/Index.vue'))],
 ])
 
+
+
 const loginStore = useLoginStore()
 
 const { getParamString } = useNavigation()
@@ -60,6 +72,8 @@ const tabIndex = shallowRef(0)
 const selectedRow = shallowRef<Model.WrTradeOrderDetailRsp>()
 const error = shallowRef(false)
 const dataList = shallowRef<Model.WrTradeOrderDetailRsp[]>([])
+const subscribe = quoteSocket.addSubscribe([item.goodscode])
+const quote = futuresStore.getQuoteInfo(item.goodscode)
 
 const { pageIndex, loading, run, pageCount } = useRequest(queryWrTradeOrderDetail, {
     params: {
@@ -80,7 +94,8 @@ const { pageIndex, loading, run, pageCount } = useRequest(queryWrTradeOrderDetai
 
 const onTabChange = () => {
     run({
-        buyorsell: tabIndex.value
+        buyorsell: tabIndex.value,
+        page: 1
     })
 }
 
@@ -105,4 +120,9 @@ const onListing = () => {
     openComponent('listing')
 }
 
+onMounted(() => subscribe.start())
+
+onUnmounted(() => subscribe.stop())
+
+
 </script>

+ 12 - 2
src/packages/mobile/views/order/position/components/goods/close/Index.vue

@@ -19,6 +19,11 @@
                 <CellGroup title="平仓信息">
                     <Cell title="当前价" :value="'--'" />
                     <Form class="goods-close__form" ref="formRef" @submit="onCloseSumit" v-if="props">
+                        <Field name="OrderPrice" :rules="formRules.OrderPrice" label="平仓价格">
+                            <template #input>
+                                <Stepper v-model="formData.OrderPrice" input-width="100" theme="round" button-size="22" :min="0" :step="0.01" :auto-fixed="false" />
+                            </template>
+                        </Field>
                         <Field name="OrderQty" :rules="formRules.OrderQty" label="平仓数量">
                             <template #input>
                                 <Stepper v-model="formData.OrderQty" input-width="100" theme="round" button-size="22" :min="0" :step="0.01" :max="selectedRow.enableqty" :auto-fixed="false" />
@@ -58,6 +63,12 @@ const props = defineProps({
 
 // 表单验证规则
 const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
+    OrderPrice: [{
+        message: '请输入平仓价格',
+        validator: () => {
+            return !!formData.OrderPrice
+        }
+    }],
     OrderQty: [{
         message: '请输入平仓数量',
         validator: () => {
@@ -72,12 +83,11 @@ const onCloseSumit = () => {
         showCancelButton: true,
     }).then(() => {
 
-        const { marketid, goodsid, buyorsell, averageprice} = props.selectedRow
+        const { marketid, goodsid, buyorsell} = props.selectedRow
         /// 市场ID
         formData.Header = { MarketID: marketid, GoodsID: goodsid }
         formData.MarketID = marketid
         formData.PriceMode = EPriceMode.PRICEMODE_LIMIT
-        formData.OrderPrice = averageprice
         formData.BuyOrSell = buyorsell === 0 ? 1 : 0,
         formData.GoodsID = goodsid
         formData.ListingSelectType = EListingSelectType.LISTINGSELECTTYPE_DELISTING

+ 1 - 1
src/packages/mobile/views/order/position/components/goods/delivery/Index.vue

@@ -24,7 +24,7 @@
                                 <Stepper v-model="formData.DeliveryLot" input-width="100" theme="round" button-size="22" :min="0" :step="0.01" :max="selectedRow.enableqty" :auto-fixed="false" />
                             </template>
                         </Field>
-                        <Field name="DeliveryInfo" :rules="formRules.DeliveryLot" label="交收信息" placeholder="请输入交收信息">
+                        <Field name="DeliveryInfo" v-model="formData.DeliveryInfo" :rules="formRules.DeliveryInfo" label="交收信息" placeholder="请输入交收信息">
                         </Field>
                     </Form>
                 </CellGroup>

+ 36 - 0
src/packages/mobile/views/swap/detail/Index.less

@@ -0,0 +1,36 @@
+.swap-detail {
+    background-color: #fff;
+
+    .van-tabs {
+        &__nav {
+            background-color: #f2f2f2;
+        }
+    }
+
+    &__quote {
+        padding: .2rem 0;
+
+        .price {
+            display: flex;
+            align-items: center;
+            padding: 0 .2rem;
+
+            li {
+                &:first-child {
+                    font-size: .44rem;
+                }
+
+                +li {
+                    margin-left: .2rem;
+                }
+            }
+        }
+
+        .time {
+            font-size: .24rem;
+            color: #999;
+            padding: 0 .2rem;
+            margin-top: .1rem;
+        }
+    }
+}

+ 31 - 12
src/packages/mobile/views/swap/detail/Index.vue

@@ -1,24 +1,30 @@
 <template>
-    <app-view>
+    <app-view class="swap-detail">
         <template #header>
-            <app-navbar title="掉期挂牌大厅" >
+            <app-navbar :title="item.goodsgroupname+'/'+item.goodscode" >
                 <template #right>
                     <div class="button-more" @click="onListing">
                         <span>挂牌</span>
                     </div>
                 </template>
             </app-navbar>
-            <div>
-                <span>{{ item.goodsgroupname }}/{{ item.goodscode }}</span>
-                <span>--</span>
-            </div>
         </template>
-        <Tabs v-model:active="tabIndex" @click="onTabChange">
-            <Tab title="买大厅" />
-            <Tab title="卖大厅" />
-        </Tabs>
+        <div class="swap-detail__quote" v-if="quote">
+                <ul class="price">
+                    <li :class="quote.lastColor">{{ quote.last }}</li>
+                    <li :class="quote.lastColor">{{ handleNumberValue(quote.rise.toFixed(quote.decimalplace)) }}</li>
+                    <li :class="quote.lastColor">{{ parsePercent(quote.change) }}</li>
+                </ul>
+                <ul class="time">
+                    <li>{{ formatDate(quote.lasttime, 'MM-DD HH:mm:ss') }}</li>
+                </ul>
+            </div>
         <app-pull-refresh ref="pullRefreshRef" v-model:loading="loading" v-model:error="error" v-model:pageIndex="pageIndex"
         :page-count="pageCount" @refresh="onTabChange">
+            <Tabs v-model:active="tabIndex" @click="onTabChange">
+                <Tab title="买大厅" />
+                <Tab title="卖大厅" />
+            </Tabs>
             <div class="trade-section sell" v-if="dataList.length">
                 <app-list :columns="columns" :data-list="dataList">
                     <template #username="{ row }">
@@ -36,13 +42,17 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent } from 'vue'
+import { shallowRef, onMounted, onUnmounted, defineAsyncComponent } from 'vue'
 import { Tab, Tabs, Button, showToast } from 'vant'
 import { useRequest } from '@/hooks/request'
 import { useNavigation } from '@/hooks/navigation'
 import { useComponent } from '@/hooks/component'
 import { queryTjmdTradeOrderDetail } from '@/services/api/swap'
 import { useLoginStore } from '@/stores'
+import { useFuturesStore } from '@/stores'
+import { parsePercent, handleNumberValue, formatDate } from '@/filters'
+
+import quoteSocket from '@/services/websocket/quote'
 
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 import AppList from '@mobile/components/base/list/index.vue'
@@ -58,12 +68,16 @@ const { getParamString } = useNavigation()
 const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => {
     pullRefreshRef.value?.refresh()
 })
+const futuresStore = useFuturesStore()
 const item: Model.QuoteGoodsListRsp = JSON.parse(getParamString('item')?.toString() || '{}')
 const tabIndex = shallowRef(0)
 const selectedRow = shallowRef<Model.TjmdTradeOrderDetailRsp>()
 const error = shallowRef(false)
 const dataList = shallowRef<Model.TjmdTradeOrderDetailRsp[]>([])
 
+const subscribe = quoteSocket.addSubscribe([item.refgoodscode])
+const quote = futuresStore.getQuoteInfo(item.refgoodscode)
+
 const { pageIndex, loading, run, pageCount } = useRequest(queryTjmdTradeOrderDetail, {
     params: {
         pagesize: 20,
@@ -83,7 +97,8 @@ const { pageIndex, loading, run, pageCount } = useRequest(queryTjmdTradeOrderDet
 
 const onTabChange = () => {
     run({
-        buyorsell: tabIndex.value
+        buyorsell: tabIndex.value,
+        page: 1
     })
 }
 
@@ -108,4 +123,8 @@ const onListing = () => {
     openComponent('listing')
 }
 
+onMounted(() => subscribe.start())
+
+onUnmounted(() => subscribe.stop())
+
 </script>