|
|
|
@ -458,24 +458,6 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 优惠券选择 --> |
|
|
|
<view v-if="isFaceToFaceGroup" class="coupon-row" |
|
|
|
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> |
|
|
|
</scroll-view> |
|
|
|
<view class="bottom popup-bottom-bar" style="padding-bottom: 40rpx;height: 160rpx;z-index: 10;"> |
|
|
|
@ -545,32 +527,40 @@ |
|
|
|
</uni-popup> |
|
|
|
|
|
|
|
<!-- 支付弹出层 --> |
|
|
|
<uni-popup ref="payPopup" background-color="#fff" @change="onBottomPopupChange"> |
|
|
|
<view class="pay-popup" |
|
|
|
style="height: auto;background: #fff;border-radius: 40rpx 40rpx 0 0;padding-top: 40rpx;"> |
|
|
|
<view class="content" style="height: 100%;margin-top:0"> |
|
|
|
<view class="box1"> |
|
|
|
<view style="display: flex;align-items: center;justify-content: center;height: 70rpx;"> |
|
|
|
<uni-popup ref="payPopup" background-color="#fff" @change="onPayPopupChange"> |
|
|
|
<view class="pay-popup"> |
|
|
|
<view class="content pay-popup-content"> |
|
|
|
<view class="box1 pay-summary-card"> |
|
|
|
<view class="pay-countdown"> |
|
|
|
支付剩余时间 <uni-countdown :show-day="false" :hour="00" :minute="59" :second="59" /> |
|
|
|
</view> |
|
|
|
<view |
|
|
|
style="height: 90rpx;line-height: 90rpx;text-align: center;font-weight: 700;font-size: 30rpx;"> |
|
|
|
¥<text |
|
|
|
style="font-size: 60rpx;">{{backendTotalAmount ? backendTotalAmount.toFixed(2) : '0.00'}}</text> |
|
|
|
<view class="pay-amount"> |
|
|
|
¥<text>{{formatMoney(getPayTotalAmount())}}</text> |
|
|
|
</view> |
|
|
|
<view style="height: 40rpx;text-align: center;color: #777;"> |
|
|
|
|
|
|
|
<text v-if="groupId != '' && isFaceToFaceGroup && groupdeliveryType == 1"> |
|
|
|
配送费(均摊){{tuanzhangOrder.deliveryFee}} 元 |
|
|
|
</text> |
|
|
|
|
|
|
|
<text v-if="groupdeliveryType == 1 && currentItem.lunchBox > 0"> 打包费 |
|
|
|
{{currentItem.lunchBox}} 元</text> |
|
|
|
</view> |
|
|
|
<view style="height: 40rpx;text-align: center;color: #ff5722;" v-if="selectedCoupon"> |
|
|
|
优惠券抵扣 -¥{{selectedCoupon.discountAmount.toFixed(2)}} |
|
|
|
<view class="pay-fee-list"> |
|
|
|
<view class="pay-fee-row"> |
|
|
|
<text>商品金额</text> |
|
|
|
<text>¥{{formatMoney(getPayGoodsAmount())}}</text> |
|
|
|
</view> |
|
|
|
<view class="pay-fee-row" v-if="groupdeliveryType == 1 && getPayPackageFee() > 0"> |
|
|
|
<text>餐盒费</text> |
|
|
|
<text>¥{{formatMoney(getPayPackageFee())}}</text> |
|
|
|
</view> |
|
|
|
<view class="pay-fee-row" v-if="groupId != '' && isFaceToFaceGroup && groupdeliveryType == 1"> |
|
|
|
<text>配送费(均摊)</text> |
|
|
|
<text>¥{{formatMoney(getPayDeliveryFee())}}</text> |
|
|
|
</view> |
|
|
|
<view class="pay-fee-row pay-coupon-entry" @tap="openCouponPopup"> |
|
|
|
<text>优惠券</text> |
|
|
|
<view class="pay-coupon-value"> |
|
|
|
<text v-if="selectedCoupon">-¥{{formatMoney(getCouponDiscount(selectedCoupon))}}</text> |
|
|
|
<text v-else-if="availableCoupons.length > 0">有 {{availableCoupons.length}} 张可用</text> |
|
|
|
<text v-else>无可用券</text> |
|
|
|
<uni-icons type="right" size="14" color="#9aa6a2"></uni-icons> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view style="height: 40rpx;text-align: center;color: red;"> |
|
|
|
<view class="pay-refund-tip"> |
|
|
|
若拼团失败,将会为您自动退款 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -622,9 +612,7 @@ |
|
|
|
alt="" style="width: 36rpx;height: 36rpx;" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="btn" |
|
|
|
style="background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));width: 90%;height: 100rpx;border-radius: 100rpx;text-align: center;font-size: 28rpx;font-weight: 700;line-height: 100rpx;margin: 40rpx auto;" |
|
|
|
@tap="wxPayment"> |
|
|
|
<view class="btn pay-confirm-btn" @tap="wxPayment"> |
|
|
|
确认付款{{nowMake && groupdeliveryType == 2 && !isStoreGroupOrder ? '-即刻出餐' : ''}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -676,27 +664,27 @@ |
|
|
|
|
|
|
|
<!-- 优惠券选择弹出层 --> |
|
|
|
<uni-popup ref="couponPopup" type="bottom" background-color="#F5F8F5" @change="onBottomPopupChange"> |
|
|
|
<view style="width: 100%; height: 800rpx; display: flex; flex-direction: column;"> |
|
|
|
<view style="width: 100%; height: 800rpx; display: flex; flex-direction: column; overflow: hidden;"> |
|
|
|
<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;"> |
|
|
|
<scroll-view scroll-y style="height: 560rpx; 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}} |
|
|
|
<text style="font-size: 24rpx;">¥</text>{{formatMoney(getCouponDiscount(item))}} |
|
|
|
</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}} |
|
|
|
{{getCouponName(item)}} |
|
|
|
</view> |
|
|
|
<view style="font-size: 22rpx; color: #999;" v-if="item.minAmount > 0"> |
|
|
|
满{{item.minAmount}}可用</view> |
|
|
|
<view style="font-size: 22rpx; color: #999;" v-if="getCouponMinAmount(item) > 0"> |
|
|
|
满{{formatMoney(getCouponMinAmount(item))}}可用</view> |
|
|
|
<view style="font-size: 22rpx; color: #999;" v-else>无门槛使用</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -806,6 +794,8 @@ |
|
|
|
backendTotalAmount: 0, |
|
|
|
currentOrderId: '', |
|
|
|
isCreatingOrder: false, |
|
|
|
createdOrderInfo: null, |
|
|
|
pendingPaySpecChoices: null, |
|
|
|
onlineWorkerInterval: 2500, |
|
|
|
onlineWorkerDuration: 500, |
|
|
|
menuList: [{ |
|
|
|
@ -816,6 +806,7 @@ |
|
|
|
shopRecommend: [], |
|
|
|
availableCoupons: [], |
|
|
|
selectedCoupon: null, |
|
|
|
navigatingFromPayPopup: false, |
|
|
|
freeOrderEffectVisible: false, |
|
|
|
freeOrderAmount: '0.00', |
|
|
|
popupPageStyle: '', |
|
|
|
@ -987,9 +978,106 @@ |
|
|
|
} |
|
|
|
this.popupPageStyle = this.bottomPopupOpenCount > 0 ? 'overflow:hidden;' : ''; |
|
|
|
}, |
|
|
|
onPayPopupChange(e) { |
|
|
|
this.onBottomPopupChange(e); |
|
|
|
if (!e.show && this.currentOrderId && !this.navigatingFromPayPopup) { |
|
|
|
this.goPayOrderDetail(); |
|
|
|
} |
|
|
|
}, |
|
|
|
nowMakeMethod() { |
|
|
|
this.nowMake = !this.nowMake |
|
|
|
}, |
|
|
|
toNumber(value) { |
|
|
|
let amount = parseFloat(value); |
|
|
|
return isNaN(amount) ? 0 : amount; |
|
|
|
}, |
|
|
|
getCouponDiscount(coupon) { |
|
|
|
if (!coupon) return 0; |
|
|
|
return this.toNumber(coupon.discountAmount || coupon.discountFee || coupon.amount || 0); |
|
|
|
}, |
|
|
|
getCouponMinAmount(coupon) { |
|
|
|
if (!coupon) return 0; |
|
|
|
return this.toNumber(coupon.minAmount || coupon.thresholdAmount || 0); |
|
|
|
}, |
|
|
|
getCouponName(coupon) { |
|
|
|
if (!coupon) return '优惠券'; |
|
|
|
if (coupon.couponName) return coupon.couponName; |
|
|
|
if (coupon.name) return coupon.name; |
|
|
|
if (coupon.title) return coupon.title; |
|
|
|
return coupon.issuerType == 2 ? '商家优惠券' : '平台优惠券'; |
|
|
|
}, |
|
|
|
normalizeCoupons(list) { |
|
|
|
return (list || []).map(item => { |
|
|
|
return Object.assign({}, item, { |
|
|
|
discountAmount: this.getCouponDiscount(item), |
|
|
|
minAmount: this.getCouponMinAmount(item), |
|
|
|
couponName: this.getCouponName(item) |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
getMoreBuyAmount() { |
|
|
|
let list = this.currentItem && this.currentItem.moreBuyData ? this.currentItem.moreBuyData : this.moreBuyData; |
|
|
|
let amount = 0; |
|
|
|
for (let i = 0; i < list.length; i++) { |
|
|
|
if (list[i].quantity > 0) { |
|
|
|
amount += Number((Number(list[i].quantity) * Number(this.sliceMsg2(list[i].attributeListPrice))).toFixed(2)); |
|
|
|
} |
|
|
|
} |
|
|
|
return amount; |
|
|
|
}, |
|
|
|
getFaceToFaceGoodsAmount() { |
|
|
|
return this.toNumber(this.selectedGroupRule && this.selectedGroupRule.groupPrice) + this.getMoreBuyAmount(); |
|
|
|
}, |
|
|
|
getPayGoodsAmount() { |
|
|
|
if (this.createdOrderInfo && this.createdOrderInfo.goodsAmount != null) { |
|
|
|
return this.toNumber(this.createdOrderInfo.goodsAmount); |
|
|
|
} |
|
|
|
return this.getFaceToFaceGoodsAmount(); |
|
|
|
}, |
|
|
|
getPayPackageFee() { |
|
|
|
if (this.createdOrderInfo && this.createdOrderInfo.packageFee != null) { |
|
|
|
return this.toNumber(this.createdOrderInfo.packageFee); |
|
|
|
} |
|
|
|
return this.groupdeliveryType == 1 ? this.toNumber(this.currentItem && this.currentItem.lunchBox) : 0; |
|
|
|
}, |
|
|
|
getPayDeliveryFee() { |
|
|
|
if (this.createdOrderInfo && this.createdOrderInfo.deliveryFee != null) { |
|
|
|
return this.toNumber(this.createdOrderInfo.deliveryFee); |
|
|
|
} |
|
|
|
return this.toNumber(this.tuanzhangOrder && this.tuanzhangOrder.deliveryFee); |
|
|
|
}, |
|
|
|
getPayTotalAmount() { |
|
|
|
if (this.createdOrderInfo && this.backendTotalAmount) { |
|
|
|
return this.toNumber(this.backendTotalAmount); |
|
|
|
} |
|
|
|
let total = this.getPayGoodsAmount() + this.getPayPackageFee() + this.getPayDeliveryFee(); |
|
|
|
if (this.selectedCoupon) { |
|
|
|
total -= this.getCouponDiscount(this.selectedCoupon); |
|
|
|
} |
|
|
|
return total > 0 ? total : 0.01; |
|
|
|
}, |
|
|
|
refreshSelectedGroupPayPrice() { |
|
|
|
if (!this.selectedGroupRule) return; |
|
|
|
let amount = this.getFaceToFaceGoodsAmount(); |
|
|
|
if (this.selectedCoupon) { |
|
|
|
amount -= this.getCouponDiscount(this.selectedCoupon); |
|
|
|
} |
|
|
|
this.selectedGroupRule.groupPriceAndMore = amount > 0 ? amount : 0.01; |
|
|
|
}, |
|
|
|
goPayOrderDetail() { |
|
|
|
if (!this.currentOrderId) return; |
|
|
|
this.navigatingFromPayPopup = true; |
|
|
|
uni.redirectTo({ |
|
|
|
url: '/package1/order/orderDetail?id=' + this.currentOrderId |
|
|
|
}); |
|
|
|
}, |
|
|
|
goPayOrderConfirm() { |
|
|
|
this.navigatingFromPayPopup = true; |
|
|
|
uni.redirectTo({ |
|
|
|
url: '/package1/order/orderConfirm?id=' + this.currentOrderId + '&groupId=' + this.groupId + |
|
|
|
'&amount=' + this.backendTotalAmount |
|
|
|
}); |
|
|
|
}, |
|
|
|
scrollGoodsListToTop() { |
|
|
|
// 滚到 catalog-row 顶部并紧贴 nav-bar |
|
|
|
const query = uni.createSelectorQuery().in(this); |
|
|
|
@ -1196,7 +1284,7 @@ |
|
|
|
obj : max)); |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
if (this.selectedCoupon) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= parseFloat(this.selectedCoupon.discountAmount); |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); |
|
|
|
if (this.selectedGroupRule.groupPriceAndMore <= 0) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore = 0.01 |
|
|
|
} |
|
|
|
@ -1206,7 +1294,7 @@ |
|
|
|
prev : curr)); |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
if (this.selectedCoupon) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= parseFloat(this.selectedCoupon.discountAmount); |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); |
|
|
|
if (this.selectedGroupRule.groupPriceAndMore <= 0) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore = 0.01 |
|
|
|
} |
|
|
|
@ -1220,7 +1308,7 @@ |
|
|
|
this.selectedGroupRule = item.productGroupBuyPrices[0]; |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
if (this.selectedCoupon) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= parseFloat(this.selectedCoupon.discountAmount); |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); |
|
|
|
if (this.selectedGroupRule.groupPriceAndMore <= 0) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore = 0.01 |
|
|
|
} |
|
|
|
@ -1239,7 +1327,7 @@ |
|
|
|
} |
|
|
|
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice |
|
|
|
if (this.selectedCoupon) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= parseFloat(this.selectedCoupon.discountAmount); |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); |
|
|
|
if (this.selectedGroupRule.groupPriceAndMore <= 0) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore = 0.01 |
|
|
|
} |
|
|
|
@ -1357,7 +1445,6 @@ |
|
|
|
|
|
|
|
if (this.isFaceToFaceGroup) { |
|
|
|
if (this.parsedSpecs.length === 0) { |
|
|
|
// No specs needed, jump straight to direct pay |
|
|
|
this.submitFTFJoinPay({}); |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -1436,7 +1523,7 @@ |
|
|
|
this.selectedGroupRule = rule; |
|
|
|
this.selectedGroupRule.groupPriceAndMore = this.selectedGroupRule.groupPrice |
|
|
|
if (this.selectedCoupon) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= parseFloat(this.selectedCoupon.discountAmount); |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); |
|
|
|
if (this.selectedGroupRule.groupPriceAndMore <= 0) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore = 0.01 |
|
|
|
} |
|
|
|
@ -1474,7 +1561,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.groupId && this.isFaceToFaceGroup) { |
|
|
|
// Direct face-to-face pay path |
|
|
|
this.submitFTFJoinPay(specChoices); |
|
|
|
return |
|
|
|
} |
|
|
|
@ -1503,8 +1589,16 @@ |
|
|
|
if (this.$refs.pintuanPopup) this.$refs.pintuanPopup.close(); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.isCreatingOrder) return; |
|
|
|
this.isCreatingOrder = true; |
|
|
|
this.pendingPaySpecChoices = specChoices || {}; |
|
|
|
this.groupdeliveryType = this.tuanzhangOrder.deliveryType; |
|
|
|
this.backendTotalAmount = 0; |
|
|
|
this.createdOrderInfo = null; |
|
|
|
this.navigatingFromPayPopup = false; |
|
|
|
this.fetchCoupons(); |
|
|
|
this.$refs.payPopup.open('bottom'); |
|
|
|
if (this.$refs.pintuanPopup) this.$refs.pintuanPopup.close(); |
|
|
|
}, |
|
|
|
buildFTFJoinPayload(specChoices) { |
|
|
|
let items = [{ |
|
|
|
productId: this.currentItem.id, |
|
|
|
specs: JSON.stringify(specChoices || {}), |
|
|
|
@ -1526,7 +1620,7 @@ |
|
|
|
|
|
|
|
let packageFee = parseFloat(this.currentItem.lunchBox || 0); |
|
|
|
|
|
|
|
let payload = { |
|
|
|
return { |
|
|
|
userId: uni.getStorageSync('id') || 'test-user123', |
|
|
|
shopId: this.shopItem.id, |
|
|
|
deliveryType: this.tuanzhangOrder.deliveryType, |
|
|
|
@ -1540,9 +1634,18 @@ |
|
|
|
shopPhone: this.shopItem.shopPhone || '', |
|
|
|
shopAddress: this.shopItem.shopAddress || '', |
|
|
|
groupId: this.groupId, |
|
|
|
userCouponId: this.selectedCoupon ? this.selectedCoupon.id : null |
|
|
|
userCouponId: this.selectedCoupon ? this.selectedCoupon.id : null, |
|
|
|
regionId: JSON.parse(uni.getStorageSync('area')).id |
|
|
|
}; |
|
|
|
payload.regionId = JSON.parse(uni.getStorageSync('area')).id |
|
|
|
}, |
|
|
|
createFTFJoinOrder(specChoices, autoPay) { |
|
|
|
if (this.isCreatingOrder) return; |
|
|
|
this.isCreatingOrder = true; |
|
|
|
let payload = this.buildFTFJoinPayload(specChoices); |
|
|
|
if (!payload) { |
|
|
|
this.isCreatingOrder = false; |
|
|
|
return; |
|
|
|
} |
|
|
|
uni.showLoading({ |
|
|
|
title: '创建订单中....' |
|
|
|
}); |
|
|
|
@ -1553,10 +1656,18 @@ |
|
|
|
this.currentOrderId = res.result.id; |
|
|
|
this.groupdeliveryType = res.result.deliveryType; |
|
|
|
this.backendTotalAmount = res.result.totalAmount; |
|
|
|
this.createdOrderInfo = res.result; |
|
|
|
if (res.result.isFreeOrder == 1) { |
|
|
|
this.showFreeOrderEffect(res.result); |
|
|
|
} |
|
|
|
this.$refs.payPopup.open('bottom'); |
|
|
|
this.pendingPaySpecChoices = null; |
|
|
|
if (autoPay) { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.wxPayment(); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.$refs.payPopup.open('bottom'); |
|
|
|
} |
|
|
|
if (this.$refs.pintuanPopup) this.$refs.pintuanPopup.close(); |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
@ -1801,7 +1912,7 @@ |
|
|
|
} |
|
|
|
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice |
|
|
|
if (this.selectedCoupon) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= parseFloat(this.selectedCoupon.discountAmount); |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); |
|
|
|
if (this.selectedGroupRule.groupPriceAndMore <= 0) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore = 0.01 |
|
|
|
} |
|
|
|
@ -1835,7 +1946,7 @@ |
|
|
|
} |
|
|
|
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice |
|
|
|
if (this.selectedCoupon) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= parseFloat(this.selectedCoupon.discountAmount); |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= this.getCouponDiscount(this.selectedCoupon); |
|
|
|
if (this.selectedGroupRule.groupPriceAndMore <= 0) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore = 0.01 |
|
|
|
} |
|
|
|
@ -1849,7 +1960,12 @@ |
|
|
|
}, |
|
|
|
wxPayment() { |
|
|
|
let that = this; |
|
|
|
if (!this.currentOrderId || !this.backendTotalAmount) return; |
|
|
|
if (!this.currentOrderId || !this.backendTotalAmount) { |
|
|
|
if (this.pendingPaySpecChoices) { |
|
|
|
this.createFTFJoinOrder(this.pendingPaySpecChoices, true); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
let amountInCents = Math.round(this.backendTotalAmount * 100); |
|
|
|
let userRequireMake = 0 |
|
|
|
@ -1886,14 +2002,10 @@ |
|
|
|
that.tui.toast("订单创建失败,请联系客服处理"); |
|
|
|
} |
|
|
|
}) */ |
|
|
|
uni.redirectTo({ |
|
|
|
url: '/package1/order/orderConfirm?id=' + that |
|
|
|
.currentOrderId + '&groupId=' + that.groupId + |
|
|
|
'&amount=' + that.backendTotalAmount |
|
|
|
}); |
|
|
|
that.goPayOrderConfirm(); |
|
|
|
}, |
|
|
|
fail: function(err) { |
|
|
|
that.tui.toast("支付失败或取消"); |
|
|
|
that.goPayOrderDetail(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
@ -1902,13 +2014,14 @@ |
|
|
|
that.tui.request( |
|
|
|
`/hiver/order/payMallOrderSuccess?orderId=${that.currentOrderId}&workerId=`, |
|
|
|
"POST", {}, false, false).then(res2 => { |
|
|
|
that.navigatingFromPayPopup = true; |
|
|
|
that.$refs.payPopup.close(); |
|
|
|
uni.showToast({ |
|
|
|
title: '支付成功(模拟)', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
setTimeout(() => { |
|
|
|
that.$refs.joinSuccessPopup.open('bottom'); |
|
|
|
that.goPayOrderConfirm(); |
|
|
|
}, 1500); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
@ -1927,10 +2040,9 @@ |
|
|
|
}, |
|
|
|
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', { |
|
|
|
if (!userId) return Promise.resolve([]); |
|
|
|
let amount = this.getFaceToFaceGoodsAmount(); |
|
|
|
return this.tui.request('/mall/coupon/available', 'GET', { |
|
|
|
userId: userId, |
|
|
|
applyScene: 1, |
|
|
|
regionId: JSON.parse(uni.getStorageSync('area')).id, |
|
|
|
@ -1938,12 +2050,13 @@ |
|
|
|
merchantId: this.shopItem.id || '0' |
|
|
|
}, false, true).then((res) => { |
|
|
|
if (res.code == 200 && res.result) { |
|
|
|
this.availableCoupons = res.result; |
|
|
|
this.availableCoupons = this.normalizeCoupons(res.result); |
|
|
|
if (this.selectedCoupon) { |
|
|
|
let stillValid = this.availableCoupons.find(c => c.id === this.selectedCoupon.id); |
|
|
|
if (!stillValid) this.selectedCoupon = null; |
|
|
|
} |
|
|
|
} |
|
|
|
return this.availableCoupons; |
|
|
|
}); |
|
|
|
}, |
|
|
|
openMianRemark() { |
|
|
|
@ -1952,10 +2065,7 @@ |
|
|
|
}, |
|
|
|
selectCoupon(item) { |
|
|
|
this.selectedCoupon = item; |
|
|
|
this.selectedGroupRule.groupPriceAndMore -= parseFloat(this.selectedCoupon.discountAmount); |
|
|
|
if (this.selectedGroupRule.groupPriceAndMore <= 0) { |
|
|
|
this.selectedGroupRule.groupPriceAndMore = 0.01 |
|
|
|
} |
|
|
|
this.refreshSelectedGroupPayPrice(); |
|
|
|
this.$refs.couponPopup.close(); |
|
|
|
}, |
|
|
|
openCouponPopup() { |
|
|
|
@ -3565,6 +3675,118 @@ |
|
|
|
background: rgba(255, 248, 224, 0.64); |
|
|
|
} |
|
|
|
|
|
|
|
.pay-popup { |
|
|
|
height: auto; |
|
|
|
background: #fff; |
|
|
|
border-radius: 40rpx 40rpx 0 0; |
|
|
|
padding-top: 34rpx; |
|
|
|
padding-bottom: calc(30rpx + env(safe-area-inset-bottom)); |
|
|
|
} |
|
|
|
|
|
|
|
.pay-popup-content { |
|
|
|
height: 100%; |
|
|
|
margin-top: 0; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-summary-card { |
|
|
|
padding: 28rpx 30rpx 24rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-countdown { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
min-height: 54rpx; |
|
|
|
color: #586963; |
|
|
|
font-size: 26rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-amount { |
|
|
|
margin-top: 8rpx; |
|
|
|
text-align: center; |
|
|
|
font-size: 30rpx; |
|
|
|
font-weight: 800; |
|
|
|
line-height: 84rpx; |
|
|
|
color: #00231C; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-amount text { |
|
|
|
font-size: 62rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-fee-list { |
|
|
|
margin-top: 14rpx; |
|
|
|
padding: 18rpx 22rpx; |
|
|
|
border-radius: 22rpx; |
|
|
|
background: #f8fbf9; |
|
|
|
border: 1rpx solid #edf3f0; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-fee-row { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: space-between; |
|
|
|
min-height: 44rpx; |
|
|
|
color: #65756f; |
|
|
|
font-size: 24rpx; |
|
|
|
line-height: 34rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-fee-row + .pay-fee-row { |
|
|
|
margin-top: 8rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-fee-row text:last-child { |
|
|
|
margin-left: 20rpx; |
|
|
|
color: #243a34; |
|
|
|
font-weight: 800; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-fee-discount text { |
|
|
|
color: #ff5722 !important; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-coupon-entry { |
|
|
|
transition: transform 0.18s ease; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-coupon-entry:active { |
|
|
|
transform: scale(0.98); |
|
|
|
} |
|
|
|
|
|
|
|
.pay-coupon-value { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: flex-end; |
|
|
|
color: #0b9b73; |
|
|
|
font-weight: 800; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-coupon-value text:first-child { |
|
|
|
margin-right: 8rpx; |
|
|
|
color: inherit; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-refund-tip { |
|
|
|
margin-top: 16rpx; |
|
|
|
text-align: center; |
|
|
|
color: #f0441f; |
|
|
|
font-size: 24rpx; |
|
|
|
line-height: 36rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.pay-confirm-btn { |
|
|
|
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1)); |
|
|
|
width: 90%; |
|
|
|
height: 100rpx; |
|
|
|
border-radius: 100rpx; |
|
|
|
text-align: center; |
|
|
|
font-size: 28rpx; |
|
|
|
font-weight: 700; |
|
|
|
line-height: 100rpx; |
|
|
|
margin: 40rpx auto; |
|
|
|
} |
|
|
|
|
|
|
|
.popup-bottom-bar { |
|
|
|
background: rgba(255, 255, 255, 0.98); |
|
|
|
box-shadow: 0 -12rpx 28rpx rgba(0, 35, 28, 0.1); |
|
|
|
|