index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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-jiayou.png`, title: '加油', name: 'refueling-tabbar', show: true }, // refueling-tabbar
  61. { icon: `${StaticUrl}/smqjh-attractions.png`, title: '景区', name: '', show: !isOnlineAudit.value },
  62. { icon: `${StaticUrl}/smqjh-diancan.png`, title: '大牌点餐', name: '', show: !isOnlineAudit.value },
  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. router.push({ name: 'bannerDetaile' })
  114. }
  115. function handleChangeSwiper(e: UniHelper.SwiperOnChangeEvent) {
  116. console.log(e.detail.current, 'e.detail.current')
  117. currentIndex.value = e.detail.current
  118. }
  119. function handleJyBanner() {
  120. wx.openOfficialAccountArticle({
  121. url: 'https://mp.weixin.qq.com/s/lxpdZ6DUhgqg00AT9klu5Q',
  122. })
  123. }
  124. </script>
  125. <template>
  126. <view class="page-class box-border">
  127. <wd-navbar
  128. title="" :custom-style="`background-color: rgba(158,214,5,${opcity});`" :bordered="false" :z-index="99"
  129. safe-area-inset-top fixed
  130. >
  131. <template #left>
  132. <view class="relative z-10 h-48rpx w-202rpx w-full opacity-100">
  133. <image class="absolute left-0 top-0 h-48rpx w-202rpx" :src="`${StaticUrl}/logo.png`" />
  134. </view>
  135. </template>
  136. </wd-navbar>
  137. <view
  138. class="header-linear h-320rpx px-24rpx"
  139. :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }"
  140. >
  141. <view class="box-border flex items-center">
  142. <view class="flex items-center" @click="useAddressStore().getMapAddress()">
  143. <image :src="`${StaticUrl}/location-black.png`" class="h-33.8rpx min-w-28.97rpx w-28.97rpx" />
  144. <view class="ml-18rpx max-w-180rpx truncate text-32rpx">
  145. {{ name }}
  146. </view>
  147. </view>
  148. <view class="ml-16rpx h-60rpx w-502rpx flex items-center justify-between rounded-40rpx bg-white pr-6rpx">
  149. <view class="flex items-center pb-14rpx pl-24rpx pt-16rpx">
  150. <wd-icon name="search" size="14" color="#ccc" />
  151. <view class="ml-12rpx text-24rpx text-gray">
  152. 霸王茶姬
  153. </view>
  154. </view>
  155. <view
  156. class="h-50rpx w-96rpx flex items-center justify-center rounded-26rpx bg-[var(--them-color)] text-24rpx text-white font-semibold"
  157. >
  158. 搜索
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. <view class="px-24rpx -mt260rpx">
  164. <view class="mt-24rpx rounded-16rpx bg-white py-24rpx" :class="[loading ? 'px-24rpx' : '']">
  165. <wd-skeleton
  166. :loading="loading"
  167. theme="image" :row-col="[
  168. [
  169. { width: '120rpx', height: '120rpx' },
  170. { width: '120rpx', height: '120rpx' },
  171. { width: '120rpx', height: '120rpx' },
  172. { width: '120rpx', height: '120rpx' },
  173. ],
  174. [
  175. { width: '120rpx', height: '120rpx' },
  176. { width: '120rpx', height: '120rpx' },
  177. { width: '120rpx', height: '120rpx' },
  178. { width: '120rpx', height: '120rpx' },
  179. ],
  180. ]"
  181. >
  182. <swiper :duration="300" class="h340rpx" @change="handleChangeSwiper">
  183. <swiper-item
  184. v-for="pageIndex in Math.ceil(navList.filter(i => i.show).length / 8)" :key="pageIndex"
  185. >
  186. <view class="grid grid-cols-4 gap-12rpx">
  187. <template
  188. v-for="item in navList.filter(i => i.show).slice((pageIndex - 1) * 8, pageIndex * 8)"
  189. :key="item.icon"
  190. >
  191. <view
  192. class="flex flex-col items-center justify-center"
  193. @click="handleClick(String(item.name))"
  194. >
  195. <view class="relative h-120rpx w-120rpx">
  196. <image :src="item.icon" class="h-120rpx w-120rpx" />
  197. <view
  198. v-if="item.name == ''"
  199. class="linebg absolute left-0 top-0 h-full w-full flex items-center justify-center rounded-32rpx text-24rpx text-white font-semibold"
  200. >
  201. 敬请期待
  202. </view>
  203. </view>
  204. <view class="text-24rpx">
  205. {{ item.title }}
  206. </view>
  207. </view>
  208. </template>
  209. </view>
  210. </swiper-item>
  211. </swiper>
  212. <view class="w-full flex items-center justify-center">
  213. <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']" />
  214. </view>
  215. </wd-skeleton>
  216. </view>
  217. <view class="mt-20rpx w-full flex items-center justify-between">
  218. <image :src="`${StaticUrl}/smqjh-jy-banner.jpg`" class="h-346rpx w-344rpx flex-shrink-0 rounded-12rpx" @click="handleJyBanner" />
  219. <view class="flex flex-1 flex-col items-end justify-center" @click="handleGo">
  220. <image :src="`${StaticUrl}/smqjh-home-banner1.jpg`" class="h-180rpx w-344rpx rounded-12rpx" />
  221. <image :src="`${StaticUrl}/smqjh-home-banner2.jpg`" class="mt-14rpx h-152rpx w-344rpx rounded-12rpx" />
  222. </view>
  223. </view>
  224. <view class="mt-20rpx">
  225. <wd-skeleton
  226. theme="image" animation="gradient" :loading="loading"
  227. :row-col="[[{ height: '568rpx', width: '344rpx' }, { height: '568rpx', width: '344rpx' }], [{ height: '568rpx', width: '344rpx' }, { height: '568rpx', width: '344rpx' }]]"
  228. >
  229. <view class="flex items-center">
  230. <scroll-view scroll-y type="custom">
  231. <grid-view type="masonry" cross-axis-count="2" main-axis-gap="10" cross-axis-gap="10">
  232. <view
  233. v-for="item in goodsList" :key="item.id"
  234. class="relative overflow-hidden rounded-16rpx bg-white pb-16rpx"
  235. >
  236. <view @click="router.push({ name: 'xsb-goods', params: { id: item.prodId } })">
  237. <view class="relative h-344rpx">
  238. <image :src="item.pic" class="h-344rpx w-344rpx" />
  239. <image
  240. :src="`${StaticUrl}/xsb-shui-index.png`"
  241. class="absolute left-0 top-0 h-344rpx w-344rpx"
  242. />
  243. <view class="absolute bottom-0 left-0 flex items-center text-22rpx">
  244. <view class="rounded-tl-8rpx bg-[#02ECFD] pl-4rpx">
  245. 星闪豹
  246. </view>
  247. <!-- <view class="rounded-tr-8rpx bg-[rgba(0,0,0,0.5)] pl8rpx pr4rpx text-white">
  248. 峰10:00-13:00
  249. </view> -->
  250. </view>
  251. </view>
  252. <view class="mt-16rpx pl-20rpx pr-6rpx">
  253. <view class="flex items-center">
  254. <!-- <view class="rounded-8rpx bg-#FF4D3A px12rpx text-24rpx text-white">
  255. 补贴
  256. </view> -->
  257. <view class="line-clamp-2 text-28rpx font-semibold">
  258. {{ item.prodName }}
  259. </view>
  260. </view>
  261. <view class="mt-20rpx flex items-end text-[#FF4D3A]">
  262. <view class="text-24rpx">
  263. </view>
  264. <view class="text-36rpx line-height-[36rpx]">
  265. {{ item.channelProdPrice }}
  266. </view>
  267. <view class="text-24rpx">
  268. </view>
  269. </view>
  270. </view>
  271. </view>
  272. <view
  273. v-if="!item.spuStock"
  274. class="absolute left-0 top-0 z-1 h-full w-full flex items-center justify-center bg-[rgba(255,255,255,0.6)]"
  275. >
  276. <view
  277. class="h-156rpx w-156rpx flex items-center justify-center rounded-full bg-[rgba(0,0,0,.6)] text-28rpx text-white"
  278. >
  279. 商品已售罄
  280. </view>
  281. </view>
  282. <view
  283. v-if="!item.skuList.some((it) => it.saleStatus)"
  284. class="absolute left-0 top-0 z-1 h-full w-full flex items-center justify-center bg-[rgba(255,255,255,0.6)]"
  285. >
  286. <view
  287. class="h-156rpx w-156rpx flex items-center justify-center rounded-full bg-[rgba(0,0,0,.6)] text-28rpx text-white"
  288. >
  289. 商品不可售
  290. </view>
  291. </view>
  292. </view>
  293. </grid-view>
  294. </scroll-view>
  295. </view>
  296. </wd-skeleton>
  297. <wd-loadmore v-if="goodsList.length > 9" :state="state" :loading-props="{ color: '#9ED605', size: 20 }" @reload="reload" />
  298. <wd-overlay :show="showoverlay" @click="showoverlay = false">
  299. <view class="mt-280rpx flex items-center justify-center">
  300. <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' }">
  301. <view>
  302. <view class="text-80rpx text-#FF1B51 font-600">
  303. ¥200
  304. </view>
  305. <view class="text-28rpx font-800">
  306. 现金抵扣券
  307. </view>
  308. </view>
  309. <view class="absolute bottom-110rpx left-42% text-60rpx text-#FF1B51 font-bold" @click="getZhUserReceived">
  310. </view>
  311. </view>
  312. </view>
  313. </wd-overlay>
  314. </view>
  315. </view>
  316. </view>
  317. </template>
  318. <style scoped lang="scss">
  319. .page-class {
  320. :deep() {
  321. .wd-divider {
  322. margin: 0 !important;
  323. }
  324. }
  325. .flex-box-item {
  326. background: linear-gradient(180deg, #EBFFB4 0%, #FFFFFF 46%, #FFFFFF 100%);
  327. }
  328. .baoyou {
  329. background: url('https://zswl-shop.oss-cn-chengdu.aliyuncs.com/2025/11/771b8a09633448d8b62c0004a8928054.png') no-repeat;
  330. background-size: contain;
  331. }
  332. .linebg {
  333. background: rgba(0, 0, 0, .3);
  334. }
  335. }
  336. </style>