index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <script setup lang="ts">
  2. import { StaticUrl } from '@/config'
  3. import router from '@/router'
  4. definePage({
  5. name: 'smqjh-home',
  6. layout: 'tabbar',
  7. islogin: false,
  8. style: {
  9. navigationBarTitleText: '首页',
  10. navigationStyle: 'custom',
  11. backgroundColor: '#9ED605',
  12. backgroundColorTop: '#9ED605',
  13. },
  14. })
  15. const { show } = useGlobalToast()
  16. const addressStore = useAddressStore()
  17. const { statusBarHeight, MenuButtonHeight, opcity, isOnlineAudit } = storeToRefs(useSysStore())
  18. const { name } = storeToRefs(addressStore)
  19. const { userInfo } = storeToRefs(useUserStore())
  20. const xsbStore = ref<typeof import('@/subPack-xsb/store-xsb/sys')>()
  21. const { data: goodsList, isLastPage, page, reload, error, refresh } = usePagination((pageNum, pageSize) =>
  22. Apis.xsb.getSearchProductList({ data: { pageNum, pageSize, salesNum: 'DESC', shopId: xsbStore.value?.useSysXsbStore().SelectShopInfo.shopId || 2, channelId: userInfo.value.channelId || 1 } }), {
  23. data: resp => resp.data?.list,
  24. initialData: [],
  25. initialPage: 1,
  26. initialPageSize: 10,
  27. append: true,
  28. immediate: false,
  29. })
  30. const state = computed(() => {
  31. return error.value ? 'error' : !isLastPage.value ? 'loading' : 'finished'
  32. })
  33. const loading = ref(true)
  34. onShow(async () => {
  35. useSysStore().getAudit()
  36. useSmqjhCartStore().getCartList('XSB')
  37. xsbStore.value = await AsyncImport('@/subPack-xsb/store-xsb/sys')
  38. refresh()
  39. })
  40. onMounted(() => {
  41. setTimeout(() => {
  42. loading.value = false
  43. }, 1000)
  44. })
  45. onReachBottom(() => {
  46. if (!isLastPage.value) {
  47. page.value++
  48. }
  49. })
  50. const navList = computed(() => {
  51. const list = [
  52. { icon: `${StaticUrl}/xsb.png`, title: '星闪豹', name: 'xsb-homeTabbar', show: true },
  53. { icon: `${StaticUrl}/smqjh-index-cd.png`, title: '充电', name: '', show: !isOnlineAudit.value }, // !isOnlineAudit.value
  54. { icon: `${StaticUrl}/smqjh-sp.png`, title: '电影演出', name: '', show: !isOnlineAudit.value },
  55. { icon: `${StaticUrl}/smqjh-vip.png`, title: '视频权益', name: '', show: !isOnlineAudit.value },
  56. { icon: `${StaticUrl}/smqjh-diancan.png`, title: '大牌点餐', name: '', show: !isOnlineAudit.value },
  57. { icon: `${StaticUrl}/smqjh-jiayou.png`, title: '加油', name: '', show: !isOnlineAudit.value },
  58. { icon: `${StaticUrl}/smqjh-jiudian.png`, title: '酒店民宿', name: '', show: !isOnlineAudit.value },
  59. { icon: `${StaticUrl}/smqjh-daijia.png`, title: '代驾', name: '', show: !isOnlineAudit.value },
  60. ]
  61. return list
  62. })
  63. onMounted(() => {
  64. addressStore.getLocation()
  65. opcity.value = 0
  66. })
  67. onPageScroll((e) => {
  68. const calculatedOpacity = e.scrollTop / 100
  69. opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
  70. })
  71. function handleClick(name: string) {
  72. if (!name) {
  73. show({ msg: '敬请期待 !' })
  74. return
  75. }
  76. router.push({ name })
  77. }
  78. onShareAppMessage(() => {
  79. return {
  80. title: '市民请集合',
  81. }
  82. })
  83. function handleGo() {
  84. show({ msg: '敬请期待 !' })
  85. }
  86. </script>
  87. <template>
  88. <view class="page-class box-border">
  89. <wd-navbar
  90. title="" :custom-style="`background-color: rgba(158,214,5,${opcity});`" :bordered="false" :z-index="99"
  91. safe-area-inset-top fixed
  92. >
  93. <template #left>
  94. <view class="relative z-10 h48rpx w-full w202rpx opacity-100">
  95. <image class="absolute left-0 top-0 h48rpx w202rpx" :src="`${StaticUrl}/logo.png`" />
  96. </view>
  97. </template>
  98. </wd-navbar>
  99. <view
  100. class="header-linear h320rpx px24rpx"
  101. :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }"
  102. >
  103. <view class="box-border flex items-center">
  104. <view class="flex items-center" @click="useAddressStore().getMapAddress()">
  105. <image :src="`${StaticUrl}/location-black.png`" class="h33.8rpx min-w28.97rpx w28.97rpx" />
  106. <view class="ml18rpx max-w-180rpx truncate text-32rpx">
  107. {{ name }}
  108. </view>
  109. </view>
  110. <view class="ml16rpx h60rpx w502rpx flex items-center justify-between rounded-40rpx bg-white pr6rpx">
  111. <view class="flex items-center pb14rpx pl24rpx pt16rpx">
  112. <wd-icon name="search" size="14" color="#ccc" />
  113. <view class="ml12rpx text-24rpx text-gray">
  114. 霸王茶姬
  115. </view>
  116. </view>
  117. <view
  118. class="h50rpx w96rpx flex items-center justify-center rounded-26rpx bg-[var(--them-color)] text-24rpx text-white font-semibold"
  119. >
  120. 搜索
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. <view class="px24rpx -mt260rpx">
  126. <view class="mt24rpx rounded-16rpx bg-white py24rpx" :class="[loading ? 'px24rpx' : '']">
  127. <wd-skeleton
  128. :loading="loading"
  129. theme="image" :row-col="[
  130. [
  131. { width: '120rpx', height: '120rpx' },
  132. { width: '120rpx', height: '120rpx' },
  133. { width: '120rpx', height: '120rpx' },
  134. { width: '120rpx', height: '120rpx' },
  135. ],
  136. [
  137. { width: '120rpx', height: '120rpx' },
  138. { width: '120rpx', height: '120rpx' },
  139. { width: '120rpx', height: '120rpx' },
  140. { width: '120rpx', height: '120rpx' },
  141. ],
  142. ]"
  143. >
  144. <view class="grid grid-cols-4 gap12rpx">
  145. <template v-for="item in navList" :key="item.icon">
  146. <view
  147. v-if="item.show" class="flex flex-col items-center justify-center"
  148. @click="handleClick(String(item.name))"
  149. >
  150. <view class="relative h120rpx w120rpx">
  151. <image :src="item.icon" class="h120rpx w120rpx" />
  152. <view
  153. v-if="item.name == ''"
  154. class="linebg absolute left-0 top-0 h-full w-full flex items-center justify-center rounded-32rpx text-24rpx text-white font-semibold"
  155. >
  156. 敬请期待
  157. </view>
  158. </view>
  159. <view class="text-24rpx">
  160. {{ item.title }}
  161. </view>
  162. </view>
  163. </template>
  164. </view>
  165. </wd-skeleton>
  166. </view>
  167. <view class="mt20rpx w-full flex items-center justify-between" @click="handleGo">
  168. <image :src="`${StaticUrl}/smqjh-fl.png`" class="h346rpx w344rpx flex-shrink-0" />
  169. <view class="flex flex-1 flex-col items-end justify-center">
  170. <image :src="`${StaticUrl}/smqjh-hot-vip.png`" class="h180rpx w344rpx" />
  171. <image :src="`${StaticUrl}/smqjh-cd.png`" class="mt14rpx h152rpx w344rpx" />
  172. </view>
  173. </view>
  174. <view class="mt20rpx">
  175. <wd-skeleton
  176. theme="image" animation="gradient" :loading="loading"
  177. :row-col="[[{ height: '568rpx', width: '344rpx' }, { height: '568rpx', width: '344rpx' }], [{ height: '568rpx', width: '344rpx' }, { height: '568rpx', width: '344rpx' }]]"
  178. >
  179. <view class="flex items-center">
  180. <scroll-view scroll-y type="custom">
  181. <grid-view type="masonry" cross-axis-count="2" main-axis-gap="10" cross-axis-gap="10">
  182. <view
  183. v-for="item in goodsList" :key="item.id"
  184. class="relative overflow-hidden rounded-16rpx bg-white pb16rpx"
  185. >
  186. <view @click="router.push({ name: 'xsb-goods', params: { id: item.prodId } })">
  187. <view class="relative h344rpx">
  188. <image :src="item.pic" class="h344rpx w344rpx" />
  189. <view class="absolute bottom-0 left-0 flex items-center text-22rpx">
  190. <view class="rounded-tl-8rpx bg-#02ECFD pl4rpx">
  191. 星闪豹
  192. </view>
  193. <!-- <view class="rounded-tr-8rpx bg-[rgba(0,0,0,0.5)] pl8rpx pr4rpx text-white">
  194. 峰10:00-13:00
  195. </view> -->
  196. </view>
  197. </view>
  198. <view class="mt16rpx pl20rpx pr6rpx">
  199. <view class="flex items-center">
  200. <!-- <view class="rounded-8rpx bg-#FF4D3A px12rpx text-24rpx text-white">
  201. 补贴
  202. </view> -->
  203. <view class="line-clamp-2 text-28rpx font-semibold">
  204. {{ item.prodName }}
  205. </view>
  206. </view>
  207. <view class="mt20rpx flex items-end text-#FF4D3A">
  208. <view class="text-24rpx">
  209. </view>
  210. <view class="text-36rpx line-height-[36rpx]">
  211. {{ item.channelProdPrice }}
  212. </view>
  213. <view class="text-24rpx">
  214. </view>
  215. </view>
  216. </view>
  217. </view>
  218. <view
  219. v-if="!item.spuStock"
  220. class="absolute left-0 top-0 z-1 h-full w-full flex items-center justify-center bg-[rgba(255,255,255,0.6)]"
  221. >
  222. <view
  223. class="h156rpx w156rpx flex items-center justify-center rounded-full bg-[rgba(0,0,0,.6)] text-28rpx text-white"
  224. >
  225. 商品已售罄
  226. </view>
  227. </view>
  228. </view>
  229. </grid-view>
  230. </scroll-view>
  231. </view>
  232. </wd-skeleton>
  233. <wd-loadmore :state="state" :loading-props="{ color: '#9ED605', size: 20 }" @reload="reload" />
  234. </view>
  235. </view>
  236. </view>
  237. </template>
  238. <style scoped lang="scss">
  239. .page-class {
  240. :deep() {
  241. .wd-divider {
  242. margin: 0 !important;
  243. }
  244. }
  245. .flex-box-item {
  246. background: linear-gradient(180deg, #EBFFB4 0%, #FFFFFF 46%, #FFFFFF 100%);
  247. }
  248. .baoyou {
  249. background: url('https://zswl-shop.oss-cn-chengdu.aliyuncs.com/2025/11/771b8a09633448d8b62c0004a8928054.png') no-repeat;
  250. background-size: contain;
  251. }
  252. .linebg {
  253. background: rgba(0, 0, 0, .3);
  254. }
  255. }
  256. </style>