|
|
@ -340,6 +340,22 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
<!-- 优惠券选择 --> |
|
|
|
|
|
<view v-if="isPintuan" style="display: flex;height: 80rpx;line-height: 80rpx;border-top: 1px solid #eee;font-size: 28rpx;font-weight: 700; align-items:center; margin-top: 20rpx;" @tap="openCouponPopup"> |
|
|
|
|
|
<view style="flex: 1; color: #777;"> |
|
|
|
|
|
优惠券 |
|
|
|
|
|
</view> |
|
|
|
|
|
<view style="color: #ff5722;" v-if="selectedCoupon"> |
|
|
|
|
|
-¥{{selectedCoupon.discountAmount.toFixed(2)}} |
|
|
|
|
|
</view> |
|
|
|
|
|
<view style="color: #0b9b73;" v-else-if="availableCoupons.length > 0"> |
|
|
|
|
|
有 {{availableCoupons.length}} 张可用 |
|
|
|
|
|
</view> |
|
|
|
|
|
<view style="color: #999;" v-else> |
|
|
|
|
|
无可用券 |
|
|
|
|
|
</view> |
|
|
|
|
|
<uni-icons type="right" size="14" color="#999" style="margin-left:10rpx;"></uni-icons> |
|
|
|
|
|
</view> |
|
|
<view style="width: 100%;height: 160rpx;"></view> |
|
|
<view style="width: 100%;height: 160rpx;"></view> |
|
|
</scroll-view> |
|
|
</scroll-view> |
|
|
<view class="bottom" style="padding-bottom: 40rpx;height: 160rpx;z-index: 10;"> |
|
|
<view class="bottom" style="padding-bottom: 40rpx;height: 160rpx;z-index: 10;"> |
|
|
@ -428,6 +444,9 @@ |
|
|
|
|
|
|
|
|
<text v-if="groupdeliveryType == 1"> 打包费 {{currentItem.lunchBox}} 元</text> |
|
|
<text v-if="groupdeliveryType == 1"> 打包费 {{currentItem.lunchBox}} 元</text> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
<view style="height: 40rpx;text-align: center;color: #ff5722;" v-if="selectedCoupon"> |
|
|
|
|
|
优惠券抵扣 -¥{{selectedCoupon.discountAmount.toFixed(2)}} |
|
|
|
|
|
</view> |
|
|
<view style="height: 40rpx;text-align: center;color: red;"> |
|
|
<view style="height: 40rpx;text-align: center;color: red;"> |
|
|
若拼团失败,将会为您自动退款 |
|
|
若拼团失败,将会为您自动退款 |
|
|
</view> |
|
|
</view> |
|
|
@ -479,6 +498,42 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</uni-popup> |
|
|
</uni-popup> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 优惠券选择弹出层 --> |
|
|
|
|
|
<uni-popup ref="couponPopup" type="bottom" background-color="#F5F8F5"> |
|
|
|
|
|
<view style="width: 100%; height: 800rpx; display: flex; flex-direction: column;"> |
|
|
|
|
|
<view style="height: 100rpx; line-height: 100rpx; text-align: center; font-size: 32rpx; font-weight: bold; border-bottom: 1px solid #eee; position: relative; background: #fff;"> |
|
|
|
|
|
选择优惠券 |
|
|
|
|
|
<uni-icons type="closeempty" size="24" @tap="$refs.couponPopup.close()" style="position: absolute; right: 30rpx; top: 0;"></uni-icons> |
|
|
|
|
|
</view> |
|
|
|
|
|
<scroll-view scroll-y style="flex: 1; padding: 20rpx; box-sizing: border-box;"> |
|
|
|
|
|
<view v-for="(item, index) in availableCoupons" :key="index" @tap="selectCoupon(item)" |
|
|
|
|
|
style="background: #fff; border-radius: 12rpx; padding: 30rpx 20rpx; margin-bottom: 20rpx; display: flex; align-items: center; justify-content: space-between;"> |
|
|
|
|
|
<view style="display: flex; align-items: center; flex: 1;"> |
|
|
|
|
|
<view style="color: #ff5722; font-size: 40rpx; font-weight: bold; width: 140rpx;"> |
|
|
|
|
|
<text style="font-size: 24rpx;">¥</text>{{item.discountAmount}} |
|
|
|
|
|
</view> |
|
|
|
|
|
<view style="flex: 1; display: flex; flex-direction: column; justify-content: center; margin-left: 20rpx;"> |
|
|
|
|
|
<view style="font-size: 28rpx; font-weight: bold; color: #333; margin-bottom: 6rpx;">{{item.couponName}}</view> |
|
|
|
|
|
<view style="font-size: 22rpx; color: #999;" v-if="item.minAmount > 0">满{{item.minAmount}}可用</view> |
|
|
|
|
|
<view style="font-size: 22rpx; color: #999;" v-else>无门槛使用</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<uni-icons v-if="selectedCoupon && selectedCoupon.id === item.id" type="checkmarkempty" size="20" color="#0b9b73"></uni-icons> |
|
|
|
|
|
<view v-else style="width: 40rpx; height: 40rpx; border-radius: 50%; border: 1px solid #ddd;"></view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view v-if="availableCoupons.length===0" style="text-align:center; padding-top: 100rpx; color: #999;"> |
|
|
|
|
|
暂无可用优惠券 |
|
|
|
|
|
</view> |
|
|
|
|
|
<view style="height:40rpx;"></view> |
|
|
|
|
|
</scroll-view> |
|
|
|
|
|
<view style="padding: 20rpx 40rpx; background: #fff;" v-if="availableCoupons.length>0"> |
|
|
|
|
|
<view @tap="selectCoupon(null)" style="width: 100%; height: 80rpx; background: linear-gradient(90deg, #e3ff96, #a6ffea); font-size: 30rpx; font-weight: 700; line-height: 80rpx; text-align: center; border-radius: 100rpx;"> |
|
|
|
|
|
不使用优惠券 |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</uni-popup> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
@ -546,7 +601,9 @@ |
|
|
id: '1', |
|
|
id: '1', |
|
|
checked: true |
|
|
checked: true |
|
|
}], |
|
|
}], |
|
|
shopRecommend:[] |
|
|
shopRecommend:[], |
|
|
|
|
|
availableCoupons: [], |
|
|
|
|
|
selectedCoupon: null |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
components: { |
|
|
components: { |
|
|
@ -631,6 +688,7 @@ |
|
|
}, |
|
|
}, |
|
|
onShow() { |
|
|
onShow() { |
|
|
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect(); |
|
|
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect(); |
|
|
|
|
|
//this.fetchCoupons(); |
|
|
// 计算导航栏高度用于sticky offset:statusBarHeight + 40px内容区 |
|
|
// 计算导航栏高度用于sticky offset:statusBarHeight + 40px内容区 |
|
|
const info = uni.getSystemInfoSync(); |
|
|
const info = uni.getSystemInfoSync(); |
|
|
this.navBarHeight = info.statusBarHeight + 40; |
|
|
this.navBarHeight = info.statusBarHeight + 40; |
|
|
@ -905,7 +963,9 @@ |
|
|
this.$refs.pintuanGroupPopup.close(); |
|
|
this.$refs.pintuanGroupPopup.close(); |
|
|
this.groupId = item.id; |
|
|
this.groupId = item.id; |
|
|
this.targetMembers = parseInt(item.targetMembers); |
|
|
this.targetMembers = parseInt(item.targetMembers); |
|
|
|
|
|
this.selectedCoupon = null; |
|
|
if(this.chooseWaitType){ |
|
|
if(this.chooseWaitType){ |
|
|
|
|
|
this.fetchCoupons(); |
|
|
this.$refs.pintuanPopup.open('bottom'); |
|
|
this.$refs.pintuanPopup.open('bottom'); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
@ -936,6 +996,7 @@ |
|
|
|
|
|
|
|
|
if (index == 'pintuan') { |
|
|
if (index == 'pintuan') { |
|
|
this.isPintuan = true; |
|
|
this.isPintuan = true; |
|
|
|
|
|
this.selectedCoupon = null; |
|
|
|
|
|
|
|
|
if (this.groupId) { |
|
|
if (this.groupId) { |
|
|
// Determine best price match given targetMembers |
|
|
// Determine best price match given targetMembers |
|
|
@ -976,6 +1037,7 @@ |
|
|
} |
|
|
} |
|
|
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice |
|
|
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice |
|
|
|
|
|
|
|
|
|
|
|
this.fetchCoupons(); |
|
|
this.$refs.pintuanPopup.open('bottom'); |
|
|
this.$refs.pintuanPopup.open('bottom'); |
|
|
} else { |
|
|
} else { |
|
|
this.isPintuan = false; |
|
|
this.isPintuan = false; |
|
|
@ -1082,7 +1144,8 @@ |
|
|
shopName: this.shopItem.shopName, |
|
|
shopName: this.shopItem.shopName, |
|
|
shopPhone: this.shopItem.shopPhone || '', |
|
|
shopPhone: this.shopItem.shopPhone || '', |
|
|
shopAddress: this.shopItem.shopAddress || '', |
|
|
shopAddress: this.shopItem.shopAddress || '', |
|
|
groupId: this.groupId |
|
|
groupId: this.groupId, |
|
|
|
|
|
userCouponId: this.selectedCoupon ? this.selectedCoupon.id : null |
|
|
}; |
|
|
}; |
|
|
payload.regionId = JSON.parse(uni.getStorageSync('area')).id |
|
|
payload.regionId = JSON.parse(uni.getStorageSync('area')).id |
|
|
uni.showLoading({ title: '创建订单中...' }); |
|
|
uni.showLoading({ title: '创建订单中...' }); |
|
|
@ -1332,6 +1395,34 @@ |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
fetchCoupons() { |
|
|
|
|
|
let userId = uni.getStorageSync('id'); |
|
|
|
|
|
if (!userId) return; |
|
|
|
|
|
let amount = this.selectedGroupRule && this.selectedGroupRule.groupPriceAndMore ? this.selectedGroupRule.groupPriceAndMore : 0; |
|
|
|
|
|
this.tui.request('/mall/coupon/available', 'GET', { |
|
|
|
|
|
userId: userId, |
|
|
|
|
|
applyScene: 1, |
|
|
|
|
|
regionId:JSON.parse(uni.getStorageSync('area')).id, |
|
|
|
|
|
amount: amount, |
|
|
|
|
|
merchantId: this.shopItem.id || '0' |
|
|
|
|
|
}, false, true).then((res) => { |
|
|
|
|
|
if (res.code == 200 && res.result) { |
|
|
|
|
|
this.availableCoupons = res.result; |
|
|
|
|
|
if (this.selectedCoupon) { |
|
|
|
|
|
let stillValid = this.availableCoupons.find(c => c.id === this.selectedCoupon.id); |
|
|
|
|
|
if (!stillValid) this.selectedCoupon = null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
selectCoupon(item) { |
|
|
|
|
|
this.selectedCoupon = item; |
|
|
|
|
|
this.$refs.couponPopup.close(); |
|
|
|
|
|
}, |
|
|
|
|
|
openCouponPopup() { |
|
|
|
|
|
this.fetchCoupons(); |
|
|
|
|
|
this.$refs.couponPopup.open('bottom'); |
|
|
|
|
|
}, |
|
|
back() { |
|
|
back() { |
|
|
uni.navigateBack() |
|
|
uni.navigateBack() |
|
|
} |
|
|
} |
|
|
|