index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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 currentIndex = ref(0)
  35. const loading = ref(true)
  36. onShow(async () => {
  37. useSysStore().getAudit()
  38. useSmqjhCartStore().getCartList('XSB')
  39. getSelectZhUser()
  40. xsbStore.value = await AsyncImport('@/subPack-xsb/store-xsb/sys')
  41. refresh()
  42. })
  43. onMounted(() => {
  44. setTimeout(() => {
  45. loading.value = false
  46. }, 1000)
  47. })
  48. onReachBottom(() => {
  49. if (!isLastPage.value) {
  50. page.value++
  51. }
  52. })
  53. const navList = computed(() => {
  54. const list = [
  55. { icon: `${StaticUrl}/xsb.png`, title: '星闪豹', name: 'xsb-homeTabbar', show: true },
  56. { icon: `${StaticUrl}/smqjh-index-cd.png`, title: '充电', name: 'charge-index', show: true },
  57. { icon: `${StaticUrl}/smqjh-sp.png`, title: '电影演出', name: 'film-index', show: true },
  58. { icon: `${StaticUrl}/smqjh-vip.png`, title: '视频权益', name: 'video-rights-tabbar', show: !isOnlineAudit.value },
  59. { icon: `${StaticUrl}/smqjh-diancan.png`, title: '大牌点餐', name: '', show: !isOnlineAudit.value },
  60. { icon: `${StaticUrl}/smqjh-jiayou.png`, title: '加油', name: '', show: !isOnlineAudit.value }, // refueling-tabbar
  61. { icon: `${StaticUrl}/smqjh-jiudian.png`, title: '酒店民宿', name: '', show: !isOnlineAudit.value },
  62. { icon: `${StaticUrl}/smqjh-daijia.png`, title: '代驾', name: '', show: !isOnlineAudit.value },
  63. { icon: `${StaticUrl}/smqjh-djk.png`, title: '大健康', name: 'djk-homeTabbar', show: !isOnlineAudit.value },
  64. ]
  65. return list
  66. })
  67. onMounted(() => {
  68. addressStore.getLocation()
  69. opcity.value = 0
  70. })
  71. onPageScroll((e) => {
  72. const calculatedOpacity = e.scrollTop / 100
  73. opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
  74. })
  75. function handleClick(name: string) {
  76. if (!name) {
  77. show({ msg: '敬请期待 !' })
  78. return
  79. }
  80. router.push({ name })
  81. }
  82. onShareAppMessage(() => {
  83. return {
  84. title: '市民请集合',
  85. }
  86. })
  87. const showoverlay = ref(false)
  88. async function getSelectZhUser() {
  89. const res = await Apis.sys.selectZhUser({})
  90. if (res.data.channelId === 54 && !res.data.isClaimed) {
  91. showoverlay.value = true
  92. }
  93. }
  94. async function getZhUserReceived() {
  95. useGlobalLoading().loading({ msg: '领取中...' })
  96. await Apis.sys.zhUserReceived({})
  97. useGlobalLoading().close()
  98. show({ msg: '领取成功 !' })
  99. }
  100. function handleGo() {
  101. show({ msg: '敬请期待 !' })
  102. }
  103. function handleChangeSwiper(e: UniHelper.SwiperOnChangeEvent) {
  104. console.log(e.detail.current, 'e.detail.current')
  105. currentIndex.value = e.detail.current
  106. }
  107. </script>
  108. <template>
  109. <view class="page-class box-border">
  110. <wd-navbar
  111. title="" :custom-style="`background-color: rgba(158,214,5,${opcity});`" :bordered="false" :z-index="99"
  112. safe-area-inset-top fixed
  113. >
  114. <template #left>
  115. <view class="relative z-10 h-48rpx w-202rpx w-full opacity-100">
  116. <image class="absolute left-0 top-0 h-48rpx w-202rpx" :src="`${StaticUrl}/logo.png`" />
  117. </view>
  118. </template>
  119. </wd-navbar>
  120. <view
  121. class="header-linear h-320rpx px-24rpx"
  122. :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }"
  123. >
  124. <view class="box-border flex items-center">
  125. <view class="flex items-center" @click="useAddressStore().getMapAddress()">
  126. <image :src="`${StaticUrl}/location-black.png`" class="h-33.8rpx min-w-28.97rpx w-28.97rpx" />
  127. <view class="ml-18rpx max-w-180rpx truncate text-32rpx">
  128. {{ name }}
  129. </view>
  130. </view>
  131. <view class="ml-16rpx h-60rpx w-502rpx flex items-center justify-between rounded-40rpx bg-white pr-6rpx">
  132. <view class="flex items-center pb-14rpx pl-24rpx pt-16rpx">
  133. <wd-icon name="search" size="14" color="#ccc" />
  134. <view class="ml-12rpx text-24rpx text-gray">
  135. 霸王茶姬
  136. </view>
  137. </view>
  138. <view
  139. class="h-50rpx w-96rpx flex items-center justify-center rounded-26rpx bg-[var(--them-color)] text-24rpx text-white font-semibold"
  140. >
  141. 搜索
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="px-24rpx -mt260rpx">
  147. <view class="mt-24rpx rounded-16rpx bg-white py-24rpx" :class="[loading ? 'px-24rpx' : '']">
  148. <wd-skeleton
  149. :loading="loading"
  150. theme="image" :row-col="[
  151. [
  152. { width: '120rpx', height: '120rpx' },
  153. { width: '120rpx', height: '120rpx' },
  154. { width: '120rpx', height: '120rpx' },
  155. { width: '120rpx', height: '120rpx' },
  156. ],
  157. [
  158. { width: '120rpx', height: '120rpx' },
  159. { width: '120rpx', height: '120rpx' },
  160. { width: '120rpx', height: '120rpx' },
  161. { width: '120rpx', height: '120rpx' },
  162. ],
  163. ]"
  164. >
  165. <swiper :duration="300" class="h340rpx" @change="handleChangeSwiper">
  166. <swiper-item
  167. v-for="pageIndex in Math.ceil(navList.filter(i => i.show).length / 8)" :key="pageIndex"
  168. >
  169. <view class="grid grid-cols-4 gap-12rpx">
  170. <template
  171. v-for="item in navList.filter(i => i.show).slice((pageIndex - 1) * 8, pageIndex * 8)"
  172. :key="item.icon"
  173. >
  174. <view
  175. class="flex flex-col items-center justify-center"
  176. @click="handleClick(String(item.name))"
  177. >
  178. <view class="relative h-120rpx w-120rpx">
  179. <image :src="item.icon" class="h-120rpx w-120rpx" />
  180. <view
  181. v-if="item.name == ''"
  182. class="linebg absolute left-0 top-0 h-full w-full flex items-center justify-center rounded-32rpx text-24rpx text-white font-semibold"
  183. >
  184. 敬请期待
  185. </view>
  186. </view>
  187. <view class="text-24rpx">
  188. {{ item.title }}
  189. </view>
  190. </view>
  191. </template>
  192. </view>
  193. </swiper-item>
  194. </swiper>
  195. <view class="w-full flex items-center justify-center">
  196. <view v-for="_pageIndex, index in Math.ceil(navList.filter(i => i.show).length / 8)" :key="index" class="mr14rpx transition-all transition-duration-400 ease-in" :class="[currentIndex == index ? 'rounded-12rpx w-40rpx h12rpx bg-[var(--them-color)]' : 'w12rpx h12rpx rounded-50% bg-#F0F0F0']" />
  197. </view>
  198. </wd-skeleton>
  199. </view>
  200. <view class="mt-20rpx w-full flex items-center justify-between" @click="handleGo">
  201. <image :src="`${StaticUrl}/smqjh-fl.png`" class="h-346rpx w-344rpx flex-shrink-0" />
  202. <view class="flex flex-1 flex-col items-end justify-center">
  203. <image :src="`${StaticUrl}/smqjh-hot-vip.png`" class="h-180rpx w-344rpx" />
  204. <image :src="`${StaticUrl}/smqjh-cd.png`" class="mt-14rpx h-152rpx w-344rpx" />
  205. </view>
  206. </view>
  207. <view class="mt-20rpx">
  208. <wd-skeleton
  209. theme="image" animation="gradient" :loading="loading"
  210. :row-col="[[{ height: '568rpx', width: '344rpx' }, { height: '568rpx', width: '344rpx' }], [{ height: '568rpx', width: '344rpx' }, { height: '568rpx', width: '344rpx' }]]"
  211. >
  212. <view class="flex items-center">
  213. <scroll-view scroll-y type="custom">
  214. <grid-view type="masonry" cross-axis-count="2" main-axis-gap="10" cross-axis-gap="10">
  215. <view
  216. v-for="item in goodsList" :key="item.id"
  217. class="relative overflow-hidden rounded-16rpx bg-white pb-16rpx"
  218. >
  219. <view @click="router.push({ name: 'xsb-goods', params: { id: item.prodId } })">
  220. <view class="relative h-344rpx">
  221. <image :src="item.pic" class="h-344rpx w-344rpx" />
  222. <image
  223. :src="`${StaticUrl}/xsb-shui-index.png`"
  224. class="absolute left-0 top-0 h-344rpx w-344rpx"
  225. />
  226. <view class="absolute bottom-0 left-0 flex items-center text-22rpx">
  227. <view class="rounded-tl-8rpx bg-[#02ECFD] pl-4rpx">
  228. 星闪豹
  229. </view>
  230. <!-- <view class="rounded-tr-8rpx bg-[rgba(0,0,0,0.5)] pl8rpx pr4rpx text-white">
  231. 峰10:00-13:00
  232. </view> -->
  233. </view>
  234. </view>
  235. <view class="mt-16rpx pl-20rpx pr-6rpx">
  236. <view class="flex items-center">
  237. <!-- <view class="rounded-8rpx bg-#FF4D3A px12rpx text-24rpx text-white">
  238. 补贴
  239. </view> -->
  240. <view class="line-clamp-2 text-28rpx font-semibold">
  241. {{ item.prodName }}
  242. </view>
  243. </view>
  244. <view class="mt-20rpx flex items-end text-[#FF4D3A]">
  245. <view class="text-24rpx">
  246. </view>
  247. <view class="text-36rpx line-height-[36rpx]">
  248. {{ item.channelProdPrice }}
  249. </view>
  250. <view class="text-24rpx">
  251. </view>
  252. </view>
  253. </view>
  254. </view>
  255. <view
  256. v-if="!item.spuStock"
  257. class="absolute left-0 top-0 z-1 h-full w-full flex items-center justify-center bg-[rgba(255,255,255,0.6)]"
  258. >
  259. <view
  260. class="h-156rpx w-156rpx flex items-center justify-center rounded-full bg-[rgba(0,0,0,.6)] text-28rpx text-white"
  261. >
  262. 商品已售罄
  263. </view>
  264. </view>
  265. </view>
  266. </grid-view>
  267. </scroll-view>
  268. </view>
  269. </wd-skeleton>
  270. <wd-loadmore v-if="goodsList.length > 9" :state="state" :loading-props="{ color: '#9ED605', size: 20 }" @reload="reload" />
  271. <wd-overlay :show="showoverlay" @click="showoverlay = false">
  272. <view class="mt-280rpx flex items-center justify-center">
  273. <view class="relative h-906rpx w-644rpx flex flex-col justify-center text-center" :style="{ backgroundImage: `url(${StaticUrl}/home-overlay-img.png)`, backgroundSize: 'cover', backgroundPosition: 'center' }">
  274. <view>
  275. <view class="text-80rpx text-#FF1B51 font-600">
  276. ¥200
  277. </view>
  278. <view class="text-28rpx font-800">
  279. 现金抵扣券
  280. </view>
  281. </view>
  282. <view class="absolute bottom-110rpx left-42% text-60rpx text-#FF1B51 font-bold" @click="getZhUserReceived">
  283. </view>
  284. </view>
  285. </view>
  286. </wd-overlay>
  287. </view>
  288. </view>
  289. </view>
  290. </template>
  291. <style scoped lang="scss">
  292. .page-class {
  293. :deep() {
  294. .wd-divider {
  295. margin: 0 !important;
  296. }
  297. }
  298. .flex-box-item {
  299. background: linear-gradient(180deg, #EBFFB4 0%, #FFFFFF 46%, #FFFFFF 100%);
  300. }
  301. .baoyou {
  302. background: url('https://zswl-shop.oss-cn-chengdu.aliyuncs.com/2025/11/771b8a09633448d8b62c0004a8928054.png') no-repeat;
  303. background-size: contain;
  304. }
  305. .linebg {
  306. background: rgba(0, 0, 0, .3);
  307. }
  308. }
  309. </style>