From b291872b130d7276e59ed4564b3d1ca56106ada9 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Thu, 12 Nov 2026 11:38:23 +0800 Subject: [PATCH] 1 --- package2/group/groupBuySingle.vue | 200 +++++++++++++++++------------- 1 file changed, 116 insertions(+), 84 deletions(-) diff --git a/package2/group/groupBuySingle.vue b/package2/group/groupBuySingle.vue index e53d2ce..d4ad36a 100644 --- a/package2/group/groupBuySingle.vue +++ b/package2/group/groupBuySingle.vue @@ -460,30 +460,14 @@ - - - 搭配小食 - - - - - - - - - {{vModelValue}} - - - + - - - - + + 搭配小食 - - + + + @@ -494,11 +478,16 @@ {{spec.productName}} - - {{spec.quantity ? spec.quantity : ''}} + + - + + {{spec.quantity || 0}} + + + - + + @@ -622,30 +611,13 @@ - - - 搭配小食 - - - - - - - - - {{vModelValue}} - - - + - - - + + 搭配小食 - + @@ -656,8 +628,12 @@ {{spec.productName}} - - {{spec.quantity ? spec.quantity : ''}} + + - + + {{spec.quantity || 0}} + + + @@ -2832,40 +2808,50 @@ } return name; }, - changeValue(type) { - let checkedMoreBuy = this.moreBuyList.find(item => item.isChecked && item.id == this.checkMoreBuyIndex); - if (!checkedMoreBuy) { - uni.showToast({ - title: '请先选择搭配小食商品', - icon: 'none' - }); - return; - } + changeMoreBuyQuantity(index, type) { + const item = this.moreBuyList[index]; + if (!item) return; + let quantity = Number(item.quantity) || 0; if (type == 'plus') { - this.vModelValue += 1 - } else { - this.vModelValue = this.vModelValue > 0 ? this.vModelValue -= 1 : 0 + quantity += 1 + } else if (quantity > 0) { + quantity -= 1 + } + this.$set(this.moreBuyList[index], 'quantity', quantity); + this.$set(this.moreBuyList[index], 'isChecked', quantity > 0); + + let dataIndex = -1; + for (let i = 0; i < this.moreBuyData.length; i++) { + if (this.moreBuyData[i].id == item.id) { + dataIndex = i; + break; + } } + if (quantity > 0) { + if (dataIndex === -1) { + this.moreBuyData.push(this.moreBuyList[index]); + } else { + this.moreBuyData[dataIndex].quantity = quantity; + this.moreBuyData[dataIndex].isChecked = true; + } + } else if (dataIndex !== -1) { + this.moreBuyData.splice(dataIndex, 1); + } + let moreBuyPrice = 0 for (let i = 0; i < this.moreBuyList.length; i++) { - if (this.moreBuyList[i].id == this.checkMoreBuyIndex) { - this.moreBuyList[i].quantity = this.vModelValue - } if (this.moreBuyList[i].quantity > 0) { moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this .moreBuyList[i].attributeListPrice))).toFixed(2)) } } - this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice - if (this.selectedCoupon) { - this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); - if (this.selectedGroupRule.groupPriceAndMore <= 0) { - this.selectedGroupRule.groupPriceAndMore = 0.01 - } - } - for (let i = 0; i < this.moreBuyData.length; i++) { - if (this.moreBuyData[i].id == this.checkMoreBuyIndex) { - this.moreBuyData[i].quantity = this.vModelValue + if (this.selectedGroupRule) { + this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice + if (this.selectedCoupon) { + this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); + if (this.selectedGroupRule.groupPriceAndMore <= 0) { + this.selectedGroupRule.groupPriceAndMore = 0.01 + } } } this.$forceUpdate() @@ -5513,7 +5499,7 @@ } .popup-spec-scroll { - max-height: 44vh; + max-height: 52vh; padding: 0 20rpx; box-sizing: border-box; } @@ -5572,25 +5558,71 @@ } .popup-more-buy-goods { - height: 236rpx; - min-height: 236rpx; + width: 100%; + height: 312rpx; + white-space: nowrap; + } + + .popup-more-buy-list { + display: inline-flex; + align-items: flex-start; + vertical-align: top; } .popup-more-buy-goods .team2, .popup-more-buy-goods .team-check1, .pay-more-buy-item { - width: 166rpx; - height: 218rpx; - margin: 18rpx 20rpx 0 0; - padding: 8rpx 8rpx 0; + width: 200rpx; + height: 295rpx; + margin: 8rpx 24rpx 0 0; + padding: 16rpx 14rpx 16rpx; box-sizing: border-box; + float: none; + flex-shrink: 0; + } + + .more-buy-stepper { + display: flex; + align-items: center; + justify-content: center; + gap: 12rpx; + margin-top: 10rpx; + height: 52rpx; + } + + .more-buy-stepper-btn { + width: 48rpx; + height: 48rpx; + border-radius: 10rpx; + background: #999; + color: #fff; + font-size: 34rpx; + font-weight: 700; + line-height: 48rpx; + text-align: center; + } + + .more-buy-stepper-btn.plus { + background: linear-gradient(135deg, #d8ff7a 0%, #8ff5d8 100%); + color: #153a35; + } + + .more-buy-stepper-num { + min-width: 48rpx; + padding: 0 6rpx; + color: #153a35; + font-size: 26rpx; + font-weight: 700; + line-height: 48rpx; + text-align: center; } .popup-more-buy-goods .team11, .pay-more-buy-item .team11 { + height: 30rpx; margin-top: 6rpx !important; - font-size: 22rpx; - line-height: 30rpx; + font-size: 24rpx; + line-height: 36rpx; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -5673,7 +5705,7 @@ } .pay-more-buy-scroll { - height: 236rpx; + height: 312rpx; } .pay-popup-content > .box1 {