瀏覽代碼

Merge branch 'dev_v3' of http://git.dgtis.com/armg/wxapp_shuibei into dev_v3

calm 6 天之前
父節點
當前提交
3079998a2c

+ 1 - 1
pages/goods/goods_details/index.vue

@@ -918,7 +918,7 @@
 				};
 				await postCartAdd(params);
 				Toast({
-					title: "添加购物车成功",
+					title: "添加成功",
 					icon: "success",
 					success: () => getCartCount(true),
 				});

+ 40 - 21
pages/merchantCenters/releaseProduct.vue

@@ -556,7 +556,18 @@
 
 	// 规格更新回调
 	const onUpdateAttr = (data) => {
+    console.log(data)
+    const formattedData = data.map(item => {
+      return {
+        ...item,
+        attrValue: typeof item.attrValue === 'string' ?
+            JSON.parse(item.attrValue) :
+            item.attrValue
+      };
+    });
 		const table = attrFormat(data)
+    console.log(table)
+
 		attr.value = data.concat();
 		attrTable.value = table
 	}
@@ -1373,31 +1384,39 @@
     }
 
     try {
-      // 尝试解析JSON
-      const data = JSON.parse(attr.attrValue);
-      const result = [];
-
-      // 遍历所有属性
-      for (const [key, value] of Object.entries(data)) {
-        if (key === "单规格") {
-          // 如果是单规格,直接返回值
-          return value;
-        } else if (key === "重量" || key === "重量(克)" || key.endsWith("重量")) {
-          // 如果属性名包含"重量",添加单位g
-          result.push(`${key}:${value}g`);
-        } else {
-          // 圈号直接显示
-          result.push(`${key}:${value}`);
-        }
+      let data = attr.attrValue;
+
+      // 如果attrValue是字符串,尝试解析JSON
+      if (typeof data === 'string') {
+        data = JSON.parse(data);
       }
 
-      // 用逗号连接所有属性
-      return result.join(",");
+      // 如果解析后是对象,处理对象格式
+      if (typeof data === 'object' && data !== null) {
+        const result = [];
+
+        // 遍历所有属性
+        for (const [key, value] of Object.entries(data)) {
+          if (key === "单规格") {
+            // 如果是单规格,直接返回值
+            return value;
+          } else {
+            // 其他属性按 key:value 格式显示
+            result.push(`${key}:${value}`);
+          }
+        }
+
+        // 用逗号连接所有属性
+        return result.join(",");
+      } else {
+        // 如果不是对象,返回原始值
+        return typeof attr.attrValue === 'string' ? attr.attrValue : String(attr.attrValue);
+      }
 
     } catch (error) {
-      // 如果不是有效的JSON,返回原始值
-      console.error("解析JSON失败:", error);
-      return attr.attrValue;
+      // 如果解析失败,返回原始值
+      console.log("解析JSON失败,使用原始值:", attr.attrValue, error);
+      return typeof attr.attrValue === 'string' ? attr.attrValue : String(attr.attrValue);
     }
   };
 </script>

+ 36 - 10
pages/order_list/index.vue

@@ -29,6 +29,7 @@
 		onMounted
 	} from "vue";
 	import {
+    onLoad,
 		onShow,
 		onReachBottom
 	} from "@dcloudio/uni-app";
@@ -86,24 +87,30 @@
 
 	const list = ref([{
 			name: '待付款',
-			orderStatus: 0
+			orderStatus: 0,
+      value: 0
 		},
 		{
 			name: '待发货',
-			orderStatus: 1
+			orderStatus: 1,
+      value: 1
 		},
 		{
 			name: '待收货',
-			orderStatus: 2
+			orderStatus: 2,
+      value: 2
 		},
+    {
+      name: '退款/换货',
+      orderStatus: -3,
+      value: 3
+    },
 		{
 			name: '已完成',
-			orderStatus: 4
-		},
-		{
-			name: '退货/退款',
-			orderStatus: -3
+			orderStatus: 4,
+      value: 4
 		},
+
 	]) //头部导航
 
 	// 生命周期
@@ -120,7 +127,6 @@
 	});
 
 	// 页面显示时
-
 	onShow(() => {
 		if (appStore.isLogin) {
 			loadend.value = false;
@@ -132,7 +138,27 @@
 			toLogin();
 		}
 	});
+  onLoad((options) => {
+    if (options.status) {
+      const statusValue = parseInt(options.status);
+
+      // 验证状态是否有效
+      const validStatuses = [0, 1, 2, 4, -3];
+      if (validStatuses.includes(statusValue)) {
+        // 设置状态
+        orderStatus.value = statusValue;
+        // 找到对应的索引
+        const index = list.value.findIndex(item => item.orderStatus === statusValue);
+        if (index !== -1) {
+          oldOrderStatus.value = index;  // 设置索引值
+        }
 
+        console.log("设置订单状态为:", statusValue, "索引为:", index);
+      } else {
+        console.warn("无效的状态参数:", statusValue);
+      }
+    }
+  })
 	// 下拉加载
 	onReachBottom(() => {
 		getOrderListFn();
@@ -226,7 +252,7 @@
 	}
 
 	function statusClick(item) {
-
+    console.log(item)
 		if (item.orderStatus === orderStatus.value) return;
 		
 		orderStatus.value = item.orderStatus;

+ 2 - 2
pages/user/index.vue

@@ -177,7 +177,7 @@
             <image
               :src="item.iconUrl"
               mode="widthFix"
-              :style="{ width: (item.iconSize || '60') + 'rpx' }"
+              :style="{ width: (item.iconSize || '60') + 'rpx',height: (item.iconSize || '60') + 'rpx' }"
             ></image>
           </view>
           <text class="function-name">{{ item.iconName }}</text>
@@ -389,7 +389,7 @@ const orderStatus = ref([
   {
     src: `${HTTP_REQUEST_URL_IMG}setting/tuikuan.png`,
     name: "退款/换货",
-    id: 5,
+    id: -3,
   },
   {
     src: `${HTTP_REQUEST_URL_IMG}setting/yiwancheng.png`,

+ 29 - 1
pages/users/my_merchant/index.vue

@@ -28,7 +28,7 @@
 
       <!-- 二维码区域 -->
       <view class="qrcode-container">
-        <image class="qrcode-img" :src="merchantInfo.merchantCodeUrl" mode="aspectFit"></image>
+        <image class="qrcode-img" :src="merchantInfo.merchantCodeUrl" mode="aspectFit" @click="previewQrCode"></image>
         <view class="qrcode-tip">扫码进入商家店铺</view>
       </view>
 
@@ -132,6 +132,34 @@ const makePhoneCall = () => {
     }
   });
 };
+const previewQrCode = () => {
+  console.log('previewQrCode===')
+  if (!merchantInfo.value.merchantCodeUrl) {
+    uni.showToast({
+      title: '暂无二维码图片',
+      icon: 'none'
+    });
+    return;
+  }
+
+  // 使用uni.previewImage预览图片
+  uni.previewImage({
+    urls: [merchantInfo.value.merchantCodeUrl], // 需要预览的图片链接列表
+    current: 0, // 当前显示图片的索引
+    indicator: 'default', // 图片指示器样式
+    loop: false, // 是否可循环预览
+    success: () => {
+      console.log('图片预览成功');
+    },
+    fail: (err) => {
+      console.log('图片预览失败:', err);
+      uni.showToast({
+        title: '预览失败',
+        icon: 'none'
+      });
+    }
+  });
+};
 </script>
 
 <style scoped lang="scss">