Commit bb6827bb66988ad68353f4ceedf4e16481b5a51f
1 parent
31033142
提交订单页切换物流方式问题修改
Showing
2 changed files
with
29 additions
and
8 deletions
pages/cart/cart2/cart2.js
@@ -6,6 +6,9 @@ var util_pay = require("../../../utils/pay.js"); | @@ -6,6 +6,9 @@ var util_pay = require("../../../utils/pay.js"); | ||
6 | var zh_calc = require("zh_calculate.js"); | 6 | var zh_calc = require("zh_calculate.js"); |
7 | var ladder_calc = require("ladder_calculate.js"); | 7 | var ladder_calc = require("ladder_calculate.js"); |
8 | 8 | ||
9 | +// 防抖函数用定时器 | ||
10 | +let timer; | ||
11 | + | ||
9 | Page({ | 12 | Page({ |
10 | data: { | 13 | data: { |
11 | url: t.globalData.setting.url, | 14 | url: t.globalData.setting.url, |
@@ -4264,6 +4267,24 @@ Page({ | @@ -4264,6 +4267,24 @@ Page({ | ||
4264 | }) | 4267 | }) |
4265 | 4268 | ||
4266 | }, | 4269 | }, |
4270 | + | ||
4271 | + | ||
4272 | + | ||
4273 | + setexptype2: function(e) { | ||
4274 | + this.debounce(this.setexptype.bind(this, e),400)(); | ||
4275 | + }, | ||
4276 | + | ||
4277 | + setexptype_w2: function(e) { | ||
4278 | + this.debounce(this.setexptype_w.bind(this, e),400)(); | ||
4279 | + }, | ||
4280 | + | ||
4281 | + // 函数防抖 | ||
4282 | + debounce: function (func, wait) { | ||
4283 | + return () => { | ||
4284 | + clearTimeout(timer); | ||
4285 | + timer = setTimeout(func, wait); | ||
4286 | + }; | ||
4287 | + }, | ||
4267 | 4288 | ||
4268 | 4289 | ||
4269 | }); | 4290 | }); |
pages/cart/cart2/cart2.wxml
@@ -9,10 +9,10 @@ | @@ -9,10 +9,10 @@ | ||
9 | <block wx:if="{{is_b_now==1}}"> | 9 | <block wx:if="{{is_b_now==1}}"> |
10 | <view class="tab-container"> | 10 | <view class="tab-container"> |
11 | <view class="tab-wrapper"> | 11 | <view class="tab-wrapper"> |
12 | - <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}" | 12 | + <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype2' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}" |
13 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> | 13 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> |
14 | 14 | ||
15 | - <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" | 15 | + <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype2' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" |
16 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> | 16 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> |
17 | 17 | ||
18 | </view> | 18 | </view> |
@@ -22,10 +22,10 @@ | @@ -22,10 +22,10 @@ | ||
22 | <block wx:if="{{is_b_now==0 && cartlist.length==1}}"> | 22 | <block wx:if="{{is_b_now==0 && cartlist.length==1}}"> |
23 | <view class="tab-container"> | 23 | <view class="tab-container"> |
24 | <view class="tab-wrapper"> | 24 | <view class="tab-wrapper"> |
25 | - <view hidden="{{cartlist[0].distr_t==2}}" bindtap='setexptype_w' data-ind="0" data-t='1' class="tab {{cartlist[0].exp_type == 1? 'active':''}}" | 25 | + <view hidden="{{cartlist[0].distr_t==2}}" bindtap='setexptype_w2' data-ind="0" data-t='1' class="tab {{cartlist[0].exp_type == 1? 'active':''}}" |
26 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> | 26 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> |
27 | 27 | ||
28 | - <view hidden="{{cartlist[0].distr_t==1}}" bindtap='setexptype_w' data-ind="0" data-t='0' class="tab {{cartlist[0].exp_type== 0 ? 'active':''}}" | 28 | + <view hidden="{{cartlist[0].distr_t==1}}" bindtap='setexptype_w2' data-ind="0" data-t='0' class="tab {{cartlist[0].exp_type== 0 ? 'active':''}}" |
29 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> | 29 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> |
30 | 30 | ||
31 | </view> | 31 | </view> |
@@ -145,7 +145,7 @@ | @@ -145,7 +145,7 @@ | ||
145 | <!-- 当是物流很多单的时候 --> | 145 | <!-- 当是物流很多单的时候 --> |
146 | <view class="use-item flex-space-between" wx:if="{{cartlist.length>1}}"> | 146 | <view class="use-item flex-space-between" wx:if="{{cartlist.length>1}}"> |
147 | <view class="flex-vertical" > | 147 | <view class="flex-vertical" > |
148 | - <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' | 148 | + <view bindtap='setexptype_w2' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' |
149 | style="padding-right:26rpx;display:{{item.distr_t==2?'none':'flex;align-items: center'}};"> | 149 | style="padding-right:26rpx;display:{{item.distr_t==2?'none':'flex;align-items: center'}};"> |
150 | <!-- <icon bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==1?'red':'gray'}}" size="16" type="success"></icon> --> | 150 | <!-- <icon bindtap='setexptype_w' data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==1?'red':'gray'}}" size="16" type="success"></icon> --> |
151 | 151 | ||
@@ -156,10 +156,10 @@ | @@ -156,10 +156,10 @@ | ||
156 | <block wx:else> | 156 | <block wx:else> |
157 | <view class="circle xc-hookts on"></view> | 157 | <view class="circle xc-hookts on"></view> |
158 | </block> | 158 | </block> |
159 | - <view bindtap='setexptype_w' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">门店自提</view> | 159 | + <view bindtap='setexptype_w2' data-ind="{{pidx}}" data-t='1' data-txt='cartlist[{{pidx}}].exp_type' class="yu_er">门店自提</view> |
160 | </view> | 160 | </view> |
161 | 161 | ||
162 | - <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w" style="display:{{item.distr_t==1?'none':'flex;align-items: center'}};"> | 162 | + <view data-t='0' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w2" style="display:{{item.distr_t==1?'none':'flex;align-items: center'}};"> |
163 | <!-- <icon bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==0?'red':'gray'}}" size="16" type="success"></icon> --> | 163 | <!-- <icon bindtap='setexptype_w' data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="{{item.exp_type==0?'red':'gray'}}" size="16" type="success"></icon> --> |
164 | <block wx:if="{{item.exp_type==0}}"> | 164 | <block wx:if="{{item.exp_type==0}}"> |
165 | <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> | 165 | <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> |
@@ -169,7 +169,7 @@ | @@ -169,7 +169,7 @@ | ||
169 | <view class="circle xc-hookts on"></view> | 169 | <view class="circle xc-hookts on"></view> |
170 | </block> | 170 | </block> |
171 | 171 | ||
172 | - <view bindtap='setexptype_w' data-t='0' data-ind="{{pidx}}" data-txt='cartlist[{{pidx}}].exp_type' data-wl_txt='cartlist[{{pidx}}].wind' | 172 | + <view bindtap='setexptype_w2' data-t='0' data-ind="{{pidx}}" data-txt='cartlist[{{pidx}}].exp_type' data-wl_txt='cartlist[{{pidx}}].wind' |
173 | class="yu_er">快递邮寄</view> | 173 | class="yu_er">快递邮寄</view> |
174 | </view> | 174 | </view> |
175 | </view> | 175 | </view> |