li.shaoyi 2 лет назад
Родитель
Сommit
c82fa88393

+ 7 - 8
src/packages/mobile/views/home/Index.vue

@@ -13,7 +13,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, nextTick, watch, onMounted } from 'vue'
+import { shallowRef, nextTick, watch, onMounted,computed } from 'vue'
 import { fullloading, dialog } from '@/utils/vant'
 import { versionToNumber } from '@/filters'
 import { Tabbar } from '@mobile/components/base/tabbar/types'
@@ -25,12 +25,14 @@ import plus from '@/utils/h5plus'
 import AppTabbar from '@mobile/components/base/tabbar/index.vue'
 import RouterTransition from '@mobile/components/base/router-transition/index.vue'
 
-const { route, routerTo, getGlobalUrlParams } = useNavigation()
+const { route, routerTo } = useNavigation()
 const { userLogin } = useLogin()
 const loginStore = useLoginStore()
 const cssTransition = shallowRef(true) // 是否使用css动画
 const currentTab = shallowRef(0)
 
+const tabIndex = computed(() => tabList.findIndex((e) => e.name === route.name))
+
 const tabList: Tabbar[] = [
   {
     name: 'home-index',
@@ -86,9 +88,7 @@ const onTabClick = (index: number) => {
 }
 
 onMounted(() => {
-  const { tabIndex } = getGlobalUrlParams()
-  currentTab.value = tabIndex > -1 ? tabIndex : tabList.findIndex((e) => e.name === route.name)
-
+  currentTab.value = tabIndex.value
   const os = plus.getSystemInfo('os')
   const currentVersion = plus.getSystemInfo('version')
   const currentVersionCode = plus.getSystemInfo('versionCode')
@@ -151,9 +151,8 @@ onMounted(() => {
 })
 
 watch(() => route.name, () => {
-  const { tabIndex } = getGlobalUrlParams()
-  if (tabIndex > -1) {
-    onTabClick(tabIndex)
+  if (tabIndex.value > -1) {
+    onTabClick(tabIndex.value)
   } else {
     nextTick(() => {
       cssTransition.value = true

+ 4 - 15
src/packages/mobile/views/home/main/Index.vue

@@ -22,10 +22,10 @@
           <li @click="routerTo('goods-50102')">
             <Iconfont label-direction="bottom" icon="g-icon-listing--line m50102">中远期挂牌</Iconfont>
           </li>
-          <!-- <li @click="switchTab(1)">
+          <!-- <li @click="switchTab('home-ballot')">
             <Iconfont label-direction="bottom" icon="g-icon-presale--line">预售中签</Iconfont>
           </li> -->
-          <!-- <li @click="switchTab(2)">
+          <!-- <li @click="switchTab('home-transfer')">
             <Iconfont label-direction="bottom" icon="g-icon-transfer--line">定金转让</Iconfont>
           </li> -->
         </ul>
@@ -81,20 +81,9 @@ const topBanners = shallowRef<string[]>([]); // 轮播图列表
 const newsList = shallowRef<Model.NewTitlesRsp[]>([]); // 资讯列表
 
 // 跳转导航页面
-const switchTab = (tabIndex: number) => {
+const switchTab = (routeName: string) => {
   if (loginStore.token) {
-    setGlobalUrlParams({ tabIndex })
-    switch (tabIndex) {
-      case 1:
-        routerTo('home-ballot', true)
-        break
-      case 2:
-        routerTo('home-transfer', true)
-        break
-      case 3:
-        routerTo('home-50101', true)
-        break
-    }
+    routerTo(routeName, true)
   } else {
     routerTo('user-login')
   }

+ 2 - 2
src/packages/pc/components/layouts/header/index.vue

@@ -10,7 +10,7 @@
                 <el-badge type="danger" :is-dot="noticeStore.unreadList.length > 0">
                     <app-icon icon="g-icon--notice" @click="openComponent('notice')" />
                 </el-badge>
-                <app-icon icon="Tickets" @click="openComponent('report')" />
+                <!-- <app-icon icon="Tickets" @click="openComponent('report')" /> -->
                 <app-icon icon="Setting" @click="openComponent('setting')" />
                 <span class="g-icon--minimize" @click="exitFullSreen" v-if="fullScreen"></span>
                 <span class="g-icon--maximize" @click="setFullSreen" v-else></span>
@@ -80,7 +80,7 @@ const exitFullSreen = () => {
 onMounted(() => {
     /// 如果未同意 或者跨天
     if (!localData.getValue('isReportAgree') || diffDays(localData.getValue('reportTime')) > 0) {
-        openComponent('report')
+        //openComponent('report')
     }
     // 监听全屏变化
     window.addEventListener('fullscreenchange', () => {

+ 4 - 1
src/packages/qdhs/router/index.ts

@@ -50,6 +50,9 @@ const routes: Array<RouteRecordRaw> = [
             path: 'trade',
             name: 'home-trade',
             component: () => import('../views/goods/detail/index.vue'),
+            props: {
+              showBackButton: false
+            }
           },
           {
             path: 'mine',
@@ -145,7 +148,7 @@ const routes: Array<RouteRecordRaw> = [
       {
         path: 'detail',
         name: 'goods-detail',
-        component: () => import('@mobile/views/goods/detail/Index.vue'),
+        component: () => import('../views/goods/detail/index.vue'),
       },
       {
         path: 'trade',

+ 22 - 0
src/packages/qdhs/views/goods/detail/index.less

@@ -0,0 +1,22 @@
+.goods-detail {
+    &__titlebar {
+        display: flex;
+        align-items: center;
+
+        .van-icon {
+            padding: 0 .2rem;
+
+            &[disabled='true']{
+                color: rgba(255,255,255,.5)
+            }
+
+            &.prev {
+                transform: scaleX(-1);
+            }
+        }
+
+        .text{
+            font-size: .32rem;
+        }
+    }
+}

+ 70 - 14
src/packages/qdhs/views/goods/detail/index.vue

@@ -1,16 +1,28 @@
 <template>
     <app-view class="goods-detail g-form">
         <template #header>
-            <app-navbar :title="quote ? quote.goodscode + '/' + quote.goodsname : '挂牌大厅'" :show-back-button="false" />
+            <app-navbar :show-back-button="showBackButton">
+                <div class="goods-detail__titlebar">
+                    <Icon class="prev" name="play" :disabled="selectedIndex <= 0" @click="onPrev" />
+                    <span class="text">
+                        {{ selectedItem ? selectedItem.goodscode + '/' + selectedItem.goodsname : '交易' }}
+                    </span>
+                    <Icon class="next" name="play" :disabled="selectedIndex >= (goodsList.length - 1)" @click="onNext" />
+                </div>
+            </app-navbar>
+        </template>
+        <template v-if="!loading">
+            <component :is="Price" v-bind="{ goodsCode }" />
+            <component :is="Chart" v-bind="{ goodsCode }" @ready="loading = true" />
+            <component :is="Forex" v-bind="{ goodsCode }" @more-click="onMoreClick" />
+            <component :is="Tik" v-bind="{ goodsCode }" />
         </template>
-        <component :is="Price" v-bind="{ goodsCode }" />
-        <component :is="Chart" v-bind="{ goodsCode }" />
-        <component :is="Forex" v-bind="{ goodsCode }" @more-click="onMoreClick" />
-        <component :is="Tik" v-bind="{ goodsCode }" />
         <template #footer>
             <div class="g-form__footer">
-                <Button block type="danger" square @click="onListing(BuyOrSell.Buy)">买入</Button>
-                <Button block type="primary" square @click="onListing(BuyOrSell.Sell)">卖出</Button>
+                <Button type="danger" :disabled="selectedIndex < 0" @click="onListing(BuyOrSell.Buy)" square
+                    block>买入</Button>
+                <Button type="primary" :disabled="selectedIndex < 0" @click="onListing(BuyOrSell.Sell)" square
+                    block>卖出</Button>
             </div>
             <component ref="componentRef" :is="componentMap.get(componentId)" v-bind="{ goodsCode, buyOrSell }"
                 @closed="closeComponent" v-if="componentId" />
@@ -19,8 +31,8 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent, computed } from 'vue'
-import { Button } from 'vant'
+import { shallowRef, defineAsyncComponent, computed, onMounted } from 'vue'
+import { Button, Icon } from 'vant'
 import { useNavigation } from '@mobile/router/navigation'
 import { useComponent } from '@/hooks/component'
 import { BuyOrSell } from '@/constants/order'
@@ -35,13 +47,22 @@ const componentMap = new Map<string, unknown>([
     ['listing', defineAsyncComponent(() => import('@mobile/views/goods/detail/components/listing/Index.vue'))],
 ])
 
+defineProps({
+    showBackButton: {
+        type: Boolean,
+        default: true
+    },
+})
+
 const { router, getQueryStringToNumber } = useNavigation()
 const futuresStore = useFuturesStore()
-const goodsid = getQueryStringToNumber('goodsid')
-const quote = futuresStore.getGoodsQuote(goodsid)
+const selectedIndex = shallowRef(-1)
 const buyOrSell = shallowRef<BuyOrSell>()
+const loading = shallowRef(false)
 
-const goodsCode = computed(() => quote.value?.goodscode ?? '')
+const goodsList = computed(() => futuresStore.getGoodsListByTradeMode(50))
+const selectedItem = computed(() => goodsList.value[selectedIndex.value])
+const goodsCode = computed(() => selectedItem.value?.goodscode ?? '')
 
 const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 
@@ -50,13 +71,48 @@ const onListing = (type: BuyOrSell) => {
     openComponent('listing')
 }
 
+// 上一个
+const onPrev = () => {
+    if (!loading.value && selectedIndex.value) {
+        loading.value = true
+        selectedIndex.value -= 1
+        setTimeout(() => {
+            loading.value = false
+        }, 0)
+    }
+}
+
+// 下一个
+const onNext = () => {
+    if (!loading.value && selectedIndex.value < (goodsList.value.length - 1)) {
+        loading.value = true
+        selectedIndex.value += 1
+        setTimeout(() => {
+            loading.value = false
+        }, 0)
+    }
+}
+
 const onMoreClick = (buyorsell: BuyOrSell) => {
     router.push({
         name: 'goods-trade',
         query: {
-            goodsid,
+            goodsid: selectedItem.value?.goodsid,
             buyorsell,
         }
     })
 }
-</script>
+
+onMounted(() => {
+    const goodsid = getQueryStringToNumber('goodsid')
+    if (goodsid) {
+        selectedIndex.value = goodsList.value.findIndex((e) => e.goodsid === goodsid)
+    } else if (goodsList.value.length) {
+        selectedIndex.value = 0
+    }
+})
+</script>
+
+<style lang="less">
+@import './index.less';
+</style>

+ 7 - 8
src/packages/qdhs/views/home/Index.vue

@@ -13,7 +13,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, nextTick, watch, onMounted } from 'vue'
+import { shallowRef, nextTick, watch, onMounted, computed } from 'vue'
 import { fullloading, dialog } from '@/utils/vant'
 import { versionToNumber } from '@/filters'
 import { Tabbar } from '@mobile/components/base/tabbar/types'
@@ -25,12 +25,14 @@ import plus from '@/utils/h5plus'
 import AppTabbar from '@mobile/components/base/tabbar/index.vue'
 import RouterTransition from '@mobile/components/base/router-transition/index.vue'
 
-const { route, routerTo, getGlobalUrlParams } = useNavigation()
+const { route, routerTo } = useNavigation()
 const { userLogin } = useLogin()
 const loginStore = useLoginStore()
 const cssTransition = shallowRef(true) // 是否使用css动画
 const currentTab = shallowRef(0)
 
+const tabIndex = computed(() => tabList.findIndex((e) => e.name === route.name))
+
 const tabList: Tabbar[] = [
   {
     name: 'home-index',
@@ -80,9 +82,7 @@ const onTabClick = (index: number) => {
 }
 
 onMounted(() => {
-  const { tabIndex } = getGlobalUrlParams()
-  currentTab.value = tabIndex > -1 ? tabIndex : tabList.findIndex((e) => e.name === route.name)
-
+  currentTab.value = tabIndex.value
   const os = plus.getSystemInfo('os')
   const currentVersion = plus.getSystemInfo('version')
   const currentVersionCode = plus.getSystemInfo('versionCode')
@@ -145,9 +145,8 @@ onMounted(() => {
 })
 
 watch(() => route.name, () => {
-  const { tabIndex } = getGlobalUrlParams()
-  if (tabIndex > -1) {
-    onTabClick(tabIndex)
+  if (tabIndex.value > -1) {
+    onTabClick(tabIndex.value)
   } else {
     nextTick(() => {
       cssTransition.value = true

+ 7 - 8
src/packages/sbyj/views/home/index.vue

@@ -13,7 +13,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, nextTick, watch, onMounted } from 'vue'
+import { shallowRef, nextTick, watch, onMounted ,computed} from 'vue'
 import { fullloading, dialog } from '@/utils/vant'
 import { Tabbar } from '@mobile/components/base/tabbar/types'
 import { getAppUpdateInfo } from '@/services/api/common'
@@ -24,12 +24,14 @@ import plus from '@/utils/h5plus'
 import AppTabbar from '@mobile/components/base/tabbar/index.vue'
 import RouterTransition from '@mobile/components/base/router-transition/index.vue'
 
-const { route, routerTo, getGlobalUrlParams } = useNavigation()
+const { route, routerTo } = useNavigation()
 const { userLogin } = useLogin()
 const loginStore = useLoginStore()
 const cssTransition = shallowRef(true) // 是否使用css动画
 const currentTab = shallowRef(0)
 
+const tabIndex = computed(() => tabList.findIndex((e) => e.name === route.name))
+
 const tabList: Tabbar[] = [
   {
     name: 'home-index',
@@ -94,9 +96,7 @@ const versionToNumber = (value: number | string) => {
 }
 
 onMounted(() => {
-  const { tabIndex } = getGlobalUrlParams()
-  currentTab.value = tabIndex > -1 ? tabIndex : tabList.findIndex((e) => e.name === route.name)
-
+  currentTab.value = tabIndex.value
   const os = plus.getSystemInfo('os')
   const currentVersion = plus.getSystemInfo('version')
   const currentVersionCode = plus.getSystemInfo('versionCode')
@@ -159,9 +159,8 @@ onMounted(() => {
 })
 
 watch(() => route.name, () => {
-  const { tabIndex } = getGlobalUrlParams()
-  if (tabIndex > -1) {
-    onTabClick(tabIndex)
+  if (tabIndex.value > -1) {
+    onTabClick(tabIndex.value)
   } else {
     nextTick(() => {
       cssTransition.value = true

+ 3 - 16
src/packages/sbyj/views/home/main/index.vue

@@ -12,7 +12,7 @@
       </app-block>
       <app-block class="home-main__iconbar bg">
         <ul>
-          <li @click="switchTab(1)">
+          <li @click="routerTo('home-market', true)">
             <Iconfont label-direction="bottom" icon="g-icon-quote--line">行情</Iconfont>
           </li>
           <li @click="routerTo('order-list')">
@@ -28,7 +28,7 @@
           <Cell class="home-main__titlebar" title="市场资讯" value="更多" icon="fire" :to="{ name: 'news-list' }" is-link />
           <template v-for="(item, index) in newsList" :key="index">
             <Cell class="article-item" :title="item.data.content" :value="formatDate(item.time, 'MM/DD')"
-              @click="switchTab(2)" />
+              @click="routerTo('home-news', true)" />
           </template>
         </CellGroup>
       </app-block>
@@ -45,24 +45,11 @@ import { queryImageConfigs, getJ10News } from "@/services/api/common";
 import Banner from '@mobile/components/base/banner/index.vue'
 import Iconfont from '@mobile/components/base/iconfont/index.vue'
 
-const { routerTo, setGlobalUrlParams } = useNavigation();
+const { routerTo } = useNavigation();
 const refreshing = shallowRef(false); // 是否处于加载中状态
 const topBanners = shallowRef<string[]>([]); // 轮播图列表
 const newsList = shallowRef<Model.J10NewsRsp[]>([]); // 资讯列表
 
-// 跳转导航页面
-const switchTab = (tabIndex: number) => {
-  setGlobalUrlParams({ tabIndex })
-  switch (tabIndex) {
-    case 1:
-      routerTo('home-market', true)
-      break
-    case 2:
-      routerTo('home-news', true)
-      break
-  }
-}
-
 // 下拉刷新
 const onRefresh = () => {
   queryImageConfigs({

+ 7 - 8
src/packages/zrwyt/views/home/Index.vue

@@ -13,7 +13,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, nextTick, watch, onMounted } from 'vue'
+import { shallowRef, nextTick, watch, onMounted, computed } from 'vue'
 import { fullloading, dialog } from '@/utils/vant'
 import { versionToNumber } from '@/filters'
 import { Tabbar } from '@mobile/components/base/tabbar/types'
@@ -25,12 +25,14 @@ import plus from '@/utils/h5plus'
 import AppTabbar from '@mobile/components/base/tabbar/index.vue'
 import RouterTransition from '@mobile/components/base/router-transition/index.vue'
 
-const { route, routerTo, getGlobalUrlParams } = useNavigation()
+const { route, routerTo } = useNavigation()
 const { userLogin } = useLogin()
 const loginStore = useLoginStore()
 const cssTransition = shallowRef(true) // 是否使用css动画
 const currentTab = shallowRef(0)
 
+const tabIndex = computed(() => tabList.findIndex((e) => e.name === route.name))
+
 const tabList: Tabbar[] = [
   {
     name: 'home-index',
@@ -86,9 +88,7 @@ const onTabClick = (index: number) => {
 }
 
 onMounted(() => {
-  const { tabIndex } = getGlobalUrlParams()
-  currentTab.value = tabIndex > -1 ? tabIndex : tabList.findIndex((e) => e.name === route.name)
-
+  currentTab.value = tabIndex.value
   const os = plus.getSystemInfo('os')
   const currentVersion = plus.getSystemInfo('version')
   const currentVersionCode = plus.getSystemInfo('versionCode')
@@ -151,9 +151,8 @@ onMounted(() => {
 })
 
 watch(() => route.name, () => {
-  const { tabIndex } = getGlobalUrlParams()
-  if (tabIndex > -1) {
-    onTabClick(tabIndex)
+  if (tabIndex.value > -1) {
+    onTabClick(tabIndex.value)
   } else {
     nextTick(() => {
       cssTransition.value = true

+ 6 - 17
src/packages/zrwyt/views/home/main/Index.vue

@@ -10,13 +10,13 @@
       </app-block>
       <!-- <app-block class="home-main__iconbar bg">
         <ul>
-          <li @click="switchTab(1)">
+          <li @click="switchTab('home-ballot')">
             <Iconfont label-direction="bottom" icon="g-icon-presale--line">预售中签</Iconfont>
           </li>
-          <li @click="switchTab(2)">
+          <li @click="switchTab('home-transfer')">
             <Iconfont label-direction="bottom" icon="g-icon-transfer--line">定金转让</Iconfont>
           </li>
-          <li @click="switchTab(3)">
+          <li @click="switchTab('home-16201')">
             <Iconfont label-direction="bottom" icon="g-icon-listing--line m16201">全款挂牌</Iconfont>
           </li>
           <li @click="routerTo('goods-50101')">
@@ -50,26 +50,15 @@ import Iconfont from '@mobile/components/base/iconfont/index.vue'
 
 const globalStore = useGlobalStore()
 const loginStore = useLoginStore();
-const { routerTo, setGlobalUrlParams } = useNavigation();
+const { routerTo } = useNavigation();
 const refreshing = shallowRef(false); // 是否处于加载中状态
 const topBanners = shallowRef<string[]>([]); // 轮播图列表
 const newsList = shallowRef<Model.NewTitlesRsp[]>([]); // 资讯列表
 
 // 跳转导航页面
-const switchTab = (tabIndex: number) => {
+const switchTab = (routeName: string) => {
   if (loginStore.token) {
-    setGlobalUrlParams({ tabIndex })
-    switch (tabIndex) {
-      case 1:
-        routerTo('home-ballot', true)
-        break
-      case 2:
-        routerTo('home-transfer', true)
-        break
-      case 3:
-        routerTo('home-16201', true)
-        break
-    }
+    routerTo(routeName, true)
   } else {
     routerTo('user-login')
   }