|
|
@@ -5,14 +5,12 @@
|
|
|
<div class="searchbar">
|
|
|
<Search shape="round" background="transparent" :placeholder="$t('tss.tips1')"
|
|
|
@click="$router.push({ name: 'search' })" />
|
|
|
- <Icon name="bullhorn-o" :dot="noticeStore.unreadList.length > 0" />
|
|
|
+ <Icon name="bullhorn-o" :dot="noticeStore.unreadList.length > 0"
|
|
|
+ @click="$router.push({ name: 'notice-list' })" />
|
|
|
</div>
|
|
|
</app-statusbar>
|
|
|
</template>
|
|
|
- <PullRefresh class="home-main__container" v-model="refreshing" @refresh="onRefresh"
|
|
|
- :pulling-text="$t('common.pulling-text')" :loosing-text="$t('common.loosing-text')"
|
|
|
- :loading-text="$t('common.loading-text')" :success-text="$t('common.success-text')"
|
|
|
- :style="{ backgroundImage: `url(${getFileUrl(topBanners)})` }">
|
|
|
+ <div class="home-main__container" :style="{ backgroundImage: `url(${getFileUrl(topBanners)})` }">
|
|
|
<app-block class="home-main__notice">
|
|
|
<h4 @click="$router.push({ name: 'notice-list' })">
|
|
|
<span>{{ $t('routes.notice') }}</span>
|
|
|
@@ -21,13 +19,13 @@
|
|
|
</app-block>
|
|
|
<app-block class="home-main__iconbar">
|
|
|
<ul>
|
|
|
- <li @click="openComponent('benefits')">
|
|
|
+ <li @click="$router.push({ name: 'rules-benefits' })">
|
|
|
<span>新人福利</span>
|
|
|
</li>
|
|
|
- <li @click="openComponent('malls')">
|
|
|
+ <li @click="$router.push({ name: 'rules-malls' })">
|
|
|
<span>了解商城</span>
|
|
|
</li>
|
|
|
- <li @click="openComponent('logistics')">
|
|
|
+ <li @click="$router.push({ name: 'rules-logistics' })">
|
|
|
<span>物流服务</span>
|
|
|
</li>
|
|
|
</ul>
|
|
|
@@ -48,23 +46,24 @@
|
|
|
</CellGroup>
|
|
|
</app-block>
|
|
|
<ProductList :data-list="goodsCollectionStore.collections" />
|
|
|
- <component ref="componentRef" :is="componentMap.get(componentId)" @closed="closeComponent" v-if="componentId" />
|
|
|
- </PullRefresh>
|
|
|
+ </div>
|
|
|
</app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, onMounted, defineAsyncComponent } from 'vue'
|
|
|
-import { Cell, CellGroup, PullRefresh, Search, Icon } from 'vant'
|
|
|
+import { shallowRef, onMounted, onActivated } from 'vue'
|
|
|
+import { Cell, CellGroup, Search, Icon } from 'vant'
|
|
|
import { getFileUrl } from '@/filters'
|
|
|
import { queryImageConfigs } from '@/services/api/common'
|
|
|
import { queryNewTitles } from '@/services/api/news'
|
|
|
-import { useNoticeStore, useGoodsCollectionStore } from '@/stores'
|
|
|
-import { useComponent } from '@/hooks/component'
|
|
|
+import { queryTouristGoods, queryTouristQuoteDay } from '@/services/api/goods'
|
|
|
+import { useLoginStore, useNoticeStore, useGoodsCollectionStore, useFuturesStore } from '@/stores'
|
|
|
import ProductList from '../../product/list/components/waterfall-list/index.vue'
|
|
|
|
|
|
+const loginStore = useLoginStore()
|
|
|
const noticeStore = useNoticeStore()
|
|
|
const goodsCollectionStore = useGoodsCollectionStore()
|
|
|
+const futuresStore = useFuturesStore()
|
|
|
|
|
|
const refreshing = shallowRef(false) // 是否处于加载中状态
|
|
|
const topBanners = shallowRef(''); // 背景图片
|
|
|
@@ -84,11 +83,6 @@ const onRefresh = () => {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- onRefresh()
|
|
|
-
|
|
|
// 市场资讯
|
|
|
queryNewTitles({
|
|
|
data: {
|
|
|
@@ -100,16 +94,40 @@ onMounted(() => {
|
|
|
}).finally(() => {
|
|
|
refreshing.value = false
|
|
|
})
|
|
|
-})
|
|
|
+}
|
|
|
|
|
|
-const componentMap = new Map<string, unknown>([
|
|
|
- ['benefits', defineAsyncComponent(() => import('./components/benefits/Index.vue'))], // 新人福利
|
|
|
- ['malls', defineAsyncComponent(() => import('./components/malls/Index.vue'))], // 了解商城
|
|
|
- ['logistics', defineAsyncComponent(() => import('./components/logistics/Index.vue'))], // 物流服务
|
|
|
-])
|
|
|
+onMounted(() => {
|
|
|
+ onRefresh()
|
|
|
|
|
|
-const { componentRef, componentId, openComponent, closeComponent } = useComponent()
|
|
|
+ if (!loginStore.token) {
|
|
|
+ // 获取游客商品列表
|
|
|
+ queryTouristGoods({
|
|
|
+ data: {
|
|
|
+ trademodes: '53',
|
|
|
+ marketids: '53201'
|
|
|
+ }
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data.length) {
|
|
|
+ futuresStore.goodsList = res.data
|
|
|
+ const goodsCodes = res.data.map((e) => e.goodscode)
|
|
|
+
|
|
|
+ // 获取游客商品盘面
|
|
|
+ queryTouristQuoteDay({
|
|
|
+ data: {
|
|
|
+ goodsCodes: goodsCodes.join(',')
|
|
|
+ }
|
|
|
+ }).then((res) => {
|
|
|
+ goodsCodes.forEach((goodscode) => {
|
|
|
+ const item = res.data.find((e) => e.goodscode === goodscode)
|
|
|
+ futuresStore.updateQuotation(item ?? { goodscode })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
+ onActivated(() => onRefresh())
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|