Commit 4d8f40827fcb33e29f713eec63d93c66ad756937

Authored by yvan.ni
1 parent efe98ac9

同城配送的优化

packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... ... @@ -76,6 +76,8 @@ Page({
76 76 card_cut_price: null, //减价多少钱
77 77 is_pre_cut:0, //是否可以使用预存 0是不可以1的可以
78 78 act:null, //幸运购的活动
  79 +
  80 + same_ok:1, //同城配送的控制,默认ok
79 81 },
80 82  
81 83 onLoad: function (t) {
... ... @@ -381,13 +383,13 @@ Page({
381 383 var gg = th.data.postdata;
382 384 //调用商品
383 385 a.get("/api/weshop/goods/get/" + oo.stoid + "/" + gg.goods_id, {
384   - success: function (t) {
  386 + success: async function (t) {
385 387 var gd = t.data.data;
386 388 if (!gd) return false;
387 389  
388 390 //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 --
389 391 if (gd.is_same_city && th.data.is_same_city && gd.whsle_id <= 0) {
390   - getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + gg.pick_id, {}).then(res => {
  392 + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + gg.pick_id, {}).then(res => {
391 393 if (res.data.code == 0) {
392 394 var pk = res.data.data;
393 395 if (pk && pk.is_same_city) {
... ... @@ -445,6 +447,11 @@ Page({
445 447 break;
446 448 }
447 449  
  450 + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){
  451 + et = 2;
  452 + }
  453 +
  454 +
448 455 t.data.data.shop_price = gg.goods_price;
449 456 //--如果是普通购买的时候--
450 457 if (gg.is_normal == 1) {
... ... @@ -615,7 +622,7 @@ Page({
615 622 });
616 623 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
617 624 th.setData({
618   - add_back: 1
  625 + add_back: 1,same_ok:1
619 626 });
620 627 if (this.data.bn_goods) th.calculatePrice2();
621 628 }
... ... @@ -933,7 +940,10 @@ Page({
933 940 })
934 941 }
935 942 })
936   - if (!is_next) return false
  943 + if (!is_next){
  944 + th.setData({is_show_sub:1,sub:0,same_ok:0 })
  945 + return false
  946 + }
937 947  
938 948 th.data.lon=lon;
939 949 th.data.lat=lat;
... ... @@ -1596,7 +1606,7 @@ Page({
1596 1606 var th = this;
1597 1607 var ty = t.currentTarget.dataset.t;
1598 1608 th.setData({
1599   - bn_exp_type: ty
  1609 + bn_exp_type: ty,same_ok:1
1600 1610 });
1601 1611 //当物流为空的时候。
1602 1612 if (ty == 0 && th.data.wu_arr == null) {
... ...
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
... ... @@ -204,7 +204,7 @@
204 204 <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view>
205 205 <!-- <view class="co-red big"></view> -->
206 206 </view>
207   - <button disabled="{{sub}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button>
  207 + <button disabled="{{sub || !same_ok}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button>
208 208 </view>
209 209 </form>
210 210  
... ...
packageC/pages/payForAnother/payForAnother.js
... ... @@ -204,12 +204,12 @@ Page({
204 204 th.setData({user_addr: ie});
205 205 if (th.data.is_b_now == 1) {
206 206 if (th.data.bn_goods) {
207   - th.setData({add_back: 1});
  207 + th.setData({add_back: 1,same_ok:1});
208 208 //th.calculatePrice2();
209 209 }
210 210 } else {
211 211 if (th.data.cartlist) {
212   - th.setData({add_back: 1});
  212 + th.setData({add_back: 1,same_ok:1});
213 213 //th.calculatePrice();
214 214 }
215 215 }
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -119,7 +119,7 @@ Page({
119 119 order_prom_amount:0,
120 120 paying:0,
121 121  
122   - same_ok:1
  122 + same_ok:1 //同城配送按钮控制
123 123 },
124 124 onLoad: function (t) {
125 125  
... ... @@ -194,7 +194,7 @@ Page({
194 194 //更换地址回来要重新调用计算价钱的接口
195 195 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
196 196 th.setData({ user_addr: ie });
197   - th.setData({ add_back: 1 });
  197 + th.setData({ add_back: 1,same_ok:1 });
198 198 th.calculatePrice2();
199 199 } else {
200 200 th.setData({ user_addr: ie });
... ...
packageC/pages/presell/cart/cart2.js
... ... @@ -129,7 +129,7 @@ Page({
129 129 dis_config:null,
130 130 bn_use_commission:0, //是不是使用佣金
131 131  
132   - same_ok:1
  132 + same_ok:1 //同城配送按钮控制
133 133  
134 134 },
135 135 onLoad: function (t) {
... ... @@ -206,7 +206,7 @@ Page({
206 206 th.setData({ user_addr: ie });
207 207 if (th.data.is_b_now == 1) {
208 208 if (th.data.bn_goods) {
209   - th.setData({ add_back: 1 });
  209 + th.setData({ add_back: 1,same_ok:1 });
210 210 //th.calculatePrice2();
211 211 }
212 212 } else {
... ...
packageC/pages/presell/cart/cart2_pre.js
... ... @@ -266,7 +266,7 @@ Page({
266 266 //更换地址回来要重新调用计算价钱的接口
267 267 th.setData({ user_addr: ie });
268 268 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
269   - th.setData({ add_back: 1 });
  269 + th.setData({ add_back: 1,same_ok: 1 });
270 270 if (th.data.bn_goods) th.calculatePrice2();
271 271 }
272 272 })
... ...
packageE/pages/cart/cart2/cart2.js
... ... @@ -243,12 +243,12 @@ Page({
243 243 th.setData({ user_addr: ie });
244 244 if (th.data.is_b_now == 1) {
245 245 if (th.data.bn_goods) {
246   - th.setData({ add_back: 1 });
  246 + th.setData({ add_back: 1,same_ok:1 });
247 247 //th.calculatePrice2();
248 248 }
249 249 } else {
250 250 if (th.data.cartlist) {
251   - th.setData({ add_back: 1 });
  251 + th.setData({ add_back: 1,same_ok:1 });
252 252 //th.calculatePrice();
253 253 }
254 254 }
... ...
packageE/pages/cart/cart2_inte/cart2_inte.js
... ... @@ -198,7 +198,7 @@ Page({
198 198 th.setData({ user_addr: ie });
199 199 if (th.data.is_b_now == 1) {
200 200 if (th.data.bn_goods) {
201   - th.setData({ add_back: 1 });
  201 + th.setData({ add_back: 1,same_ok:1 });
202 202 th.calculatePrice2();
203 203 }
204 204 }
... ... @@ -996,7 +996,7 @@ Page({
996 996 }
997 997 })
998 998 if(!is_next){
999   - th.setData({show_submit:1, submit: 0,same_ok:0 })
  999 + th.setData({is_show_sub:1, submit: 0,same_ok:0 })
1000 1000 return false
1001 1001 }
1002 1002  
... ...
pages/cart/cart2_pt/cart2_pt.js
... ... @@ -554,7 +554,7 @@ Page({
554 554 //更换地址回来要重新调用计算价钱的接口
555 555 th.setData({ user_addr: ie });
556 556 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) {
557   - th.setData({ add_back: 1 });
  557 + th.setData({ add_back: 1,same_ok:1 });
558 558 if (th.data.bn_goods) th.calculatePrice2();
559 559 }
560 560 })
... ...