From cf562b28b0890e36096d26c0907c260857b371d4 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 24 Dec 2025 18:11:57 +0800
Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=BC=B9=E7=AA=97=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/product/components/goods-modal.vue | 56 ++++++++++++++----------
1 file changed, 33 insertions(+), 23 deletions(-)
diff --git a/pages/product/components/goods-modal.vue b/pages/product/components/goods-modal.vue
index 30759d3..22417aa 100644
--- a/pages/product/components/goods-modal.vue
+++ b/pages/product/components/goods-modal.vue
@@ -1,11 +1,11 @@
-
-
-
-
+
+
+
+
@@ -159,17 +159,17 @@
- {{ skuBtnText }}
+ 添加到购物车
- {{ skuBtnText }}
+ 添加到购物车
- {{ skuBtnText }}
+ 添加到购物车
@@ -205,7 +205,7 @@
type: Object,
default: () => {
return {
- relatedRecommendJson:[]
+ relatedRecommendJson: []
}
},
},
@@ -275,7 +275,17 @@
function returnFirstSku(product) {
return product.skuList[0]
}
+ //返回是否是多规格商品
+ function returnIsSkuGoods(item) {
+ if (item.type == 'single' || item.type == 'weight' || (item.type == 'package' && item.groupType == '0')) {
+ return false;
+ }
+ return true;
+ }
+ const isSkuGoods = computed(() => {
+ return returnIsSkuGoods(props.goods);
+ });
function swiperChange(e) {
@@ -343,8 +353,8 @@
};
// 提交选择并执行下一步操作的方法
const submitSelection = async () => {
- if (!isProductAvailable(specifications.productListitem.days, specifications.productListitem.startTime,
- specifications.productListitem.endTime)) {
+ if (!isProductAvailable(props.goods.productListitem.days, props.goods.productListitem.startTime,
+ props.goods.productListitem.endTime)) {
uni.showToast({
title: '不在可售时间内'
});
@@ -355,7 +365,7 @@
if (shopCartNumber.value <= 0) {
return;
}
- let res = await shoppingcart();
+ let res = null
if ((props.goods.type == 'package' && allConditionsSatisfied.value) || (props.goods.type ==
'sku' && canSubmit.value)) {
@@ -370,12 +380,12 @@
websocketsendMessage({
id: res ? res.cartListId : '',
type: 'shopping',
- suitNum: specifications.productListitem.suitNum,
+ suitNum: props.goods.productListitem.suitNum,
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: res ? 'edit' : 'add',
- product_id: specifications.product_id,
- sku_id: specifications.sku_id,
+ product_id: props.goods.product_id,
+ sku_id: props.goods.sku_id,
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
shopCartNumber.value,
pro_group_info: selectedGroupSnap.value,
@@ -392,12 +402,12 @@
websocketsendMessage({
id: res ? res.cartListId : '',
type: 'shopping',
- suitNum: specifications.productListitem.suitNum,
+ suitNum: props.goods.productListitem.suitNum,
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: res ? 'edit' : 'add',
- product_id: specifications.product_id,
- sku_id: specifications.sku_id,
+ product_id: props.goods.product_id,
+ sku_id: props.goods.sku_id,
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
shopCartNumber.value,
memberPrice: props.goods.memberPrice,
@@ -410,16 +420,16 @@
return;
}
};
-
-
+
+
+
// 多规格 套餐 单规格添加数量
const shopCart = async (i) => {
if (i == '-' && shopCartNumber.value <= (props.goods.suitNum || 1)) {
shopCartNumber.value = 0;
return false;
}
- let res = await shoppingcart();
-
+ let res = null
if (props.goods.result === 'kong') {
//没有满足可添加或者编辑的规格
return;
@@ -436,10 +446,10 @@
}
} else {
if (!res && shopCartNumber.value < 1) {
- if (specifications.type == 'sku') {
+ if (props.goods.type == 'sku') {
shopCartNumber.value = parseFloat(selSku.value.suitNum);
} else {
- shopCartNumber.value = parseFloat(selSku.value.suitNum);
+ shopCartNumber.value = parseFloat(props.goods.suitNum);
}
} else {
shopCartNumber.value++;