Commit bd0687e835fe4f287bda52797c79d00e6be0bace

Authored by yiren
1 parent 6bbe95d2

优惠券加字段 剩余数量

@@ -97,6 +97,22 @@ Page({ @@ -97,6 +97,22 @@ Page({
97 }, 97 },
98 // 提交订单 98 // 提交订单
99 submitOrder() { 99 submitOrder() {
  100 + if(this.data.detail.grant_num==this.data.num || this.data.detail.grant_num=='0'){
  101 + return wx.showToast({
  102 + title:'您来晚了,当前优惠券已经售罄,请与商家联系!',
  103 + duration:2000,
  104 + mask:true,
  105 + icon:'none'
  106 + })
  107 + }
  108 + if(this.data.num=='0'){
  109 + return wx.showToast({
  110 + title:'最少需要购买一个!',
  111 + duration:2000,
  112 + mask:true,
  113 + icon:'none'
  114 + })
  115 + }
100 console.log('oidoid',this.data.opt.oid); 116 console.log('oidoid',this.data.opt.oid);
101 let detail=this.data.detail 117 let detail=this.data.detail
102 detail.name=this.data.opt.name; 118 detail.name=this.data.opt.name;
@@ -59,6 +59,14 @@ @@ -59,6 +59,14 @@
59 <text wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}" class="info info_right text_info font32r text_info1" > 59 <text wx:if="{{exp_date.is_week=='1' || exp_date.is_week===true}}" class="info info_right text_info font32r text_info1" >
60 {{exp_date.week_show?exp_date.week_show:''}} 60 {{exp_date.week_show?exp_date.week_show:''}}
61 </text> 61 </text>
  62 + <view class="info" wx:if="{{detail.grant_num}}">
  63 + <view class="info_left font32r">
  64 + 剩余数量:
  65 + </view>
  66 + <view class="info_right text_info font32r">
  67 + {{detail.grant_num}}
  68 + </view>
  69 + </view>
62 <view wx:if="{{detail.explain}}" class="info"> 70 <view wx:if="{{detail.explain}}" class="info">
63 <view class="info_left font32r"> 71 <view class="info_left font32r">
64 券说明 72 券说明
@@ -74,6 +82,6 @@ @@ -74,6 +82,6 @@
74 <view class="content font24r"> 82 <view class="content font24r">
75 总计:<text>¥{{totalize}}</text>元 83 总计:<text>¥{{totalize}}</text>元
76 </view> 84 </view>
77 - <button class="font32r btns" bindtap="submitOrder">提交订单 85 + <button class="font32r {{detail.grant_num=='0' || detail.grant_num==num?'btns btnsDisabled':'btns'}}" bindtap="submitOrder">提交订单
78 </button> 86 </button>
79 </view> 87 </view>
@@ -133,4 +133,8 @@ page { @@ -133,4 +133,8 @@ page {
133 padding: 0 56rpx; 133 padding: 0 56rpx;
134 color: #fff; 134 color: #fff;
135 background: linear-gradient(104.24deg, #4c8dad -57.47%, #0143a3 55.72%, #42a5ff 148.72%); 135 background: linear-gradient(104.24deg, #4c8dad -57.47%, #0143a3 55.72%, #42a5ff 148.72%);
  136 +}
  137 +.btnsDisabled{
  138 + background: #999999 !important;
  139 + color: #fff !important;
136 } 140 }
@@ -89,6 +89,7 @@ Page({ @@ -89,6 +89,7 @@ Page({
89 duration: 1000, 89 duration: 1000,
90 icon:'none', 90 icon:'none',
91 success: function () { 91 success: function () {
  92 + console.log('支付失败',that.data.opt.types);
92 let url=''; 93 let url='';
93 if(that.data.opt.types=='1'){ 94 if(that.data.opt.types=='1'){
94 url='/pages/customer/detail_owner_invitation_new?id='+that.data.opt.detail.oid; 95 url='/pages/customer/detail_owner_invitation_new?id='+that.data.opt.detail.oid;
@@ -140,9 +141,20 @@ Page({ @@ -140,9 +141,20 @@ Page({
140 duration: 1000, 141 duration: 1000,
141 icon:'none', 142 icon:'none',
142 success: function () { 143 success: function () {
  144 + console.log('支付失败',that.data.opt.types);
  145 + let url='';
  146 + if(that.data.opt.types=='1'){
  147 + url='/pages/customer/detail_owner_invitation_new?id='+that.data.opt.detail.oid;
  148 + }
  149 + if(that.data.opt.types=='2'){
  150 + url='/pack-cookbook/pages/success_new';
  151 + }
  152 + if(that.data.opt.types=='3'){
  153 + url='/pages/reserve/index';
  154 + }
143 setTimeout(function () { 155 setTimeout(function () {
144 wx.reLaunch({ 156 wx.reLaunch({
145 - url: `/pages/customer/detail_owner_invitation_new?id=${that.data.opt.detail.oid}&hasInvitation=1&hasSellerShare=1&tplid=1` 157 + url
146 }) 158 })
147 }, 1000); 159 }, 1000);
148 } 160 }