Commit d0857249 authored by 罗超's avatar 罗超

支持订单使用VIP福利

parent 171a41af
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
this.vipInfo = r.data this.vipInfo = r.data
const v = r.data const v = r.data
this.$emit('setUserOrder',v.FinishOrderCount) 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) let rule = v.RuleList.find(x=>x.LineId==this.lineId)
if(!rule) rule = v.RuleList.find(x=>x.LineId==0) if(!rule) rule = v.RuleList.find(x=>x.LineId==0)
if(rule) { if(rule) {
......
...@@ -386,7 +386,7 @@ ...@@ -386,7 +386,7 @@
</view> </view>
</view> </view>
<view class="form-items" style="border-bottom: none"> <view class="form-items" style="border-bottom: none">
<view class="label"> 明细 </view> <view class="label" style="text-align: left;"> 明细 </view>
</view> </view>
<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index"> <view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index">
<view style="flex: 1"> <view style="flex: 1">
...@@ -464,12 +464,19 @@ ...@@ -464,12 +464,19 @@
<view style="text-align: right"> <view style="text-align: right">
{{currentCoupon.discountMoney}}</view> {{currentCoupon.discountMoney}}</view>
</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 class="flex f12 grey" style="margin-bottom: 40rpx">
<view style="flex: 1"> <view style="flex: 1">
<text style="margin-right: 30rpx">小计</text> <text style="margin-right: 30rpx">小计</text>
</view> </view>
<view style="text-align: right"> <view style="text-align: right">
¥{{parseFloat((price-currentCoupon.discountMoney)).toFixed(2)}}</view> ¥{{parseFloat((price-currentCoupon.discountMoney-vipDiscountMoney)).toFixed(2)}}</view>
</view> </view>
<view class="f12" style="color:#ff3166;margin-bottom: 40rpx" v-if="activity && activity.Id"> <view class="f12" style="color:#ff3166;margin-bottom: 40rpx" v-if="activity && activity.Id">
...@@ -495,7 +502,7 @@ ...@@ -495,7 +502,7 @@
<view style="color: #ff3166; font-weight: bold"> <view style="color: #ff3166; font-weight: bold">
<text style="font-size: 22rpx">¥</text> <text style="font-size: 22rpx">¥</text>
<text style="font-size: 40rpx; margin: 0 20rpx 0 5rpx;font-family: nav-font;">{{ <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>
<text style="color: #6e6e6e; font-size: 24rpx;font-family: microsoft yahei ui light;">共计{{ total }}</text> <text style="color: #6e6e6e; font-size: 24rpx;font-family: microsoft yahei ui light;">共计{{ total }}</text>
</view> </view>
...@@ -594,6 +601,8 @@ ...@@ -594,6 +601,8 @@
showPz:false, showPz:false,
pzCoupon:null, pzCoupon:null,
userInfo: {}, userInfo: {},
userVipRights:null,
vipDiscountMoney:0
}; };
}, },
created() { created() {
...@@ -763,6 +772,7 @@ ...@@ -763,6 +772,7 @@
this.useCouponIds = [] this.useCouponIds = []
} }
this.showCoupon = false; this.showCoupon = false;
this.calcVipDisscountHandle()
}, },
getUserCouponList() { getUserCouponList() {
let couponParams = { let couponParams = {
...@@ -779,7 +789,6 @@ ...@@ -779,7 +789,6 @@
// #endif // #endif
"TCID": this.currentPriceInfo.tcid, "TCID": this.currentPriceInfo.tcid,
} }
console.log("this.currentPriceInfo", this.currentPriceInfo);
if (this.currentPriceInfo.teamType == "0") { if (this.currentPriceInfo.teamType == "0") {
//跟团游 //跟团游
couponParams.CouponsUseScope = 2; couponParams.CouponsUseScope = 2;
...@@ -794,12 +803,9 @@ ...@@ -794,12 +803,9 @@
couponParams.lineteamId = this.currentPriceInfo.lineteamId; couponParams.lineteamId = this.currentPriceInfo.lineteamId;
} }
couponParams.userId = this.customer.accountId; couponParams.userId = this.customer.accountId;
console.log("this.customer", this.customer);
console.log("couponParams", couponParams);
this.apipost( this.apipost(
"coupon_post_GetUserCanUseCouponList", couponParams, "coupon_post_GetUserCanUseCouponList", couponParams,
(res) => { (res) => {
console.log("coupon_post_GetUserCanUseCouponList", res);
if (res.resultCode == 1) { if (res.resultCode == 1) {
let arrList = function(list){ let arrList = function(list){
list.forEach(x=>{ list.forEach(x=>{
...@@ -810,13 +816,46 @@ ...@@ -810,13 +816,46 @@
arrList(res.data) arrList(res.data)
this.couponList = res.data this.couponList = res.data
this.calcPzCouponHandler() this.calcPzCouponHandler()
this.calcMaxCouponHandle()
this.getUserVipInfo(this.realCurrentPriceInfo.lineId)
} }
}, },
(err) => { (err) => {}
console.log("coupon_post_GetUserCanUseCouponList_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(){ usePzCouponHandler(){
this.showPz = false this.showPz = false
this.closeCouponHandler([this.pzCoupon.id]) this.closeCouponHandler([this.pzCoupon.id])
...@@ -863,9 +902,11 @@ ...@@ -863,9 +902,11 @@
this.realCurrentPriceInfo = res.data.currentPriceInfo this.realCurrentPriceInfo = res.data.currentPriceInfo
this.tips = res.data.feature.importantTipText; this.tips = res.data.feature.importantTipText;
this.ltName = res.data.ltName; this.ltName = res.data.ltName;
this.realCurrentPriceInfo.lineId = res.data.lineId
this.currentPriceInfo.visaPrice = res.data.currentPriceInfo.visaPrice this.currentPriceInfo.visaPrice = res.data.currentPriceInfo.visaPrice
this.calcMoney() this.calcMoney()
this.getCouponActivityHandler(res.data) this.getCouponActivityHandler(res.data)
} }
}, },
(err) => { (err) => {
...@@ -873,6 +914,28 @@ ...@@ -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) { getCouponActivityHandler(d) {
uni.hideLoading(); uni.hideLoading();
let msg = { let msg = {
...@@ -1111,6 +1174,7 @@ ...@@ -1111,6 +1174,7 @@
MiniAppUserId: MiniAppUserId, MiniAppUserId: MiniAppUserId,
CreateBy: CreateBy, //同行联系人创建人 CustomerCreateBy CreateBy: CreateBy, //同行联系人创建人 CustomerCreateBy
DirectCustomerId: DirectCustomerId, //直客Id DirectCustomerId: DirectCustomerId, //直客Id
DisValue: this.vipDiscountMoney,
// #ifdef MP-DI // #ifdef MP-DI
OrderSource: 7, OrderSource: 7,
// #endif // #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