商品弹窗修改

This commit is contained in:
2025-12-24 18:11:57 +08:00
parent 33453ab961
commit cf562b28b0

View File

@@ -1,11 +1,11 @@
<template>
<up-popup :show="visible" :round="20" mode="bottom" @close="close" :close-on-click-overlay="true">
<view class="shop_sku">
<view class="positionabsolute">
<up-icon name="arrow-down" @click="close" color="#333" size="22"></up-icon>
</view>
<scroll-view scroll-y style="max-height: 60vh; width: 100%">
<scroll-view scroll-y style="max-height: 60vh; width: 100%">
<view class="positionabsolute">
<up-icon name="arrow-down" @click="close" color="#333" size="22"></up-icon>
</view>
<up-swiper :list="goods.images" @change="swiperChange" :current="swiperCurrent" radius="6px"
height="250" @click="prveImgs(goods.images, goods.images[swiperCurrent])">
</up-swiper>
@@ -159,17 +159,17 @@
<view v-if="goods.type == 'package'" class="addShopping"
:class="shopCartNumber > 0 && allConditionsSatisfied ? 'active' : ''"
@click="submitSelection()">
{{ skuBtnText }}
添加到购物车
</view>
<view v-else class="addShopping" :class="shopCartNumber > 0 && canSubmit ? 'active' : ''"
@click="submitSelection()">
{{ skuBtnText }}
添加到购物车
</view>
</template>
<template v-else>
<view class="addShopping" :class="shopCartNumber > 0 ? 'active' : ''"
@click="submitSelection()">
{{ skuBtnText }}
添加到购物车
</view>
</template>
</template>
@@ -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++;