Forráskód Böngészése

fix: 商品详情页轮播图指示器位置调整;商品详情页添加商品到购物车时触发购物车刷新;首页商品刷新逻辑修改;

ext.zhangbin71 1 hónapja
szülő
commit
d3622361f4

+ 1 - 0
config/app.js

@@ -53,6 +53,7 @@ export const WHITELIST = [
   "/pages/users/VIP/VIP",
   "/pages/order_addcart/order_addcart",
   "/pages/mall/dapan",
+  // "/pages/merchantCenters/merchant",
 ];
 
 // oss对象存储地址

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2217 - 2168
pages/goods/goods_details/index.vue


+ 2 - 3
pages/index/index.vue

@@ -330,10 +330,9 @@
 				return; // 登录后页面会刷新,避免继续执行
 			}
 		} else if (appStore?.userInfo?.lastVisitedMerchantId) {
-			if (merchantId.value != appStore?.userInfo?.lastVisitedMerchantId) {
+			console.log(merchantId.value,appStore?.userInfo?.lastVisitedMerchantId)
+			if(appStore.indexRefreshFlag || merchantId.value != appStore?.userInfo?.lastVisitedMerchantId){
 				merchantId.value = appStore?.userInfo?.lastVisitedMerchantId;
-			}
-			if(appStore.indexRefreshFlag){
 				appStore.setIndexRefersh(false)
 				initPageData();
 			}

+ 2 - 2
pages/merchantCenters/components/merchant_cate.vue

@@ -172,7 +172,7 @@ defineExpose({
 
 <style scoped lang="scss">
 .productSort{
-  padding-right: 30rpx;
+  // padding-right: 30rpx;
 }
 .productSort .aside {
   position: absolute;
@@ -203,7 +203,7 @@ defineExpose({
 }
 
 .productSort .conter {
-  margin: 0rpx 0 0 200rpx;
+  margin: 0rpx 0 0 180rpx;
   padding: 0 14rpx;
   background-color: #fff;
   border-radius: 16rpx;

+ 22 - 18
pages/merchantCenters/merchant.vue

@@ -3,7 +3,7 @@
 <template>
   <view class="container">
 <!--    商家信息-->
-    <view class="padding20">
+    <view class="merchant-info">
       <view class="store-card">
         <view class="info-top">
           <view class="left">
@@ -40,7 +40,7 @@
               transform: 'scale(1)'
         }"></up-tabs>
       <!--    商品列表-->
-    <view class="index-product-wrapper padding30" v-if="tabActive == '0'">
+    <view class="index-product-wrapper" v-if="tabActive == '0'">
       <view
           class="list-box animated"
           :class="goodsList.length > 0 ? 'fadeIn on' : ''"
@@ -62,16 +62,16 @@
             <view class="bottom-row">
               <!-- <text class="price">工费: {{ item.price }}/克</text> -->
               <text class="price">¥ {{ item.totalPrice }}</text>
-              <text class="sales">
+              <text class="sales" style="color:#666;">
                 销量:{{ Number(item.sales || 0) + Number(item.ficti || 0) }}件
               </text>
               <!-- <view class="txt">券</view> -->
             </view>
             <view class="bottom-row">
               <!-- <text class="price">工费: {{ item.price }}/克</text> -->
-              <text class="sales">工费{{ item.totalLaborCost }}</text>
+              <text class="sales">工费:¥{{ item.totalLaborCost }}</text>
               <text class="sales">
-                附加费{{ item.additionalAmount }}
+                附加费:¥{{ item.additionalAmount }}
               </text>
               <!-- <view class="txt">券</view> -->
             </view>
@@ -177,12 +177,14 @@ const getSbmerchantInfoFn = async () => {
   }
   let obj ={
     merchantId:query.value.merchantId,
-    userId:appStore.userInfo.userId
+    userId:appStore?.userInfo?.userId
+  }
+  if(appStore?.userInfo?.userId){
+	  await footprintScan(obj)
+	  appStore.USERINFO();
   }
-  await footprintScan(obj)
-  appStore.USERINFO();
   // 当浏览的店铺主页不是上次浏览店铺时,才改变状态
-  if(query.value.merchantId != appStore.userInfo.lastVisitedMerchantId){
+  if(query.value.merchantId != appStore?.userInfo?.lastVisitedMerchantId){
 	  appStore.setIndexRefersh(true)
   }
   getSbmerchantInfo(data).then((res) => {
@@ -267,11 +269,13 @@ const goDetail = async (item) => {
   //padding: 30rpx;
   //box-sizing: border-box;
 }
+.merchant-info{
+	padding: 16rpx 16rpx 0;
+}
 .store-card{
   background: #ffffff;
   border-radius: 16rpx;
   padding: 20rpx;
-  margin-bottom: 10rpx;
 
   .info-top{
     display: flex;
@@ -325,10 +329,10 @@ const goDetail = async (item) => {
   float: right;
 }
 .index-product-wrapper {
-  //padding: 0 30rpx;
+  padding: 0 16rpx 16rpx;
   margin-bottom: 110rpx;
   min-height: 700rpx;
-  margin-top: 30rpx;
+  margin-top: 16rpx;
   //background: #fff;
   position: relative;
 
@@ -343,11 +347,11 @@ const goDetail = async (item) => {
 
     .item {
       width: 48.99%;
-      height: 490rpx;
+      // height: 490rpx;
       background-color: #ffffff;
-      box-shadow: 0rpx 3rpx 13rpx 0rpx rgba(0, 0, 0, 0.13);
-      border-radius: 20rpx;
-      margin-bottom: 20rpx;
+      // box-shadow: 0rpx 3rpx 13rpx 0rpx rgba(0, 0, 0, 0.13);
+      border-radius: 16rpx;
+      margin-bottom: 16rpx;
 
       overflow: hidden;
       display: flex;
@@ -364,10 +368,10 @@ const goDetail = async (item) => {
       }
 
       .text-info {
-        padding: 10rpx 20rpx 15rpx;
+        padding: 16rpx 8rpx;
 
         .title {
-          color: #222222;
+          color: #333;
           display: flex;
           align-items: center;
           justify-items: space-between;

+ 30 - 18
pages/order_addcart/order_addcart.vue

@@ -455,28 +455,39 @@ onLoad((options) => {
 onShow(() => {
   // 隐藏原生 tabBar
   uni.hideTabBar();
+  if(appStore.cartRefreshFlag){
+	  refresh();
+	  appStore.SET_CART_REFRESH(false)
+  }
 });
 onPullDownRefresh(async () => {
-  canShow.value = false;
-  if (isLogin.value) {
-    // 重置所有状态
-    resetAllState();
-    Promise.allSettled([
-      getCartListFn(),
-      getInvalidList(),
-      getHostProduct()
-    ]).finally(() => {
-      // 添加一个短暂延迟,确保 DOM 更新完成
-      setTimeout(() => {
-        canShow.value = true;
-        uni.stopPullDownRefresh();
-        uni.hideLoading();
-      }, 50);
-    });
-  }
-
+  refresh()
 })
 
+const refresh = ()=>{
+	canShow.value = false;
+	if (isLogin.value) {
+	  // 重置所有状态
+	  resetAllState();
+	  Promise.allSettled([
+	    getCartListFn(),
+	    getInvalidList(),
+	    getHostProduct()
+	  ]).finally(() => {
+	    // 添加一个短暂延迟,确保 DOM 更新完成
+	    setTimeout(() => {
+	      canShow.value = true;
+		  try {
+		  	uni.stopPullDownRefresh();
+		  } catch (error) {
+		  	//TODO handle the exception
+		  }
+	      uni.hideLoading();
+	    }, 50);
+	  });
+	}
+}
+
 function resetAllState() {
   footerswitch.value = true;
   goodsHidden.value = false;
@@ -1425,6 +1436,7 @@ const toMerchant = (obj) => {
             display: flex;
             justify-content: space-between;
             .attribute-suk {
+				font-weight: normal;
             }
             .invalid-count {
               text-align: right;

+ 1 - 0
pages/users/login/index.vue

@@ -500,6 +500,7 @@
 	}
 	const getPhoneNumberFn = async (e) => {
 		// Toast({ title: "登录中..." });
+		appStore.setIndexRefersh(true)
 		if (!aloneChecked.value) {
 			return Toast({
 				title: "请阅读并同意用户协议和隐私政策",

+ 4 - 0
static/css/base.css

@@ -488,4 +488,8 @@ checkbox .uni-checkbox-input.uni-checkbox-input-checked::before {
 
 .product-con .uni-swiper-dots-horizontal{
   bottom: 42rpx;
+}
+
+.product-con .u-swiper__indicator{
+	bottom: 42rpx !important;
 }

+ 4 - 0
stores/app.js

@@ -46,6 +46,7 @@ export const useAppStore = defineStore("app", {
       merchantId: null,
 	  // 首页展示刷新标识,当浏览了新店铺主页/扫店铺码时,改为true,首页onshow时判断true刷新列表并改为false
 	  indexRefreshFlag: false,
+	  cartRefreshFlag: false,
     };
   },
   getters: {
@@ -66,6 +67,9 @@ export const useAppStore = defineStore("app", {
     SET_REFRESH(val) {
       this.refreshArticles = val;
     },
+    SET_CART_REFRESH(val) {
+      this.cartRefreshFlag = val;
+    },
     setIndexRefersh(val) {
       this.indexRefreshFlag = val;
     },