|
@@ -83,9 +83,9 @@
|
|
|
<view class="coupon u-flex u-row-between block-wrap" @click="selectCoupon">
|
|
|
<view class="left">优惠券</view>
|
|
|
<view class="right u-flex">
|
|
|
- <text v-if="couponList.length<1||Number(this.totalPrice)<=0">暂无可用</text>
|
|
|
+ <text v-if="couponList.length<1||Number(this.pageContent.salePrice)<=0">暂无可用</text>
|
|
|
<text v-if="coupon.quota" style="color: #EF2929;">已选1张优惠券</text>
|
|
|
- <text v-if="couponList.length>0&&!coupon.quota&&Number(this.totalPrice)>0">未选择优惠券</text>
|
|
|
+ <text v-if="couponList.length>0&&!coupon.quota&&Number(this.pageContent.salePrice)>0">未选择优惠券</text>
|
|
|
<u-icon name="arrow-right" color="#7F7F7F" size="24rpx"></u-icon>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -151,9 +151,9 @@
|
|
|
<view class="original-price">
|
|
|
原价¥{{pageContent.originalPrice}}
|
|
|
</view>
|
|
|
- <!-- <view class="bottom-coupon" v-if="coupon.quota">
|
|
|
+ <view class="bottom-coupon" v-if="coupon.quota">
|
|
|
优惠券共减¥{{couponAmount}}
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="right">
|
|
@@ -247,13 +247,13 @@ import {
|
|
|
computed: {
|
|
|
// finalPrice(){
|
|
|
// let discount = 0;
|
|
|
- // let price = this.totalPrice||0;
|
|
|
+ // let price = this.pageContent.salePrice||0;
|
|
|
// if(this.coupon.type==1){
|
|
|
// discount = this.coupon.quota || 0; // 如果没有优惠券,默认为0
|
|
|
- // price = Math.max(this.totalPrice - discount,0);
|
|
|
+ // price = Math.max(this.pageContent.salePrice - discount,0);
|
|
|
|
|
|
// }else if(this.coupon.type==2){
|
|
|
- // price = this.totalPrice*(this.coupon.quota/100);
|
|
|
+ // price = this.pageContent.salePrice*(this.coupon.quota/100);
|
|
|
// }
|
|
|
// // console.log('price',price);
|
|
|
// // console.log('price',typeof price);
|
|
@@ -280,12 +280,12 @@ import {
|
|
|
amount = this.coupon.quota || 0; // 如果没有优惠券,默认为0
|
|
|
} else if (this.coupon.type == 2) {
|
|
|
// 将总价和折扣转化为整数
|
|
|
- const totalPrice = Math.round(this.totalPrice * 100); // 以分为单位
|
|
|
+ const totalPrice = Math.round(this.pageContent.salePrice * 100); // 以分为单位
|
|
|
const discountRate = this.coupon.quota; // 折扣百分比
|
|
|
const discountAmount = totalPrice * (discountRate / 100);
|
|
|
const finalAmount = totalPrice - discountAmount;
|
|
|
amount = finalAmount / 100; // 结果转换回以元为单位
|
|
|
- // console.log('this.totalPrice',this.totalPrice);
|
|
|
+ // console.log('this.pageContent.salePrice',this.pageContent.salePrice);
|
|
|
// console.log('this.coupon.quota',this.coupon.quota);
|
|
|
// console.log('amount',amount);
|
|
|
}
|
|
@@ -295,7 +295,7 @@ import {
|
|
|
onShow() {
|
|
|
this.getSettlement();
|
|
|
|
|
|
- if(this.totalPrice>0){
|
|
|
+ if(this.pageContent.salePrice>0){
|
|
|
this.findOrderCoupons()
|
|
|
}
|
|
|
|
|
@@ -334,7 +334,16 @@ import {
|
|
|
},
|
|
|
getSettlement() {
|
|
|
this.pageData.goodsList = this.selectGoodsList;
|
|
|
- this.$u.api.getSettlementV2(this.pageData).then(res => {
|
|
|
+ // console.log('coupon',this.coupon.quota)
|
|
|
+ let params = {
|
|
|
+ ...this.pageData,
|
|
|
+ }
|
|
|
+ if(this.coupon.quota){
|
|
|
+ params.coupon = {
|
|
|
+ memberCouponId :this.coupon.id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$u.api.getSettlementV2(params).then(res => {
|
|
|
// console.log('getSettlement',res.data);
|
|
|
this.pageContent = res.data;
|
|
|
this.getMemberAll();
|
|
@@ -807,20 +816,23 @@ import {
|
|
|
// #endif
|
|
|
},
|
|
|
selectCoupon(){
|
|
|
- if(Number(this.totalPrice)<=0){
|
|
|
+ if(Number(this.pageContent.salePrice)<=0){
|
|
|
return
|
|
|
}
|
|
|
+ let goodsId = this.pageContent.goodsList[0].goodsId;
|
|
|
this.$u.route('/center/couponselect',{
|
|
|
- salePrice:this.totalPrice,
|
|
|
+ salePrice:this.pageContent.salePrice,
|
|
|
performId:this.performId,
|
|
|
- goodsId: this.pageContent.goodsId
|
|
|
+ goodsId: goodsId
|
|
|
})
|
|
|
},
|
|
|
findOrderCoupons() {
|
|
|
+ let goodsId = this.pageContent.goodsList[0].goodsId;
|
|
|
+ // console.log('findOrderCoupons-goodsId',goodsId)
|
|
|
let param = {
|
|
|
- salePrice: this.totalPrice,
|
|
|
+ salePrice: this.pageContent.salePrice,
|
|
|
performId: this.performId,
|
|
|
- goodsId: this.pageContent.goodsId
|
|
|
+ goodsId: goodsId
|
|
|
};
|
|
|
|
|
|
this.$u.api.findOrderCoupons(param)
|