商品弹窗代码修改

This commit is contained in:
2025-12-25 09:29:09 +08:00
parent cf562b28b0
commit f75f90d34f
4 changed files with 27 additions and 17 deletions

View File

@@ -186,6 +186,10 @@
APIminiAppskuinfo,
productRelated
} from '@/common/api/product/product.js';
//价格计算辅助函数
import {
limitUtils
} from 'ysk-utils';
import GoodsPrice from '@/components/goods-price.vue';
import {
computed,
@@ -292,7 +296,7 @@
swiperCurrent.value = e.current;
}
const emits = defineEmits(['prveImgs'])
const emits = defineEmits(['prveImgs', 'websocketsendMessage'])
function prveImgs(images, currentUrl) {
emits('prveImgs', images, currentUrl)
@@ -353,8 +357,8 @@
};
// 提交选择并执行下一步操作的方法
const submitSelection = async () => {
if (!isProductAvailable(props.goods.productListitem.days, props.goods.productListitem.startTime,
props.goods.productListitem.endTime)) {
if (!isProductAvailable(props.goods.days, props.goods.startTime,
props.goods.endTime)) {
uni.showToast({
title: '不在可售时间内'
});
@@ -377,7 +381,7 @@
selectedGroupSnap.value = [];
}
console.log('props.goods', props.goods);
websocketsendMessage({
emits('websocketsendMessage', {
id: res ? res.cartListId : '',
type: 'shopping',
suitNum: props.goods.productListitem.suitNum,
@@ -394,12 +398,13 @@
is_print: 1,
product_type: props.goods.type,
is_time_discount: showLimitDiscount(props.goods)
});
})
// 清空套餐选中
selectedGroupSnap.value = [];
showShopsku.value = false;
} else {
websocketsendMessage({
emits('websocketsendMessage', {
id: res ? res.cartListId : '',
type: 'shopping',
suitNum: props.goods.productListitem.suitNum,
@@ -414,14 +419,21 @@
is_print: 1,
product_type: props.goods.type,
is_time_discount: showLimitDiscount(props.goods)
});
})
showShopsku.value = false;
return;
}
};
function showLimitDiscount(item) {
if (!cartStore.limitTimeDiscount || !cartStore.limitTimeDiscount.id) {
return 0;
}
return limitUtils.canUseLimitTimeDiscount(item, cartStore.limitTimeDiscount, shopInfo, shopUserInfo.value, 'id') ?
1 : 0;
}
// 多规格 套餐 单规格添加数量
const shopCart = async (i) => {