Commit 45f64077 authored by youjie's avatar youjie

优惠券 满足人数

parent 9792e5ac
...@@ -183,8 +183,10 @@ ...@@ -183,8 +183,10 @@
</view> </view>
</view> </view>
<coupon v-if="couponList.length > 0 && showCoupon" :price="price" :list="couponList" :current="useCouponId" <coupon v-if="couponList.length > 0 && showCoupon" :price="price" :list="couponList"
@close="closeCouponHandler"></coupon> :current="useCouponId"
@close="closeCouponHandler"
:numberPeople="guest.length"></coupon>
<u-picker mode="selector" v-model="saleVisable" @confirm="setSaleHandle" :default-selector="[0]" :range="sales" range-key="EmName"></u-picker> <u-picker mode="selector" v-model="saleVisable" @confirm="setSaleHandle" :default-selector="[0]" :range="sales" range-key="EmName"></u-picker>
<u-modal :border-radius="16" @confirm="nativageToOrderHandle" title="订单提醒" content="订单创建成功,请您在6小时内完成付款,否则将会被取消." @cancel="navigatorToHomeHandle" v-model="successVisible" confirm-text='查看订单' cancel-text='返回首页' confirm-color='#DEBF7B' cancel-color='#080A09' :show-cancel-button="true"></u-modal> <u-modal :border-radius="16" @confirm="nativageToOrderHandle" title="订单提醒" content="订单创建成功,请您在6小时内完成付款,否则将会被取消." @cancel="navigatorToHomeHandle" v-model="successVisible" confirm-text='查看订单' cancel-text='返回首页' confirm-color='#DEBF7B' cancel-color='#080A09' :show-cancel-button="true"></u-modal>
</view> </view>
...@@ -585,6 +587,7 @@ ...@@ -585,6 +587,7 @@
}, },
guestChangeHandle(val) { guestChangeHandle(val) {
this.guest = val ? val : [] this.guest = val ? val : []
this.calcMaxCouponHandle()
}, },
closeCouponHandler(e) { closeCouponHandler(e) {
this.useCouponId = [] this.useCouponId = []
...@@ -636,19 +639,20 @@ ...@@ -636,19 +639,20 @@
let discount = 0 let discount = 0
const money = this.price const money = this.price
this.couponList.forEach(x=>{ this.couponList.forEach(x=>{
if(x.couponsType==1 && x.denomination>discount) { if(x.couponsType==1 && x.denomination>discount&&this.guest.length>=x.orderGuestNum) {
discount=x.denomination discount=x.denomination
maxCouponId = x.id maxCouponId = x.id
} }
if(x.couponsType==2){ if(x.couponsType==2){
let disMoney = money*(1-x.denomination) let disMoney = money*(1-x.denomination)
if(discount<disMoney){ if(discount<disMoney&&this.guest.length>=x.orderGuestNum){
discount=disMoney discount=disMoney
maxCouponId = x.id maxCouponId = x.id
} }
} }
}) })
if(maxCouponId>0) this.closeCouponHandler([maxCouponId]) if(maxCouponId>0) this.closeCouponHandler([maxCouponId])
else this.closeCouponHandler([-1])
} }
}, },
usePzCouponHandler() { usePzCouponHandler() {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
}]"> }]">
<view class="title" style="position: relative;"> <view class="title" style="position: relative;">
<u-icon name="arrow-left" size="38" color="#000" <u-icon name="arrow-left" size="38" color="#000"
style="position: absolute;left: 32rpx;top:20rpx"></u-icon> style="position: absolute;left: 32rpx;top:20rpx;z-index: 2;" @click="goBack"></u-icon>
{{ pageTitle }} {{ pageTitle }}
</view> </view>
</view> </view>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
}]"> }]">
<view class="title" style="position: relative;"> <view class="title" style="position: relative;">
<u-icon name="arrow-left" size="38" color="#000" <u-icon name="arrow-left" size="38" color="#000"
style="position: absolute;left: 32rpx;top:20rpx"></u-icon> style="position: absolute;left: 32rpx;top:20rpx;z-index: 2;" @click="goBack"></u-icon>
{{ pageTitle }} {{ pageTitle }}
</view> </view>
</view> </view>
......
...@@ -663,7 +663,11 @@ ...@@ -663,7 +663,11 @@
<view class="empty-block"></view> <view class="empty-block"></view>
</template> </template>
<coupon v-if="couponList.length > 0 && showCoupon" :price="price" :list="couponList" :current="useCouponIds" @close="closeCouponHandler" :current-price="realCurrentPriceInfo" :order="orderMsg"></coupon> <coupon v-if="couponList.length > 0 && showCoupon" :price="price"
:list="couponList" :current="useCouponIds"
@close="closeCouponHandler" :current-price="realCurrentPriceInfo"
:order="orderMsg"
:numberPeople="orderMsg.AdultPeopleNum"></coupon>
<view style="padding: 50rpx 40rpx;background: #fff;" v-if="tips != ''&&tips!=null"> <view style="padding: 50rpx 40rpx;background: #fff;" v-if="tips != ''&&tips!=null">
<view class="big-title"> <view class="big-title">
<text>重要提示</text> <text>重要提示</text>
...@@ -932,6 +936,7 @@ ...@@ -932,6 +936,7 @@
this.orderMsg.AdultPeopleNum++; this.orderMsg.AdultPeopleNum++;
} }
this.calcMoney() this.calcMoney()
this.calcMaxCouponHandle()
}, },
//市 //市
getCity() { getCity() {
...@@ -1112,19 +1117,20 @@ ...@@ -1112,19 +1117,20 @@
let discount = 0 let discount = 0
const money = this.price const money = this.price
this.couponList.forEach(x=>{ this.couponList.forEach(x=>{
if(x.couponsType==1 && x.denomination>discount) { if(x.couponsType==1 && x.denomination>discount&&this.orderMsg.AdultPeopleNum>=x.orderGuestNum) {
discount=x.denomination discount=x.denomination
maxCouponId = x.id maxCouponId = x.id
} }
if(x.couponsType==2){ if(x.couponsType==2){
let disMoney = money*(1-x.denomination) let disMoney = money*(1-x.denomination)
if(discount<disMoney){ if(discount<disMoney&&this.orderMsg.AdultPeopleNum>=x.orderGuestNum){
discount=disMoney discount=disMoney
maxCouponId = x.id maxCouponId = x.id
} }
} }
}) })
if(maxCouponId>0) this.closeCouponHandler([maxCouponId]) if(maxCouponId>0) this.closeCouponHandler([maxCouponId])
else this.closeCouponHandler(-1)
} }
}, },
usePzCouponHandler(){ usePzCouponHandler(){
......
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