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