选择商品弹窗修改
This commit is contained in:
@@ -158,17 +158,17 @@
|
||||
<template v-if="isSkuGoods">
|
||||
<view v-if="goods.type == 'package'" class="addShopping"
|
||||
:class="shopCartNumber > 0 && allConditionsSatisfied ? 'active' : ''"
|
||||
@click="submitSelection()">
|
||||
@click="submitSelection(goods)">
|
||||
添加到购物车
|
||||
</view>
|
||||
<view v-else class="addShopping" :class="shopCartNumber > 0 && canSubmit ? 'active' : ''"
|
||||
@click="submitSelection()">
|
||||
@click="submitSelection(goods)">
|
||||
添加到购物车
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="addShopping" :class="shopCartNumber > 0 ? 'active' : ''"
|
||||
@click="submitSelection()">
|
||||
@click="submitSelection(goods)">
|
||||
添加到购物车
|
||||
</view>
|
||||
</template>
|
||||
@@ -356,9 +356,9 @@
|
||||
return isInRange;
|
||||
};
|
||||
// 提交选择并执行下一步操作的方法
|
||||
const submitSelection = async () => {
|
||||
if (!isProductAvailable(props.goods.days, props.goods.startTime,
|
||||
props.goods.endTime)) {
|
||||
const submitSelection = async (goods) => {
|
||||
if (!isProductAvailable(goods.days, goods.startTime,
|
||||
goods.endTime)) {
|
||||
uni.showToast({
|
||||
title: '不在可售时间内'
|
||||
});
|
||||
@@ -369,60 +369,60 @@
|
||||
if (shopCartNumber.value <= 0) {
|
||||
return;
|
||||
}
|
||||
let res = null
|
||||
|
||||
if ((props.goods.type == 'package' && allConditionsSatisfied.value) || (props.goods.type ==
|
||||
|
||||
if ((goods.type == 'package' && allConditionsSatisfied.value) || (goods.type ==
|
||||
'sku' && canSubmit.value)) {
|
||||
let res = cartStore.carts.find(cart => cart.product_id == goods.id && cart.sku_id == selSku.value.id)
|
||||
// 是否是套餐 有就传
|
||||
if (props.goods.type == 'package') {
|
||||
if (goods.type == 'package') {
|
||||
// 需求更改:所所有商品套餐都是add,没有修改
|
||||
res = null;
|
||||
} else {
|
||||
selectedGroupSnap.value = [];
|
||||
}
|
||||
console.log('props.goods', props.goods);
|
||||
console.log('goods', goods);
|
||||
emits('websocketsendMessage', {
|
||||
id: res ? res.cartListId : '',
|
||||
type: 'shopping',
|
||||
suitNum: props.goods.productListitem.suitNum,
|
||||
suitNum: selSku.value.suitNum,
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
shop_id: uni.cache.get('shopId'),
|
||||
operate_type: res ? 'edit' : 'add',
|
||||
product_id: props.goods.product_id,
|
||||
sku_id: props.goods.sku_id,
|
||||
product_id: goods.id,
|
||||
sku_id: selSku.value.id,
|
||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
||||
shopCartNumber.value,
|
||||
pro_group_info: selectedGroupSnap.value,
|
||||
goods_type: props.goods.type == 'package' ? 'package' : '',
|
||||
memberPrice: props.goods.memberPrice,
|
||||
goods_type: goods.type == 'package' ? 'package' : '',
|
||||
memberPrice: goods.memberPrice,
|
||||
is_print: 1,
|
||||
product_type: props.goods.type,
|
||||
is_time_discount: showLimitDiscount(props.goods)
|
||||
product_type: goods.type,
|
||||
is_time_discount: showLimitDiscount(goods)
|
||||
})
|
||||
// 清空套餐选中
|
||||
selectedGroupSnap.value = [];
|
||||
showShopsku.value = false;
|
||||
} else {
|
||||
|
||||
let res = cartStore.carts.find(cart => cart.product_id == goods.id && goods.skuList[0].id)
|
||||
emits('websocketsendMessage', {
|
||||
id: res ? res.cartListId : '',
|
||||
type: 'shopping',
|
||||
suitNum: props.goods.productListitem.suitNum,
|
||||
suitNum: goods.suitNum,
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
shop_id: uni.cache.get('shopId'),
|
||||
operate_type: res ? 'edit' : 'add',
|
||||
product_id: props.goods.product_id,
|
||||
sku_id: props.goods.sku_id,
|
||||
product_id: goods.id,
|
||||
sku_id: goods.skuList[0].id,
|
||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
||||
shopCartNumber.value,
|
||||
memberPrice: props.goods.memberPrice,
|
||||
memberPrice: goods.memberPrice,
|
||||
is_print: 1,
|
||||
product_type: props.goods.type,
|
||||
is_time_discount: showLimitDiscount(props.goods)
|
||||
product_type: goods.type,
|
||||
is_time_discount: showLimitDiscount(goods)
|
||||
})
|
||||
|
||||
showShopsku.value = false;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -571,7 +571,7 @@
|
||||
<Loading :isLoading="!useSocket.isConnected" />
|
||||
<ModalList></ModalList>
|
||||
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
||||
<goodsModal v-model="showGoodsModal" :goods="specifications.item" @prveImgs="prveImgs"></goodsModal>
|
||||
<goodsModal v-model="showGoodsModal" :goods="specifications.item" @prveImgs="prveImgs" @websocketsendMessage="websocketsendMessage"></goodsModal>
|
||||
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="updateShowPrveImg">
|
||||
</xbSwiperPreview>
|
||||
<!-- 显示选择人数popup -->
|
||||
|
||||
Reference in New Issue
Block a user