index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <script setup lang="ts">
  2. import { createGlobalLoadingMiddleware } from '@/api/core/middleware'
  3. import { StaticUrl, VITE_OSS_BASE_URL } from '@/config'
  4. import router from '@/router'
  5. definePage({
  6. name: 'smqjh-home',
  7. layout: 'tabbar',
  8. islogin: false,
  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 } = storeToRefs(useSysStore())
  19. const { name } = storeToRefs(addressStore)
  20. const { userInfo } = storeToRefs(useUserStore())
  21. const { getTotalNum } = storeToRefs(useSmqjhCartStore())
  22. const { data: goodsList, isLastPage, page, reload, error, loading } = usePagination((pageNum, pageSize) =>
  23. Apis.xsb.getSearchProductList({ data: { pageNum, pageSize, salesNum: 'DESC', 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. middleware: createGlobalLoadingMiddleware(),
  30. })
  31. const state = computed(() => {
  32. return error.value ? 'error' : !isLastPage.value ? 'loading' : 'finished'
  33. })
  34. onShow(() => {
  35. useSmqjhCartStore().getCartList('XSB')
  36. useTabbar().setTabbarItem('smqjh-cart', getTotalNum.value)
  37. })
  38. onReachBottom(() => {
  39. if (!isLastPage.value) {
  40. page.value++
  41. }
  42. })
  43. const navList = ref([
  44. { icon: `${VITE_OSS_BASE_URL}2025/11/4dabcf9b8d794d3c99aa6b49be34f205.png`, title: '星闪豹', name: 'xsb-homeTabbar' },
  45. { icon: `${VITE_OSS_BASE_URL}2025/11/40cb38e287234a83885d68f30c9c39bc.png`, title: '充电', name: '' },
  46. { icon: `${VITE_OSS_BASE_URL}2025/11/9981d979739b4ae6b4eec941b7d2c9b0.png`, title: '电影演出', name: '' },
  47. { icon: `${VITE_OSS_BASE_URL}2025/11/f2b15ec1048e4b5689fe1ba26f6058e1.png`, title: '视频权益', name: '' },
  48. { icon: `${VITE_OSS_BASE_URL}2025/11/0e971577095c406a88c5ea10af419246.png`, title: '大牌点餐', name: '' },
  49. { icon: `${VITE_OSS_BASE_URL}2025/11/95e2ea622dbd498a8a36ab74f00209f3.png`, title: '加油', name: '' },
  50. { icon: `${VITE_OSS_BASE_URL}2025/11/f5178ca02e3e4ebb9072d9e129bb3fd4.png`, title: '酒店民宿', name: '' },
  51. { icon: `${VITE_OSS_BASE_URL}2025/11/d1f4d36d6fcc442a841f4f4f4927df19.png`, title: '代驾', name: '' },
  52. ])
  53. onMounted(() => {
  54. addressStore.getLocation()
  55. opcity.value = 0
  56. })
  57. onPageScroll((e) => {
  58. const calculatedOpacity = e.scrollTop / 100
  59. opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
  60. })
  61. function handleClick(name: string) {
  62. if (!name) {
  63. show({ msg: '敬请期待 !' })
  64. return
  65. }
  66. router.push({ name })
  67. }
  68. onShareAppMessage(() => {
  69. return {
  70. title: '市民请集合',
  71. }
  72. })
  73. function handleGo() {
  74. show({ msg: '敬请期待 !' })
  75. }
  76. </script>
  77. <template>
  78. <view class="page-class box-border">
  79. <wd-navbar
  80. title="" :custom-style="`background-color: rgba(158,214,5,${opcity});`" :bordered="false" :z-index="99"
  81. safe-area-inset-top fixed
  82. >
  83. <template #left>
  84. <view class="relative z-10 h48rpx w-full w202rpx opacity-100">
  85. <image class="absolute left-0 top-0 h48rpx w202rpx" :src="`${StaticUrl}/logo.png`" />
  86. </view>
  87. </template>
  88. </wd-navbar>
  89. <view
  90. class="header-linear h320rpx px24rpx"
  91. :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }"
  92. >
  93. <view class="box-border flex items-center">
  94. <view class="flex items-center" @click="useAddressStore().getMapAddress()">
  95. <image :src="`${StaticUrl}/location-black.png`" class="h33.8rpx min-w28.97rpx w28.97rpx" />
  96. <view class="ml18rpx max-w-180rpx truncate text-32rpx">
  97. {{ name }}
  98. </view>
  99. </view>
  100. <view class="ml16rpx h60rpx w502rpx flex items-center justify-between rounded-40rpx bg-white pr6rpx">
  101. <view class="flex items-center pb14rpx pl24rpx pt16rpx">
  102. <wd-icon name="search" size="14" color="#ccc" />
  103. <view class="ml12rpx text-24rpx text-gray">
  104. 霸王茶姬
  105. </view>
  106. </view>
  107. <view
  108. class="h50rpx w96rpx flex items-center justify-center rounded-26rpx bg-[var(--them-color)] text-24rpx text-white font-semibold"
  109. >
  110. 搜索
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. <view class="px24rpx -mt260rpx">
  116. <view class="grid grid-cols-4 mt24rpx gap12rpx rounded-16rpx bg-white py24rpx">
  117. <view
  118. v-for="item in navList" :key="item.icon" class="flex flex-col items-center justify-center"
  119. @click="handleClick(String(item.name))"
  120. >
  121. <view class="relative h120rpx w120rpx">
  122. <image :src="item.icon" class="h120rpx w120rpx" />
  123. <view
  124. v-if="item.title != '星闪豹'"
  125. class="linebg absolute left-0 top-0 h-full w-full flex items-center justify-center rounded-32rpx text-24rpx text-white font-semibold"
  126. >
  127. 敬请期待
  128. </view>
  129. </view>
  130. <view class="text-24rpx">
  131. {{ item.title }}
  132. </view>
  133. </view>
  134. </view>
  135. <view class="mt20rpx w-full flex items-center justify-between" @click="handleGo">
  136. <image :src="`${StaticUrl}/smqjh-fl.png`" class="h346rpx w344rpx flex-shrink-0" />
  137. <view class="flex flex-1 flex-col items-end justify-center">
  138. <image :src="`${StaticUrl}/smqjh-hot-vip.png`" class="h180rpx w344rpx" />
  139. <image :src="`${StaticUrl}/smqjh-hot-vip.png`" class="mt14rpx h152rpx w344rpx" />
  140. </view>
  141. </view>
  142. <view class="mt20rpx">
  143. <wd-skeleton
  144. theme="image" animation="gradient" :loading="loading"
  145. :row-col="[[{ height: '568rpx', width: '344rpx' }, { height: '568rpx', width: '344rpx' }], [{ height: '568rpx', width: '344rpx' }, { height: '568rpx', width: '344rpx' }]]"
  146. >
  147. <view class="flex items-center">
  148. <scroll-view scroll-y type="custom">
  149. <grid-view type="masonry" cross-axis-count="2" main-axis-gap="10" cross-axis-gap="10">
  150. <view
  151. v-for="item in goodsList" :key="item.id"
  152. class="relative overflow-hidden rounded-16rpx bg-white pb16rpx"
  153. >
  154. <view @click="router.push({ name: 'xsb-goods', params: { id: item.prodId } })">
  155. <view class="relative h344rpx">
  156. <image :src="item.pic" class="h344rpx w344rpx" />
  157. <view class="absolute bottom-0 left-0 flex items-center text-22rpx">
  158. <view class="rounded-tl-8rpx bg-#02ECFD pl4rpx">
  159. 星闪豹
  160. </view>
  161. <!-- <view class="rounded-tr-8rpx bg-[rgba(0,0,0,0.5)] pl8rpx pr4rpx text-white">
  162. 峰10:00-13:00
  163. </view> -->
  164. </view>
  165. </view>
  166. <view class="mt16rpx pl20rpx pr6rpx">
  167. <view class="flex items-center">
  168. <!-- <view class="rounded-8rpx bg-#FF4D3A px12rpx text-24rpx text-white">
  169. 补贴
  170. </view> -->
  171. <view class="line-clamp-2 text-28rpx font-semibold">
  172. {{ item.prodName }}
  173. </view>
  174. </view>
  175. <view class="mt20rpx flex items-end text-#FF4D3A">
  176. <view class="text-24rpx">
  177. </view>
  178. <view class="text-36rpx line-height-[36rpx]">
  179. {{ item.channelProdPrice }}
  180. </view>
  181. <view class="text-24rpx">
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. <view
  187. v-if="!item.spuStock"
  188. class="absolute left-0 top-0 z-1 h-full w-full flex items-center justify-center bg-[rgba(255,255,255,0.6)]"
  189. >
  190. <view
  191. class="h156rpx w156rpx flex items-center justify-center rounded-full bg-[rgba(0,0,0,.6)] text-28rpx text-white"
  192. >
  193. 商品已售罄
  194. </view>
  195. </view>
  196. </view>
  197. <!-- <view class="overflow-hidden rounded-16rpx bg-white pb16rpx">
  198. <view class="relative h344rpx">
  199. <image :src="`${VITE_OSS_BASE_URL}2025/11/8177f50dc5f040188dbd40149831273a.png`" class="h344rpx w344rpx" />
  200. <view class="absolute bottom-0 left-0 flex items-center text-22rpx">
  201. <view class="rounded-tl-8rpx bg-#FCD22B pl4rpx pr8rpx">
  202. 酒店民宿
  203. </view>
  204. <view class="rounded-tr-8rpx bg-[rgba(0,0,0,0.5)] pl8rpx pr4rpx text-white">
  205. 距您5km
  206. </view>
  207. </view>
  208. </view>
  209. <view class="mt16rpx pl20rpx pr6rpx">
  210. <view class="flex">
  211. <view class="h32rpx flex items-center rounded-8rpx bg-#FF4D3A px12rpx text-24rpx text-white">
  212. <image :src="`${VITE_OSS_BASE_URL}2025/11/3437d2a44ffe4238b827c5472019d323.png`" class="mr8rpx h18rpx w20rpx" /> 直播中
  213. </view>
  214. <view class="ml8rpx text-28rpx font-semibold">
  215. 长白山雪景温
  216. </view>
  217. </view>
  218. <view class="ml12rpx text-28rpx font-semibold">
  219. 泉度假酒店
  220. </view>
  221. <view class="mt20rpx flex items-end text-#FF4D3A">
  222. <view class="text-24rpx">
  223. </view>
  224. <view class="text-36rpx line-height-[36rpx]">
  225. 398
  226. </view>
  227. <view class="text-24rpx">
  228. </view>
  229. </view>
  230. </view>
  231. </view>
  232. <view class="overflow-hidden rounded-16rpx bg-white pb16rpx">
  233. <view class="relative h344rpx">
  234. <image :src="`${VITE_OSS_BASE_URL}2025/11/04433c8d7186465d929a03d89a652caa.png`" class="h344rpx w344rpx" />
  235. <view class="absolute bottom-0 left-0 flex items-center text-22rpx">
  236. <view class="rounded-tl-8rpx bg-#006CE8 pl4rpx pr8rpx text-white">
  237. 星闪豹
  238. </view>
  239. <view class="rounded-tr-8rpx bg-[rgba(0,0,0,0.5)] pl8rpx pr4rpx text-white">
  240. 48分钟
  241. </view>
  242. </view>
  243. </view>
  244. <view class="mt16rpx pl20rpx pr6rpx">
  245. <view class="flex items-center">
  246. <view class="text-28rpx font-semibold">
  247. 海湾高盐特大白虾200g
  248. </view>
  249. </view>
  250. <view class="mt20rpx flex items-center">
  251. <view class="flex items-end text-#FF4D3A">
  252. <view class="text-24rpx">
  253. </view>
  254. <view class="text-36rpx line-height-[36rpx]">
  255. 29
  256. </view>
  257. <view class="text-24rpx">
  258. </view>
  259. <view class="ml10rpx text-24rpx text-#aaa line-through">
  260. ¥39
  261. </view>
  262. </view>
  263. </view>
  264. </view>
  265. </view>
  266. <view class="overflow-hidden rounded-16rpx bg-white pb16rpx">
  267. <view class="relative h344rpx">
  268. <image :src="`${VITE_OSS_BASE_URL}2025/11/4e2d6f2096a643f18fb9d11dee764509.png`" class="h344rpx w344rpx" />
  269. <view class="absolute bottom-0 left-0 flex items-center text-22rpx">
  270. <view class="rounded-tl-8rpx bg-#FF4D3A pl4rpx pr8rpx text-white">
  271. 电影演出
  272. </view>
  273. <view class="rounded-tr-8rpx bg-[rgba(0,0,0,0.5)] pl8rpx pr4rpx text-white">
  274. 评分8.9 1w+人想看
  275. </view>
  276. </view>
  277. </view>
  278. <view class="mt16rpx pl20rpx pr6rpx">
  279. <view class="flex items-center">
  280. <view class="rounded-8rpx bg-#FF4D3A px12rpx text-24rpx text-white">
  281. 折扣大促
  282. </view>
  283. <view class="ml12rpx text-28rpx font-semibold">
  284. 疯狂动物城2
  285. </view>
  286. </view>
  287. <view class="mt20rpx flex items-center">
  288. <view class="flex items-end text-#FF4D3A">
  289. <view class="text-24rpx">
  290. </view>
  291. <view class="text-36rpx line-height-[36rpx]">
  292. 19.9
  293. </view>
  294. <view class="text-24rpx">
  295. </view>
  296. <view class="ml8rpx text-24rpx text-#aaa">
  297. </view>
  298. </view>
  299. </view>
  300. <view class="mt16rpx text-24rpx text-#aaa">
  301. 电影演出上新榜No.1
  302. </view>
  303. </view>
  304. </view>
  305. <view class="overflow-hidden rounded-16rpx bg-white pb16rpx">
  306. <view class="relative h344rpx">
  307. <image :src="`${VITE_OSS_BASE_URL}2025/11/52624954555942dbbbe8dabf872c29c4.png`" class="h344rpx w344rpx" />
  308. <view class="absolute bottom-0 left-0 flex items-center text-22rpx">
  309. <view class="rounded-tl-8rpx bg-#02ECFD pl4rpx pr8rpx">
  310. 大牌点餐
  311. </view>
  312. <view class="rounded-tr-8rpx bg-[rgba(0,0,0,0.5)] pl8rpx pr4rpx text-white">
  313. 距您1.2km
  314. </view>
  315. </view>
  316. </view>
  317. <view class="mt16rpx pl20rpx pr6rpx">
  318. <view class="flex items-center">
  319. <view class="truncate rounded-8rpx bg-#FF4D3A px12rpx text-nowrap text-24rpx text-white">
  320. 折扣大促
  321. </view>
  322. <view class="ml12rpx truncate text-nowrap text-28rpx font-semibold">
  323. 大堡口福三件套
  324. </view>
  325. </view>
  326. <view class="mt20rpx flex items-end text-#FF4D3A">
  327. <view class="text-24rpx">
  328. </view>
  329. <view class="text-36rpx line-height-[36rpx]">
  330. 22
  331. </view>
  332. <view class="text-24rpx">
  333. </view>
  334. </view>
  335. </view>
  336. </view> -->
  337. </grid-view>
  338. </scroll-view>
  339. </view>
  340. </wd-skeleton>
  341. <wd-loadmore :state="state" :loading-props="{ color: '#9ED605', size: 20 }" @reload="reload" />
  342. </view>
  343. </view>
  344. </view>
  345. </template>
  346. <style scoped lang="scss">
  347. .page-class {
  348. :deep() {
  349. .wd-divider {
  350. margin: 0 !important;
  351. }
  352. }
  353. .flex-box-item {
  354. background: linear-gradient(180deg, #EBFFB4 0%, #FFFFFF 46%, #FFFFFF 100%);
  355. }
  356. .baoyou {
  357. background: url('https://zswl-shop.oss-cn-chengdu.aliyuncs.com/2025/11/771b8a09633448d8b62c0004a8928054.png') no-repeat;
  358. background-size: contain;
  359. }
  360. .linebg {
  361. background: rgba(0, 0, 0, .3);
  362. }
  363. }
  364. </style>