Commit d8c18196f1e5fe692272cd0f0d333227ed0dd950
1 parent
a4266f6e
商品详情的优化
Showing
2 changed files
with
116 additions
and
46 deletions
pages/goods/goodsInfo/goodsInfo.js
| @@ -2742,6 +2742,8 @@ Page({ | @@ -2742,6 +2742,8 @@ Page({ | ||
| 2742 | return false; | 2742 | return false; |
| 2743 | } | 2743 | } |
| 2744 | 2744 | ||
| 2745 | + th.setData({def_pick_store: ut.deep_cp(th.data.front_pick)}); | ||
| 2746 | + | ||
| 2745 | this.setData({ | 2747 | this.setData({ |
| 2746 | store: 0, | 2748 | store: 0, |
| 2747 | choice_sort_store: 0, | 2749 | choice_sort_store: 0, |
| @@ -4269,15 +4271,18 @@ Page({ | @@ -4269,15 +4271,18 @@ Page({ | ||
| 4269 | } | 4271 | } |
| 4270 | 4272 | ||
| 4271 | if(this.data.fir_set_sto==1){ | 4273 | if(this.data.fir_set_sto==1){ |
| 4272 | - this.data.fir_set_sto=0; | ||
| 4273 | - if(th.data.def_pick_store && th.data.def_pick_store.pickup_id){ | ||
| 4274 | - let cp_data=JSON.parse(JSON.stringify(th.data.def_pick_store)); | ||
| 4275 | - th.setData({ | ||
| 4276 | - front_pick:cp_data, | ||
| 4277 | - front_only_pk:th.data.only_pk, | ||
| 4278 | - front_def_pickpu_list:th.data.def_pickpu_list, | ||
| 4279 | - }) | ||
| 4280 | - } | 4274 | + this.data.fir_set_sto=0; |
| 4275 | + var cp_data=null | ||
| 4276 | + if(th.data.def_pick_store && th.data.def_pick_store.pickup_id){ | ||
| 4277 | + cp_data=JSON.parse(JSON.stringify(th.data.def_pick_store)); | ||
| 4278 | + } | ||
| 4279 | + th.setData({ | ||
| 4280 | + front_pick:cp_data, | ||
| 4281 | + front_only_pk:th.data.only_pk, | ||
| 4282 | + front_def_pickpu_list:th.data.def_pickpu_list, | ||
| 4283 | + front_pickpu_listt:th.data.pickpu_list, | ||
| 4284 | + front_all_sto:th.data.all_sto, | ||
| 4285 | + }) | ||
| 4281 | } | 4286 | } |
| 4282 | 4287 | ||
| 4283 | }, | 4288 | }, |
| @@ -7324,8 +7329,8 @@ Page({ | @@ -7324,8 +7329,8 @@ Page({ | ||
| 7324 | var ind = ee.currentTarget.dataset.ind; | 7329 | var ind = ee.currentTarget.dataset.ind; |
| 7325 | var isfront = ee.currentTarget.dataset.isfront; | 7330 | var isfront = ee.currentTarget.dataset.isfront; |
| 7326 | 7331 | ||
| 7327 | - if(isfront) | ||
| 7328 | - th.data.isfront=1; | 7332 | + th.data.isfront=0; |
| 7333 | + if(isfront) th.data.isfront=1; | ||
| 7329 | 7334 | ||
| 7330 | var bconfig = th.data.bconfig; | 7335 | var bconfig = th.data.bconfig; |
| 7331 | this.setData({ | 7336 | this.setData({ |
| @@ -7346,40 +7351,91 @@ Page({ | @@ -7346,40 +7351,91 @@ Page({ | ||
| 7346 | return false; | 7351 | return false; |
| 7347 | } | 7352 | } |
| 7348 | 7353 | ||
| 7349 | - if (!th.data.only_pk && !th.data.def_pickpu_list && !th.data.change) { | ||
| 7350 | - // getApp().confirmBox("门店库存不足", null, 25000, !1); | ||
| 7351 | - wx.showToast({ | ||
| 7352 | - title: '门店库存不足', | ||
| 7353 | - icon: 'none', | ||
| 7354 | - }); | ||
| 7355 | - return false; | ||
| 7356 | - } | ||
| 7357 | - th.data.change = 0; | 7354 | + if(th.data.isfront==1){ |
| 7358 | 7355 | ||
| 7359 | - if (th.data.only_pk && !th.data.only_pk.length) { | ||
| 7360 | - // getApp().confirmBox("门店库存不足", null, 25000, !1); | ||
| 7361 | - wx.showToast({ | ||
| 7362 | - title: '门店库存不足', | ||
| 7363 | - icon: 'none', | ||
| 7364 | - }); | ||
| 7365 | - return false; | ||
| 7366 | - } | ||
| 7367 | - if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) { | ||
| 7368 | - // getApp().confirmBox("门店库存不足", null, 25000, !1); | ||
| 7369 | - wx.showToast({ | ||
| 7370 | - title: '门店库存不足', | ||
| 7371 | - icon: 'none', | ||
| 7372 | - }); | ||
| 7373 | - return false; | ||
| 7374 | - } | 7356 | + if (!th.data.front_only_pk && !th.data.front_def_pickpu_list && !th.data.change) { |
| 7357 | + // getApp().confirmBox("门店库存不足", null, 25000, !1); | ||
| 7358 | + wx.showToast({ | ||
| 7359 | + title: '门店库存不足', | ||
| 7360 | + icon: 'none', | ||
| 7361 | + }); | ||
| 7362 | + return false; | ||
| 7363 | + } | ||
| 7364 | + th.data.change = 0; | ||
| 7365 | + | ||
| 7366 | + if (th.data.front_only_pk && !th.data.front_only_pk.length) { | ||
| 7367 | + // getApp().confirmBox("门店库存不足", null, 25000, !1); | ||
| 7368 | + wx.showToast({ | ||
| 7369 | + title: '门店库存不足', | ||
| 7370 | + icon: 'none', | ||
| 7371 | + }); | ||
| 7372 | + return false; | ||
| 7373 | + } | ||
| 7374 | + if (th.data.front_def_pickpu_list && !th.data.front_def_pickpu_list.length) { | ||
| 7375 | + // getApp().confirmBox("门店库存不足", null, 25000, !1); | ||
| 7376 | + wx.showToast({ | ||
| 7377 | + title: '门店库存不足', | ||
| 7378 | + icon: 'none', | ||
| 7379 | + }); | ||
| 7380 | + return false; | ||
| 7381 | + } | ||
| 7382 | + | ||
| 7383 | + //-- 把默认的数据拿过来,数据传递要用深拷贝 -- | ||
| 7384 | + th.setData({ | ||
| 7385 | + def_pick_store: ut.deep_cp(th.data.front_pick), | ||
| 7386 | + only_pk:ut.deep_cp(th.data.front_only_pk), | ||
| 7387 | + def_pickpu_list:ut.deep_cp(th.data.front_def_pickpu_list), | ||
| 7388 | + pickpu_list:ut.deep_cp(th.data.front_pickpu_listt), | ||
| 7389 | + all_sto:ut.deep_cp(th.data.front_all_sto) | ||
| 7390 | + }) | ||
| 7391 | + | ||
| 7392 | + | ||
| 7393 | + this.setData({ | ||
| 7394 | + open_ind_store: ind, | ||
| 7395 | + store: 1, | ||
| 7396 | + openSpecModal: !1, | ||
| 7397 | + openSpecModal_pt: !1, | ||
| 7398 | + openSpecModal_flash_normal: !1, | ||
| 7399 | + }) | ||
| 7375 | 7400 | ||
| 7376 | - //如果开启了,则不在选择门店 | ||
| 7377 | - if (th.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) { | ||
| 7378 | return false; | 7401 | return false; |
| 7402 | + | ||
| 7403 | + | ||
| 7404 | + }else{ | ||
| 7405 | + if (!th.data.only_pk && !th.data.def_pickpu_list && !th.data.change) { | ||
| 7406 | + // getApp().confirmBox("门店库存不足", null, 25000, !1); | ||
| 7407 | + wx.showToast({ | ||
| 7408 | + title: '门店库存不足', | ||
| 7409 | + icon: 'none', | ||
| 7410 | + }); | ||
| 7411 | + return false; | ||
| 7412 | + } | ||
| 7413 | + th.data.change = 0; | ||
| 7414 | + | ||
| 7415 | + if (th.data.only_pk && !th.data.only_pk.length) { | ||
| 7416 | + // getApp().confirmBox("门店库存不足", null, 25000, !1); | ||
| 7417 | + wx.showToast({ | ||
| 7418 | + title: '门店库存不足', | ||
| 7419 | + icon: 'none', | ||
| 7420 | + }); | ||
| 7421 | + return false; | ||
| 7422 | + } | ||
| 7423 | + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) { | ||
| 7424 | + // getApp().confirmBox("门店库存不足", null, 25000, !1); | ||
| 7425 | + wx.showToast({ | ||
| 7426 | + title: '门店库存不足', | ||
| 7427 | + icon: 'none', | ||
| 7428 | + }); | ||
| 7429 | + return false; | ||
| 7430 | + } | ||
| 7431 | + | ||
| 7379 | } | 7432 | } |
| 7380 | 7433 | ||
| 7381 | 7434 | ||
| 7382 | 7435 | ||
| 7436 | + | ||
| 7437 | + | ||
| 7438 | + | ||
| 7383 | if (bconfig && bconfig.is_sort_storage) { | 7439 | if (bconfig && bconfig.is_sort_storage) { |
| 7384 | wx.getLocation({ | 7440 | wx.getLocation({ |
| 7385 | type: 'gcj02', | 7441 | type: 'gcj02', |
| @@ -7524,12 +7580,18 @@ Page({ | @@ -7524,12 +7580,18 @@ Page({ | ||
| 7524 | check_the_pick(item, func) { | 7580 | check_the_pick(item, func) { |
| 7525 | var th = this; | 7581 | var th = this; |
| 7526 | var goodsinfo = th.data.sele_g; | 7582 | var goodsinfo = th.data.sele_g; |
| 7583 | + | ||
| 7584 | + if(th.data.isfront){ | ||
| 7585 | + goodsinfo=this.data.front_g; | ||
| 7586 | + } | ||
| 7587 | + | ||
| 7588 | + | ||
| 7527 | var erpwareid = goodsinfo.erpwareid; | 7589 | var erpwareid = goodsinfo.erpwareid; |
| 7528 | var plist = null; | 7590 | var plist = null; |
| 7529 | var lock = 0; | 7591 | var lock = 0; |
| 7530 | 7592 | ||
| 7531 | //---如果是活动的时候,同时不是普通购买--- | 7593 | //---如果是活动的时候,同时不是普通购买--- |
| 7532 | - if (getApp().is_virtual(th.data.sele_g) || th.data.sele_g.whsle_id || ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) > -1 && !th.data.is_normal)) { | 7594 | + if (getApp().is_virtual(goodsinfo) || goodsinfo.whsle_id || ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) > -1 && !th.data.is_normal)) { |
| 7533 | func(); | 7595 | func(); |
| 7534 | return false; | 7596 | return false; |
| 7535 | } | 7597 | } |
| @@ -7655,19 +7717,13 @@ Page({ | @@ -7655,19 +7717,13 @@ Page({ | ||
| 7655 | } | 7717 | } |
| 7656 | 7718 | ||
| 7657 | 7719 | ||
| 7658 | - | ||
| 7659 | - | ||
| 7660 | - | ||
| 7661 | - | ||
| 7662 | if (!th.data.sele_g) return false; | 7720 | if (!th.data.sele_g) return false; |
| 7663 | //判断门店的配送方式是不是匹配 | 7721 | //判断门店的配送方式是不是匹配 |
| 7664 | var g_distr_type = th.data.sele_g.distr_type; | 7722 | var g_distr_type = th.data.sele_g.distr_type; |
| 7665 | - | ||
| 7666 | if(th.data.isfront==1){ | 7723 | if(th.data.isfront==1){ |
| 7667 | g_distr_type = th.data.data.distr_type; | 7724 | g_distr_type = th.data.data.distr_type; |
| 7668 | } | 7725 | } |
| 7669 | 7726 | ||
| 7670 | - | ||
| 7671 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { | 7727 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { |
| 7672 | wx.showToast({ | 7728 | wx.showToast({ |
| 7673 | title: "门店配送方式不匹配,请选择其他门店", | 7729 | title: "门店配送方式不匹配,请选择其他门店", |
| @@ -7689,6 +7745,14 @@ Page({ | @@ -7689,6 +7745,14 @@ Page({ | ||
| 7689 | fir_pick_index: 0 | 7745 | fir_pick_index: 0 |
| 7690 | }); | 7746 | }); |
| 7691 | 7747 | ||
| 7748 | + | ||
| 7749 | + if(th.data.isfront){ | ||
| 7750 | + th.setData({ | ||
| 7751 | + front_pick: ut.deep_cp(item) | ||
| 7752 | + }) | ||
| 7753 | + } | ||
| 7754 | + | ||
| 7755 | + | ||
| 7692 | switch (openindstore) { | 7756 | switch (openindstore) { |
| 7693 | case 1: | 7757 | case 1: |
| 7694 | th.setData({ | 7758 | th.setData({ |
utils/util.js
| @@ -1012,5 +1012,11 @@ module.exports = { | @@ -1012,5 +1012,11 @@ module.exports = { | ||
| 1012 | wx_back:wx_back, | 1012 | wx_back:wx_back, |
| 1013 | _debounce, | 1013 | _debounce, |
| 1014 | calculatewuliu:calculatewuliu, //计算物流的函数进行抽象 | 1014 | calculatewuliu:calculatewuliu, //计算物流的函数进行抽象 |
| 1015 | - format_content | 1015 | + format_content, |
| 1016 | + deep_cp:function(e){ | ||
| 1017 | + if(!e) return null; | ||
| 1018 | + //判断e是不是对象类型 | ||
| 1019 | + var new_e = JSON.parse(JSON.stringify(e)); | ||
| 1020 | + return new_e; | ||
| 1021 | + } | ||
| 1016 | }; | 1022 | }; |