index.vue 10 KB

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