wangfukang 21 hours ago
parent
commit
b291872b13
  1. 200
      package2/group/groupBuySingle.vue

200
package2/group/groupBuySingle.vue

@ -460,30 +460,14 @@
</view>
</view>
</template>
<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 class="spec11 popup-more-buy-title" v-if="moreBuyList.length > 0 && isPintuan">
搭配小食
</view>
<view class="goods-team popup-more-buy-goods" v-if="moreBuyList.length > 0 && isPintuan">
<view :class="spec.isChecked ? 'team-check1' : 'team2'" v-for="(spec, sIndex) in moreBuyList"
:key="sIndex" @tap="selectMoreBuy(spec,sIndex)">
<scroll-view scroll-x class="popup-more-buy-goods" :show-scrollbar="false"
v-if="moreBuyList.length > 0 && isPintuan">
<view class="popup-more-buy-list">
<view :class="spec.quantity > 0 ? 'team-check1' : 'team2'" v-for="(spec, sIndex) in moreBuyList"
:key="sIndex">
<view>
<img :src="spec.productPicture" alt=""
style="width: 112rpx;height: 112rpx;background-size: 100%;border-radius: 10px;">
@ -494,11 +478,16 @@
<view class="team11" style="margin-top:10rpx;">
{{spec.productName}}
</view>
<view class="jiaobiao" v-if="spec.quantity>0">
{{spec.quantity ? spec.quantity : ''}}
<view class="more-buy-stepper">
<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>
</scroll-view>
<view class="popup-bottom-placeholder"></view>
</scroll-view>
<view class="bottom popup-bottom-bar" style="padding-bottom: 24rpx;height: 132rpx;z-index: 10;">
@ -622,30 +611,13 @@
</view>
</view>
<view class="box1 pay-more-buy-card" v-if="showPayPopupMoreBuy">
<view class="spec11 pay-more-buy-title" 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 class="spec11 pay-more-buy-title">
搭配小食
</view>
<scroll-view scroll-x class="pay-more-buy-scroll">
<view class="pay-more-buy-list">
<view :class="spec.isChecked ? 'team-check1 pay-more-buy-item' : 'team2 pay-more-buy-item'"
v-for="(spec, sIndex) in moreBuyList" :key="sIndex"
@tap="selectMoreBuy(spec,sIndex)">
<view :class="spec.quantity > 0 ? 'team-check1 pay-more-buy-item' : 'team2 pay-more-buy-item'"
v-for="(spec, sIndex) in moreBuyList" :key="sIndex">
<view>
<img :src="spec.productPicture" alt=""
style="width: 112rpx;height: 112rpx;background-size: 100%;border-radius: 10px;">
@ -656,8 +628,12 @@
<view class="team11" style="margin-top:10rpx;">
{{spec.productName}}
</view>
<view class="jiaobiao" v-if="spec.quantity>0">
{{spec.quantity ? spec.quantity : ''}}
<view class="more-buy-stepper">
<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>
@ -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 {

Loading…
Cancel
Save