Commit 5107fca7559cbb16834194c5ad728894e166c2df
1 parent
f190f75f
默认取货方式是同城配送的优化
Showing
2 changed files
with
74 additions
and
16 deletions
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -150,6 +150,8 @@ Page({ |
150 | 150 | coll_prom:{}, //搭配活动存储 |
151 | 151 | yh_is_xz_yh:{},//优惠促销优惠券使用开关 |
152 | 152 | |
153 | + same_ok:1, //同城配送的控制,默认ok | |
154 | + | |
153 | 155 | }, |
154 | 156 | onLoad: function (t) { |
155 | 157 | |
... | ... | @@ -267,6 +269,9 @@ Page({ |
267 | 269 | //先获取是否有关闭使用优惠券 |
268 | 270 | getApp().getConfig2(function (ee) { |
269 | 271 | var json_d = JSON.parse(ee.switch_list); |
272 | + //测试强行写死,后面一定要删除 | |
273 | + json_d.pickupway=2; | |
274 | + | |
270 | 275 | th.data.json_d = json_d; |
271 | 276 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
272 | 277 | var is_default_logistics = json_d.is_default_logistics; |
... | ... | @@ -1229,7 +1234,12 @@ Page({ |
1229 | 1234 | return e.is_same_city != 1 || e.whsle_id > 0 |
1230 | 1235 | }) |
1231 | 1236 | if (!fd || fd.length == 0) { |
1232 | - arr[ik].show_same_city = 1; | |
1237 | + arr[ik].show_same_city = 1; | |
1238 | + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 2) { | |
1239 | + arr[ik].exp_type=2; | |
1240 | + th.setData({ is_all_zt: 0 }); | |
1241 | + } | |
1242 | + | |
1233 | 1243 | } |
1234 | 1244 | } |
1235 | 1245 | } |
... | ... | @@ -1331,6 +1341,11 @@ Page({ |
1331 | 1341 | et = 0; |
1332 | 1342 | break; |
1333 | 1343 | } |
1344 | + | |
1345 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | |
1346 | + et = 2; | |
1347 | + } | |
1348 | + | |
1334 | 1349 | var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
1335 | 1350 | |
1336 | 1351 | if (et == 0 && def_exp_code && !th.data.is_default_logistics) { |
... | ... | @@ -2104,6 +2119,9 @@ Page({ |
2104 | 2119 | }) |
2105 | 2120 | //-- to.getwuliuprice(async function (rs) { -- |
2106 | 2121 | |
2122 | + th.data.lon=0; | |
2123 | + th.data.lat=0; | |
2124 | + | |
2107 | 2125 | //是不是区域包邮 |
2108 | 2126 | th.data.is_area_by = 0; |
2109 | 2127 | //当不是区域不包邮的时候,没有不包邮商品的时候 |
... | ... | @@ -2714,7 +2732,10 @@ Page({ |
2714 | 2732 | } |
2715 | 2733 | } |
2716 | 2734 | }) |
2717 | - if (!is_next) return false | |
2735 | + if (!is_next) { | |
2736 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | |
2737 | + return false | |
2738 | + } | |
2718 | 2739 | } |
2719 | 2740 | |
2720 | 2741 | //预存金额使用参与计算 |
... | ... | @@ -2938,6 +2959,10 @@ Page({ |
2938 | 2959 | [atxt11]: all_pre_json, |
2939 | 2960 | [atxt12]: all_yck_arr, |
2940 | 2961 | }) |
2962 | + | |
2963 | + th.data.lon=lon; | |
2964 | + th.data.lat=lat; | |
2965 | + | |
2941 | 2966 | th.data.order_prom_list_cart = c_arr; |
2942 | 2967 | th.set_can_num(); |
2943 | 2968 | wx.hideLoading(); |
... | ... | @@ -3006,6 +3031,8 @@ Page({ |
3006 | 3031 | var cut_price = 0; |
3007 | 3032 | var allpice1 = allpice; |
3008 | 3033 | |
3034 | + th.data.lon=0; | |
3035 | + th.data.lat=0; | |
3009 | 3036 | |
3010 | 3037 | if (good.prom_type == 3 && good.prom_price !== null) { |
3011 | 3038 | cut_price = allpice - good.prom_price; |
... | ... | @@ -3493,7 +3520,13 @@ Page({ |
3493 | 3520 | |
3494 | 3521 | } |
3495 | 3522 | }) |
3496 | - if (!is_next) return false | |
3523 | + if (!is_next){ | |
3524 | + th.setData({show_submit:1,same_ok:0,submit: 0}) | |
3525 | + return false | |
3526 | + } | |
3527 | + th.data.lon=lon; | |
3528 | + th.data.lat=lat; | |
3529 | + | |
3497 | 3530 | } |
3498 | 3531 | |
3499 | 3532 | |
... | ... | @@ -3765,7 +3798,7 @@ Page({ |
3765 | 3798 | var ff = true; |
3766 | 3799 | //------------立即购买------------- |
3767 | 3800 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { |
3768 | - if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { | |
3801 | + if ( [0,2].indexOf(th.data.bn_exp_typ) == -1 && th.data.user_addr == null) { | |
3769 | 3802 | ff = false; |
3770 | 3803 | getApp().my_warnning("请选择收货地址", 0, th); |
3771 | 3804 | th.data.is_summit_ing = 0; |
... | ... | @@ -3816,6 +3849,12 @@ Page({ |
3816 | 3849 | item.use_commission = th.data.bn_goods.use_commission; |
3817 | 3850 | } |
3818 | 3851 | |
3852 | + if(th.data.lon && item.exp_type==2){ | |
3853 | + item.lon=th.data.lon; | |
3854 | + item.lat=th.data.lat; | |
3855 | + } | |
3856 | + | |
3857 | + | |
3819 | 3858 | //获取立即购买的商品的信息 |
3820 | 3859 | var gg = to.get_b_now(); |
3821 | 3860 | //--商品的房间号-- |
... | ... | @@ -3823,7 +3862,6 @@ Page({ |
3823 | 3862 | item.room_ids = gg.room_id; |
3824 | 3863 | } |
3825 | 3864 | //群id |
3826 | - | |
3827 | 3865 | if(gg.groupchat_id && gg.groupchat_id!='undefined'){ |
3828 | 3866 | item.groupchat_ids=gg.groupchat_id; |
3829 | 3867 | } |
... | ... | @@ -4117,6 +4155,11 @@ Page({ |
4117 | 4155 | item.use_commission = t_item.can_usecommise; |
4118 | 4156 | } |
4119 | 4157 | |
4158 | + if(th.data.lon && item.exp_type==2){ | |
4159 | + item.lon=th.data.lon; | |
4160 | + item.lat=th.data.lat; | |
4161 | + } | |
4162 | + | |
4120 | 4163 | var order_prom_list = {}; |
4121 | 4164 | //--判断有没有优惠活动-- |
4122 | 4165 | if (t_item.order_prom_amount > 0) { |
... | ... | @@ -6285,7 +6328,7 @@ Page({ |
6285 | 6328 | setexptype2: function (e) { |
6286 | 6329 | |
6287 | 6330 | if(this.data.submit) return false; |
6288 | - this.setData({ submit: 1 }); | |
6331 | + this.setData({ submit: 1,same_ok:1 }); | |
6289 | 6332 | |
6290 | 6333 | if(this.data.all_collocation_list){ |
6291 | 6334 | var bn_coll= this.selectComponent('#bn_coll'); |
... | ... | @@ -6304,7 +6347,7 @@ Page({ |
6304 | 6347 | setexptype_w2: function (e) { |
6305 | 6348 | |
6306 | 6349 | if(this.data.submit) return false; |
6307 | - this.setData({ submit: 1 }); | |
6350 | + this.setData({ submit: 1,same_ok:1 }); | |
6308 | 6351 | |
6309 | 6352 | for (let i = 0; i <this.data.cartlist.length ; i++) { |
6310 | 6353 | |
... | ... | @@ -6787,14 +6830,21 @@ Page({ |
6787 | 6830 | } |
6788 | 6831 | |
6789 | 6832 | }else{ |
6790 | - if(item.distr_type==1){ | |
6791 | - wx.showToast({ | |
6792 | - title: "商品的配送方式不一致", | |
6793 | - icon: 'none', | |
6794 | - duration: 2000 | |
6795 | - }) | |
6796 | - th.setData({ submit: 0 }); | |
6797 | - return false; | |
6833 | + | |
6834 | + if(this.data.bn_exp_type==2){ | |
6835 | + | |
6836 | + | |
6837 | + | |
6838 | + }else{ | |
6839 | + if(item.distr_type==1){ | |
6840 | + wx.showToast({ | |
6841 | + title: "商品的配送方式不一致", | |
6842 | + icon: 'none', | |
6843 | + duration: 2000 | |
6844 | + }) | |
6845 | + th.setData({ submit: 0 }); | |
6846 | + return false; | |
6847 | + } | |
6798 | 6848 | } |
6799 | 6849 | } |
6800 | 6850 | |
... | ... | @@ -6977,6 +7027,13 @@ Page({ |
6977 | 7027 | et = 0; th.setData({ is_all_zt: 0 }); |
6978 | 7028 | } |
6979 | 7029 | |
7030 | + //-- 如果是同城配送和默认同城配送的时候 -- | |
7031 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2) { | |
7032 | + et = 2; th.setData({ is_all_zt: 0 }); | |
7033 | + } | |
7034 | + | |
7035 | + | |
7036 | + | |
6980 | 7037 | var m_wind = th.data.m_wind; |
6981 | 7038 | var ie = { |
6982 | 7039 | pickup_id: gg.pick_id, | ... | ... |
packageE/pages/cart/cart2/cart2.wxml
... | ... | @@ -599,7 +599,8 @@ |
599 | 599 | <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view> |
600 | 600 | <!-- <view class="co-red big"></view> --> |
601 | 601 | </view> |
602 | - <button class="tips-btn" formType="submit" id="submitOrder" disabled="{{submit}}" bindtap="requestSubscribe">提交订单</button> | |
602 | + <button class="tips-btn" formType="submit" id="submitOrder" | |
603 | + disabled="{{submit || !same_ok}}" bindtap="requestSubscribe">提交订单</button> | |
603 | 604 | </view> |
604 | 605 | </form> |
605 | 606 | ... | ... |