Commit 4f6f14c5431d2f19a6937164d3a74eab1c467ec6
1 parent
9dae48af
OA单,和图片转成代码线上的~~解决超包的问题 ---还有组合购要取用线下库存的优化
Showing
17 changed files
with
249 additions
and
44 deletions
components/diy_live/diy_live.js
components/diy_live/diy_live.wxml
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <view class="close-box"> |
4 | 4 | <text class="iconfont icon-guan"></text> |
5 | 5 | </view> |
6 | - <image class="img" src="../../images/share/default_g_img.gif" mode="aspectFit"></image> | |
6 | + <image class="img" src="{{imghost}}/miniapp/images/default_g_img.gif" mode="aspectFit"></image> | |
7 | 7 | <view class="zhibo-box t-c fs26"> |
8 | 8 | <text class="iconfont icon-zhibo"></text> 直播 |
9 | 9 | </view> | ... | ... |
images/share/default_g_img.gif deleted
4.23 KB
packageA/pages/activity_share/activity_share.js
... | ... | @@ -1203,9 +1203,17 @@ Page({ |
1203 | 1203 | ee.data.share_goods_img = res.path; |
1204 | 1204 | tt(); |
1205 | 1205 | }, |
1206 | - fail: function(res) { | |
1207 | - ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
1208 | - tt(); | |
1206 | + fail: function(res) { | |
1207 | + | |
1208 | + //获取默认空白图 | |
1209 | + wx.getImageInfo({ | |
1210 | + src: ee.data.url+'/miniapp/images/default_g_img.gif', | |
1211 | + success: function(res) { | |
1212 | + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | |
1213 | + tt(); | |
1214 | + } | |
1215 | + }) | |
1216 | + | |
1209 | 1217 | } |
1210 | 1218 | }); |
1211 | 1219 | }, | ... | ... |
packageA/pages/goodsInfo/goodsInfo.js
... | ... | @@ -2444,9 +2444,15 @@ Page({ |
2444 | 2444 | tt(); |
2445 | 2445 | }, |
2446 | 2446 | fail: function(res) { |
2447 | + //获取默认空白图 | |
2448 | + wx.getImageInfo({ | |
2449 | + src: ee.data.iurl+'/miniapp/images/default_g_img.gif', | |
2450 | + success: function(res) { | |
2451 | + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | |
2452 | + tt(); | |
2453 | + } | |
2454 | + }) | |
2447 | 2455 | |
2448 | - ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
2449 | - tt(); | |
2450 | 2456 | } |
2451 | 2457 | }); |
2452 | 2458 | }, | ... | ... |
packageA/pages/goods_share/goods_share.js
... | ... | @@ -806,8 +806,16 @@ Page({ |
806 | 806 | tt(); |
807 | 807 | }, |
808 | 808 | fail: function(res) { |
809 | - ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
810 | - tt(); | |
809 | + | |
810 | + //获取默认空白图 | |
811 | + wx.getImageInfo({ | |
812 | + src: ee.data.url+'/miniapp/images/default_g_img.gif', | |
813 | + success: function(res) { | |
814 | + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | |
815 | + tt(); | |
816 | + } | |
817 | + }) | |
818 | + | |
811 | 819 | } |
812 | 820 | }); |
813 | 821 | }, | ... | ... |
packageA/pages/service_share/service_share.js
... | ... | @@ -784,9 +784,15 @@ Page({ |
784 | 784 | ee.data.share_goods_img = res.path; |
785 | 785 | tt(); |
786 | 786 | }, |
787 | - fail: function(res) { | |
788 | - ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
789 | - tt(); | |
787 | + fail: function(res) { | |
788 | + //获取默认空白图 | |
789 | + wx.getImageInfo({ | |
790 | + src: ee.data.url+'/miniapp/images/default_g_img.gif', | |
791 | + success: function(res) { | |
792 | + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | |
793 | + tt(); | |
794 | + } | |
795 | + }) | |
790 | 796 | } |
791 | 797 | }); |
792 | 798 | }, | ... | ... |
packageB/pages/zuhegou/index/index.js
... | ... | @@ -116,7 +116,9 @@ Page({ |
116 | 116 | sort_store: 0, //门店分类 |
117 | 117 | choice_sort_store: 0, //选择分类门店 |
118 | 118 | fir_pick_index: 0, //门店选择的下标 |
119 | - sec_pick_index: 0 //门店选择的下标,地区选择之后的内页 | |
119 | + sec_pick_index: 0, //门店选择的下标,地区选择之后的内页 | |
120 | + | |
121 | + sales_map:{}, //线下销售的map | |
120 | 122 | }, |
121 | 123 | |
122 | 124 | /** |
... | ... | @@ -311,7 +313,6 @@ Page({ |
311 | 313 | getApp().getConfig2(function (e) { |
312 | 314 | ee.setData({ |
313 | 315 | bconfig: e, |
314 | - sales_rules: e.sales_rules, | |
315 | 316 | }); |
316 | 317 | //设置基本参数 |
317 | 318 | th.wait_for_store_config(e); |
... | ... | @@ -533,6 +534,9 @@ Page({ |
533 | 534 | //说明是加入购物车是时候 |
534 | 535 | this.data.is_zuhe_addcart = 1; |
535 | 536 | if (!haveAdded) { |
537 | + | |
538 | + | |
539 | + | |
536 | 540 | th.data.sele_g = this.data.list[index]; |
537 | 541 | if (!th.data.sele_g.num) th.data.goodsInputNum = 1; |
538 | 542 | |
... | ... | @@ -567,11 +571,14 @@ Page({ |
567 | 571 | } |
568 | 572 | return false; |
569 | 573 | } else { |
570 | - th.setData({ | |
571 | - is_no_pipei: 0 | |
572 | - }); | |
573 | - th.check_is_in_cart(function () { | |
574 | - th.add_cart_func(); | |
574 | + //先判断一下线下库存 | |
575 | + th.check_pk_store_conut(function(){ | |
576 | + th.setData({ | |
577 | + is_no_pipei: 0 | |
578 | + }); | |
579 | + th.check_is_in_cart(function () { | |
580 | + th.add_cart_func(); | |
581 | + }) | |
575 | 582 | }) |
576 | 583 | } |
577 | 584 | } else { |
... | ... | @@ -648,6 +655,109 @@ Page({ |
648 | 655 | |
649 | 656 | }, |
650 | 657 | |
658 | + //在启用线下的时候,要判断一下是不是有库存 | |
659 | + async check_pk_store_conut(func,is_no_msg,gd,by_num){ | |
660 | + var th=this; | |
661 | + if(this.data.sales_rules!=2){ | |
662 | + func(); | |
663 | + } | |
664 | + //门店库存no | |
665 | + var pkno= gd && gd.pickup_no?gd.pickup_no:this.data.def_pick_store.pickup_no; | |
666 | + var pickup_id=gd && gd.pick_id?gd.pick_id:this.data.def_pick_store.pickup_id; | |
667 | + var lock = []; | |
668 | + var plist=null; | |
669 | + var good=gd || th.data.sele_g; | |
670 | + var buy_num=by_num || th.data.goodsInputNum; | |
671 | + | |
672 | + if(this.data.sales_map[good.goods_id]){ | |
673 | + | |
674 | + var mp=this.data.sales_map[good.goods_id]; | |
675 | + var lock_num=mp.lock_num; | |
676 | + var CanOutQty=mp.CanOutQty; | |
677 | + if (CanOutQty < lock_num +buy_num) { | |
678 | + | |
679 | + if(!is_no_msg) { | |
680 | + wx.showToast({ | |
681 | + title: "门店库存不足", | |
682 | + icon: 'none', | |
683 | + duration: 2000 | |
684 | + }) | |
685 | + } | |
686 | + return false; | |
687 | + } | |
688 | + if(is_no_msg) return true; | |
689 | + func(); | |
690 | + | |
691 | + }else { | |
692 | + //先读取门店的lock,采用链式写法,少用await | |
693 | + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | |
694 | + data: {store_id: os.stoid, wareId: good.goods_id, pageSize: 1000} | |
695 | + }).then(res => { | |
696 | + if (res.data.code == 0 && res.data.data.total > 0) { | |
697 | + lock = res.data.data.pageData | |
698 | + } | |
699 | + | |
700 | + }) | |
701 | + //---通过接口获取门店的线下库存信息-- | |
702 | + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | |
703 | + data: { | |
704 | + storageNos: pkno, | |
705 | + wareIds: encodeURIComponent(good.erpwareid), | |
706 | + storeId: os.stoid, | |
707 | + pageSize: 2000 | |
708 | + } | |
709 | + }).then(res => { | |
710 | + if (ut.ajax_ok(res)) { | |
711 | + plist = res.data.data.pageData[0]; | |
712 | + } | |
713 | + }) | |
714 | + | |
715 | + if(!plist){ | |
716 | + if(!is_no_msg) { | |
717 | + wx.showToast({ | |
718 | + title: "该商品在门店未找到库存", | |
719 | + icon: 'none', | |
720 | + duration: 2000 | |
721 | + }) | |
722 | + } | |
723 | + return false; | |
724 | + } | |
725 | + | |
726 | + var lock_num = th.find_lock_num(pickup_id, lock); | |
727 | + this.data.sales_map[good.goods_id]={ | |
728 | + CanOutQty:plist.CanOutQty, | |
729 | + lock_num:lock_num | |
730 | + } | |
731 | + | |
732 | + if (plist.CanOutQty < lock_num + buy_num) { | |
733 | + if(!is_no_msg) { | |
734 | + wx.showToast({ | |
735 | + title: "该商品在门店未找到库存", | |
736 | + icon: 'none', | |
737 | + duration: 2000 | |
738 | + }) | |
739 | + } | |
740 | + return false; | |
741 | + } | |
742 | + if(is_no_msg) return true; | |
743 | + func(); | |
744 | + } | |
745 | + | |
746 | + }, | |
747 | + | |
748 | + find_lock_num(pick_id, lock) { | |
749 | + var lock_num = 0; | |
750 | + if (!lock) return 0; | |
751 | + if (lock.length < 0) return 0; | |
752 | + for (var i in lock) { | |
753 | + if (pick_id == lock[i].pickupId) { | |
754 | + lock_num += lock[i].outQty; | |
755 | + } | |
756 | + } | |
757 | + return lock_num; | |
758 | + }, | |
759 | + | |
760 | + | |
651 | 761 | /** |
652 | 762 | * 增加数量 |
653 | 763 | */ |
... | ... | @@ -664,13 +774,17 @@ Page({ |
664 | 774 | this.data.changing = 1; |
665 | 775 | |
666 | 776 | var index = e.currentTarget.dataset.index; |
667 | - this.data.sele_g = this.data.list[index]; | |
777 | + this.data.sele_g = th.data.list[index]; | |
668 | 778 | this.data.sele_index = index; |
669 | - th.data.goodsInputNum = this.data.sele_g.num + 1; | |
670 | - if (this.data.sele_g.cart_num) { | |
671 | - th.data.s_cart_num = this.data.sele_g.cart_num + 1; | |
672 | - } | |
673 | - th.add_cart_func(); | |
779 | + th.data.goodsInputNum = th.data.sele_g.num + 1; | |
780 | + | |
781 | + th.check_pk_store_conut(function(){ | |
782 | + if (th.data.sele_g.cart_num) { | |
783 | + th.data.s_cart_num = th.data.sele_g.cart_num + 1; | |
784 | + } | |
785 | + th.add_cart_func(); | |
786 | + }) | |
787 | + | |
674 | 788 | }, |
675 | 789 | |
676 | 790 | /** |
... | ... | @@ -1581,11 +1695,19 @@ Page({ |
1581 | 1695 | //只是单纯的选择门店 |
1582 | 1696 | if (this.data.only) { |
1583 | 1697 | this.data.only = 0; |
1698 | + this.data.sales_map={}; | |
1699 | + | |
1584 | 1700 | return false; |
1585 | 1701 | } |
1586 | - th.check_is_in_cart(function () { | |
1587 | - th.add_cart_func(); | |
1702 | + | |
1703 | + //-- 判断一下库存 -- | |
1704 | + th.check_pk_store_conut(function(){ | |
1705 | + th.check_is_in_cart(function () { | |
1706 | + th.add_cart_func(); | |
1707 | + }) | |
1588 | 1708 | }) |
1709 | + | |
1710 | + | |
1589 | 1711 | }, |
1590 | 1712 | |
1591 | 1713 | |
... | ... | @@ -2116,7 +2238,7 @@ Page({ |
2116 | 2238 | getApp().request.get("/api/weshop/cart/list", { |
2117 | 2239 | data: req, |
2118 | 2240 | success: async function (e) { |
2119 | - if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length) { | |
2241 | + if(ut.ajax_ok(e)) { | |
2120 | 2242 | var map = {}; |
2121 | 2243 | var mlist = e.data.data.pageData; |
2122 | 2244 | th.data.cart_list = mlist; |
... | ... | @@ -2127,6 +2249,8 @@ Page({ |
2127 | 2249 | if (item.prom_id != th.data.act.id) continue; |
2128 | 2250 | map[item.goods_id] = item; |
2129 | 2251 | } |
2252 | + | |
2253 | + //-- 循环活动的从表 -- | |
2130 | 2254 | for (let j in th.data.list) { |
2131 | 2255 | let item_j = th.data.list[j]; |
2132 | 2256 | item_j.current_price = item_j.shop_price; |
... | ... | @@ -2144,6 +2268,16 @@ Page({ |
2144 | 2268 | if (map[item_j.goods_id]) { |
2145 | 2269 | var cart_num = map[item_j.goods_id].goods_num; |
2146 | 2270 | item_j.num = cart_num; |
2271 | + item_j.pickup_no = map[item_j.goods_id].pickup_no; | |
2272 | + item_j.pick_id = map[item_j.goods_id].pick_id; | |
2273 | + | |
2274 | + //判断库存是不是存在 | |
2275 | + var can_qty=await th.check_pk_store_conut(null,1,item_j,cart_num); | |
2276 | + if(!can_qty){ | |
2277 | + item_j.num=0; | |
2278 | + continue; | |
2279 | + } | |
2280 | + | |
2147 | 2281 | item_j.cart_num = cart_num; |
2148 | 2282 | item_j.cart_id = map[item_j.goods_id].id; |
2149 | 2283 | if (item_j.buyqty > 0) { | ... | ... |
packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js
... | ... | @@ -952,8 +952,14 @@ Page({ |
952 | 952 | tt(); |
953 | 953 | }, |
954 | 954 | fail: function (res) { |
955 | - ee.data.share_img_localpath= "../../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
956 | - tt(); | |
955 | + //获取默认空白图 | |
956 | + wx.getImageInfo({ | |
957 | + src: os.imghost+'/miniapp/images/default_g_img.gif', | |
958 | + success: function(res) { | |
959 | + ee.data.share_img_localpath = res.path; //分享的图片不能用网络的 | |
960 | + tt(); | |
961 | + } | |
962 | + }) | |
957 | 963 | } |
958 | 964 | }); |
959 | 965 | }, | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -5375,8 +5375,14 @@ Page({ |
5375 | 5375 | tt(); |
5376 | 5376 | }, |
5377 | 5377 | fail: function (res) { |
5378 | - ee.data.share_goods_img = "../../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
5379 | - tt(); | |
5378 | + //获取默认空白图 | |
5379 | + wx.getImageInfo({ | |
5380 | + src: ee.data.iurl+'/miniapp/images/default_g_img.gif', | |
5381 | + success: function(res) { | |
5382 | + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | |
5383 | + tt(); | |
5384 | + } | |
5385 | + }) | |
5380 | 5386 | } |
5381 | 5387 | }); |
5382 | 5388 | }, | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -3166,8 +3166,14 @@ Page({ |
3166 | 3166 | tt(); |
3167 | 3167 | }, |
3168 | 3168 | fail: function (res) { |
3169 | - ee.data.share_goods_img = "../../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
3170 | - tt(); | |
3169 | + //获取默认空白图 | |
3170 | + wx.getImageInfo({ | |
3171 | + src: ee.data.iurl+'/miniapp/images/default_g_img.gif', | |
3172 | + success: function(res) { | |
3173 | + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | |
3174 | + tt(); | |
3175 | + } | |
3176 | + }) | |
3171 | 3177 | } |
3172 | 3178 | }); |
3173 | 3179 | }, | ... | ... |
packageC/pages/presell/pregoodsInfo/goodsInfo.js
... | ... | @@ -3115,8 +3115,14 @@ Page({ |
3115 | 3115 | tt(); |
3116 | 3116 | }, |
3117 | 3117 | fail: function (res) { |
3118 | - ee.data.share_goods_img = "../../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
3119 | - tt(); | |
3118 | + //获取默认空白图 | |
3119 | + wx.getImageInfo({ | |
3120 | + src: ee.data.iurl+'/miniapp/images/default_g_img.gif', | |
3121 | + success: function(res) { | |
3122 | + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | |
3123 | + tt(); | |
3124 | + } | |
3125 | + }) | |
3120 | 3126 | } |
3121 | 3127 | }); |
3122 | 3128 | }, | ... | ... |
pages/cart/cart/cart.js
... | ... | @@ -2080,7 +2080,7 @@ Page({ |
2080 | 2080 | |
2081 | 2081 | function normal_check(store_count, goodsinfo, wareIds) { |
2082 | 2082 | //--- 看一下是不是线下库存 --- |
2083 | - if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7 && !goodsinfo.whsle_id) { | |
2083 | + if (th.data.sales_rules == 2 && !goodsinfo.whsle_id) { | |
2084 | 2084 | th.check_down_line(t, pitem, item, wareIds); |
2085 | 2085 | } else { |
2086 | 2086 | if (t.goods_num > store_count) { | ... | ... |
pages/giftpack/giftpacklist/giftpacklist.js
... | ... | @@ -1126,8 +1126,14 @@ Page({ |
1126 | 1126 | tt(); |
1127 | 1127 | }, |
1128 | 1128 | fail: function (res) { |
1129 | - ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
1130 | - tt(); | |
1129 | + //获取默认空白图 | |
1130 | + wx.getImageInfo({ | |
1131 | + src: ee.data.iurl+'/miniapp/images/default_g_img.gif', | |
1132 | + success: function(res) { | |
1133 | + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | |
1134 | + tt(); | |
1135 | + } | |
1136 | + }) | |
1131 | 1137 | } |
1132 | 1138 | }); |
1133 | 1139 | }, | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -5736,8 +5736,14 @@ Page({ |
5736 | 5736 | tt(); |
5737 | 5737 | }, |
5738 | 5738 | fail: function (res) { |
5739 | - ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
5740 | - tt(); | |
5739 | + //获取默认空白图 | |
5740 | + wx.getImageInfo({ | |
5741 | + src: ee.data.iurl+'/miniapp/images/default_g_img.gif', | |
5742 | + success: function(res) { | |
5743 | + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | |
5744 | + tt(); | |
5745 | + } | |
5746 | + }) | |
5741 | 5747 | } |
5742 | 5748 | }); |
5743 | 5749 | }, | ... | ... |
pages/team/team_success/team_success.js
... | ... | @@ -794,8 +794,14 @@ Page({ |
794 | 794 | tt(); |
795 | 795 | }, |
796 | 796 | fail: function (res) { |
797 | - ee.data.share_img_localpath= "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
798 | - tt(); | |
797 | + //获取默认空白图 | |
798 | + wx.getImageInfo({ | |
799 | + src: os.imghost+'/miniapp/images/default_g_img.gif', | |
800 | + success: function(res) { | |
801 | + ee.data.share_img_localpath = res.path; //分享的图片不能用网络的 | |
802 | + tt(); | |
803 | + } | |
804 | + }) | |
799 | 805 | } |
800 | 806 | }); |
801 | 807 | }, | ... | ... |
pages/user/cardinfo/cardinfo.js