wangfukang 2 days ago
parent
commit
b291872b13
  1. 200
      package2/group/groupBuySingle.vue

200
package2/group/groupBuySingle.vue

@ -460,30 +460,14 @@
</view> </view>
</view> </view>
</template> </template>
<view class="spec11 popup-more-buy-title" v-if="moreBuyList.length > 0 && isPintuan" <view class="spec11 popup-more-buy-title" v-if="moreBuyList.length > 0 && isPintuan">
style="display: flex;"> 搭配小食
<view style="flex: 1;">
搭配小食
</view>
<view style="padding-top: 10rpx;">
<view class="goods-num">
<view class="num-plus" style="background: #999;color: #fff;"
@tap="changeValue('minus')">
-
</view>
<view class="num">
{{vModelValue}}
</view>
<view class="num-plus" @tap="changeValue('plus')">
+
</view>
</view>
</view>
</view> </view>
<view class="goods-team popup-more-buy-goods" v-if="moreBuyList.length > 0 && isPintuan"> <scroll-view scroll-x class="popup-more-buy-goods" :show-scrollbar="false"
<view :class="spec.isChecked ? 'team-check1' : 'team2'" v-for="(spec, sIndex) in moreBuyList" v-if="moreBuyList.length > 0 && isPintuan">
:key="sIndex" @tap="selectMoreBuy(spec,sIndex)"> <view class="popup-more-buy-list">
<view :class="spec.quantity > 0 ? 'team-check1' : 'team2'" v-for="(spec, sIndex) in moreBuyList"
:key="sIndex">
<view> <view>
<img :src="spec.productPicture" alt="" <img :src="spec.productPicture" alt=""
style="width: 112rpx;height: 112rpx;background-size: 100%;border-radius: 10px;"> style="width: 112rpx;height: 112rpx;background-size: 100%;border-radius: 10px;">
@ -494,11 +478,16 @@
<view class="team11" style="margin-top:10rpx;"> <view class="team11" style="margin-top:10rpx;">
{{spec.productName}} {{spec.productName}}
</view> </view>
<view class="jiaobiao" v-if="spec.quantity>0"> <view class="more-buy-stepper">
{{spec.quantity ? spec.quantity : ''}} <view class="more-buy-stepper-btn" @tap.stop="changeMoreBuyQuantity(sIndex, 'minus')">-
</view>
<view class="more-buy-stepper-num">{{spec.quantity || 0}}</view>
<view class="more-buy-stepper-btn plus" @tap.stop="changeMoreBuyQuantity(sIndex, 'plus')">+
</view>
</view> </view>
</view> </view>
</view> </view>
</scroll-view>
<view class="popup-bottom-placeholder"></view> <view class="popup-bottom-placeholder"></view>
</scroll-view> </scroll-view>
<view class="bottom popup-bottom-bar" style="padding-bottom: 24rpx;height: 132rpx;z-index: 10;"> <view class="bottom popup-bottom-bar" style="padding-bottom: 24rpx;height: 132rpx;z-index: 10;">
@ -622,30 +611,13 @@
</view> </view>
</view> </view>
<view class="box1 pay-more-buy-card" v-if="showPayPopupMoreBuy"> <view class="box1 pay-more-buy-card" v-if="showPayPopupMoreBuy">
<view class="spec11 pay-more-buy-title" style="display: flex;"> <view class="spec11 pay-more-buy-title">
<view style="flex: 1;"> 搭配小食
搭配小食
</view>
<view style="padding-top: 10rpx;">
<view class="goods-num">
<view class="num-plus" style="background: #999;color: #fff;"
@tap="changeValue('minus')">
-
</view>
<view class="num">
{{vModelValue}}
</view>
<view class="num-plus" @tap="changeValue('plus')">
+
</view>
</view>
</view>
</view> </view>
<scroll-view scroll-x class="pay-more-buy-scroll"> <scroll-view scroll-x class="pay-more-buy-scroll">
<view class="pay-more-buy-list"> <view class="pay-more-buy-list">
<view :class="spec.isChecked ? 'team-check1 pay-more-buy-item' : 'team2 pay-more-buy-item'" <view :class="spec.quantity > 0 ? 'team-check1 pay-more-buy-item' : 'team2 pay-more-buy-item'"
v-for="(spec, sIndex) in moreBuyList" :key="sIndex" v-for="(spec, sIndex) in moreBuyList" :key="sIndex">
@tap="selectMoreBuy(spec,sIndex)">
<view> <view>
<img :src="spec.productPicture" alt="" <img :src="spec.productPicture" alt=""
style="width: 112rpx;height: 112rpx;background-size: 100%;border-radius: 10px;"> style="width: 112rpx;height: 112rpx;background-size: 100%;border-radius: 10px;">
@ -656,8 +628,12 @@
<view class="team11" style="margin-top:10rpx;"> <view class="team11" style="margin-top:10rpx;">
{{spec.productName}} {{spec.productName}}
</view> </view>
<view class="jiaobiao" v-if="spec.quantity>0"> <view class="more-buy-stepper">
{{spec.quantity ? spec.quantity : ''}} <view class="more-buy-stepper-btn" @tap.stop="changeMoreBuyQuantity(sIndex, 'minus')">-
</view>
<view class="more-buy-stepper-num">{{spec.quantity || 0}}</view>
<view class="more-buy-stepper-btn plus" @tap.stop="changeMoreBuyQuantity(sIndex, 'plus')">+
</view>
</view> </view>
</view> </view>
</view> </view>
@ -2832,40 +2808,50 @@
} }
return name; return name;
}, },
changeValue(type) { changeMoreBuyQuantity(index, type) {
let checkedMoreBuy = this.moreBuyList.find(item => item.isChecked && item.id == this.checkMoreBuyIndex); const item = this.moreBuyList[index];
if (!checkedMoreBuy) { if (!item) return;
uni.showToast({ let quantity = Number(item.quantity) || 0;
title: '请先选择搭配小食商品',
icon: 'none'
});
return;
}
if (type == 'plus') { if (type == 'plus') {
this.vModelValue += 1 quantity += 1
} else { } else if (quantity > 0) {
this.vModelValue = this.vModelValue > 0 ? this.vModelValue -= 1 : 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 let moreBuyPrice = 0
for (let i = 0; i < this.moreBuyList.length; i++) { 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) { if (this.moreBuyList[i].quantity > 0) {
moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this
.moreBuyList[i].attributeListPrice))).toFixed(2)) .moreBuyList[i].attributeListPrice))).toFixed(2))
} }
} }
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice if (this.selectedGroupRule) {
if (this.selectedCoupon) { this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice
this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); if (this.selectedCoupon) {
if (this.selectedGroupRule.groupPriceAndMore <= 0) { this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon);
this.selectedGroupRule.groupPriceAndMore = 0.01 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
} }
} }
this.$forceUpdate() this.$forceUpdate()
@ -5513,7 +5499,7 @@
} }
.popup-spec-scroll { .popup-spec-scroll {
max-height: 44vh; max-height: 52vh;
padding: 0 20rpx; padding: 0 20rpx;
box-sizing: border-box; box-sizing: border-box;
} }
@ -5572,25 +5558,71 @@
} }
.popup-more-buy-goods { .popup-more-buy-goods {
height: 236rpx; width: 100%;
min-height: 236rpx; 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 .team2,
.popup-more-buy-goods .team-check1, .popup-more-buy-goods .team-check1,
.pay-more-buy-item { .pay-more-buy-item {
width: 166rpx; width: 200rpx;
height: 218rpx; height: 295rpx;
margin: 18rpx 20rpx 0 0; margin: 8rpx 24rpx 0 0;
padding: 8rpx 8rpx 0; padding: 16rpx 14rpx 16rpx;
box-sizing: border-box; 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, .popup-more-buy-goods .team11,
.pay-more-buy-item .team11 { .pay-more-buy-item .team11 {
height: 30rpx;
margin-top: 6rpx !important; margin-top: 6rpx !important;
font-size: 22rpx; font-size: 24rpx;
line-height: 30rpx; line-height: 36rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@ -5673,7 +5705,7 @@
} }
.pay-more-buy-scroll { .pay-more-buy-scroll {
height: 236rpx; height: 312rpx;
} }
.pay-popup-content > .box1 { .pay-popup-content > .box1 {

Loading…
Cancel
Save