Commit d0857249 authored by 罗超's avatar 罗超

支持订单使用VIP福利

parent 171a41af
......@@ -54,7 +54,7 @@
this.vipInfo = r.data
const v = r.data
this.$emit('setUserOrder',v.FinishOrderCount)
if(v.FinishOrderCount == v.OrderCount){
if(v.FinishOrderCount >= v.OrderCount){
let rule = v.RuleList.find(x=>x.LineId==this.lineId)
if(!rule) rule = v.RuleList.find(x=>x.LineId==0)
if(rule) {
......
......@@ -386,7 +386,7 @@
</view>
</view>
<view class="form-items" style="border-bottom: none">
<view class="label"> 明细 </view>
<view class="label" style="text-align: left;"> 明细 </view>
</view>
<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index">
<view style="flex: 1">
......@@ -464,12 +464,19 @@
<view style="text-align: right">
{{currentCoupon.discountMoney}}</view>
</view>
<view v-if="userVipRights && vipDiscountMoney>0" class="flex f12 grey" style="margin-bottom: 40rpx" :style="{'color':mainColor+' !important'}">
<view style="flex: 1">
<text style="margin-right: 30rpx">印象会员福利优惠({{userVipRights.DiscountType==1?`${userVipRights.DiscountValue*10}折`:`减${userVipRights.DiscountValue}/人`}})</text>
</view>
<view style="text-align: right">
-¥{{vipDiscountMoney}}</view>
</view>
<view class="flex f12 grey" style="margin-bottom: 40rpx">
<view style="flex: 1">
<text style="margin-right: 30rpx">小计</text>
</view>
<view style="text-align: right">
¥{{parseFloat((price-currentCoupon.discountMoney)).toFixed(2)}}</view>
¥{{parseFloat((price-currentCoupon.discountMoney-vipDiscountMoney)).toFixed(2)}}</view>
</view>
<view class="f12" style="color:#ff3166;margin-bottom: 40rpx" v-if="activity && activity.Id">
......@@ -495,7 +502,7 @@
<view style="color: #ff3166; font-weight: bold">
<text style="font-size: 22rpx">¥</text>
<text style="font-size: 40rpx; margin: 0 20rpx 0 5rpx;font-family: nav-font;">{{
(price-currentCoupon.discountMoney).toFixed(2)
(price-currentCoupon.discountMoney-vipDiscountMoney).toFixed(2)
}}</text>
<text style="color: #6e6e6e; font-size: 24rpx;font-family: microsoft yahei ui light;">共计{{ total }}</text>
</view>
......@@ -594,6 +601,8 @@
showPz:false,
pzCoupon:null,
userInfo: {},
userVipRights:null,
vipDiscountMoney:0
};
},
created() {
......@@ -763,6 +772,7 @@
this.useCouponIds = []
}
this.showCoupon = false;
this.calcVipDisscountHandle()
},
getUserCouponList() {
let couponParams = {
......@@ -779,7 +789,6 @@
// #endif
"TCID": this.currentPriceInfo.tcid,
}
console.log("this.currentPriceInfo", this.currentPriceInfo);
if (this.currentPriceInfo.teamType == "0") {
//跟团游
couponParams.CouponsUseScope = 2;
......@@ -794,12 +803,9 @@
couponParams.lineteamId = this.currentPriceInfo.lineteamId;
}
couponParams.userId = this.customer.accountId;
console.log("this.customer", this.customer);
console.log("couponParams", couponParams);
this.apipost(
"coupon_post_GetUserCanUseCouponList", couponParams,
(res) => {
console.log("coupon_post_GetUserCanUseCouponList", res);
if (res.resultCode == 1) {
let arrList = function(list){
list.forEach(x=>{
......@@ -810,13 +816,46 @@
arrList(res.data)
this.couponList = res.data
this.calcPzCouponHandler()
this.calcMaxCouponHandle()
this.getUserVipInfo(this.realCurrentPriceInfo.lineId)
}
},
(err) => {
console.log("coupon_post_GetUserCanUseCouponList_err", err);
}
(err) => {}
);
},
calcMaxCouponHandle(){
if(this.couponList && this.couponList.length>0){
let maxCouponId = 0
let discount = 0
const money = this.price
this.couponList.forEach(x=>{
if(x.couponsType==1 && x.denomination>discount) {
discount=x.denomination
maxCouponId = x.id
}
if(x.couponsType==2){
let disMoney = money*(1-x.denomination)
if(discount<disMoney){
discount=disMoney
maxCouponId = x.id
}
}
})
console.log(maxCouponId)
if(maxCouponId>0) this.closeCouponHandler([maxCouponId])
}
},
calcVipDisscountHandle(){
const money = this.price-this.currentCoupon.discountMoney
let vipMoney = 0
if(this.userVipRights){
const v = this.userVipRights
if(v.DiscountType==1) vipMoney += money*(1-v.DiscountValue)
else vipMoney += v.DiscountValue*(parseInt(this.orderMsg.ManNum) + parseInt(this.orderMsg.ChirdNum))
this.vipDiscountMoney = Number(vipMoney.toFixed(2))
}
},
usePzCouponHandler(){
this.showPz = false
this.closeCouponHandler([this.pzCoupon.id])
......@@ -863,9 +902,11 @@
this.realCurrentPriceInfo = res.data.currentPriceInfo
this.tips = res.data.feature.importantTipText;
this.ltName = res.data.ltName;
this.realCurrentPriceInfo.lineId = res.data.lineId
this.currentPriceInfo.visaPrice = res.data.currentPriceInfo.visaPrice
this.calcMoney()
this.getCouponActivityHandler(res.data)
}
},
(err) => {
......@@ -873,6 +914,28 @@
}
);
},
getUserVipInfo(lineId){
const parameter = {
VipCusType:1,
CustomerId:this.customer.customerId
}
// #ifdef MP-DI
parameter.VipCusType = 2
// #endif
this.apipost( "vip_post_CheckCustomerIsVip", parameter,(r) => {
const v = r.data
v.FinishOrderCount=2
if(v.FinishOrderCount >= v.OrderCount){
let rule = v.RuleList.find(x=>x.LineId==lineId)
if(!rule) rule = v.RuleList.find(x=>x.LineId==0)
if(rule) {
this.userVipRights = rule
}
this.calcVipDisscountHandle()
}
})
},
getCouponActivityHandler(d) {
uni.hideLoading();
let msg = {
......@@ -1111,6 +1174,7 @@
MiniAppUserId: MiniAppUserId,
CreateBy: CreateBy, //同行联系人创建人 CustomerCreateBy
DirectCustomerId: DirectCustomerId, //直客Id
DisValue: this.vipDiscountMoney,
// #ifdef MP-DI
OrderSource: 7,
// #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment