Commit 1f50def26980fba3ee6ce52fcfd68a619bb67f71
Merge branch 'dev' into 'test'
Dev See merge request !1125
Showing
15 changed files
with
1670 additions
and
643 deletions
packageA/pages/goodsInfo/goodsInfo.js
@@ -853,6 +853,13 @@ Page({ | @@ -853,6 +853,13 @@ Page({ | ||
853 | } | 853 | } |
854 | 854 | ||
855 | 855 | ||
856 | + if(this.data.goodsInputNum==0){ | ||
857 | + getApp().my_warnning('请输入购买数量', 1, th, 450); | ||
858 | + return false; | ||
859 | + } | ||
860 | + | ||
861 | + | ||
862 | + | ||
856 | if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind; | 863 | if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind; |
857 | 864 | ||
858 | th.setData({ | 865 | th.setData({ |
@@ -870,6 +877,8 @@ Page({ | @@ -870,6 +877,8 @@ Page({ | ||
870 | var limitNum = 0; | 877 | var limitNum = 0; |
871 | // 已购买数量 | 878 | // 已购买数量 |
872 | var boughtNum = 0; | 879 | var boughtNum = 0; |
880 | + | ||
881 | + var is_ok=1; | ||
873 | 882 | ||
874 | // 秒杀活动 | 883 | // 秒杀活动 |
875 | if(this.data.prom_type == 1) { | 884 | if(this.data.prom_type == 1) { |
@@ -895,6 +904,7 @@ Page({ | @@ -895,6 +904,7 @@ Page({ | ||
895 | // title: '超出活动库存', | 904 | // title: '超出活动库存', |
896 | // }); | 905 | // }); |
897 | getApp().my_warnning('超出活动库存', 0, self); | 906 | getApp().my_warnning('超出活动库存', 0, self); |
907 | + is_ok=0; | ||
898 | return false; | 908 | return false; |
899 | } else { | 909 | } else { |
900 | // 可购买数量>0 | 910 | // 可购买数量>0 |
@@ -922,8 +932,9 @@ Page({ | @@ -922,8 +932,9 @@ Page({ | ||
922 | // }); | 932 | // }); |
923 | getApp().my_warnning('超出活动库存', 0, self); | 933 | getApp().my_warnning('超出活动库存', 0, self); |
924 | th.setData({ | 934 | th.setData({ |
925 | - goodsInputNum: res, | 935 | + goodsInputNum: res || 1 |
926 | }); | 936 | }); |
937 | + is_ok=0; | ||
927 | return false; | 938 | return false; |
928 | }; | 939 | }; |
929 | }; | 940 | }; |
@@ -935,8 +946,9 @@ Page({ | @@ -935,8 +946,9 @@ Page({ | ||
935 | // }); | 946 | // }); |
936 | getApp().my_warnning('超出限购数量', 0, self); | 947 | getApp().my_warnning('超出限购数量', 0, self); |
937 | th.setData({ | 948 | th.setData({ |
938 | - goodsInputNum: canBuyNum, | 949 | + goodsInputNum: canBuyNum || 1, |
939 | }); | 950 | }); |
951 | + is_ok=0; | ||
940 | return false; | 952 | return false; |
941 | }; | 953 | }; |
942 | }; | 954 | }; |
@@ -955,7 +967,10 @@ Page({ | @@ -955,7 +967,10 @@ Page({ | ||
955 | }; | 967 | }; |
956 | 968 | ||
957 | 969 | ||
958 | - | 970 | + if(!is_ok) return false; |
971 | + | ||
972 | + | ||
973 | + | ||
959 | if(action=="buy"){ | 974 | if(action=="buy"){ |
960 | //--------------此时操作的数据------------ | 975 | //--------------此时操作的数据------------ |
961 | var newd = { | 976 | var newd = { |
@@ -1243,7 +1258,7 @@ Page({ | @@ -1243,7 +1258,7 @@ Page({ | ||
1243 | // }); | 1258 | // }); |
1244 | getApp().my_warnning('超出活动库存', 0, self); | 1259 | getApp().my_warnning('超出活动库存', 0, self); |
1245 | th.setData({ | 1260 | th.setData({ |
1246 | - goodsInputNum: res, | 1261 | + goodsInputNum: res || 1, |
1247 | }); | 1262 | }); |
1248 | return false; | 1263 | return false; |
1249 | }; | 1264 | }; |
@@ -1256,7 +1271,7 @@ Page({ | @@ -1256,7 +1271,7 @@ Page({ | ||
1256 | // }); | 1271 | // }); |
1257 | getApp().my_warnning('超出限购数量', 0, self); | 1272 | getApp().my_warnning('超出限购数量', 0, self); |
1258 | th.setData({ | 1273 | th.setData({ |
1259 | - goodsInputNum: canBuyNum, | 1274 | + goodsInputNum: canBuyNum || 1, |
1260 | }); | 1275 | }); |
1261 | return false; | 1276 | return false; |
1262 | }; | 1277 | }; |
packageB/pages/zuhegou/index/index.js
@@ -358,12 +358,17 @@ Page({ | @@ -358,12 +358,17 @@ Page({ | ||
358 | } | 358 | } |
359 | } | 359 | } |
360 | //获取购物车的内容 | 360 | //获取购物车的内容 |
361 | - th.get_cart_val(e); | 361 | + setTimeout(function(){ |
362 | + th.get_cart_val(e); | ||
363 | + },1000) | ||
364 | + | ||
362 | 365 | ||
363 | }) | 366 | }) |
364 | } else { | 367 | } else { |
365 | //获取购物车的内容 | 368 | //获取购物车的内容 |
366 | - th.get_cart_val(e); | 369 | + setTimeout(function(){ |
370 | + th.get_cart_val(e); | ||
371 | + },1000) | ||
367 | } | 372 | } |
368 | }, 1); | 373 | }, 1); |
369 | 374 | ||
@@ -659,7 +664,8 @@ Page({ | @@ -659,7 +664,8 @@ Page({ | ||
659 | async check_pk_store_conut(func,is_no_msg,gd,by_num){ | 664 | async check_pk_store_conut(func,is_no_msg,gd,by_num){ |
660 | var th=this; | 665 | var th=this; |
661 | if(this.data.sales_rules!=2){ | 666 | if(this.data.sales_rules!=2){ |
662 | - func(); | 667 | + if(func) func(); |
668 | + return false; | ||
663 | } | 669 | } |
664 | //门店库存no | 670 | //门店库存no |
665 | var pkno= gd && gd.pickup_no?gd.pickup_no:this.data.def_pick_store.pickup_no; | 671 | var pkno= gd && gd.pickup_no?gd.pickup_no:this.data.def_pick_store.pickup_no; |
@@ -2242,11 +2248,15 @@ Page({ | @@ -2242,11 +2248,15 @@ Page({ | ||
2242 | var map = {}; | 2248 | var map = {}; |
2243 | var mlist = e.data.data.pageData; | 2249 | var mlist = e.data.data.pageData; |
2244 | th.data.cart_list = mlist; | 2250 | th.data.cart_list = mlist; |
2245 | - | ||
2246 | for (let i in mlist) { | 2251 | for (let i in mlist) { |
2247 | let item = mlist[i]; | 2252 | let item = mlist[i]; |
2248 | if (item.prom_type != 7) continue; | 2253 | if (item.prom_type != 7) continue; |
2249 | if (item.prom_id != th.data.act.id) continue; | 2254 | if (item.prom_id != th.data.act.id) continue; |
2255 | + if(th.data.def_pick_store && th.data.def_pick_store.pickup_id){ | ||
2256 | + if(item.pick_id!=th.data.def_pick_store.pickup_id){ | ||
2257 | + continue; | ||
2258 | + } | ||
2259 | + } | ||
2250 | map[item.goods_id] = item; | 2260 | map[item.goods_id] = item; |
2251 | } | 2261 | } |
2252 | 2262 |
packageC/pages/goods/distributionCategoryList/index.js
@@ -143,9 +143,9 @@ Page({ | @@ -143,9 +143,9 @@ Page({ | ||
143 | that.setData({ store_config: e, is_do: 1 }); | 143 | that.setData({ store_config: e, is_do: 1 }); |
144 | 144 | ||
145 | //---有勾品类--- | 145 | //---有勾品类--- |
146 | - if (that.data.is_show_pl) { | ||
147 | - that.getGoodsCategoris(); | ||
148 | - } | 146 | + //if (that.data.is_show_pl) { |
147 | + // that.getGoodsCategoris(); | ||
148 | + //} | ||
149 | if (that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl) { | 149 | if (that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl) { |
150 | that.data.pl_timer = setInterval(function () { | 150 | that.data.pl_timer = setInterval(function () { |
151 | if (that.data.catelist.length > 0) { | 151 | if (that.data.catelist.length > 0) { |
@@ -521,6 +521,7 @@ Page({ | @@ -521,6 +521,7 @@ Page({ | ||
521 | let { currentData } = this.data; | 521 | let { currentData } = this.data; |
522 | currentData.cat_id = this.data.cat_id; | 522 | currentData.cat_id = this.data.cat_id; |
523 | currentData.page = this.data.stylePage; | 523 | currentData.page = this.data.stylePage; |
524 | + currentData.parent_id = 0; | ||
524 | 525 | ||
525 | let url = '/api/weshop/users/distribut/pagemyshop'; | 526 | let url = '/api/weshop/users/distribut/pagemyshop'; |
526 | getApp().promiseGet(url, { | 527 | getApp().promiseGet(url, { |
packageC/pages/goods/distributionCategoryList/index.wxml
@@ -33,7 +33,8 @@ | @@ -33,7 +33,8 @@ | ||
33 | </view> | 33 | </view> |
34 | <view wx:if="{{is_show_pl}}"> | 34 | <view wx:if="{{is_show_pl}}"> |
35 | <scroll-view scroll-y scroll-with-animation class="tab-view" scroll-top="{{scrollTop}}" style="height:88%"> | 35 | <scroll-view scroll-y scroll-with-animation class="tab-view" scroll-top="{{scrollTop}}" style="height:88%"> |
36 | - <view wx:for="{{catelist}}" class="tab-bar-item {{select_classify_on==index ? 'active' : ''}}" data-current="{{index}}" catchtap="click_classify" data-cid="{{item.id}}" data-index="{{index}}" data-name="{{item.name}}"> | 36 | + <view wx:for="{{catelist}}" wx:if="{{item}}" class="tab-bar-item {{select_classify_on==index ? 'active' : ''}}" |
37 | + data-current="{{index}}" catchtap="click_classify" data-cid="{{item.id}}" data-index="{{index}}" data-name="{{item.name}}"> | ||
37 | <text>{{item.name}}</text> | 38 | <text>{{item.name}}</text> |
38 | </view> | 39 | </view> |
39 | </scroll-view> | 40 | </scroll-view> |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -317,6 +317,39 @@ Page({ | @@ -317,6 +317,39 @@ Page({ | ||
317 | //检查测肤 | 317 | //检查测肤 |
318 | getApp().check_skin_face(t,0,gid); | 318 | getApp().check_skin_face(t,0,gid); |
319 | 319 | ||
320 | + //-- 自定义海报 -- | ||
321 | + getApp().request.promiseGet("/api/weshop/goods/poster/page", { | ||
322 | + data: {store_id: os.stoid, type: 1, is_use: 1} | ||
323 | + }).then(res => { | ||
324 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]) { | ||
325 | + | ||
326 | + var poster_data = res.data.data.pageData[0]; | ||
327 | + var json_str = poster_data.jsonStr; | ||
328 | + | ||
329 | + if (json_str) { | ||
330 | + var json_data = JSON.parse(json_str); | ||
331 | + console.log('自定义海报参数-------'); | ||
332 | + console.log(json_data); | ||
333 | + if (json_data.bg_img) { | ||
334 | + | ||
335 | + //-- 把图片那到本地 -- | ||
336 | + wx.getImageInfo({ | ||
337 | + src: json_data.bg_img, | ||
338 | + success: function (res) { | ||
339 | + var path = res.path; | ||
340 | + | ||
341 | + th.setData({share_b_img: path}) | ||
342 | + }, | ||
343 | + fail: function (res) { | ||
344 | + } | ||
345 | + }); | ||
346 | + } | ||
347 | + th.setData({poster: json_data}) | ||
348 | + | ||
349 | + } | ||
350 | + } | ||
351 | + }) | ||
352 | + | ||
320 | //---获取手机地址坐标-- | 353 | //---获取手机地址坐标-- |
321 | //--如果tg_id是空的话,分享回来-- | 354 | //--如果tg_id是空的话,分享回来-- |
322 | // console.log('扫描海报gid'); | 355 | // console.log('扫描海报gid'); |
@@ -714,7 +747,7 @@ Page({ | @@ -714,7 +747,7 @@ Page({ | ||
714 | data: { | 747 | data: { |
715 | store_id: os.stoid, | 748 | store_id: os.stoid, |
716 | type: 1, | 749 | type: 1, |
717 | - pageSize: 3, | 750 | + pageSize: 100, |
718 | page: 1, | 751 | page: 1, |
719 | is_share: 0, | 752 | is_share: 0, |
720 | }, | 753 | }, |
@@ -722,7 +755,24 @@ Page({ | @@ -722,7 +755,24 @@ Page({ | ||
722 | fir_quan = res1.data.data.pageData; | 755 | fir_quan = res1.data.data.pageData; |
723 | }) | 756 | }) |
724 | } | 757 | } |
725 | - | 758 | + //过滤不是本商品的单品优惠券------------------- |
759 | + if(fir_quan.length > 0 ){ | ||
760 | + let goodInfo = ee.data.data | ||
761 | + for (let index = fir_quan.length-1; index >= 0; index--) { | ||
762 | + if (fir_quan[index].useobjecttype==20) { //判断是单品优惠券 | ||
763 | + if (fir_quan[index].useobjectno != goodInfo.goods_sn) { | ||
764 | + fir_quan.splice(index,1) | ||
765 | + } | ||
766 | + } | ||
767 | + } | ||
768 | + } | ||
769 | + let arr=[] | ||
770 | + let length = fir_quan.length | ||
771 | + if (length <= 3) { | ||
772 | + arr=fir_quan | ||
773 | + }else{ | ||
774 | + arr=fir_quan.splice(0,3); | ||
775 | + } | ||
726 | //--------获取视频图片--------- | 776 | //--------获取视频图片--------- |
727 | await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, { | 777 | await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, { |
728 | 1: 1 | 778 | 1: 1 |
@@ -748,7 +798,7 @@ Page({ | @@ -748,7 +798,7 @@ Page({ | ||
748 | is_collect: is_collect, | 798 | is_collect: is_collect, |
749 | collect_id: collect_id, | 799 | collect_id: collect_id, |
750 | categories3: categories3, | 800 | categories3: categories3, |
751 | - fir_quan: fir_quan, | 801 | + fir_quan: arr, |
752 | fir_comments: fir_com, | 802 | fir_comments: fir_com, |
753 | mapurl_f_img: mapurl_f_img, | 803 | mapurl_f_img: mapurl_f_img, |
754 | mapurl: mapurl, | 804 | mapurl: mapurl, |
@@ -4450,7 +4500,18 @@ Page({ | @@ -4450,7 +4500,18 @@ Page({ | ||
4450 | wx.hideLoading(); | 4500 | wx.hideLoading(); |
4451 | quan_list = res.data.data.pageData; | 4501 | quan_list = res.data.data.pageData; |
4452 | }) | 4502 | }) |
4453 | - | 4503 | + //过滤不是本商品的单品优惠券 |
4504 | + if (quan_list.length > 0) { | ||
4505 | + let goodInfo = th.data.data | ||
4506 | + for (let index = quan_list.length-1; index >= 0; index--) { | ||
4507 | + if (quan_list[index].useobjecttype==20) { //判断是单品优惠券 | ||
4508 | + if (quan_list[index].useobjectno != goodInfo.goods_sn) { | ||
4509 | + quan_list.splice(index,1) | ||
4510 | + } | ||
4511 | + } | ||
4512 | + } | ||
4513 | + } | ||
4514 | + //------------------------ | ||
4454 | if (quan_list) { | 4515 | if (quan_list) { |
4455 | for (var ind in quan_list) { | 4516 | for (var ind in quan_list) { |
4456 | var ep = quan_list[ind]; | 4517 | var ep = quan_list[ind]; |
@@ -4620,7 +4681,7 @@ Page({ | @@ -4620,7 +4681,7 @@ Page({ | ||
4620 | // 8.商品标题 | 4681 | // 8.商品标题 |
4621 | context.setFontSize(20 * unit); | 4682 | context.setFontSize(20 * unit); |
4622 | context.setFillStyle('#898989'); | 4683 | context.setFillStyle('#898989'); |
4623 | - this.draw_Text(context, this.data.data.goods_name, | 4684 | + getApp().draw_Text(context, this.data.data.goods_name, |
4624 | 54 * unit, 770 * unit, 240 * unit, 240 * unit, unit); | 4685 | 54 * unit, 770 * unit, 240 * unit, 240 * unit, unit); |
4625 | // 9.小程序码 | 4686 | // 9.小程序码 |
4626 | context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); | 4687 | context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); |
@@ -4717,7 +4778,7 @@ Page({ | @@ -4717,7 +4778,7 @@ Page({ | ||
4717 | // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | 4778 | // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
4718 | 4779 | ||
4719 | 4780 | ||
4720 | - if (type == 0) { // 如果是普通商品,绘制新海报 | 4781 | + if (!th.data.share_b_img && (type == 9)) { // 如果是普通商品,绘制新海报 |
4721 | th.drawPoster(context, unit, th.data.share_goods_img, vpath); | 4782 | th.drawPoster(context, unit, th.data.share_goods_img, vpath); |
4722 | } else { | 4783 | } else { |
4723 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | 4784 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
@@ -4727,7 +4788,7 @@ Page({ | @@ -4727,7 +4788,7 @@ Page({ | ||
4727 | 4788 | ||
4728 | 4789 | ||
4729 | //-- 是自定义海报的情况下 -- | 4790 | //-- 是自定义海报的情况下 -- |
4730 | - if (type != 0) { | 4791 | + if (th.data.share_b_img || type != 0) { |
4731 | 4792 | ||
4732 | 4793 | ||
4733 | 4794 | ||
@@ -4758,10 +4819,10 @@ Page({ | @@ -4758,10 +4819,10 @@ Page({ | ||
4758 | } | 4819 | } |
4759 | } else { | 4820 | } else { |
4760 | //--昵称--- | 4821 | //--昵称--- |
4761 | - context.setFontSize(24 * unit); | ||
4762 | - context.setFillStyle("black"); | ||
4763 | - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit); | ||
4764 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | 4822 | + // context.setFontSize(24 * unit); |
4823 | + // context.setFillStyle("black"); | ||
4824 | + // context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit); | ||
4825 | + // var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | ||
4765 | //强烈推荐 改许程 | 4826 | //强烈推荐 改许程 |
4766 | // var tj_path = "../../../../images/share/q_tj.png"; | 4827 | // var tj_path = "../../../../images/share/q_tj.png"; |
4767 | // let txt_gn = th.data.luckGoInfo.group_num + '人团'; | 4828 | // let txt_gn = th.data.luckGoInfo.group_num + '人团'; |
@@ -4772,9 +4833,9 @@ Page({ | @@ -4772,9 +4833,9 @@ Page({ | ||
4772 | // context.setFillStyle("white"); | 4833 | // context.setFillStyle("white"); |
4773 | // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); | 4834 | // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); |
4774 | // 发出幸运购活动邀请 | 4835 | // 发出幸运购活动邀请 |
4775 | - context.setFillStyle("#7f7f7f") | ||
4776 | - context.setFontSize(21.3 * unit) | ||
4777 | - context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); | 4836 | + // context.setFillStyle("#7f7f7f") |
4837 | + // context.setFontSize(21.3 * unit) | ||
4838 | + // context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); | ||
4778 | 4839 | ||
4779 | } | 4840 | } |
4780 | 4841 | ||
@@ -4791,7 +4852,7 @@ Page({ | @@ -4791,7 +4852,7 @@ Page({ | ||
4791 | 4852 | ||
4792 | //---产品名称--- | 4853 | //---产品名称--- |
4793 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | 4854 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
4794 | - if (type != 4 && type != 0) { | 4855 | + if (th.data.share_b_img || (type != 4 && type != 9)) { |
4795 | context.setFillStyle("black"); | 4856 | context.setFillStyle("black"); |
4796 | context.setFontSize(21.3 * unit) | 4857 | context.setFontSize(21.3 * unit) |
4797 | th.draw_Text(context, share_title, | 4858 | th.draw_Text(context, share_title, |
@@ -4852,11 +4913,29 @@ Page({ | @@ -4852,11 +4913,29 @@ Page({ | ||
4852 | } | 4913 | } |
4853 | 4914 | ||
4854 | //---中间大图--- | 4915 | //---中间大图--- |
4855 | - if (type != 0) { | 4916 | + if ( th.data.share_b_img || type != 9) { |
4856 | context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | 4917 | context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); |
4857 | }; | 4918 | }; |
4858 | 4919 | ||
4920 | + //---自定义海报 产品质量保证 | ||
4921 | + if(th.data.share_b_img && th.data.poster.show_quality==1 ){ | ||
4922 | + var g_path = "../../../../images/share/s_gou.png"; | ||
4923 | + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
4924 | + context.setFillStyle("red") | ||
4925 | + context.setFontSize(18 * unit) | ||
4926 | + context.fillText("正品保证", 84 * unit, 690 * unit); | ||
4927 | + | ||
4928 | + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
4929 | + context.setFillStyle("red") | ||
4930 | + context.setFontSize(18 * unit) | ||
4931 | + context.fillText("纯实体店", 246 * unit, 690 * unit); | ||
4932 | + | ||
4933 | + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
4934 | + context.setFillStyle("red") | ||
4935 | + context.setFontSize(18 * unit) | ||
4936 | + context.fillText("官方验证", 420 * unit, 690 * unit); | ||
4859 | 4937 | ||
4938 | + } | ||
4860 | 4939 | ||
4861 | //-------大图后面就不一样了----------- | 4940 | //-------大图后面就不一样了----------- |
4862 | switch (type) { | 4941 | switch (type) { |
@@ -5073,74 +5152,76 @@ Page({ | @@ -5073,74 +5152,76 @@ Page({ | ||
5073 | 5152 | ||
5074 | 5153 | ||
5075 | case 9: | 5154 | case 9: |
5155 | + if(th.data.share_b_img){ | ||
5076 | 5156 | ||
5077 | - //---画线--- | ||
5078 | - context.setLineWidth(1 * unit) | ||
5079 | - context.moveTo(32 * unit, 680 * unit) | ||
5080 | - context.lineTo(520 * unit, 680 * unit) | ||
5081 | - context.stroke(); | ||
5082 | - | ||
5083 | - //---文字--- | ||
5084 | - context.setFillStyle("black") | ||
5085 | - context.setFontSize(24 * unit) | ||
5086 | - context.font = 'normal bold 18px'; | ||
5087 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | ||
5088 | - | ||
5089 | - //还差N人,即可成团 | ||
5090 | - let group_num = th.data.luckGoInfo.group_num; | ||
5091 | - let num_joined = th.data.luckGoInfo.num; | ||
5092 | - let delta1 = group_num - num_joined; | ||
5093 | - let width_delta1 = ut.measureText(delta1, 15); | ||
5094 | - context.setFillStyle("black"); | ||
5095 | - context.setFontSize(21.3 * unit); | ||
5096 | - context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit); | ||
5097 | - context.setFillStyle("#FF6768"); | ||
5098 | - context.setFontSize(21.3 * unit); | ||
5099 | - context.fillText(delta1, 160 * unit, 772 * unit); | ||
5100 | - context.setFillStyle("black"); | ||
5101 | - context.setFontSize(21.3 * unit); | ||
5102 | - context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit); | ||
5103 | - | ||
5104 | - // N人得商品,N人全额退款 | ||
5105 | - let group_win = th.data.luckGoInfo.group_win; | ||
5106 | - let delta2 = group_num - group_win; | ||
5107 | - let width_delta2 = ut.measureText(delta2, 16); | ||
5108 | - let width_groupNum = ut.measureText(group_num, 15); | ||
5109 | - let width_groupWin = ut.measureText(group_win, 15); | ||
5110 | - context.setFillStyle("#FF6768"); | ||
5111 | - context.setFontSize(21.3 * unit); | ||
5112 | - context.fillText(group_win, 40 * unit, 806 * unit); | ||
5113 | - context.setFillStyle("black"); | ||
5114 | - context.setFontSize(21.3 * unit); | ||
5115 | - context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); | ||
5116 | - context.setFillStyle("#FF6768"); | ||
5117 | - context.setFontSize(21.3 * unit); | ||
5118 | - context.fillText(delta2, 160 * unit, 806 * unit); | ||
5119 | - context.setFillStyle("black"); | ||
5120 | - context.setFontSize(21.3 * unit); | ||
5121 | - context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); | ||
5122 | - | ||
5123 | - // 并得帮团惊喜礼品 | ||
5124 | - context.setFillStyle("black") | ||
5125 | - context.setFontSize(21.3 * unit) | ||
5126 | - context.fillText("并得帮团", 40 * unit, 840 * unit); | ||
5127 | - context.setFillStyle("#FF6768") | ||
5128 | - context.setFontSize(21.3 * unit) | ||
5129 | - context.fillText("惊喜礼品", 130 * unit, 840 * unit); | ||
5130 | - context.setFillStyle("black") | ||
5131 | - context.setFontSize(21.3 * unit) | ||
5132 | - context.fillText("!", 220 * unit, 840 * unit); | 5157 | + |
5158 | + //---画线--- | ||
5159 | + context.setLineWidth(1 * unit) | ||
5160 | + context.moveTo(32 * unit, 680 * unit) | ||
5161 | + context.lineTo(520 * unit, 680 * unit) | ||
5162 | + context.stroke(); | ||
5133 | 5163 | ||
5164 | + //---文字--- | ||
5165 | + context.setFillStyle("black") | ||
5166 | + context.setFontSize(24 * unit) | ||
5167 | + context.font = 'normal bold 18px'; | ||
5168 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | ||
5169 | + | ||
5170 | + //还差N人,即可成团 | ||
5171 | + let group_num = th.data.luckGoInfo.group_num; | ||
5172 | + let num_joined = th.data.luckGoInfo.num; | ||
5173 | + let delta1 = group_num - num_joined; | ||
5174 | + let width_delta1 = ut.measureText(delta1, 15); | ||
5175 | + context.setFillStyle("black"); | ||
5176 | + context.setFontSize(21.3 * unit); | ||
5177 | + context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit); | ||
5178 | + context.setFillStyle("#FF6768"); | ||
5179 | + context.setFontSize(21.3 * unit); | ||
5180 | + context.fillText(delta1, 160 * unit, 772 * unit); | ||
5181 | + context.setFillStyle("black"); | ||
5182 | + context.setFontSize(21.3 * unit); | ||
5183 | + context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit); | ||
5184 | + | ||
5185 | + // N人得商品,N人全额退款 | ||
5186 | + let group_win = th.data.luckGoInfo.group_win; | ||
5187 | + let delta2 = group_num - group_win; | ||
5188 | + let width_delta2 = ut.measureText(delta2, 16); | ||
5189 | + let width_groupNum = ut.measureText(group_num, 15); | ||
5190 | + let width_groupWin = ut.measureText(group_win, 15); | ||
5191 | + context.setFillStyle("#FF6768"); | ||
5192 | + context.setFontSize(21.3 * unit); | ||
5193 | + context.fillText(group_win, 40 * unit, 806 * unit); | ||
5194 | + context.setFillStyle("black"); | ||
5195 | + context.setFontSize(21.3 * unit); | ||
5196 | + context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); | ||
5197 | + context.setFillStyle("#FF6768"); | ||
5198 | + context.setFontSize(21.3 * unit); | ||
5199 | + context.fillText(delta2, 160 * unit, 806 * unit); | ||
5200 | + context.setFillStyle("black"); | ||
5201 | + context.setFontSize(21.3 * unit); | ||
5202 | + context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); | ||
5203 | + | ||
5204 | + // 并得帮团惊喜礼品 | ||
5205 | + context.setFillStyle("black") | ||
5206 | + context.setFontSize(21.3 * unit) | ||
5207 | + context.fillText("并得帮团", 40 * unit, 840 * unit); | ||
5208 | + context.setFillStyle("#FF6768") | ||
5209 | + context.setFontSize(21.3 * unit) | ||
5210 | + context.fillText("惊喜礼品", 130 * unit, 840 * unit); | ||
5211 | + context.setFillStyle("black") | ||
5212 | + context.setFontSize(21.3 * unit) | ||
5213 | + context.fillText("!", 220 * unit, 840 * unit); | ||
5214 | + } | ||
5134 | 5215 | ||
5135 | //---二维吗图--- | 5216 | //---二维吗图--- |
5136 | //-- 自定义海报 -- | 5217 | //-- 自定义海报 -- |
5137 | - if (th.data.poster) { | 5218 | + if (th.data.share_b_img && th.data.poster) { |
5138 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | 5219 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5139 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | 5220 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5140 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | 5221 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
5141 | } else { | 5222 | } else { |
5142 | //---二维吗图--- | 5223 | //---二维吗图--- |
5143 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | 5224 | + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); |
5144 | } | 5225 | } |
5145 | 5226 | ||
5146 | break; | 5227 | break; |
@@ -5150,7 +5231,7 @@ Page({ | @@ -5150,7 +5231,7 @@ Page({ | ||
5150 | 5231 | ||
5151 | 5232 | ||
5152 | //--- 如果是自定义海报的时候 --- | 5233 | //--- 如果是自定义海报的时候 --- |
5153 | - if (type != 0) { | 5234 | + if ( th.data.share_b_img || type != 9) { |
5154 | 5235 | ||
5155 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { | 5236 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
5156 | 5237 | ||
@@ -5324,7 +5405,7 @@ Page({ | @@ -5324,7 +5405,7 @@ Page({ | ||
5324 | 5405 | ||
5325 | 5406 | ||
5326 | 5407 | ||
5327 | - //--获取头像的本地缓存,回调写法-- | 5408 | + //--获取头像的本地缓存,回调写法-- |
5328 | get_head_temp: function (tt, func) { | 5409 | get_head_temp: function (tt, func) { |
5329 | var ee = this; | 5410 | var ee = this; |
5330 | if (ee.data.share_head) { | 5411 | if (ee.data.share_head) { |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
@@ -899,7 +899,7 @@ | @@ -899,7 +899,7 @@ | ||
899 | <view class="shopping-cart cart-ico new_split"> | 899 | <view class="shopping-cart cart-ico new_split"> |
900 | <navigator open-type="switchTab" url="/pages/cart/cart/cart"> | 900 | <navigator open-type="switchTab" url="/pages/cart/cart/cart"> |
901 | <image class="sc-img" src="{{iurl}}/miniapp/images/shopping-cart.png"></image> | 901 | <image class="sc-img" src="{{iurl}}/miniapp/images/shopping-cart.png"></image> |
902 | - <view class="cart-num ellipsis-1">{{cartGoodsNum}}</view> | 902 | + <!-- <view class="cart-num ellipsis-1">{{cartGoodsNum}}</view> --> |
903 | <view>购物车</view> | 903 | <view>购物车</view> |
904 | </navigator> | 904 | </navigator> |
905 | </view> | 905 | </view> |
packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -7,7 +7,7 @@ var ut = require("../../../../utils/util.js"), | @@ -7,7 +7,7 @@ var ut = require("../../../../utils/util.js"), | ||
7 | oo = s.globalData, | 7 | oo = s.globalData, |
8 | o = s.globalData.setting, | 8 | o = s.globalData.setting, |
9 | os = o; | 9 | os = o; |
10 | -//评价加载更多 | 10 | +//评价加载更多 |
11 | var more = function (e) { | 11 | var more = function (e) { |
12 | return e && e.__esModule ? e : { | 12 | return e && e.__esModule ? e : { |
13 | default: e | 13 | default: e |
@@ -250,13 +250,13 @@ Page({ | @@ -250,13 +250,13 @@ Page({ | ||
250 | 250 | ||
251 | share_hidden: false, | 251 | share_hidden: false, |
252 | pre_arr: null, | 252 | pre_arr: null, |
253 | - | ||
254 | - hiddenCS: true, | 253 | + |
254 | + hiddenCS: true, | ||
255 | }, | 255 | }, |
256 | 256 | ||
257 | //------初始化加载---------- | 257 | //------初始化加载---------- |
258 | onLoad: function (t) { | 258 | onLoad: function (t) { |
259 | - self = this; | 259 | + self = this; |
260 | var ee = this, that = ee, th = ee, | 260 | var ee = this, that = ee, th = ee, |
261 | pre_id = t.pre_id, | 261 | pre_id = t.pre_id, |
262 | gid = t.goods_id, | 262 | gid = t.goods_id, |
@@ -264,8 +264,8 @@ Page({ | @@ -264,8 +264,8 @@ Page({ | ||
264 | first_leader = t.first_leader, | 264 | first_leader = t.first_leader, |
265 | room_id = t.room_id, | 265 | room_id = t.room_id, |
266 | room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id | 266 | room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id |
267 | - //检查测肤 | ||
268 | - getApp().check_skin_face(t,0,gid); | 267 | + //检查测肤 |
268 | + getApp().check_skin_face(t, 0, gid); | ||
269 | 269 | ||
270 | //-- 自定义海报 -- | 270 | //-- 自定义海报 -- |
271 | getApp().request.promiseGet("/api/weshop/goods/poster/page", { | 271 | getApp().request.promiseGet("/api/weshop/goods/poster/page", { |
@@ -314,7 +314,7 @@ Page({ | @@ -314,7 +314,7 @@ Page({ | ||
314 | } | 314 | } |
315 | 315 | ||
316 | this.setData({ | 316 | this.setData({ |
317 | - gid:gid,pre_id:pre_id,presell_id:presell_id | 317 | + gid: gid, pre_id: pre_id, presell_id: presell_id |
318 | }) | 318 | }) |
319 | 319 | ||
320 | if (first_leader) { | 320 | if (first_leader) { |
@@ -561,7 +561,7 @@ Page({ | @@ -561,7 +561,7 @@ Page({ | ||
561 | data: { | 561 | data: { |
562 | store_id: os.stoid, | 562 | store_id: os.stoid, |
563 | type: 1, | 563 | type: 1, |
564 | - pageSize: 3, | 564 | + pageSize: 100, |
565 | page: 1, | 565 | page: 1, |
566 | is_share: 0, | 566 | is_share: 0, |
567 | }, | 567 | }, |
@@ -569,7 +569,24 @@ Page({ | @@ -569,7 +569,24 @@ Page({ | ||
569 | fir_quan = res1.data.data.pageData; | 569 | fir_quan = res1.data.data.pageData; |
570 | }) | 570 | }) |
571 | } | 571 | } |
572 | - | 572 | + //过滤不是本商品的单品优惠券------------------- |
573 | + if (fir_quan.length > 0) { | ||
574 | + let goodInfo = ee.data.data || {} | ||
575 | + for (let index = fir_quan.length - 1; index >= 0; index--) { | ||
576 | + if (fir_quan[index].useobjecttype == 20) { //判断是单品优惠券 | ||
577 | + if (fir_quan[index].useobjectno != goodInfo.goods_sn) { | ||
578 | + fir_quan.splice(index, 1) | ||
579 | + } | ||
580 | + } | ||
581 | + } | ||
582 | + } | ||
583 | + let arr = [] | ||
584 | + let length = fir_quan.length | ||
585 | + if (length <= 3) { | ||
586 | + arr = fir_quan | ||
587 | + } else { | ||
588 | + arr = fir_quan.splice(0, 3); | ||
589 | + } | ||
573 | //--------获取视频图片--------- | 590 | //--------获取视频图片--------- |
574 | await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, { | 591 | await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, { |
575 | 1: 1 | 592 | 1: 1 |
@@ -587,7 +604,7 @@ Page({ | @@ -587,7 +604,7 @@ Page({ | ||
587 | is_collect: is_collect, | 604 | is_collect: is_collect, |
588 | collect_id: collect_id, | 605 | collect_id: collect_id, |
589 | categories3: categories3, | 606 | categories3: categories3, |
590 | - fir_quan: fir_quan, | 607 | + fir_quan: arr, |
591 | fir_comments: fir_com, | 608 | fir_comments: fir_com, |
592 | mapurl_f_img: mapurl_f_img, | 609 | mapurl_f_img: mapurl_f_img, |
593 | mapurl: mapurl, | 610 | mapurl: mapurl, |
@@ -597,7 +614,7 @@ Page({ | @@ -597,7 +614,7 @@ Page({ | ||
597 | 614 | ||
598 | //---展示--- | 615 | //---展示--- |
599 | onShow: function () { | 616 | onShow: function () { |
600 | - getApp().check_can_share(); | 617 | + getApp().check_can_share(); |
601 | var goods_list = null, th = this, that = this; | 618 | var goods_list = null, th = this, that = this; |
602 | 619 | ||
603 | //-- 如果是预览图片,页面不重新更新 -- | 620 | //-- 如果是预览图片,页面不重新更新 -- |
@@ -672,8 +689,8 @@ Page({ | @@ -672,8 +689,8 @@ Page({ | ||
672 | 689 | ||
673 | //-- 把商品的赋值 -- | 690 | //-- 把商品的赋值 -- |
674 | ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); | 691 | ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); |
675 | - ee.data.sele_g_id=t.data.data.goods_id; | ||
676 | - ee.data.sele_g=t.data.data; | 692 | + ee.data.sele_g_id = t.data.data.goods_id; |
693 | + ee.data.sele_g = t.data.data; | ||
677 | 694 | ||
678 | //获取用户的默认门店 | 695 | //获取用户的默认门店 |
679 | getApp().get_user_store(function (e) { | 696 | getApp().get_user_store(function (e) { |
@@ -681,7 +698,7 @@ Page({ | @@ -681,7 +698,7 @@ Page({ | ||
681 | th.data.fir_def_store = {}; //赋值空对象 | 698 | th.data.fir_def_store = {}; //赋值空对象 |
682 | return false; | 699 | return false; |
683 | } | 700 | } |
684 | - if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) | 701 | + if (getApp().globalData.is_dj_pk) th.setData({ has_def: 1 }) |
685 | 702 | ||
686 | var ee = JSON.parse(JSON.stringify(e)); | 703 | var ee = JSON.parse(JSON.stringify(e)); |
687 | 704 | ||
@@ -1045,7 +1062,7 @@ Page({ | @@ -1045,7 +1062,7 @@ Page({ | ||
1045 | 1062 | ||
1046 | newd.goods_price = th.data.prom_price; | 1063 | newd.goods_price = th.data.prom_price; |
1047 | newd.member_goods_price = th.data.prom_price, | 1064 | newd.member_goods_price = th.data.prom_price, |
1048 | - newd.prom_type = 8; | 1065 | + newd.prom_type = 8; |
1049 | newd.prom_id = o.prom_id; | 1066 | newd.prom_id = o.prom_id; |
1050 | 1067 | ||
1051 | if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); | 1068 | if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); |
@@ -1084,8 +1101,8 @@ Page({ | @@ -1084,8 +1101,8 @@ Page({ | ||
1084 | return s.my_warnning("库存不足!", 0, th); | 1101 | return s.my_warnning("库存不足!", 0, th); |
1085 | } | 1102 | } |
1086 | 1103 | ||
1087 | - if (item.goods_num + th.data.goodsInputNum >th.data.pre_arr.presell_sumqty-th.data.pre_arr.buy_goodnum) { | ||
1088 | - return s.my_warnning("库存不足!", 0, th); | 1104 | + if (item.goods_num + th.data.goodsInputNum > th.data.pre_arr.presell_sumqty - th.data.pre_arr.buy_goodnum) { |
1105 | + return s.my_warnning("库存不足!", 0, th); | ||
1089 | } | 1106 | } |
1090 | 1107 | ||
1091 | var updata = { | 1108 | var updata = { |
@@ -1156,10 +1173,10 @@ Page({ | @@ -1156,10 +1173,10 @@ Page({ | ||
1156 | app.set_b_now(e); | 1173 | app.set_b_now(e); |
1157 | 1174 | ||
1158 | //如果是全额付款的话 | 1175 | //如果是全额付款的话 |
1159 | - if(this.data.presellForm.presell_type==1){ | ||
1160 | - getApp().goto("/packageC/pages/presell/cart/cart2") | ||
1161 | - }else{ | ||
1162 | - getApp().goto("/packageC/pages/presell/cart/cart2_pre"); | 1176 | + if (this.data.presellForm.presell_type == 1) { |
1177 | + getApp().goto("/packageC/pages/presell/cart/cart2") | ||
1178 | + } else { | ||
1179 | + getApp().goto("/packageC/pages/presell/cart/cart2_pre"); | ||
1163 | } | 1180 | } |
1164 | }, | 1181 | }, |
1165 | 1182 | ||
@@ -1213,8 +1230,8 @@ Page({ | @@ -1213,8 +1230,8 @@ Page({ | ||
1213 | } | 1230 | } |
1214 | 1231 | ||
1215 | var e = th.data.sele_g.store_count; | 1232 | var e = th.data.sele_g.store_count; |
1216 | - var e2=th.data.pre_arr.presell_sumqty-th.data.pre_arr.buy_goodnum; | ||
1217 | - if(e2<e) e=e2; | 1233 | + var e2 = th.data.pre_arr.presell_sumqty - th.data.pre_arr.buy_goodnum; |
1234 | + if (e2 < e) e = e2; | ||
1218 | 1235 | ||
1219 | if (!e) e = 0; | 1236 | if (!e) e = 0; |
1220 | //库存不足,不增加 | 1237 | //库存不足,不增加 |
@@ -1280,14 +1297,14 @@ Page({ | @@ -1280,14 +1297,14 @@ Page({ | ||
1280 | 1297 | ||
1281 | //判断是不是优惠促销 | 1298 | //判断是不是优惠促销 |
1282 | check_is_prom_goods: function (callback) { | 1299 | check_is_prom_goods: function (callback) { |
1283 | - if(!this.data.sele_g) return false; | 1300 | + if (!this.data.sele_g) return false; |
1284 | var th = this; | 1301 | var th = this; |
1285 | var usr = getApp().globalData.userInfo; | 1302 | var usr = getApp().globalData.userInfo; |
1286 | if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3) { | 1303 | if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3) { |
1287 | callback(); | 1304 | callback(); |
1288 | } else { | 1305 | } else { |
1289 | //-- 判断有没有优惠活动 -- | 1306 | //-- 判断有没有优惠活动 -- |
1290 | - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0"+"/"+getApp().globalData.user_id, {}).then(res => { | 1307 | + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => { |
1291 | if (res.data.code == 0) { | 1308 | if (res.data.code == 0) { |
1292 | var r_data = res.data.data; | 1309 | var r_data = res.data.data; |
1293 | th.data.prom_goods = r_data.promGoodsLists; | 1310 | th.data.prom_goods = r_data.promGoodsLists; |
@@ -1444,38 +1461,38 @@ Page({ | @@ -1444,38 +1461,38 @@ Page({ | ||
1444 | contactService: function () { | 1461 | contactService: function () { |
1445 | getApp().com_call(this); | 1462 | getApp().com_call(this); |
1446 | }, | 1463 | }, |
1447 | - | ||
1448 | - // 获取客服电话 | ||
1449 | - getTel() { | ||
1450 | - return new Promise((resolve, reject) => { | ||
1451 | - s.getConfig(function (t) { | ||
1452 | - if (t.store_tel == undefined) { | ||
1453 | - getApp().request.get("/api/weshop/store/get/" + os.stoid, { | ||
1454 | - isShowLoading: 1, | ||
1455 | - data: {}, | ||
1456 | - success: function (rs) { | ||
1457 | - getApp().globalData.config = rs.data.data; | ||
1458 | - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | ||
1459 | - getApp().my_warnning("商家未设置电话", 0, th); | ||
1460 | - return false; | ||
1461 | - } | ||
1462 | - self.setData({ | ||
1463 | - store_tel: rs.data.data.store_tel, | ||
1464 | - }); | ||
1465 | - // s.confirmBox("请联系客服:" + rs.data.data.store_tel); | ||
1466 | - } | ||
1467 | - }) | ||
1468 | - } else { | ||
1469 | - self.setData({ | ||
1470 | - store_tel: t.store_tel, | ||
1471 | - }); | ||
1472 | - // s.confirmBox("请联系客服:" + t.store_tel); | ||
1473 | - }; | ||
1474 | - resolve(); | ||
1475 | - }); | ||
1476 | - }); | ||
1477 | - }, | ||
1478 | - | 1464 | + |
1465 | + // 获取客服电话 | ||
1466 | + getTel() { | ||
1467 | + return new Promise((resolve, reject) => { | ||
1468 | + s.getConfig(function (t) { | ||
1469 | + if (t.store_tel == undefined) { | ||
1470 | + getApp().request.get("/api/weshop/store/get/" + os.stoid, { | ||
1471 | + isShowLoading: 1, | ||
1472 | + data: {}, | ||
1473 | + success: function (rs) { | ||
1474 | + getApp().globalData.config = rs.data.data; | ||
1475 | + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | ||
1476 | + getApp().my_warnning("商家未设置电话", 0, th); | ||
1477 | + return false; | ||
1478 | + } | ||
1479 | + self.setData({ | ||
1480 | + store_tel: rs.data.data.store_tel, | ||
1481 | + }); | ||
1482 | + // s.confirmBox("请联系客服:" + rs.data.data.store_tel); | ||
1483 | + } | ||
1484 | + }) | ||
1485 | + } else { | ||
1486 | + self.setData({ | ||
1487 | + store_tel: t.store_tel, | ||
1488 | + }); | ||
1489 | + // s.confirmBox("请联系客服:" + t.store_tel); | ||
1490 | + }; | ||
1491 | + resolve(); | ||
1492 | + }); | ||
1493 | + }); | ||
1494 | + }, | ||
1495 | + | ||
1479 | //-------获取购物车数量---------- | 1496 | //-------获取购物车数量---------- |
1480 | requestCardNum: function () { | 1497 | requestCardNum: function () { |
1481 | var t = this; | 1498 | var t = this; |
@@ -1515,7 +1532,7 @@ Page({ | @@ -1515,7 +1532,7 @@ Page({ | ||
1515 | b[i] = this.data.iurl + e[i]; | 1532 | b[i] = this.data.iurl + e[i]; |
1516 | } | 1533 | } |
1517 | this.data.show_prew_img = 1; | 1534 | this.data.show_prew_img = 1; |
1518 | - getApp().pre_img2(b,t) | 1535 | + getApp().pre_img2(b, t) |
1519 | 1536 | ||
1520 | }, | 1537 | }, |
1521 | 1538 | ||
@@ -1526,16 +1543,16 @@ Page({ | @@ -1526,16 +1543,16 @@ Page({ | ||
1526 | b[i] = this.data.iurl + e[i]; | 1543 | b[i] = this.data.iurl + e[i]; |
1527 | } | 1544 | } |
1528 | this.data.show_prew_img = 1; | 1545 | this.data.show_prew_img = 1; |
1529 | - getApp().pre_img2(b,t) | 1546 | + getApp().pre_img2(b, t) |
1530 | }, | 1547 | }, |
1531 | 1548 | ||
1532 | previewGoodsCommentImgs: function (t) { | 1549 | previewGoodsCommentImgs: function (t) { |
1533 | var e = this, | 1550 | var e = this, |
1534 | a = this.data.data.comment[t.currentTarget.dataset.cidx].img; | 1551 | a = this.data.data.comment[t.currentTarget.dataset.cidx].img; |
1535 | - getApp().globalData.no_clear=1; | 1552 | + getApp().globalData.no_clear = 1; |
1536 | a = a.map(function (t) { | 1553 | a = a.map(function (t) { |
1537 | return e.data.url + t; | 1554 | return e.data.url + t; |
1538 | - }), getApp().pre_img2(a,t); | 1555 | + }), getApp().pre_img2(a, t); |
1539 | this.data.show_prew_img = 1; | 1556 | this.data.show_prew_img = 1; |
1540 | }, | 1557 | }, |
1541 | closePromModal: function () { | 1558 | closePromModal: function () { |
@@ -1550,19 +1567,20 @@ Page({ | @@ -1550,19 +1567,20 @@ Page({ | ||
1550 | }, | 1567 | }, |
1551 | 1568 | ||
1552 | //--点击分享事件--- | 1569 | //--点击分享事件--- |
1553 | - onShareAppMessage: function (t) { getApp().globalData.no_clear=1; | 1570 | + onShareAppMessage: function (t) { |
1571 | + getApp().globalData.no_clear = 1; | ||
1554 | 1572 | ||
1555 | var th = this; | 1573 | var th = this; |
1556 | - var price = th.data.pre_arr.presell_price; | 1574 | + var price = th.data.pre_arr.presell_price; |
1557 | var img = th.data.data.original_img; | 1575 | var img = th.data.data.original_img; |
1558 | - var title = th.data.presellForm.share_title; | 1576 | + var title = th.data.presellForm.share_title; |
1559 | if (!title) title = th.data.prom_act.title; | 1577 | if (!title) title = th.data.prom_act.title; |
1560 | if (th.data.prom_type == 4) title = th.data.prom_act.name; | 1578 | if (th.data.prom_type == 4) title = th.data.prom_act.name; |
1561 | 1579 | ||
1562 | //if (th.data.presellForm.share_img) | 1580 | //if (th.data.presellForm.share_img) |
1563 | // img = th.data.iurl + th.data.presellForm.share_img; | 1581 | // img = th.data.iurl + th.data.presellForm.share_img; |
1564 | 1582 | ||
1565 | - var url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + th.data.gid+"&pre_id="+th.data.pre_arr.id; | 1583 | + var url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + th.data.gid + "&pre_id=" + th.data.pre_arr.id; |
1566 | if (getApp().globalData.user_id) { | 1584 | if (getApp().globalData.user_id) { |
1567 | url += "&first_leader=" + getApp().globalData.user_id; | 1585 | url += "&first_leader=" + getApp().globalData.user_id; |
1568 | } | 1586 | } |
@@ -1580,13 +1598,13 @@ Page({ | @@ -1580,13 +1598,13 @@ Page({ | ||
1580 | path: url, | 1598 | path: url, |
1581 | imageUrl: img, | 1599 | imageUrl: img, |
1582 | }; | 1600 | }; |
1583 | - | 1601 | + |
1584 | ob.title += '\n' + th.data.presellForm.share_remark; | 1602 | ob.title += '\n' + th.data.presellForm.share_remark; |
1585 | - | ||
1586 | - | ||
1587 | - console.log(ob,888); | ||
1588 | 1603 | ||
1589 | - | 1604 | + |
1605 | + console.log(ob, 888); | ||
1606 | + | ||
1607 | + | ||
1590 | return ob; | 1608 | return ob; |
1591 | 1609 | ||
1592 | }, | 1610 | }, |
@@ -1609,22 +1627,22 @@ Page({ | @@ -1609,22 +1627,22 @@ Page({ | ||
1609 | 1627 | ||
1610 | //----------装载同一活动中的商品---------- | 1628 | //----------装载同一活动中的商品---------- |
1611 | async get_sku(stoid, gd, g_id, is_normal, func) { | 1629 | async get_sku(stoid, gd, g_id, is_normal, func) { |
1612 | - var tt = this, arrdata = null; | ||
1613 | - var now = ut.gettimestamp(); | ||
1614 | - var rq_data={ | ||
1615 | - store_id: o.stoid, | ||
1616 | - sku: gd.sku, | ||
1617 | - more_spec: gd.more_spec, | ||
1618 | - isonsale: 1, | ||
1619 | - is_on_sale: 1, | ||
1620 | - pageSize: 500, | ||
1621 | - orderField: 'gg_ordid,goods_spec,sort', | ||
1622 | - prom_type: 8, | ||
1623 | - }; | 1630 | + var tt = this, arrdata = null; |
1631 | + var now = ut.gettimestamp(); | ||
1632 | + var rq_data = { | ||
1633 | + store_id: o.stoid, | ||
1634 | + sku: gd.sku, | ||
1635 | + more_spec: gd.more_spec, | ||
1636 | + isonsale: 1, | ||
1637 | + is_on_sale: 1, | ||
1638 | + pageSize: 500, | ||
1639 | + orderField: 'gg_ordid,goods_spec,sort', | ||
1640 | + prom_type: 8, | ||
1641 | + }; | ||
1624 | 1642 | ||
1625 | - if(tt.data.presellForm && tt.data.presellForm.id){ | ||
1626 | - rq_data.prom_id=tt.data.presellForm.id; | ||
1627 | - } | 1643 | + if (tt.data.presellForm && tt.data.presellForm.id) { |
1644 | + rq_data.prom_id = tt.data.presellForm.id; | ||
1645 | + } | ||
1628 | 1646 | ||
1629 | await getApp().request.promiseGet("/api/weshop/goods/page", { | 1647 | await getApp().request.promiseGet("/api/weshop/goods/page", { |
1630 | data: rq_data | 1648 | data: rq_data |
@@ -1755,31 +1773,31 @@ Page({ | @@ -1755,31 +1773,31 @@ Page({ | ||
1755 | 1773 | ||
1756 | //选择了不同的规格的时候要判断是不是有活动正在进行中 | 1774 | //选择了不同的规格的时候要判断是不是有活动正在进行中 |
1757 | async sele_spec_chech_activity() { | 1775 | async sele_spec_chech_activity() { |
1758 | - var prom = null, goodsinfo = this.data.sele_g, th = this; | ||
1759 | - | ||
1760 | - var all_pre_goods=th.data.all_pre_goods; | ||
1761 | - if(all_pre_goods){ | ||
1762 | - var userInfo = getApp().globalData.userInfo; | ||
1763 | - var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid }; | ||
1764 | - if (userInfo) { | ||
1765 | - pre_data.user_id = userInfo.user_id; | ||
1766 | - } | ||
1767 | - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { | ||
1768 | - data: pre_data, | ||
1769 | - }).then(e => { | ||
1770 | - if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | ||
1771 | - all_pre_goods=e.data.data.pageData; | ||
1772 | - th.data.all_pre_goods=e.data.data.pageData; | ||
1773 | - } | ||
1774 | - }) | 1776 | + var prom = null, goodsinfo = this.data.sele_g, th = this; |
1777 | + | ||
1778 | + var all_pre_goods = th.data.all_pre_goods; | ||
1779 | + if (all_pre_goods) { | ||
1780 | + var userInfo = getApp().globalData.userInfo; | ||
1781 | + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid }; | ||
1782 | + if (userInfo) { | ||
1783 | + pre_data.user_id = userInfo.user_id; | ||
1775 | } | 1784 | } |
1776 | - | ||
1777 | - var idx=all_pre_goods.findIndex(function (ele) { | ||
1778 | - return ele.goods_id==goodsinfo.goods_id; | 1785 | + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { |
1786 | + data: pre_data, | ||
1787 | + }).then(e => { | ||
1788 | + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | ||
1789 | + all_pre_goods = e.data.data.pageData; | ||
1790 | + th.data.all_pre_goods = e.data.data.pageData; | ||
1791 | + } | ||
1779 | }) | 1792 | }) |
1780 | - var pre_arr =all_pre_goods[idx]; | ||
1781 | - th.setData({ pre_arr: pre_arr }) | ||
1782 | - th.data.prom_buy_limit=pre_arr.vip_butyqty; | 1793 | + } |
1794 | + | ||
1795 | + var idx = all_pre_goods.findIndex(function (ele) { | ||
1796 | + return ele.goods_id == goodsinfo.goods_id; | ||
1797 | + }) | ||
1798 | + var pre_arr = all_pre_goods[idx]; | ||
1799 | + th.setData({ pre_arr: pre_arr }) | ||
1800 | + th.data.prom_buy_limit = pre_arr.vip_butyqty; | ||
1783 | }, | 1801 | }, |
1784 | 1802 | ||
1785 | 1803 | ||
@@ -1870,7 +1888,7 @@ Page({ | @@ -1870,7 +1888,7 @@ Page({ | ||
1870 | th.setData({ all_pick_list: e.data.data.pageData }); | 1888 | th.setData({ all_pick_list: e.data.data.pageData }); |
1871 | 1889 | ||
1872 | //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售-- | 1890 | //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售-- |
1873 | - if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4 && th.data.prom_type !=8 ) || is_normal == 1)) { | 1891 | + if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4 && th.data.prom_type != 8) || is_normal == 1)) { |
1874 | setTimeout(function () { | 1892 | setTimeout(function () { |
1875 | th.deal_pickup_dline(e); | 1893 | th.deal_pickup_dline(e); |
1876 | }, 800) | 1894 | }, 800) |
@@ -1906,15 +1924,15 @@ Page({ | @@ -1906,15 +1924,15 @@ Page({ | ||
1906 | success: function (ee) { | 1924 | success: function (ee) { |
1907 | if (ee.data.code == 0) { | 1925 | if (ee.data.code == 0) { |
1908 | 1926 | ||
1909 | - var check_all_cate=0; | ||
1910 | - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){ | ||
1911 | - for(let i in ee.data.data.pageData){ | ||
1912 | - let item=ee.data.data.pageData[i]; | ||
1913 | - if(item.is_show==1){ | ||
1914 | - check_all_cate=1;break | ||
1915 | - } | ||
1916 | - } | 1927 | + var check_all_cate = 0; |
1928 | + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) { | ||
1929 | + for (let i in ee.data.data.pageData) { | ||
1930 | + let item = ee.data.data.pageData[i]; | ||
1931 | + if (item.is_show == 1) { | ||
1932 | + check_all_cate = 1; break | ||
1933 | + } | ||
1917 | } | 1934 | } |
1935 | + } | ||
1918 | 1936 | ||
1919 | if (check_all_cate) { | 1937 | if (check_all_cate) { |
1920 | 1938 | ||
@@ -1923,29 +1941,29 @@ Page({ | @@ -1923,29 +1941,29 @@ Page({ | ||
1923 | var newarr = new Array(); | 1941 | var newarr = new Array(); |
1924 | var qita = new Array(); | 1942 | var qita = new Array(); |
1925 | 1943 | ||
1926 | - var is_del_pk=0; | 1944 | + var is_del_pk = 0; |
1927 | //----要进行门店分组-------- | 1945 | //----要进行门店分组-------- |
1928 | for (var i = 0; i < sto_arr.length; i++) { | 1946 | for (var i = 0; i < sto_arr.length; i++) { |
1929 | //找一下这个门店有没有在分类数组内 | 1947 | //找一下这个门店有没有在分类数组内 |
1930 | var find2 = 0, find2name = "", sort = 0; | 1948 | var find2 = 0, find2name = "", sort = 0; |
1931 | - is_del_pk=0; | 1949 | + is_del_pk = 0; |
1932 | for (var m = 0; m < sto_cate.length; m++) { | 1950 | for (var m = 0; m < sto_cate.length; m++) { |
1933 | - if (sto_arr[i].category_id == sto_cate[m].cat_id) { | ||
1934 | - if (sto_cate[m].is_show != 1) { | ||
1935 | - is_del_pk = 1; | ||
1936 | - sto_arr.splice(i, 1); | ||
1937 | - i--; | ||
1938 | - } else { | ||
1939 | - find2 = sto_cate[m].cat_id; | ||
1940 | - find2name = sto_cate[m].cat_name; | ||
1941 | - sort = sto_cate[m].sort; | ||
1942 | - is_del_pk = 0; | ||
1943 | - } | ||
1944 | - break; | 1951 | + if (sto_arr[i].category_id == sto_cate[m].cat_id) { |
1952 | + if (sto_cate[m].is_show != 1) { | ||
1953 | + is_del_pk = 1; | ||
1954 | + sto_arr.splice(i, 1); | ||
1955 | + i--; | ||
1956 | + } else { | ||
1957 | + find2 = sto_cate[m].cat_id; | ||
1958 | + find2name = sto_cate[m].cat_name; | ||
1959 | + sort = sto_cate[m].sort; | ||
1960 | + is_del_pk = 0; | ||
1945 | } | 1961 | } |
1962 | + break; | ||
1963 | + } | ||
1946 | } | 1964 | } |
1947 | 1965 | ||
1948 | - if(is_del_pk) continue; | 1966 | + if (is_del_pk) continue; |
1949 | 1967 | ||
1950 | if (newarr.length > 0) { | 1968 | if (newarr.length > 0) { |
1951 | var find = 0; | 1969 | var find = 0; |
@@ -1991,17 +2009,17 @@ Page({ | @@ -1991,17 +2009,17 @@ Page({ | ||
1991 | } | 2009 | } |
1992 | 2010 | ||
1993 | 2011 | ||
1994 | - var def_arr = new Array(); | ||
1995 | - //-- 开始就看10个门店 -- | ||
1996 | - for (var k = 0; k < 10; k++) { | ||
1997 | - if (k == sto_arr.length) break; | ||
1998 | - def_arr.push(sto_arr[k]); | ||
1999 | - } | 2012 | + var def_arr = new Array(); |
2013 | + //-- 开始就看10个门店 -- | ||
2014 | + for (var k = 0; k < 10; k++) { | ||
2015 | + if (k == sto_arr.length) break; | ||
2016 | + def_arr.push(sto_arr[k]); | ||
2017 | + } | ||
2000 | 2018 | ||
2001 | - th.setData({ | ||
2002 | - def_pickpu_list: def_arr, | ||
2003 | - pickpu_list: ee.data.data.pageData | ||
2004 | - }); | 2019 | + th.setData({ |
2020 | + def_pickpu_list: def_arr, | ||
2021 | + pickpu_list: ee.data.data.pageData | ||
2022 | + }); | ||
2005 | //门店分类要排序下 | 2023 | //门店分类要排序下 |
2006 | function compare(property) { | 2024 | function compare(property) { |
2007 | return function (a, b) { | 2025 | return function (a, b) { |
@@ -2025,15 +2043,15 @@ Page({ | @@ -2025,15 +2043,15 @@ Page({ | ||
2025 | } | 2043 | } |
2026 | 2044 | ||
2027 | 2045 | ||
2028 | - var sd={ | ||
2029 | - all_sto: newarr, | ||
2030 | - is_show_sto_cat:1 | ||
2031 | - } | ||
2032 | - if(!sto_arr || sto_arr.length<=10){ | ||
2033 | - sd.is_show_sto_cat=-1; | ||
2034 | - sd.only_pk=sto_arr; | ||
2035 | - } | ||
2036 | - th.setData(sd); | 2046 | + var sd = { |
2047 | + all_sto: newarr, | ||
2048 | + is_show_sto_cat: 1 | ||
2049 | + } | ||
2050 | + if (!sto_arr || sto_arr.length <= 10) { | ||
2051 | + sd.is_show_sto_cat = -1; | ||
2052 | + sd.only_pk = sto_arr; | ||
2053 | + } | ||
2054 | + th.setData(sd); | ||
2037 | 2055 | ||
2038 | } else { | 2056 | } else { |
2039 | th.setData({ | 2057 | th.setData({ |
@@ -2382,21 +2400,21 @@ Page({ | @@ -2382,21 +2400,21 @@ Page({ | ||
2382 | } | 2400 | } |
2383 | } else { | 2401 | } else { |
2384 | 2402 | ||
2385 | - //活动已结束,全部设置为'00' | ||
2386 | - obj = { | ||
2387 | - day: '00', | ||
2388 | - hou: '00', | ||
2389 | - min: '00', | ||
2390 | - sec: '00' | ||
2391 | - } | ||
2392 | - th.setData({ | ||
2393 | - prom_time_text: '活动已经结束:', | ||
2394 | - prom_st: 3 | ||
2395 | - }) | ||
2396 | - th.setData({ | ||
2397 | - djs: obj | ||
2398 | - }); | ||
2399 | - return false; | 2403 | + //活动已结束,全部设置为'00' |
2404 | + obj = { | ||
2405 | + day: '00', | ||
2406 | + hou: '00', | ||
2407 | + min: '00', | ||
2408 | + sec: '00' | ||
2409 | + } | ||
2410 | + th.setData({ | ||
2411 | + prom_time_text: '活动已经结束:', | ||
2412 | + prom_st: 3 | ||
2413 | + }) | ||
2414 | + th.setData({ | ||
2415 | + djs: obj | ||
2416 | + }); | ||
2417 | + return false; | ||
2400 | 2418 | ||
2401 | } | 2419 | } |
2402 | 2420 | ||
@@ -2410,56 +2428,56 @@ Page({ | @@ -2410,56 +2428,56 @@ Page({ | ||
2410 | 2428 | ||
2411 | 2429 | ||
2412 | //-------------获取购买数量的总函数---------------- | 2430 | //-------------获取购买数量的总函数---------------- |
2413 | - get_buy_num: function (gd, func) { | ||
2414 | - var map = this.data.g_buy_num, | ||
2415 | - th = this, | ||
2416 | - user_id = getApp().globalData.user_id; | ||
2417 | - if (user_id == null) { | ||
2418 | - map.set(gd.goods_id, 0); | 2431 | + get_buy_num: function (gd, func) { |
2432 | + var map = this.data.g_buy_num, | ||
2433 | + th = this, | ||
2434 | + user_id = getApp().globalData.user_id; | ||
2435 | + if (user_id == null) { | ||
2436 | + map.set(gd.goods_id, 0); | ||
2437 | + th.setData({ | ||
2438 | + g_buy_num: map, | ||
2439 | + prom_buy_num: 0, | ||
2440 | + }); | ||
2441 | + "function" == typeof func && func(); | ||
2442 | + return false; | ||
2443 | + } | ||
2444 | + | ||
2445 | + if (map.has(gd.goods_id)) { | ||
2446 | + "function" == typeof func && func(); | ||
2447 | + } else { | ||
2448 | + //----获取商品购买数---- | ||
2449 | + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
2450 | + data: { | ||
2451 | + store_id: os.stoid, | ||
2452 | + user_id: user_id, | ||
2453 | + goods_id: gd.goods_id, | ||
2454 | + }, | ||
2455 | + success: function (t) { | ||
2456 | + if (t.data.code == 0) { | ||
2457 | + var g_buy_num = t.data.data.goodsbuynum; | ||
2458 | + map.set(gd.goods_id, g_buy_num); | ||
2419 | th.setData({ | 2459 | th.setData({ |
2420 | - g_buy_num: map, | ||
2421 | - prom_buy_num: 0, | 2460 | + g_buy_num: map, |
2422 | }); | 2461 | }); |
2423 | - "function" == typeof func && func(); | ||
2424 | - return false; | ||
2425 | - } | ||
2426 | - | ||
2427 | - if (map.has(gd.goods_id)) { | ||
2428 | - "function" == typeof func && func(); | ||
2429 | - } else { | ||
2430 | - //----获取商品购买数---- | ||
2431 | - getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
2432 | - data: { | ||
2433 | - store_id: os.stoid, | ||
2434 | - user_id: user_id, | ||
2435 | - goods_id: gd.goods_id, | ||
2436 | - }, | ||
2437 | - success: function (t) { | ||
2438 | - if (t.data.code == 0) { | ||
2439 | - var g_buy_num = t.data.data.goodsbuynum; | ||
2440 | - map.set(gd.goods_id, g_buy_num); | ||
2441 | - th.setData({ | ||
2442 | - g_buy_num: map, | ||
2443 | - }); | ||
2444 | - getApp().request.get("/api/weshop/order/orderPresell/countBuyGoodsSum",{ | ||
2445 | - data: {store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, prom_id: gd.prom_id}, | ||
2446 | - success: function (e) { | ||
2447 | - if (e.data.code == 0) { | ||
2448 | - th.setData({prom_buy_num: e.data.data.sumgoodsnum}) | ||
2449 | - "function" == typeof func && func(); | ||
2450 | - } else { | ||
2451 | - th.setData({prom_buy_num: 0,}) | ||
2452 | - "function" == typeof func && func(); | ||
2453 | - } | ||
2454 | - | ||
2455 | - } | ||
2456 | - }); | ||
2457 | - | ||
2458 | - } | 2462 | + getApp().request.get("/api/weshop/order/orderPresell/countBuyGoodsSum", { |
2463 | + data: { store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, prom_id: gd.prom_id }, | ||
2464 | + success: function (e) { | ||
2465 | + if (e.data.code == 0) { | ||
2466 | + th.setData({ prom_buy_num: e.data.data.sumgoodsnum }) | ||
2467 | + "function" == typeof func && func(); | ||
2468 | + } else { | ||
2469 | + th.setData({ prom_buy_num: 0, }) | ||
2470 | + "function" == typeof func && func(); | ||
2459 | } | 2471 | } |
2472 | + | ||
2473 | + } | ||
2460 | }); | 2474 | }); |
2475 | + | ||
2476 | + } | ||
2461 | } | 2477 | } |
2462 | - }, | 2478 | + }); |
2479 | + } | ||
2480 | + }, | ||
2463 | 2481 | ||
2464 | //--拼单推荐的显示--- | 2482 | //--拼单推荐的显示--- |
2465 | tj_Click: function (e) { | 2483 | tj_Click: function (e) { |
@@ -2471,7 +2489,7 @@ Page({ | @@ -2471,7 +2489,7 @@ Page({ | ||
2471 | 2489 | ||
2472 | //-------跳转pt商品------- | 2490 | //-------跳转pt商品------- |
2473 | go_to_nopay: function () { | 2491 | go_to_nopay: function () { |
2474 | - var th =this,url = "/pages/user/order_detail/order_detail?order_id=" + th.data.buy_order.order_id; | 2492 | + var th = this, url = "/pages/user/order_detail/order_detail?order_id=" + th.data.buy_order.order_id; |
2475 | getApp().goto(url); | 2493 | getApp().goto(url); |
2476 | 2494 | ||
2477 | }, | 2495 | }, |
@@ -2615,7 +2633,18 @@ Page({ | @@ -2615,7 +2633,18 @@ Page({ | ||
2615 | wx.hideLoading(); | 2633 | wx.hideLoading(); |
2616 | quan_list = res.data.data.pageData; | 2634 | quan_list = res.data.data.pageData; |
2617 | }) | 2635 | }) |
2618 | - | 2636 | + //过滤不是本商品的单品优惠券 |
2637 | + if (quan_list.length > 0) { | ||
2638 | + let goodInfo = th.data.data | ||
2639 | + for (let index = quan_list.length - 1; index >= 0; index--) { | ||
2640 | + if (quan_list[index].useobjecttype == 20) { //判断是单品优惠券 | ||
2641 | + if (quan_list[index].useobjectno != goodInfo.goods_sn) { | ||
2642 | + quan_list.splice(index, 1) | ||
2643 | + } | ||
2644 | + } | ||
2645 | + } | ||
2646 | + } | ||
2647 | + //------------------------ | ||
2619 | if (quan_list) { | 2648 | if (quan_list) { |
2620 | for (var ind in quan_list) { | 2649 | for (var ind in quan_list) { |
2621 | var ep = quan_list[ind]; | 2650 | var ep = quan_list[ind]; |
@@ -2712,7 +2741,13 @@ Page({ | @@ -2712,7 +2741,13 @@ Page({ | ||
2712 | } | 2741 | } |
2713 | }) | 2742 | }) |
2714 | }, | 2743 | }, |
2715 | - | 2744 | + saveImageFn(){ |
2745 | + if(this.data.share_b_img){ | ||
2746 | + this.saveImageToPhotosAlbum() | ||
2747 | + }else{ | ||
2748 | + this.saveImageToPhotosAlbumDef() | ||
2749 | + } | ||
2750 | + }, | ||
2716 | //--定义的保存图片方法,分享团--- | 2751 | //--定义的保存图片方法,分享团--- |
2717 | saveImageToPhotosAlbum: function () { | 2752 | saveImageToPhotosAlbum: function () { |
2718 | //--先判断会员状态-- | 2753 | //--先判断会员状态-- |
@@ -3038,7 +3073,608 @@ Page({ | @@ -3038,7 +3073,608 @@ Page({ | ||
3038 | } | 3073 | } |
3039 | }); | 3074 | }); |
3040 | }, | 3075 | }, |
3076 | + //--定义的保存图片方法,分享团--- | ||
3077 | + saveImageToPhotosAlbumDef: function () { | ||
3078 | + //--先判断会员状态-- | ||
3079 | + var user_info = getApp().globalData.userInfo; | ||
3080 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
3081 | + //getApp().my_warnning("请先登录",0,this); | ||
3082 | + wx.navigateTo({url: '/packageE/pages/togoin/togoin',}) | ||
3083 | + return false; | ||
3084 | + } | ||
3085 | + | ||
3086 | + if (this.data.share_hidden) { | ||
3087 | + this.setData({share_hidden: false,}); | ||
3088 | + }; | ||
3089 | + | ||
3090 | + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 | ||
3091 | + var type = this.data.prom_type; | ||
3092 | + console.log('商品类型-----'); | ||
3093 | + console.log(type); | ||
3094 | + // if (type == 2) type = -1; | ||
3095 | + if (type == 4) type = 0; | ||
3096 | + if (type == 8) type = 0; | ||
3097 | + if (type == 2) type = 0; | ||
3098 | + if (type == 6) type = 2; // 6拼团 2团购 | ||
3099 | + if (type == 10) type = -1; | ||
3100 | + | ||
3101 | + | ||
3102 | + if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; | ||
3103 | + console.log('商品类型。。。。。'); | ||
3104 | + console.log(type); | ||
3105 | + wx.showLoading({title: '生成中...',}) | ||
3106 | + var that = this, th = that; | ||
3107 | + //设置画板显示,才能开始绘图 | ||
3108 | + that.setData({ | ||
3109 | + canvasHidden: false | ||
3110 | + }) | ||
3111 | + | ||
3112 | + var app = getApp(); | ||
3113 | + var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | ||
3114 | + var path2 = that.data.data.original_img; | ||
3115 | + var scene = th.data.gid + ""; | ||
3116 | + scene += "." + th.data.sele_g.prom_type + "." + th.data.sele_g.prom_id; | ||
3117 | + | ||
3118 | + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; | ||
3119 | + if (user_id > 0) { | ||
3120 | + scene += "_" + user_id; | ||
3121 | + } | ||
3122 | + //-- 如果不是会员分享过来的要分享给别人 -- | ||
3123 | + if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) { | ||
3124 | + //固定房间是第3个字符 | ||
3125 | + if (!user_id) scene += "_0"; | ||
3126 | + scene += "_" + getApp().globalData.room_id; | ||
3127 | + } | ||
3128 | + | ||
3129 | + ///二微码 | ||
3130 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
3131 | + os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/goodsInfo/goodsInfo"; | ||
3132 | + | ||
3133 | + console.log(path3); | ||
3134 | + | ||
3135 | + | ||
3136 | + // 读取文件成功则OK-- | ||
3137 | + wx.getImageInfo({ | ||
3138 | + src: path3, | ||
3139 | + success: function (res) { | ||
3140 | + // 回调写法 | ||
3141 | + th.get_head_temp(th.get_goods_temp, function () { | ||
3142 | + var vpath = res.path; | ||
3143 | + var context = wx.createCanvasContext('share'); | ||
3144 | + // 先画背景 | ||
3145 | + var pg_path = "../../../../images/share/share_bg.png"; | ||
3146 | + | ||
3147 | + | ||
3148 | + //-- 如果有自定义海报的时候,判断背景的图片 -- | ||
3149 | + if (th.data.share_b_img) { | ||
3150 | + pg_path = th.data.share_b_img; | ||
3151 | + } | ||
3152 | + // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | ||
3153 | + console.log('海报类型-----') | ||
3154 | + console.log(type); | ||
3155 | + | ||
3156 | + if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报 | ||
3157 | + th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); | ||
3158 | + } else { | ||
3159 | + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | ||
3160 | + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
3161 | + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
3162 | + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | ||
3163 | + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | ||
3164 | + }; | ||
3165 | + | ||
3166 | + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | ||
3167 | + | ||
3168 | + | ||
3169 | + //-- 是自定义海报的情况下 -- | ||
3170 | + if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | ||
3171 | + | ||
3172 | + if (th.data.poster && parseInt(th.data.poster.style) == 2) { | ||
3173 | + //在线上分享人的情况下 | ||
3174 | + if (parseInt(th.data.poster.show_headpic)) { | ||
3175 | + //获取坐标 | ||
3176 | + var x = parseFloat(th.data.poster.head_x) * 2; | ||
3177 | + var y = parseFloat(th.data.poster.head_y) * 2; | ||
3178 | + var x1 = (x + 90) * unit; | ||
3179 | + var y1 = (y + 50) * unit; | ||
3180 | + //--昵称--- | ||
3181 | + context.setFontSize(24 * unit) | ||
3182 | + context.setFillStyle("black") | ||
3183 | + context.fillText(app.globalData.userInfo.nickname, x1, y1); | ||
3184 | + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | ||
3185 | + //强烈推荐 改许程 | ||
3186 | + var tj_path = "../../../../images/share/q_tj.png"; | ||
3187 | + context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); | ||
3188 | + context.setFontSize(16 * unit); | ||
3189 | + context.setLineJoin('round'); //交点设置成圆角 | ||
3190 | + context.setFillStyle("white"); | ||
3191 | + context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); | ||
3192 | + | ||
3193 | + //context.setFillStyle("black") | ||
3194 | + //context.setFontSize(24 * unit) | ||
3195 | + //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); | ||
3196 | + } | ||
3197 | + } else { | ||
3198 | + //--昵称--- | ||
3199 | + context.setFontSize(24 * unit); | ||
3200 | + context.setFillStyle("black"); | ||
3201 | + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); | ||
3202 | + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | ||
3203 | + //强烈推荐 改许程 | ||
3204 | + var tj_path = "../../../../images/share/q_tj.png"; | ||
3205 | + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); | ||
3206 | + context.setFontSize(16 * unit); | ||
3207 | + context.setLineJoin('round'); //交点设置成圆角 | ||
3208 | + context.setFillStyle("white"); | ||
3209 | + context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); | ||
3210 | + } | ||
3211 | + | ||
3212 | + }; | ||
3213 | + | ||
3214 | + | ||
3215 | + var share_title = th.data.data.goods_name; | ||
3216 | + if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) { | ||
3217 | + share_title = th.data.prom_act.share_title; | ||
3218 | + if (!share_title) share_title = th.data.prom_act.title; | ||
3219 | + if (th.data.prom_type == 4) share_title = th.data.prom_act.name; | ||
3220 | + } | ||
3221 | + | ||
3222 | + //---产品名称--- | ||
3223 | + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | ||
3224 | + if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | ||
3225 | + context.setFillStyle("black"); | ||
3226 | + context.setFontSize(21.3 * unit) | ||
3227 | + getApp().draw_Text(context, share_title, | ||
3228 | + 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); | ||
3229 | + | ||
3230 | + //------产品的价格------- | ||
3231 | + context.setFontSize(23 * unit) | ||
3232 | + context.setFillStyle("red") | ||
3233 | + | ||
3234 | + var pri0 = th.data.data.shop_price; | ||
3235 | + if (th.data.card_field && th.data.data[th.data.card_field]) { | ||
3236 | + pri0 = th.data.data[th.data.card_field]; | ||
3237 | + } | ||
3238 | + | ||
3239 | + if (th.data.prom_act) | ||
3240 | + pri0 = th.data.prom_price; | ||
3241 | + pri0 = parseFloat(pri0).toFixed(2); | ||
3242 | + var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; | ||
3243 | + context.fillText("¥", wd1 - 15, 185 * unit); | ||
3244 | + context.setFontSize(31 * unit) | ||
3245 | + context.fillText(pri0, wd1, 185 * unit); | ||
3246 | + | ||
3247 | + //---市场价划掉--- | ||
3248 | + /*-- | ||
3249 | + context.setFillStyle("gray") | ||
3250 | + context.setFontSize(22 * unit) | ||
3251 | + pri0 = "¥" + th.data.data.market_price.toFixed(2); | ||
3252 | + var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | ||
3253 | + context.fillText(pri0, wd2, 213 * unit); | ||
3254 | + | ||
3255 | + context.setStrokeStyle('gray'); | ||
3256 | + context.setLineWidth(1 * unit); | ||
3257 | + context.moveTo(wd2 - 5, 206 * unit); | ||
3258 | + context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | ||
3259 | + context.stroke();--*/ | ||
3260 | + | ||
3261 | + } else if ( ( type == 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | ||
3262 | + context.setFillStyle("black"); | ||
3263 | + context.setFontSize(21.3 * unit) | ||
3264 | + getApp().draw_Text(context, share_title, | ||
3265 | + 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); | ||
3266 | + //------ 产品的价格 ----- | ||
3267 | + var pri0 = th.data.prom_act.addmoney; | ||
3268 | + var integral = th.data.prom_act.integral; | ||
3269 | + var text = ""; | ||
3270 | + if (integral) { | ||
3271 | + text = integral + "积分"; | ||
3272 | + } | ||
3273 | + if (pri0 && integral) { | ||
3274 | + text += "+"; | ||
3275 | + } | ||
3276 | + if (pri0) { | ||
3277 | + text += "¥" + pri0; | ||
3278 | + } | ||
3279 | + | ||
3280 | + if (!pri0 && !integral) { | ||
3281 | + text = "0积分"; | ||
3282 | + } | ||
3283 | + context.setFillStyle("red"); | ||
3284 | + context.fillText(text, 38 * unit, 235 * unit); | ||
3041 | 3285 | ||
3286 | + } | ||
3287 | + | ||
3288 | + //---中间大图--- | ||
3289 | + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | ||
3290 | + context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | ||
3291 | + } | ||
3292 | + ; | ||
3293 | + | ||
3294 | + //---自定义海报 产品质量保证 | ||
3295 | + if(th.data.share_b_img && th.data.poster.show_quality==1 ){ | ||
3296 | + var g_path = "../../../../images/share/s_gou.png"; | ||
3297 | + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3298 | + context.setFillStyle("red") | ||
3299 | + context.setFontSize(18 * unit) | ||
3300 | + context.fillText("正品保证", 84 * unit, 690 * unit); | ||
3301 | + | ||
3302 | + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3303 | + context.setFillStyle("red") | ||
3304 | + context.setFontSize(18 * unit) | ||
3305 | + context.fillText("纯实体店", 246 * unit, 690 * unit); | ||
3306 | + | ||
3307 | + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3308 | + context.setFillStyle("red") | ||
3309 | + context.setFontSize(18 * unit) | ||
3310 | + context.fillText("官方验证", 420 * unit, 690 * unit); | ||
3311 | + | ||
3312 | + } | ||
3313 | + //-------大图后面就不一样了----------- | ||
3314 | + switch (type) { | ||
3315 | + case 0: | ||
3316 | + if(!th.data.share_b_img){ | ||
3317 | + break | ||
3318 | + } | ||
3319 | + //---画线--- | ||
3320 | + context.setLineWidth(1 * unit) | ||
3321 | + context.moveTo(32 * unit, 710 * unit) | ||
3322 | + context.lineTo(520 * unit, 710 * unit) | ||
3323 | + context.stroke(); | ||
3324 | + //---文字--- | ||
3325 | + context.setFillStyle("black") | ||
3326 | + context.setFontSize(22 * unit) | ||
3327 | + // 原来start ---> | ||
3328 | + context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit); | ||
3329 | + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit); | ||
3330 | + // <--- 原来end | ||
3331 | + // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit); | ||
3332 | + // context.setFontSize(18 * unit) | ||
3333 | + // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit); | ||
3334 | + //---二维吗图--- | ||
3335 | + context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); | ||
3336 | + break;//普通商品的展示 | ||
3337 | + case 4: | ||
3338 | + // 中间的几个字 | ||
3339 | + if (th.data.poster && parseInt(th.data.poster.style) == 2) { | ||
3340 | + if (parseInt(th.data.poster.show_quality)) { | ||
3341 | + var g_path = "../../../../images/share/s_gou.png"; | ||
3342 | + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3343 | + context.setFillStyle("red") | ||
3344 | + context.setFontSize(18 * unit) | ||
3345 | + context.fillText("正品保证", 84 * unit, 690 * unit); | ||
3346 | + | ||
3347 | + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3348 | + context.setFillStyle("red") | ||
3349 | + context.setFontSize(18 * unit) | ||
3350 | + context.fillText("纯实体店", 246 * unit, 690 * unit); | ||
3351 | + | ||
3352 | + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3353 | + context.setFillStyle("red") | ||
3354 | + context.setFontSize(18 * unit) | ||
3355 | + context.fillText("官方验证", 420 * unit, 690 * unit); | ||
3356 | + } | ||
3357 | + | ||
3358 | + } else { | ||
3359 | + var g_path = "../../../../images/share/s_gou.png"; | ||
3360 | + context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3361 | + context.setFillStyle("red") | ||
3362 | + context.setFontSize(18 * unit) | ||
3363 | + context.fillText("正品保证", 84 * unit, 690 * unit); | ||
3364 | + | ||
3365 | + context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3366 | + context.setFillStyle("red") | ||
3367 | + context.setFontSize(18 * unit) | ||
3368 | + context.fillText("纯实体店", 246 * unit, 690 * unit); | ||
3369 | + | ||
3370 | + context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3371 | + context.setFillStyle("red") | ||
3372 | + context.setFontSize(18 * unit) | ||
3373 | + context.fillText("官方验证", 420 * unit, 690 * unit); | ||
3374 | + } | ||
3375 | + | ||
3376 | + | ||
3377 | + //---画线--- | ||
3378 | + context.setLineWidth(1 * unit) | ||
3379 | + context.moveTo(32 * unit, 710 * unit) | ||
3380 | + context.lineTo(520 * unit, 710 * unit) | ||
3381 | + context.stroke(); | ||
3382 | + | ||
3383 | + //---文字--- | ||
3384 | + context.setFillStyle("black") | ||
3385 | + context.setFontSize(22 * unit) | ||
3386 | + | ||
3387 | + if (type == 0 || type == -1) { | ||
3388 | + // 原来start ---> | ||
3389 | + context.setFontSize(24 * unit) | ||
3390 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | ||
3391 | + | ||
3392 | + context.setFontSize(22 * unit) | ||
3393 | + context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit); | ||
3394 | + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); | ||
3395 | + | ||
3396 | + } else { | ||
3397 | + context.setFontSize(24 * unit) | ||
3398 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | ||
3399 | + context.setFontSize(22 * unit) | ||
3400 | + context.fillText("长按识别二维码", 40 * unit, 806 * unit); | ||
3401 | + context.fillText("立即开始兑换", 40 * unit, 846 * unit); | ||
3402 | + | ||
3403 | + } | ||
3404 | + | ||
3405 | + //---二维吗图--- | ||
3406 | + //-- 自定义海报 -- | ||
3407 | + if (th.data.share_b_img || th.data.poster) { | ||
3408 | + var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
3409 | + var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
3410 | + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | ||
3411 | + } else { | ||
3412 | + //---二维吗图--- | ||
3413 | + context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | ||
3414 | + } | ||
3415 | + ; | ||
3416 | + | ||
3417 | + break; | ||
3418 | + case 1: //秒杀商品的展示 | ||
3419 | + if(!th.data.share_b_img){ | ||
3420 | + break | ||
3421 | + } | ||
3422 | + //---画线--- | ||
3423 | + context.setLineWidth(1 * unit) | ||
3424 | + context.moveTo(32 * unit, 670 * unit) | ||
3425 | + context.lineTo(520 * unit, 670 * unit) | ||
3426 | + context.stroke(); | ||
3427 | + | ||
3428 | + //画秒杀的图片 | ||
3429 | + var miaos_path = '../../../../images/share/miao_share.png'; | ||
3430 | + context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | ||
3431 | + | ||
3432 | + context.setFillStyle("black") | ||
3433 | + context.setFontSize(24 * unit) | ||
3434 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); | ||
3435 | + //---文字--- | ||
3436 | + context.setFontSize(22 * unit) | ||
3437 | + context.setFillStyle("black") | ||
3438 | + context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); | ||
3439 | + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | ||
3440 | + | ||
3441 | + | ||
3442 | + //---二维吗图--- | ||
3443 | + //-- 自定义海报 -- | ||
3444 | + if (th.data.share_b_img || th.data.poster) { | ||
3445 | + var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
3446 | + var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
3447 | + context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | ||
3448 | + } else { | ||
3449 | + //---二维吗图--- | ||
3450 | + context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); | ||
3451 | + } | ||
3452 | + break; | ||
3453 | + | ||
3454 | + case 2: //会员团和商家团的展示 | ||
3455 | + if(!th.data.share_b_img){ | ||
3456 | + break | ||
3457 | + } | ||
3458 | + //---画线--- | ||
3459 | + context.setLineWidth(1 * unit) | ||
3460 | + context.moveTo(32 * unit, 670 * unit) | ||
3461 | + context.lineTo(520 * unit, 670 * unit) | ||
3462 | + context.stroke(); | ||
3463 | + //---文字--- | ||
3464 | + context.setFillStyle("black") | ||
3465 | + context.setFontSize(24 * unit) | ||
3466 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | ||
3467 | + | ||
3468 | + //绘制成团图片 | ||
3469 | + var ct_img = "../../../../images/share/ct_num.png"; | ||
3470 | + context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); | ||
3471 | + var ct_num = th.data.prom_act.ct_num; | ||
3472 | + context.setFontSize(14 * unit) | ||
3473 | + context.font = 'normal'; | ||
3474 | + context.setFillStyle("red") | ||
3475 | + if (ct_num < 10) { | ||
3476 | + context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit); | ||
3477 | + } else { | ||
3478 | + context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit); | ||
3479 | + } | ||
3480 | + context.setFontSize(22 * unit) | ||
3481 | + context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); | ||
3482 | + | ||
3483 | + context.setFillStyle("gray") | ||
3484 | + context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit); | ||
3485 | + context.setFillStyle("black") | ||
3486 | + context.font = 'normal bold 18px sans-serif'; | ||
3487 | + context.setFontSize(21.3 * unit) | ||
3488 | + context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit); | ||
3489 | + | ||
3490 | + | ||
3491 | + //---二维吗图--- | ||
3492 | + //-- 自定义海报 -- | ||
3493 | + if (th.data.share_b_img || th.data.poster) { | ||
3494 | + var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
3495 | + var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
3496 | + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | ||
3497 | + } else { | ||
3498 | + //---二维吗图--- | ||
3499 | + context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | ||
3500 | + } | ||
3501 | + break | ||
3502 | + case 3: //阶梯团的展示 | ||
3503 | + if(!th.data.share_b_img){ | ||
3504 | + break | ||
3505 | + } | ||
3506 | + //---画线--- | ||
3507 | + context.setLineWidth(1 * unit) | ||
3508 | + context.moveTo(32 * unit, 670 * unit) | ||
3509 | + context.lineTo(520 * unit, 670 * unit) | ||
3510 | + context.stroke(); | ||
3511 | + //---文字--- | ||
3512 | + context.setFillStyle("black") | ||
3513 | + context.setFontSize(24 * unit) | ||
3514 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | ||
3515 | + | ||
3516 | + //---绘制中间阶梯的价格--- | ||
3517 | + var list = th.data.prom_act.ct_rylist; | ||
3518 | + for (var i = 0; i < list.length; i++) { | ||
3519 | + var item = list[i]; | ||
3520 | + var wi = i * 90 * unit; | ||
3521 | + context.font = 'normal'; | ||
3522 | + context.setFontSize(16 * unit) | ||
3523 | + context.setFillStyle("red") | ||
3524 | + context.fillText("¥", 40 * unit + wi, 756 * unit); | ||
3525 | + context.setFontSize(22 * unit) | ||
3526 | + var pri = parseFloat(item.price).toFixed(2); | ||
3527 | + context.fillText(pri, 56 * unit + wi, 756 * unit); | ||
3528 | + context.setFillStyle("gray") | ||
3529 | + context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); | ||
3530 | + } | ||
3531 | + //----------------下面部分---------------- | ||
3532 | + | ||
3533 | + context.setFillStyle("black") | ||
3534 | + context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit); | ||
3535 | + //context.font = 'normal bold 18px sans-serif'; | ||
3536 | + context.setFontSize(21 * unit) | ||
3537 | + context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit); | ||
3538 | + | ||
3539 | + | ||
3540 | + //-- 自定义海报 -- | ||
3541 | + if (th.data.share_b_img || th.data.poster) { | ||
3542 | + var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
3543 | + var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
3544 | + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | ||
3545 | + } else { | ||
3546 | + //---二维吗图--- | ||
3547 | + context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | ||
3548 | + } | ||
3549 | + break | ||
3550 | + | ||
3551 | + | ||
3552 | + case -1: //秒杀商品的展示 | ||
3553 | + //---画线--- | ||
3554 | + context.setLineWidth(1 * unit) | ||
3555 | + context.moveTo(32 * unit, 670 * unit) | ||
3556 | + context.lineTo(520 * unit, 670 * unit) | ||
3557 | + context.stroke(); | ||
3558 | + | ||
3559 | + | ||
3560 | + context.setFillStyle("black") | ||
3561 | + context.setFontSize(24 * unit) | ||
3562 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 744 * unit); | ||
3563 | + //---文字--- | ||
3564 | + context.setFontSize(22 * unit) | ||
3565 | + context.setFillStyle("black") | ||
3566 | + context.fillText("长按识别二维码", 40 * unit, 800 * unit); | ||
3567 | + context.fillText("立即开始抢购", 40 * unit, 846 * unit); | ||
3568 | + | ||
3569 | + | ||
3570 | + //---二维吗图--- | ||
3571 | + //-- 自定义海报 -- | ||
3572 | + if (th.data.share_b_img || th.data.poster) { | ||
3573 | + var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
3574 | + var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
3575 | + context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | ||
3576 | + } else { | ||
3577 | + //---二维吗图--- | ||
3578 | + context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); | ||
3579 | + } | ||
3580 | + break; | ||
3581 | + | ||
3582 | + | ||
3583 | + } | ||
3584 | + | ||
3585 | + | ||
3586 | + //--- 如果是自定义海报的时候 --- | ||
3587 | + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | ||
3588 | + | ||
3589 | + if (th.data.poster && parseInt(th.data.poster.style) == 2) { | ||
3590 | + | ||
3591 | + //如果显示会员信息的话 | ||
3592 | + if (parseInt(th.data.poster.show_headpic)) { | ||
3593 | + //获取坐标 | ||
3594 | + var x = parseFloat(th.data.poster.head_x) * 2; | ||
3595 | + var y = parseFloat(th.data.poster.head_y) * 2; | ||
3596 | + //---绘制圆形要放在最后---- | ||
3597 | + context.save(); | ||
3598 | + context.beginPath(); | ||
3599 | + var h_x = x * unit; | ||
3600 | + var h_y = y * unit; | ||
3601 | + var h_r = 40 * unit; | ||
3602 | + var cx = h_x + h_r; | ||
3603 | + var cy = h_y + h_r; | ||
3604 | + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
3605 | + context.closePath(); | ||
3606 | + context.fill(); | ||
3607 | + context.clip(); | ||
3608 | + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
3609 | + context.restore(); | ||
3610 | + } | ||
3611 | + | ||
3612 | + } else { | ||
3613 | + //---绘制圆形要放在最后---- | ||
3614 | + context.save(); | ||
3615 | + context.beginPath(); | ||
3616 | + var h_x = 60 * unit; | ||
3617 | + var h_y = 24 * unit; | ||
3618 | + var h_r = 40 * unit; | ||
3619 | + var cx = h_x + h_r; | ||
3620 | + var cy = h_y + h_r; | ||
3621 | + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
3622 | + context.closePath(); | ||
3623 | + context.fill(); | ||
3624 | + context.clip(); | ||
3625 | + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
3626 | + context.restore(); | ||
3627 | + } | ||
3628 | + | ||
3629 | + } | ||
3630 | + ; | ||
3631 | + | ||
3632 | + | ||
3633 | + //把画板内容绘制成图片,并回调 画板图片路径 | ||
3634 | + context.draw(false, function () { | ||
3635 | + setTimeout(function () { | ||
3636 | + wx.canvasToTempFilePath({ | ||
3637 | + x: 0, | ||
3638 | + y: 0, | ||
3639 | + width: 750, | ||
3640 | + height: 1217, | ||
3641 | + destWidth: 1.2 * 750 * 750 / that.data.screenWidth, | ||
3642 | + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth, | ||
3643 | + canvasId: 'share', | ||
3644 | + success: function (res) { | ||
3645 | + | ||
3646 | + that.setData({ | ||
3647 | + shareImgPath: res.tempFilePath, | ||
3648 | + canvasHidden: true | ||
3649 | + }) | ||
3650 | + | ||
3651 | + if (!res.tempFilePath) { | ||
3652 | + wx.showModal({ | ||
3653 | + title: '提示', | ||
3654 | + content: '图片绘制中,请稍后重试', | ||
3655 | + showCancel: false | ||
3656 | + }) | ||
3657 | + return false; | ||
3658 | + } | ||
3659 | + | ||
3660 | + that.setData({ | ||
3661 | + showPoster: true, | ||
3662 | + }); | ||
3663 | + wx.hideLoading(); | ||
3664 | + } | ||
3665 | + }) | ||
3666 | + }, 500) | ||
3667 | + | ||
3668 | + }); | ||
3669 | + }); | ||
3670 | + }, | ||
3671 | + fail: function (res) { | ||
3672 | + console.log(res); | ||
3673 | + wx.hideLoading(); | ||
3674 | + | ||
3675 | + } | ||
3676 | + }); | ||
3677 | + }, | ||
3042 | 3678 | ||
3043 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | 3679 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
3044 | draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { | 3680 | draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { |
@@ -3067,7 +3703,144 @@ Page({ | @@ -3067,7 +3703,144 @@ Page({ | ||
3067 | } | 3703 | } |
3068 | } | 3704 | } |
3069 | }, | 3705 | }, |
3706 | + drawPoster(context, unit, img, vpath, type) { | ||
3707 | + // 1.灰色背景 | ||
3708 | + context.setFillStyle('#f2f1f6'); | ||
3709 | + context.rect(0, 0, 554 * unit, 899 * unit); | ||
3710 | + context.fill(); | ||
3711 | + | ||
3712 | + // 2.商城名称 | ||
3713 | + let shopName = this.data.sto_sele_name_1; | ||
3714 | + context.setTextAlign('center'); | ||
3715 | + context.setFontSize(26 * unit); | ||
3716 | + context.setFillStyle('black'); | ||
3717 | + context.fillText(shopName, 277 * unit, 60 * unit); | ||
3718 | + | ||
3719 | + // 3.推荐来源 | ||
3720 | + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | ||
3721 | + context.setTextAlign('center'); | ||
3722 | + context.setFontSize(22 * unit); | ||
3723 | + context.setFillStyle('#96959a'); | ||
3724 | + context.fillText(fromText, 277 * unit, 105 * unit); | ||
3725 | + | ||
3726 | + // 4.海报背景 | ||
3727 | + context.setFillStyle('white'); | ||
3728 | + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); | ||
3729 | + | ||
3730 | + // 5.商品图片 | ||
3731 | + // 图片的x坐标 | ||
3732 | + let bg_x = 37 * unit | ||
3733 | + // 图片的y坐标 | ||
3734 | + let bg_y = 157 * unit | ||
3735 | + // 图片宽度 | ||
3736 | + let bg_w = 480 * unit | ||
3737 | + // 图片高度 | ||
3738 | + let bg_h = 474 * unit | ||
3739 | + // 图片圆角 | ||
3740 | + let bg_r = 4 | ||
3741 | + // 绘制海报背景图片圆角 | ||
3742 | + context.save() | ||
3743 | + context.beginPath() | ||
3744 | + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) | ||
3745 | + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) | ||
3746 | + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) | ||
3747 | + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) | ||
3748 | + context.clip() | ||
3749 | + context.drawImage(img, bg_x, bg_y, bg_w, bg_h); | ||
3750 | + context.restore(); | ||
3751 | + | ||
3752 | + // 6.强烈推荐 | ||
3753 | + let src = ''; | ||
3754 | + context.beginPath(); | ||
3755 | + if(type == 0) { // 普通 | ||
3756 | + src = '../../../../images/share/q_tj.png'; | ||
3757 | + context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit); | ||
3758 | + context.setFontSize(16 * unit) | ||
3759 | + context.setFillStyle("white") | ||
3760 | + context.setTextAlign('left'); | ||
3761 | + context.fillText('强烈推荐', 64 * unit, 668 * unit); | ||
3762 | + }; | ||
3763 | + if(type == 1) { // 秒杀 | ||
3764 | + src = '../../../images/share/miao_share.png'; | ||
3765 | + context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit); | ||
3766 | + context.setTextAlign('left'); | ||
3767 | + }; | ||
3768 | + if(type == 2) { // 商家和会员团 | ||
3769 | + src = '../../../images/share/ct_num.png'; | ||
3770 | + context.drawImage(src, 54 * unit, 648 * unit, 120 * unit, 30 * unit); | ||
3771 | + context.setTextAlign('left'); | ||
3772 | + | ||
3773 | + let ct_num = self.data.prom_act.ct_num; | ||
3774 | + context.setFontSize(16 * unit) | ||
3775 | + context.font = 'normal'; | ||
3776 | + context.setFillStyle("red") | ||
3777 | + if (ct_num < 10) { | ||
3778 | + context.fillText(ct_num + "人拼团", 100 * unit, 670 * unit); | ||
3779 | + } else { | ||
3780 | + context.fillText(ct_num + "人拼团", 96 * unit, 670 * unit); | ||
3781 | + } | ||
3782 | + context.setFontSize(22 * unit) | ||
3783 | + context.fillText("已拼" + self.data.prom_act.buy_num + "份", 186 * unit, 672 * unit); | ||
3784 | + }; | ||
3785 | + if(type == 3) { // 阶梯团 | ||
3786 | + let list = self.data.prom_act.ct_rylist; | ||
3787 | + for (let i = 0; i < list.length; i++) { | ||
3788 | + let item = list[i]; | ||
3789 | + let wi = i * 90 * unit; | ||
3790 | + context.font = 'normal'; | ||
3791 | + context.setTextAlign('left'); | ||
3792 | + context.setFontSize(16 * unit) | ||
3793 | + context.setFillStyle("red") | ||
3794 | + context.fillText("¥", 50 * unit + wi, 680 * unit); | ||
3795 | + context.setFontSize(22 * unit) | ||
3796 | + let pri = parseFloat(item.price).toFixed(2); | ||
3797 | + context.fillText(pri, 66 * unit + wi, 680 * unit); | ||
3798 | + context.setFillStyle("gray") | ||
3799 | + context.fillText("满" + item.rynum + "人", 50 * unit + wi, 716 * unit); | ||
3800 | + } | ||
3801 | + }; | ||
3802 | + | ||
3803 | + // 7.商品价格 | ||
3804 | + if(type != 3) { | ||
3805 | + let price = this.data.data.shop_price; | ||
3806 | + if (this.data.card_field && this.data.data[this.data.card_field]) { | ||
3807 | + price = this.data.data[this.data.card_field]; | ||
3808 | + } | ||
3809 | + if (this.data.prom_act) price = this.data.prom_price; | ||
3810 | + price = parseFloat(price).toFixed(2); | ||
3811 | + context.setFontSize(32 * unit); | ||
3812 | + context.setFillStyle('#DE1117'); | ||
3813 | + if (this.data.prom_type == 4 && this.data.prom_integral){ | ||
3814 | + context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit); | ||
3815 | + }else{ | ||
3816 | + if(this.data.prom_type ==8){ | ||
3817 | + price = this.data.presellList.presell_price | ||
3818 | + context.fillText('¥' + price, 54 * unit, 735 * unit); | ||
3819 | + }else{ | ||
3820 | + context.fillText('¥' + price, 54 * unit, 735 * unit); | ||
3821 | + } | ||
3822 | + } | ||
3823 | + | ||
3070 | 3824 | ||
3825 | + }; | ||
3826 | + | ||
3827 | + // 8.商品标题 | ||
3828 | + context.setFontSize(20 * unit); | ||
3829 | + context.setFillStyle('#898989'); | ||
3830 | + getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1); | ||
3831 | + | ||
3832 | + // 9.小程序码 | ||
3833 | + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); | ||
3834 | + context.setFontSize(16 * unit); | ||
3835 | + context.setFillStyle('#777'); | ||
3836 | + context.fillText('长按识别二维码', 378 * unit, 810 * unit); | ||
3837 | + | ||
3838 | + // 10.竖线 | ||
3839 | + context.beginPath(); | ||
3840 | + context.setFillStyle('#eee'); | ||
3841 | + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); | ||
3842 | + context.fill(); | ||
3843 | + }, | ||
3071 | // ----视频图片---- | 3844 | // ----视频图片---- |
3072 | // 图片计数器 | 3845 | // 图片计数器 |
3073 | swiperChange: function (e) { | 3846 | swiperChange: function (e) { |
@@ -3153,7 +3926,7 @@ Page({ | @@ -3153,7 +3926,7 @@ Page({ | ||
3153 | tt(); | 3926 | tt(); |
3154 | return false; | 3927 | return false; |
3155 | } | 3928 | } |
3156 | - var img_url = ee.data.data.original_img; | 3929 | + var img_url = ee.data.data.original_img; |
3157 | //var img_url = ee.data.presellForm.share_img; | 3930 | //var img_url = ee.data.presellForm.share_img; |
3158 | //img_url?img_url:ee.data.data.original_img; | 3931 | //img_url?img_url:ee.data.data.original_img; |
3159 | 3932 | ||
@@ -3168,8 +3941,8 @@ Page({ | @@ -3168,8 +3941,8 @@ Page({ | ||
3168 | fail: function (res) { | 3941 | fail: function (res) { |
3169 | //获取默认空白图 | 3942 | //获取默认空白图 |
3170 | wx.getImageInfo({ | 3943 | wx.getImageInfo({ |
3171 | - src: ee.data.iurl+'/miniapp/images/default_g_img.gif', | ||
3172 | - success: function(res) { | 3944 | + src: ee.data.iurl + '/miniapp/images/default_g_img.gif', |
3945 | + success: function (res) { | ||
3173 | ee.data.share_goods_img = res.path; //分享的图片不能用网络的 | 3946 | ee.data.share_goods_img = res.path; //分享的图片不能用网络的 |
3174 | tt(); | 3947 | tt(); |
3175 | } | 3948 | } |
@@ -3213,22 +3986,22 @@ Page({ | @@ -3213,22 +3986,22 @@ Page({ | ||
3213 | getHistoryBuy() { | 3986 | getHistoryBuy() { |
3214 | let _this = this; | 3987 | let _this = this; |
3215 | let req_data = { | 3988 | let req_data = { |
3216 | - store_id: os.stoid, | ||
3217 | - goods_id: this.data.gid, | ||
3218 | - pay_status: 1, | ||
3219 | - rndid: 1 | 3989 | + store_id: os.stoid, |
3990 | + goods_id: this.data.gid, | ||
3991 | + pay_status: 1, | ||
3992 | + rndid: 1 | ||
3220 | }; | 3993 | }; |
3221 | getApp().request.promiseGet('/api/weshop/ordergoods/list', { | 3994 | getApp().request.promiseGet('/api/weshop/ordergoods/list', { |
3222 | - data: req_data, | 3995 | + data: req_data, |
3223 | }) | 3996 | }) |
3224 | - .then(res => { | ||
3225 | - if (ut.ajax_ok(res)) { | ||
3226 | - _this.setData({ | ||
3227 | - historyBuyInfo: res.data.data.pageData, | ||
3228 | - }) | ||
3229 | - } | ||
3230 | - }) | ||
3231 | -}, | 3997 | + .then(res => { |
3998 | + if (ut.ajax_ok(res)) { | ||
3999 | + _this.setData({ | ||
4000 | + historyBuyInfo: res.data.data.pageData, | ||
4001 | + }) | ||
4002 | + } | ||
4003 | + }) | ||
4004 | + }, | ||
3232 | 4005 | ||
3233 | //--调用更新阶梯团的接口-- | 4006 | //--调用更新阶梯团的接口-- |
3234 | update_jiti: function (id) { | 4007 | update_jiti: function (id) { |
@@ -3256,8 +4029,8 @@ Page({ | @@ -3256,8 +4029,8 @@ Page({ | ||
3256 | var bconfig = th.data.bconfig; | 4029 | var bconfig = th.data.bconfig; |
3257 | 4030 | ||
3258 | //如果开启了,则不在选择门店 | 4031 | //如果开启了,则不在选择门店 |
3259 | - if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
3260 | - return false; | 4032 | + if (this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) { |
4033 | + return false; | ||
3261 | } | 4034 | } |
3262 | 4035 | ||
3263 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 4036 | if (!th.data.only_pk && !th.data.def_pickpu_list) { |
@@ -3881,7 +4654,7 @@ Page({ | @@ -3881,7 +4654,7 @@ Page({ | ||
3881 | 4654 | ||
3882 | 4655 | ||
3883 | onShareTimeline() { | 4656 | onShareTimeline() { |
3884 | - getApp().globalData.no_clear=1; | 4657 | + getApp().globalData.no_clear = 1; |
3885 | var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | 4658 | var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; |
3886 | if (!store_name) | 4659 | if (!store_name) |
3887 | store_name = getApp().globalData.setting.appName; | 4660 | store_name = getApp().globalData.setting.appName; |
@@ -3896,10 +4669,10 @@ Page({ | @@ -3896,10 +4669,10 @@ Page({ | ||
3896 | }, | 4669 | }, |
3897 | 4670 | ||
3898 | clickShare() { | 4671 | clickShare() { |
3899 | - if(!getApp().globalData.user_id){ | ||
3900 | - getApp().goto("/packageE/pages/togoin/togoin"); | ||
3901 | - return false; | ||
3902 | - } | 4672 | + if (!getApp().globalData.user_id) { |
4673 | + getApp().goto("/packageE/pages/togoin/togoin"); | ||
4674 | + return false; | ||
4675 | + } | ||
3903 | this.setData({ share_hidden: true, }); | 4676 | this.setData({ share_hidden: true, }); |
3904 | }, | 4677 | }, |
3905 | 4678 | ||
@@ -3930,206 +4703,206 @@ Page({ | @@ -3930,206 +4703,206 @@ Page({ | ||
3930 | }, | 4703 | }, |
3931 | 4704 | ||
3932 | //获取预售的信息 | 4705 | //获取预售的信息 |
3933 | - async get_pre_prom(func) { | ||
3934 | - var th = this; | ||
3935 | - var presell_id = null; | ||
3936 | - var pre_arr = null; | ||
3937 | - | ||
3938 | - if (!th.data.pre_id) { | ||
3939 | - var presell_id = th.data.presell_id; | ||
3940 | - var url = "/api/weshop/marketing/marketingPresellList/list" | ||
3941 | - var rd = { | ||
3942 | - store_id: os.stoid, | ||
3943 | - presell_id: presell_id, | ||
3944 | - goods_id: th.data.gid | ||
3945 | - } | ||
3946 | - //------获取预售从表---------- | ||
3947 | - await getApp().request.promiseGet(url, { | ||
3948 | - data: rd | ||
3949 | - }).then(res => { | ||
3950 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
3951 | - var arr = res.data.data[0]; | ||
3952 | - presell_id = arr.presell_id; | ||
3953 | - th.setData({ | ||
3954 | - presellList: arr, | ||
3955 | - }) | ||
3956 | - } | ||
3957 | - }) | 4706 | + async get_pre_prom(func) { |
4707 | + var th = this; | ||
4708 | + var presell_id = null; | ||
4709 | + var pre_arr = null; | ||
3958 | 4710 | ||
3959 | - } else { | ||
3960 | - //------获取预售从表---------- | ||
3961 | - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => { | ||
3962 | - if (res.data.code == 0 && res.data.data) { | ||
3963 | - var arr = res.data.data; | ||
3964 | - presell_id = arr.presell_id; | ||
3965 | - th.setData({ | ||
3966 | - presellList: arr, | ||
3967 | - }) | ||
3968 | - } | ||
3969 | - }) | 4711 | + if (!th.data.pre_id) { |
4712 | + var presell_id = th.data.presell_id; | ||
4713 | + var url = "/api/weshop/marketing/marketingPresellList/list" | ||
4714 | + var rd = { | ||
4715 | + store_id: os.stoid, | ||
4716 | + presell_id: presell_id, | ||
4717 | + goods_id: th.data.gid | ||
4718 | + } | ||
4719 | + //------获取预售从表---------- | ||
4720 | + await getApp().request.promiseGet(url, { | ||
4721 | + data: rd | ||
4722 | + }).then(res => { | ||
4723 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
4724 | + var arr = res.data.data[0]; | ||
4725 | + presell_id = arr.presell_id; | ||
4726 | + th.setData({ | ||
4727 | + presellList: arr, | ||
4728 | + }) | ||
3970 | } | 4729 | } |
4730 | + }) | ||
3971 | 4731 | ||
3972 | - if (!presell_id) { | ||
3973 | - wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000}); | ||
3974 | - ut.wx_back(); | ||
3975 | - return false; | 4732 | + } else { |
4733 | + //------获取预售从表---------- | ||
4734 | + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => { | ||
4735 | + if (res.data.code == 0 && res.data.data) { | ||
4736 | + var arr = res.data.data; | ||
4737 | + presell_id = arr.presell_id; | ||
4738 | + th.setData({ | ||
4739 | + presellList: arr, | ||
4740 | + }) | ||
3976 | } | 4741 | } |
4742 | + }) | ||
4743 | + } | ||
3977 | 4744 | ||
3978 | - var gnext=1; | ||
3979 | - //------获取预售主表---------- | ||
3980 | - await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => { | ||
3981 | - if (res.data.code == 0 && res.data.data) { | ||
3982 | - var act_data = res.data.data; | ||
3983 | - if (act_data.is_end) { | ||
3984 | - wx.showToast({title: "活动已经结束", icon: 'none', duration: 3000}); | ||
3985 | - setTimeout(function () { | ||
3986 | - ut.wx_back(); | ||
3987 | - }, 2000) | ||
3988 | - gnext=0; | ||
3989 | - return false; | ||
3990 | - } | ||
3991 | - if (act_data.isuse == 0) { | ||
3992 | - wx.showToast({title: "活动未启用", icon: 'none', duration: 3000}); | ||
3993 | - setTimeout(function () { | ||
3994 | - ut.wx_back(); | ||
3995 | - }, 2000) | ||
3996 | - gnext=0; | ||
3997 | - return false; | ||
3998 | - } | ||
3999 | - | ||
4000 | - var err_txt="活动定金时间已经结束"; | ||
4001 | - var end_time = act_data.end_time; | ||
4002 | - if (act_data.presell_type == 1) { | ||
4003 | - err_txt="活动时间已经结束"; | ||
4004 | - } | ||
4005 | - if (end_time < ut.gettimestamp()) { | ||
4006 | - wx.showToast({title:err_txt, icon: 'none', duration: 3000}); | ||
4007 | - setTimeout(function () { | ||
4008 | - getApp().goto("/pages/index/index/index"); | ||
4009 | - }, 2000) | ||
4010 | - gnext=0; | ||
4011 | - return false; | ||
4012 | - } | ||
4013 | - | ||
4014 | - if (act_data.presell_type == 0) { | ||
4015 | - end_time = act_data.pay_enddate; | ||
4016 | - err_txt="活动尾款时间已经结束"; | ||
4017 | - } | ||
4018 | - if (end_time < ut.gettimestamp()) { | ||
4019 | - wx.showToast({title:err_txt, icon: 'none', duration: 3000}); | ||
4020 | - setTimeout(function () { | ||
4021 | - ut.wx_back(); | ||
4022 | - }, 2000) | ||
4023 | - gnext=0; | ||
4024 | - return false; | ||
4025 | - } | ||
4026 | - | ||
4027 | - if (act_data.start_time > ut.gettimestamp()) { | ||
4028 | - wx.showToast({title:"活动还未开始", icon: 'none', duration: 3000}); | ||
4029 | - setTimeout(function () { | ||
4030 | - ut.wx_back(); | ||
4031 | - }, 2000) | ||
4032 | - gnext=0; | ||
4033 | - return false; | ||
4034 | - } | 4745 | + if (!presell_id) { |
4746 | + wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 }); | ||
4747 | + ut.wx_back(); | ||
4748 | + return false; | ||
4749 | + } | ||
4035 | 4750 | ||
4036 | - th.setData({ | ||
4037 | - presellForm: res.data.data, | ||
4038 | - }); | ||
4039 | - th.countDown(res.data.data.end_time) | ||
4040 | - } | ||
4041 | - }) | 4751 | + var gnext = 1; |
4752 | + //------获取预售主表---------- | ||
4753 | + await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => { | ||
4754 | + if (res.data.code == 0 && res.data.data) { | ||
4755 | + var act_data = res.data.data; | ||
4756 | + if (act_data.is_end) { | ||
4757 | + wx.showToast({ title: "活动已经结束", icon: 'none', duration: 3000 }); | ||
4758 | + setTimeout(function () { | ||
4759 | + ut.wx_back(); | ||
4760 | + }, 2000) | ||
4761 | + gnext = 0; | ||
4762 | + return false; | ||
4763 | + } | ||
4764 | + if (act_data.isuse == 0) { | ||
4765 | + wx.showToast({ title: "活动未启用", icon: 'none', duration: 3000 }); | ||
4766 | + setTimeout(function () { | ||
4767 | + ut.wx_back(); | ||
4768 | + }, 2000) | ||
4769 | + gnext = 0; | ||
4770 | + return false; | ||
4771 | + } | ||
4042 | 4772 | ||
4043 | - if(!gnext){ | ||
4044 | - return false; | 4773 | + var err_txt = "活动定金时间已经结束"; |
4774 | + var end_time = act_data.end_time; | ||
4775 | + if (act_data.presell_type == 1) { | ||
4776 | + err_txt = "活动时间已经结束"; | ||
4777 | + } | ||
4778 | + if (end_time < ut.gettimestamp()) { | ||
4779 | + wx.showToast({ title: err_txt, icon: 'none', duration: 3000 }); | ||
4780 | + setTimeout(function () { | ||
4781 | + getApp().goto("/pages/index/index/index"); | ||
4782 | + }, 2000) | ||
4783 | + gnext = 0; | ||
4784 | + return false; | ||
4045 | } | 4785 | } |
4046 | 4786 | ||
4047 | - var userInfo = getApp().globalData.userInfo; | ||
4048 | - var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, prom_type: 8, prom_id: presell_id,pageSize:1000}; | ||
4049 | - if (userInfo) { | ||
4050 | - pre_data.user_id = userInfo.user_id; | 4787 | + if (act_data.presell_type == 0) { |
4788 | + end_time = act_data.pay_enddate; | ||
4789 | + err_txt = "活动尾款时间已经结束"; | ||
4051 | } | 4790 | } |
4052 | - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { | ||
4053 | - data: pre_data, | ||
4054 | - }).then(e => { | ||
4055 | - if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | ||
4056 | - | ||
4057 | - th.data.all_pre_goods = e.data.data.pageData; | ||
4058 | - var idx = e.data.data.pageData.findIndex(function (ele) { | ||
4059 | - return ele.id == th.data.presellList.id; | ||
4060 | - }) | ||
4061 | - | ||
4062 | - pre_arr = e.data.data.pageData[idx]; | ||
4063 | - th.setData({pre_arr: pre_arr,show:1}) | ||
4064 | - th.data.prom_buy_limit = pre_arr.vip_butyqty; | ||
4065 | - } | ||
4066 | - }) | ||
4067 | - if (!pre_arr) { | ||
4068 | - wx.showToast({title: "当前会员身份不符或者时间已过期,无法参与", icon: 'none', duration: 3000}); | ||
4069 | - setTimeout(function () { | ||
4070 | - ut.wx_back(); | ||
4071 | - }, 2000) | ||
4072 | - return false; | 4791 | + if (end_time < ut.gettimestamp()) { |
4792 | + wx.showToast({ title: err_txt, icon: 'none', duration: 3000 }); | ||
4793 | + setTimeout(function () { | ||
4794 | + ut.wx_back(); | ||
4795 | + }, 2000) | ||
4796 | + gnext = 0; | ||
4797 | + return false; | ||
4073 | } | 4798 | } |
4074 | - if (func) { | ||
4075 | - func(); | 4799 | + |
4800 | + if (act_data.start_time > ut.gettimestamp()) { | ||
4801 | + wx.showToast({ title: "活动还未开始", icon: 'none', duration: 3000 }); | ||
4802 | + setTimeout(function () { | ||
4803 | + ut.wx_back(); | ||
4804 | + }, 2000) | ||
4805 | + gnext = 0; | ||
4806 | + return false; | ||
4076 | } | 4807 | } |
4077 | - }, | ||
4078 | 4808 | ||
4079 | - con_weixin:function () { | ||
4080 | - getApp().con_wx(this); | ||
4081 | - }, | ||
4082 | - | ||
4083 | - // 预览海报 | ||
4084 | - previewPoster() { | ||
4085 | - getApp().globalData.no_clear=1; | ||
4086 | - wx.previewImage({ | ||
4087 | - current: this.data.shareImgPath, // 当前显示图片的http链接 | ||
4088 | - urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表 | ||
4089 | - }); | ||
4090 | - }, | ||
4091 | - | ||
4092 | - | ||
4093 | - click_contact:function () { | ||
4094 | - getApp().globalData.no_clear=1; | ||
4095 | - }, | ||
4096 | - | ||
4097 | - //打开客服操作菜单 | ||
4098 | - openCS() { | ||
4099 | - // 判断会员状态 | ||
4100 | - let user_info = getApp().globalData.userInfo; | ||
4101 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { | ||
4102 | - wx.navigateTo({ | ||
4103 | - url: '/packageE/pages/togoin/togoin', | ||
4104 | - }) | ||
4105 | - return false; | ||
4106 | - }; | ||
4107 | - // csType/在线客服设置: | ||
4108 | - // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 | ||
4109 | - // 1小程序客服、 | ||
4110 | - // 2企业微信客服 | ||
4111 | - if(this.data.sys_switch) { | ||
4112 | - let csType = this.data.sys_switch.weapp_customertype; | ||
4113 | - if(csType == 0) { | ||
4114 | - // 拨打电话号码 | ||
4115 | - this.contactService(); | ||
4116 | - } else { | ||
4117 | - this.getTel() | ||
4118 | - .then(() => { | ||
4119 | - self.setData({ | ||
4120 | - hiddenCS: false, | ||
4121 | - }); | ||
4122 | - }); | ||
4123 | - }; | ||
4124 | - }; | ||
4125 | - | ||
4126 | - }, | ||
4127 | - | ||
4128 | - //关闭客服操作菜单 | ||
4129 | - closeCS() { | ||
4130 | - this.setData({ | ||
4131 | - hiddenCS: true, | ||
4132 | - }); | ||
4133 | - }, | 4809 | + th.setData({ |
4810 | + presellForm: res.data.data, | ||
4811 | + }); | ||
4812 | + th.countDown(res.data.data.end_time) | ||
4813 | + } | ||
4814 | + }) | ||
4815 | + | ||
4816 | + if (!gnext) { | ||
4817 | + return false; | ||
4818 | + } | ||
4819 | + | ||
4820 | + var userInfo = getApp().globalData.userInfo; | ||
4821 | + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, prom_type: 8, prom_id: presell_id, pageSize: 1000 }; | ||
4822 | + if (userInfo) { | ||
4823 | + pre_data.user_id = userInfo.user_id; | ||
4824 | + } | ||
4825 | + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { | ||
4826 | + data: pre_data, | ||
4827 | + }).then(e => { | ||
4828 | + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | ||
4829 | + | ||
4830 | + th.data.all_pre_goods = e.data.data.pageData; | ||
4831 | + var idx = e.data.data.pageData.findIndex(function (ele) { | ||
4832 | + return ele.id == th.data.presellList.id; | ||
4833 | + }) | ||
4834 | + | ||
4835 | + pre_arr = e.data.data.pageData[idx]; | ||
4836 | + th.setData({ pre_arr: pre_arr, show: 1 }) | ||
4837 | + th.data.prom_buy_limit = pre_arr.vip_butyqty; | ||
4838 | + } | ||
4839 | + }) | ||
4840 | + if (!pre_arr) { | ||
4841 | + wx.showToast({ title: "当前会员身份不符或者时间已过期,无法参与", icon: 'none', duration: 3000 }); | ||
4842 | + setTimeout(function () { | ||
4843 | + ut.wx_back(); | ||
4844 | + }, 2000) | ||
4845 | + return false; | ||
4846 | + } | ||
4847 | + if (func) { | ||
4848 | + func(); | ||
4849 | + } | ||
4850 | + }, | ||
4851 | + | ||
4852 | + con_weixin: function () { | ||
4853 | + getApp().con_wx(this); | ||
4854 | + }, | ||
4855 | + | ||
4856 | + // 预览海报 | ||
4857 | + previewPoster() { | ||
4858 | + getApp().globalData.no_clear = 1; | ||
4859 | + wx.previewImage({ | ||
4860 | + current: this.data.shareImgPath, // 当前显示图片的http链接 | ||
4861 | + urls: [this.data.shareImgPath],// 需要预览的图片http链接列表 | ||
4862 | + }); | ||
4863 | + }, | ||
4864 | + | ||
4865 | + | ||
4866 | + click_contact: function () { | ||
4867 | + getApp().globalData.no_clear = 1; | ||
4868 | + }, | ||
4869 | + | ||
4870 | + //打开客服操作菜单 | ||
4871 | + openCS() { | ||
4872 | + // 判断会员状态 | ||
4873 | + let user_info = getApp().globalData.userInfo; | ||
4874 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { | ||
4875 | + wx.navigateTo({ | ||
4876 | + url: '/packageE/pages/togoin/togoin', | ||
4877 | + }) | ||
4878 | + return false; | ||
4879 | + }; | ||
4880 | + // csType/在线客服设置: | ||
4881 | + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 | ||
4882 | + // 1小程序客服、 | ||
4883 | + // 2企业微信客服 | ||
4884 | + if (this.data.sys_switch) { | ||
4885 | + let csType = this.data.sys_switch.weapp_customertype; | ||
4886 | + if (csType == 0) { | ||
4887 | + // 拨打电话号码 | ||
4888 | + this.contactService(); | ||
4889 | + } else { | ||
4890 | + this.getTel() | ||
4891 | + .then(() => { | ||
4892 | + self.setData({ | ||
4893 | + hiddenCS: false, | ||
4894 | + }); | ||
4895 | + }); | ||
4896 | + }; | ||
4897 | + }; | ||
4898 | + | ||
4899 | + }, | ||
4900 | + | ||
4901 | + //关闭客服操作菜单 | ||
4902 | + closeCS() { | ||
4903 | + this.setData({ | ||
4904 | + hiddenCS: true, | ||
4905 | + }); | ||
4906 | + }, | ||
4134 | 4907 | ||
4135 | }); | 4908 | }); |
packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -939,7 +939,7 @@ | @@ -939,7 +939,7 @@ | ||
939 | <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if='{{!canvasHidden}}'></canvas> | 939 | <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if='{{!canvasHidden}}'></canvas> |
940 | <warn id="warn"></warn> | 940 | <warn id="warn"></warn> |
941 | <!-- 分享控件,底部弹出 --> | 941 | <!-- 分享控件,底部弹出 --> |
942 | -<share id="share_button" bind:send="send" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum" wx:if="{{share_hidden}}"></share> | 942 | +<share id="share_button" bind:send="send" bind:cancel="cancel" bind:share_img="saveImageFn" wx:if="{{share_hidden}}"></share> |
943 | <view wx:if="{{showPoster}}"> | 943 | <view wx:if="{{showPoster}}"> |
944 | <view class="mask" catchtap="closePoster"></view> | 944 | <view class="mask" catchtap="closePoster"></view> |
945 | <view class="poster-container"> | 945 | <view class="poster-container"> |
@@ -951,7 +951,10 @@ | @@ -951,7 +951,10 @@ | ||
951 | <text class="iconfont icon-close"></text> | 951 | <text class="iconfont icon-close"></text> |
952 | </view> | 952 | </view> |
953 | </view> | 953 | </view> |
954 | - | 954 | + <view class="btn-container"> |
955 | + <!-- <button class="btn-share" open-type="share" bindtap="">微信好友分享</button> --> | ||
956 | + <button class="btn-share" bindtap="savePic">保存到相册</button> | ||
957 | + </view> | ||
955 | </view> | 958 | </view> |
956 | </view> | 959 | </view> |
957 | </view> | 960 | </view> |
packageC/pages/presell/pregoodsInfo/goodsInfo.js
@@ -556,7 +556,7 @@ Page({ | @@ -556,7 +556,7 @@ Page({ | ||
556 | data: { | 556 | data: { |
557 | store_id: os.stoid, | 557 | store_id: os.stoid, |
558 | type: 1, | 558 | type: 1, |
559 | - pageSize: 3, | 559 | + pageSize: 100, |
560 | page: 1, | 560 | page: 1, |
561 | is_share: 0, | 561 | is_share: 0, |
562 | }, | 562 | }, |
@@ -564,7 +564,25 @@ Page({ | @@ -564,7 +564,25 @@ Page({ | ||
564 | fir_quan = res1.data.data.pageData; | 564 | fir_quan = res1.data.data.pageData; |
565 | }) | 565 | }) |
566 | } | 566 | } |
567 | - | 567 | + //过滤不是本商品的单品优惠券------------------- |
568 | + if(fir_quan.length > 0 ){ | ||
569 | + let goodInfo = ee.data.data | ||
570 | + for (let index = fir_quan.length-1; index >= 0; index--) { | ||
571 | + if (fir_quan[index].useobjecttype==20) { //判断是单品优惠券 | ||
572 | + if (fir_quan[index].useobjectno != goodInfo.goods_sn) { | ||
573 | + fir_quan.splice(index,1) | ||
574 | + } | ||
575 | + } | ||
576 | + } | ||
577 | + } | ||
578 | + let arr=[] | ||
579 | + let length = fir_quan.length | ||
580 | + if (length <= 3) { | ||
581 | + arr=fir_quan | ||
582 | + }else{ | ||
583 | + arr=fir_quan.splice(0,3); | ||
584 | + } | ||
585 | + //--------获取视频图片--------- | ||
568 | //--------获取视频图片--------- | 586 | //--------获取视频图片--------- |
569 | await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, { | 587 | await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, { |
570 | 1: 1 | 588 | 1: 1 |
@@ -580,7 +598,7 @@ Page({ | @@ -580,7 +598,7 @@ Page({ | ||
580 | is_collect: is_collect, | 598 | is_collect: is_collect, |
581 | collect_id: collect_id, | 599 | collect_id: collect_id, |
582 | categories3: categories3, | 600 | categories3: categories3, |
583 | - fir_quan: fir_quan, | 601 | + fir_quan: arr, |
584 | fir_comments: fir_com, | 602 | fir_comments: fir_com, |
585 | mapurl_f_img: mapurl_f_img, | 603 | mapurl_f_img: mapurl_f_img, |
586 | mapurl: mapurl, | 604 | mapurl: mapurl, |
@@ -2578,7 +2596,18 @@ Page({ | @@ -2578,7 +2596,18 @@ Page({ | ||
2578 | wx.hideLoading(); | 2596 | wx.hideLoading(); |
2579 | quan_list = res.data.data.pageData; | 2597 | quan_list = res.data.data.pageData; |
2580 | }) | 2598 | }) |
2581 | - | 2599 | + //过滤不是本商品的单品优惠券 |
2600 | + if (quan_list.length > 0) { | ||
2601 | + let goodInfo = th.data.data | ||
2602 | + for (let index = quan_list.length-1; index >= 0; index--) { | ||
2603 | + if (quan_list[index].useobjecttype==20) { //判断是单品优惠券 | ||
2604 | + if (quan_list[index].useobjectno != goodInfo.goods_sn) { | ||
2605 | + quan_list.splice(index,1) | ||
2606 | + } | ||
2607 | + } | ||
2608 | + } | ||
2609 | + } | ||
2610 | + //------------------------ | ||
2582 | if (quan_list) { | 2611 | if (quan_list) { |
2583 | for (var ind in quan_list) { | 2612 | for (var ind in quan_list) { |
2584 | var ep = quan_list[ind]; | 2613 | var ep = quan_list[ind]; |
packageD/pages/user/coupons/coupons.js
@@ -118,7 +118,7 @@ Page({ | @@ -118,7 +118,7 @@ Page({ | ||
118 | let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}` | 118 | let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}` |
119 | getApp().goto(url) | 119 | getApp().goto(url) |
120 | }else{ | 120 | }else{ |
121 | - getApp().showWarning("未找到该商品"); | 121 | + getApp().showWarning("该商品不存在"); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | } | 124 | } |
pages/cart/cart/cart.js
@@ -49,9 +49,9 @@ Page({ | @@ -49,9 +49,9 @@ Page({ | ||
49 | 49 | ||
50 | }, | 50 | }, |
51 | onLoad: function () { | 51 | onLoad: function () { |
52 | + | ||
52 | var a = this, | 53 | var a = this, |
53 | ee = a; | 54 | ee = a; |
54 | - | ||
55 | 55 | ||
56 | wx.setNavigationBarTitle({ | 56 | wx.setNavigationBarTitle({ |
57 | title: "购物车", | 57 | title: "购物车", |
@@ -268,53 +268,67 @@ Page({ | @@ -268,53 +268,67 @@ Page({ | ||
268 | }, | 268 | }, |
269 | //清空失效宝贝 | 269 | //清空失效宝贝 |
270 | delInva(obj=null){ | 270 | delInva(obj=null){ |
271 | - let ainvalid=''; | ||
272 | - let binvalid=''; | ||
273 | - var user_id = getApp().globalData.user_id; | ||
274 | - var th = this; | ||
275 | - let ab = 0; //选中 | ||
276 | - let abc = 0; // | ||
277 | - let arr = obj.id ? [obj] : this.data.invalidList | ||
278 | - console.log('失效-----') | ||
279 | - console.log(arr); | ||
280 | - arr.map(item=>{ | ||
281 | - if (item.classType ==0 ) { | ||
282 | - ainvalid+=item.id + ','; | ||
283 | - ab = 1; | ||
284 | - } | ||
285 | - if (item.classType ==1 ) { | ||
286 | - binvalid+=item.id + ','; | ||
287 | - abc = 1; | ||
288 | - } | ||
289 | - }); | 271 | + |
272 | + var th = this; | ||
273 | + wx.showModal({ | ||
274 | + title: '提示', | ||
275 | + content: '确认要清空全部失效商品吗?', | ||
276 | + success(res) { | ||
277 | + if (res.confirm) { | ||
278 | + let ainvalid=''; | ||
279 | + let binvalid=''; | ||
280 | + var user_id = getApp().globalData.user_id; | ||
281 | + | ||
282 | + let ab = 0; //选中 | ||
283 | + let abc = 0; // | ||
284 | + let arr = obj.id ? [obj] : th.data.invalidList | ||
285 | + console.log('失效-----') | ||
286 | + console.log(arr); | ||
287 | + arr.map(item=>{ | ||
288 | + if (item.classType ==0 ) { | ||
289 | + ainvalid+=item.id + ','; | ||
290 | + ab = 1; | ||
291 | + } | ||
292 | + if (item.classType ==1 ) { | ||
293 | + binvalid+=item.id + ','; | ||
294 | + abc = 1; | ||
295 | + } | ||
296 | + }); | ||
297 | + | ||
298 | + | ||
299 | + if (ab == 0 && abc == 0 ) { | ||
300 | + t.my_warnning('没有需要清空的失效宝贝', 0, th); | ||
301 | + return false; | ||
302 | + } | ||
303 | + if (ab) { | ||
304 | + ainvalid = ainvalid.substring(0, ainvalid.length - 1); | ||
305 | + //要删除购物车中的商品 | ||
306 | + var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + '/' + ainvalid; | ||
307 | + getApp().request.delete(url, { | ||
308 | + success: function (t) { | ||
309 | + th.getCardList(); | ||
310 | + getApp().requestCardNum(th); | ||
311 | + } | ||
312 | + }); | ||
313 | + } | ||
314 | + if (abc) { | ||
315 | + binvalid = binvalid.substring(0, binvalid.length - 1); | ||
316 | + //要删除购物车中的商品 | ||
317 | + var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + '/' + binvalid; | ||
318 | + getApp().request.delete(url, { | ||
319 | + success: function (t) { | ||
320 | + th.getCardList(); | ||
321 | + getApp().requestCardNum(th); | ||
322 | + } | ||
323 | + }); | ||
324 | + } | ||
325 | + | ||
326 | + } | ||
327 | + } | ||
328 | + }) | ||
329 | + | ||
290 | 330 | ||
291 | 331 | ||
292 | - if (ab == 0 && abc == 0 ) { | ||
293 | - t.my_warnning('没有需要清空的失效宝贝', 0, th); | ||
294 | - return false; | ||
295 | - } | ||
296 | - if (ab) { | ||
297 | - ainvalid = ainvalid.substring(0, ainvalid.length - 1); | ||
298 | - //要删除购物车中的商品 | ||
299 | - var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + '/' + ainvalid; | ||
300 | - getApp().request.delete(url, { | ||
301 | - success: function (t) { | ||
302 | - th.getCardList(); | ||
303 | - getApp().requestCardNum(th); | ||
304 | - } | ||
305 | - }); | ||
306 | - } | ||
307 | - if (abc) { | ||
308 | - binvalid = binvalid.substring(0, binvalid.length - 1); | ||
309 | - //要删除购物车中的商品 | ||
310 | - var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + '/' + binvalid; | ||
311 | - getApp().request.delete(url, { | ||
312 | - success: function (t) { | ||
313 | - th.getCardList(); | ||
314 | - getApp().requestCardNum(th); | ||
315 | - } | ||
316 | - }); | ||
317 | - } | ||
318 | }, | 332 | }, |
319 | 333 | ||
320 | //---------点击收藏------------ | 334 | //---------点击收藏------------ |
@@ -619,7 +633,7 @@ Page({ | @@ -619,7 +633,7 @@ Page({ | ||
619 | else if(item.prom_type ==2){ | 633 | else if(item.prom_type ==2){ |
620 | var prom = null; | 634 | var prom = null; |
621 | var now = ut.gettimestamp(); | 635 | var now = ut.gettimestamp(); |
622 | - await getApp().request.promiseGet('/api/weshop/goods/groupBuy/getActInfo/' + item.goods_id + '/' + user_id + '/' + item.prom_id, {}).then(res => { | 636 | + await getApp().request.promiseGet('/api/weshop/goods/groupBuy/getActInfo/'+ oo.stoid + '/' + item.goods_id + '/' + item.prom_id, {}).then(res => { |
623 | if (res.data.code == 0) { | 637 | if (res.data.code == 0) { |
624 | prom = res.data.data; | 638 | prom = res.data.data; |
625 | prom.price = prom.user_price; | 639 | prom.price = prom.user_price; |
@@ -666,26 +680,35 @@ Page({ | @@ -666,26 +680,35 @@ Page({ | ||
666 | if (!r_data.promGoodsLists) { | 680 | if (!r_data.promGoodsLists) { |
667 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | 681 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
668 | // getApp().request.delete(url, {}); | 682 | // getApp().request.delete(url, {}); |
669 | - th.disInvalid(item); | ||
670 | //商品已经无活动 | 683 | //商品已经无活动 |
671 | - isok = 0; | 684 | + // th.disInvalid(item); |
685 | + // isok = 0; | ||
686 | + item.prom_type = 0 | ||
687 | + //购物车更新 | ||
688 | + th.cartUpFn(item) | ||
672 | } else { | 689 | } else { |
673 | //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 | 690 | //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 |
674 | if (item.prom_id != r_data.promGoodsLists[0].prom_id) { | 691 | if (item.prom_id != r_data.promGoodsLists[0].prom_id) { |
675 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | 692 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
676 | // getApp().request.delete(url, {}); | 693 | // getApp().request.delete(url, {}); |
677 | - th.disInvalid(item); | ||
678 | //商品已经下架 | 694 | //商品已经下架 |
679 | - isok = 0; | 695 | + // th.disInvalid(item); |
696 | + // isok = 0; | ||
697 | + item.prom_type = 0 | ||
698 | + //购物车更新 | ||
699 | + th.cartUpFn(item) | ||
680 | } | 700 | } |
681 | } | 701 | } |
682 | 702 | ||
683 | } else { | 703 | } else { |
684 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | 704 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
685 | // getApp().request.delete(url, {}); | 705 | // getApp().request.delete(url, {}); |
686 | - th.disInvalid(item); | ||
687 | - //商品已经下架 | ||
688 | - isok = 0; | 706 | + // th.disInvalid(item); |
707 | + // //商品已经下架 | ||
708 | + // isok = 0; | ||
709 | + item.prom_type = 0 | ||
710 | + //购物车更新 | ||
711 | + th.cartUpFn(item) | ||
689 | } | 712 | } |
690 | }) | 713 | }) |
691 | 714 | ||
@@ -696,43 +719,51 @@ Page({ | @@ -696,43 +719,51 @@ Page({ | ||
696 | if (!r_data.promGoodsLists) { | 719 | if (!r_data.promGoodsLists) { |
697 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | 720 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
698 | // getApp().request.delete(url, {}); | 721 | // getApp().request.delete(url, {}); |
699 | - th.disInvalid(item); | ||
700 | - //商品已经无活动 | ||
701 | - isok = 0; | 722 | + // th.disInvalid(item); |
723 | + // //商品已经无活动 | ||
724 | + // isok = 0; | ||
725 | + item.prom_type = 0 | ||
726 | + //购物车更新 | ||
727 | + th.cartUpFn(item) | ||
702 | } else { | 728 | } else { |
703 | //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 | 729 | //如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了 |
704 | if (item.prom_id != r_data.promGoodsLists[0].prom_id) { | 730 | if (item.prom_id != r_data.promGoodsLists[0].prom_id) { |
705 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | 731 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
706 | // getApp().request.delete(url, {}); | 732 | // getApp().request.delete(url, {}); |
707 | - th.disInvalid(item); | ||
708 | - //商品已经下架 | ||
709 | - isok = 0; | 733 | + // th.disInvalid(item); |
734 | + // //商品已经下架 | ||
735 | + // isok = 0; | ||
736 | + item.prom_type = 0 | ||
737 | + //购物车更新 | ||
738 | + th.cartUpFn(item) | ||
710 | } | 739 | } |
711 | } | 740 | } |
712 | 741 | ||
713 | } else { | 742 | } else { |
714 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | 743 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
715 | // getApp().request.delete(url, {}); | 744 | // getApp().request.delete(url, {}); |
716 | - th.disInvalid(item,1); | ||
717 | - //商品已经下架 | ||
718 | - isok = 0; | 745 | + // th.disInvalid(item,1); |
746 | + // //商品已经下架 | ||
747 | + // isok = 0; | ||
748 | + item.prom_type = 0 | ||
749 | + //购物车更新 | ||
750 | + th.cartUpFn(item) | ||
719 | } | 751 | } |
720 | }) | 752 | }) |
721 | - | ||
722 | } | 753 | } |
723 | - | ||
724 | - if (!isok) continue; | 754 | + // if (!isok) continue; |
725 | } | 755 | } |
726 | else if (item.prom_type == 7) { | 756 | else if (item.prom_type == 7) { |
757 | + console.log('组合购------------'); | ||
727 | if(!th.data.zuhe_map[item.prom_id]){ | 758 | if(!th.data.zuhe_map[item.prom_id]){ |
728 | - | 759 | + console.log('组1') |
729 | //如果有组合购 | 760 | //如果有组合购 |
730 | var isok = 1; | 761 | var isok = 1; |
731 | var is_flag = 1; | 762 | var is_flag = 1; |
732 | var act = null; | 763 | var act = null; |
733 | var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.user_id; | 764 | var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.user_id; |
734 | await getApp().request.promiseGet(url, {}).then(res => { | 765 | await getApp().request.promiseGet(url, {}).then(res => { |
735 | - console.log(res, 1000); | 766 | + console.log(res); |
736 | if (res.data.code == 0 && res.data.data) { | 767 | if (res.data.code == 0 && res.data.data) { |
737 | if (res.data.data.is_show != 1) { | 768 | if (res.data.data.is_show != 1) { |
738 | isok = 0; | 769 | isok = 0; |
@@ -759,38 +790,44 @@ Page({ | @@ -759,38 +790,44 @@ Page({ | ||
759 | if (!isok) { | 790 | if (!isok) { |
760 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | 791 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
761 | // getApp().request.delete(url, {}); | 792 | // getApp().request.delete(url, {}); |
762 | - th.disInvalid(item); | ||
763 | - th.data.zuhe_map[item.prom_id] = -1; | ||
764 | - continue; | ||
765 | - } | ||
766 | - th.data.zuhe_map[item.prom_id] = act; | ||
767 | - var url1 = "/api/weshop/prom/zhbuyGoods/page"; | ||
768 | - var req_data = { | ||
769 | - page: 1, | ||
770 | - pageSize: 2000, | ||
771 | - store_id: os.stoid, | ||
772 | - zh_id: item.prom_id, | 793 | + //组合购失效不处理 |
794 | + // th.disInvalid(item); | ||
795 | + // th.data.zuhe_map[item.prom_id] = -1; | ||
796 | + // continue; | ||
797 | + item.prom_type = 0 | ||
798 | + //购物车更新 | ||
799 | + th.cartUpFn(item) | ||
800 | + }else{ | ||
801 | + th.data.zuhe_map[item.prom_id] = act; | ||
802 | + var url1 = "/api/weshop/prom/zhbuyGoods/page"; | ||
803 | + var req_data = { | ||
804 | + page: 1, | ||
805 | + pageSize: 2000, | ||
806 | + store_id: os.stoid, | ||
807 | + zh_id: item.prom_id, | ||
808 | + } | ||
809 | + await getApp().request.promiseGet(url1, { | ||
810 | + data: req_data | ||
811 | + }).then(res => { | ||
812 | + console.log(res, 2000); | ||
813 | + if (ut.ajax_ok(res)) { | ||
814 | + var gdlist = res.data.data.pageData; | ||
815 | + gdlist.forEach(i => { | ||
816 | + if (item.goods_id == i.goods_id && !is_flag) { | ||
817 | + item.prom_type = 0; | ||
818 | + item.prom_type1 = 0; | ||
819 | + item.prom_id = 0; | ||
820 | + item.prom_id1 = 0 | ||
821 | + } | ||
822 | + }) | ||
823 | + th.data.zuhe_map_good[item.prom_id] = gdlist; | ||
824 | + } | ||
825 | + }) | ||
773 | } | 826 | } |
774 | - await getApp().request.promiseGet(url1, { | ||
775 | - data: req_data | ||
776 | - }).then(res => { | ||
777 | - console.log(res, 2000); | ||
778 | - if (ut.ajax_ok(res)) { | ||
779 | - var gdlist = res.data.data.pageData; | ||
780 | - gdlist.forEach(i => { | ||
781 | - if (item.goods_id == i.goods_id && !is_flag) { | ||
782 | - item.prom_type = 0; | ||
783 | - item.prom_type1 = 0; | ||
784 | - item.prom_id = 0; | ||
785 | - item.prom_id1 = 0 | ||
786 | - } | ||
787 | - }) | ||
788 | - th.data.zuhe_map_good[item.prom_id] = gdlist; | ||
789 | - } | ||
790 | - }) | ||
791 | } | 827 | } |
792 | - | 828 | + console.log('组2') |
793 | if (th.data.zuhe_map[item.prom_id] && th.data.zuhe_map[item.prom_id] != -1) { | 829 | if (th.data.zuhe_map[item.prom_id] && th.data.zuhe_map[item.prom_id] != -1) { |
830 | + console.log('组3') | ||
794 | var gdlist = th.data.zuhe_map_good[item.prom_id]; | 831 | var gdlist = th.data.zuhe_map_good[item.prom_id]; |
795 | var t_item = gdlist.find(function (ele) { | 832 | var t_item = gdlist.find(function (ele) { |
796 | return ele.goods_id == item.goods_id | 833 | return ele.goods_id == item.goods_id |
@@ -798,13 +835,18 @@ Page({ | @@ -798,13 +835,18 @@ Page({ | ||
798 | if (!t_item) { | 835 | if (!t_item) { |
799 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | 836 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
800 | // getApp().request.delete(url, {}); | 837 | // getApp().request.delete(url, {}); |
801 | - th.disInvalid(item,1); | ||
802 | - th.data.zuhe_map[item.prom_id] = -1; | ||
803 | - continue; | ||
804 | - } | ||
805 | - item.buyqty = t_item.buyqty; | ||
806 | - item.zh_b_num = promgoodsbuynum; | ||
807 | - item.act = th.data.zuhe_map[item.prom_id]; | 838 | + //组合购不处理 |
839 | + // th.disInvalid(item,1); | ||
840 | + // th.data.zuhe_map[item.prom_id] = -1; | ||
841 | + // continue; | ||
842 | + item.prom_type = 0 | ||
843 | + //购物车更新 | ||
844 | + th.cartUpFn(item) | ||
845 | + }else{ | ||
846 | + item.buyqty = t_item.buyqty; | ||
847 | + item.zh_b_num = promgoodsbuynum; | ||
848 | + item.act = th.data.zuhe_map[item.prom_id]; | ||
849 | + } | ||
808 | } //else{ | 850 | } //else{ |
809 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | 851 | // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; |
810 | // getApp().request.delete(url, {}); | 852 | // getApp().request.delete(url, {}); |
@@ -1082,7 +1124,19 @@ Page({ | @@ -1082,7 +1124,19 @@ Page({ | ||
1082 | } | 1124 | } |
1083 | }); | 1125 | }); |
1084 | }, | 1126 | }, |
1085 | - | 1127 | + //商品购物车修改 |
1128 | + cartUpFn(item){ | ||
1129 | + let updata1 = { | ||
1130 | + id: item.id, | ||
1131 | + prom_type: 0, | ||
1132 | + prom_id:item.prom_id, | ||
1133 | + store_id: os.stoid, | ||
1134 | + user_id: getApp().globalData.userInfo.user_id | ||
1135 | + }; | ||
1136 | + getApp().request.put("/api/weshop/cart/update", { | ||
1137 | + data: updata1, | ||
1138 | + }) | ||
1139 | + }, | ||
1086 | //-----真的获取购物车-------- | 1140 | //-----真的获取购物车-------- |
1087 | get_ser_cart: function () { | 1141 | get_ser_cart: function () { |
1088 | var th = this; | 1142 | var th = this; |
@@ -3202,6 +3256,21 @@ Page({ | @@ -3202,6 +3256,21 @@ Page({ | ||
3202 | }); | 3256 | }); |
3203 | } | 3257 | } |
3204 | 3258 | ||
3259 | + setTimeout(()=>{ | ||
3260 | + if ((!th.data.requestData|| th.data.requestData.length==0) && (!th.data.service_data|| th.data.service_data.length==0)){ | ||
3261 | + | ||
3262 | + console.log('---1111---bb'); | ||
3263 | + var goods_list = th.selectComponent("#goods_list"); //组件的id | ||
3264 | + if (goods_list) { | ||
3265 | + goods_list.init(); | ||
3266 | + goods_list.get_list(); | ||
3267 | + } | ||
3268 | + | ||
3269 | + } | ||
3270 | + | ||
3271 | + },1200) | ||
3272 | + | ||
3273 | + | ||
3205 | }, | 3274 | }, |
3206 | //跳到首页 | 3275 | //跳到首页 |
3207 | goto: function (e) { | 3276 | goto: function (e) { |
pages/cart/cart/cart.wxml
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | </block> | 23 | </block> |
24 | 24 | ||
25 | 25 | ||
26 | -<view class="container" wx:if="{{(requestData && requestData.length>0) || (service_data && service_data.length>0) }}"> | 26 | +<view class="container {{(requestData && requestData.length>0) || (service_data && service_data.length>0)?'margin_b':''}} " wx:if="{{(requestData && requestData.length>0) || (service_data && service_data.length>0) || invalidList && invalidList.length }}"> |
27 | <!-- 购物车商品框架 --> | 27 | <!-- 购物车商品框架 --> |
28 | <view class="login-in"> | 28 | <view class="login-in"> |
29 | <!-- 编辑 --> | 29 | <!-- 编辑 --> |
@@ -276,7 +276,7 @@ | @@ -276,7 +276,7 @@ | ||
276 | </block> | 276 | </block> |
277 | 277 | ||
278 | </view> | 278 | </view> |
279 | - <view class="pay-for flex-vertical-between"> | 279 | + <view class="pay-for flex-vertical-between" wx:if="{{(requestData && requestData.length>0) || (service_data && service_data.length>0)}}" > |
280 | <view class="allradio flex-vertical-between"> | 280 | <view class="allradio flex-vertical-between"> |
281 | <view class="flex-vertical mlr" bindtap="checkAll"> | 281 | <view class="flex-vertical mlr" bindtap="checkAll"> |
282 | <!--<radio class="order-raido" color="red" checked="{{checkAllToggle}}"></radio>--> | 282 | <!--<radio class="order-raido" color="red" checked="{{checkAllToggle}}"></radio>--> |
@@ -306,7 +306,7 @@ | @@ -306,7 +306,7 @@ | ||
306 | </view> | 306 | </view> |
307 | 307 | ||
308 | <!-- 购物车为空 --> | 308 | <!-- 购物车为空 --> |
309 | -<view class="empty_order" wx:if="{{(!requestData|| requestData.length==0) && (!service_data|| service_data.length==0) && is_load}}"> | 309 | +<view class="empty_order" wx:if="{{(!requestData|| requestData.length==0) && (!service_data|| service_data.length==0) && (!invalidList || invalidList.length==0) && is_load}}"> |
310 | <view class="flex-level"> | 310 | <view class="flex-level"> |
311 | <image src="{{iurl}}miniapp/images/stores/nocart.png"></image> | 311 | <image src="{{iurl}}miniapp/images/stores/nocart.png"></image> |
312 | </view> | 312 | </view> |
pages/cart/cart/cart.wxss
@@ -30,6 +30,9 @@ page { | @@ -30,6 +30,9 @@ page { | ||
30 | align-items: center; | 30 | align-items: center; |
31 | justify-content: center; | 31 | justify-content: center; |
32 | background-color: rgb(255, 255, 255); | 32 | background-color: rgb(255, 255, 255); |
33 | + /*margin-bottom: 160rpx;*/ | ||
34 | +} | ||
35 | +.container.margin_b{ | ||
33 | margin-bottom: 160rpx; | 36 | margin-bottom: 160rpx; |
34 | } | 37 | } |
35 | 38 |
pages/goods/goodsInfo/goodsInfo.js
@@ -417,6 +417,7 @@ Page({ | @@ -417,6 +417,7 @@ Page({ | ||
417 | is_show_gb: 1 | 417 | is_show_gb: 1 |
418 | }); | 418 | }); |
419 | } | 419 | } |
420 | + console.log('获取系统参数'); | ||
420 | console.log(e); | 421 | console.log(e); |
421 | var json_d = JSON.parse(e.switch_list); | 422 | var json_d = JSON.parse(e.switch_list); |
422 | ee.setData({ | 423 | ee.setData({ |
@@ -740,15 +741,33 @@ Page({ | @@ -740,15 +741,33 @@ Page({ | ||
740 | data: { | 741 | data: { |
741 | store_id: os.stoid, | 742 | store_id: os.stoid, |
742 | type: 1, | 743 | type: 1, |
743 | - pageSize: 3, | 744 | + pageSize: 100, |
744 | page: 1, | 745 | page: 1, |
745 | is_share: 0, | 746 | is_share: 0, |
746 | }, | 747 | }, |
747 | }).then(res1 => { | 748 | }).then(res1 => { |
749 | + | ||
748 | fir_quan = res1.data.data.pageData; | 750 | fir_quan = res1.data.data.pageData; |
749 | }) | 751 | }) |
750 | } | 752 | } |
751 | - | 753 | + //过滤不是本商品的单品优惠券------------------- |
754 | + if(fir_quan.length > 0 ){ | ||
755 | + let goodInfo = ee.data.data | ||
756 | + for (let index = fir_quan.length-1; index >= 0; index--) { | ||
757 | + if (fir_quan[index].useobjecttype==20) { //判断是单品优惠券 | ||
758 | + if (fir_quan[index].useobjectno != goodInfo.goods_sn) { | ||
759 | + fir_quan.splice(index,1) | ||
760 | + } | ||
761 | + } | ||
762 | + } | ||
763 | + } | ||
764 | + let arr=[] | ||
765 | + let length = fir_quan.length | ||
766 | + if (length <= 3) { | ||
767 | + arr=fir_quan | ||
768 | + }else{ | ||
769 | + arr=fir_quan.splice(0,3); | ||
770 | + } | ||
752 | //--------获取视频图片--------- | 771 | //--------获取视频图片--------- |
753 | await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, { | 772 | await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, { |
754 | 1: 1 | 773 | 1: 1 |
@@ -764,7 +783,7 @@ Page({ | @@ -764,7 +783,7 @@ Page({ | ||
764 | is_collect: is_collect, | 783 | is_collect: is_collect, |
765 | collect_id: collect_id, | 784 | collect_id: collect_id, |
766 | categories3: categories3, | 785 | categories3: categories3, |
767 | - fir_quan: fir_quan, | 786 | + fir_quan: arr, |
768 | fir_comments: fir_com, | 787 | fir_comments: fir_com, |
769 | mapurl_f_img: mapurl_f_img, | 788 | mapurl_f_img: mapurl_f_img, |
770 | mapurl: mapurl, | 789 | mapurl: mapurl, |
@@ -1844,6 +1863,7 @@ Page({ | @@ -1844,6 +1863,7 @@ Page({ | ||
1844 | goods_price: newd.goods_price, | 1863 | goods_price: newd.goods_price, |
1845 | member_goods_price: newd.goods_price, | 1864 | member_goods_price: newd.goods_price, |
1846 | store_id: th.data.stoid, | 1865 | store_id: th.data.stoid, |
1866 | + prom_id:newd.prom_id //把活动id带上去(用于购物车失效变成有效商品) | ||
1847 | }; | 1867 | }; |
1848 | 1868 | ||
1849 | //---是不是从收藏夹出来的--- | 1869 | //---是不是从收藏夹出来的--- |
@@ -1856,6 +1876,7 @@ Page({ | @@ -1856,6 +1876,7 @@ Page({ | ||
1856 | updata['guide_type'] = 0; | 1876 | updata['guide_type'] = 0; |
1857 | } | 1877 | } |
1858 | } | 1878 | } |
1879 | + | ||
1859 | 1880 | ||
1860 | i.put("/api/weshop/cart/update", { | 1881 | i.put("/api/weshop/cart/update", { |
1861 | data: updata, | 1882 | data: updata, |
@@ -2271,7 +2292,7 @@ Page({ | @@ -2271,7 +2292,7 @@ Page({ | ||
2271 | sort_store: 0, | 2292 | sort_store: 0, |
2272 | open_ind_store: open_store, | 2293 | open_ind_store: open_store, |
2273 | }) | 2294 | }) |
2274 | - //--先判断会员状态-- | 2295 | + //--先判断会员状态-- |
2275 | var user_info = getApp().globalData.userInfo; | 2296 | var user_info = getApp().globalData.userInfo; |
2276 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 2297 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
2277 | wx.navigateTo({ | 2298 | wx.navigateTo({ |
@@ -2924,7 +2945,8 @@ Page({ | @@ -2924,7 +2945,8 @@ Page({ | ||
2924 | } | 2945 | } |
2925 | }) | 2946 | }) |
2926 | } | 2947 | } |
2927 | - | 2948 | + console.log('活动详情------------'); |
2949 | + console.log(prom); | ||
2928 | //----------如果有活动,并且在进行中,就不计算线下库存--------------- | 2950 | //----------如果有活动,并且在进行中,就不计算线下库存--------------- |
2929 | var now = ut.gettimestamp(); | 2951 | var now = ut.gettimestamp(); |
2930 | if (prom) { | 2952 | if (prom) { |
@@ -3587,7 +3609,7 @@ Page({ | @@ -3587,7 +3609,7 @@ Page({ | ||
3587 | prom_end_time: prom_end_time, | 3609 | prom_end_time: prom_end_time, |
3588 | prom_start_time: prom_start_time, | 3610 | prom_start_time: prom_start_time, |
3589 | isshow: 1, | 3611 | isshow: 1, |
3590 | - prom_act: t.data.data | 3612 | + // prom_act: t.data.data |
3591 | }); | 3613 | }); |
3592 | 3614 | ||
3593 | ee.get_sto(); | 3615 | ee.get_sto(); |
@@ -4768,7 +4790,18 @@ Page({ | @@ -4768,7 +4790,18 @@ Page({ | ||
4768 | wx.hideLoading(); | 4790 | wx.hideLoading(); |
4769 | quan_list = res.data.data.pageData; | 4791 | quan_list = res.data.data.pageData; |
4770 | }) | 4792 | }) |
4771 | - | 4793 | + //过滤不是本商品的单品优惠券 |
4794 | + if (quan_list.length > 0) { | ||
4795 | + let goodInfo = th.data.data | ||
4796 | + for (let index = quan_list.length-1; index >= 0; index--) { | ||
4797 | + if (quan_list[index].useobjecttype==20) { //判断是单品优惠券 | ||
4798 | + if (quan_list[index].useobjectno != goodInfo.goods_sn) { | ||
4799 | + quan_list.splice(index,1) | ||
4800 | + } | ||
4801 | + } | ||
4802 | + } | ||
4803 | + } | ||
4804 | + //------------------------ | ||
4772 | if (quan_list) { | 4805 | if (quan_list) { |
4773 | for (var ind in quan_list) { | 4806 | for (var ind in quan_list) { |
4774 | var ep = quan_list[ind]; | 4807 | var ep = quan_list[ind]; |
@@ -4997,11 +5030,15 @@ Page({ | @@ -4997,11 +5030,15 @@ Page({ | ||
4997 | if (this.data.card_field && this.data.data[this.data.card_field]) { | 5030 | if (this.data.card_field && this.data.data[this.data.card_field]) { |
4998 | price = this.data.data[this.data.card_field]; | 5031 | price = this.data.data[this.data.card_field]; |
4999 | } | 5032 | } |
5000 | - if (this.data.prom_act) price = this.data.prom_price; | 5033 | + if (this.data.prom_act) price = this.data.prom_price; |
5001 | price = parseFloat(price).toFixed(2); | 5034 | price = parseFloat(price).toFixed(2); |
5002 | context.setFontSize(32 * unit); | 5035 | context.setFontSize(32 * unit); |
5003 | - context.setFillStyle('#DE1117'); | ||
5004 | - context.fillText('¥' + price, 54 * unit, 735 * unit); | 5036 | + context.setFillStyle('#DE1117'); |
5037 | + if (this.data.prom_type == 4 && this.data.prom_integral){ | ||
5038 | + context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit); | ||
5039 | + }else{ | ||
5040 | + context.fillText('¥' + price, 54 * unit, 735 * unit); | ||
5041 | + } | ||
5005 | 5042 | ||
5006 | 5043 | ||
5007 | }; | 5044 | }; |
@@ -5192,6 +5229,11 @@ Page({ | @@ -5192,6 +5229,11 @@ Page({ | ||
5192 | var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; | 5229 | var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; |
5193 | context.fillText("¥", wd1 - 15, 185 * unit); | 5230 | context.fillText("¥", wd1 - 15, 185 * unit); |
5194 | context.setFontSize(31 * unit) | 5231 | context.setFontSize(31 * unit) |
5232 | + // if(th.data.prom_type==4){ | ||
5233 | + // context.fillText(th.data.prom_integral+'积分'+pri0, wd1, 185 * unit); | ||
5234 | + // }else{ | ||
5235 | + // context.fillText(pri0, wd1, 185 * unit); | ||
5236 | + // } | ||
5195 | context.fillText(pri0, wd1, 185 * unit); | 5237 | context.fillText(pri0, wd1, 185 * unit); |
5196 | 5238 | ||
5197 | //---市场价划掉--- | 5239 | //---市场价划掉--- |
pages/goods/goodsInfo/goodsInfo.wxml
@@ -169,7 +169,7 @@ | @@ -169,7 +169,7 @@ | ||
169 | {{djs.min}} | 169 | {{djs.min}} |
170 | </view> | 170 | </view> |
171 | <view class="xc-time" style="color: {{prom_st==1?'#d40022':'#0097e0'}}">分</view> | 171 | <view class="xc-time" style="color: {{prom_st==1?'#d40022':'#0097e0'}}">分</view> |
172 | - <view class='xc-time-val white t-c' style=";background:{{prom_st==1?'#d40022':'#0097e0'}}"> | 172 | + <view class='xc-time-val white t-c' style="background:{{prom_st==1?'#d40022':'#0097e0'}}"> |
173 | {{djs.sec}} | 173 | {{djs.sec}} |
174 | </view> | 174 | </view> |
175 | <view class="xc-time" style="color: {{prom_st==1?'#d40022':'#0097e0'}}">秒</view> | 175 | <view class="xc-time" style="color: {{prom_st==1?'#d40022':'#0097e0'}}">秒</view> |
@@ -264,7 +264,7 @@ | @@ -264,7 +264,7 @@ | ||
264 | ¥{{filters.toFix(data.shop_price,2)}} | 264 | ¥{{filters.toFix(data.shop_price,2)}} |
265 | </text> | 265 | </text> |
266 | </view> | 266 | </view> |
267 | - <!-- 这个是分享按钮 --> | 267 | + <!-- 这个是分享按钮 --> |
268 | <!-- <view class="xc-share-frame {{prom_type==1?'s_ms_bth':''}} t-c" bindtap="saveImageToPhotosAlbum"> --> | 268 | <!-- <view class="xc-share-frame {{prom_type==1?'s_ms_bth':''}} t-c" bindtap="saveImageToPhotosAlbum"> --> |
269 | <view class="xc-share-frame t-c shrink0" bindtap="clickShare"> | 269 | <view class="xc-share-frame t-c shrink0" bindtap="clickShare"> |
270 | <!-- <image class="share-frame" src="{{iurl}}/miniapp/images/share.png"></image> --> | 270 | <!-- <image class="share-frame" src="{{iurl}}/miniapp/images/share.png"></image> --> |
@@ -604,7 +604,7 @@ | @@ -604,7 +604,7 @@ | ||
604 | </block> | 604 | </block> |
605 | </block> | 605 | </block> |
606 | <!-- 许程 7.24暂时注释 --> | 606 | <!-- 许程 7.24暂时注释 --> |
607 | - <view class="bdt16" wx:if="{{prom_type!=1&& prom_type!=1 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1 && sele_g.is_xz_yh !=1}}"> | 607 | + <view class="bdt16" wx:if="{{ prom_type!=1 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1 && sele_g.is_xz_yh !=1}}"> |
608 | <view class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}"> | 608 | <view class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}"> |
609 | <view class="cx-sizs fs30">领券</view> | 609 | <view class="cx-sizs fs30">领券</view> |
610 | <view class="flex ai_c f1 pdh20"> | 610 | <view class="flex ai_c f1 pdh20"> |