diff --git a/pages/product/components/goods-modal.vue b/pages/product/components/goods-modal.vue index 6d4f0ef..eff8ad2 100644 --- a/pages/product/components/goods-modal.vue +++ b/pages/product/components/goods-modal.vue @@ -158,17 +158,17 @@ @@ -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; } }; diff --git a/pages/product/index.vue b/pages/product/index.vue index 7898072..0d7e789 100644 --- a/pages/product/index.vue +++ b/pages/product/index.vue @@ -571,7 +571,7 @@ - +