소스 검색

feat(pagination): 添加refresh方法支持页面刷新功能

添加refresh方法到usePagination hook,用于页面显示时刷新数据,
替代原有的reload方法以提供更准确的语义。

fix(order): 订单列表切换时清空数据避免显示残留

在订单页面切换类型或状态时,清空orderList数据以避免
显示之前的订单信息,确保数据的准确性。

fix(cart): 商品跳转使用prodId而非skuId

修复商品详情页跳转逻辑,将路由参数从skuId改为prodId,
确保正确的商品页面访问。

feat(classfiy): 商品数量更新优化

在分类组件的商品数量调整操作后调用setProductNum方法,
确保商品数量显示的实时更新。

fix(index): 轮播图组件移除不必要的autoplay属性

移除首页轮播图组件的autoplay="false"属性,简化组件配置。

feat(commonTab): 优化页面切换和数据刷新逻辑

使用refresh方法替代reload方法处理页面显示,
添加页面容器和切换逻辑优化用户体验。

fix(goods): 商品权限提示信息优化

将商品权限提示信息从"该商品没有价格权限!"改为
"暂无该商品查看权限!",提供更友好的用户提示。

style(order): 订单导航栏样式调整

调整订单页面导航栏高度和布局样式,优化视觉效果和
用户体验。

fix(search): 搜索结果商品跳转使用正确ID

修复搜索结果商品点击跳转逻辑,使用prodId而非skuId
确保正确的商品详情页访问。

chore(store): 添加距离计算日志用于调试

在系统店铺距离计算逻辑中添加console.log,
便于开发调试和问题排查。
zhangtao 1 주 전
부모
커밋
a54cd2bb4a

+ 2 - 2
src/pages/index/index.vue

@@ -21,7 +21,7 @@ const { statusBarHeight, MenuButtonHeight, opcity } = storeToRefs(useSysStore())
 const { name } = storeToRefs(addressStore)
 const { userInfo } = storeToRefs(useUserStore())
 const { getTotalNum } = storeToRefs(useSmqjhCartStore())
-const { data: goodsList, isLastPage, page, reload, error, loading } = usePagination((pageNum, pageSize) =>
+const { data: goodsList, isLastPage, page, reload, error, loading, refresh } = usePagination((pageNum, pageSize) =>
   Apis.xsb.getSearchProductList({ data: { pageNum, pageSize, salesNum: 'DESC', shopId: 1, channelId: userInfo.value.channelId || 1 } }), {
   data: resp => resp.data?.list,
   initialData: [],
@@ -37,7 +37,7 @@ const state = computed(() => {
 onShow(() => {
   useSmqjhCartStore().getCartList('XSB')
   useTabbar().setTabbarItem('smqjh-cart', getTotalNum.value)
-  reload()
+  refresh()
 })
 onReachBottom(() => {
   if (!isLastPage.value) {

+ 2 - 0
src/subPack-smqjh/order/index.vue

@@ -40,6 +40,7 @@ onMounted(async () => {
 function handleChangeTypeNav(value: number) {
   navActiveTab.value = value
   scrollViewId.value = null
+  orderList.value = []
   nextTick(() => scrollViewId.value = value)
   reload()
 }
@@ -48,6 +49,7 @@ onShow(() => {
 })
 function handleChangeStatus(value: string) {
   orderStatusActive.value = value
+  orderList.value = []
   reload()
 }
 function handleClick(no: string) {

+ 1 - 1
src/subPack-xsb/commonTab/components/cart.vue

@@ -61,7 +61,7 @@ onMounted(async () => {
                   <image
                     :src="item.pic"
                     class="h206rpx w200rpx flex-shrink-0"
-                    @click.stop="router.push({ name: 'xsb-goods', params: { id: String(item.skuId) } })"
+                    @click.stop="router.push({ name: 'xsb-goods', params: { id: String(item.prodId) } })"
                   />
                   <view class="ml20rpx flex-1">
                     <view class="text-left text-28rpx font-semibold">

+ 6 - 2
src/subPack-xsb/commonTab/components/classfiy.vue

@@ -253,6 +253,8 @@ async function handleSub(item: Api.xsbCategoriesCartList) {
         cartPopup.value = false
         await useSmqjhCartStore().addCart(item.skuId, -1, item.shopId, 'XSB')
         await getCartCategorList()
+        setProductNum()
+        totalProduct.value = undefined
       },
     })
   }
@@ -260,12 +262,14 @@ async function handleSub(item: Api.xsbCategoriesCartList) {
     await useSmqjhCartStore().addCart(item.skuId, -1, item.shopId, 'XSB')
     getGoodsPrice()
     await getCartCategorList()
+    setProductNum()
   }
 }
 async function handleAdd(item: Api.xsbCategoriesCartList) {
   await useSmqjhCartStore().addCart(item.skuId, 1, item.shopId, 'XSB')
   getGoodsPrice()
   await getCartCategorList()
+  setProductNum()
 }
 onUnmounted(() => {
   console.log('组件卸载')
@@ -573,7 +577,7 @@ function handlePay() {
               <image
                 :src="item.pic"
                 class="h206rpx w200rpx flex-shrink-0"
-                @click.stop="router.push({ name: 'xsb-goods', params: { id: String(item.skuId) } })"
+                @click.stop="router.push({ name: 'xsb-goods', params: { id: String(item.prodId) } })"
               />
               <view class="ml20rpx flex-1">
                 <view class="text-left text-28rpx font-semibold">
@@ -633,7 +637,7 @@ function handlePay() {
       <template #footer>
         <view class="box-border w-full flex items-center justify-between py20rpx">
           <view class="w-48%">
-            <wd-button hairline plain block @click="selectGoods = false">
+            <wd-button plain hairline block @click="selectGoods = false">
               取消
             </wd-button>
           </view>

+ 1 - 1
src/subPack-xsb/commonTab/components/index.vue

@@ -143,7 +143,7 @@ function handleChangeSwiper(e: UniHelper.SwiperOnChangeEvent) {
       <view class="px24rpx" :class="[recommendText.length ? '-mt180rpx' : '-mt240rpx']">
         <wd-skeleton theme="image" animation="gradient" :loading="loading" :row-col="[{ height: '138px', width: '100%' }]">
           <wd-swiper
-            :autoplay="false" :list="swiperList" :height="138" :indicator="false" value-key="advertImg" @click="handleGo"
+            :list="swiperList" :height="138" :indicator="false" value-key="advertImg" @click="handleGo"
           />
         </wd-skeleton>
         <view class="mt20rpx">

+ 16 - 3
src/subPack-xsb/commonTab/index.vue

@@ -25,7 +25,7 @@ definePage({
 const { opcity, backTop, SelectShopInfo } = storeToRefs(useSysXsbStore())
 const { userInfo } = storeToRefs(useUserStore())
 const commonCategoryData = ref<Api.xsbCategories[]>([])
-const { data: goodsList, isLastPage, page, error, reload } = usePagination((pageNum, pageSize) =>
+const { data: goodsList, isLastPage, page, error, reload, refresh } = usePagination((pageNum, pageSize) =>
   Apis.xsb.getSearchProductList({ data: { pageNum, pageSize, salesNum: 'DESC', shopId: Number(SelectShopInfo.value?.shopId) || 1, channelId: userInfo.value.channelId || 1 } }), {
   data: resp => resp.data?.list,
   initialData: [],
@@ -44,6 +44,7 @@ const tabbarName = ref('xsb-home')
 const swiperList = ref<Api.xsbAdvertInfo[]>([])
 const hotText = ref<Api.xsbSearchTerm[]>([])
 const recommendText = ref<Api.xsbSearchTerm[]>([])
+const isShow = ref(true)
 function handleTabbarChange({ value }: { value: string }) {
   setTabbarItemActive(value)
   tabbarName.value = value
@@ -91,11 +92,11 @@ onMounted(async () => {
   // reload()
   getCategories()
 })
-onShow(() => reload())
+onShow(() => refresh())
 
 watch(() => SelectShopInfo.value.shopId, () => {
   getCategories()
-  reload()
+  refresh()
 })
 
 onShareAppMessage(() => {
@@ -124,6 +125,15 @@ function handleChange(name: string) {
   })
   tabbarName.value = name
 }
+function beforeleave() {
+  if (tabbarName.value === 'xsb-classfiy') {
+    isShow.value = false
+    handleChange('xsb-home')
+    nextTick(() => {
+      isShow.value = true
+    })
+  }
+}
 </script>
 
 <template>
@@ -137,6 +147,9 @@ function handleChange(name: string) {
     <cart v-if="tabbarName == 'xsb-cart'" @change-tab="handleChange('xsb-home')" />
     <classfiy v-if="tabbarName == 'xsb-classfiy'" :category-list="commonCategoryData" :hot-text="hotText" />
     <my v-if="tabbarName == 'xsb-my'" />
+    <view v-if="tabbarName == 'xsb-classfiy'">
+      <page-container :show="isShow" :overlay="false" @beforeleave="beforeleave" />
+    </view>
     <wd-tabbar
       v-model="tabbarName" safe-area-inset-bottom placeholder fixed :bordered="false" custom-class="custom-tab"
       :custom-style="`box-shadow:${tabbarName == 'xsb-cart' || tabbarName == 'xsb-classfiy' ? '' : ' 0rpx -6rpx 12rpx 2rpx rgba(0, 0, 0, 0.09)'}`"

+ 1 - 1
src/subPack-xsb/goods/index.vue

@@ -91,7 +91,7 @@ async function getGoodsDetaile() {
   const res = await Apis.xsb.getProductDetail({ data: { id: goodsId.value, shopId: Number(SelectShopInfo.value?.shopId) || 1, channelId: userInfo.value.channelId || 1 } })
   console.log(res, '请求')
   if (!res.data) {
-    useGlobalToast().show('该商品没有价格权限!')
+    useGlobalToast().show('暂无该商品查看权限!')
     return
   }
   goodsInfo.value = res.data

+ 5 - 2
src/subPack-xsb/order/index.vue

@@ -33,10 +33,13 @@ const { data: orderList, refresh, isLastPage, page, reload } = usePagination((pa
 })
 function handleChangeTypeNav(value: number) {
   navActiveTab.value = value
+  console.log(navActiveTab.value, '===============')
+  orderList.value = []
   reload()
 }
 function handleChangeStatus(value: string) {
   orderStatusActive.value = value
+  orderList.value = []
   reload()
 }
 function handleClick(item: Api.xsbOrderList) {
@@ -77,9 +80,9 @@ async function handleSubmitOrder(order: Api.xsbOrderList) {
 <template>
   <view class="page-xsb">
     <view class="nav sticky top-0 z10 bg-white px24rpx py18rpx">
-      <view class="flex items-center">
+      <view class="h80rpx flex items-center">
         <view
-          v-for="item in navTabTypeList" :key="item.value" class="mr64rpx flex flex-col items-center text-32rpx"
+          v-for="item in navTabTypeList" :key="item.value" class="mr64rpx h-full flex flex-col items-center justify-center text-32rpx"
           :class="[navActiveTab == item.value ? 'font-semibold ' : 'text-#AAAAAA']"
           @click="handleChangeTypeNav(item.value)"
         >

+ 1 - 1
src/subPack-xsb/search/index.vue

@@ -150,7 +150,7 @@ function handleSearchText(text: string) {
       </view>
     </view>
     <view v-if="isSearch" class="px24rpx pt20rpx">
-      <view v-for="item in data" :key="item.id" class="mb20rpx box-border flex items-center justify-between rounded-16rpx bg-white p24rpx" @click="router.push({ name: 'xsb-goods', params: { id: String(item.skuList[0].skuId) } })">
+      <view v-for="item in data" :key="item.id" class="mb20rpx box-border flex items-center justify-between rounded-16rpx bg-white p24rpx" @click="router.push({ name: 'xsb-goods', params: { id: String(item.prodId) } })">
         <image
           :src="item.pic"
           class="h200rpx w200rpx flex-shrink-0 rounded-16rpx"

+ 1 - 0
src/subPack-xsb/store-xsb/sys.ts

@@ -67,6 +67,7 @@ export const useSysXsbStore = defineStore('system-xsb', {
                 Number(shop.shopLat),
                 Number(shop.shopLng),
               )
+              console.log(distance, 'distance')
               if (distance < minDistance) {
                 minDistance = distance
                 if (!this.SelectShopInfo.shopId) {