Commit 3f4f6cf43bbe605742e89a1f88b8eea3f2465b7b
1 parent
41898588
同城配送的bug优化2条
Showing
2 changed files
with
45 additions
and
20 deletions
pages/cart/cart2/cart2.js
@@ -1510,7 +1510,7 @@ Page({ | @@ -1510,7 +1510,7 @@ Page({ | ||
1510 | }, | 1510 | }, |
1511 | 1511 | ||
1512 | //-------------------计算订单价格------------------- | 1512 | //-------------------计算订单价格------------------- |
1513 | - calculatePrice:async function (t, s) { | 1513 | + calculatePrice:async function (qfunc) { |
1514 | var th = this; | 1514 | var th = this; |
1515 | th.setData({submit:1}); | 1515 | th.setData({submit:1}); |
1516 | 1516 | ||
@@ -1953,7 +1953,7 @@ Page({ | @@ -1953,7 +1953,7 @@ Page({ | ||
1953 | 1953 | ||
1954 | 1954 | ||
1955 | var req_data={ | 1955 | var req_data={ |
1956 | - store_id:os.stoid, order_amount:o_condition, | 1956 | + store_id:os.stoid, order_amount:t_o_condition, |
1957 | lon:lon,lat:lat, pickup_id:c_arr[i].pickup_id, goods_weight:gd_w | 1957 | lon:lon,lat:lat, pickup_id:c_arr[i].pickup_id, goods_weight:gd_w |
1958 | } | 1958 | } |
1959 | var is_next=1; | 1959 | var is_next=1; |
@@ -1964,11 +1964,15 @@ Page({ | @@ -1964,11 +1964,15 @@ Page({ | ||
1964 | cart_item.shipping_price = res.data.data; | 1964 | cart_item.shipping_price = res.data.data; |
1965 | }else{ | 1965 | }else{ |
1966 | is_next=0; | 1966 | is_next=0; |
1967 | - wx.showToast({ | ||
1968 | - title: res.data.msg, | ||
1969 | - icon: 'none', | ||
1970 | - duration: 2000 | ||
1971 | - }) | 1967 | + |
1968 | + if(qfunc) qfunc(); | ||
1969 | + else{ | ||
1970 | + wx.showToast({ | ||
1971 | + title: res.data.msg, | ||
1972 | + icon: 'none', | ||
1973 | + duration: 2000 | ||
1974 | + }) | ||
1975 | + } | ||
1972 | } | 1976 | } |
1973 | }) | 1977 | }) |
1974 | if(!is_next) return false | 1978 | if(!is_next) return false |
@@ -2136,7 +2140,7 @@ Page({ | @@ -2136,7 +2140,7 @@ Page({ | ||
2136 | 2140 | ||
2137 | 2141 | ||
2138 | //---------计算立即购买---------- | 2142 | //---------计算立即购买---------- |
2139 | - calculatePrice2: async function () { | 2143 | + calculatePrice2: async function (qfunc) { |
2140 | var th = this, good = this.data.bn_goods; | 2144 | var th = this, good = this.data.bn_goods; |
2141 | 2145 | ||
2142 | if (!good) return false; | 2146 | if (!good) return false; |
@@ -2455,18 +2459,20 @@ Page({ | @@ -2455,18 +2459,20 @@ Page({ | ||
2455 | is_json: 1,data: req_data | 2459 | is_json: 1,data: req_data |
2456 | }).then(res => { | 2460 | }).then(res => { |
2457 | if (res.data.code == 0) { | 2461 | if (res.data.code == 0) { |
2458 | - | ||
2459 | - | ||
2460 | var wl_txt = "formData.shipping_price"; | 2462 | var wl_txt = "formData.shipping_price"; |
2461 | th.setData({ [wl_txt]: res.data.data, }) | 2463 | th.setData({ [wl_txt]: res.data.data, }) |
2462 | 2464 | ||
2463 | }else{ | 2465 | }else{ |
2464 | is_next=0; | 2466 | is_next=0; |
2465 | - wx.showToast({ | ||
2466 | - title: res.data.msg, | ||
2467 | - icon: 'none', | ||
2468 | - duration: 2000 | ||
2469 | - }) | 2467 | + if(qfunc){ |
2468 | + qfunc(); | ||
2469 | + }else{ | ||
2470 | + wx.showToast({ | ||
2471 | + title: res.data.msg, | ||
2472 | + icon: 'none', | ||
2473 | + duration: 2000 | ||
2474 | + }) | ||
2475 | + } | ||
2470 | 2476 | ||
2471 | } | 2477 | } |
2472 | }) | 2478 | }) |
@@ -3907,7 +3913,9 @@ Page({ | @@ -3907,7 +3913,9 @@ Page({ | ||
3907 | }, | 3913 | }, |
3908 | 3914 | ||
3909 | //----把券插入之后的操作,同时还要重新计算价格---- | 3915 | //----把券插入之后的操作,同时还要重新计算价格---- |
3910 | - insert_into_using_quan: function (item, using_quan, pickid, isby) { | 3916 | + insert_into_using_quan:async function (item, using_quan, pickid, isby) { |
3917 | + | ||
3918 | + | ||
3911 | var th = this; | 3919 | var th = this; |
3912 | if (isby == 1) { | 3920 | if (isby == 1) { |
3913 | using_quan[pickid] = { | 3921 | using_quan[pickid] = { |
@@ -3924,9 +3932,26 @@ Page({ | @@ -3924,9 +3932,26 @@ Page({ | ||
3924 | } | 3932 | } |
3925 | this.setData({ using_quan: using_quan }); | 3933 | this.setData({ using_quan: using_quan }); |
3926 | if (th.data.is_b_now == 1) { | 3934 | if (th.data.is_b_now == 1) { |
3927 | - th.calculatePrice2(); | 3935 | + th.calculatePrice2(function () { |
3936 | + using_quan[pickid]=null; | ||
3937 | + th.setData({ using_quan: using_quan,submit:0 }); | ||
3938 | + wx.showToast({ | ||
3939 | + title: "不能使用优惠券,同城起送价不足", | ||
3940 | + icon: 'none', | ||
3941 | + duration: 2000 | ||
3942 | + }) | ||
3943 | + | ||
3944 | + }); | ||
3928 | } else { | 3945 | } else { |
3929 | - th.calculatePrice(); | 3946 | + th.calculatePrice(function () { |
3947 | + using_quan[pickid]=null; | ||
3948 | + th.setData({ using_quan: using_quan ,submit:0 }); | ||
3949 | + wx.showToast({ | ||
3950 | + title: "不能使用优惠券,同城起送价不足", | ||
3951 | + icon: 'none', | ||
3952 | + duration: 2000 | ||
3953 | + }) | ||
3954 | + }); | ||
3930 | } | 3955 | } |
3931 | th.setData({ open_quan: 0 }); | 3956 | th.setData({ open_quan: 0 }); |
3932 | }, | 3957 | }, |
pages/cart/cart2/cart2.wxml
@@ -166,7 +166,7 @@ | @@ -166,7 +166,7 @@ | ||
166 | </view> | 166 | </view> |
167 | 167 | ||
168 | <!-- 同城配送 --> | 168 | <!-- 同城配送 --> |
169 | - <view data-t='2' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w2" style="display:{{!item.show_same_city?'none':'flex;align-items: center'}};"> | 169 | + <view data-t='2' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w2" style=" margin-left: 5rpx;display:{{!item.show_same_city?'none':'flex;align-items: center'}};"> |
170 | 170 | ||
171 | <block wx:if="{{item.exp_type==2}}"> | 171 | <block wx:if="{{item.exp_type==2}}"> |
172 | <icon data-t='2' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> | 172 | <icon data-t='2' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> |
@@ -182,7 +182,7 @@ | @@ -182,7 +182,7 @@ | ||
182 | 182 | ||
183 | 183 | ||
184 | <!-- 点击显示物流选择,如果是默认使用的情况不成立 --> | 184 | <!-- 点击显示物流选择,如果是默认使用的情况不成立 --> |
185 | - <view wx:if="{{!is_default_logistics && item.exp_type!=1}}" class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;"> | 185 | + <view wx:if="{{!is_default_logistics && item.exp_type!=1 && item.exp_type!=2}}" class="flex-vertical" bindtap="show_wu_arr" data-txt='cartlist[{{pidx}}].wind' data-w_sele_index="{{pidx}}" style="padding-right:6rpx;"> |
186 | <view>{{wu_arr[item.wind].name}}</view> | 186 | <view>{{wu_arr[item.wind].name}}</view> |
187 | <view class="xc-right"></view> | 187 | <view class="xc-right"></view> |
188 | </view> | 188 | </view> |