Commit 2cf04b9f404dba09a4c5ed669fe39469fd40f3d8
1 parent
5107fca7
默认取货门店优化
Showing
10 changed files
with
187 additions
and
31 deletions
packageC/pages/presell/cart/cart.js
@@ -117,7 +117,9 @@ Page({ | @@ -117,7 +117,9 @@ Page({ | ||
117 | order_id: '', | 117 | order_id: '', |
118 | exp_price:0, | 118 | exp_price:0, |
119 | order_prom_amount:0, | 119 | order_prom_amount:0, |
120 | - paying:0 | 120 | + paying:0, |
121 | + | ||
122 | + same_ok:1 | ||
121 | }, | 123 | }, |
122 | onLoad: function (t) { | 124 | onLoad: function (t) { |
123 | 125 | ||
@@ -516,7 +518,7 @@ Page({ | @@ -516,7 +518,7 @@ Page({ | ||
516 | //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | 518 | //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- |
517 | if(goods.is_same_city && th.data.is_same_city && goods.whsle_id<=0){ | 519 | if(goods.is_same_city && th.data.is_same_city && goods.whsle_id<=0){ |
518 | 520 | ||
519 | - getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ | 521 | + await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ |
520 | if(res.data.code==0){ | 522 | if(res.data.code==0){ |
521 | var pk=res.data.data; | 523 | var pk=res.data.data; |
522 | if(pk && pk.is_same_city){ | 524 | if(pk && pk.is_same_city){ |
@@ -659,6 +661,11 @@ Page({ | @@ -659,6 +661,11 @@ Page({ | ||
659 | break; //物流 | 661 | break; //物流 |
660 | } | 662 | } |
661 | 663 | ||
664 | + | ||
665 | + if(th.data.show_same_city==1 && th.data.sys_switch.pickupway && th.data.sys_switch.pickupway == 2 ){ | ||
666 | + exp_type = 2; | ||
667 | + } | ||
668 | + | ||
662 | if (th.data.exp_type) { | 669 | if (th.data.exp_type) { |
663 | exp_type=th.data.exp_type | 670 | exp_type=th.data.exp_type |
664 | } | 671 | } |
@@ -703,7 +710,7 @@ Page({ | @@ -703,7 +710,7 @@ Page({ | ||
703 | async calculatePrice2() { | 710 | async calculatePrice2() { |
704 | var th = this; | 711 | var th = this; |
705 | if (!this.data.pre_arr) return false; | 712 | if (!this.data.pre_arr) return false; |
706 | - th.setData({ show_submit: 0,disabled_btn:0}) | 713 | + th.setData({ show_submit: 0,disabled_btn:0 }) |
707 | 714 | ||
708 | //--计算物流-- | 715 | //--计算物流-- |
709 | if (this.data.exp_type == 0) { | 716 | if (this.data.exp_type == 0) { |
@@ -2107,11 +2114,11 @@ Page({ | @@ -2107,11 +2114,11 @@ Page({ | ||
2107 | } | 2114 | } |
2108 | 2115 | ||
2109 | 2116 | ||
2117 | + var bn_pick = th.data.pickup.pickup_id | ||
2110 | //如果同意参与订单优惠 | 2118 | //如果同意参与订单优惠 |
2111 | if (ord_prom) { | 2119 | if (ord_prom) { |
2112 | //th.check_is_order_prom(o_condition,async function (ord_price) { | 2120 | //th.check_is_order_prom(o_condition,async function (ord_price) { |
2113 | var ord_price=o_condition; | 2121 | var ord_price=o_condition; |
2114 | - var bn_pick = th.data.pickup.pickup_id | ||
2115 | var order_prom_amount = 0; | 2122 | var order_prom_amount = 0; |
2116 | var order_prom_id = 0; | 2123 | var order_prom_id = 0; |
2117 | var order_m = 0; | 2124 | var order_m = 0; |
@@ -2227,6 +2234,58 @@ Page({ | @@ -2227,6 +2234,58 @@ Page({ | ||
2227 | var o_condition1 = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit); | 2234 | var o_condition1 = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit); |
2228 | if (o_condition1 < 0) o_condition1 = 0; | 2235 | if (o_condition1 < 0) o_condition1 = 0; |
2229 | 2236 | ||
2237 | + | ||
2238 | + if(th.data.exp_type == 2) { | ||
2239 | + var good = th.data.goods; | ||
2240 | + //--------------开始计算物流------------------ | ||
2241 | + var shipping_price = 0; | ||
2242 | + var lon = 0; | ||
2243 | + var lat = 0; | ||
2244 | + //-- 获取距离 -- | ||
2245 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | ||
2246 | + is_json: 1, data: {address: th.data.user_addr.more_address + th.data.user_addr.address} | ||
2247 | + }).then(res => { | ||
2248 | + if (res.data.code == 0) { | ||
2249 | + var data = JSON.parse(res.data.data); | ||
2250 | + if (data.status == 0) { | ||
2251 | + lon = data.result.location.lng; | ||
2252 | + lat = data.result.location.lat; | ||
2253 | + } | ||
2254 | + } | ||
2255 | + }) | ||
2256 | + var gd_w = good['weight'] * good['buynum']; | ||
2257 | + //-- 获取距离 -- | ||
2258 | + var req_data = { | ||
2259 | + store_id: os.stoid, | ||
2260 | + order_amount: parseFloat(o_condition1), | ||
2261 | + lon: lon, lat: lat, | ||
2262 | + pickup_id: bn_pick, | ||
2263 | + goods_weight: gd_w, | ||
2264 | + } | ||
2265 | + | ||
2266 | + var is_next = 1; | ||
2267 | + //获取同城配送参数 | ||
2268 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | ||
2269 | + is_json: 1, | ||
2270 | + data: req_data | ||
2271 | + }).then(res => { | ||
2272 | + if (res.data.code == 0) { | ||
2273 | + shipping_price = res.data.data; | ||
2274 | + } else { | ||
2275 | + is_next = 0; | ||
2276 | + wx.showToast({ | ||
2277 | + title: res.data.msg, icon: 'none', duration: 2000 | ||
2278 | + }) | ||
2279 | + } | ||
2280 | + }) | ||
2281 | + if (!is_next) { | ||
2282 | + th.setData({show_submit: 1, disabled_btn: 1,same_ok: 0}) | ||
2283 | + return false | ||
2284 | + } | ||
2285 | + exp_price = parseFloat(shipping_price).toFixed(2); | ||
2286 | + } | ||
2287 | + | ||
2288 | + | ||
2230 | var the_price=parseFloat(o_condition1) + parseFloat(exp_price); | 2289 | var the_price=parseFloat(o_condition1) + parseFloat(exp_price); |
2231 | 2290 | ||
2232 | if(the_price<th.data.goods.use_commission){ | 2291 | if(the_price<th.data.goods.use_commission){ |
@@ -2491,7 +2550,7 @@ Page({ | @@ -2491,7 +2550,7 @@ Page({ | ||
2491 | set_wuliu: function (e) { | 2550 | set_wuliu: function (e) { |
2492 | var type = e.currentTarget.dataset.type; | 2551 | var type = e.currentTarget.dataset.type; |
2493 | this.setData({ | 2552 | this.setData({ |
2494 | - exp_type: type | 2553 | + exp_type: type,same_ok:1 |
2495 | }); | 2554 | }); |
2496 | this.calculatePrice2(); | 2555 | this.calculatePrice2(); |
2497 | }, | 2556 | }, |
packageC/pages/presell/cart/cart.wxml
@@ -381,7 +381,7 @@ | @@ -381,7 +381,7 @@ | ||
381 | </view> | 381 | </view> |
382 | </view> | 382 | </view> |
383 | <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">支付尾款</button> | 383 | <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">支付尾款</button> |
384 | - <button wx:else class="tips-btn" bindtap="show_pay" hidden="{{!show_submit}}">支付尾款</button> | 384 | + <button wx:else class="tips-btn" bindtap="show_pay" hidden="{{!show_submit || !same_ok}}">支付尾款</button> |
385 | <!-- 预售 --> | 385 | <!-- 预售 --> |
386 | <!-- <button class="tips-btn" formType="submit" id="submitOrder">立即支付</button> --> | 386 | <!-- <button class="tips-btn" formType="submit" id="submitOrder">立即支付</button> --> |
387 | </view> | 387 | </view> |
packageC/pages/presell/cart/cart2.js
@@ -129,6 +129,8 @@ Page({ | @@ -129,6 +129,8 @@ Page({ | ||
129 | dis_config:null, | 129 | dis_config:null, |
130 | bn_use_commission:0, //是不是使用佣金 | 130 | bn_use_commission:0, //是不是使用佣金 |
131 | 131 | ||
132 | + same_ok:1 | ||
133 | + | ||
132 | }, | 134 | }, |
133 | onLoad: function (t) { | 135 | onLoad: function (t) { |
134 | wx.setNavigationBarTitle({ title: "填写订单", }) | 136 | wx.setNavigationBarTitle({ title: "填写订单", }) |
@@ -232,6 +234,10 @@ Page({ | @@ -232,6 +234,10 @@ Page({ | ||
232 | //先获取是否有关闭使用优惠券 | 234 | //先获取是否有关闭使用优惠券 |
233 | getApp().getConfig2(function (ee) { | 235 | getApp().getConfig2(function (ee) { |
234 | var json_d = JSON.parse(ee.switch_list); | 236 | var json_d = JSON.parse(ee.switch_list); |
237 | + | ||
238 | + //测试强行写死,后面一定要删除 | ||
239 | + //json_d.pickupway=2; | ||
240 | + | ||
235 | th.data.json_d = json_d; | 241 | th.data.json_d = json_d; |
236 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | 242 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
237 | var is_default_logistics = json_d.is_default_logistics; | 243 | var is_default_logistics = json_d.is_default_logistics; |
@@ -407,7 +413,7 @@ Page({ | @@ -407,7 +413,7 @@ Page({ | ||
407 | //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | 413 | //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- |
408 | if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ | 414 | if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ |
409 | 415 | ||
410 | - getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+th.data.gg.pick_id, {}).then(res=>{ | 416 | + await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+th.data.gg.pick_id, {}).then(res=>{ |
411 | if(res.data.code==0){ | 417 | if(res.data.code==0){ |
412 | var pk=res.data.data; | 418 | var pk=res.data.data; |
413 | if(pk && pk.is_same_city){ | 419 | if(pk && pk.is_same_city){ |
@@ -468,6 +474,10 @@ Page({ | @@ -468,6 +474,10 @@ Page({ | ||
468 | break; | 474 | break; |
469 | } | 475 | } |
470 | 476 | ||
477 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | ||
478 | + et = 2; | ||
479 | + } | ||
480 | + | ||
471 | 481 | ||
472 | var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | 482 | var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
473 | if (et == 0 && def_exp_code && !th.data.is_default_logistics) { | 483 | if (et == 0 && def_exp_code && !th.data.is_default_logistics) { |
@@ -993,7 +1003,10 @@ Page({ | @@ -993,7 +1003,10 @@ Page({ | ||
993 | }) | 1003 | }) |
994 | } | 1004 | } |
995 | }) | 1005 | }) |
996 | - if(!is_next) return false | 1006 | + if(!is_next) { |
1007 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | ||
1008 | + return false | ||
1009 | + } | ||
997 | } | 1010 | } |
998 | 1011 | ||
999 | total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | 1012 | total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); |
@@ -1814,7 +1827,7 @@ Page({ | @@ -1814,7 +1827,7 @@ Page({ | ||
1814 | setexptype: function (t) { | 1827 | setexptype: function (t) { |
1815 | var th = this; | 1828 | var th = this; |
1816 | var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; | 1829 | var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
1817 | - th.setData({ bn_exp_type: ty }); | 1830 | + th.setData({ bn_exp_type: ty,same_ok:1 }); |
1818 | if (ty == 0) { | 1831 | if (ty == 0) { |
1819 | th.setData({ is_all_zt: 0 }); | 1832 | th.setData({ is_all_zt: 0 }); |
1820 | } | 1833 | } |
packageE/pages/cart/cart2/cart2.js
@@ -269,8 +269,9 @@ Page({ | @@ -269,8 +269,9 @@ Page({ | ||
269 | //先获取是否有关闭使用优惠券 | 269 | //先获取是否有关闭使用优惠券 |
270 | getApp().getConfig2(function (ee) { | 270 | getApp().getConfig2(function (ee) { |
271 | var json_d = JSON.parse(ee.switch_list); | 271 | var json_d = JSON.parse(ee.switch_list); |
272 | + | ||
272 | //测试强行写死,后面一定要删除 | 273 | //测试强行写死,后面一定要删除 |
273 | - json_d.pickupway=2; | 274 | + //json_d.pickupway=2; |
274 | 275 | ||
275 | th.data.json_d = json_d; | 276 | th.data.json_d = json_d; |
276 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | 277 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
@@ -6833,7 +6834,15 @@ Page({ | @@ -6833,7 +6834,15 @@ Page({ | ||
6833 | 6834 | ||
6834 | if(this.data.bn_exp_type==2){ | 6835 | if(this.data.bn_exp_type==2){ |
6835 | 6836 | ||
6836 | - | 6837 | + if(!item.is_same_city){ |
6838 | + wx.showToast({ | ||
6839 | + title: "商品不支持同城配送", | ||
6840 | + icon: 'none', | ||
6841 | + duration: 2000 | ||
6842 | + }) | ||
6843 | + th.setData({ submit: 0 }); | ||
6844 | + return false; | ||
6845 | + } | ||
6837 | 6846 | ||
6838 | }else{ | 6847 | }else{ |
6839 | if(item.distr_type==1){ | 6848 | if(item.distr_type==1){ |
@@ -6942,7 +6951,12 @@ Page({ | @@ -6942,7 +6951,12 @@ Page({ | ||
6942 | //-- 如果是选中 -- | 6951 | //-- 如果是选中 -- |
6943 | if (e.selected) { | 6952 | if (e.selected) { |
6944 | 6953 | ||
6945 | - var exp_type=this.data.order_prom_list_cart[cart_index].exp_type; //配送方式 | 6954 | + var m_cartlist=this.data.old_cartlist; |
6955 | + if(this.data.order_prom_list_cart){ | ||
6956 | + m_cartlist=this.data.order_prom_list_cart; | ||
6957 | + } | ||
6958 | + | ||
6959 | + var exp_type=m_cartlist[cart_index].exp_type; //配送方式 | ||
6946 | //如果是自提的时候 | 6960 | //如果是自提的时候 |
6947 | if(exp_type==1){ | 6961 | if(exp_type==1){ |
6948 | 6962 | ||
@@ -6956,13 +6970,29 @@ Page({ | @@ -6956,13 +6970,29 @@ Page({ | ||
6956 | } | 6970 | } |
6957 | 6971 | ||
6958 | }else{ | 6972 | }else{ |
6959 | - if(item.distr_type==1){ | ||
6960 | - wx.showToast({ | ||
6961 | - title: "商品的配送方式不一致", | ||
6962 | - icon: 'none', | ||
6963 | - duration: 2000 | ||
6964 | - }) | ||
6965 | - return false; | 6973 | + |
6974 | + if(exp_type==2){ | ||
6975 | + | ||
6976 | + if(!item.is_same_city){ | ||
6977 | + wx.showToast({ | ||
6978 | + title: "商品不支持同城配送", | ||
6979 | + icon: 'none', | ||
6980 | + duration: 2000 | ||
6981 | + }) | ||
6982 | + th.setData({ submit: 0 }); | ||
6983 | + return false; | ||
6984 | + } | ||
6985 | + | ||
6986 | + }else { | ||
6987 | + | ||
6988 | + if (item.distr_type == 1) { | ||
6989 | + wx.showToast({ | ||
6990 | + title: "商品的配送方式不一致", | ||
6991 | + icon: 'none', | ||
6992 | + duration: 2000 | ||
6993 | + }) | ||
6994 | + return false; | ||
6995 | + } | ||
6966 | } | 6996 | } |
6967 | } | 6997 | } |
6968 | 6998 | ||
@@ -7019,8 +7049,9 @@ Page({ | @@ -7019,8 +7049,9 @@ Page({ | ||
7019 | 7049 | ||
7020 | //-- 如果有一件代发的商品或者不是同城配送的配送 -- | 7050 | //-- 如果有一件代发的商品或者不是同城配送的配送 -- |
7021 | if (narr[hi].is_same_city != 1 || narr[hi].whsle_id > 0) { | 7051 | if (narr[hi].is_same_city != 1 || narr[hi].whsle_id > 0) { |
7022 | - th.setData({ show_same_city: 0 }) | 7052 | + //th.setData({ show_same_city: 0 }) |
7023 | } | 7053 | } |
7054 | + | ||
7024 | } | 7055 | } |
7025 | //自选的时候,系统配置了默认的配送方式是物流的时候 | 7056 | //自选的时候,系统配置了默认的配送方式是物流的时候 |
7026 | if (distr_t == 0 && th.data.json_d.pickupway && th.data.json_d.pickupway == 1) { | 7057 | if (distr_t == 0 && th.data.json_d.pickupway && th.data.json_d.pickupway == 1) { |
pages/cart/cart2_inte/cart2_inte.js
@@ -81,6 +81,8 @@ Page({ | @@ -81,6 +81,8 @@ Page({ | ||
81 | show_submit: 0, //提交按钮变正常显示 | 81 | show_submit: 0, //提交按钮变正常显示 |
82 | udata: null,//用户预存值,数据 | 82 | udata: null,//用户预存值,数据 |
83 | is_pre_cut:0, //是否可以使用预存 0是不可以1的可以 | 83 | is_pre_cut:0, //是否可以使用预存 0是不可以1的可以 |
84 | + | ||
85 | + same_ok:1, //同城配送的控制,默认ok | ||
84 | }, | 86 | }, |
85 | onLoad: function (t) { | 87 | onLoad: function (t) { |
86 | wx.setNavigationBarTitle({ title: "填写订单", }) | 88 | wx.setNavigationBarTitle({ title: "填写订单", }) |
@@ -96,6 +98,10 @@ Page({ | @@ -96,6 +98,10 @@ Page({ | ||
96 | //先获取是否有关闭使用优惠券 | 98 | //先获取是否有关闭使用优惠券 |
97 | getApp().getConfig2(function (ee) { | 99 | getApp().getConfig2(function (ee) { |
98 | var json_d = JSON.parse(ee.switch_list); | 100 | var json_d = JSON.parse(ee.switch_list); |
101 | + | ||
102 | + //测试强行写死,后面一定要删除 | ||
103 | + //json_d.pickupway=2; | ||
104 | + | ||
99 | th.data.json_d = json_d; | 105 | th.data.json_d = json_d; |
100 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | 106 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
101 | var is_default_logistics = json_d.is_default_logistics; | 107 | var is_default_logistics = json_d.is_default_logistics; |
@@ -496,6 +502,11 @@ Page({ | @@ -496,6 +502,11 @@ Page({ | ||
496 | case 2: et = 0; break; | 502 | case 2: et = 0; break; |
497 | } | 503 | } |
498 | 504 | ||
505 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | ||
506 | + et = 2; | ||
507 | + } | ||
508 | + | ||
509 | + | ||
499 | if (th.data.bn_goods) et = th.data.bn_exp_type | 510 | if (th.data.bn_goods) et = th.data.bn_exp_type |
500 | 511 | ||
501 | var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | 512 | var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
@@ -984,7 +995,10 @@ Page({ | @@ -984,7 +995,10 @@ Page({ | ||
984 | }) | 995 | }) |
985 | } | 996 | } |
986 | }) | 997 | }) |
987 | - if(!is_next) return false | 998 | + if(!is_next){ |
999 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | ||
1000 | + return false | ||
1001 | + } | ||
988 | } | 1002 | } |
989 | 1003 | ||
990 | 1004 | ||
@@ -1419,7 +1433,8 @@ Page({ | @@ -1419,7 +1433,8 @@ Page({ | ||
1419 | setexptype: function (t) { | 1433 | setexptype: function (t) { |
1420 | var th = this; | 1434 | var th = this; |
1421 | var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; | 1435 | var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
1422 | - th.setData({ bn_exp_type: ty }); | 1436 | + |
1437 | + th.setData({ bn_exp_type: ty,same_ok:1 }); | ||
1423 | //当物流为空的时候。 | 1438 | //当物流为空的时候。 |
1424 | if (ty == 0 && th.data.wu_arr == null) { | 1439 | if (ty == 0 && th.data.wu_arr == null) { |
1425 | th.data.isget_by_quan = {}; | 1440 | th.data.isget_by_quan = {}; |
pages/cart/cart2_inte/cart2_inte.wxml
@@ -199,7 +199,7 @@ | @@ -199,7 +199,7 @@ | ||
199 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> | 199 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> |
200 | <view class="payable">应付积分:<text class="co-red">{{formData.integral}}积分</text></view> | 200 | <view class="payable">应付积分:<text class="co-red">{{formData.integral}}积分</text></view> |
201 | </view> | 201 | </view> |
202 | - <button disabled="{{submit}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | 202 | + <button disabled="{{submit || !same_ok}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> |
203 | </view> | 203 | </view> |
204 | </form> | 204 | </form> |
205 | 205 |
pages/cart/cart2_pt/cart2_pt.js
@@ -72,6 +72,8 @@ Page({ | @@ -72,6 +72,8 @@ Page({ | ||
72 | 72 | ||
73 | bn_is_order_yh:1, //是不是订单优惠 | 73 | bn_is_order_yh:1, //是不是订单优惠 |
74 | bn_is_post_temp:1, //是不是进行计算包邮模板 | 74 | bn_is_post_temp:1, //是不是进行计算包邮模板 |
75 | + | ||
76 | + same_ok:1, //同城配送的控制,默认ok | ||
75 | }, | 77 | }, |
76 | onLoad: function (t) { | 78 | onLoad: function (t) { |
77 | console.log("onLoad_pt_cart"); | 79 | console.log("onLoad_pt_cart"); |
@@ -380,6 +382,10 @@ Page({ | @@ -380,6 +382,10 @@ Page({ | ||
380 | break; | 382 | break; |
381 | } | 383 | } |
382 | 384 | ||
385 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | ||
386 | + et = 2; | ||
387 | + } | ||
388 | + | ||
383 | t.data.data.shop_price = gg.goods_price; | 389 | t.data.data.shop_price = gg.goods_price; |
384 | //--如果是普通购买的时候-- | 390 | //--如果是普通购买的时候-- |
385 | if (gg.is_normal == 1) { | 391 | if (gg.is_normal == 1) { |
@@ -564,6 +570,10 @@ Page({ | @@ -564,6 +570,10 @@ Page({ | ||
564 | //先获取是否有关闭使用优惠券 | 570 | //先获取是否有关闭使用优惠券 |
565 | getApp().getConfig2(function (ee) { | 571 | getApp().getConfig2(function (ee) { |
566 | var json_d = JSON.parse(ee.switch_list); | 572 | var json_d = JSON.parse(ee.switch_list); |
573 | + | ||
574 | + //测试强行写死,后面一定要删除 | ||
575 | + //json_d.pickupway=2; | ||
576 | + | ||
567 | th.data.json_d = json_d; | 577 | th.data.json_d = json_d; |
568 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | 578 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
569 | var is_default_logistics = json_d.is_default_logistics; | 579 | var is_default_logistics = json_d.is_default_logistics; |
@@ -851,7 +861,10 @@ Page({ | @@ -851,7 +861,10 @@ Page({ | ||
851 | }) | 861 | }) |
852 | } | 862 | } |
853 | }) | 863 | }) |
854 | - if (!is_next) return false | 864 | + if (!is_next){ |
865 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | ||
866 | + return false | ||
867 | + } | ||
855 | } | 868 | } |
856 | 869 | ||
857 | //-- 如果是订单优惠的时候,allpice要拿来减掉一些 -- | 870 | //-- 如果是订单优惠的时候,allpice要拿来减掉一些 -- |
@@ -1426,7 +1439,7 @@ Page({ | @@ -1426,7 +1439,7 @@ Page({ | ||
1426 | setexptype: function (t) { | 1439 | setexptype: function (t) { |
1427 | var th = this; | 1440 | var th = this; |
1428 | var ty = t.currentTarget.dataset.t; | 1441 | var ty = t.currentTarget.dataset.t; |
1429 | - th.setData({ bn_exp_type: ty }); | 1442 | + th.setData({ bn_exp_type: ty, same_ok:0 }); |
1430 | //当物流为空的时候。 | 1443 | //当物流为空的时候。 |
1431 | if (ty == 0 && th.data.wu_arr == null) { | 1444 | if (ty == 0 && th.data.wu_arr == null) { |
1432 | return th.get_wuliu(th.calculatePrice2()); | 1445 | return th.get_wuliu(th.calculatePrice2()); |
pages/cart/cart2_pt/cart2_pt.wxml
@@ -198,7 +198,7 @@ | @@ -198,7 +198,7 @@ | ||
198 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> | 198 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> |
199 | <!-- <view class="co-red big"></view> --> | 199 | <!-- <view class="co-red big"></view> --> |
200 | </view> | 200 | </view> |
201 | - <button disabled="{{submit}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | 201 | + <button disabled="{{submit || !same_ok}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> |
202 | </view> | 202 | </view> |
203 | </form> | 203 | </form> |
204 | 204 |
pages/cart/cart_wk/cart_wk.js
@@ -50,7 +50,8 @@ Page({ | @@ -50,7 +50,8 @@ Page({ | ||
50 | bn_is_order_yh:1, //是不是订单优惠 | 50 | bn_is_order_yh:1, //是不是订单优惠 |
51 | bn_is_post_temp:1, //是不是进行计算包邮模板 | 51 | bn_is_post_temp:1, //是不是进行计算包邮模板 |
52 | 52 | ||
53 | - paying:0 //支付中 | 53 | + paying:0, //支付中 |
54 | + same_ok:1 //同城配送的控制 | ||
54 | 55 | ||
55 | }, | 56 | }, |
56 | 57 | ||
@@ -71,6 +72,11 @@ Page({ | @@ -71,6 +72,11 @@ Page({ | ||
71 | //--初始化-- | 72 | //--初始化-- |
72 | getApp().getConfig2(function (e) { | 73 | getApp().getConfig2(function (e) { |
73 | var json_d = JSON.parse(e.switch_list); | 74 | var json_d = JSON.parse(e.switch_list); |
75 | + | ||
76 | + //测试强行写死,后面一定要删除 | ||
77 | + //json_d.pickupway=2; | ||
78 | + | ||
79 | + | ||
74 | th.data.json_d = json_d; | 80 | th.data.json_d = json_d; |
75 | var is_default_logistics = json_d.is_default_logistics; | 81 | var is_default_logistics = json_d.is_default_logistics; |
76 | var is_same_city = json_d.is_same_city; | 82 | var is_same_city = json_d.is_same_city; |
@@ -343,7 +349,7 @@ Page({ | @@ -343,7 +349,7 @@ Page({ | ||
343 | 349 | ||
344 | //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | 350 | //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- |
345 | if(goods.is_same_city && th.data.is_same_city && goods.whsle_id<=0){ | 351 | if(goods.is_same_city && th.data.is_same_city && goods.whsle_id<=0){ |
346 | - getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ | 352 | + await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ |
347 | if(res.data.code==0){ | 353 | if(res.data.code==0){ |
348 | var pk=res.data.data; | 354 | var pk=res.data.data; |
349 | if(pk && pk.is_same_city){ | 355 | if(pk && pk.is_same_city){ |
@@ -369,6 +375,12 @@ Page({ | @@ -369,6 +375,12 @@ Page({ | ||
369 | break; //物流 | 375 | break; //物流 |
370 | } | 376 | } |
371 | 377 | ||
378 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | ||
379 | + exp_type = 2; | ||
380 | + } | ||
381 | + | ||
382 | + | ||
383 | + | ||
372 | order.order_goods = order_goods; | 384 | order.order_goods = order_goods; |
373 | 385 | ||
374 | //-- 计算获得佣金的金额 -- | 386 | //-- 计算获得佣金的金额 -- |
@@ -416,6 +428,7 @@ Page({ | @@ -416,6 +428,7 @@ Page({ | ||
416 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; | 428 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; |
417 | var o_condition = allpice; | 429 | var o_condition = allpice; |
418 | var ord_prom=null; | 430 | var ord_prom=null; |
431 | + var order_prom_amount=0; | ||
419 | 432 | ||
420 | if (th.data.bn_is_order_yh) { | 433 | if (th.data.bn_is_order_yh) { |
421 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | 434 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
@@ -432,6 +445,10 @@ Page({ | @@ -432,6 +445,10 @@ Page({ | ||
432 | //--计算物流-- | 445 | //--计算物流-- |
433 | if (th.data.exp_type == 0) { | 446 | if (th.data.exp_type == 0) { |
434 | th.calculate_wuliu(); | 447 | th.calculate_wuliu(); |
448 | + return false; | ||
449 | + }else if(th.data.exp_type == 2){ | ||
450 | + th.calculate_same_city(); | ||
451 | + return false; | ||
435 | } else { | 452 | } else { |
436 | 453 | ||
437 | var order_prom_id=0; | 454 | var order_prom_id=0; |
@@ -454,6 +471,10 @@ Page({ | @@ -454,6 +471,10 @@ Page({ | ||
454 | } | 471 | } |
455 | } | 472 | } |
456 | 473 | ||
474 | + | ||
475 | + | ||
476 | + | ||
477 | + | ||
457 | //--订单优惠的显示-- | 478 | //--订单优惠的显示-- |
458 | var order_prom_txt1 = "formData.order_prom_id"; | 479 | var order_prom_txt1 = "formData.order_prom_id"; |
459 | var order_prom_txt2 = "formData.order_prom_amount"; | 480 | var order_prom_txt2 = "formData.order_prom_amount"; |
@@ -498,7 +519,7 @@ Page({ | @@ -498,7 +519,7 @@ Page({ | ||
498 | set_wuliu: function (e) { | 519 | set_wuliu: function (e) { |
499 | var type = e.currentTarget.dataset.type, th = this; | 520 | var type = e.currentTarget.dataset.type, th = this; |
500 | this.setData({ | 521 | this.setData({ |
501 | - exp_type: type | 522 | + exp_type: type,same_ok:1 |
502 | }); | 523 | }); |
503 | //--计算物流的值-- | 524 | //--计算物流的值-- |
504 | if (type == 0) { | 525 | if (type == 0) { |
@@ -525,6 +546,7 @@ Page({ | @@ -525,6 +546,7 @@ Page({ | ||
525 | 546 | ||
526 | //如果有再计算价格的过程中,不能提交订单 | 547 | //如果有再计算价格的过程中,不能提交订单 |
527 | if(this.data.submit){ return false} | 548 | if(this.data.submit){ return false} |
549 | + if(!this.data.same_ok){ return false} | ||
528 | 550 | ||
529 | //--物流支付时要有地址-- | 551 | //--物流支付时要有地址-- |
530 | if (this.data.exp_type == 0 && this.data.user_addr == null) { | 552 | if (this.data.exp_type == 0 && this.data.user_addr == null) { |
@@ -984,7 +1006,10 @@ Page({ | @@ -984,7 +1006,10 @@ Page({ | ||
984 | }) | 1006 | }) |
985 | } | 1007 | } |
986 | }) | 1008 | }) |
987 | - if(!is_next) return false | 1009 | + if(!is_next) { |
1010 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | ||
1011 | + return false | ||
1012 | + } | ||
988 | 1013 | ||
989 | var exp_price = parseFloat(shipping_price).toFixed(2); | 1014 | var exp_price = parseFloat(shipping_price).toFixed(2); |
990 | allpice = parseFloat(exp_price) + parseFloat(allpice); | 1015 | allpice = parseFloat(exp_price) + parseFloat(allpice); |
pages/cart/cart_wk/cart_wk.wxml
@@ -135,7 +135,7 @@ | @@ -135,7 +135,7 @@ | ||
135 | <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> | 135 | <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> |
136 | </view> --> | 136 | </view> --> |
137 | <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-(bn_use_commission?goods.use_commission:0)-formData.order_prom_amount ,2)}}</text></view> | 137 | <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-(bn_use_commission?goods.use_commission:0)-formData.order_prom_amount ,2)}}</text></view> |
138 | - <view class="zf_btn {{submit?'gray':''}}" bindtap="to_pay">支付尾款</view> | 138 | + <view class="zf_btn {{(submit || !same_ok)?'gray':''}}" bindtap="to_pay">支付尾款</view> |
139 | </view> | 139 | </view> |
140 | 140 | ||
141 | 141 |