Commit 45f64077 authored by youjie's avatar youjie

优惠券 满足人数

parent 9792e5ac
......@@ -183,8 +183,10 @@
</view>
</view>
<coupon v-if="couponList.length > 0 && showCoupon" :price="price" :list="couponList" :current="useCouponId"
@close="closeCouponHandler"></coupon>
<coupon v-if="couponList.length > 0 && showCoupon" :price="price" :list="couponList"
: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-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>
......@@ -585,6 +587,7 @@
},
guestChangeHandle(val) {
this.guest = val ? val : []
this.calcMaxCouponHandle()
},
closeCouponHandler(e) {
this.useCouponId = []
......@@ -636,19 +639,20 @@
let discount = 0
const money = this.price
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
maxCouponId = x.id
}
if(x.couponsType==2){
let disMoney = money*(1-x.denomination)
if(discount<disMoney){
if(discount<disMoney&&this.guest.length>=x.orderGuestNum){
discount=disMoney
maxCouponId = x.id
}
}
})
if(maxCouponId>0) this.closeCouponHandler([maxCouponId])
else this.closeCouponHandler([-1])
}
},
usePzCouponHandler() {
......
......@@ -10,7 +10,7 @@
}]">
<view class="title" style="position: relative;">
<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 }}
</view>
</view>
......
......@@ -10,7 +10,7 @@
}]">
<view class="title" style="position: relative;">
<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 }}
</view>
</view>
......
......@@ -663,7 +663,11 @@
<view class="empty-block"></view>
</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 class="big-title">
<text>重要提示</text>
......@@ -932,6 +936,7 @@
this.orderMsg.AdultPeopleNum++;
}
this.calcMoney()
this.calcMaxCouponHandle()
},
//市
getCity() {
......@@ -1112,19 +1117,20 @@
let discount = 0
const money = this.price
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
maxCouponId = x.id
}
if(x.couponsType==2){
let disMoney = money*(1-x.denomination)
if(discount<disMoney){
if(discount<disMoney&&this.orderMsg.AdultPeopleNum>=x.orderGuestNum){
discount=disMoney
maxCouponId = x.id
}
}
})
if(maxCouponId>0) this.closeCouponHandler([maxCouponId])
else this.closeCouponHandler(-1)
}
},
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