index.vue 13 KB

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