Commit eb828a870af678c18cc443d1e0d8aec68c43519f
Merge branch 'test' into 'qa'
Test See merge request !997
Showing
104 changed files
with
4415 additions
and
2821 deletions
Too many changes.
To preserve performance only 100 of 104 files are displayed.
app.js
... | ... | @@ -51,7 +51,7 @@ App({ |
51 | 51 | config: null, //门店参数 |
52 | 52 | config2: null, //门店配置 |
53 | 53 | code: null, |
54 | - user_id: null,//5682094,6520044,6520119 qa 4687 6519901 | |
54 | + user_id:null,//5682094,6520044,6520119 qa 4687 6519901 zs 10153869 | |
55 | 55 | buy_now: null, |
56 | 56 | picklist: null, //门店列表 |
57 | 57 | wuliuprice: null, //物流价格表 |
... | ... | @@ -61,7 +61,6 @@ App({ |
61 | 61 | getu: null, //记录会员信息 |
62 | 62 | sessionKey: null,//记录会员信息 |
63 | 63 | openid: null, //记录会员信息 |
64 | - | |
65 | 64 | to_group: null, //参团传递的数据 |
66 | 65 | wxapp_buy_obj: null, //微信小程序购买的Object |
67 | 66 | pk_store: null, //选择的门店 |
... | ... | @@ -74,15 +73,17 @@ App({ |
74 | 73 | }, |
75 | 74 | auth: o, |
76 | 75 | request: a, |
77 | - onLaunch: function () { | |
76 | + onLaunch: function (option) { | |
78 | 77 | //初始化美图测肤插件 |
79 | 78 | // var plugin = requirePlugin('mtSkinSdk'); |
80 | 79 | // params.login_id = wx.getStorageSync('login_id') || '' // 可将登录id缓存下来,方便下次进入小程序直接获取 |
81 | 80 | // plugin.setConfig(pluginGD) |
82 | - | |
81 | + if(option) this.globalData.scene=option.scene; | |
83 | 82 | wx.hideTabBar(); |
84 | 83 | this.initExt(); |
85 | 84 | |
85 | + | |
86 | + | |
86 | 87 | //检查更新 |
87 | 88 | this.checkUpdateVersion(); |
88 | 89 | |
... | ... | @@ -363,7 +364,7 @@ App({ |
363 | 364 | title: t, |
364 | 365 | mask: e, |
365 | 366 | duration: a, |
366 | - icon: 'error', | |
367 | + icon: 'error', | |
367 | 368 | // image: "/images/gt.png", |
368 | 369 | complete: function () { |
369 | 370 | "function" == typeof o && setTimeout(o, a); |
... | ... | @@ -430,12 +431,12 @@ App({ |
430 | 431 | }) |
431 | 432 | }, |
432 | 433 | //获取场景值 判断是否是单页面 |
433 | - is_Single_page(_this,func) { | |
434 | - let scene = wx.getLaunchOptionsSync().scene; | |
434 | + is_Single_page(_this, func) { | |
435 | + let scene = wx.getLaunchOptionsSync().scene; | |
435 | 436 | //--判断是否是单页面-- |
436 | - if(scene !== 1154){ | |
437 | - typeof func =="function" && func.bind(_this)(); | |
438 | - }else{ | |
437 | + if (scene !== 1154) { | |
438 | + typeof func == "function" && func.bind(_this)(); | |
439 | + } else { | |
439 | 440 | return false; |
440 | 441 | } |
441 | 442 | // return scene == 1154? false:true; |
... | ... | @@ -672,11 +673,11 @@ App({ |
672 | 673 | |
673 | 674 | //清空登录时候缓存的值 |
674 | 675 | onHide: function () { |
675 | - var th=this; | |
676 | + var th = this; | |
676 | 677 | setTimeout(function () { |
677 | 678 | console.log("app onhide"); |
678 | 679 | console.log(th.globalData.no_clear); |
679 | - if(!th.globalData.no_clear) { | |
680 | + if (!th.globalData.no_clear) { | |
680 | 681 | th.globalData.is_test = 0; |
681 | 682 | th.globalData.guide_id = null; //导购清空 |
682 | 683 | th.globalData.first_leader = null; //分享的会员清空 |
... | ... | @@ -691,10 +692,11 @@ App({ |
691 | 692 | th.globalData.dis_buy_obj = null; //等级卡的购买记录 |
692 | 693 | th.globalData.storeFooter = null; //底部的导航 |
693 | 694 | th.globalData.full_screen = null; //全屏 |
694 | - }else{ | |
695 | - th.globalData.no_clear=0; | |
695 | + th.globalData.scene=null | |
696 | + } else { | |
697 | + th.globalData.no_clear = 0; | |
696 | 698 | } |
697 | - },600) | |
699 | + }, 600) | |
698 | 700 | |
699 | 701 | }, |
700 | 702 | |
... | ... | @@ -803,7 +805,7 @@ App({ |
803 | 805 | if (wx.canIUse('getUpdateManager')) { |
804 | 806 | //创建 UpdateManager 实例 |
805 | 807 | const updateManager = wx.getUpdateManager(); |
806 | - if(!updateManager) { | |
808 | + if (!updateManager) { | |
807 | 809 | return false; |
808 | 810 | } |
809 | 811 | //检测版本更新 |
... | ... | @@ -836,33 +838,35 @@ App({ |
836 | 838 | }, |
837 | 839 | |
838 | 840 | //重复函数,统一调用, |
839 | - pre_img(path){ | |
840 | - this.globalData.no_clear=1; | |
841 | + pre_img(path) { | |
842 | + this.globalData.no_clear = 1; | |
841 | 843 | wx.previewImage({ |
842 | 844 | //将图片预览出来 |
843 | 845 | urls: [path] |
844 | 846 | }); |
845 | 847 | }, |
846 | 848 | //b是数组,t是wxml元素返回的 |
847 | - pre_img2(b,t){ | |
848 | - this.globalData.no_clear=1; | |
849 | + pre_img2(b, t) { | |
850 | + this.globalData.no_clear = 1; | |
849 | 851 | wx.previewImage({ |
850 | 852 | current: b[t.currentTarget.dataset.id], |
851 | 853 | urls: b |
852 | 854 | }); |
853 | 855 | }, |
854 | 856 | |
857 | + | |
858 | + | |
859 | + //联系客服的3个函数 | |
855 | 860 | con_wx(th){ |
856 | 861 | var url=th.data.sys_switch.weapp_customertype_url; |
857 | 862 | var id=th.data.sys_switch.weapp_customertype_appid; |
858 | 863 | this.globalData.no_clear=1; |
859 | 864 | wx.openCustomerServiceChat({ |
860 | - extInfo: {url: url}, | |
865 | + extInfo: { url: url }, | |
861 | 866 | corpId: id, |
862 | - success(res) {} | |
867 | + success(res) { } | |
863 | 868 | }) |
864 | 869 | }, |
865 | - | |
866 | 870 | con_Service(){ |
867 | 871 | var th=this; |
868 | 872 | var oss= this.globalData.setting; |
... | ... | @@ -871,7 +875,7 @@ App({ |
871 | 875 | th.request.get("/api/weshop/store/get/" + oss.stoid, { |
872 | 876 | isShowLoading: 1, |
873 | 877 | data: {}, |
874 | - success: function(rs) { | |
878 | + success: function (rs) { | |
875 | 879 | th.globalData.config = rs.data.data; |
876 | 880 | if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { |
877 | 881 | wx.showToast({ |
... | ... | @@ -881,46 +885,85 @@ App({ |
881 | 885 | }) |
882 | 886 | return false; |
883 | 887 | } |
884 | - th.globalData.no_clear=1; | |
888 | + th.globalData.no_clear = 1; | |
885 | 889 | wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, }) |
886 | 890 | } |
887 | 891 | }) |
888 | 892 | } else { |
889 | - th.globalData.no_clear=1; | |
893 | + th.globalData.no_clear = 1; | |
890 | 894 | wx.makePhoneCall({ phoneNumber: t.store_tel, }) |
891 | 895 | } |
892 | 896 | }); |
893 | 897 | }, |
894 | - | |
895 | - com_call(self) { | |
896 | - self.getTel() | |
897 | - .then(() => { | |
898 | - if(self.data.store_tel) { | |
899 | - wx.showModal({ | |
900 | - title: '联系客服', | |
901 | - content: '客服热线:' + self.data.store_tel, | |
902 | - confirmText: '拨打', | |
903 | - success(res) { | |
904 | - if(res.confirm) { | |
905 | - getApp().globalData.no_clear = 1; | |
906 | - wx.makePhoneCall({ | |
907 | - phoneNumber: self.data.store_tel, | |
908 | - }) | |
909 | - }; | |
910 | - }, | |
911 | - }); | |
912 | - }; | |
913 | - }); | |
914 | - }, | |
898 | + | |
899 | + user_tools_endTime(type) { | |
900 | + //调用接口判断商家工具有没有过期 | |
901 | + return this.request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=" + type + "", {}).then(res => { | |
902 | + if (res.data.code == 0) { | |
903 | + var arr = res.data.data.pageData; | |
904 | + if (arr.length > 0) { | |
905 | + var item = arr[0]; | |
906 | + if (item.is_sy == 0) { | |
907 | + var now = Date.parse(new Date()); now = now / 1000; | |
908 | + if (item.end_time < now) { | |
909 | + return 0 | |
910 | + } | |
911 | + return 1; | |
912 | + } | |
913 | + } | |
914 | + } | |
915 | + }) | |
916 | + }, | |
917 | + | |
918 | + com_call(self) { | |
919 | + self.getTel() | |
920 | + .then(() => { | |
921 | + if (self.data.store_tel) { | |
922 | + wx.showModal({ | |
923 | + title: '联系客服', | |
924 | + content: '客服热线:' + self.data.store_tel, | |
925 | + confirmText: '拨打', | |
926 | + success(res) { | |
927 | + if (res.confirm) { | |
928 | + getApp().globalData.no_clear = 1; | |
929 | + wx.makePhoneCall({ | |
930 | + phoneNumber: self.data.store_tel, | |
931 | + }) | |
932 | + }; | |
933 | + }, | |
934 | + }); | |
935 | + }; | |
936 | + }); | |
937 | + }, | |
915 | 938 | |
916 | 939 | //检验能不能分享 |
917 | - check_can_share(){ | |
918 | - if(!this.globalData.user_id) wx.hideShareMenu(); | |
919 | - else wx.showShareMenu(); | |
940 | + check_can_share() { | |
941 | + if (!this.globalData.user_id) wx.hideShareMenu(); | |
942 | + else wx.showShareMenu(); | |
943 | + }, | |
944 | + | |
945 | + //--- 判断是不是皮肤的商品的公共函数 --- | |
946 | + check_skin_face(options,type,goods_id){ | |
947 | + if(options.skinface_id){ | |
948 | + this.globalData.skinface_id=options.skinface_id; | |
949 | + var stoid=this.globalData.setting.stoid; | |
950 | + var user_id=this.globalData.user_id; | |
951 | + if(!user_id) return false; | |
952 | + //点击量的 | |
953 | + this.request.promisePost("/api/weshop/face/skinGoodsBrowse/save",{ | |
954 | + data:{ | |
955 | + store_id:stoid, | |
956 | + goods_id:goods_id, | |
957 | + user_id:user_id, | |
958 | + addtime:ut.gettimestamp(), | |
959 | + skinface_id:options.skinface_id, | |
960 | + goods_type:type | |
961 | + } | |
962 | + }).then(res=>{}) | |
963 | + } | |
920 | 964 | } |
921 | 965 | |
922 | 966 | |
923 | - | |
924 | 967 | |
925 | 968 | |
926 | 969 | }); | ... | ... |
app.json
... | ... | @@ -31,16 +31,9 @@ |
31 | 31 | "pages/team/team_ping/team_ping", |
32 | 32 | "pages/cart/cart2_pt/cart2_pt", |
33 | 33 | "pages/cart/cart_wk/cart_wk", |
34 | - "pages/user/member/menber", | |
35 | - "pages/user/member/bring/bring", | |
36 | - "pages/user/member/bring/msg/msg", | |
37 | - "pages/user/member/account/account", | |
38 | - "pages/user/member/account_unable/account_unable", | |
39 | - "pages/user/member/cash_record/cash_record", | |
40 | - "pages/user/coupons/coupons", | |
41 | - "pages/user/integral/integral", | |
42 | - "pages/user/integral/query/index", | |
43 | - "pages/user/integral/msg/msg", | |
34 | + | |
35 | + | |
36 | + | |
44 | 37 | "pages/user/userqy/userqy", |
45 | 38 | "pages/user/user_spsy/user_spsy", |
46 | 39 | "pages/user/user_fw/user_fw", |
... | ... | @@ -74,9 +67,7 @@ |
74 | 67 | "pages/cart/cart2_inte/cart2_inte", |
75 | 68 | "pages/giftpack/festival/festival", |
76 | 69 | "pages/team/team_more/team_more", |
77 | - "pages/user/deposit/deposit", | |
78 | - "pages/user/deposit/prepaid/msg/msg", | |
79 | - "pages/user/deposit/prepaid/prepaid", | |
70 | + | |
80 | 71 | "pages/distribution/distribution", |
81 | 72 | "pages/template/index" |
82 | 73 | ], |
... | ... | @@ -189,7 +180,21 @@ |
189 | 180 | "pages/AI-test-skin/select_photo/select_photo", |
190 | 181 | "pages/AI-test-skin/fail_result/fail_result", |
191 | 182 | "pages/AI-test-skin/success_result/success_result", |
192 | - "pages/AI-test-skin/analyse/analyse" | |
183 | + "pages/AI-test-skin/analyse/analyse", | |
184 | + | |
185 | + "pages/user/coupons/coupons", | |
186 | + "pages/user/integral/integral", | |
187 | + "pages/user/integral/query/index", | |
188 | + "pages/user/integral/msg/msg", | |
189 | + "pages/user/deposit/deposit", | |
190 | + "pages/user/deposit/prepaid/msg/msg", | |
191 | + "pages/user/deposit/prepaid/prepaid", | |
192 | + "pages/user/member/menber", | |
193 | + "pages/user/member/bring/bring", | |
194 | + "pages/user/member/bring/msg/msg", | |
195 | + "pages/user/member/account/account", | |
196 | + "pages/user/member/account_unable/account_unable", | |
197 | + "pages/user/member/cash_record/cash_record" | |
193 | 198 | ] |
194 | 199 | } |
195 | 200 | ... | ... |
components/diy_goodsGroup/diy_goodsGroup.js
... | ... | @@ -29,7 +29,7 @@ Component({ |
29 | 29 | currentPage: 1, |
30 | 30 | requestData: null, |
31 | 31 | requestUrl: "", |
32 | - goods_array: null, | |
32 | + goods_array: [], | |
33 | 33 | total: null, |
34 | 34 | prom_id: 0, |
35 | 35 | classstyle_id: null, |
... | ... | @@ -424,7 +424,7 @@ Component({ |
424 | 424 | |
425 | 425 | |
426 | 426 | this.data.currentPage = 1; |
427 | - this.setData({ goods_array: null, total: null, title_index: title_idx }); | |
427 | + this.setData({ goods_array: [], total: null, title_index: title_idx }); | |
428 | 428 | //初始化 |
429 | 429 | this.init(this.data.classstyle_id, this.data.wgroup); |
430 | 430 | setTimeout(function () { wx.hideLoading(); }, 1000) |
... | ... | @@ -467,7 +467,6 @@ Component({ |
467 | 467 | item.cardprice3 = val.cardprice3; |
468 | 468 | item.prom_type = val.prom_type; |
469 | 469 | item.prom_id = val.prom_id; |
470 | - | |
471 | 470 | if (val.prom_price) item.prom_price = val.prom_price; |
472 | 471 | if (val.prom_integral) item.prom_integral = val.prom_integral; |
473 | 472 | ... | ... |
components/diy_goodsGroup/diy_goodsGroup.json
components/diy_goodsGroup/diy_goodsGroup.wxml
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | <wxs module="g_filter" src="g_filter.wxs"></wxs> |
4 | 4 | |
5 | 5 | <!-- 要不要顶部标题 --> |
6 | +<mp-loading show ="{{goods_array.length== 0}}" type="circle"></mp-loading> | |
6 | 7 | <block wx:if="{{is_nav}}"> |
7 | 8 | <view class="flex gr_title_list" style="overflow-x: auto;"> |
8 | 9 | <view class="gr_title_item" wx:for="{{nav_list}}" data-index="{{index}}" bindtap="gr_set_nav" data-idlist="{{item.idlist}}" data-wgroup="{{item.wgroup}}" data-classstyle="{{item.classstyle}}"> |
... | ... | @@ -10,9 +11,6 @@ |
10 | 11 | </view> |
11 | 12 | </view> |
12 | 13 | </block> |
13 | - | |
14 | - | |
15 | - | |
16 | 14 | <view style="background-color: {{bg_color}};"> |
17 | 15 | <!--1个列表的时候--> |
18 | 16 | <view class="zs_goods_wai" wx:if='{{object.column==1}}'> |
... | ... | @@ -155,7 +153,25 @@ |
155 | 153 | </block> |
156 | 154 | |
157 | 155 | </view> |
158 | - <view class='zs_wz5' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> | |
156 | + <!-- <view class='zs_wz5' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> --> | |
157 | + <view class="flex jc-sb ai-center"> | |
158 | + <view class='zs_wz5_x' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> | |
159 | + | |
160 | + <!-- 购物车图标 --> | |
161 | + <view class="icon-box" wx:if="{{object.goodcaricon != 1}}"> | |
162 | + <!-- 系统图标 --> | |
163 | + <block wx:if="{{object.goodcaricon == 2}}"> | |
164 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_1.png'}}" wx:if="{{object.stylecaricon == 1}}" mode="widthFix"></image> | |
165 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_2.png'}}" wx:if="{{object.stylecaricon == 2}}" mode="widthFix"></image> | |
166 | + <text class="icon-text" wx:if="{{object.stylecaricon == 3}}">马上抢</text> | |
167 | + <text class="icon-text" wx:if="{{object.stylecaricon == 4}}">立即购买</text> | |
168 | + </block> | |
169 | + <!-- 自定义图标 --> | |
170 | + <block wx:if="{{object.goodcaricon == 3}}"> | |
171 | + <image class="icon icon2" src="{{object.customcaricon}}" mode="widthFix"></image> | |
172 | + </block> | |
173 | + </view> | |
174 | + </view> | |
159 | 175 | <view style="height: 10rpx;"></view> |
160 | 176 | </view> |
161 | 177 | </navigator> |
... | ... | @@ -303,8 +319,27 @@ |
303 | 319 | </block> |
304 | 320 | </block> |
305 | 321 | </view> |
306 | - <view class='zs_wz5_2l' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> | |
307 | - <view style="height: 10rpx;"></view> | |
322 | + <!-- <view class='zs_wz5_2l' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> --> | |
323 | + <view class="flex jc-sb ai-center"> | |
324 | + <view class='zs_wz5_x' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> | |
325 | + | |
326 | + <!-- 购物车图标 --> | |
327 | + <view class="icon-box" wx:if="{{object.goodcaricon != 1}}"> | |
328 | + <!-- 系统图标 --> | |
329 | + <block wx:if="{{object.goodcaricon == 2}}"> | |
330 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_1.png'}}" wx:if="{{object.stylecaricon == 1}}" mode="widthFix"></image> | |
331 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_2.png'}}" wx:if="{{object.stylecaricon == 2}}" mode="widthFix"></image> | |
332 | + <text class="icon-text" wx:if="{{object.stylecaricon == 3}}">马上抢</text> | |
333 | + <text class="icon-text" wx:if="{{object.stylecaricon == 4}}">立即购买</text> | |
334 | + </block> | |
335 | + <!-- 自定义图标 --> | |
336 | + <block wx:if="{{object.goodcaricon == 3}}"> | |
337 | + <image class="icon icon2" src="{{object.customcaricon}}" mode="widthFix"></image> | |
338 | + </block> | |
339 | + </view> | |
340 | + </view> | |
341 | + | |
342 | + <view style="height: 10rpx;"></view> | |
308 | 343 | </view> |
309 | 344 | </view> |
310 | 345 | </view> |
... | ... | @@ -453,7 +488,25 @@ |
453 | 488 | </block> |
454 | 489 | </block> |
455 | 490 | </view> |
456 | - <view class='zs_wz5_3l' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> | |
491 | + <!-- <view class='zs_wz5_3l' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> --> | |
492 | + <view class="flex jc-sb ai-center"> | |
493 | + <view class='zs_wz5_x' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> | |
494 | + | |
495 | + <!-- 购物车图标 --> | |
496 | + <view class="icon-box" wx:if="{{object.goodcaricon != 1}}"> | |
497 | + <!-- 系统图标 --> | |
498 | + <block wx:if="{{object.goodcaricon == 2}}"> | |
499 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_1.png'}}" wx:if="{{object.stylecaricon == 1}}" mode="widthFix"></image> | |
500 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_2.png'}}" wx:if="{{object.stylecaricon == 2}}" mode="widthFix"></image> | |
501 | + <text class="icon-text" wx:if="{{object.stylecaricon == 3}}">马上抢</text> | |
502 | + <text class="icon-text" wx:if="{{object.stylecaricon == 4}}">立即购买</text> | |
503 | + </block> | |
504 | + <!-- 自定义图标 --> | |
505 | + <block wx:if="{{object.goodcaricon == 3}}"> | |
506 | + <image class="icon icon2" src="{{object.customcaricon}}" mode="widthFix"></image> | |
507 | + </block> | |
508 | + </view> | |
509 | + </view> | |
457 | 510 | <view style="height: 10rpx;"></view> |
458 | 511 | </view> |
459 | 512 | </view> |
... | ... | @@ -610,7 +663,26 @@ |
610 | 663 | |
611 | 664 | </block> |
612 | 665 | </view> |
613 | - <view class='zs_wz5_x' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> | |
666 | + | |
667 | + <view class="flex jc-sb ai-center"> | |
668 | + <view class='zs_wz5_x' wx:if="{{object.goodsnum}}">销量:{{item.sales_sum}}件</view> | |
669 | + | |
670 | + <!-- 购物车图标 --> | |
671 | + <view class="icon-box" wx:if="{{object.goodcaricon != 1}}"> | |
672 | + <!-- 系统图标 --> | |
673 | + <block wx:if="{{object.goodcaricon == 2}}"> | |
674 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_1.png'}}" wx:if="{{object.stylecaricon == 1}}" mode="widthFix"></image> | |
675 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_2.png'}}" wx:if="{{object.stylecaricon == 2}}" mode="widthFix"></image> | |
676 | + <text class="icon-text" wx:if="{{object.stylecaricon == 3}}">马上抢</text> | |
677 | + <text class="icon-text" wx:if="{{object.stylecaricon == 4}}">立即购买</text> | |
678 | + </block> | |
679 | + <!-- 自定义图标 --> | |
680 | + <block wx:if="{{object.goodcaricon == 3}}"> | |
681 | + <image class="icon icon2" src="{{object.customcaricon}}" mode="widthFix"></image> | |
682 | + </block> | |
683 | + </view> | |
684 | + </view> | |
685 | + | |
614 | 686 | </view> |
615 | 687 | |
616 | 688 | </view> |
... | ... | @@ -784,7 +856,25 @@ |
784 | 856 | </block> |
785 | 857 | </block> |
786 | 858 | </view> |
787 | - <view class='zs_wz5_3l' wx:if="{{object.goodsnum}}">销量:{{aitem.sales_sum}}件</view> | |
859 | + <!-- <view class='zs_wz5_3l' wx:if="{{object.goodsnum}}">销量:{{aitem.sales_sum}}件</view> --> | |
860 | + <view class="flex jc-sb ai-center"> | |
861 | + <view class='zs_wz5_x' wx:if="{{object.goodsnum}}">销量:{{aitem.sales_sum}}件</view> | |
862 | + | |
863 | + <!-- 购物车图标 --> | |
864 | + <view class="icon-box" wx:if="{{object.goodcaricon != 1}}"> | |
865 | + <!-- 系统图标 --> | |
866 | + <block wx:if="{{object.goodcaricon == 2}}"> | |
867 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_1.png'}}" wx:if="{{object.stylecaricon == 1}}" mode="widthFix"></image> | |
868 | + <image class="icon" src="{{url + '/miniapp/images/cart/group_goods_car_2.png'}}" wx:if="{{object.stylecaricon == 2}}" mode="widthFix"></image> | |
869 | + <text class="icon-text" wx:if="{{object.stylecaricon == 3}}">马上抢</text> | |
870 | + <text class="icon-text" wx:if="{{object.stylecaricon == 4}}">立即购买</text> | |
871 | + </block> | |
872 | + <!-- 自定义图标 --> | |
873 | + <block wx:if="{{object.goodcaricon == 3}}"> | |
874 | + <image class="icon icon2" src="{{object.customcaricon}}" mode="widthFix"></image> | |
875 | + </block> | |
876 | + </view> | |
877 | + </view> | |
788 | 878 | <view style="height: 10rpx;"></view> |
789 | 879 | </view> |
790 | 880 | ... | ... |
components/diy_goodsGroup/diy_goodsGroup.wxss
... | ... | @@ -31,9 +31,10 @@ |
31 | 31 | .zs_top { |
32 | 32 | width: 100%; |
33 | 33 | min-height: 700rpx; |
34 | - margin: 0 auto; | |
35 | - margin-bottom: 30rpx; | |
34 | + /* margin: 0 auto; | |
35 | + margin-bottom: 30rpx; */ | |
36 | 36 | display: flex; |
37 | + | |
37 | 38 | } |
38 | 39 | |
39 | 40 | .zs_t_img { |
... | ... | @@ -43,13 +44,15 @@ |
43 | 44 | } |
44 | 45 | |
45 | 46 | .zs_center { |
47 | + box-sizing: border-box; | |
46 | 48 | width: 100%; |
47 | 49 | /* min-height: 200rpx; */ |
48 | 50 | font-size: 28rpx; |
49 | 51 | color: #333; |
50 | 52 | text-align: left; |
51 | - margin-left: 25rpx; | |
52 | - padding: 0 10rpx; | |
53 | + padding: 20rpx; | |
54 | + /* margin-left: 25rpx; */ | |
55 | + /* padding: 0 10rpx; */ | |
53 | 56 | } |
54 | 57 | |
55 | 58 | .zs_wz1 { |
... | ... | @@ -171,6 +174,8 @@ |
171 | 174 | .zs_center_x { |
172 | 175 | /* width: 100%; |
173 | 176 | min-height: 200rpx; */ |
177 | + box-sizing: border-box; | |
178 | + flex-grow: 1; | |
174 | 179 | font-size: 28rpx; |
175 | 180 | color: #333; |
176 | 181 | padding-left: 20rpx; |
... | ... | @@ -555,6 +560,10 @@ |
555 | 560 | justify-content: space-around; |
556 | 561 | } |
557 | 562 | |
563 | +.jc-sb { | |
564 | + justify-content: space-between; | |
565 | +} | |
566 | + | |
558 | 567 | .fs24 { |
559 | 568 | font-size: 24rpx; |
560 | 569 | } |
... | ... | @@ -870,5 +879,29 @@ top: 10rpx; |
870 | 879 | -webkit-line-clamp: 2; |
871 | 880 | } |
872 | 881 | |
882 | +.icon-box { | |
883 | + /* width: 50rpx; */ | |
884 | +} | |
885 | + | |
886 | +.icon-box .icon { | |
887 | + display: block; | |
888 | + width: 50rpx; | |
889 | + height: 50rpx; | |
890 | +} | |
891 | + | |
892 | +.icon-box .icon.icon2 { | |
893 | + width: 80rpx; | |
894 | +} | |
895 | + | |
896 | +.icon-box .icon-text { | |
897 | + font-size: 26rpx; | |
898 | + color: red; | |
899 | + padding: 10rpx 20rpx; | |
900 | + border: 2rpx solid red; | |
901 | + border-radius: 40rpx; | |
902 | +} | |
903 | + | |
904 | + | |
905 | + | |
873 | 906 | |
874 | 907 | ... | ... |
packageA/pages/activity_share/activity_share.js
... | ... | @@ -397,7 +397,7 @@ Page({ |
397 | 397 | get_colloction: async function(){ |
398 | 398 | var list=null; |
399 | 399 | //-- 获取搭配购的从商品的信息 -- |
400 | - await app.request.promiseGet("/api/weshop/goods/getGoodsPromList/"+oo.stoid+"/"+this.data.hui_active.main_goods_id+"/2",{}).then(res=>{ | |
400 | + await app.request.promiseGet("/api/weshop/goods/getGoodsPromList/"+oo.stoid+"/"+this.data.hui_active.main_goods_id+"/2"+"/"+getApp().globalData.user_id,{}).then(res=>{ | |
401 | 401 | if(res.data.code==0){ |
402 | 402 | list=res.data.data.collocationList; |
403 | 403 | } | ... | ... |
packageA/pages/checkin/checkin.wxml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <view class="checkin-container"> |
5 | 5 | <view class="rule-container flex"> |
6 | 6 | <view class="rule" bindtap="showRules">规则</view> |
7 | - <view class="points" bindtap="goto" data-url="/pages/user/integral/integral"> | |
7 | + <view class="points" bindtap="goto" data-url="/packageD/pages/user/integral/integral"> | |
8 | 8 | <image class="coin" src="https://mshop-lib.yolipai.net/template/mobile/new/static/images/integral/coins.png"></image>我的积分 |
9 | 9 | </view> |
10 | 10 | </view> | ... | ... |
packageA/pages/goodsInfo/goodsInfo.wxml
... | ... | @@ -696,7 +696,8 @@ |
696 | 696 | <view class="b_num"> |
697 | 697 | <view>购买数量</view> |
698 | 698 | <view class="count"> |
699 | - <view bindtap="subCartNum" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view> | |
699 | + <view class="sub {{goodsInputNum <= 1 ? 'active':''}}" wx:if="{{goodsInputNum <= 1}}">-</view> | |
700 | + <view bindtap="subCartNum" class="sub" wx:else>-</view> | |
700 | 701 | <input bindblur="inputCartNum" type="number" value="{{goodsInputNum}}"></input> |
701 | 702 | <view bindtap="addCartNum" class="add">+</view> |
702 | 703 | </view> | ... | ... |
packageA/pages/prom_list/prom_list.js
... | ... | @@ -268,7 +268,7 @@ Page({ |
268 | 268 | if (!ee.data.collocationList) { |
269 | 269 | /*---获取活动的重表---*/ |
270 | 270 | //调用接口判断订单优惠, |
271 | - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + ee.data.gid + "/2", {}).then(res => { | |
271 | + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + ee.data.gid + "/2"+"/"+oo.user_id, {}).then(res => { | |
272 | 272 | if (res.data.code == 0) { |
273 | 273 | var r_data = res.data.data; |
274 | 274 | ... | ... |
packageA/pages/quan_list/quan_list.js
1 | 1 | var t = require("../../../utils/util.js"), ut = t, |
2 | - e = require("../../../utils/common.js"), | |
3 | - oo = getApp().globalData, | |
4 | - os = getApp().globalData.setting; | |
5 | -var utils = require('../../../utils/util.js'),ut=utils; | |
2 | + e = require("../../../utils/common.js"), | |
3 | + oo = getApp().globalData, | |
4 | + os = getApp().globalData.setting; | |
5 | +var utils = require('../../../utils/util.js'), ut = utils; | |
6 | 6 | |
7 | 7 | |
8 | 8 | |
9 | 9 | Page({ |
10 | - data: { | |
11 | - stoid: os.stoid, | |
12 | - url: os.url, | |
13 | - resourceUrl: os.resourceUrl, | |
14 | - iurl: os.imghost, | |
15 | - defaultAvatar: os.resourceUrl + "/static/images/user68.jpg", | |
16 | - dataList: null, | |
17 | - config2:null, | |
18 | - curpage:1, | |
19 | - loading:0, | |
20 | - get_item:null, | |
21 | - show_success:0, | |
22 | - getcurday:null, | |
23 | - }, | |
24 | - //------初始化加载---------- | |
25 | - onLoad: function(t) { | |
26 | - var th=this; | |
27 | - getApp().getConfig2(function (conf) { | |
28 | - if(conf.couponset) conf.couponset=conf.couponset.replace(/\<img/g,'<img style="width:100%;height:auto;display:block"'); | |
29 | - th.setData({config2:conf}); | |
30 | - }) | |
31 | - }, | |
32 | - //---展示--- | |
33 | - onShow: function() { | |
10 | + data: { | |
11 | + stoid: os.stoid, | |
12 | + url: os.url, | |
13 | + resourceUrl: os.resourceUrl, | |
14 | + iurl: os.imghost, | |
15 | + defaultAvatar: os.resourceUrl + "/static/images/user68.jpg", | |
16 | + dataList: null, | |
17 | + config2: null, | |
18 | + curpage: 1, | |
19 | + loading: 0, | |
20 | + get_item: null, | |
21 | + show_success: 0, | |
22 | + getcurday: null, | |
23 | + }, | |
24 | + //------初始化加载---------- | |
25 | + onLoad: function (t) { | |
26 | + var th = this; | |
27 | + getApp().getConfig2(function (conf) { | |
28 | + if (conf.couponset) conf.couponset = conf.couponset.replace(/\<img/g, '<img style="width:100%;height:auto;display:block"'); | |
29 | + th.setData({ config2: conf }); | |
30 | + }) | |
31 | + }, | |
32 | + //---展示--- | |
33 | + onShow: function () { | |
34 | 34 | |
35 | - console.log("onShow:1"); | |
36 | - this.data.curpage=1; | |
37 | - this.setData({dataList:null}); | |
38 | - console.log("onShow:2"); | |
39 | - this.get_quan_list(); | |
40 | - //券的模拟数据 | |
41 | - //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}]; | |
42 | - //th.setData({dataList: data}); | |
43 | - this.setData({getcurday:ut.gettimestamp()}); | |
44 | - }, | |
35 | + console.log("onShow:1"); | |
36 | + this.data.curpage = 1; | |
37 | + this.setData({ dataList: null }); | |
38 | + console.log("onShow:2"); | |
39 | + this.get_quan_list(); | |
40 | + //券的模拟数据 | |
41 | + //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}]; | |
42 | + //th.setData({dataList: data}); | |
43 | + this.setData({ getcurday: ut.gettimestamp() }); | |
44 | + }, | |
45 | 45 | |
46 | - onHide: function() { | |
47 | - | |
48 | - }, | |
46 | + onHide: function () { | |
49 | 47 | |
50 | - //--券的列表页面的函数-- | |
51 | - get_quan_list:function(){ | |
52 | - console.log("onShow:3"); | |
53 | - var th=this; | |
54 | - if(th.data.loading) return false; | |
55 | - th.data.loading=1; | |
56 | - var user_id=getApp().globalData.user_id; | |
57 | - console.log("onShow:4"); | |
58 | - var data={store_id:os.stoid,type:1,pageSize:10,page:th.data.curpage,user_id:user_id,is_share:0}; | |
59 | - console.log(data); | |
60 | - getApp().request.get("/api/weshop/prom/coupon/pageCouponList", { | |
61 | - data:data, | |
62 | - success:function (res){ | |
63 | - console.log("onShow:5"); | |
64 | - console.log(res); | |
65 | - th.data.loading=0; | |
66 | - if(res.data.code==0){ | |
67 | - if(!th.data.dataList) th.data.dataList=new Array(); | |
68 | - th.data.dataList=th.data.dataList.concat(res.data.data.pageData); | |
69 | - th.data.curpage++; | |
70 | - th.setData({dataList:th.data.dataList}); | |
71 | - } | |
72 | - }, | |
73 | - fail:function (e){ | |
74 | - console.log("onShow:6"); | |
75 | - console.log(e); | |
76 | - } | |
77 | - }); | |
78 | - }, | |
48 | + }, | |
79 | 49 | |
80 | - //---加载更多是靠这个函数---- | |
81 | - onReachBottom: function() { | |
82 | - this.get_quan_list(); | |
83 | - }, | |
50 | + //--券的列表页面的函数-- | |
51 | + get_quan_list: function () { | |
52 | + console.log("onShow:3"); | |
53 | + var th = this; | |
54 | + if (th.data.loading) return false; | |
55 | + th.data.loading = 1; | |
56 | + var user_id = getApp().globalData.user_id; | |
57 | + console.log("onShow:4"); | |
58 | + var data = { store_id: os.stoid, type: 1, pageSize: 10, page: th.data.curpage, user_id: user_id, is_share: 0 }; | |
59 | + console.log(data); | |
60 | + getApp().request.get("/api/weshop/prom/coupon/pageCouponList", { | |
61 | + data: data, | |
62 | + success: function (res) { | |
63 | + console.log("onShow:5"); | |
64 | + console.log(res); | |
65 | + th.data.loading = 0; | |
66 | + if (res.data.code == 0) { | |
67 | + if (!th.data.dataList) th.data.dataList = new Array(); | |
68 | + th.data.dataList = th.data.dataList.concat(res.data.data.pageData); | |
69 | + th.data.curpage++; | |
70 | + th.setData({ dataList: th.data.dataList }); | |
71 | + } | |
72 | + }, | |
73 | + fail: function (e) { | |
74 | + console.log("onShow:6"); | |
75 | + console.log(e); | |
76 | + } | |
77 | + }); | |
78 | + }, | |
84 | 79 | |
80 | + //---加载更多是靠这个函数---- | |
81 | + onReachBottom: function () { | |
82 | + this.get_quan_list(); | |
83 | + }, | |
85 | 84 | |
86 | - //--滚动到顶部-- | |
87 | - doScrollTop: function() { | |
88 | - wx.pageScrollTo({ scrollTop: 0 }); | |
89 | - }, | |
90 | 85 | |
91 | - //-----领取券----- | |
92 | - get_quan: function(e) { | |
93 | - var cid = e.currentTarget.dataset.cid; | |
94 | - var index = e.currentTarget.dataset.ind; | |
95 | - var item = this.data.dataList[index]; | |
86 | + //--滚动到顶部-- | |
87 | + doScrollTop: function () { | |
88 | + wx.pageScrollTo({ scrollTop: 0 }); | |
89 | + }, | |
96 | 90 | |
97 | - //--先判断会员状态-- | |
98 | - var user_info = getApp().globalData.userInfo; | |
99 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
100 | - wx.navigateTo({ | |
101 | - url: '/pages/togoin/togoin', | |
102 | - }) | |
103 | - return false; | |
104 | - } | |
91 | + //-----领取券----- | |
92 | + get_quan: function (e) { | |
93 | + var cid = e.currentTarget.dataset.cid; | |
94 | + var index = e.currentTarget.dataset.ind; | |
95 | + var item = this.data.dataList[index]; | |
96 | + var good = new Array(); //单品且是免费领取专门使用 | |
97 | + //--先判断会员状态-- | |
98 | + var user_info = getApp().globalData.userInfo; | |
99 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
100 | + wx.navigateTo({ | |
101 | + url: '/pages/togoin/togoin', | |
102 | + }) | |
103 | + return false; | |
104 | + } | |
105 | 105 | |
106 | - //如果券还在领取中,不能再点 | |
107 | - if (item.linging == 1) { | |
108 | - getApp().my_warnning('领取中..', 0, this); | |
109 | - return false; | |
110 | - } | |
111 | - | |
112 | - //如果领取的次数到了 | |
113 | - if (item.everyone_num > 0 && item.lqnum >= item.everyone_num) { | |
114 | - getApp().my_warnning('领取失败,您已领完该券', 0, this); | |
115 | - return false; | |
116 | - } | |
117 | - var lq_num = item.lqnum; | |
118 | - var pdata = { | |
119 | - 'uid': oo.user_id, | |
120 | - 'cid': cid, | |
121 | - 'store_id': os.stoid, | |
122 | - 'type': 5 | |
123 | - }; | |
124 | - //-- 导购ID -- | |
125 | - if(getApp().globalData.guide_id){ | |
126 | - pdata.guide_id=getApp().globalData.guide_id; | |
127 | - } | |
128 | - var app = getApp(), | |
129 | - th = this; | |
130 | - app.request.post("/api/weshop/couponList/saveCouponList", { | |
131 | - data: pdata, | |
132 | - success: function(res) { | |
133 | - if (res.data.code == 0) { | |
134 | - var text = "dataList[" + index + "].is_get"; | |
135 | - var text2 = "dataList[" + index + "].linging"; | |
136 | - var text3 = "get_item"; | |
137 | - var obj = {};obj[text] = 1; obj[text2] = 0;obj[text3] = item;obj['show_success']=1; | |
138 | - th.setData(obj); | |
139 | - } else { | |
140 | - app.confirmBox(res.data.msg); | |
141 | - var text2 = "dataList[" + index + "].linging"; | |
142 | - th.setData({[text2]:0}); | |
143 | - } | |
144 | - } | |
145 | - }) | |
146 | - }, | |
147 | - close_show:function () { | |
148 | - this.setData({show_success:0,get_item:null}) | |
149 | - }, | |
150 | - go_quan:function () { | |
151 | - getApp().goto("/pages/user/coupons/coupons"); | |
152 | - }, | |
153 | - go_detail:function (e) { | |
154 | - var index=e.currentTarget.dataset.ind; | |
155 | - var item=this.data.dataList[index]; | |
156 | - getApp().goto("/packageA/pages/quan_pro/quan_pro?id="+item.id); | |
157 | - } | |
106 | + //如果券还在领取中,不能再点 | |
107 | + if (item.linging == 1) { | |
108 | + getApp().my_warnning('领取中..', 0, this); | |
109 | + return false; | |
110 | + } | |
158 | 111 | |
112 | + //如果领取的次数到了 | |
113 | + if (item.everyone_num > 0 && item.lqnum >= item.everyone_num) { | |
114 | + getApp().my_warnning('领取失败,您已领完该券', 0, this); | |
115 | + return false; | |
116 | + } | |
117 | + var lq_num = item.lqnum; | |
118 | + var pdata = { | |
119 | + 'uid': oo.user_id, | |
120 | + 'cid': cid, | |
121 | + 'store_id': os.stoid, | |
122 | + 'type': 5 | |
123 | + }; | |
124 | + if (item.useobjecttype == 20 && item.type == 1) { | |
125 | + getApp().request.get('/api/weshop/goods/list', { | |
126 | + data: { | |
127 | + store_id: os.stoid, | |
128 | + erpwareid: item.useobjectid, | |
129 | + }, | |
130 | + success(res) { | |
131 | + if (ut.ajax_ok2(res)) { | |
132 | + good = res.data.data; | |
133 | + } | |
134 | + } | |
135 | + }) | |
136 | + } | |
137 | + //-- 导购ID -- | |
138 | + if (getApp().globalData.guide_id) { | |
139 | + pdata.guide_id = getApp().globalData.guide_id; | |
140 | + } | |
141 | + var app = getApp(), | |
142 | + th = this; | |
143 | + app.request.post("/api/weshop/couponList/saveCouponList", { | |
144 | + data: pdata, | |
145 | + success: function (res) { | |
146 | + if (res.data.code == 0) { | |
147 | + var text = "dataList[" + index + "].is_get"; | |
148 | + var text2 = "dataList[" + index + "].linging"; | |
149 | + var text3 = "get_item"; | |
150 | + var obj = {}; obj[text] = 1; obj[text2] = 0; obj[text3] = item; | |
151 | + th.setData(obj); | |
152 | + if (good.length > 0) { | |
153 | + wx.showToast({ | |
154 | + title: '领取成功', | |
155 | + success() { | |
156 | + let item = good[0]; | |
157 | + let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}` | |
158 | + setTimeout(()=>{ | |
159 | + getApp().goto(url) | |
160 | + },500) | |
161 | + } | |
162 | + }) | |
159 | 163 | |
164 | + } else { | |
165 | + th.setData({ | |
166 | + show_success: 1, | |
167 | + }) | |
168 | + } | |
169 | + } else { | |
170 | + app.confirmBox(res.data.msg); | |
171 | + var text2 = "dataList[" + index + "].linging"; | |
172 | + th.setData({ [text2]: 0 }); | |
173 | + } | |
174 | + } | |
175 | + }) | |
176 | + }, | |
177 | + close_show: function () { | |
178 | + this.setData({ show_success: 0, get_item: null }) | |
179 | + }, | |
180 | + go_quan: function () { | |
181 | + getApp().goto("/pages/user/coupons/coupons"); | |
182 | + }, | |
183 | + go_detail: function (e) { | |
184 | + var index = e.currentTarget.dataset.ind; | |
185 | + var item = this.data.dataList[index]; | |
186 | + getApp().goto("/packageA/pages/quan_pro/quan_pro?id=" + item.id); | |
187 | + } | |
160 | 188 | }); | ... | ... |
packageA/pages/quan_pro/quan_pro.js
... | ... | @@ -77,6 +77,7 @@ Page({ |
77 | 77 | var item=this.data.q_data; |
78 | 78 | var cid = this.data.q_data.id; |
79 | 79 | var th=this; |
80 | + var good = new Array(); //单品且是免费领取专门使用 | |
80 | 81 | //--先判断会员状态-- |
81 | 82 | var user_info = getApp().globalData.userInfo; |
82 | 83 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
... | ... | @@ -103,6 +104,19 @@ Page({ |
103 | 104 | 'store_id': os.stoid, |
104 | 105 | 'type': 5 |
105 | 106 | }; |
107 | + if (item.useobjecttype == 20 && item.type == 1) { | |
108 | + getApp().request.get('/api/weshop/goods/list', { | |
109 | + data: { | |
110 | + store_id: os.stoid, | |
111 | + erpwareid: item.useobjectid, | |
112 | + }, | |
113 | + success(res) { | |
114 | + if (ut.ajax_ok2(res)) { | |
115 | + good = res.data.data; | |
116 | + } | |
117 | + } | |
118 | + }) | |
119 | + } | |
106 | 120 | |
107 | 121 | //-- 分享导购ID -- |
108 | 122 | if(getApp().globalData.guide_id){ |
... | ... | @@ -118,8 +132,24 @@ Page({ |
118 | 132 | if (res.data.code == 0) { |
119 | 133 | item.lqnum++; |
120 | 134 | var text3="q_data"; |
121 | - var obj = {};obj[text3] = item;obj['show_success']=1; | |
135 | + var obj = {};obj[text3] = item; | |
122 | 136 | th.setData(obj); |
137 | + if (good.length > 0) { | |
138 | + wx.showToast({ | |
139 | + title: '领取成功', | |
140 | + success() { | |
141 | + let item = good[0]; | |
142 | + let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}` | |
143 | + setTimeout(()=>{ | |
144 | + getApp().goto(url) | |
145 | + },500) | |
146 | + } | |
147 | + }) | |
148 | + } else { | |
149 | + th.setData({ | |
150 | + show_success: 1, | |
151 | + }) | |
152 | + } | |
123 | 153 | } else { |
124 | 154 | app.confirmBox(res.data.msg); |
125 | 155 | } |
... | ... | @@ -132,7 +162,7 @@ Page({ |
132 | 162 | this.setData({ |
133 | 163 | show_success:0 |
134 | 164 | }) |
135 | - getApp().goto("/pages/user/coupons/coupons"); | |
165 | + getApp().goto("/packageD/pages/user/coupons/coupons"); | |
136 | 166 | }, |
137 | 167 | |
138 | 168 | close_show(){ | ... | ... |
packageB/pages/luckactivity/luckinfo/luckinfo.js
... | ... | @@ -1279,7 +1279,7 @@ Page({ |
1279 | 1279 | }; |
1280 | 1280 | switch(type) { |
1281 | 1281 | case 1: { |
1282 | - url = '/pages/user/integral/integral'; | |
1282 | + url = '/packageD/pages/user/integral/integral'; | |
1283 | 1283 | break; |
1284 | 1284 | }; |
1285 | 1285 | case 2: { |
... | ... | @@ -1287,7 +1287,7 @@ Page({ |
1287 | 1287 | break; |
1288 | 1288 | }; |
1289 | 1289 | case 3: { |
1290 | - url = '/pages/user/coupons/coupons'; | |
1290 | + url = '/packageD/pages/user/coupons/coupons'; | |
1291 | 1291 | break; |
1292 | 1292 | }; |
1293 | 1293 | case 4: { | ... | ... |
packageC/pages/presell/cart/cart.js
... | ... | @@ -2256,7 +2256,7 @@ Page({ |
2256 | 2256 | //如果优惠促销和搭配购的时候 |
2257 | 2257 | if ((good.prom_type == 3 || good.prom_type == 5) && good.is_collocation != 1 && good.is_gift != 1) { |
2258 | 2258 | var p_ok = 1; |
2259 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { | |
2259 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0"+"/"+getApp().globalData.user_id, {}).then(res => { | |
2260 | 2260 | if (res.data.code == 0) { |
2261 | 2261 | var r_data = res.data.data; |
2262 | 2262 | if (!r_data.collocationPromList && good.prom_type == 5) { |
... | ... | @@ -2336,7 +2336,7 @@ Page({ |
2336 | 2336 | //不是赠品的时候 |
2337 | 2337 | if (!good.is_gift && good.prom_type != 3) { |
2338 | 2338 | var t_ok = 1; |
2339 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { | |
2339 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0"+"/"+getApp().globalData.user_id, {}).then(res => { | |
2340 | 2340 | if (res.data.code == 0) { |
2341 | 2341 | var r_data = res.data.data; |
2342 | 2342 | //-- 参加了全局的优惠活动 -- | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -1281,7 +1281,7 @@ Page({ |
1281 | 1281 | callback(); |
1282 | 1282 | } else { |
1283 | 1283 | //-- 判断有没有优惠活动 -- |
1284 | - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0", {}).then(res => { | |
1284 | + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0"+"/"+getApp().globalData.user_id, {}).then(res => { | |
1285 | 1285 | if (res.data.code == 0) { |
1286 | 1286 | var r_data = res.data.data; |
1287 | 1287 | th.data.prom_goods = r_data.promGoodsLists; | ... | ... |
packageC/pages/presell/pregoodsInfo/goodsInfo.js
... | ... | @@ -1278,7 +1278,7 @@ Page({ |
1278 | 1278 | callback(); |
1279 | 1279 | } else { |
1280 | 1280 | //-- 判断有没有优惠活动 -- |
1281 | - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0", {}).then(res => { | |
1281 | + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0"+"/"+getApp().globalData.user_id, {}).then(res => { | |
1282 | 1282 | if (res.data.code == 0) { |
1283 | 1283 | var r_data = res.data.data; |
1284 | 1284 | th.data.prom_goods = r_data.promGoodsLists; | ... | ... |
packageD/pages/AI-test-skin/index/aiskin.js
1 | 1 | /* |
2 | 2 | * @Author: abson |
3 | 3 | * @Date: 2022-02-11 14:13:05 |
4 | - * @LastEditTime: 2022-02-22 15:17:48 | |
4 | + * @LastEditTime: 2022-03-26 17:03:01 | |
5 | 5 | * @LastEditors: Please set LastEditors |
6 | 6 | * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
7 | 7 | * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\index\aiskin.js |
... | ... | @@ -25,11 +25,13 @@ Page({ |
25 | 25 | * 生命周期函数--监听页面加载 |
26 | 26 | */ |
27 | 27 | onLoad: function (options) { |
28 | - var user=getApp().globalData.userInfo; | |
29 | - if(!user){ | |
30 | - let url = "/pages/togoin/togoin"; | |
31 | - app.goto(url); | |
32 | - } | |
28 | + getApp().globalData.user_id = options?.user_id; | |
29 | + getApp().getUserFir(); | |
30 | + var user = getApp().globalData.userInfo; | |
31 | + if (!user || !getApp().globalData.user_id) { | |
32 | + let url = "/pages/togoin/togoin"; | |
33 | + app.goto(url); | |
34 | + } | |
33 | 35 | }, |
34 | 36 | |
35 | 37 | /** |
... | ... | @@ -57,8 +59,8 @@ Page({ |
57 | 59 | goto(e) { |
58 | 60 | |
59 | 61 | this.check_num(function () { |
60 | - var user=getApp().globalData.userInfo; | |
61 | - if(!user){ | |
62 | + var user = getApp().globalData.userInfo; | |
63 | + if (!user) { | |
62 | 64 | wx.showToast({ |
63 | 65 | title: "请先授权登陆", |
64 | 66 | icon: 'none', |
... | ... | @@ -68,14 +70,14 @@ Page({ |
68 | 70 | setTimeout(function () { |
69 | 71 | let url = "/pages/togoin/togoin"; |
70 | 72 | app.goto(url); |
71 | - },1000) | |
73 | + }, 1000) | |
72 | 74 | return false; |
73 | 75 | } |
74 | 76 | |
75 | 77 | let url = e.currentTarget.dataset.url; |
76 | 78 | app.goto(url); |
77 | 79 | }) |
78 | - | |
80 | + | |
79 | 81 | }, |
80 | 82 | |
81 | 83 | /** |
... | ... | @@ -102,26 +104,27 @@ Page({ |
102 | 104 | /** |
103 | 105 | * 用户点击右上角分享 |
104 | 106 | */ |
105 | - onShareAppMessage: function () { getApp().globalData.no_clear=1 | |
107 | + onShareAppMessage: function () { | |
108 | + getApp().globalData.no_clear = 1 | |
106 | 109 | |
107 | 110 | }, |
108 | 111 | |
109 | - check_num:function (func) { | |
112 | + check_num: function (func) { | |
110 | 113 | //判断右没有开AI测肤 |
111 | - getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{ | |
112 | - if(rs.data.code!=0 || !rs.data.data){ | |
114 | + getApp().promiseGet("/api/weshop/wx/weappSkin/get/" + setting.stoid, {}).then(rs => { | |
115 | + if (rs.data.code != 0 || !rs.data.data) { | |
113 | 116 | wx.showToast({ |
114 | 117 | title: "未开通测肤功能,请联系商家", |
115 | 118 | icon: 'none', |
116 | 119 | duration: 3000 |
117 | 120 | }) |
118 | - }else if(!rs.data.data.skin_num || rs.data.data.skin_num<=0){ | |
121 | + } else if (!rs.data.data.skin_num || rs.data.data.skin_num <= 0) { | |
119 | 122 | wx.showToast({ |
120 | 123 | title: "测肤功能的使用次数已经达到上限,请联系商家", |
121 | 124 | icon: 'none', |
122 | 125 | duration: 3000 |
123 | 126 | }) |
124 | - }else{ | |
127 | + } else { | |
125 | 128 | func(); |
126 | 129 | } |
127 | 130 | }) |
... | ... | @@ -139,14 +142,14 @@ Page({ |
139 | 142 | store_id: setting.stoid, |
140 | 143 | user_id: os.user_id, |
141 | 144 | page: 1, |
142 | - pageSize:1, | |
145 | + pageSize: 1, | |
143 | 146 | } |
144 | 147 | }); |
145 | 148 | // initChart.setOption(option); |
146 | 149 | if (res.code == 0 && res.data.pageData.length > 0) { |
147 | - this.setData({show_his:1}) | |
150 | + this.setData({ show_his: 1 }) | |
148 | 151 | } |
149 | 152 | } |
150 | - | |
151 | - | |
153 | + | |
154 | + | |
152 | 155 | }) |
153 | 156 | \ No newline at end of file | ... | ... |
packageD/pages/AI-test-skin/success_result/success_result.wxml
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | <view style="padding: 0 50rpx 20rpx 20rpx">泪沟</view> |
8 | 8 | </scroll-view> --> |
9 | 9 | <view style="height: 100rpx;"> |
10 | - <scroll-view enable-flex scroll-into-view="{{tab_id}}" scroll-with-animation scroll-x class="tab_scroll"> | |
10 | + <scroll-view enable-flex scroll-into-view="{{tab_id}}" scroll-with-animation scroll-x> | |
11 | 11 | <view class="flex" style="height: 100%;"> |
12 | 12 | <view wx:for="{{tab}}" wx:key="id" id="{{item.id}}" bindtap="clickTab" data-tab_id="{{item.id}}" data-index="{{index}}" class="tab_scroll_item {{currentIndex==index?'active':''}}"> |
13 | 13 | {{item.name}} | ... | ... |
packageD/pages/AI-test-skin/success_result/success_result.wxss
pages/user/coupons/coupons.js renamed to packageD/pages/user/coupons/coupons.js
... | ... | @@ -2,14 +2,14 @@ var t = getApp(), |
2 | 2 | a = t.request, |
3 | 3 | o = t.globalData.setting, |
4 | 4 | os = o, |
5 | - i = require("../../../utils/util.js"), | |
5 | + i = require("../../../../utils/util.js"), | |
6 | 6 | ut = i, |
7 | - s = require("../../../utils/common.js"); | |
8 | -var regeneratorRuntime = require('../../../utils/runtime.js'); | |
7 | + s = require("../../../../utils/common.js"); | |
8 | +var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
9 | 9 | const { |
10 | 10 | barcode, |
11 | 11 | qrcode |
12 | -} = require('../../../utils/index.js'); | |
12 | +} = require('../../../../utils/index.js'); | |
13 | 13 | let _this = null; |
14 | 14 | |
15 | 15 | Page({ | ... | ... |
pages/user/coupons/coupons.json renamed to packageD/pages/user/coupons/coupons.json
pages/user/coupons/coupons.wxml renamed to packageD/pages/user/coupons/coupons.wxml
1 | 1 | <wxs module="filter" src="filter.wxs"></wxs> |
2 | -<wxs module="time" src="../../../utils/filter.wxs"></wxs> | |
2 | +<wxs module="time" src="../../../../utils/filter.wxs"></wxs> | |
3 | 3 | |
4 | 4 | <view> |
5 | 5 | |
... | ... | @@ -57,8 +57,8 @@ |
57 | 57 | </view> |
58 | 58 | </view> |
59 | 59 | <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}"> |
60 | - <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:if="{{detail.Remark1!=''}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}}</view> | |
61 | - <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:else><text style="margin-right: 15rpx">使用说明:</text> {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}}</view> | |
60 | + <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:if="{{detail.Remark1!=''}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}</view> | |
61 | + <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:else><text style="margin-right: 15rpx">使用说明:</text> {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}</view> | |
62 | 62 | </view> |
63 | 63 | </block> |
64 | 64 | </view> | ... | ... |
pages/user/coupons/coupons.wxss renamed to packageD/pages/user/coupons/coupons.wxss
pages/user/coupons/filter.wxs renamed to packageD/pages/user/coupons/filter.wxs
pages/user/deposit/deposit.js renamed to packageD/pages/user/deposit/deposit.js
... | ... | @@ -2,10 +2,10 @@ var t = getApp(), |
2 | 2 | a = t.request, |
3 | 3 | o = t.globalData.setting, |
4 | 4 | os = o, |
5 | - i = require("../../../utils/util.js"), | |
5 | + i = require("../../../../utils/util.js"), | |
6 | 6 | ut = i, |
7 | - s = require("../../../utils/common.js"); | |
8 | -var regeneratorRuntime = require('../../../utils/runtime.js'); | |
7 | + s = require("../../../../utils/common.js"); | |
8 | +var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
9 | 9 | Page({ |
10 | 10 | data:{ |
11 | 11 | yucun_money:0, | ... | ... |
pages/user/deposit/deposit.json renamed to packageD/pages/user/deposit/deposit.json
pages/user/deposit/deposit.wxml renamed to packageD/pages/user/deposit/deposit.wxml
pages/user/deposit/deposit.wxss renamed to packageD/pages/user/deposit/deposit.wxss
pages/user/deposit/prepaid/fil.wxs renamed to packageD/pages/user/deposit/prepaid/fil.wxs
pages/user/deposit/prepaid/msg/msg.js renamed to packageD/pages/user/deposit/prepaid/msg/msg.js
pages/user/deposit/prepaid/msg/msg.json renamed to packageD/pages/user/deposit/prepaid/msg/msg.json
pages/user/deposit/prepaid/msg/msg.wxml renamed to packageD/pages/user/deposit/prepaid/msg/msg.wxml
pages/user/deposit/prepaid/msg/msg.wxss renamed to packageD/pages/user/deposit/prepaid/msg/msg.wxss
pages/user/deposit/prepaid/prepaid.js renamed to packageD/pages/user/deposit/prepaid/prepaid.js
... | ... | @@ -2,10 +2,10 @@ var t = getApp(), |
2 | 2 | a = t.request, |
3 | 3 | o = t.globalData.setting, |
4 | 4 | os = o, |
5 | - i = require("../../../../utils/util.js"), | |
5 | + i = require("../../../../../utils/util.js"), | |
6 | 6 | ut = i, |
7 | - s = require("../../../../utils/common.js"); | |
8 | -var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
7 | + s = require("../../../../../utils/common.js"); | |
8 | +var regeneratorRuntime = require('../../../../../utils/runtime.js'); | |
9 | 9 | Page({ |
10 | 10 | data: { |
11 | 11 | iurl: o.imghost, | ... | ... |
pages/user/deposit/prepaid/prepaid.json renamed to packageD/pages/user/deposit/prepaid/prepaid.json
pages/user/deposit/prepaid/prepaid.wxml renamed to packageD/pages/user/deposit/prepaid/prepaid.wxml
pages/user/deposit/prepaid/prepaid.wxss renamed to packageD/pages/user/deposit/prepaid/prepaid.wxss
pages/user/integral/filter.wxs renamed to packageD/pages/user/integral/filter.wxs
pages/user/integral/integral.js renamed to packageD/pages/user/integral/integral.js
... | ... | @@ -3,9 +3,9 @@ var e = function (e) { |
3 | 3 | return e && e.__esModule ? e : { |
4 | 4 | default: e |
5 | 5 | }; |
6 | -}(require("../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o, | |
7 | - i = require("../../../utils/util.js"), ut = i, b = require("../../../app.js"), app = b, s = require("../../../utils/common.js"), n = new e.default(); | |
8 | -var regeneratorRuntime = require('../../../utils/runtime.js'); | |
6 | +}(require("../../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o, | |
7 | + i = require("../../../../utils/util.js"), ut = i, b = require("../../../../app.js"), app = b, s = require("../../../../utils/common.js"), n = new e.default(); | |
8 | +var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
9 | 9 | Page({ |
10 | 10 | |
11 | 11 | /** | ... | ... |
pages/user/integral/integral.json renamed to packageD/pages/user/integral/integral.json
pages/user/integral/integral.wxml renamed to packageD/pages/user/integral/integral.wxml
pages/user/integral/integral.wxss renamed to packageD/pages/user/integral/integral.wxss
pages/user/integral/msg/msg.js renamed to packageD/pages/user/integral/msg/msg.js
pages/user/integral/msg/msg.json renamed to packageD/pages/user/integral/msg/msg.json
pages/user/integral/msg/msg.wxml renamed to packageD/pages/user/integral/msg/msg.wxml
pages/user/integral/msg/msg.wxss renamed to packageD/pages/user/integral/msg/msg.wxss
pages/user/integral/query/index.js renamed to packageD/pages/user/integral/query/index.js
... | ... | @@ -2,10 +2,10 @@ var t = getApp(), |
2 | 2 | a = t.request, |
3 | 3 | o = t.globalData.setting, |
4 | 4 | os = o, |
5 | - i = require("../../../../utils/util.js"), | |
5 | + i = require("../../../../../utils/util.js"), | |
6 | 6 | ut = i, |
7 | - s = require("../../../../utils/common.js"); | |
8 | -var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
7 | + s = require("../../../../../utils/common.js"); | |
8 | +var regeneratorRuntime = require('../../../../../utils/runtime.js'); | |
9 | 9 | Page({ |
10 | 10 | data: { |
11 | 11 | ... | ... |
pages/user/integral/query/index.json renamed to packageD/pages/user/integral/query/index.json
pages/user/integral/query/index.wxml renamed to packageD/pages/user/integral/query/index.wxml
pages/user/integral/query/index.wxss renamed to packageD/pages/user/integral/query/index.wxss
pages/user/member/account/account.js renamed to packageD/pages/user/member/account/account.js
... | ... | @@ -2,10 +2,10 @@ var t = getApp(), |
2 | 2 | a = t.request, |
3 | 3 | o = t.globalData.setting, |
4 | 4 | os = o, |
5 | - i = require("../../../../utils/util.js"), | |
5 | + i = require("../../../../../utils/util.js"), | |
6 | 6 | ut = i, |
7 | - s = require("../../../../utils/common.js"); | |
8 | -var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
7 | + s = require("../../../../../utils/common.js"); | |
8 | +var regeneratorRuntime = require('../../../../../utils/runtime.js'); | |
9 | 9 | Page({ |
10 | 10 | data: { |
11 | 11 | details:[],//数据 | ... | ... |
pages/user/member/account/account.json renamed to packageD/pages/user/member/account/account.json
pages/user/member/account/account.wxml renamed to packageD/pages/user/member/account/account.wxml
pages/user/member/account/account.wxss renamed to packageD/pages/user/member/account/account.wxss
pages/user/member/account/index.wxs renamed to packageD/pages/user/member/account/index.wxs
pages/user/member/account_unable/account_unable.js renamed to packageD/pages/user/member/account_unable/account_unable.js
... | ... | @@ -2,10 +2,10 @@ var t = getApp(), |
2 | 2 | a = t.request, |
3 | 3 | o = t.globalData.setting, |
4 | 4 | os = o, |
5 | - i = require("../../../../utils/util.js"), | |
5 | + i = require("../../../../../utils/util.js"), | |
6 | 6 | ut = i, |
7 | - s = require("../../../../utils/common.js"); | |
8 | -var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
7 | + s = require("../../../../../utils/common.js"); | |
8 | +var regeneratorRuntime = require('../../../../../utils/runtime.js'); | |
9 | 9 | Page({ |
10 | 10 | data: { |
11 | 11 | details: [],//数据 | ... | ... |
pages/user/member/account_unable/account_unable.json renamed to packageD/pages/user/member/account_unable/account_unable.json
pages/user/member/account_unable/account_unable.wxml renamed to packageD/pages/user/member/account_unable/account_unable.wxml
pages/user/member/account_unable/account_unable.wxss renamed to packageD/pages/user/member/account_unable/account_unable.wxss
pages/user/member/account_unable/index.wxs renamed to packageD/pages/user/member/account_unable/index.wxs
pages/user/member/bring/bring.js renamed to packageD/pages/user/member/bring/bring.js
... | ... | @@ -2,10 +2,10 @@ var t = getApp(), |
2 | 2 | a = t.request, |
3 | 3 | o = t.globalData.setting, |
4 | 4 | os = o, |
5 | - i = require("../../../../utils/util.js"), | |
5 | + i = require("../../../../../utils/util.js"), | |
6 | 6 | ut = i, |
7 | - s = require("../../../../utils/common.js"); | |
8 | -var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
7 | + s = require("../../../../../utils/common.js"); | |
8 | +var regeneratorRuntime = require('../../../../../utils/runtime.js'); | |
9 | 9 | var oo = t.globalData.setting; |
10 | 10 | Page({ |
11 | 11 | /** | ... | ... |
pages/user/member/bring/bring.json renamed to packageD/pages/user/member/bring/bring.json
pages/user/member/bring/bring.wxml renamed to packageD/pages/user/member/bring/bring.wxml
pages/user/member/bring/bring.wxss renamed to packageD/pages/user/member/bring/bring.wxss
pages/user/member/bring/msg/msg.js renamed to packageD/pages/user/member/bring/msg/msg.js
pages/user/member/bring/msg/msg.json renamed to packageD/pages/user/member/bring/msg/msg.json
pages/user/member/bring/msg/msg.wxml renamed to packageD/pages/user/member/bring/msg/msg.wxml
pages/user/member/bring/msg/msg.wxss renamed to packageD/pages/user/member/bring/msg/msg.wxss
pages/user/member/cash_record/cash_record.js renamed to packageD/pages/user/member/cash_record/cash_record.js
... | ... | @@ -2,10 +2,10 @@ var t = getApp(), |
2 | 2 | a = t.request, |
3 | 3 | o = t.globalData.setting, |
4 | 4 | os = o, |
5 | - i = require("../../../../utils/util.js"), | |
5 | + i = require("../../../../../utils/util.js"), | |
6 | 6 | ut = i, |
7 | - s = require("../../../../utils/common.js"); | |
8 | -var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
7 | + s = require("../../../../../utils/common.js"); | |
8 | +var regeneratorRuntime = require('../../../../../utils/runtime.js'); | |
9 | 9 | Page({ |
10 | 10 | data: { |
11 | 11 | parameter: false,//控制有没有数据的时候 | ... | ... |
pages/user/member/cash_record/cash_record.json renamed to packageD/pages/user/member/cash_record/cash_record.json
pages/user/member/cash_record/cash_record.wxml renamed to packageD/pages/user/member/cash_record/cash_record.wxml
pages/user/member/cash_record/cash_record.wxss renamed to packageD/pages/user/member/cash_record/cash_record.wxss
pages/user/member/cash_record/index.wxs renamed to packageD/pages/user/member/cash_record/index.wxs
pages/user/member/filter.wxs renamed to packageD/pages/user/member/filter.wxs
pages/user/member/menber.js renamed to packageD/pages/user/member/menber.js
... | ... | @@ -2,9 +2,9 @@ var e = function (e) { |
2 | 2 | return e && e.__esModule ? e : { |
3 | 3 | default: e |
4 | 4 | }; |
5 | -}(require("../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o, | |
6 | - i = require("../../../utils/util.js"), ut = i, s = require("../../../utils/common.js"), n = new e.default(); | |
7 | -var regeneratorRuntime = require('../../../utils/runtime.js'); | |
5 | +}(require("../../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o, | |
6 | + i = require("../../../../utils/util.js"), ut = i, s = require("../../../../utils/common.js"), n = new e.default(); | |
7 | +var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
8 | 8 | Page({ |
9 | 9 | /** |
10 | 10 | * 页面的初始数据 | ... | ... |
pages/user/member/menber.json renamed to packageD/pages/user/member/menber.json
pages/user/member/menber.wxml renamed to packageD/pages/user/member/menber.wxml
pages/user/member/menber.wxss renamed to packageD/pages/user/member/menber.wxss
pages/cart/cart/cart.js
... | ... | @@ -402,7 +402,7 @@ Page({ |
402 | 402 | }) |
403 | 403 | |
404 | 404 | if (is_g_prom) { |
405 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => { | |
405 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1"+"/"+getApp().globalData.user_id, {}).then(res => { | |
406 | 406 | if (res.data.code == 0) { |
407 | 407 | var r_data = res.data.data; |
408 | 408 | if (!r_data.promGoodsLists) { |
... | ... | @@ -611,7 +611,7 @@ Page({ |
611 | 611 | else if(item.prom_type == 0) { |
612 | 612 | |
613 | 613 | //如果有优惠活动,要更新活动 |
614 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => { | |
614 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1"+"/"+getApp().globalData.user_id, {}).then(res => { | |
615 | 615 | if (res.data.code == 0) { |
616 | 616 | var r_data = res.data.data; |
617 | 617 | if (r_data.promGoodsLists) { |
... | ... | @@ -2482,7 +2482,7 @@ Page({ |
2482 | 2482 | //如果是优惠活动话,要看活动有没有过期 |
2483 | 2483 | if (i_arr[j].prom_type == 3) { |
2484 | 2484 | //判断有没有活动 |
2485 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + i_arr[j].goods_id + "/1", {}).then(res => { | |
2485 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + i_arr[j].goods_id + "/1"+"/"+getApp().globalData.user_id, {}).then(res => { | |
2486 | 2486 | if (res.data.code == 0) { |
2487 | 2487 | if (!res.data.data.promGoodsLists) { |
2488 | 2488 | t.my_warnning(i_arr[j].goods_name + "优惠活动已经过期", 0, th); | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -1802,7 +1802,7 @@ Page({ |
1802 | 1802 | var order_m = 0; |
1803 | 1803 | //---判断是不是有订单优惠--- |
1804 | 1804 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
1805 | - data: { store_id: os.stoid, orderAmount: o_condition } | |
1805 | + data: { store_id: os.stoid, orderAmount: o_condition,user_id:getApp().globalData.user_id} | |
1806 | 1806 | }).then(res => { |
1807 | 1807 | if (res.data.code == 0) { |
1808 | 1808 | var ord_prom = res.data.data; |
... | ... | @@ -4052,7 +4052,7 @@ Page({ |
4052 | 4052 | if (this.data.is_b_now == 1) pick = this.data.bn_pick; |
4053 | 4053 | //---获取订单优惠--- |
4054 | 4054 | getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
4055 | - data: { store_id: os.stoid, orderAmount: condition } | |
4055 | + data: { store_id: os.stoid, orderAmount: condition,user_id:getApp().globalData.user_id } | |
4056 | 4056 | }).then(res => { |
4057 | 4057 | if (res.data.code == 0) { |
4058 | 4058 | var data = res.data.data; | ... | ... |
pages/distribution/distribution.wxml
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | <view> |
15 | 15 | <view class="flex ai-center jc_sb pd2622 bdb arrow-r" bindtap="goto"> |
16 | 16 | <view><text class="iconfont icon-jine pdr10 ctb"></text>可提现金额</view> |
17 | - <view class="ctb money" data-url="/pages/user/member/menber">{{filter.show_default(data.liudong_money)}}</view> | |
17 | + <view class="ctb money" data-url="/packageD/pages/user/member/menber">{{filter.show_default(data.liudong_money)}}</view> | |
18 | 18 | </view> |
19 | 19 | |
20 | 20 | <view class="flex jc_sa t-c"> | ... | ... |
pages/giftpack/buygiftpack/giftpackbuy.js
1 | 1 | var i = require("../../../utils/util.js"); |
2 | +var com = require("../public/buy_com.js"); | |
2 | 3 | var e = getApp(), |
3 | 4 | a = e.globalData.setting, |
4 | 5 | os = a, |
... | ... | @@ -27,6 +28,44 @@ Page({ |
27 | 28 | total: 0, //总数量 |
28 | 29 | ad_data: null, |
29 | 30 | first_leader: e.globalData.first_leader || 0, // 推荐人ID |
31 | + | |
32 | + //门店相关 | |
33 | + ismend: 0, | |
34 | + is_sec_mend: 0, | |
35 | + sto_sele_name: "", //选中的门店名称 | |
36 | + sto_sele_id: "", //选中的门店id | |
37 | + sto_sele_distr: "", //选择的门店的配送方式 | |
38 | + is_show_sto_cat: 1, //是否显示门店分类 | |
39 | + only_pk: null, | |
40 | + all_sto: null, | |
41 | + sec_sto: null, //选择了的门店分类 | |
42 | + pickpu_list: null, //读出的所有门店list | |
43 | + def_pickpu_list: null, //一开始5个门店list | |
44 | + sec_pick_index: 0, //第二级门店选择ID | |
45 | + fir_pick_index: 0, //第一级门店选择ID | |
46 | + all_pick_list: null,//所有的门店先记录起来 | |
47 | + | |
48 | + select_store: 0, //选择更多 | |
49 | + index: 1, | |
50 | + more_store: 0, //选择门店 | |
51 | + sort_store: 0, //门店分类 | |
52 | + choice_sort_store: 0, //选择分类门店 | |
53 | + new_user: 0, //新用户 | |
54 | + | |
55 | + def_pick_store: null, // 默认的门店 | |
56 | + fir_def_store: null, //客户默认的门店的 | |
57 | + lat: null, //维度 | |
58 | + lon: null, //经度 | |
59 | + | |
60 | + is_get_local_ok: 0, //获取坐标是否完成 | |
61 | + region_name: "门店分类", //区域的名字 | |
62 | + is_gps: 1, | |
63 | + open_ind_store: 0, //哪里打开的门店列表的控制属性 | |
64 | + default_store: {}, //创建添加默认门店地址的对象 | |
65 | + | |
66 | + store:0, | |
67 | + openSpecModal:0 | |
68 | + | |
30 | 69 | }, |
31 | 70 | onLoad: function (options) { |
32 | 71 | this.setData({ |
... | ... | @@ -80,6 +119,7 @@ Page({ |
80 | 119 | }, |
81 | 120 | onShow: function () { |
82 | 121 | getApp().check_can_share(); |
122 | + var th=this; | |
83 | 123 | //--先判断会员状态-- |
84 | 124 | getApp().is_Single_page(this, function () { |
85 | 125 | var user_info = getApp().globalData.userInfo; |
... | ... | @@ -87,170 +127,114 @@ Page({ |
87 | 127 | getApp().goto('/pages/togoin/togoin'); |
88 | 128 | return false; |
89 | 129 | } |
130 | + com.wait_for_store_config(th); | |
131 | + com.set_user_mo_store(th,os); | |
132 | + | |
90 | 133 | }) |
91 | 134 | this.init(); |
92 | 135 | }, |
93 | 136 | |
94 | 137 | //购买礼包 |
95 | 138 | GetBuyPrice: function (e) { |
96 | - var that = this.data; | |
139 | + | |
97 | 140 | var th = this; |
98 | - var id = e.currentTarget.dataset.id; //活动id | |
99 | - var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
100 | - var order_sn = e.currentTarget.dataset.order_sn; //订单号 | |
101 | - var money = e.currentTarget.dataset.money; //支付金额 | |
102 | - my_confirm.open( | |
103 | - "是否确定购买该礼包", | |
104 | - "取消", | |
105 | - "确定", | |
106 | - function () { | |
107 | - my_confirm.open_cancel(0); | |
108 | - }, | |
109 | - function () { | |
110 | - my_confirm.open_cancel(0); | |
111 | - var json = { | |
112 | - "actId": '', //活动Id | |
113 | - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | |
114 | - "buyType": '2', //1=积分兑换 2=余额购买 | |
115 | - "giftBagId": id, //礼包Id | |
116 | - "storeId": that.getStorageID, //商家Id | |
117 | - "userId": that.getUserID, //用户ID | |
118 | - "buyFrom": 2, | |
119 | - "first_leader": that.first_leader, | |
120 | - }; | |
141 | + var index = e.currentTarget.dataset.index; //活动id | |
142 | + var sele_g=th.data.wareCard[index]; | |
143 | + this.data.payMoney=sele_g.payMoney; | |
121 | 144 | |
122 | - //-- 分享导购要记录 -- | |
123 | - if (getApp().globalData.guide_id) { | |
124 | - json.guide_id = getApp().globalData.guide_id; | |
145 | + th.setData({sele_g:sele_g,buyType:2,}) | |
146 | + if(sele_g.is_pickup){ | |
147 | + if(sele_g.pickup_list && th.data.def_pick_store){ | |
148 | + com.check_def_pk(th); | |
125 | 149 | } |
126 | - | |
127 | - var data = JSON.stringify(json); | |
128 | - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | |
129 | - getApp().request.json_post(url, json, | |
130 | - function (res) { | |
131 | - if (res.data.code == 0 && res.data.data) { | |
132 | - var order_sn = res.data.data.orderSn; | |
133 | - res = res.data.data.result; | |
134 | - if (!res) return false; | |
135 | - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; | |
136 | - wx.requestPayment({ | |
137 | - timeStamp: String(res.timeStamp), | |
138 | - nonceStr: res.nonceStr, | |
139 | - package: res.packageValue, | |
140 | - signType: res.signType, | |
141 | - paySign: res.paySign, | |
142 | - success: function (res) { | |
143 | - getApp().goto(url); | |
144 | - }, | |
145 | - fail: function (res) { | |
146 | - getApp().my_warnning("取消支付", 0, th); | |
147 | - } | |
148 | - }); | |
149 | - } else { | |
150 | - getApp().my_warnning(res.data.msg, 0, th); | |
150 | + com.get_sto(th,os) | |
151 | + th.setData({ | |
152 | + openSpecModal:1 | |
153 | + }) | |
154 | + }else{ | |
155 | + var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
156 | + my_confirm.open( | |
157 | + "是否确定购买该礼包", | |
158 | + "取消", | |
159 | + "确定", | |
160 | + function () { | |
161 | + my_confirm.open_cancel(0); | |
162 | + }, | |
163 | + function () { | |
164 | + my_confirm.open_cancel(0); | |
165 | + com.buy_libao(th) | |
151 | 166 | } |
152 | - }, | |
153 | - function (res) { | |
154 | - | |
155 | - } | |
156 | 167 | |
157 | 168 | ) |
169 | + } | |
158 | 170 | |
159 | 171 | |
160 | - } | |
161 | 172 | |
162 | - ) | |
163 | 173 | |
164 | 174 | |
165 | 175 | }, |
166 | 176 | // 积分兑换 |
167 | 177 | GetBuyIntegral: function (e) { |
168 | - var that = this.data; | |
169 | - var th = this; | |
170 | - var id = e.currentTarget.dataset.id; //活动id | |
171 | - var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
172 | - | |
173 | - my_confirm.open( | |
174 | - "是否确定兑换该礼包", | |
175 | - "取消", | |
176 | - "确定", | |
177 | - function () { | |
178 | - my_confirm.open_cancel(0); | |
179 | - }, | |
180 | - function () { | |
181 | - my_confirm.open_cancel(0); | |
182 | - var json = { | |
183 | - "actId": '', //活动Id | |
184 | - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | |
185 | - "buyType": '1', //1=积分兑换 2=余额购买 3=免费领取 | |
186 | - "giftBagId": id, //礼包Id | |
187 | - "storeId": that.getStorageID, //商家Id | |
188 | - "userId": that.getUserID, //用户ID | |
189 | - "buyFrom": 2, | |
190 | - "first_leader": that.first_leader | |
191 | - }; | |
192 | - | |
193 | - //-- 分享导购要记录 -- | |
194 | - if (getApp().globalData.guide_id) { | |
195 | - json.guide_id = getApp().globalData.guide_id; | |
196 | - } | |
197 | - console.log(json, 'json'); | |
198 | - var data = JSON.stringify(json); | |
199 | - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | |
200 | - getApp().request.json_post(url, json, | |
201 | - function (res) { | |
202 | - if (res.data.code == 0) { | |
203 | - getApp().my_warnning("兑换成功!", 1, th); | |
204 | - } else { | |
205 | - getApp().my_warnning(res.data.msg, 0, th); | |
206 | - } | |
207 | - }, | |
208 | - function (res) { }) | |
209 | - | |
210 | - }) | |
178 | + var th = this; | |
179 | + var index = e.currentTarget.dataset.index; //活动id | |
180 | + var sele_g=th.data.wareCard[index]; | |
181 | + th.setData({sele_g:sele_g, buyType:1,}) | |
182 | + if(sele_g.is_pickup){ | |
183 | + if(sele_g.pickup_list && th.data.def_pick_store){ | |
184 | + com.check_def_pk(th); | |
185 | + } | |
186 | + com.get_sto(th,os) | |
187 | + th.setData({ | |
188 | + openSpecModal:1 | |
189 | + }) | |
190 | + }else { | |
191 | + var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
192 | + my_confirm.open( | |
193 | + "是否确定兑换该礼包", | |
194 | + "取消", | |
195 | + "确定", | |
196 | + function () { | |
197 | + my_confirm.open_cancel(0); | |
198 | + }, | |
199 | + function () { | |
200 | + my_confirm.open_cancel(0); | |
201 | + com.buy_libao(th) | |
202 | + }) | |
203 | + } | |
211 | 204 | |
212 | 205 | }, |
213 | 206 | //免费领取 |
214 | 207 | GetFree: function (e) { |
215 | - var that = this.data; | |
216 | - var th = this; | |
217 | - var id = e.currentTarget.dataset.id; //活动id | |
218 | - var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
219 | - my_confirm.open( | |
220 | - "是否确定领取该礼包", | |
221 | - "取消", | |
222 | - "确定", | |
223 | - function () { | |
224 | - my_confirm.open_cancel(0); | |
225 | - }, | |
226 | - function () { | |
227 | - my_confirm.open_cancel(0); | |
228 | - var json = { | |
229 | - "actId": '', //活动Id | |
230 | - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | |
231 | - "buyType": '3', //1=积分兑换 2=余额购买 3=免费领取 | |
232 | - "giftBagId": id, //礼包Id | |
233 | - "storeId": that.getStorageID, //商家Id | |
234 | - "userId": that.getUserID, //用户ID | |
235 | - "buyFrom": 2, | |
236 | - "first_leader": that.first_leader | |
237 | - }; | |
238 | - //-- 分享导购要记录 -- | |
239 | - if (getApp().globalData.guide_id) { | |
240 | - json.guide_id = getApp().globalData.guide_id; | |
241 | - } | |
242 | - var data = JSON.stringify(json); | |
243 | - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | |
244 | - getApp().request.json_post(url, json, | |
245 | - function (res) { | |
246 | - if (res.data.code == 0) { | |
247 | - getApp().my_warnning("领取成功!", 1, th); | |
248 | - } else { | |
249 | - getApp().my_warnning(res.data.msg, 0, th); | |
250 | - } | |
251 | - }, | |
252 | - function (res) { }) | |
253 | - }) | |
208 | + | |
209 | + var th = this; | |
210 | + var index = e.currentTarget.dataset.index; //活动id | |
211 | + var sele_g=th.data.wareCard[index]; | |
212 | + th.setData({sele_g:sele_g, buyType:3,}) | |
213 | + | |
214 | + if(sele_g.is_pickup){ | |
215 | + if(sele_g.pickup_list && th.data.def_pick_store){ | |
216 | + com.check_def_pk(th); | |
217 | + } | |
218 | + com.get_sto(th,os) | |
219 | + th.setData({ | |
220 | + openSpecModal:1 | |
221 | + }) | |
222 | + }else { | |
223 | + | |
224 | + | |
225 | + var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
226 | + my_confirm.open( | |
227 | + "是否确定领取该礼包", | |
228 | + "取消", | |
229 | + "确定", | |
230 | + function () { | |
231 | + my_confirm.open_cancel(0); | |
232 | + }, | |
233 | + function () { | |
234 | + my_confirm.open_cancel(0); | |
235 | + com.buy_libao(th) | |
236 | + }) | |
237 | + } | |
254 | 238 | }, |
255 | 239 | |
256 | 240 | getList: function (e) { |
... | ... | @@ -327,6 +311,7 @@ Page({ |
327 | 311 | }, |
328 | 312 | |
329 | 313 | onShareAppMessage: function (e) { |
314 | + getApp().globalData.no_clear=1; | |
330 | 315 | var curPage = this; |
331 | 316 | var pagePath = curPage.route; //当前页面url |
332 | 317 | if (pagePath.indexOf('/') != 0) { |
... | ... | @@ -341,6 +326,7 @@ Page({ |
341 | 326 | |
342 | 327 | // 分享朋友圈 |
343 | 328 | onShareTimeline() { |
329 | + getApp().globalData.no_clear=1; | |
344 | 330 | var curPage = this; |
345 | 331 | var pagePath = curPage.route; //当前页面url |
346 | 332 | if (pagePath.indexOf('/') != 0) { |
... | ... | @@ -354,4 +340,271 @@ Page({ |
354 | 340 | } |
355 | 341 | }, |
356 | 342 | |
343 | + | |
344 | + //--- 设置一下默认库存的数量 ---- | |
345 | + set_def_storage(ee) { | |
346 | + var that = this, th = this; | |
347 | + that.data.fir_def_store = ee; | |
348 | + that.setData({ | |
349 | + def_pick_store: ee, | |
350 | + sto_sele_name: ee.pickup_name, | |
351 | + sto_sele_id: ee.pickup_id, | |
352 | + sto_sele_distr: ee.distr_type | |
353 | + }) | |
354 | + }, | |
355 | + // 选择门店 | |
356 | + choice_store: function (ee) { | |
357 | + var th = this; | |
358 | + var ind = ee.currentTarget.dataset.ind; | |
359 | + var bconfig = th.data.bconfig; | |
360 | + | |
361 | + if (!th.data.only_pk && !th.data.def_pickpu_list) { | |
362 | + getApp().confirmBox("门店库存不足", null, 25000, !1); | |
363 | + return false; | |
364 | + } | |
365 | + | |
366 | + if (th.data.only_pk && !th.data.only_pk.length) { | |
367 | + getApp().confirmBox("门店库存不足", null, 25000, !1); | |
368 | + return false; | |
369 | + } | |
370 | + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) { | |
371 | + getApp().confirmBox("门店库存不足", null, 25000, !1); | |
372 | + return false; | |
373 | + } | |
374 | + | |
375 | + | |
376 | + if (bconfig && bconfig.is_sort_storage) { | |
377 | + wx.getLocation({ | |
378 | + type: 'gcj02', | |
379 | + success: function (res) { | |
380 | + | |
381 | + th.data.lat = res.latitude; | |
382 | + th.data.lon = res.longitude; | |
383 | + th.data.is_get_local_ok = 1; | |
384 | + th.setData({ | |
385 | + is_gps: 1 | |
386 | + }); | |
387 | + //th.onShow(); | |
388 | + com.get_sto(th,os); | |
389 | + }, | |
390 | + fail: function (res) { | |
391 | + //th.onShow(); | |
392 | + th.data.is_get_local_ok = 1; | |
393 | + com.get_sto(th,os); | |
394 | + if (res.errCode == 2) { | |
395 | + th.setData({ | |
396 | + is_gps: 0 | |
397 | + }); | |
398 | + if (th.data.is_gps == 0) { | |
399 | + getApp().confirmBox("请开启GPS定位", null, 25000, !1); | |
400 | + } | |
401 | + } else { | |
402 | + th.setData({ | |
403 | + is_gps: "3" | |
404 | + }); | |
405 | + } | |
406 | + | |
407 | + } | |
408 | + }) | |
409 | + } else { | |
410 | + th.data.is_get_local_ok = 1; | |
411 | + com.get_sto(th,os); | |
412 | + } | |
413 | + | |
414 | + if (ind != undefined && ind != null) { | |
415 | + this.setData({ | |
416 | + open_ind_store: ind, | |
417 | + store: 1, | |
418 | + openSpecModal: !1, | |
419 | + openSpecModal_pt: !1, | |
420 | + openSpecModal_flash_normal: !1, | |
421 | + }) | |
422 | + } else { | |
423 | + this.setData({ | |
424 | + store: 1, | |
425 | + openSpecModal: !1, | |
426 | + openSpecModal_pt: !1, | |
427 | + openSpecModal_flash_normal: !1 | |
428 | + | |
429 | + }) | |
430 | + } | |
431 | + }, | |
432 | + //关闭选择门店 | |
433 | + close_popup: function (e) { | |
434 | + var th = this; | |
435 | + this.setData({ | |
436 | + store: 0, | |
437 | + choice_sort_store: 0, | |
438 | + sort_store: 0, | |
439 | + fir_pick_index: 0, | |
440 | + sec_pick_index: 0 | |
441 | + }) | |
442 | + | |
443 | + var openindstore = this.data.open_ind_store; | |
444 | + if (openindstore == 1) { | |
445 | + th.setData({ | |
446 | + openSpecModal: !0, | |
447 | + openSpecModal_ind: openindstore, | |
448 | + }); | |
449 | + } else if (openindstore == 2) { | |
450 | + th.setData({ | |
451 | + openSpecModal: !0, | |
452 | + openSpecModal_ind: openindstore, | |
453 | + }); | |
454 | + } | |
455 | + else if (openindstore == 4) { //4就是拼团 | |
456 | + th.setData({ | |
457 | + openSpecModal_pt: 1, //打开拼团购买界面 | |
458 | + store: 0, //关闭门店 | |
459 | + choice_sort_store: 0, //关闭门店2级 | |
460 | + sort_store: 0, //关闭门店2级 | |
461 | + }); | |
462 | + } | |
463 | + else { | |
464 | + th.setData({ | |
465 | + store: 0, | |
466 | + choice_sort_store: 0, | |
467 | + sort_store: 0 | |
468 | + }) | |
469 | + } | |
470 | + | |
471 | + | |
472 | + }, | |
473 | + | |
474 | + //选择更多门店 | |
475 | + more_store: function () { | |
476 | + this.setData({ | |
477 | + sort_store: 1 | |
478 | + }); | |
479 | + }, | |
480 | + // 返回按钮 | |
481 | + returns: function () { | |
482 | + this.setData({ | |
483 | + sort_store: 0, | |
484 | + choice_sort_store: 0 | |
485 | + }); | |
486 | + }, | |
487 | + //---选择分类门店--- | |
488 | + choice_sort_store: function (e) { | |
489 | + var index = e.currentTarget.dataset.index; | |
490 | + var region_name = e.currentTarget.dataset.region; | |
491 | + var item = this.data.all_sto[index]; | |
492 | + this.setData({ | |
493 | + region_name: region_name, | |
494 | + sort_store: 0, | |
495 | + choice_sort_store: 1, | |
496 | + sec_sto: item, | |
497 | + sec_pick_index: 0 | |
498 | + }); | |
499 | + }, | |
500 | + | |
501 | + choose_for_store_fir: function (e) { | |
502 | + var index_c = e.currentTarget.dataset.ind; | |
503 | + var th = this; | |
504 | + th.setData({ | |
505 | + fir_pick_index: index_c | |
506 | + }) | |
507 | + | |
508 | + }, | |
509 | + | |
510 | + //确定def_pick为选择的门店 | |
511 | + sure_pick: function (e) { | |
512 | + var th = this; | |
513 | + var item = null; | |
514 | + var openindstore = th.data.open_ind_store; | |
515 | + | |
516 | + if (th.data.choice_sort_store == 0) { | |
517 | + var index = th.data.fir_pick_index; | |
518 | + if (th.data.is_show_sto_cat == 1) { | |
519 | + item = th.data.def_pickpu_list[index]; | |
520 | + } else { | |
521 | + item = th.data.only_pk[index]; //当没有门店分类的时候 | |
522 | + } | |
523 | + | |
524 | + } else { | |
525 | + var index = th.data.sec_pick_index; | |
526 | + item = th.data.sec_sto.s_arr[index]; | |
527 | + } | |
528 | + | |
529 | + if (!th.data.sele_g) return false; | |
530 | + | |
531 | + th.setData({ | |
532 | + def_pick_store: item, | |
533 | + sto_sele_name: item.pickup_name, | |
534 | + sto_sele_id: item.pickup_id, | |
535 | + sto_sele_distr: item.distr_type, | |
536 | + store: 0, | |
537 | + choice_sort_store: 0, | |
538 | + fir_pick_index: 0, | |
539 | + openSpecModal: !0, | |
540 | + }); | |
541 | + | |
542 | + | |
543 | + }, | |
544 | + //---点击二级之后的选择--- | |
545 | + choose_for_store: function (e) { | |
546 | + var index_c = e.currentTarget.dataset.ind; | |
547 | + var th = this; | |
548 | + th.setData({ | |
549 | + sec_pick_index: index_c, | |
550 | + fir_pick_index: index_c | |
551 | + }) | |
552 | + | |
553 | + }, | |
554 | + //把选择的门店设置成默认的门店def_pick | |
555 | + set_def_pick: function (e) { | |
556 | + var th = this; | |
557 | + var item = null; | |
558 | + if (th.data.choice_sort_store == 0) { | |
559 | + var index = th.data.fir_pick_index; | |
560 | + if (th.data.is_show_sto_cat == 1) { | |
561 | + item = th.data.def_pickpu_list[index]; | |
562 | + } else { | |
563 | + item = th.data.only_pk[index]; //当没有门店分类的时候 | |
564 | + } | |
565 | + } else { | |
566 | + var index = th.data.sec_pick_index; | |
567 | + item = th.data.sec_sto.s_arr[index]; | |
568 | + } | |
569 | + | |
570 | + th.setData({ | |
571 | + def_pick_store: item, | |
572 | + sto_sele_name: item.pickup_name, | |
573 | + sto_sele_id: item.pickup_id, | |
574 | + sto_sele_distr: item.distr_type, | |
575 | + store: 0, | |
576 | + choice_sort_store: 0, | |
577 | + openSpecModal: !0, | |
578 | + }); | |
579 | + | |
580 | + var user_id=getApp().globalData.user_id; | |
581 | + var def_pickup_id = item.pickup_id; | |
582 | + getApp().request.put('/api/weshop/users/update', { | |
583 | + data: { | |
584 | + user_id: user_id, | |
585 | + def_pickup_id: def_pickup_id | |
586 | + }, | |
587 | + success: function (res) { | |
588 | + if (res.data.code == 0) { | |
589 | + if (th.data.choice_sort_store == 0) th.setData({ | |
590 | + fir_pick_index: 0 | |
591 | + }); | |
592 | + getApp().globalData.pk_store = item; | |
593 | + } else { | |
594 | + getApp().my_warnning("设置默认门店地址失败", 0, th) | |
595 | + } | |
596 | + | |
597 | + } | |
598 | + }); | |
599 | + | |
600 | + | |
601 | + | |
602 | + }, | |
603 | + closeSpecModal: function () { | |
604 | + this.setData({openSpecModal: 0}); | |
605 | + }, | |
606 | + | |
607 | + buy_libao:function () { | |
608 | + com.buy_libao(this) | |
609 | + } | |
357 | 610 | }) |
358 | 611 | \ No newline at end of file | ... | ... |
pages/giftpack/buygiftpack/giftpackbuy.wxml
... | ... | @@ -62,30 +62,30 @@ |
62 | 62 | <view class="flex-vertical"> |
63 | 63 | <block wx:if="{{items.payMoney>0 && items.payIntegral>0}}"> |
64 | 64 | <block wx:if="{{items.payMoney>0}}"> |
65 | - <view class="flex" bindtap="GetBuyPrice" data-id="{{items.lbId}}" data-money="{{items.payMoney}}"> | |
65 | + <view class="flex" bindtap="GetBuyPrice" data-index="{{index}}"> | |
66 | 66 | <button class="box_button_dui">立即购买</button> |
67 | 67 | </view> |
68 | 68 | </block> |
69 | 69 | <block wx:if="{{items.payIntegral>0}}"> |
70 | - <view class="flex" bindtap="GetBuyIntegral" data-id="{{items.lbId}}"> | |
70 | + <view class="flex" bindtap="GetBuyIntegral" data-index="{{index}}"> | |
71 | 71 | <button class="box_button_dui box_button_buy">立即兑换</button> |
72 | 72 | </view> |
73 | 73 | </block> |
74 | 74 | </block> |
75 | 75 | <block wx:else> |
76 | 76 | <block wx:if="{{items.payMoney>0}}"> |
77 | - <view class="flex" bindtap="GetBuyPrice" data-id="{{items.lbId}}" data-money="{{items.payMoney}}"> | |
77 | + <view class="flex" bindtap="GetBuyPrice" data-index="{{index}}"> | |
78 | 78 | <button class="box_button_dui box_button_buy">立即购买</button> |
79 | 79 | </view> |
80 | 80 | </block> |
81 | 81 | <block wx:if="{{items.payIntegral>0}}"> |
82 | - <view class="flex" bindtap="GetBuyIntegral" data-id="{{items.lbId}}"> | |
82 | + <view class="flex" bindtap="GetBuyIntegral" data-index="{{index}}"> | |
83 | 83 | <button class="box_button_dui box_button_buy">立即兑换</button> |
84 | 84 | </view> |
85 | 85 | </block> |
86 | 86 | </block> |
87 | 87 | <block wx:if="{{!items.payMoney && !items.payIntegral}}"> |
88 | - <view class="flex" bindtap="GetFree" data-id="{{items.lbId}}"> | |
88 | + <view class="flex" bindtap="GetFree" data-index="{{index}}"> | |
89 | 89 | <button class="box_button_dui box_button_buy">免费领取</button> |
90 | 90 | </view> |
91 | 91 | </block> |
... | ... | @@ -116,4 +116,6 @@ |
116 | 116 | </view> |
117 | 117 | <!-- 引入提示组件 --> |
118 | 118 | <warn id="warn"></warn> |
119 | -<my_confirm id="my_confirm"></my_confirm> | |
120 | 119 | \ No newline at end of file |
120 | +<my_confirm id="my_confirm"></my_confirm> | |
121 | + | |
122 | +<include src="../public/buy_com.wxml"></include> | |
121 | 123 | \ No newline at end of file | ... | ... |
pages/giftpack/buygiftpack/giftpackbuy.wxss
pages/giftpack/giftpacklist/giftpacklist.js
... | ... | @@ -4,6 +4,7 @@ var e = getApp(), |
4 | 4 | t = e.request, |
5 | 5 | d = e.globalData; |
6 | 6 | var ut = require("../../../utils/util.js"); |
7 | +var com = require("../public/buy_com.js"); | |
7 | 8 | |
8 | 9 | Page({ |
9 | 10 | data: { |
... | ... | @@ -30,6 +31,43 @@ Page({ |
30 | 31 | is_lb: 0, //是否有礼包 |
31 | 32 | default_color: null, |
32 | 33 | first_leader: e.globalData.first_leader || 0, // 推荐人ID |
34 | + | |
35 | + //门店相关 | |
36 | + ismend: 0, | |
37 | + is_sec_mend: 0, | |
38 | + sto_sele_name: "", //选中的门店名称 | |
39 | + sto_sele_id: "", //选中的门店id | |
40 | + sto_sele_distr: "", //选择的门店的配送方式 | |
41 | + is_show_sto_cat: 1, //是否显示门店分类 | |
42 | + only_pk: null, | |
43 | + all_sto: null, | |
44 | + sec_sto: null, //选择了的门店分类 | |
45 | + pickpu_list: null, //读出的所有门店list | |
46 | + def_pickpu_list: null, //一开始5个门店list | |
47 | + sec_pick_index: 0, //第二级门店选择ID | |
48 | + fir_pick_index: 0, //第一级门店选择ID | |
49 | + all_pick_list: null,//所有的门店先记录起来 | |
50 | + | |
51 | + select_store: 0, //选择更多 | |
52 | + index: 1, | |
53 | + more_store: 0, //选择门店 | |
54 | + sort_store: 0, //门店分类 | |
55 | + choice_sort_store: 0, //选择分类门店 | |
56 | + new_user: 0, //新用户 | |
57 | + | |
58 | + def_pick_store: null, // 默认的门店 | |
59 | + fir_def_store: null, //客户默认的门店的 | |
60 | + lat: null, //维度 | |
61 | + lon: null, //经度 | |
62 | + | |
63 | + is_get_local_ok: 0, //获取坐标是否完成 | |
64 | + region_name: "门店分类", //区域的名字 | |
65 | + is_gps: 1, | |
66 | + open_ind_store: 0, //哪里打开的门店列表的控制属性 | |
67 | + default_store: {}, //创建添加默认门店地址的对象 | |
68 | + | |
69 | + store:0, | |
70 | + openSpecModal:0 | |
33 | 71 | }, |
34 | 72 | onLoad: function (options) { |
35 | 73 | this.setData({ |
... | ... | @@ -37,7 +75,7 @@ Page({ |
37 | 75 | }) |
38 | 76 | }, |
39 | 77 | init(){ |
40 | - let options = this.data?.params; | |
78 | + let options = this.data?.params; // this.data == null ? undefined:this.data.params | |
41 | 79 | var th = this; |
42 | 80 | this.setData({ |
43 | 81 | getUserID: d.user_id, |
... | ... | @@ -47,6 +85,7 @@ Page({ |
47 | 85 | isBuy: options.isBuy, |
48 | 86 | getGiftID: options.lbId, |
49 | 87 | orderSn: options.orderSn, |
88 | + flag: options.flag, // 如果从商品详情页的促销处点击专享礼包跳转到此页,则flag为1 | |
50 | 89 | }) |
51 | 90 | if (options.lbId) th.data.lbId = options.lbId; |
52 | 91 | //-- 获取分享人的ID -- |
... | ... | @@ -65,11 +104,17 @@ Page({ |
65 | 104 | }) |
66 | 105 | } |
67 | 106 | th.close(); |
68 | - if (this.data.isBuy == 0) { | |
69 | - this.GetMyGiftList(); | |
70 | - } else { | |
71 | - this.GetBuyGiftList(); | |
72 | - } | |
107 | + | |
108 | + | |
109 | + if(this.data.flag == 1) { | |
110 | + this.getZxlbDetails(); | |
111 | + } else { | |
112 | + if (this.data.isBuy == 0) { | |
113 | + this.GetMyGiftList(); | |
114 | + } else if (this.data.isBuy == 1) { | |
115 | + this.GetBuyGiftList(); | |
116 | + }; | |
117 | + }; | |
73 | 118 | }, |
74 | 119 | |
75 | 120 | onShow: function () { |
... | ... | @@ -87,81 +132,37 @@ Page({ |
87 | 132 | GetBuyPrice: function (e) { |
88 | 133 | var that = this.data; |
89 | 134 | var th = this; |
90 | - // var id = e.currentTarget.dataset.id;//活动id | |
91 | 135 | //如果还没有开始的话 |
92 | 136 | if (th.data.isStart != 1) { |
93 | 137 | getApp().my_warnning("活动还没有开始", 0, th); |
94 | 138 | return false; |
95 | 139 | } |
96 | 140 | |
97 | - | |
98 | - var money = e.currentTarget.dataset.money; | |
99 | - var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
100 | - my_confirm.open( | |
101 | - "是否确定购买该礼包", | |
102 | - "取消", | |
103 | - "确定", | |
104 | - function () { | |
105 | - my_confirm.open_cancel(0); | |
106 | - }, | |
107 | - function () { | |
108 | - my_confirm.open_cancel(0); | |
109 | - | |
110 | - var json = { | |
111 | - "actId": '', //活动Id | |
112 | - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | |
113 | - "buyType": '2', //1=积分兑换 2=余额购买 | |
114 | - "giftBagId": that.getGiftID, //礼包Id | |
115 | - "storeId": a.stoid, //商家Id | |
116 | - "userId": d.user_id, //用户ID | |
117 | - "buyFrom": 2, | |
118 | - "first_leader": that.first_leader, | |
119 | - }; | |
120 | - | |
121 | - //-- 分享导购要记录 -- | |
122 | - if (getApp().globalData.guide_id) { | |
123 | - json.guide_id = getApp().globalData.guide_id; | |
124 | - } | |
125 | - | |
126 | - var data = JSON.stringify(json); | |
127 | - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | |
128 | - | |
129 | - getApp().request.json_post(url, json, | |
130 | - function (res) { | |
131 | - if (res.data.code == 0) { | |
132 | - var res = res.data.data; | |
133 | - if (!res) return false; | |
134 | - if (!res.result) return false; | |
135 | - | |
136 | - var order_sn = res.orderSn; | |
137 | - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; | |
138 | - wx.requestPayment({ | |
139 | - timeStamp: String(res.result.timeStamp), | |
140 | - nonceStr: res.result.nonceStr, | |
141 | - package: res.result.packageValue, | |
142 | - signType: res.result.signType, | |
143 | - paySign: res.result.paySign, | |
144 | - success: function (n) { | |
145 | - getApp().goto(url); | |
146 | - }, | |
147 | - fail: function (n) { | |
148 | - getApp().my_warnning("取消支付", 0, th); | |
149 | - } | |
150 | - }); | |
151 | - } else { | |
152 | - getApp().my_warnning(res.data.msg, 0, th); | |
141 | + this.data.payMoney=th.data.sele_g.payMoney; | |
142 | + th.setData({ buyType:2 }) | |
143 | + if(th.data.sele_g.is_pickup){ | |
144 | + th.setData({ | |
145 | + openSpecModal:1 | |
146 | + }) | |
147 | + }else{ | |
148 | + var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
149 | + my_confirm.open( | |
150 | + "是否确定购买该礼包", | |
151 | + "取消", | |
152 | + "确定", | |
153 | + function () { | |
154 | + my_confirm.open_cancel(0); | |
155 | + }, | |
156 | + function () { | |
157 | + my_confirm.open_cancel(0); | |
158 | + com.buy_libao(th) | |
153 | 159 | } |
154 | - }, | |
155 | - function (res) { | |
156 | - | |
157 | - } | |
158 | 160 | |
159 | 161 | ) |
162 | + } | |
160 | 163 | |
161 | 164 | |
162 | - } | |
163 | 165 | |
164 | - ) | |
165 | 166 | |
166 | 167 | }, |
167 | 168 | GetBuyIntegral: function (e) { |
... | ... | @@ -173,48 +174,28 @@ Page({ |
173 | 174 | getApp().my_warnning("活动还没有开始", 0, th); |
174 | 175 | return false; |
175 | 176 | } |
176 | - // var id = e.currentTarget.dataset.id;//活动id | |
177 | - var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
178 | - my_confirm.open( | |
179 | - "是否确定兑换该礼包", | |
180 | - "取消", | |
181 | - "确定", | |
182 | - function () { | |
183 | - my_confirm.open_cancel(0); | |
184 | - }, | |
185 | - function () { | |
186 | - my_confirm.open_cancel(0); | |
187 | - var json = { | |
188 | - "actId": '', //活动Id | |
189 | - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | |
190 | - "buyType": '1', //1=积分兑换 2=余额购买 | |
191 | - "giftBagId": that.getGiftID, //礼包Id | |
192 | - "storeId": a.stoid, //商家ID | |
193 | - "userId": d.user_id, //用户ID | |
194 | - "buyFrom": 2, | |
195 | - "first_leader": that.first_leader, | |
196 | - }; | |
197 | - //-- 分享导购要记录 -- | |
198 | - if (getApp().globalData.guide_id) { | |
199 | - json.guide_id = getApp().globalData.guide_id; | |
200 | - } | |
201 | 177 | |
202 | - var data = JSON.stringify(json); | |
203 | - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | |
204 | - getApp().request.json_post(url, json, | |
205 | - function (res) { | |
206 | - if (res.data.code == 0) { | |
207 | - getApp().my_warnning("兑换成功!", 1, th); | |
208 | - } else { | |
209 | - getApp().my_warnning(res.data.msg, 0, th); | |
210 | - } | |
211 | - }, | |
212 | - function (res) { | |
178 | + th.setData({ buyType:1 }); | |
179 | + if(th.data.sele_g.is_pickup){ | |
180 | + th.setData({ | |
181 | + openSpecModal:1 | |
182 | + }) | |
183 | + }else { | |
184 | + var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
185 | + my_confirm.open( | |
186 | + "是否确定兑换该礼包", | |
187 | + "取消", | |
188 | + "确定", | |
189 | + function () { | |
190 | + my_confirm.open_cancel(0); | |
191 | + }, | |
192 | + function () { | |
193 | + my_confirm.open_cancel(0); | |
194 | + com.buy_libao(th) | |
195 | + }) | |
196 | + } | |
213 | 197 | |
214 | - } | |
215 | 198 | |
216 | - ) | |
217 | - }) | |
218 | 199 | |
219 | 200 | |
220 | 201 | }, |
... | ... | @@ -280,6 +261,19 @@ Page({ |
280 | 261 | break; |
281 | 262 | } |
282 | 263 | } |
264 | + | |
265 | + if(res.data.data.pickup_id){ | |
266 | + getApp().request.get("/api/weshop/pickup/get/"+os.stoid+"/"+res.data.data.pickup_id,{ | |
267 | + success: function (res) { | |
268 | + if(res.data.code==0){ | |
269 | + th.setData({pick_up:res.data.data}); | |
270 | + } | |
271 | + } | |
272 | + }); | |
273 | + | |
274 | + } | |
275 | + | |
276 | + | |
283 | 277 | } else { |
284 | 278 | getApp().my_warnning(res.data.msg, 0, th); |
285 | 279 | return false; |
... | ... | @@ -334,7 +328,20 @@ Page({ |
334 | 328 | actTitle: res.data.data.actTitle, |
335 | 329 | wareCard: res.data.data.wareCard, |
336 | 330 | isStart: isStart, |
331 | + sele_g:res.data.data | |
337 | 332 | }) |
333 | + | |
334 | + | |
335 | + var sele_g=res.data.data; | |
336 | + com.wait_for_store_config(_this2); | |
337 | + com.set_user_mo_store(_this2,os,function () { | |
338 | + if(sele_g.pickup_list && _this2.data.def_pick_store){ | |
339 | + com.check_def_pk(_this2); | |
340 | + } | |
341 | + }); | |
342 | + com.get_sto(_this2,os); | |
343 | + | |
344 | + | |
338 | 345 | } else { |
339 | 346 | getApp().my_warnning(res.data.msg, 0, _this2); |
340 | 347 | return false; |
... | ... | @@ -343,6 +350,84 @@ Page({ |
343 | 350 | }); |
344 | 351 | |
345 | 352 | }, |
353 | + | |
354 | + getZxlbDetails: function () { | |
355 | + | |
356 | + var th = this; | |
357 | + getApp().request.get('/api/weshop/marketing/giftbag/detail/getNew', { | |
358 | + isShowLoading: true, | |
359 | + data: { | |
360 | + "storeId": a.stoid, //商家ID | |
361 | + //"userId": d.user_id, //用户ID | |
362 | + "giftBagId": th.data.lbId | |
363 | + }, | |
364 | + success: function (res) { | |
365 | + if (res.data.code == 0) { | |
366 | + th.setData({ | |
367 | + giftImage: th.data.iurl + res.data.data.lbUrl, | |
368 | + giftTitle: res.data.data.lbTitle, | |
369 | + default_color: res.data.data.bgcolor | |
370 | + }) | |
371 | + if (res.data.data.lbIntro == '') { | |
372 | + th.setData({ | |
373 | + giftRemark: '暂无详情......' | |
374 | + }) | |
375 | + } else { | |
376 | + th.setData({ | |
377 | + giftRemark: res.data.data.lbIntro.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"') | |
378 | + }) | |
379 | + } | |
380 | + | |
381 | + //---获取日期的时间戳--- | |
382 | + let exchangeType = res.data.data.exchangeType; | |
383 | + let exchangeDay = res.data.data.exchangeDay; | |
384 | + let exchangeStartTime = res.data.data.exchangeStartTime; | |
385 | + let exchangeEndTime = res.data.data.exchangeEndTime; | |
386 | + // let t_endtime; | |
387 | + | |
388 | + if(exchangeType == 2) { | |
389 | + if(exchangeStartTime == 0 || !exchangeStartTime) { | |
390 | + exchangeStartTime = ut.gettimestamp(); | |
391 | + }; | |
392 | + exchangeStartTime = ut.formatTime(exchangeStartTime, 0); | |
393 | + exchangeEndTime = ut.formatTime(exchangeEndTime, 0); | |
394 | + } | |
395 | + | |
396 | + | |
397 | + th.setData({ | |
398 | + // giftDate: t_endtime, | |
399 | + giftPosPrice: res.data.data.oldPrice, | |
400 | + giftQty: res.data.data.lbNum, | |
401 | + giftIntegral: res.data.data.exchangeIntegral, | |
402 | + giftPrice: res.data.data.lbPrice, | |
403 | + giftType: res.data.data.actType, | |
404 | + actTitle: res.data.data.actTitle, | |
405 | + wareCard: res.data.data.wareCard, | |
406 | + lbId: res.data.data.lbId, | |
407 | + exchangeType: exchangeType, | |
408 | + exchangeDay: exchangeDay, | |
409 | + exchangeStartTime: exchangeStartTime, | |
410 | + exchangeEndTime: exchangeEndTime, | |
411 | + }) | |
412 | + //判断是否有礼包 | |
413 | + for (var i = 0; i < res.data.data.wareCard.length; i++) { | |
414 | + if (res.data.data.wareCard[i].lbType == 1) { | |
415 | + th.setData({ | |
416 | + is_lb: 1 | |
417 | + }) | |
418 | + break; | |
419 | + } | |
420 | + } | |
421 | + } else { | |
422 | + getApp().my_warnning(res.data.msg, 0, th); | |
423 | + return false; | |
424 | + } | |
425 | + } | |
426 | + }); | |
427 | + | |
428 | + }, | |
429 | + | |
430 | + | |
346 | 431 | //显示核销码 |
347 | 432 | code_show: function (e) { |
348 | 433 | var th = this; |
... | ... | @@ -421,6 +506,7 @@ Page({ |
421 | 506 | |
422 | 507 | //--- 分享设置 -- |
423 | 508 | onShareAppMessage: function (e) { |
509 | + getApp().globalData.no_clear=1; | |
424 | 510 | var curPage = this; |
425 | 511 | var pagePath = curPage.route; //当前页面url |
426 | 512 | if (pagePath.indexOf('/') != 0) { |
... | ... | @@ -443,6 +529,7 @@ Page({ |
443 | 529 | * 用户分享朋友圈 |
444 | 530 | */ |
445 | 531 | onShareTimeline() { |
532 | + getApp().globalData.no_clear=1; | |
446 | 533 | var curPage = this; |
447 | 534 | var pagePath = curPage.route; //当前页面url |
448 | 535 | if (pagePath.indexOf('/') != 0) { |
... | ... | @@ -471,50 +558,298 @@ Page({ |
471 | 558 | getApp().my_warnning("活动还没有开始", 0, th); |
472 | 559 | return false; |
473 | 560 | } |
474 | - // var id = e.currentTarget.dataset.id;//活动id | |
475 | - var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
476 | - my_confirm.open( | |
477 | - "是否确定领取该礼包", | |
478 | - "取消", | |
479 | - "确定", | |
480 | - function () { | |
481 | - my_confirm.open_cancel(0); | |
482 | - }, | |
483 | - function () { | |
484 | - my_confirm.open_cancel(0); | |
485 | - var json = { | |
486 | - "actId": '', //活动Id | |
487 | - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | |
488 | - "buyType": '3', //1=积分兑换 2=余额购买 | |
489 | - "giftBagId": that.getGiftID, //礼包Id | |
490 | - "storeId": a.stoid, //商家ID | |
491 | - "userId": d.user_id, //用户ID | |
492 | - "buyFrom": 2, | |
493 | - "first_leader": that.first_leader, | |
494 | - }; | |
495 | - | |
496 | - //-- 分享导购要记录 -- | |
497 | - if (getApp().globalData.guide_id) { | |
498 | - json.guide_id = getApp().globalData.guide_id; | |
561 | + | |
562 | + th.setData({ buyType:3 }); | |
563 | + if(th.data.sele_g.is_pickup){ | |
564 | + th.setData({ | |
565 | + openSpecModal:1 | |
566 | + }) | |
567 | + }else { | |
568 | + | |
569 | + | |
570 | + // var id = e.currentTarget.dataset.id;//活动id | |
571 | + var my_confirm = th.selectComponent("#my_confirm"); //组件的id | |
572 | + my_confirm.open( | |
573 | + "是否确定领取该礼包", | |
574 | + "取消", | |
575 | + "确定", | |
576 | + function () { | |
577 | + my_confirm.open_cancel(0); | |
578 | + }, | |
579 | + function () { | |
580 | + my_confirm.open_cancel(0); | |
581 | + com.buy_libao(th) | |
582 | + }) | |
583 | + } | |
584 | + | |
585 | + | |
586 | + }, | |
587 | + | |
588 | + //--- 设置一下默认库存的数量 ---- | |
589 | + set_def_storage(ee) { | |
590 | + var that = this, th = this; | |
591 | + that.data.fir_def_store = ee; | |
592 | + | |
593 | + that.setData({ | |
594 | + def_pick_store: ee, | |
595 | + sto_sele_name: ee.pickup_name, | |
596 | + sto_sele_id: ee.pickup_id, | |
597 | + sto_sele_distr: ee.distr_type | |
598 | + }) | |
599 | + }, | |
600 | + // 选择门店 | |
601 | + choice_store: function (ee) { | |
602 | + var th = this; | |
603 | + var ind = ee.currentTarget.dataset.ind; | |
604 | + var bconfig = th.data.bconfig; | |
605 | + | |
606 | + if (!th.data.only_pk && !th.data.def_pickpu_list) { | |
607 | + getApp().confirmBox("门店库存不足", null, 25000, !1); | |
608 | + return false; | |
609 | + } | |
610 | + | |
611 | + if (th.data.only_pk && !th.data.only_pk.length) { | |
612 | + getApp().confirmBox("门店库存不足", null, 25000, !1); | |
613 | + return false; | |
614 | + } | |
615 | + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) { | |
616 | + getApp().confirmBox("门店库存不足", null, 25000, !1); | |
617 | + return false; | |
618 | + } | |
619 | + | |
620 | + | |
621 | + if (bconfig && bconfig.is_sort_storage) { | |
622 | + wx.getLocation({ | |
623 | + type: 'gcj02', | |
624 | + success: function (res) { | |
625 | + | |
626 | + th.data.lat = res.latitude; | |
627 | + th.data.lon = res.longitude; | |
628 | + th.data.is_get_local_ok = 1; | |
629 | + th.setData({ | |
630 | + is_gps: 1 | |
631 | + }); | |
632 | + //th.onShow(); | |
633 | + com.get_sto(th,os); | |
634 | + }, | |
635 | + fail: function (res) { | |
636 | + //th.onShow(); | |
637 | + th.data.is_get_local_ok = 1; | |
638 | + com.get_sto(th,os); | |
639 | + if (res.errCode == 2) { | |
640 | + th.setData({ | |
641 | + is_gps: 0 | |
642 | + }); | |
643 | + if (th.data.is_gps == 0) { | |
644 | + getApp().confirmBox("请开启GPS定位", null, 25000, !1); | |
645 | + } | |
646 | + } else { | |
647 | + th.setData({ | |
648 | + is_gps: "3" | |
649 | + }); | |
650 | + } | |
651 | + | |
652 | + } | |
653 | + }) | |
654 | + } else { | |
655 | + th.data.is_get_local_ok = 1; | |
656 | + com.get_sto(th,os); | |
499 | 657 | } |
500 | 658 | |
501 | - var data = JSON.stringify(json); | |
502 | - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; | |
503 | - getApp().request.json_post(url, json, | |
504 | - function (res) { | |
505 | - if (res.data.code == 0) { | |
506 | - getApp().my_warnning("领取成功!", 1, th); | |
659 | + if (ind != undefined && ind != null) { | |
660 | + this.setData({ | |
661 | + open_ind_store: ind, | |
662 | + store: 1, | |
663 | + openSpecModal: !1, | |
664 | + openSpecModal_pt: !1, | |
665 | + openSpecModal_flash_normal: !1, | |
666 | + }) | |
667 | + } else { | |
668 | + this.setData({ | |
669 | + store: 1, | |
670 | + openSpecModal: !1, | |
671 | + openSpecModal_pt: !1, | |
672 | + openSpecModal_flash_normal: !1 | |
673 | + | |
674 | + }) | |
675 | + } | |
676 | + }, | |
677 | + //关闭选择门店 | |
678 | + close_popup: function (e) { | |
679 | + var th = this; | |
680 | + this.setData({ | |
681 | + store: 0, | |
682 | + choice_sort_store: 0, | |
683 | + sort_store: 0, | |
684 | + fir_pick_index: 0, | |
685 | + sec_pick_index: 0 | |
686 | + }) | |
687 | + | |
688 | + var openindstore = this.data.open_ind_store; | |
689 | + if (openindstore == 1) { | |
690 | + th.setData({ | |
691 | + openSpecModal: !0, | |
692 | + openSpecModal_ind: openindstore, | |
693 | + }); | |
694 | + } else if (openindstore == 2) { | |
695 | + th.setData({ | |
696 | + openSpecModal: !0, | |
697 | + openSpecModal_ind: openindstore, | |
698 | + }); | |
699 | + } | |
700 | + else if (openindstore == 4) { //4就是拼团 | |
701 | + th.setData({ | |
702 | + openSpecModal_pt: 1, //打开拼团购买界面 | |
703 | + store: 0, //关闭门店 | |
704 | + choice_sort_store: 0, //关闭门店2级 | |
705 | + sort_store: 0, //关闭门店2级 | |
706 | + }); | |
707 | + } | |
708 | + else { | |
709 | + th.setData({ | |
710 | + store: 0, | |
711 | + choice_sort_store: 0, | |
712 | + sort_store: 0 | |
713 | + }) | |
714 | + } | |
715 | + | |
716 | + | |
717 | + }, | |
718 | + | |
719 | + //选择更多门店 | |
720 | + more_store: function () { | |
721 | + this.setData({ | |
722 | + sort_store: 1 | |
723 | + }); | |
724 | + }, | |
725 | + // 返回按钮 | |
726 | + returns: function () { | |
727 | + this.setData({ | |
728 | + sort_store: 0, | |
729 | + choice_sort_store: 0 | |
730 | + }); | |
731 | + }, | |
732 | + //---选择分类门店--- | |
733 | + choice_sort_store: function (e) { | |
734 | + var index = e.currentTarget.dataset.index; | |
735 | + var region_name = e.currentTarget.dataset.region; | |
736 | + var item = this.data.all_sto[index]; | |
737 | + this.setData({ | |
738 | + region_name: region_name, | |
739 | + sort_store: 0, | |
740 | + choice_sort_store: 1, | |
741 | + sec_sto: item, | |
742 | + sec_pick_index: 0 | |
743 | + }); | |
744 | + }, | |
745 | + | |
746 | + choose_for_store_fir: function (e) { | |
747 | + var index_c = e.currentTarget.dataset.ind; | |
748 | + var th = this; | |
749 | + th.setData({ | |
750 | + fir_pick_index: index_c | |
751 | + }) | |
752 | + | |
753 | + }, | |
754 | + | |
755 | + //确定def_pick为选择的门店 | |
756 | + sure_pick: function (e) { | |
757 | + var th = this; | |
758 | + var item = null; | |
759 | + var openindstore = th.data.open_ind_store; | |
760 | + | |
761 | + if (th.data.choice_sort_store == 0) { | |
762 | + var index = th.data.fir_pick_index; | |
763 | + if (th.data.is_show_sto_cat == 1) { | |
764 | + item = th.data.def_pickpu_list[index]; | |
507 | 765 | } else { |
508 | - getApp().my_warnning(res.data.msg, 0, th); | |
766 | + item = th.data.only_pk[index]; //当没有门店分类的时候 | |
509 | 767 | } |
510 | - }, | |
511 | - function (res) { } | |
512 | 768 | |
513 | - ) | |
514 | - }) | |
769 | + } else { | |
770 | + var index = th.data.sec_pick_index; | |
771 | + item = th.data.sec_sto.s_arr[index]; | |
772 | + } | |
515 | 773 | |
774 | + if (!th.data.sele_g) return false; | |
775 | + | |
776 | + th.setData({ | |
777 | + def_pick_store: item, | |
778 | + sto_sele_name: item.pickup_name, | |
779 | + sto_sele_id: item.pickup_id, | |
780 | + sto_sele_distr: item.distr_type, | |
781 | + store: 0, | |
782 | + choice_sort_store: 0, | |
783 | + fir_pick_index: 0, | |
784 | + openSpecModal: !0, | |
785 | + }); | |
786 | + | |
787 | + | |
788 | + }, | |
789 | + //---点击二级之后的选择--- | |
790 | + choose_for_store: function (e) { | |
791 | + var index_c = e.currentTarget.dataset.ind; | |
792 | + var th = this; | |
793 | + th.setData({ | |
794 | + sec_pick_index: index_c, | |
795 | + fir_pick_index: index_c | |
796 | + }) | |
797 | + | |
798 | + }, | |
799 | + //把选择的门店设置成默认的门店def_pick | |
800 | + set_def_pick: function (e) { | |
801 | + var th = this; | |
802 | + var item = null; | |
803 | + if (th.data.choice_sort_store == 0) { | |
804 | + var index = th.data.fir_pick_index; | |
805 | + if (th.data.is_show_sto_cat == 1) { | |
806 | + item = th.data.def_pickpu_list[index]; | |
807 | + } else { | |
808 | + item = th.data.only_pk[index]; //当没有门店分类的时候 | |
809 | + } | |
810 | + } else { | |
811 | + var index = th.data.sec_pick_index; | |
812 | + item = th.data.sec_sto.s_arr[index]; | |
813 | + } | |
814 | + th.setData({ | |
815 | + def_pick_store: item, | |
816 | + sto_sele_name: item.pickup_name, | |
817 | + sto_sele_id: item.pickup_id, | |
818 | + sto_sele_distr: item.distr_type, | |
819 | + store: 0, | |
820 | + choice_sort_store: 0, | |
821 | + openSpecModal: !0, | |
822 | + }); | |
823 | + | |
824 | + var user_id=getApp().globalData.user_id; | |
825 | + var def_pickup_id = item.pickup_id; | |
826 | + getApp().request.put('/api/weshop/users/update', { | |
827 | + data: { | |
828 | + user_id: user_id, | |
829 | + def_pickup_id: def_pickup_id | |
830 | + }, | |
831 | + success: function (res) { | |
832 | + if (res.data.code == 0) { | |
833 | + if (th.data.choice_sort_store == 0) th.setData({ | |
834 | + fir_pick_index: 0 | |
835 | + }); | |
836 | + getApp().globalData.pk_store = item; | |
837 | + } else { | |
838 | + getApp().my_warnning("设置默认门店地址失败", 0, th) | |
839 | + } | |
516 | 840 | |
517 | - }, | |
841 | + } | |
842 | + }); | |
843 | + | |
844 | + | |
845 | + }, | |
846 | + closeSpecModal: function () { | |
847 | + this.setData({openSpecModal: 0}); | |
848 | + }, | |
849 | + | |
850 | + buy_libao:function () { | |
851 | + com.buy_libao(this) | |
852 | + } | |
518 | 853 | |
519 | 854 | |
520 | 855 | ... | ... |
pages/giftpack/giftpacklist/giftpacklist.wxml
... | ... | @@ -3,23 +3,36 @@ |
3 | 3 | <image src="{{giftImage}}" class="data-v-3a5b7e36" lazy-load="true" binderror="bind_bnerr" data-errorimg="giftImage"></image> |
4 | 4 | </view> |
5 | 5 | <view class="box_title data-v-3a5b7e36" > |
6 | + | |
7 | + <view class="flex ai_c fs28" style="margin-bottom: 20rpx" wx:if="{{isBuy==0 && pick_up}}"> | |
8 | + <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>{{pick_up.pickup_name}} | |
9 | + </view> | |
10 | + | |
6 | 11 | <view class="top_title data-v-3a5b7e36"> |
7 | 12 | <text class="data-v-3a5b7e36 ellipsis-2">{{giftTitle}}</text> |
8 | 13 | </view> |
9 | - <view class="top_time data-v-3a5b7e36"> | |
10 | - <block wx:if="{{isBuy==1 && giftTitle && isStart!=1}}" > | |
11 | - <text class="data-v-3a5b7e36"> | |
12 | - {{"活动开始时间:"+giftStart}} | |
13 | - </text> | |
14 | - </block> | |
15 | - <block wx:else> | |
16 | - <text class="data-v-3a5b7e36" wx:if="{{isBuy==0}}">{{"兑换结束时间:"+giftDate}}</text> | |
17 | - <text class="data-v-3a5b7e36" wx:else> | |
18 | - {{"活动结束时间:"+giftDate}} | |
19 | - </text> | |
20 | - </block> | |
21 | - | |
14 | + <view class="top_time data-v-3a5b7e36" wx:if="{{!flag}}"> | |
15 | + <block wx:if="{{isBuy==1 && giftTitle && isStart!=1}}" > | |
16 | + <text class="data-v-3a5b7e36"> | |
17 | + {{"活动开始时间:"+giftStart}} | |
18 | + </text> | |
19 | + </block> | |
20 | + <block wx:else> | |
21 | + <text class="data-v-3a5b7e36" wx:if="{{isBuy==0}}">{{"兑换结束时间:"+giftDate}}</text> | |
22 | + <text class="data-v-3a5b7e36" wx:else> | |
23 | + {{"活动结束时间:"+giftDate}} | |
24 | + </text> | |
25 | + </block> | |
26 | + </view> | |
27 | + <view class="top_time data-v-3a5b7e36" wx:if="{{flag == 1}}"> | |
28 | + <text class="data-v-3a5b7e36" wx:if="{{exchangeType == 1}}"> | |
29 | + {{"兑换时间:领取后"+exchangeDay+"天内兑换"}} | |
30 | + </text> | |
31 | + <text class="data-v-3a5b7e36" wx:elif="{{exchangeType == 2}}"> | |
32 | + {{"兑换时间:"+exchangeStartTime+"至"+exchangeEndTime}} | |
33 | + </text> | |
22 | 34 | </view> |
35 | + | |
23 | 36 | <view class="top_price data-v-3a5b7e36"> |
24 | 37 | <block wx:if="{{giftPrice>0}}"> |
25 | 38 | <text class="data-v-3a5b7e36">{{"¥"+giftPrice}}</text> |
... | ... | @@ -39,7 +52,8 @@ |
39 | 52 | <text class="data-v-3a5b7e36">{{"零售价:"+giftPosPrice+"元"}}</text> |
40 | 53 | </view> |
41 | 54 | <view class="top_foot_qty data-v-3a5b7e36"> |
42 | - <text class="data-v-3a5b7e36">{{"已售:"+giftQty+"件"}}</text> | |
55 | + <text class="data-v-3a5b7e36" wx:if="{{!flag}}">{{"已售:"+giftQty+"件"}}</text> | |
56 | + <text class="data-v-3a5b7e36" wx:elif="{{flag == 1 && giftQty > 0}}">{{"数量:"+giftQty+"件"}}</text> | |
43 | 57 | </view> |
44 | 58 | </view> |
45 | 59 | </view> |
... | ... | @@ -77,7 +91,7 @@ |
77 | 91 | <text class="data-v-3a5b7e36 ellipsis-1"> |
78 | 92 | {{"数量:"+item.num}} |
79 | 93 | </text> |
80 | - <block wx:if="{{isBuy==0}}"> | |
94 | + <block wx:if="{{isBuy==0 && !flag}}"> | |
81 | 95 | <text style="margin-left:10rpx" wx:if="{{item.useState}}"> |
82 | 96 | 已核销 |
83 | 97 | </text> |
... | ... | @@ -86,21 +100,16 @@ |
86 | 100 | </text> |
87 | 101 | </block> |
88 | 102 | </view> |
89 | - <view class="box_ware_code data-v-3a5b7e36"> | |
103 | + | |
104 | + <view class="box_ware_code data-v-3a5b7e36" wx:if="{{!flag}}"> | |
90 | 105 | <!-- <block wx:if="{{c_state==0}}"> --> |
106 | + | |
91 | 107 | <block wx:if="{{isBuy==0&item.lbType==1}}"> |
92 | 108 | <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" lazy-load="true" bindtap="getcode" data-codeId="{{item.Id}}" class="data-v-3a5b7e36"></image> |
93 | 109 | </block> |
94 | - <!-- </block> --> | |
95 | - <!-- | |
96 | - <block wx:else> | |
97 | - <block wx:if="{{isBuy==0&item.lbType==1}}"> | |
98 | - <image src="{{iurl+'/miniapp/images/giftbag/gift08.png'}}" lazy-load="true" class="data-v-3a5b7e36"></image> | |
99 | - </block> | |
100 | - </block>--> | |
101 | - | |
110 | + | |
102 | 111 | <block wx:if="{{isBuy==0&item.lbType==2}}"> |
103 | - <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/coupons/coupons" bindtap="goto"></image> | |
112 | + <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/packageD/pages/user/coupons/coupons" bindtap="goto"></image> | |
104 | 113 | </block> |
105 | 114 | <block wx:if="{{isBuy==0&item.lbType==3}}"> |
106 | 115 | <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/my_service/i_service" bindtap="goto"></image> |
... | ... | @@ -121,68 +130,73 @@ |
121 | 130 | <rich-text nodes="{{giftRemark}}" style="word-break:break-all;word-wrap:break-word"></rich-text> |
122 | 131 | </view> |
123 | 132 | </view> |
124 | - <view class="foot_empty data-v-3a5b7e36"></view> | |
125 | - <block wx:if="{{isBuy==1 && giftTitle}}"> | |
126 | - <block wx:if="{{isStart==1}}"> | |
127 | - <view class="foot_button data-v-3a5b7e36"> | |
128 | - <block wx:if="{{giftPrice>0 && giftIntegral>0}}"> | |
129 | - <view class="foot_button_left data-v-3a5b7e36 " data-money="{{giftPrice}}" data-id="{{lbId}}" bindtap="GetBuyPrice"> | |
130 | - <text class="data-v-3a5b7e36 ">立即购买</text> | |
131 | - </view> | |
132 | - <view class="foot_button_right data-v-3a5b7e36 " bindtap="GetBuyIntegral" data-id="{{lbId}}"> | |
133 | - <text class="data-v-3a5b7e36">立即兑换</text> | |
134 | - </view> | |
135 | - </block> | |
136 | - <block wx:if="{{giftPrice>0 && giftIntegral<=0}}"> | |
137 | - <view class="foot_button_buy data-v-3a5b7e36 " data-money="{{giftPrice}}" bindtap="GetBuyPrice" data-id="{{lbId}}"> | |
138 | - <text class="data-v-3a5b7e36">立即购买</text> | |
139 | - </view> | |
140 | - </block> | |
141 | - <block wx:if="{{giftPrice<=0 && giftIntegral>0}}"> | |
142 | - <view class="foot_button_intalge data-v-3a5b7e36 " bindtap="GetBuyIntegral" data-id="{{lbId}}"> | |
143 | - <text class="data-v-3a5b7e36">立即兑换</text> | |
144 | - </view> | |
145 | - </block> | |
146 | - | |
147 | - <block wx:if="{{giftPrice<=0 && giftIntegral<=0}}"> | |
148 | - <view class="foot_button_intalge data-v-3a5b7e36 " bindtap="GetFree" data-id="{{lbId}}"> | |
149 | - <text class="data-v-3a5b7e36">免费领取</text> | |
150 | - </view> | |
151 | - </block> | |
152 | - | |
153 | - | |
154 | - </view> | |
155 | - </block> | |
156 | - <block wx:else> | |
157 | - <view class="foot_button data-v-3a5b7e36"> | |
158 | - <view class="foot_button_intalge data-v-3a5b7e36 gray "> | |
159 | - <text class="data-v-3a5b7e36">活动还未开始</text> | |
160 | - </view> | |
161 | - </view> | |
162 | - </block> | |
163 | - | |
164 | - </block> | |
165 | - <block wx:if="{{isBuy==0}}"> | |
166 | - <view class="foot_button data-v-3a5b7e36"> | |
167 | - <block wx:if="{{is_lb!=1}}"> | |
168 | - <view class="foot_button_buy data-v-3a5b7e36 overdue"> | |
169 | - <text class="data-v-3a5b7e36">无核销商品</text> | |
170 | - </view> | |
171 | - </block> | |
172 | - <block wx:else> | |
173 | - <view wx:if="{{c_state==0}}" class="foot_button_buy data-v-3a5b7e36" bindtap="getcode"> | |
174 | - <text class="data-v-3a5b7e36">立即使用</text> | |
175 | - </view> | |
176 | - <view wx:if="{{c_state==1}}" class="foot_button_buy data-v-3a5b7e36 overdue" bindtap="getcode"> | |
177 | - <text class="data-v-3a5b7e36">商品已核销</text> | |
178 | - </view> | |
179 | - <view wx:if="{{c_state==2}}" class="foot_button_buy data-v-3a5b7e36 overdue"> | |
180 | - <text class="data-v-3a5b7e36">商品兑换时间已过</text> | |
181 | - </view> | |
182 | - | |
183 | - </block> | |
184 | - </view> | |
185 | - </block> | |
133 | + | |
134 | + | |
135 | + <view class="foot_empty data-v-3a5b7e36"></view> | |
136 | + | |
137 | + <block wx:if="{{flag != 1}}"> | |
138 | + <block wx:if="{{isBuy==1 && giftTitle}}"> | |
139 | + <block wx:if="{{isStart==1}}"> | |
140 | + <view class="foot_button data-v-3a5b7e36"> | |
141 | + <block wx:if="{{giftPrice>0 && giftIntegral>0}}"> | |
142 | + <view class="foot_button_left data-v-3a5b7e36 " data-money="{{giftPrice}}" data-id="{{lbId}}" bindtap="GetBuyPrice"> | |
143 | + <text class="data-v-3a5b7e36 ">立即购买</text> | |
144 | + </view> | |
145 | + <view class="foot_button_right data-v-3a5b7e36 " bindtap="GetBuyIntegral" data-id="{{lbId}}"> | |
146 | + <text class="data-v-3a5b7e36">立即兑换</text> | |
147 | + </view> | |
148 | + </block> | |
149 | + <block wx:if="{{giftPrice>0 && giftIntegral<=0}}"> | |
150 | + <view class="foot_button_buy data-v-3a5b7e36 " data-money="{{giftPrice}}" bindtap="GetBuyPrice" data-id="{{lbId}}"> | |
151 | + <text class="data-v-3a5b7e36">立即购买</text> | |
152 | + </view> | |
153 | + </block> | |
154 | + <block wx:if="{{giftPrice<=0 && giftIntegral>0}}"> | |
155 | + <view class="foot_button_intalge data-v-3a5b7e36 " bindtap="GetBuyIntegral" data-id="{{lbId}}"> | |
156 | + <text class="data-v-3a5b7e36">立即兑换</text> | |
157 | + </view> | |
158 | + </block> | |
159 | + | |
160 | + <block wx:if="{{giftPrice<=0 && giftIntegral<=0}}"> | |
161 | + <view class="foot_button_intalge data-v-3a5b7e36 " bindtap="GetFree" data-id="{{lbId}}"> | |
162 | + <text class="data-v-3a5b7e36">免费领取</text> | |
163 | + </view> | |
164 | + </block> | |
165 | + | |
166 | + | |
167 | + </view> | |
168 | + </block> | |
169 | + <block wx:else> | |
170 | + <view class="foot_button data-v-3a5b7e36"> | |
171 | + <view class="foot_button_intalge data-v-3a5b7e36 gray "> | |
172 | + <text class="data-v-3a5b7e36">活动还未开始</text> | |
173 | + </view> | |
174 | + </view> | |
175 | + </block> | |
176 | + | |
177 | + </block> | |
178 | + <block wx:if="{{isBuy==0}}"> | |
179 | + <view class="foot_button data-v-3a5b7e36"> | |
180 | + <block wx:if="{{is_lb!=1}}"> | |
181 | + <view class="foot_button_buy data-v-3a5b7e36 overdue"> | |
182 | + <text class="data-v-3a5b7e36">无核销商品</text> | |
183 | + </view> | |
184 | + </block> | |
185 | + <block wx:else> | |
186 | + <view wx:if="{{c_state==0}}" class="foot_button_buy data-v-3a5b7e36" bindtap="getcode"> | |
187 | + <text class="data-v-3a5b7e36">立即使用</text> | |
188 | + </view> | |
189 | + <view wx:if="{{c_state==1}}" class="foot_button_buy data-v-3a5b7e36 overdue" bindtap="getcode"> | |
190 | + <text class="data-v-3a5b7e36">商品已核销</text> | |
191 | + </view> | |
192 | + <view wx:if="{{c_state==2}}" class="foot_button_buy data-v-3a5b7e36 overdue"> | |
193 | + <text class="data-v-3a5b7e36">商品兑换时间已过</text> | |
194 | + </view> | |
195 | + </block> | |
196 | + </view> | |
197 | + </block> | |
198 | + </block> | |
199 | + | |
186 | 200 | </view> |
187 | 201 | <!-- 引入提示组件 --> |
188 | 202 | <warn id="warn"></warn> |
... | ... | @@ -190,4 +204,6 @@ |
190 | 204 | <!-- 弹出框扫描 --> |
191 | 205 | <qr_code id="qc_com"></qr_code> |
192 | 206 | <!-- 制作一个圆球导航 --> |
193 | -<nav_b id="nav_b"></nav_b> | |
194 | 207 | \ No newline at end of file |
208 | +<nav_b id="nav_b"></nav_b> | |
209 | + | |
210 | +<include src="../public/buy_com.wxml"></include> | |
195 | 211 | \ No newline at end of file | ... | ... |
pages/giftpack/giftpacklist/giftpacklist.wxss
pages/giftpack/public/buy_com.js
0 → 100644
1 | +module.exports = { | |
2 | + //开启定位 | |
3 | + wait_for_store_config: function (th) { | |
4 | + var t_time = setInterval(function () { | |
5 | + if (th.data.bconfig == null) false; | |
6 | + var e = th.data.bconfig; | |
7 | + if (e && e.is_sort_storage) { | |
8 | + wx.getLocation({ | |
9 | + type: 'gcj02', | |
10 | + success: function (res) { | |
11 | + th.data.lat = res.latitude; | |
12 | + th.data.lon = res.longitude; | |
13 | + th.data.is_get_local_ok = 1; | |
14 | + }, | |
15 | + fail: function (res) { | |
16 | + if (res.errCode == 2) { | |
17 | + th.setData({ | |
18 | + is_gps: 0 | |
19 | + }); | |
20 | + if (th.data.is_gps == 0) { | |
21 | + getApp().confirmBox("请开启GPS定位", null, 10000, !1); | |
22 | + } | |
23 | + | |
24 | + } else { | |
25 | + th.setData({ | |
26 | + is_gps: "3" | |
27 | + }); | |
28 | + } | |
29 | + | |
30 | + th.data.is_get_local_ok = 1; | |
31 | + } | |
32 | + }) | |
33 | + } else { | |
34 | + th.data.is_get_local_ok = 1; | |
35 | + } | |
36 | + clearInterval(t_time); | |
37 | + }, 500) | |
38 | + }, | |
39 | + set_user_mo_store(th,os,func){ | |
40 | + var that=th; | |
41 | + //获取用户的默认门店 | |
42 | + getApp().get_user_store(function (e) { | |
43 | + if (!e) { | |
44 | + th.data.fir_def_store = {}; //赋值空对象 | |
45 | + return false; | |
46 | + } | |
47 | + var ee = JSON.parse(JSON.stringify(e)); | |
48 | + //--定时器推迟一下-- | |
49 | + setTimeout(function () { | |
50 | + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; | |
51 | + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- | |
52 | + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { | |
53 | + ee.is_no_dis = 1; | |
54 | + } | |
55 | + | |
56 | + var appd = getApp().globalData; | |
57 | + var w_time = setInterval(function () { | |
58 | + if (that.data.is_get_local_ok == 0) return false; | |
59 | + clearInterval(w_time); | |
60 | + var distance = null; | |
61 | + var e = JSON.parse(JSON.stringify(ee)); | |
62 | + | |
63 | + //如果有开启近距离的话,同时距离优不一样了 | |
64 | + if (that.data.lat != null) { | |
65 | + //如果经纬度有变化的话 | |
66 | + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { | |
67 | + that.set_def_storage(e); | |
68 | + if(func) func(); | |
69 | + } else { | |
70 | + //要用接口是获取距离,js的计算不准 | |
71 | + getApp().request.promiseGet("/api/weshop/pickup/list", { | |
72 | + data: { | |
73 | + store_id: os.stoid, | |
74 | + pickup_id: e.pickup_id, | |
75 | + lat: th.data.lat, | |
76 | + lon: th.data.lon, | |
77 | + isstop: 0, | |
78 | + is_pos: 1 | |
79 | + }, | |
80 | + }).then(res => { | |
81 | + if (res.data.code == 0) { | |
82 | + e = res.data.data.pageData[0]; | |
83 | + if (e) { | |
84 | + e.is_no_dis = ee.is_no_dis; | |
85 | + appd.pk_store = e; | |
86 | + that.set_def_storage(e); | |
87 | + } | |
88 | + | |
89 | + } | |
90 | + if(func) func(); | |
91 | + }) | |
92 | + } | |
93 | + //e.distance = distance; | |
94 | + appd.lat = that.data.lat; | |
95 | + appd.lon = that.data.lon; | |
96 | + | |
97 | + } else { | |
98 | + if (e) { | |
99 | + e.distance = null; | |
100 | + that.set_def_storage(e); | |
101 | + } | |
102 | + if(func) func(); | |
103 | + } | |
104 | + }, 500) | |
105 | + }, 700) | |
106 | + }) | |
107 | + | |
108 | + }, | |
109 | + | |
110 | + //---------拿出门店分类和门店------------ | |
111 | + get_sto(th,os) { | |
112 | + var that = th; | |
113 | + var self=this; | |
114 | + var timer_get = setInterval(function () { | |
115 | + if (th.data.is_get_local_ok == 0) return false; | |
116 | + var dd = null; | |
117 | + | |
118 | + dd = { | |
119 | + store_id: os.stoid, | |
120 | + isstop: 0, | |
121 | + is_pos: 1, | |
122 | + pageSize: 2000, | |
123 | + } | |
124 | + | |
125 | + //如果有距离的话 | |
126 | + if (th.data.lat != null) { | |
127 | + dd.lat = th.data.lat; | |
128 | + dd.lon = th.data.lon; | |
129 | + } | |
130 | + | |
131 | + if(th.data.sele_g && th.data.sele_g.pickup_list){ | |
132 | + dd.ids=th.data.sele_g.pickup_list | |
133 | + } | |
134 | + | |
135 | + clearInterval(timer_get); | |
136 | + | |
137 | + //如果会员是有默认的门店话 | |
138 | + if (!th.data.def_pick_store && th.data.fir_def_store) { | |
139 | + th.setData({def_pick_store: th.data.fir_def_store}); | |
140 | + } | |
141 | + wx.showLoading({ | |
142 | + title: '加载中.' | |
143 | + }); | |
144 | + //----------获取门店---------------- | |
145 | + getApp().request.promiseGet("/api/weshop/pickup/list", { | |
146 | + data: dd, | |
147 | + }).then(res => { | |
148 | + var e = res; | |
149 | + | |
150 | + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { | |
151 | + | |
152 | + var his_cate_num = 0; | |
153 | + for (let i in e.data.data.pageData) { | |
154 | + let item = e.data.data.pageData[i]; | |
155 | + if (item.category_id > 0) { | |
156 | + his_cate_num = 1; | |
157 | + break; | |
158 | + } | |
159 | + } | |
160 | + e.his_cate_num = his_cate_num; | |
161 | + | |
162 | + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 | |
163 | + if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) { | |
164 | + th.setData({ | |
165 | + def_pick_store: e.data.data.pageData[0], | |
166 | + sto_sele_name: e.data.data.pageData[0].pickup_name, | |
167 | + sto_sele_id: e.data.data.pageData[0].pickup_id, | |
168 | + sto_sele_distr: e.data.data.pageData[0].distr_type | |
169 | + }); | |
170 | + th.data.fir_def_store = e.data.data.pageData[0]; | |
171 | + } | |
172 | + | |
173 | + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 -- | |
174 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') { | |
175 | + for (var k = 0; k < e.data.data.pageData.length; k++) { | |
176 | + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | |
177 | + e.data.data.pageData.splice(k, 1); //删除 | |
178 | + break; | |
179 | + } | |
180 | + } | |
181 | + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | |
182 | + } | |
183 | + | |
184 | + th.setData({all_pick_list: e.data.data.pageData}); | |
185 | + | |
186 | + setTimeout(function () { | |
187 | + self.deal_pickup(e,th,os); //--普通门店排版-- | |
188 | + }, 800) | |
189 | + | |
190 | + } | |
191 | + }) | |
192 | + }, 200) | |
193 | + | |
194 | + }, | |
195 | + | |
196 | + //-- 统一购买 -- | |
197 | + buy_libao:function (th) { | |
198 | + if(th.data.sele_g.is_pickup){ | |
199 | + if(!th.data.def_pick_store && !th.data.def_pick_store.pickup_id){ | |
200 | + getApp().my_warnning("请先选择门店", 1, th); | |
201 | + return false; | |
202 | + } | |
203 | + | |
204 | + if(th.data.def_pick_store.is_no_dis){ | |
205 | + getApp().my_warnning("门店不匹配,请重新选择", 1, th); | |
206 | + return false; | |
207 | + } | |
208 | + } | |
209 | + | |
210 | + th.setData({submit:1}) | |
211 | + var id=th.data.sele_g.lbId; | |
212 | + var that=th; | |
213 | + var json = { | |
214 | + "actId": '', //活动Id | |
215 | + "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | |
216 | + "buyType":""+that.data.buyType, //1=积分兑换 2=余额购买 | |
217 | + "giftBagId": id, //礼包Id | |
218 | + "storeId": that.data.getStorageID, //商家Id | |
219 | + "userId": that.data.getUserID, //用户ID | |
220 | + "buyFrom": 2, | |
221 | + }; | |
222 | + | |
223 | + if(that.data.first_leader){ | |
224 | + json.first_leader=that.data.first_leader | |
225 | + } | |
226 | + if(that.data.guide_id){ | |
227 | + json.guide_id=that.data.guide_id | |
228 | + } | |
229 | + | |
230 | + if(that.data.def_pick_store){ | |
231 | + json.pickup_id=that.data.def_pick_store.pickup_id; | |
232 | + } | |
233 | + | |
234 | + //-- 分享导购要记录 -- | |
235 | + if (getApp().globalData.guide_id) { | |
236 | + json.guide_id = getApp().globalData.guide_id; | |
237 | + } | |
238 | + | |
239 | + var url ="/api/weshop/marketing/buy/receive/gift/record/insert"; | |
240 | + getApp().request.json_post(url, json, | |
241 | + function (res) { | |
242 | + if (res.data.code == 0 && res.data.data) { | |
243 | + switch(that.data.buyType){ | |
244 | + case 1://立即兑换 | |
245 | + th.setData({submit:0}) | |
246 | + getApp().my_warnning("兑换成功!", 1, th); | |
247 | + th.closeSpecModal(); | |
248 | + break; | |
249 | + case 2://立即购买 | |
250 | + var order_sn = res.data.data.orderSn; | |
251 | + res = res.data.data.result; | |
252 | + if (!res) return false; | |
253 | + var money=that.data.payMoney; | |
254 | + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; | |
255 | + wx.requestPayment({ | |
256 | + timeStamp: String(res.timeStamp), | |
257 | + nonceStr: res.nonceStr, | |
258 | + package: res.packageValue, | |
259 | + signType: res.signType, | |
260 | + paySign: res.paySign, | |
261 | + success: function (res) { | |
262 | + th.setData({submit:0}) | |
263 | + getApp().goto(url); | |
264 | + }, | |
265 | + fail: function (res) { | |
266 | + th.setData({submit:0}) | |
267 | + getApp().my_warnning("取消支付", 0, th); | |
268 | + } | |
269 | + }); | |
270 | + break; | |
271 | + case 3://立即领取 | |
272 | + th.setData({submit:0}) | |
273 | + getApp().my_warnning("领取成功!", 1, th); | |
274 | + th.closeSpecModal(); | |
275 | + break; | |
276 | + } | |
277 | + | |
278 | + } else { | |
279 | + th.setData({submit:0}) | |
280 | + getApp().my_warnning(res.data.msg, 0, th); | |
281 | + } | |
282 | + }, | |
283 | + function (res) { | |
284 | + th.setData({submit:0}) | |
285 | + } | |
286 | + ) | |
287 | + | |
288 | + }, | |
289 | + | |
290 | + //------------处理门店--------------- | |
291 | + deal_pickup(e,th,os) { | |
292 | + | |
293 | + if (!th.data.sele_g) return false | |
294 | + wx.hideLoading(); | |
295 | + | |
296 | + //单总量超出10个的时候,同时门店有分类 | |
297 | + if (e.data.data.total > 10 && e.his_cate_num) { | |
298 | + getApp().request.get("/api/weshop/storagecategory/page", { | |
299 | + data: { | |
300 | + store_id: os.stoid, | |
301 | + pageSize: 1000, | |
302 | + orderField: "sort", | |
303 | + orderType: 'asc', | |
304 | + }, | |
305 | + success: function (ee) { | |
306 | + if (ee.data.code == 0) { | |
307 | + var check_all_cate = 0; | |
308 | + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) { | |
309 | + for (let i in ee.data.data.pageData) { | |
310 | + let item = ee.data.data.pageData[i]; | |
311 | + if (item.is_show == 1) { | |
312 | + check_all_cate = 1; | |
313 | + break | |
314 | + } | |
315 | + } | |
316 | + } | |
317 | + if (check_all_cate) { | |
318 | + var sto_cate = ee.data.data.pageData; | |
319 | + var sto_arr = e.data.data.pageData; | |
320 | + var newarr = new Array(); | |
321 | + var qita = new Array(); | |
322 | + | |
323 | + | |
324 | + var is_del_pk = 0; | |
325 | + //----要进行门店分组-------- | |
326 | + for (var i = 0; i < sto_arr.length; i++) { | |
327 | + //找一下这个门店有没有在分类数组内 | |
328 | + var find2 = 0, find2name = "", sort = 0; | |
329 | + is_del_pk = 0; | |
330 | + for (var m = 0; m < sto_cate.length; m++) { | |
331 | + if (sto_arr[i].category_id == sto_cate[m].cat_id) { | |
332 | + if (sto_cate[m].is_show != 1) { | |
333 | + is_del_pk = 1; | |
334 | + sto_arr.splice(i, 1); | |
335 | + i--; | |
336 | + } else { | |
337 | + find2 = sto_cate[m].cat_id; | |
338 | + find2name = sto_cate[m].cat_name; | |
339 | + sort = sto_cate[m].sort; | |
340 | + is_del_pk = 0; | |
341 | + } | |
342 | + break; | |
343 | + } | |
344 | + } | |
345 | + if (is_del_pk) continue; | |
346 | + | |
347 | + if (newarr.length > 0) { | |
348 | + var find = 0; | |
349 | + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 | |
350 | + if (find2 != 0) { | |
351 | + for (var ii = 0; ii < newarr.length; ii++) { | |
352 | + if (sto_arr[i].category_id == newarr[ii].cat_id) { | |
353 | + newarr[ii].s_arr.push(sto_arr[i]); | |
354 | + find = 1; | |
355 | + break; | |
356 | + } | |
357 | + } | |
358 | + if (find == 0) { | |
359 | + var arr0 = new Array(); | |
360 | + arr0.push(sto_arr[i]); | |
361 | + var item = { | |
362 | + cat_id: find2, | |
363 | + name: find2name, | |
364 | + sort: sort, | |
365 | + s_arr: arr0 | |
366 | + }; | |
367 | + newarr.push(item); | |
368 | + } | |
369 | + } else { | |
370 | + qita.push(sto_arr[i]); | |
371 | + } | |
372 | + } else { | |
373 | + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 | |
374 | + if (find2 != 0) { | |
375 | + var arr0 = new Array(); | |
376 | + arr0.push(sto_arr[i]); | |
377 | + var item = { | |
378 | + cat_id: find2, | |
379 | + name: find2name, | |
380 | + sort: sort, | |
381 | + s_arr: arr0 | |
382 | + }; | |
383 | + newarr.push(item); | |
384 | + } else { | |
385 | + qita.push(sto_arr[i]); | |
386 | + } | |
387 | + } | |
388 | + } | |
389 | + | |
390 | + var def_arr = new Array(); | |
391 | + //-- 开始就看10个门店 -- | |
392 | + for (var k = 0; k < 10; k++) { | |
393 | + if (k == sto_arr.length) break; | |
394 | + def_arr.push(sto_arr[k]); | |
395 | + } | |
396 | + | |
397 | + th.setData({ | |
398 | + def_pickpu_list: def_arr, | |
399 | + pickpu_list: ee.data.data.pageData | |
400 | + }); | |
401 | + | |
402 | + | |
403 | + //门店分类要排序下 | |
404 | + function compare(property) { | |
405 | + return function (a, b) { | |
406 | + var value1 = a[property]; | |
407 | + var value2 = b[property]; | |
408 | + return value1 - value2; | |
409 | + } | |
410 | + } | |
411 | + | |
412 | + if (newarr.length > 0) | |
413 | + newarr.sort(compare("sort")); | |
414 | + | |
415 | + | |
416 | + //----安排其他的分类----- | |
417 | + if (qita.length > 0) { | |
418 | + var item = { | |
419 | + cat_id: -1, | |
420 | + name: "其他", | |
421 | + s_arr: qita | |
422 | + }; | |
423 | + newarr.push(item); | |
424 | + } | |
425 | + | |
426 | + var sd = { | |
427 | + all_sto: newarr, | |
428 | + is_show_sto_cat: 1 | |
429 | + } | |
430 | + if (!sto_arr || sto_arr.length <= 10) { | |
431 | + sd.is_show_sto_cat = -1; | |
432 | + sd.only_pk = sto_arr; | |
433 | + } | |
434 | + th.setData(sd); | |
435 | + | |
436 | + } else { | |
437 | + th.setData({ | |
438 | + is_show_sto_cat: -1, | |
439 | + only_pk: e.data.data.pageData | |
440 | + }); | |
441 | + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------ | |
442 | + if (!th.data.def_pick_store) { | |
443 | + th.setData({ | |
444 | + def_pick_store: e.data.data.pageData[0], | |
445 | + sto_sele_name: e.data.data.pageData[0].pickup_name, | |
446 | + sto_sele_id: e.data.data.pageData[0].pickup_id, | |
447 | + sto_sele_distr: e.data.data.pageData[0].distr_type | |
448 | + }) | |
449 | + } | |
450 | + } | |
451 | + } else { | |
452 | + th.setData({ | |
453 | + is_show_sto_cat: -1, | |
454 | + only_pk: e.data.data.pageData | |
455 | + }); | |
456 | + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------ | |
457 | + if (!th.data.def_pick_store) { | |
458 | + th.setData({ | |
459 | + def_pick_store: e.data.data.pageData[0], | |
460 | + sto_sele_name: e.data.data.pageData[0].pickup_name, | |
461 | + sto_sele_id: e.data.data.pageData[0].pickup_id, | |
462 | + sto_sele_distr: e.data.data.pageData[0].distr_type | |
463 | + }) | |
464 | + } | |
465 | + | |
466 | + } | |
467 | + } | |
468 | + }); | |
469 | + } else { | |
470 | + th.setData({ | |
471 | + is_show_sto_cat: 0, | |
472 | + only_pk: e.data.data.pageData | |
473 | + }); | |
474 | + //-----如果没有默认门店,要取第一个门店作为默认店------ | |
475 | + if (!th.data.def_pick_store && th.data.bconfig && th.data.bconfig.is_sort_storage) { | |
476 | + th.setData({ | |
477 | + def_pick_store: e.data.data.pageData[0], | |
478 | + sto_sele_name: e.data.data.pageData[0].pickup_name, | |
479 | + sto_sele_id: e.data.data.pageData[0].pickup_id, | |
480 | + sto_sele_distr: e.data.data.pageData[0].distr_type | |
481 | + }) | |
482 | + } | |
483 | + } | |
484 | + }, | |
485 | + | |
486 | + check_def_pk:function (th) { | |
487 | + th.data.def_pick_store.is_no_dis=0; | |
488 | + var def_pick_store=th.data.def_pick_store | |
489 | + var sele_g=th.data.sele_g; | |
490 | + var arr=sele_g.pickup_list.split(','); | |
491 | + | |
492 | + var idx=arr.findIndex(function (e) { | |
493 | + return e==def_pick_store.pickup_id; | |
494 | + }) | |
495 | + | |
496 | + if(idx==-1){ | |
497 | + def_pick_store.is_no_dis=1; | |
498 | + } | |
499 | + th.setData({def_pick_store}) | |
500 | + | |
501 | + } | |
502 | + | |
503 | + | |
504 | + | |
505 | + | |
506 | +} | |
0 | 507 | \ No newline at end of file | ... | ... |
pages/giftpack/public/buy_com.wxml
0 → 100644
1 | +<!-- 选择门店的弹框,1.1版最新的 --> | |
2 | +<block wx:if="{{store}}"> | |
3 | + <view class="mongolia-layer" bindtap="close_popup"></view> | |
4 | + <view class="popup-frame"> | |
5 | + <block wx:if="{{sort_store==0}}"> | |
6 | + <!-- 头部 标题 --> | |
7 | + <view class="popup-top flex-space-between"> | |
8 | + <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text> | |
9 | + <view> | |
10 | + <view> | |
11 | + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon> | |
12 | + </view> | |
13 | + <view class="felx choose_more" bindtap="more_store" wx:if="{{is_show_sto_cat>0}}"> | |
14 | + <text class="fs26 red-co" >{{choice_sort_store==0?'更多门店':'返回'}}</text> <view class="bg_rights" ></view> | |
15 | + </view> | |
16 | + </view> | |
17 | + </view> | |
18 | + <!-- 门店列表,最外层的门店列表,一开始 --> | |
19 | + <view class="store-list"> | |
20 | + <!-- 如果还没有点击更多门店的时候 --> | |
21 | + <block wx:if="{{choice_sort_store==0}}"> | |
22 | + <!-- 需要for循环 --> | |
23 | + <block wx:if="{{is_show_sto_cat==1}}"> | |
24 | + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
25 | + <view class="store flex-vertical"> | |
26 | + <!-- 需要点击事件 --> | |
27 | + <block wx:if="{{index==fir_pick_index}}"> | |
28 | + <view class="circle white xc-hook fs20 red-b">Г</view> | |
29 | + </block> | |
30 | + <block wx:else> | |
31 | + <view class="circle xc-hooks"></view> | |
32 | + </block> | |
33 | + <view class="address-frame xc-ash"> | |
34 | + <view class="flex-vertical-between butttem5"> | |
35 | + <view class="flex xc-ash"> | |
36 | + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view> | |
37 | + </view> | |
38 | + <view> | |
39 | + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> | |
40 | + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}} | |
41 | + </view> | |
42 | + </view> | |
43 | + </view> | |
44 | + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view> | |
45 | + </view> | |
46 | + </view> | |
47 | + </view> | |
48 | + </block> | |
49 | + <block wx:else> | |
50 | + <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
51 | + <view class="store flex-vertical"> | |
52 | + <!-- 需要点击事件 --> | |
53 | + <block wx:if="{{index==fir_pick_index}}"> | |
54 | + <view class="circle white xc-hook fs20 red-b">Г</view> | |
55 | + </block> | |
56 | + <block wx:else> | |
57 | + <view class="circle xc-hooks"></view> | |
58 | + </block> | |
59 | + <view class="address-frame xc-ash"> | |
60 | + <view class="flex-vertical-between "> | |
61 | + <view class="flex xc-ash"> | |
62 | + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view> | |
63 | + </view> | |
64 | + <view> | |
65 | + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> | |
66 | + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}} | |
67 | + </view> | |
68 | + </view> | |
69 | + </view> | |
70 | + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view> | |
71 | + </view> | |
72 | + </view> | |
73 | + </view> | |
74 | + </block> | |
75 | + </block> | |
76 | + <block wx:else> | |
77 | + <!-- 如果是点击选择门店分类后显示分类下的门店 --> | |
78 | + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}" bindtap="choose_for_store"> | |
79 | + <view class="store flex-vertical"> | |
80 | + <!-- 需要点击事件 --> | |
81 | + <block wx:if="{{index==sec_pick_index}}"> | |
82 | + <view class="circle white xc-hook fs20 red-b">Г</view> | |
83 | + </block> | |
84 | + <block wx:else> | |
85 | + <view class="circle xc-hooks"></view> | |
86 | + </block> | |
87 | + <view class="address-frame xc-ash"> | |
88 | + <view class="flex-vertical-between "> | |
89 | + <view class="flex xc-ash"> | |
90 | + <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view> | |
91 | + </view> | |
92 | + <view> | |
93 | + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> | |
94 | + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}} | |
95 | + </view> | |
96 | + </view> | |
97 | + </view> | |
98 | + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view> | |
99 | + </view> | |
100 | + </view> | |
101 | + </view> | |
102 | + </block> | |
103 | + </view> | |
104 | + <!-- 门店列表底部 --> | |
105 | + <view class="store-bottom-frame"> | |
106 | + <view class="store-bottom flex-vertical-between"> | |
107 | + <view class="determine red-b fs28 white t-c" bindtap="sure_pick" data-openindstore="{{open_ind_store}}"> | |
108 | + 确定 | |
109 | + </view> | |
110 | + <view class="default t-c fs28" bindtap="set_def_pick" data-openindstore="{{open_ind_store}}"> | |
111 | + 设为默认 | |
112 | + </view> | |
113 | + </view> | |
114 | + </view> | |
115 | + </block> | |
116 | + <block wx:else> | |
117 | + <view class="popup-top flex-space-between"> | |
118 | + <text class="fs32 nearby_store">门店分类选择</text> | |
119 | + <view> | |
120 | + <view> | |
121 | + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon> | |
122 | + </view> | |
123 | + <view class="felx choose_mores" bindtap="returns"> | |
124 | + <text class="fs26 red-co">返回</text> | |
125 | + </view> | |
126 | + </view> | |
127 | + </view> | |
128 | + <view class="sort_store_list"> | |
129 | + <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}"> | |
130 | + <view class="sort-store flex-vertical-between"> | |
131 | + <view class="fs30" di>{{item.name}}</view> | |
132 | + <view class="black_rights-frame"> | |
133 | + <view class="black_rights"></view> | |
134 | + </view> | |
135 | + </view> | |
136 | + </view> | |
137 | + </view> | |
138 | + </block> | |
139 | + </view> | |
140 | +</block> | |
141 | +<!-- --弹起来,选择规格数量,普通商品购买和秒杀---- --> | |
142 | +<view hidden="{{!openSpecModal}}"> | |
143 | + <view bindtap="closeSpecModal" class="cover-layer"></view> | |
144 | + <view class="spec-model"> | |
145 | + <view class="pding"> | |
146 | + <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon> | |
147 | + <view class="spec-goods"> | |
148 | + <image class="wh100 spec-img xc-distance-bottom" bindtap="previewImage" src="{{iurl+(sele_g.cover_img?sele_g.cover_img:sele_g.lbUrl)}}" binderror="pop_err_img" data-errorimg=""></image> | |
149 | + <view class="spec-goods-info"> | |
150 | + <view class="spec-goods-name ellipsis-2">{{sele_g.giftTitle}}</view> | |
151 | + <view class="flex ai_end xc-val-money"> | |
152 | + <view class="spec-goods-price"> | |
153 | + <block wx:if="{{sele_g.payMoney>0}}"> | |
154 | + <text>{{"¥"+sele_g.payMoney}}</text> | |
155 | + </block> | |
156 | + <block wx:if="{{sele_g.payMoney>0&&sele_g.payIntegral>0}}"> | |
157 | + <text>/</text> | |
158 | + </block> | |
159 | + <block wx:if="{{sele_g.payIntegral>0}}"> | |
160 | + <view class="flex"> | |
161 | + <text class="ellipsis-1">{{sele_g.payIntegral}}</text> | |
162 | + <view>积分</view> | |
163 | + </view> | |
164 | + </block> | |
165 | + | |
166 | + </view> | |
167 | + </view> | |
168 | + | |
169 | + | |
170 | + <view class="flex"> | |
171 | + <view class="spec-goods-stock" >已售:{{sele_g.giftQty}}</view> | |
172 | + <view class="spec-goods-stock">可售:{{sele_g.lbnum-sele_g.giftQty+(sele_g.virtualsales?sele_g.virtualsales:0)}}</view> | |
173 | + </view> | |
174 | + | |
175 | + </view> | |
176 | + <!-- 选择门店模块 --> | |
177 | + <view class="flex-space-between address ai_end xc-width "> | |
178 | + <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
179 | + <text class="fs30 xc-black3 shop_name bold">{{def_pick_store.pickup_name}}</text> | |
180 | + <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}"> | |
181 | + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} | |
182 | + </view> | |
183 | + </view> | |
184 | + <!-- 没有门店的时候 --> | |
185 | + <view class="flex" bindtap="choice_store" wx:else> | |
186 | + <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | |
187 | + <view class="fs30" style="color:black;">选择门店</view> | |
188 | + </view> | |
189 | + <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | |
190 | + </view> | |
191 | + <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | |
192 | + <block wx:else> | |
193 | + <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> | |
194 | + <block wx:else> | |
195 | + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
196 | + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> | |
197 | + (库存不足) | |
198 | + </view> | |
199 | + </block> | |
200 | + </block> | |
201 | + <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store && def_pick_store.fulladdress}}"> | |
202 | + 地址:{{def_pick_store.fulladdress}} | |
203 | + </view> | |
204 | + </view> | |
205 | + <!-- 商品的属性项目 --> | |
206 | + | |
207 | + | |
208 | + </view> | |
209 | + <view class="spec-cart-btns"> | |
210 | + <!-- 根本就找不到门店 --> | |
211 | + <block wx:if="{{!only_pk && !def_pickpu_list}}"> | |
212 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | |
213 | + 未找到门店 | |
214 | + </view> | |
215 | + </block> | |
216 | + <block wx:else> | |
217 | + <block wx:if="{{only_pk && !only_pk.length}}"> | |
218 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | |
219 | + 未找到门店 | |
220 | + </view> | |
221 | + </block> | |
222 | + <block wx:else> | |
223 | + <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> | |
224 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> | |
225 | + 库存不足 | |
226 | + </view> | |
227 | + </block> | |
228 | + <block wx:else> | |
229 | + <block wx:if="{{!def_pick_store}}"> | |
230 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> | |
231 | + 请先选择门店 | |
232 | + </view> | |
233 | + </block> | |
234 | + <block wx:else> | |
235 | + <block wx:if="{{sele_g.store_count<=0}}"> | |
236 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> | |
237 | + 库存不足 | |
238 | + </view> | |
239 | + </block> | |
240 | + <block wx:else> | |
241 | + <button bindtap="buy_libao" disabled="{{submit}}" style="display: block" class="spec-cart-btn {{buyType==2?'yellow':'red-b'}} fs32" data-action="add"> | |
242 | + <text wx:if="{{buyType==1}}">立即兑换</text> | |
243 | + <text wx:if="{{buyType==2}}">立即购买</text> | |
244 | + <text wx:if="{{buyType==3}}">立即领取</text> | |
245 | + </button> | |
246 | + </block> | |
247 | + | |
248 | + </block> | |
249 | + </block> | |
250 | + </block> | |
251 | + </block> | |
252 | + | |
253 | + </view> | |
254 | + <view class="clear"></view> | |
255 | + | |
256 | + </view> | |
257 | +</view> | |
0 | 258 | \ No newline at end of file | ... | ... |
pages/goods/categoryList/categoryList.wxml
... | ... | @@ -81,7 +81,7 @@ |
81 | 81 | </block> |
82 | 82 | </scroll-view> |
83 | 83 | |
84 | - <view class="nav box box-tb" catchtouchmove="touchmove" catchtouchend="touchend" > | |
84 | + <view class="nav box box-tb my-nav" catchtouchmove="touchmove" catchtouchend="touchend" > | |
85 | 85 | <view bindtap="tabLetter" data-index="{{item}}" wx:for="{{letters}}" |
86 | 86 | class="flex box box-align-center box-pack-center letter"> |
87 | 87 | <text class="letter-text {{selected == item ? 'letter-actived' : ''}}">{{item}}</text> | ... | ... |
pages/goods/categoryList/categoryList.wxss
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -370,7 +370,7 @@ Page({ |
370 | 370 | } |
371 | 371 | |
372 | 372 | //调用接口判断商家plus有没有过期 |
373 | - i.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { | |
373 | + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { | |
374 | 374 | if (res.data.code == 0) { |
375 | 375 | var arr = res.data.data.pageData; |
376 | 376 | if (arr.length > 0) { |
... | ... | @@ -1248,7 +1248,7 @@ Page({ |
1248 | 1248 | |
1249 | 1249 | //让商品带上房间号 |
1250 | 1250 | //让商品带上房间号 |
1251 | - if (th.data.sys_switch.is_skuroom_id == 1) { | |
1251 | + if (!th.data.sys_switch.is_skuroom_id && th.data.sys_switch.is_skuroom_id == 1) { | |
1252 | 1252 | if (th.data.data.goods_id == getApp().globalData.room_goods_id) { |
1253 | 1253 | newd.room_id = getApp().globalData.room_id; |
1254 | 1254 | } |
... | ... | @@ -1354,7 +1354,7 @@ Page({ |
1354 | 1354 | |
1355 | 1355 | //让商品带上房间号 |
1356 | 1356 | //让商品带上房间号 |
1357 | - if (th.data.sys_switch.is_skuroom_id == 1) { | |
1357 | + if (!th.data.sys_switch.is_skuroom_id && th.data.sys_switch.is_skuroom_id == 1) { | |
1358 | 1358 | if (th.data.data.goods_id == getApp().globalData.room_goods_id) { |
1359 | 1359 | newd.room_id = getApp().globalData.room_id; |
1360 | 1360 | } |
... | ... | @@ -2138,7 +2138,7 @@ Page({ |
2138 | 2138 | callback(); |
2139 | 2139 | } else { |
2140 | 2140 | //-- 判断有没有优惠活动 -- |
2141 | - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0", {}).then(res => { | |
2141 | + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0"+"/"+usr.user_id, {}).then(res => { | |
2142 | 2142 | if (res.data.code == 0) { |
2143 | 2143 | var r_data = res.data.data; |
2144 | 2144 | th.data.prom_goods = r_data.promGoodsLists; |
... | ... | @@ -4243,7 +4243,7 @@ Page({ |
4243 | 4243 | } |
4244 | 4244 | |
4245 | 4245 | //让商品带上房间号 |
4246 | - if (th.data.sys_switch.is_skuroom_id == 1) { | |
4246 | + if (!th.data.sys_switch.is_skuroom_id && th.data.sys_switch.is_skuroom_id == 1) { | |
4247 | 4247 | if (th.data.data.goods_id == getApp().globalData.room_goods_id) { |
4248 | 4248 | newd.room_id = getApp().globalData.room_id; |
4249 | 4249 | } |
... | ... | @@ -6118,9 +6118,8 @@ Page({ |
6118 | 6118 | |
6119 | 6119 | } else { |
6120 | 6120 | //调用接口判断订单优惠, |
6121 | - getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0", { | |
6121 | + getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0"+"/"+user_id, { | |
6122 | 6122 | success: function (res) { |
6123 | - | |
6124 | 6123 | if (res.data.code == 0 && res.data.data) { |
6125 | 6124 | var r_data = res.data.data; |
6126 | 6125 | var max = 0, min = 0; |
... | ... | @@ -6552,10 +6551,18 @@ Page({ |
6552 | 6551 | // 促销 -> 送礼包 -> 查看详情 |
6553 | 6552 | viewLbDetails(e) { |
6554 | 6553 | let id = e.currentTarget.dataset.id; // 获取礼包id |
6555 | - let url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮 | |
6554 | + let flag = e.currentTarget.dataset.flag; | |
6555 | + let url = ''; | |
6556 | + if(flag == 1) { // flag =1 控制跳转到专享礼包 | |
6557 | + url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`; | |
6558 | + } else { | |
6559 | + url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮 | |
6560 | + }; | |
6556 | 6561 | // console.log('myurl', url); |
6557 | 6562 | getApp().goto(url); |
6558 | 6563 | }, |
6564 | + | |
6565 | + | |
6559 | 6566 | |
6560 | 6567 | go_more_ladder: function (e) { |
6561 | 6568 | var prom_id = e.currentTarget.dataset.id; | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxml
... | ... | @@ -499,7 +499,7 @@ |
499 | 499 | <!-- 中间显示层 --> |
500 | 500 | <block> |
501 | 501 | <view class="cx-sizs fs30 pdr20">促销</view> |
502 | - <view> | |
502 | + <view class="f1"> | |
503 | 503 | <view class="fs28 f1" wx:for="{{prom_goods}}"> |
504 | 504 | <view> |
505 | 505 | <text class="prom_condition"> |
... | ... | @@ -519,7 +519,7 @@ |
519 | 519 | <view class="tick lh2 pdr20" wx:if="{{item.couponId>0}}">送{{item.couponMoney}}元优惠券</view> |
520 | 520 | <view class="tick ellipsis-1x lh2" wx:if="{{item.gift_id>0}}">送商品{{item.goods_name}}</view> |
521 | 521 | <view class="tick ellipsis-1x lh2 details pdr40" wx:if="{{item.lb_id>0}}" data-id="{{item.lb_id}}" bindtap="viewLbDetails">送{{item.lbtitle}}</view> |
522 | - <view class="tick ellipsis-1x lh2 details pdr40" wx:if="{{item.zxlb_id>0}}" data-id="{{item.zxlb_id}}" bindtap="viewLbDetails2">送{{item.zxlbtitle}}</view> | |
522 | + <view class="tick ellipsis-1x lh2 details pdr40" wx:if="{{item.zxlb_id>0}}" data-id="{{item.zxlb_id}}" data-flag="1" bindtap="viewLbDetails">送{{item.zxlbtitle}}</view> | |
523 | 523 | </view> |
524 | 524 | </view> |
525 | 525 | </view> | ... | ... |
pages/index/index/index.js
1 | 1 | var e = function (e) { |
2 | - return e && e.__esModule ? e : { | |
3 | - default: e | |
4 | - }; | |
2 | + return e && e.__esModule ? e : { | |
3 | + default: e | |
4 | + }; | |
5 | 5 | }(require("../../../utils/LoadMore.js")), |
6 | - t = getApp(), | |
7 | - a = t.request, | |
8 | - o = t.globalData.setting, | |
9 | - os = o, | |
10 | - i = require("../../../utils/util.js"), | |
11 | - ut = i, | |
12 | - s = require("../../../utils/common.js"), | |
13 | - n = new e.default(); | |
6 | + t = getApp(), | |
7 | + a = t.request, | |
8 | + o = t.globalData.setting, | |
9 | + os = o, | |
10 | + i = require("../../../utils/util.js"), | |
11 | + ut = i, | |
12 | + s = require("../../../utils/common.js"), | |
13 | + n = new e.default(); | |
14 | 14 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
15 | 15 | var api = require('../../../api/api.js'); |
16 | 16 | var d = getApp().globalData; |
... | ... | @@ -19,1202 +19,1200 @@ var full_screen = require('full_screen.js'); |
19 | 19 | |
20 | 20 | |
21 | 21 | Page({ |
22 | - data: { | |
23 | - url: o.imghost, | |
24 | - swiperimage: [{ | |
25 | - image: "/miniapp/images/title.png", | |
26 | - nav_url: 0 | |
27 | - }], | |
28 | - resourceUrl: o.resourceUrl, | |
29 | - logo: o.appLogo, | |
30 | - homeData: null, | |
31 | - saleGoods: null, | |
32 | - sale: { | |
33 | - countTime: { | |
34 | - hour: 0, | |
35 | - minute: 0, | |
36 | - second: 0 | |
37 | - }, | |
38 | - diffTime: 0, | |
39 | - good: null, | |
40 | - }, | |
41 | - timer: null, | |
42 | - recommend: null, | |
43 | - scrollTop: 0, | |
44 | - currentPage: 1, | |
45 | - banner: null, | |
46 | - | |
47 | - appdata: null, | |
48 | - saleGoods: null, //秒杀数据 | |
49 | - pindGoods: null, //拼单数据 | |
50 | - newGoods: null, //新商品 | |
51 | - hotGoods: null, //hot商品 | |
52 | - preGoods:null, //预售商品 | |
53 | - //----控制是是否显示计时器--- | |
54 | - is_timer: 1, | |
55 | - ishow: 0, | |
56 | - //是不是显示自定义模板 | |
57 | - isTemplate: 0, | |
58 | - template_arr: null, | |
59 | - bgcolor_t: '', | |
60 | - | |
61 | - banner_index: 0, | |
62 | - flash_index: 0, | |
63 | - pt_index: 0, | |
64 | - | |
65 | - pt_timer_item: null, | |
66 | - pt_timer_arr: null, | |
67 | - pt_timer: null, | |
68 | - pt_timer_active: 0, | |
69 | - //看下商家是否开通会员权益 | |
70 | - is_boot: 0, | |
71 | - gd_category: null, | |
72 | - is_no_more: 0, | |
73 | - max_sw_height: 0, //banner的最大高度 | |
74 | - is_disgraceful: 0, //是否显示新人广告 | |
75 | - new_image: "", //新人有礼弹窗图片 | |
76 | - new_nav: "", //新人页面跳转地址 | |
77 | - w_holiday_pop: 0, | |
78 | - | |
79 | - showHongbao: false, | |
80 | - showHongbaoSmall: false, | |
81 | - | |
82 | - is_full_screen_show: 0, //全屏显示 | |
83 | - sec_show: 3, //倒计时的秒数 | |
84 | - full_ad: null, //全屏广告 | |
85 | - full_screen: 0, //全屏广告 | |
86 | - is_ok_h5:0, //判断要不要显示关注二维码 | |
87 | - }, | |
88 | - | |
89 | - onLoad: async function (tt) { | |
90 | - var th = this; | |
91 | - var first_leader = tt.first_leader; | |
92 | - if (!first_leader && tt.scene) { | |
93 | - var first_leader_str = decodeURIComponent(tt.scene); | |
94 | - var f_arr = first_leader_str.split("_"); | |
95 | - first_leader = f_arr[0] && parseFloat(f_arr[0]) > 0 ? f_arr[0] : null; | |
96 | - //注册门店 | |
97 | - if (f_arr[1] && parseFloat(f_arr[1]) > 0) { | |
98 | - getApp().globalData.store_number = f_arr[1]; | |
99 | - } | |
100 | - } | |
101 | - | |
102 | - getApp().getConfig(function (e) { | |
103 | - //--首页的问题-- | |
104 | - if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) { | |
105 | - wx.setNavigationBarTitle({ | |
106 | - title: getApp().globalData.config.store_name, | |
107 | - }); | |
108 | - } else { | |
109 | - wx.setNavigationBarTitle({ | |
110 | - title: getApp().globalData.setting.appName, | |
111 | - }); | |
112 | - }; | |
113 | - }); | |
114 | - | |
115 | - | |
116 | - var th = this; | |
117 | - getApp().getConfig2(function (config2) { | |
118 | - if (config2 && config2.is_overdue == 1) { | |
119 | - getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=5", {}).then(res => { | |
120 | - var o = res; | |
121 | - if (o.data.code == 0) { | |
122 | - var ob = { isout: 0, isbuy: 1 }; | |
123 | - var arr = o.data.data.pageData; | |
124 | - var isbuy = 0; | |
125 | - //----如果数组不为空---- | |
126 | - if (arr.length > 0) { | |
127 | - arr.forEach(function (val, ind) { | |
128 | - if (val.is_sy == 0 && val.type == 5) { | |
129 | - isbuy = 1; | |
130 | - var now = ut.gettimestamp(); | |
131 | - if (now > val.end_time) ob.isout = 1; | |
132 | - return false; | |
133 | - } | |
134 | - }) | |
135 | - } | |
136 | - ob.isbuy = isbuy; | |
137 | - | |
138 | - var pages = getCurrentPages(); //获取加载的页面 | |
139 | - var currentPage = pages[pages.length - 1]; //获取当前页面的对象 | |
140 | - | |
141 | - // console.log("当前路由"); | |
142 | - // console.log(currentPage.route); | |
143 | - | |
144 | - | |
145 | - th.setappdata(ob); | |
146 | - | |
147 | - if (ob.isbuy && !ob.isout) { | |
148 | - th.onload_init(); | |
149 | - } | |
150 | - } else { | |
151 | - th.onload_init(); | |
152 | - } | |
153 | - }) | |
154 | - } | |
155 | - else { | |
156 | - th.onload_init(); | |
157 | - } | |
158 | - }) | |
159 | - | |
160 | - if (first_leader) { | |
161 | - //-- user_id代过来免登录 -- | |
162 | - getApp().globalData.first_leader = first_leader; | |
163 | - //调用接口判断是不是会员 | |
164 | - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { | |
165 | - if (res.data.code == 0) { | |
166 | - getApp().globalData.guide_id = res.data.data.id; | |
167 | - } | |
168 | - }) | |
169 | - } | |
170 | - | |
171 | - // 判断是否有红包活动 | |
172 | - getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, { | |
173 | - data: {} | |
174 | - }).then(function (data) { | |
175 | - let code = data.data.code; | |
176 | - if (code == 0) { | |
177 | - | |
178 | - th.setData({ | |
179 | - showHongbao: true, | |
180 | - }); | |
181 | - } else if (code == -1) { | |
182 | - th.setData({ | |
183 | - showHongbao: false, | |
184 | - }); | |
185 | - }; | |
186 | - }); | |
187 | - | |
188 | - | |
189 | - // console.log(9090909); | |
190 | - //看一下商家是否开通了权益 | |
191 | - //--初始化是否有打勾-- | |
192 | - getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { | |
193 | - data: { | |
194 | - storeId: os.stoid | |
195 | - } | |
196 | - }).then(res => { | |
197 | - if (res.data.data) { | |
198 | - var is_init = res.data.data.isBool; | |
199 | - th.setData({ | |
200 | - is_boot: is_init | |
201 | - }); | |
202 | - | |
203 | - if (!is_init) { | |
204 | - th.setData({ | |
205 | - swiperimage: [] | |
206 | - }); | |
207 | - } | |
208 | - } | |
209 | - }) | |
210 | - | |
211 | - //调用底部导航 | |
212 | - //getApp().globalData.url=th.data.url | |
213 | - //t.editTabBar(th,o.stoid,th.data.url); | |
214 | - | |
215 | - }, | |
216 | - | |
217 | - async onload_init() { | |
218 | - var th = this; | |
219 | - await this.init_load(); | |
220 | - //显示的时候要开启计时器 | |
221 | - this.data.is_timer = 1; | |
222 | - //如果是自定义模板 | |
223 | - if (this.data.isTemplate) { | |
224 | - //---先获取会员--- | |
225 | - //t.getUserFir(function () { | |
226 | - if(getApp().globalData.user_id) { | |
227 | - th.is_festival(); | |
228 | - var new_nav = th.data.new_nav; | |
229 | - if (new_nav == "") { | |
230 | - th.is_new(); | |
231 | - } | |
232 | - // sty | |
233 | - setTimeout(function () { | |
234 | - if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
235 | - }, 500) | |
236 | - } | |
237 | - | |
238 | - //}); | |
239 | - } else { | |
240 | - await this.init_fir(); | |
241 | - wx.setNavigationBarColor({ | |
242 | - frontColor: '#ffffff', // 必写项 | |
243 | - backgroundColor: '#ff7295', // 必写项 | |
244 | - }) | |
245 | - } | |
246 | - | |
247 | - //--正再拼团中的处理-- | |
248 | - var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" | |
249 | - await getApp().request.promiseGet(url, {}).then(res => { | |
250 | - if (res.data.code == 0 && res.data.data && res.data.data.pageData) { | |
251 | - th.data.pt_timer_arr = res.data.data.pageData; | |
252 | - } | |
253 | - }) | |
254 | - if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) { | |
255 | - for (var i in th.data.pt_timer_arr) { | |
256 | - var p_item = th.data.pt_timer_arr[i]; | |
257 | - await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, { | |
258 | - 1: 1 | |
259 | - }).then(res => { | |
260 | - th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; | |
261 | - th.data.pt_timer_arr[i].nickname = res.data.data.nickname; | |
262 | - }) | |
263 | - } | |
264 | - th.Interval_pt(); | |
265 | - } | |
266 | - | |
267 | - //---处理正在6个分类---- | |
268 | - await getApp().request.promiseGet("/api/weshop/goodscategory/page", { | |
269 | - data: { | |
270 | - store_id: os.stoid, | |
271 | - pageSize: 5, | |
272 | - is_show: 1, | |
273 | - level: 1 | |
274 | - } | |
275 | - }).then(res => { | |
276 | - if (res.data.data) { | |
277 | - var gd_category = res.data.data.pageData; | |
278 | - th.setData({ | |
279 | - gd_category: gd_category | |
280 | - }); | |
281 | - } | |
282 | - }) | |
283 | - }, | |
284 | - | |
285 | - | |
286 | - //关闭新用户领取广告 | |
287 | - close_disgraceful: function () { | |
288 | - var th = this; | |
289 | - th.setData({ | |
290 | - is_disgraceful: 0 | |
291 | - }) | |
292 | - }, | |
293 | - | |
294 | - async onShow() { | |
295 | - | |
296 | - getApp().check_can_share(); | |
22 | + data: { | |
23 | + url: o.imghost, | |
24 | + swiperimage: [{ | |
25 | + image: "/miniapp/images/title.png", | |
26 | + nav_url: 0 | |
27 | + }], | |
28 | + resourceUrl: o.resourceUrl, | |
29 | + logo: o.appLogo, | |
30 | + homeData: null, | |
31 | + saleGoods: null, | |
32 | + sale: { | |
33 | + countTime: { | |
34 | + hour: 0, | |
35 | + minute: 0, | |
36 | + second: 0 | |
37 | + }, | |
38 | + diffTime: 0, | |
39 | + good: null, | |
40 | + }, | |
41 | + timer: null, | |
42 | + recommend: null, | |
43 | + scrollTop: 0, | |
44 | + currentPage: 1, | |
45 | + banner: null, | |
46 | + | |
47 | + appdata: null, | |
48 | + saleGoods: null, //秒杀数据 | |
49 | + pindGoods: null, //拼单数据 | |
50 | + newGoods: null, //新商品 | |
51 | + hotGoods: null, //hot商品 | |
52 | + preGoods: null, //预售商品 | |
53 | + //----控制是是否显示计时器--- | |
54 | + is_timer: 1, | |
55 | + ishow: 0, | |
56 | + //是不是显示自定义模板 | |
57 | + isTemplate: 0, | |
58 | + template_arr: null, | |
59 | + bgcolor_t: '', | |
60 | + | |
61 | + banner_index: 0, | |
62 | + flash_index: 0, | |
63 | + pt_index: 0, | |
64 | + | |
65 | + pt_timer_item: null, | |
66 | + pt_timer_arr: null, | |
67 | + pt_timer: null, | |
68 | + pt_timer_active: 0, | |
69 | + //看下商家是否开通会员权益 | |
70 | + is_boot: 0, | |
71 | + gd_category: null, | |
72 | + is_no_more: 0, | |
73 | + max_sw_height: 0, //banner的最大高度 | |
74 | + is_disgraceful: 0, //是否显示新人广告 | |
75 | + new_image: "", //新人有礼弹窗图片 | |
76 | + new_nav: "", //新人页面跳转地址 | |
77 | + w_holiday_pop: 0, | |
78 | + | |
79 | + showHongbao: false, | |
80 | + showHongbaoSmall: false, | |
81 | + | |
82 | + is_full_screen_show: 0, //全屏显示 | |
83 | + sec_show: 3, //倒计时的秒数 | |
84 | + full_ad: null, //全屏广告 | |
85 | + full_screen: 0, //全屏广告 | |
86 | + is_ok_h5: 0, //判断要不要显示关注二维码 | |
87 | + }, | |
88 | + | |
89 | + onLoad: async function (tt) { | |
90 | + wx.showShareMenu({ | |
91 | + withShareTicket:true, | |
92 | + menus:['shareAppMessage','shareTimeline'] | |
93 | + }) | |
94 | + var th = this; | |
95 | + var first_leader = tt.first_leader; | |
96 | + if (!first_leader && tt.scene) { | |
97 | + var first_leader_str = decodeURIComponent(tt.scene); | |
98 | + var f_arr = first_leader_str.split("_"); | |
99 | + first_leader = f_arr[0] && parseFloat(f_arr[0]) > 0 ? f_arr[0] : null; | |
100 | + //注册门店 | |
101 | + if (f_arr[1] && parseFloat(f_arr[1]) > 0) { | |
102 | + getApp().globalData.store_number = f_arr[1]; | |
103 | + } | |
104 | + } | |
105 | + | |
106 | + getApp().getConfig(function (e) { | |
107 | + //--首页的问题-- | |
108 | + if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) { | |
109 | + wx.setNavigationBarTitle({ | |
110 | + title: getApp().globalData.config.store_name, | |
111 | + }); | |
112 | + } else { | |
113 | + wx.setNavigationBarTitle({ | |
114 | + title: getApp().globalData.setting.appName, | |
115 | + }); | |
116 | + }; | |
117 | + }); | |
118 | + | |
119 | + | |
120 | + var th = this; | |
121 | + getApp().getConfig2(function (config2) { | |
122 | + if (config2 && config2.is_overdue == 1) { | |
123 | + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=5", {}).then(res => { | |
124 | + var o = res; | |
125 | + if (o.data.code == 0) { | |
126 | + var ob = { isout: 0, isbuy: 1 }; | |
127 | + var arr = o.data.data.pageData; | |
128 | + var isbuy = 0; | |
129 | + //----如果数组不为空---- | |
130 | + if (arr.length > 0) { | |
131 | + arr.forEach(function (val, ind) { | |
132 | + if (val.is_sy == 0 && val.type == 5) { | |
133 | + isbuy = 1; | |
134 | + var now = ut.gettimestamp(); | |
135 | + if (now > val.end_time) ob.isout = 1; | |
136 | + return false; | |
137 | + } | |
138 | + }) | |
139 | + } | |
140 | + ob.isbuy = isbuy; | |
141 | + | |
142 | + var pages = getCurrentPages(); //获取加载的页面 | |
143 | + var currentPage = pages[pages.length - 1]; //获取当前页面的对象 | |
144 | + | |
145 | + // console.log("当前路由"); | |
146 | + // console.log(currentPage.route); | |
147 | + | |
148 | + | |
149 | + th.setappdata(ob); | |
150 | + | |
151 | + if (ob.isbuy && !ob.isout) { | |
152 | + th.onload_init(); | |
153 | + } | |
154 | + } else { | |
155 | + th.onload_init(); | |
156 | + } | |
157 | + }) | |
158 | + } | |
159 | + else { | |
160 | + th.onload_init(); | |
161 | + } | |
162 | + }) | |
163 | + | |
164 | + if (first_leader) { | |
165 | + //-- user_id代过来免登录 -- | |
166 | + getApp().globalData.first_leader = first_leader; | |
167 | + //调用接口判断是不是会员 | |
168 | + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { | |
169 | + if (res.data.code == 0) { | |
170 | + getApp().globalData.guide_id = res.data.data.id; | |
171 | + } | |
172 | + }) | |
173 | + } | |
174 | + | |
175 | + // 判断是否有红包活动 | |
176 | + getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, { | |
177 | + data: {} | |
178 | + }).then(function (data) { | |
179 | + let code = data.data.code; | |
180 | + if (code == 0) { | |
181 | + | |
182 | + th.setData({ | |
183 | + showHongbao: true, | |
184 | + }); | |
185 | + } else if (code == -1) { | |
186 | + th.setData({ | |
187 | + showHongbao: false, | |
188 | + }); | |
189 | + }; | |
190 | + }); | |
191 | + | |
192 | + | |
193 | + // console.log(9090909); | |
194 | + //看一下商家是否开通了权益 | |
195 | + //--初始化是否有打勾-- | |
196 | + getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { | |
197 | + data: { | |
198 | + storeId: os.stoid | |
199 | + } | |
200 | + }).then(res => { | |
201 | + if (res.data.data) { | |
202 | + var is_init = res.data.data.isBool; | |
203 | + th.setData({ | |
204 | + is_boot: is_init | |
205 | + }); | |
206 | + | |
207 | + if (!is_init) { | |
208 | + th.setData({ | |
209 | + swiperimage: [] | |
210 | + }); | |
211 | + } | |
212 | + } | |
213 | + }) | |
214 | + | |
215 | + | |
216 | + | |
217 | + //调用底部导航 | |
218 | + //getApp().globalData.url=th.data.url | |
219 | + //t.editTabBar(th,o.stoid,th.data.url); | |
220 | + | |
221 | + }, | |
222 | + | |
223 | + async onload_init() { | |
224 | + var th = this; | |
225 | + await this.init_load(); | |
226 | + //显示的时候要开启计时器 | |
227 | + this.data.is_timer = 1; | |
228 | + //如果是自定义模板 | |
229 | + if (this.data.isTemplate) { | |
230 | + //---先获取会员--- | |
231 | + //t.getUserFir(function () { | |
232 | + if (getApp().globalData.user_id) { | |
233 | + th.is_festival(); | |
234 | + var new_nav = th.data.new_nav; | |
235 | + if (new_nav == "") { | |
236 | + th.is_new(); | |
237 | + } | |
238 | + // sty | |
239 | + setTimeout(function () { | |
240 | + if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
241 | + }, 500) | |
242 | + } | |
243 | + | |
244 | + //}); | |
245 | + } else { | |
246 | + await this.init_fir(); | |
247 | + wx.setNavigationBarColor({ | |
248 | + frontColor: '#ffffff', // 必写项 | |
249 | + backgroundColor: '#ff7295', // 必写项 | |
250 | + }) | |
251 | + } | |
252 | + | |
253 | + //--正再拼团中的处理-- | |
254 | + var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" | |
255 | + await getApp().request.promiseGet(url, {}).then(res => { | |
256 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData) { | |
257 | + th.data.pt_timer_arr = res.data.data.pageData; | |
258 | + } | |
259 | + }) | |
260 | + if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) { | |
261 | + for (var i in th.data.pt_timer_arr) { | |
262 | + var p_item = th.data.pt_timer_arr[i]; | |
263 | + await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, { | |
264 | + 1: 1 | |
265 | + }).then(res => { | |
266 | + th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; | |
267 | + th.data.pt_timer_arr[i].nickname = res.data.data.nickname; | |
268 | + }) | |
269 | + } | |
270 | + th.Interval_pt(); | |
271 | + } | |
272 | + | |
273 | + //---处理正在6个分类---- | |
274 | + await getApp().request.promiseGet("/api/weshop/goodscategory/page", { | |
275 | + data: { | |
276 | + store_id: os.stoid, | |
277 | + pageSize: 5, | |
278 | + is_show: 1, | |
279 | + level: 1 | |
280 | + } | |
281 | + }).then(res => { | |
282 | + if (res.data.data) { | |
283 | + var gd_category = res.data.data.pageData; | |
284 | + th.setData({ | |
285 | + gd_category: gd_category | |
286 | + }); | |
287 | + } | |
288 | + }) | |
289 | + }, | |
290 | + | |
291 | + | |
292 | + //关闭新用户领取广告 | |
293 | + close_disgraceful: function () { | |
294 | + var th = this; | |
295 | + th.setData({ | |
296 | + is_disgraceful: 0 | |
297 | + }) | |
298 | + }, | |
299 | + | |
300 | + async onShow() { | |
301 | + | |
302 | + getApp().check_can_share(); | |
303 | + | |
304 | + this.getTabBar().setData({ | |
305 | + cartGoodsNum: getApp().globalData.cartGoodsNum | |
306 | + }) | |
307 | + var th = this; | |
308 | + //-- 登录回来判断弹框 -- | |
309 | + var user_id = getApp().globalData.user_id; | |
310 | + | |
311 | + if (!user_id) { | |
312 | + var userinfo = wx.getStorageSync('userinfo'); | |
313 | + if (userinfo) user_id = userinfo.user_id | |
314 | + } | |
315 | + | |
316 | + if (user_id) { | |
317 | + th.is_festival(); | |
318 | + var new_nav = th.data.new_nav; | |
319 | + if (new_nav == "") { | |
320 | + th.is_new(); | |
321 | + } | |
322 | + } | |
323 | + | |
324 | + console.log(this.data.isTemplate, '首页'); | |
325 | + | |
326 | + if (!this.data.isTemplate) { | |
327 | + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1 }; | |
328 | + if (user_id) { | |
329 | + pre_data.user_id = user_id; | |
330 | + } | |
331 | + | |
332 | + getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { | |
333 | + data: pre_data, | |
334 | + success: function (e) { | |
335 | + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | |
336 | + var pre_data = e.data.data.pageData; | |
337 | + var arr = new Array(); | |
338 | + //--三个三个一组--- | |
339 | + for (var i = 0; i < pre_data.length; i += 3) { | |
340 | + arr.push(pre_data.slice(i, i + 3)); | |
341 | + } | |
342 | + th.setData({ | |
343 | + preGoods: arr | |
344 | + }); | |
345 | + } else { | |
346 | + th.setData({ | |
347 | + preGoods: null | |
348 | + }); | |
349 | + } | |
350 | + } | |
351 | + }) | |
297 | 352 | |
353 | + // 获取幸运购活动列表 | |
354 | + getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { | |
355 | + data: { | |
356 | + store_id: getApp().globalData.setting.stoid, | |
357 | + is_end: 0, | |
358 | + timetype: 1, | |
359 | + } | |
360 | + }).then(res => { | |
361 | + if (res.data.code == 0) { | |
362 | + th.setData({ | |
363 | + luckGo_list: res.data.data.pageData.slice(0, 3), | |
364 | + }); | |
365 | + } | |
366 | + }); | |
367 | + | |
368 | + //-----秒杀----- | |
369 | + var flash_data = null; | |
370 | + var f_req = { | |
371 | + store_id: os.stoid, | |
372 | + timetype: 2, | |
373 | + is_end: 0, | |
374 | + is_show: 1, | |
375 | + pageSize: 9, | |
376 | + user_id: 0 | |
377 | + }; | |
378 | + if (user_id) f_req.user_id = user_id; | |
379 | + //--获取活动-- | |
380 | + await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { | |
381 | + data: f_req, | |
382 | + }).then(res => { | |
383 | + var e = res; | |
384 | + if (e.data.code == 0) { | |
385 | + flash_data = e.data.data.pageData; | |
386 | + if (flash_data == null || flash_data.length <= 0) return false; | |
387 | + | |
388 | + //当前时间戳 | |
389 | + var nt = ut.gettimestamp(); | |
390 | + | |
391 | + flash_data.forEach(function (val, ind) { | |
392 | + | |
393 | + if (val.user_price) val.price = val.user_price; | |
394 | + if (val.start_time > nt) { | |
395 | + flash_data[ind].status = 0; | |
396 | + } else if (val.end_time > nt) { | |
397 | + flash_data[ind].status = 1; | |
398 | + } | |
399 | + | |
400 | + if (val.buy_num >= val.goods_num) { | |
401 | + flash_data[ind].status = 2; | |
402 | + } | |
403 | + }); | |
404 | + | |
405 | + var promisies = []; | |
406 | + for (const key in flash_data) { | |
407 | + if (Object.hasOwnProperty.call(flash_data, key)) { | |
408 | + const val = flash_data[key]; | |
409 | + promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | |
410 | + os.stoid + "/1/" + val.id, | |
411 | + {} | |
412 | + ).then(res => { | |
413 | + if (res.data.code == 0) { | |
414 | + if (res.data.data <= 0) flash_data[key].status = 2; | |
415 | + }; | |
416 | + }); | |
417 | + } | |
418 | + } | |
419 | + | |
420 | + Promise.all(promisies).then(() => { | |
421 | + var arr = new Array(); | |
422 | + //--三个三个一组--- | |
423 | + for (var i = 0; i < flash_data.length; i += 3) { | |
424 | + arr.push(flash_data.slice(i, i + 3)); | |
425 | + } | |
426 | + | |
427 | + th.setData({ | |
428 | + saleGoods: arr | |
429 | + }); | |
430 | + }); | |
431 | + | |
432 | + | |
433 | + | |
434 | + } | |
435 | + }); | |
436 | + | |
437 | + } | |
438 | + | |
439 | + | |
440 | + | |
441 | + | |
442 | + | |
443 | + | |
444 | + | |
445 | + | |
446 | + | |
447 | + //优惠券要实时更新 | |
448 | + getApp().getConfig2(function (e) { | |
449 | + var json_d = JSON.parse(e.switch_list); | |
450 | + th.setData({ is_closecoupon: json_d.is_closecoupon }) | |
451 | + th.setData({ is_topstore: json_d.is_show_storeselect }) | |
452 | + if (json_d.is_gz_h5) th.setData({ is_gz_h5: json_d.is_gz_h5 }) | |
453 | + }, 1) | |
454 | + | |
455 | + if (typeof this.getTabBar === 'function' && this.getTabBar()) { | |
456 | + var index = getApp().getPageIndex(this); | |
298 | 457 | this.getTabBar().setData({ |
299 | - cartGoodsNum: getApp().globalData.cartGoodsNum | |
458 | + active: index //数字是当前页面在tabbar的索引 | |
300 | 459 | }) |
301 | - var th = this; | |
302 | - //-- 登录回来判断弹框 -- | |
303 | - var user_id=getApp().globalData.user_id; | |
304 | - | |
305 | - if(!user_id){ | |
306 | - var userinfo=wx.getStorageSync('userinfo'); | |
307 | - if(userinfo) user_id=userinfo.user_id | |
308 | - } | |
309 | - | |
310 | - if (user_id) { | |
311 | - th.is_festival(); | |
312 | - var new_nav = th.data.new_nav; | |
313 | - if (new_nav == "") { | |
314 | - th.is_new(); | |
315 | - } | |
316 | - } | |
317 | - | |
318 | - console.log(this.data.isTemplate,'首页'); | |
319 | - | |
320 | - if(!this.data.isTemplate){ | |
321 | - var pre_data={store_id:os.stoid,is_end:0,timetype:1,isuse:1}; | |
322 | - if(user_id){ | |
323 | - pre_data.user_id= user_id; | |
324 | - } | |
325 | - | |
326 | - getApp().request.get("/api/weshop/marketing/marketingPresellList/page",{ | |
327 | - data:pre_data, | |
328 | - success:function (e) { | |
329 | - if(e.data.code==0 && e.data.data.pageData && e.data.data.pageData.length>0 ){ | |
330 | - var pre_data=e.data.data.pageData; | |
331 | - var arr = new Array(); | |
332 | - //--三个三个一组--- | |
333 | - for (var i = 0; i < pre_data.length; i += 3) { | |
334 | - arr.push(pre_data.slice(i, i + 3)); | |
335 | - } | |
336 | - th.setData({ | |
337 | - preGoods: arr | |
338 | - }); | |
339 | - }else{ | |
340 | - th.setData({ | |
341 | - preGoods: null | |
342 | - }); | |
343 | - } | |
344 | - } | |
345 | - }) | |
346 | - | |
347 | - // 获取幸运购活动列表 | |
348 | - getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { | |
349 | - data: { | |
350 | - store_id: getApp().globalData.setting.stoid, | |
351 | - is_end: 0, | |
352 | - timetype: 1, | |
353 | - } | |
354 | - }).then(res => { | |
355 | - if(res.data.code == 0) { | |
356 | - th.setData({ | |
357 | - luckGo_list: res.data.data.pageData.slice(0,3), | |
358 | - }); | |
359 | - } | |
360 | - }); | |
361 | - | |
362 | - //-----秒杀----- | |
363 | - var flash_data = null; | |
364 | - var f_req={ | |
365 | - store_id: os.stoid, | |
366 | - timetype: 2, | |
367 | - is_end: 0, | |
368 | - is_show: 1, | |
369 | - pageSize: 9, | |
370 | - user_id:0 | |
371 | - }; | |
372 | - if(user_id) f_req.user_id=user_id; | |
373 | - //--获取活动-- | |
374 | - await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { | |
375 | - data:f_req , | |
376 | - }).then(res => { | |
377 | - var e = res; | |
378 | - if (e.data.code == 0) { | |
379 | - flash_data = e.data.data.pageData; | |
380 | - if (flash_data == null || flash_data.length <= 0) return false; | |
381 | - | |
382 | - //当前时间戳 | |
383 | - var nt = ut.gettimestamp(); | |
384 | - | |
385 | - flash_data.forEach(function (val, ind) { | |
386 | - | |
387 | - if(val.user_price) val.price=val.user_price; | |
388 | - if (val.start_time > nt) { | |
389 | - flash_data[ind].status = 0; | |
390 | - } else if (val.end_time > nt) { | |
391 | - flash_data[ind].status = 1; | |
392 | - } | |
393 | - | |
394 | - if (val.buy_num >= val.goods_num){ | |
395 | - flash_data[ind].status = 2; | |
396 | - } | |
397 | - }); | |
398 | - | |
399 | - var promisies = []; | |
400 | - for (const key in flash_data) { | |
401 | - if (Object.hasOwnProperty.call(flash_data, key)) { | |
402 | - const val = flash_data[key]; | |
403 | - promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | |
404 | - os.stoid + "/1/" + val.id, | |
405 | - {} | |
406 | - ).then(res => { | |
407 | - if (res.data.code == 0) { | |
408 | - if (res.data.data <= 0) flash_data[key].status = 2; | |
409 | - }; | |
410 | - }); | |
411 | - } | |
412 | - } | |
413 | - | |
414 | - Promise.all(promisies).then(() => { | |
415 | - var arr = new Array(); | |
416 | - //--三个三个一组--- | |
417 | - for (var i = 0; i < flash_data.length; i += 3) { | |
418 | - arr.push(flash_data.slice(i, i + 3)); | |
419 | - } | |
420 | - | |
421 | - th.setData({ | |
422 | - saleGoods: arr | |
423 | - }); | |
424 | - }); | |
425 | - | |
426 | - | |
427 | - | |
428 | - } | |
429 | - }); | |
430 | - | |
431 | - } | |
432 | - | |
433 | - | |
434 | - | |
435 | - | |
436 | - | |
437 | - | |
438 | - | |
439 | - | |
440 | - | |
441 | - //优惠券要实时更新 | |
442 | - getApp().getConfig2(function (e) { | |
443 | - var json_d = JSON.parse(e.switch_list); | |
444 | - th.setData({ is_closecoupon: json_d.is_closecoupon }) | |
445 | - th.setData({ is_topstore: json_d.is_show_storeselect }) | |
446 | - if(json_d.is_gz_h5) th.setData({is_gz_h5:json_d.is_gz_h5}) | |
447 | - }, 1) | |
448 | - | |
449 | - if (typeof this.getTabBar === 'function' && this.getTabBar()) { | |
450 | - var index = getApp().getPageIndex(this); | |
451 | - this.getTabBar().setData({ | |
452 | - active: index //数字是当前页面在tabbar的索引 | |
453 | - }) | |
454 | 460 | |
455 | 461 | |
456 | - getApp().requestCardNum(this); | |
457 | - } | |
458 | - | |
459 | - var th = this; | |
460 | - | |
461 | - var show = getApp().globalData.isLoad_ad; | |
462 | - | |
463 | - if(!show){ | |
464 | - setTimeout(function () { | |
465 | - full_screen.get_the_full_screen(th); | |
466 | - }, 800); | |
467 | - getApp().globalData.isLoad_ad=1; | |
468 | - if (!th.data.f_hidden) { | |
469 | - setTimeout(function () { | |
470 | - th.setData({ f_hidden: 1 }) | |
471 | - wx.hideLoading(); | |
472 | - }, 960) | |
473 | - } | |
474 | - } else { | |
475 | - th.setData({ f_hidden: 1 }) | |
476 | - } | |
477 | - | |
478 | - setTimeout(function () { | |
479 | - const query = wx.createSelectorQuery(); | |
480 | - query.select('#off_top').boundingClientRect(); | |
481 | - query.exec((res) => { | |
482 | - if(res && res[0] && res[0].height>0){ | |
483 | - th.setData({is_ok_h5:1}); | |
484 | - } | |
485 | - }) | |
486 | - },3600); | |
487 | - | |
488 | - }, | |
489 | - //当隐藏的时候就关闭计时器 | |
490 | - onHide: function () { | |
491 | - this.data.is_timer = 0; | |
492 | - if (this.data.pt_timer) clearInterval(this.data.pt_timer); | |
493 | - if (this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop); | |
494 | - if (this.data.full_screen) clearInterval(this.data.full_screen); | |
495 | - this.data.w_holiday_pop = 0; | |
496 | - | |
497 | - }, | |
498 | - | |
499 | - //同步初始加载 | |
500 | - async init_load() { | |
501 | - var th = this; | |
502 | - //因为营销版本的功能包含了自定义模板的功能,是同时的 | |
503 | - //读取全局是否有弄自定义模板 | |
504 | - await api.get_template_fir(o.stoid).then(res => { | |
505 | - var data = res.data.data; | |
506 | - if (data && data.length > 0) { | |
507 | - var temp_data = data[0]; | |
508 | - var t_arr = JSON.parse(temp_data.json_str); | |
509 | - | |
510 | - th.setData({ | |
511 | - template_arr: t_arr, | |
512 | - isTemplate: 1, | |
513 | - bgcolor_t: temp_data.bkcolor | |
514 | - }); | |
515 | - | |
516 | - //---如果有设定顶部的颜色的时候-- | |
517 | - if (temp_data.top_color && temp_data.top_color != 'null') { | |
518 | - | |
519 | - var top_w_color = "#ffffff"; | |
520 | - if (temp_data.top_word_color && temp_data.top_word_color == 'black') { | |
521 | - top_w_color = "#000000"; | |
522 | - } | |
523 | - wx.setNavigationBarColor({ | |
524 | - frontColor: top_w_color, // 必写项 | |
525 | - backgroundColor: temp_data.top_color, // 必写项 | |
526 | - }) | |
527 | - } | |
528 | - } | |
529 | - }) | |
530 | - | |
531 | - | |
532 | - }, | |
533 | - //---读取数据内容--- | |
534 | - async init_fir() { | |
535 | - console.log('init_fir'); | |
536 | - var th = this; | |
537 | - //----广告---- | |
538 | - var e = this; | |
539 | - await getApp().request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + o.stoid, { | |
540 | - data: { | |
541 | - enabled: 1 | |
542 | - } | |
543 | - }).then(res => { | |
544 | - | |
545 | - if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { | |
546 | - var a = res.data.data.pageData; | |
547 | - var arr = new Array(); | |
548 | - for (var i = 0; i < a.length; i++) { | |
549 | - var tt = { | |
550 | - 'ad_code': o.imghost + a[i].ad_code, | |
551 | - 'media_link': '', | |
552 | - 'ad_weapplink': a[i].ad_weapplink | |
553 | - }; | |
554 | - arr.push(tt); | |
555 | - } | |
556 | - if (arr.length > 0) e.setData({ | |
557 | - banner: arr, | |
558 | - }); | |
559 | - | |
560 | - wx.stopPullDownRefresh(); | |
561 | - } | |
562 | - }) | |
563 | - let user_id=getApp().globalData.user_id; | |
564 | - | |
565 | - //----拼单----- | |
566 | - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", { | |
567 | - data: { | |
568 | - store_id: os.stoid, | |
569 | - is_end: 0, | |
570 | - is_show: 1, | |
571 | - pageSize: 6, | |
572 | - user_id, | |
573 | - } | |
574 | - }).then(res => { | |
575 | - var e = res; | |
576 | - if (e.data.code == 0) { | |
577 | - var pd_data = e.data.data.pageData; | |
578 | - | |
579 | - if (pd_data.length == 0) return; | |
580 | - | |
581 | - //获取当前 | |
582 | - var nt = ut.gettimestamp(); | |
583 | - pd_data.forEach(function (val, ind) { | |
584 | - if (val.start_time > nt) pd_data[ind].status = 0; | |
585 | - else if (val.end_time > nt) pd_data[ind].status = 1; | |
586 | - if (val.buy_num >= val.goods_num) pd_data[ind].status = 2; | |
587 | - }); | |
588 | - | |
589 | - //获取当前时间,比较拼团中还在未开始 | |
590 | - var timestamp = new Date().getTime(); | |
591 | - var is_team_tepy; | |
592 | - for (var j = 0; j < pd_data.length; j++) { | |
593 | - pd_data[j].is_team_tepy = 1; | |
594 | - if (timestamp < pd_data[j].start_time * 1000) { | |
595 | - var is_team_tepy; | |
596 | - pd_data[j].is_team_tepy = 0; | |
597 | - } | |
598 | - } | |
599 | - | |
600 | - var arr = new Array(); | |
601 | - //--2个2个一组--- | |
602 | - for (var i = 0; i < pd_data.length; i += 2) { | |
603 | - | |
604 | - arr.push(pd_data.slice(i, i + 2)); | |
605 | - } | |
606 | - | |
607 | - th.setData({ | |
608 | - pindGoods: arr | |
609 | - }); | |
610 | - th.countDown2(); | |
611 | - } | |
612 | - }) | |
613 | - | |
614 | - //------新品------- | |
615 | - await getApp().request.promiseGet("/api/weshop/goods/page?page=1", { | |
616 | - data: { | |
617 | - is_mainshow: 1, | |
618 | - isonsale: 1, | |
619 | - is_on_sale: 1, | |
620 | - store_id: o.stoid, | |
621 | - pageSize: 9, | |
622 | - is_new: 1, | |
623 | - orderField: "sort" | |
624 | - } | |
625 | - }).then(res => { | |
626 | - var e = res; | |
627 | - if (e.data.code == 0) { | |
628 | - var new_data = e.data.data.pageData; | |
629 | - var arr = new Array(); | |
630 | - //--三个三个一组--- | |
631 | - for (var i = 0; i < new_data.length; i += 3) { | |
632 | - arr.push(new_data.slice(i, i + 3)); | |
633 | - } | |
634 | - th.setData({ | |
635 | - newGoods: arr, | |
636 | - }); | |
637 | - } | |
638 | - }) | |
639 | - | |
640 | - //------热卖------- | |
641 | - await getApp().request.promiseGet("/api/weshop/goods/page?page=1", { | |
642 | - data: { | |
643 | - is_mainshow: 1, | |
644 | - isonsale: 1, | |
645 | - is_on_sale: 1, | |
646 | - store_id: o.stoid, | |
647 | - pageSize: 9, | |
648 | - is_hot: 1, | |
649 | - orderField: "sort" | |
650 | - } | |
651 | - }).then(res => { | |
652 | - var e = res; | |
653 | - if (e.data.code == 0) { | |
654 | - var new_data = e.data.data.pageData; | |
655 | - var arr = new Array(); | |
656 | - //--三个三个一组--- | |
657 | - for (var i = 0; i < new_data.length; i += 3) { | |
658 | - arr.push(new_data.slice(i, i + 3)); | |
659 | - } | |
660 | - console.log(arr); | |
661 | - th.setData({ | |
662 | - hotGoods: arr, | |
663 | - }); | |
664 | - } | |
665 | - }) | |
666 | - | |
667 | - //---调用信息--- | |
668 | - // this.requestRecommend(); | |
669 | - this.setData({ | |
670 | - ishow: 1 | |
671 | - }); | |
672 | - | |
673 | - //---先获取会员--- | |
674 | - //t.getUserFir(function () { | |
675 | - if(getApp().globalData.user_id) { | |
676 | - th.is_festival(); | |
677 | - var new_nav = th.data.new_nav; | |
678 | - if (new_nav == "") { | |
679 | - th.is_new(); | |
462 | + getApp().requestCardNum(this); | |
463 | + } | |
464 | + | |
465 | + var th = this; | |
466 | + | |
467 | + var show = getApp().globalData.isLoad_ad; | |
468 | + | |
469 | + if (!show) { | |
470 | + setTimeout(function () { | |
471 | + full_screen.get_the_full_screen(th); | |
472 | + }, 800); | |
473 | + getApp().globalData.isLoad_ad = 1; | |
474 | + if (!th.data.f_hidden) { | |
475 | + setTimeout(function () { | |
476 | + th.setData({ f_hidden: 1 }) | |
477 | + wx.hideLoading(); | |
478 | + }, 960) | |
479 | + } | |
480 | + } else { | |
481 | + th.setData({ f_hidden: 1 }) | |
482 | + } | |
483 | + | |
484 | + setTimeout(function () { | |
485 | + const query = wx.createSelectorQuery(); | |
486 | + query.select('#off_top').boundingClientRect(); | |
487 | + query.exec((res) => { | |
488 | + if (res && res[0] && res[0].height > 0) { | |
489 | + th.setData({ is_ok_h5: 1 }); | |
490 | + } | |
491 | + }) | |
492 | + }, 3600); | |
493 | + | |
494 | + }, | |
495 | + //当隐藏的时候就关闭计时器 | |
496 | + onHide: function () { | |
497 | + this.data.is_timer = 0; | |
498 | + if (this.data.pt_timer) clearInterval(this.data.pt_timer); | |
499 | + if (this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop); | |
500 | + if (this.data.full_screen) clearInterval(this.data.full_screen); | |
501 | + this.data.w_holiday_pop = 0; | |
502 | + | |
503 | + }, | |
504 | + | |
505 | + //同步初始加载 | |
506 | + async init_load() { | |
507 | + var th = this; | |
508 | + //因为营销版本的功能包含了自定义模板的功能,是同时的 | |
509 | + //读取全局是否有弄自定义模板 | |
510 | + await api.get_template_fir(o.stoid).then(res => { | |
511 | + var data = res.data.data; | |
512 | + if (data && data.length > 0) { | |
513 | + var temp_data = data[0]; | |
514 | + var t_arr = JSON.parse(temp_data.json_str); | |
515 | + | |
516 | + th.setData({ | |
517 | + template_arr: t_arr, | |
518 | + isTemplate: 1, | |
519 | + bgcolor_t: temp_data.bkcolor | |
520 | + }); | |
521 | + | |
522 | + //---如果有设定顶部的颜色的时候-- | |
523 | + if (temp_data.top_color && temp_data.top_color != 'null') { | |
524 | + | |
525 | + var top_w_color = "#ffffff"; | |
526 | + if (temp_data.top_word_color && temp_data.top_word_color == 'black') { | |
527 | + top_w_color = "#000000"; | |
528 | + } | |
529 | + wx.setNavigationBarColor({ | |
530 | + frontColor: top_w_color, // 必写项 | |
531 | + backgroundColor: temp_data.top_color, // 必写项 | |
532 | + }) | |
533 | + } | |
534 | + } | |
535 | + }) | |
536 | + | |
537 | + | |
538 | + }, | |
539 | + //---读取数据内容--- | |
540 | + async init_fir() { | |
541 | + console.log('init_fir'); | |
542 | + var th = this; | |
543 | + //----广告---- | |
544 | + var e = this; | |
545 | + await getApp().request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + o.stoid, { | |
546 | + data: { | |
547 | + enabled: 1 | |
548 | + } | |
549 | + }).then(res => { | |
550 | + | |
551 | + if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { | |
552 | + var a = res.data.data.pageData; | |
553 | + var arr = new Array(); | |
554 | + for (var i = 0; i < a.length; i++) { | |
555 | + var tt = { | |
556 | + 'ad_code': o.imghost + a[i].ad_code, | |
557 | + 'media_link': '', | |
558 | + 'ad_weapplink': a[i].ad_weapplink | |
559 | + }; | |
560 | + arr.push(tt); | |
561 | + } | |
562 | + if (arr.length > 0) e.setData({ | |
563 | + banner: arr, | |
564 | + }); | |
565 | + | |
566 | + wx.stopPullDownRefresh(); | |
567 | + } | |
568 | + }) | |
569 | + let user_id = getApp().globalData.user_id; | |
570 | + | |
571 | + //----拼单----- | |
572 | + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", { | |
573 | + data: { | |
574 | + store_id: os.stoid, | |
575 | + is_end: 0, | |
576 | + is_show: 1, | |
577 | + pageSize: 6, | |
578 | + user_id, | |
579 | + } | |
580 | + }).then(res => { | |
581 | + var e = res; | |
582 | + if (e.data.code == 0) { | |
583 | + var pd_data = e.data.data.pageData; | |
584 | + | |
585 | + if (pd_data.length == 0) return; | |
586 | + | |
587 | + //获取当前 | |
588 | + var nt = ut.gettimestamp(); | |
589 | + pd_data.forEach(function (val, ind) { | |
590 | + if (val.start_time > nt) pd_data[ind].status = 0; | |
591 | + else if (val.end_time > nt) pd_data[ind].status = 1; | |
592 | + if (val.buy_num >= val.goods_num) pd_data[ind].status = 2; | |
593 | + }); | |
594 | + | |
595 | + //获取当前时间,比较拼团中还在未开始 | |
596 | + var timestamp = new Date().getTime(); | |
597 | + var is_team_tepy; | |
598 | + for (var j = 0; j < pd_data.length; j++) { | |
599 | + pd_data[j].is_team_tepy = 1; | |
600 | + if (timestamp < pd_data[j].start_time * 1000) { | |
601 | + var is_team_tepy; | |
602 | + pd_data[j].is_team_tepy = 0; | |
603 | + } | |
604 | + } | |
605 | + | |
606 | + var arr = new Array(); | |
607 | + //--2个2个一组--- | |
608 | + for (var i = 0; i < pd_data.length; i += 2) { | |
609 | + | |
610 | + arr.push(pd_data.slice(i, i + 2)); | |
611 | + } | |
612 | + | |
613 | + th.setData({ | |
614 | + pindGoods: arr | |
615 | + }); | |
616 | + th.countDown2(); | |
617 | + } | |
618 | + }) | |
619 | + | |
620 | + //------新品------- | |
621 | + await getApp().request.promiseGet("/api/weshop/goods/page?page=1", { | |
622 | + data: { | |
623 | + is_mainshow: 1, | |
624 | + isonsale: 1, | |
625 | + is_on_sale: 1, | |
626 | + store_id: o.stoid, | |
627 | + pageSize: 9, | |
628 | + is_new: 1, | |
629 | + orderField: "sort" | |
630 | + } | |
631 | + }).then(res => { | |
632 | + var e = res; | |
633 | + if (e.data.code == 0) { | |
634 | + var new_data = e.data.data.pageData; | |
635 | + var arr = new Array(); | |
636 | + //--三个三个一组--- | |
637 | + for (var i = 0; i < new_data.length; i += 3) { | |
638 | + arr.push(new_data.slice(i, i + 3)); | |
639 | + } | |
640 | + th.setData({ | |
641 | + newGoods: arr, | |
642 | + }); | |
643 | + } | |
644 | + }) | |
645 | + | |
646 | + //------热卖------- | |
647 | + await getApp().request.promiseGet("/api/weshop/goods/page?page=1", { | |
648 | + data: { | |
649 | + is_mainshow: 1, | |
650 | + isonsale: 1, | |
651 | + is_on_sale: 1, | |
652 | + store_id: o.stoid, | |
653 | + pageSize: 9, | |
654 | + is_hot: 1, | |
655 | + orderField: "sort" | |
656 | + } | |
657 | + }).then(res => { | |
658 | + var e = res; | |
659 | + if (e.data.code == 0) { | |
660 | + var new_data = e.data.data.pageData; | |
661 | + var arr = new Array(); | |
662 | + //--三个三个一组--- | |
663 | + for (var i = 0; i < new_data.length; i += 3) { | |
664 | + arr.push(new_data.slice(i, i + 3)); | |
665 | + } | |
666 | + console.log(arr); | |
667 | + th.setData({ | |
668 | + hotGoods: arr, | |
669 | + }); | |
670 | + } | |
671 | + }) | |
672 | + | |
673 | + //---调用信息--- | |
674 | + // this.requestRecommend(); | |
675 | + this.setData({ | |
676 | + ishow: 1 | |
677 | + }); | |
678 | + | |
679 | + //---先获取会员--- | |
680 | + //t.getUserFir(function () { | |
681 | + if (getApp().globalData.user_id) { | |
682 | + th.is_festival(); | |
683 | + var new_nav = th.data.new_nav; | |
684 | + if (new_nav == "") { | |
685 | + th.is_new(); | |
686 | + } | |
687 | + | |
688 | + // sty | |
689 | + setTimeout(function () { | |
690 | + if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
691 | + }, 500) | |
692 | + } | |
693 | + //}); | |
694 | + | |
695 | + setTimeout(function () { | |
696 | + var goods_list = th.selectComponent("#goods_list"); //组件的id | |
697 | + goods_list.init(); | |
698 | + goods_list.get_list(); | |
699 | + }, 2000) | |
700 | + }, | |
701 | + | |
702 | + //--判断小程序是否过期-- | |
703 | + setappdata: function (t) { | |
704 | + if (t && t.isout == 1) | |
705 | + wx.reLaunch({ | |
706 | + url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:" + getApp().globalData.config.store_tel, | |
707 | + }); | |
708 | + if (t && t.isbuy == 0) | |
709 | + wx.reLaunch({ | |
710 | + url: "/pages/error/error?msg=还未购买小程序", | |
711 | + }); | |
712 | + }, | |
713 | + //---加载更多是靠这个函数---- | |
714 | + onReachBottom: function () { | |
715 | + var goods_list = this.selectComponent("#goods_list"); //组件的id | |
716 | + if (goods_list) goods_list.get_list(); | |
717 | + | |
718 | + if (getApp().globalData.func_list) { | |
719 | + for (let i in getApp().globalData.func_list) { | |
720 | + let item = getApp().globalData.func_list[i]; | |
721 | + item.re_show(); | |
722 | + } | |
723 | + } | |
724 | + }, | |
725 | + | |
726 | + onPullDownRefresh: function (e) { | |
727 | + this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(), | |
728 | + this.requestRecommend(); | |
729 | + }, | |
730 | + requestRecommend() { }, | |
731 | + requestHomePage() { }, | |
732 | + | |
733 | + onUnload: function () { | |
734 | + this.destroyActivityTimer(); | |
735 | + }, | |
736 | + setCountTime: function (e) { | |
737 | + e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({ | |
738 | + "sale.diffTime": e.diffTime | |
739 | + }), this.setData({ | |
740 | + "sale.good": e.flash_sale_goods[0] | |
741 | + }), this.destroyActivityTimer(), this.createActivityTimer(); | |
742 | + }, | |
743 | + createActivityTimer: function () { | |
744 | + var e = this.data.sale, | |
745 | + t = this; | |
746 | + this.data.timer = setInterval(function () { | |
747 | + var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime, | |
748 | + o = i.transTime(a); | |
749 | + a <= 0 ? t.requestHomePage() : t.setData({ | |
750 | + "sale.countTime": o | |
751 | + }); | |
752 | + }, 1e3); | |
753 | + }, | |
754 | + destroyActivityTimer: function () { | |
755 | + this.data.timer && (clearInterval(this.data.timer), this.data.timer = null); | |
756 | + }, | |
757 | + onPageScroll: function (e) { | |
758 | + this.data.scrollTop = e.scrollTop; | |
759 | + var t = getCurrentPages(); | |
760 | + "pages/index/index/index" == t[t.length - 1].route; | |
761 | + /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({ | |
762 | + frontColor: "#ffffff", | |
763 | + backgroundColor: "#f95959" | |
764 | + }) : wx.setNavigationBarColor({ | |
765 | + frontColor: "#000000", | |
766 | + backgroundColor: "#eeeeee" | |
767 | + }));--*/ | |
768 | + }, | |
769 | + jumpSearch: function () { | |
770 | + wx.navigateTo({ | |
771 | + url: "/pages/goods/search/search" | |
772 | + }); | |
773 | + }, | |
774 | + onShareAppMessage: function (e) { | |
775 | + getApp().globalData.no_clear = 1; | |
776 | + var url = "/pages/index/index/index"; | |
777 | + var userInfo = getApp().globalData.userInfo; | |
778 | + //是分销商才带 | |
779 | + if (userInfo) { | |
780 | + url += "?first_leader=" + userInfo.user_id; | |
781 | + } | |
782 | + console.log("---首页---分享--"); | |
783 | + var title = "商城首页" | |
784 | + //分享 | |
785 | + if (getApp().globalData.config && getApp().globalData.config.store_name) { | |
786 | + title = getApp().globalData.config.store_name; | |
787 | + } else if (getApp().globalData.setting.appName) { | |
788 | + title = getApp().globalData.setting.appName; | |
789 | + } | |
790 | + | |
791 | + var ob = { | |
792 | + title: title, | |
793 | + path: url, | |
794 | + }; | |
795 | + console.log(ob); | |
796 | + return ob; | |
797 | + }, | |
798 | + | |
799 | + //图片失败,默认图片 | |
800 | + bind_bnerr: function (e) { | |
801 | + var _errImg = e.target.dataset.errorimg; | |
802 | + var _errObj = {}; | |
803 | + _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg"; | |
804 | + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
805 | + }, | |
806 | + | |
807 | + //图片失败,默认图片 | |
808 | + bind_bnerr2: function (e) { | |
809 | + var _errImg = e.target.dataset.errorimg; | |
810 | + var _errurl = e.target.dataset.url; | |
811 | + var _errObj = {}; | |
812 | + _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; | |
813 | + this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
814 | + | |
815 | + }, | |
816 | + //图片失败,默认图片 | |
817 | + bind_bnerr3: function (e) { | |
818 | + var _errImg = e.target.dataset.errorimg; | |
819 | + var _Img = e.target.dataset.img; | |
820 | + if (_Img != undefined) { | |
821 | + var _errObj = {}; | |
822 | + _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; | |
823 | + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
824 | + } | |
825 | + }, | |
826 | + | |
827 | + | |
828 | + //秒杀倒计时 | |
829 | + //---小于10的格式化函数---- | |
830 | + timeFormat(param) { | |
831 | + return param < 10 ? '0' + param : param; | |
832 | + }, | |
833 | + | |
834 | + //----秒杀倒计时函数----- | |
835 | + countDown() { | |
836 | + if (!this.data.is_timer) return false; | |
837 | + var th = this; | |
838 | + // 获取当前时间,同时得到活动结束时间数组 | |
839 | + var newTime = ut.gettimestamp(); | |
840 | + var List = this.data.saleGoods; | |
841 | + for (var j = 0; j < List.length; j++) { | |
842 | + var endTimeList = List[j]; | |
843 | + // 对结束时间进行处理渲染到页面 | |
844 | + for (var i = 0; i < endTimeList.length; i++) { | |
845 | + var o = endTimeList[i]; | |
846 | + var endTime = o.end_time | |
847 | + if (o.status == 0) endTime = o.start_time | |
848 | + | |
849 | + var obj = null; | |
850 | + // 如果活动未结束,对时间进行处理 | |
851 | + if (endTime - newTime > 0) { | |
852 | + var time = (endTime - newTime); | |
853 | + // 获取天、时、分、秒 | |
854 | + var day = parseInt(time / (60 * 60 * 24)); | |
855 | + var hou = parseInt(time % (60 * 60 * 24) / 3600); | |
856 | + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
857 | + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
858 | + obj = { | |
859 | + day: this.timeFormat(day), | |
860 | + hou: this.timeFormat(hou), | |
861 | + min: this.timeFormat(min), | |
862 | + sec: this.timeFormat(sec) | |
863 | + } | |
864 | + } else { | |
865 | + //活动已结束,全部设置为'00' | |
866 | + obj = { | |
867 | + day: '00', | |
868 | + hou: '00', | |
869 | + min: '00', | |
870 | + sec: '00' | |
871 | + } | |
872 | + } | |
873 | + var txt = "saleGoods[" + j + "][" + i + "].djs"; | |
874 | + th.setData({ | |
875 | + [txt]: obj | |
876 | + }); | |
877 | + } | |
878 | + | |
879 | + } | |
880 | + setTimeout(th.countDown, 1000); | |
881 | + }, | |
882 | + | |
883 | + //----拼单倒计时函数----- | |
884 | + countDown2() { | |
885 | + if (!this.data.is_timer) return false; | |
886 | + | |
887 | + var th = this; | |
888 | + // 获取当前时间,同时得到活动结束时间数组 | |
889 | + var newTime = ut.gettimestamp(); | |
890 | + var List = this.data.pindGoods; | |
891 | + for (var j = 0; j < List.length; j++) { | |
892 | + var endTimeList = List[j]; | |
893 | + // 对结束时间进行处理渲染到页面 | |
894 | + for (var i = 0; i < endTimeList.length; i++) { | |
895 | + var o = endTimeList[i]; | |
896 | + var endTime = o.end_time; | |
897 | + if (o.status == 0) endTime = o.start_time; | |
898 | + | |
899 | + let obj = null; | |
900 | + // 如果活动未结束,对时间进行处理 | |
901 | + if (endTime - newTime > 0) { | |
902 | + let time = (endTime - newTime); | |
903 | + // 获取天、时、分、秒 | |
904 | + let day = parseInt(time / (60 * 60 * 24)); | |
905 | + let hou = parseInt(time % (60 * 60 * 24) / 3600); | |
906 | + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
907 | + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
908 | + obj = { | |
909 | + day: this.timeFormat(day), | |
910 | + hou: this.timeFormat(hou), | |
911 | + min: this.timeFormat(min), | |
912 | + sec: this.timeFormat(sec) | |
913 | + } | |
914 | + } else { | |
915 | + //活动已结束,全部设置为'00' | |
916 | + obj = { | |
917 | + day: '00', | |
918 | + hou: '00', | |
919 | + min: '00', | |
920 | + sec: '00' | |
921 | + } | |
922 | + } | |
923 | + var txt = "pindGoods[" + j + "][" + i + "].djs"; | |
924 | + th.setData({ | |
925 | + [txt]: obj | |
926 | + }); | |
927 | + } | |
928 | + } | |
929 | + setTimeout(th.countDown2, 1000); | |
930 | + }, | |
931 | + | |
932 | + bannerSwiperChange: function (e) { | |
933 | + var index = e.detail.current; | |
934 | + this.setData({ | |
935 | + banner_index: index | |
936 | + }); | |
937 | + }, | |
938 | + flashSwiperChange: function (e) { | |
939 | + var index = e.detail.current; | |
940 | + this.setData({ | |
941 | + flash_index: index | |
942 | + }); | |
943 | + }, | |
944 | + ptSwiperChange: function (e) { | |
945 | + var index = e.detail.current; | |
946 | + this.setData({ | |
947 | + pt_index: index | |
948 | + }); | |
949 | + }, | |
950 | + | |
951 | + Interval_pt() { | |
952 | + var th = this; | |
953 | + this.data.pt_timer = setInterval(function () { | |
954 | + var item = ut.get_rand_item(th.data.pt_timer_arr); | |
955 | + th.setData({ | |
956 | + pt_timer_active: 1, | |
957 | + pt_timer_item: item | |
958 | + }); | |
959 | + setTimeout(function () { | |
960 | + th.setData({ | |
961 | + pt_timer_active: 0 | |
962 | + }); | |
963 | + }, 1500) | |
964 | + }, 4000); | |
965 | + }, | |
966 | + | |
967 | + | |
968 | + //---扫一扫的函数--- | |
969 | + getScancode: function () { | |
970 | + var _this = this; | |
971 | + getApp().globalData.no_clear = 1; | |
972 | + // 允许从相机和相册扫码 | |
973 | + wx.scanCode({ | |
974 | + success: (res) => { | |
975 | + var result = res.result; | |
976 | + wx.navigateTo({ | |
977 | + url: "/pages/goods/search/search?s_key=" + result, | |
978 | + }); | |
979 | + } | |
980 | + }) | |
981 | + }, | |
982 | + | |
983 | + //跳转到分类 | |
984 | + go_cate: function () { | |
985 | + getApp().goto("/pages/goods/categoryList/categoryList"); | |
986 | + }, | |
987 | + | |
988 | + // 幸运购跳转 | |
989 | + go_url: function (e) { | |
990 | + | |
991 | + var url = e.currentTarget.dataset.url; | |
992 | + getApp().goto(url); | |
993 | + | |
994 | + }, // | |
995 | + | |
996 | + bind_bnerr_icon: function (e) { | |
997 | + var def = "/miniapp/images/no_cate_def.png"; | |
998 | + var _err = e.currentTarget.dataset.err; | |
999 | + var ob = {}; | |
1000 | + ob[_err] = def; | |
1001 | + this.setData(ob); | |
1002 | + }, | |
1003 | + | |
1004 | + //跳转到分类的商品列表 | |
1005 | + go_cate2: function (t) { | |
1006 | + var cid = t.currentTarget.dataset.cid; | |
1007 | + var pid = t.currentTarget.dataset.pid; | |
1008 | + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; | |
1009 | + wx.navigateTo({ | |
1010 | + url: lurl | |
1011 | + }); | |
1012 | + }, | |
1013 | + new_nav: function (e) { | |
1014 | + var th = this; | |
1015 | + var new_nav = th.data.new_nav; | |
1016 | + getApp().goto(new_nav); | |
1017 | + }, | |
1018 | + //跳转到权益 | |
1019 | + go_quanyi: function (t) { | |
1020 | + var user_info = getApp().globalData.userInfo; | |
1021 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
1022 | + wx.navigateTo({ | |
1023 | + url: '/pages/togoin/togoin', | |
1024 | + //url: '/pages/getphone/getphone', | |
1025 | + }) | |
1026 | + return false; | |
1027 | + } | |
1028 | + getApp().goto("/pages/user/userqy/userqy"); | |
1029 | + }, | |
1030 | + | |
1031 | + imageLoad: function (e) { | |
1032 | + var imgwidth = e.detail.width; | |
1033 | + var imgheight = e.detail.height; | |
1034 | + //宽高比 | |
1035 | + var ratio = imgwidth / imgheight; | |
1036 | + //计算的高度值 | |
1037 | + var viewHeight = 715 / ratio; | |
1038 | + if (this.data.max_sw_height < viewHeight) this.setData({ | |
1039 | + max_sw_height: viewHeight | |
1040 | + }); | |
1041 | + }, | |
1042 | + //判断该用户是否是新会员 | |
1043 | + is_new: function () { | |
1044 | + var th = this; | |
1045 | + wx.hideLoading(); | |
1046 | + getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", { | |
1047 | + data: { | |
1048 | + storeId: os.stoid, | |
1049 | + userId: d.user_id | |
1050 | + } | |
1051 | + }).then(res => { | |
1052 | + if (res.data.code == 0) { | |
1053 | + var actid = res.data.data.id; //活动id | |
1054 | + var giftBagId = res.data.data.giftBagId; //礼包id | |
1055 | + var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId; | |
1056 | + var new_image = res.data.data.imageurl; | |
1057 | + var swiperimage = th.data.swiperimage; | |
1058 | + var img = { | |
1059 | + image: "/miniapp/images/newpeople/newpeople.png", | |
1060 | + nav_url: new_nav | |
1061 | + } | |
1062 | + swiperimage.unshift(img); | |
1063 | + th.setData({ | |
1064 | + swiperimage: swiperimage, | |
1065 | + new_image: new_image, | |
1066 | + new_nav: new_nav | |
1067 | + }) | |
1068 | + | |
1069 | + getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/bound/judge", { | |
1070 | + data: { | |
1071 | + storeId: o.stoid, | |
1072 | + userId: d.user_id | |
1073 | + } | |
1074 | + }).then(res => { | |
1075 | + if (res.data.code == 0) { | |
1076 | + th.setData({ | |
1077 | + is_disgraceful: 1 | |
1078 | + }) | |
1079 | + } else { | |
1080 | + th.check_holiday_pop(); //节日的弹窗 | |
1081 | + } | |
1082 | + | |
1083 | + }) | |
1084 | + } else { | |
1085 | + th.check_holiday_pop(); //节日的弹窗 | |
1086 | + } | |
1087 | + | |
1088 | + }) | |
1089 | + | |
1090 | + }, | |
1091 | + | |
1092 | + is_festival: function (e) { | |
1093 | + var th = this; | |
1094 | + var url = "/api/weshop/marketing/holiday/act/judge"; | |
1095 | + getApp().request.promiseGet(url, { | |
1096 | + data: { | |
1097 | + storeId: os.stoid, | |
1098 | + userId: d.user_id | |
1099 | + } | |
1100 | + }).then(res => { | |
1101 | + if (res.data.code == 0) { | |
1102 | + var actid = res.data.data.id; //活动id | |
1103 | + var giftBagId = res.data.data.gifBagId; //礼包id | |
1104 | + var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId; | |
1105 | + var swiperimage = th.data.swiperimage; | |
1106 | + var actBoundImg = res.data.data.actBoundImg ? res.data.data.actBoundImg : '/miniapp/images/default_g_img.gif'; | |
1107 | + | |
1108 | + th.data.holiday_image = res.data.data.actImg; | |
1109 | + th.data.holiday_url = nav_url; | |
1110 | + | |
1111 | + var img = { | |
1112 | + image: actBoundImg, | |
1113 | + nav_url: nav_url, | |
1114 | + id: res.data.data.id, | |
1115 | + type: 'festival' | |
1116 | + } | |
1117 | + | |
1118 | + for (var i in swiperimage) { | |
1119 | + var item = swiperimage[i]; | |
1120 | + if (item.id == img.id && item.type == img.type) { | |
1121 | + return false; | |
1122 | + } | |
1123 | + } | |
1124 | + | |
1125 | + swiperimage.unshift(img); | |
1126 | + th.setData({ | |
1127 | + swiperimage: swiperimage, | |
1128 | + new_nav: nav_url | |
1129 | + }) | |
1130 | + } | |
1131 | + }) | |
1132 | + }, | |
1133 | + | |
1134 | + //弹出节日有礼 | |
1135 | + check_holiday_pop: function () { | |
1136 | + var th = this; | |
1137 | + getApp().waitfor2(th, 'w_holiday_pop', 'holiday_image', function () { | |
1138 | + //等到结果才显示 | |
1139 | + if (th.data.holiday_image) { | |
1140 | + th.setData({ | |
1141 | + new_image: th.data.holiday_image, | |
1142 | + new_nav: th.data.holiday_url, | |
1143 | + is_disgraceful: 1 | |
1144 | + }) | |
1145 | + } | |
1146 | + }) | |
1147 | + }, | |
1148 | + | |
1149 | + go_ad: function (e) { | |
1150 | + var url = e.currentTarget.dataset.url; | |
1151 | + if (!url || url == '') return; | |
1152 | + if (url[0] != '/') url = '/' + url; | |
1153 | + getApp().goto(url); | |
1154 | + }, | |
1155 | + | |
1156 | + //导航跳转 | |
1157 | + nav_goto: function (e) { | |
1158 | + var url = e.currentTarget.dataset.url; | |
1159 | + if (!url || url == '') return; | |
1160 | + if (url[0] != '/') url = '/' + url; | |
1161 | + getApp().goto(url); | |
1162 | + if (this.data.showHongbao) { | |
1163 | + this.setData({ | |
1164 | + showHongbao: false, | |
1165 | + showHongbaoSmall: true, //显示抢红包小图标 | |
1166 | + }); | |
1167 | + } | |
1168 | + }, | |
1169 | + | |
1170 | + //----跳转到搭配购买---- | |
1171 | + go_test: function () { | |
1172 | + wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", }) | |
1173 | + }, | |
1174 | + onShareTimeline() { | |
1175 | + getApp().globalData.no_clear=1; | |
1176 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
1177 | + if (!store_name){ | |
1178 | + store_name = getApp().globalData.setting.appName; | |
1179 | + } | |
1180 | + return { | |
1181 | + title: '首页-' + '-' + store_name, | |
680 | 1182 | } |
1183 | + }, | |
681 | 1184 | |
682 | - // sty | |
683 | - setTimeout(function () { | |
684 | - if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
685 | - }, 500) | |
686 | - } | |
687 | - //}); | |
688 | - | |
689 | - setTimeout(function () { | |
690 | - var goods_list = th.selectComponent("#goods_list"); //组件的id | |
691 | - goods_list.init(); | |
692 | - goods_list.get_list(); | |
693 | - }, 2000) | |
694 | - }, | |
695 | - | |
696 | - //--判断小程序是否过期-- | |
697 | - setappdata: function (t) { | |
698 | - if (t && t.isout == 1) | |
699 | - wx.reLaunch({ | |
700 | - url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:" + getApp().globalData.config.store_tel, | |
701 | - }); | |
702 | - if (t && t.isbuy == 0) | |
703 | - wx.reLaunch({ | |
704 | - url: "/pages/error/error?msg=还未购买小程序", | |
705 | - }); | |
706 | - }, | |
707 | - //---加载更多是靠这个函数---- | |
708 | - onReachBottom: function () { | |
709 | - var goods_list = this.selectComponent("#goods_list"); //组件的id | |
710 | - if (goods_list) goods_list.get_list(); | |
711 | - | |
712 | - if (getApp().globalData.func_list) { | |
713 | - for (let i in getApp().globalData.func_list) { | |
714 | - let item = getApp().globalData.func_list[i]; | |
715 | - item.re_show(); | |
716 | - } | |
717 | - } | |
718 | - }, | |
719 | - | |
720 | - onPullDownRefresh: function (e) { | |
721 | - this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(), | |
722 | - this.requestRecommend(); | |
723 | - }, | |
724 | - requestRecommend() { }, | |
725 | - requestHomePage() { }, | |
726 | - | |
727 | - onUnload: function () { | |
728 | - this.destroyActivityTimer(); | |
729 | - }, | |
730 | - setCountTime: function (e) { | |
731 | - e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({ | |
732 | - "sale.diffTime": e.diffTime | |
733 | - }), this.setData({ | |
734 | - "sale.good": e.flash_sale_goods[0] | |
735 | - }), this.destroyActivityTimer(), this.createActivityTimer(); | |
736 | - }, | |
737 | - createActivityTimer: function () { | |
738 | - var e = this.data.sale, | |
739 | - t = this; | |
740 | - this.data.timer = setInterval(function () { | |
741 | - var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime, | |
742 | - o = i.transTime(a); | |
743 | - a <= 0 ? t.requestHomePage() : t.setData({ | |
744 | - "sale.countTime": o | |
745 | - }); | |
746 | - }, 1e3); | |
747 | - }, | |
748 | - destroyActivityTimer: function () { | |
749 | - this.data.timer && (clearInterval(this.data.timer), this.data.timer = null); | |
750 | - }, | |
751 | - onPageScroll: function (e) { | |
752 | - this.data.scrollTop = e.scrollTop; | |
753 | - var t = getCurrentPages(); | |
754 | - "pages/index/index/index" == t[t.length - 1].route; | |
755 | - /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({ | |
756 | - frontColor: "#ffffff", | |
757 | - backgroundColor: "#f95959" | |
758 | - }) : wx.setNavigationBarColor({ | |
759 | - frontColor: "#000000", | |
760 | - backgroundColor: "#eeeeee" | |
761 | - }));--*/ | |
762 | - }, | |
763 | - jumpSearch: function () { | |
764 | - wx.navigateTo({ | |
765 | - url: "/pages/goods/search/search" | |
766 | - }); | |
767 | - }, | |
768 | - onShareAppMessage: function (e) { | |
769 | - getApp().globalData.no_clear=1; | |
770 | - var url = "/pages/index/index/index"; | |
771 | - var userInfo = getApp().globalData.userInfo; | |
772 | - //是分销商才带 | |
773 | - if (userInfo) { | |
774 | - url += "?first_leader=" + userInfo.user_id; | |
775 | - } | |
776 | - console.log("---首页---分享--"); | |
777 | - var title = "商城首页" | |
778 | - //分享 | |
779 | - if (getApp().globalData.config && getApp().globalData.config.store_name) { | |
780 | - title = getApp().globalData.config.store_name; | |
781 | - } else if (getApp().globalData.setting.appName) { | |
782 | - title = getApp().globalData.setting.appName; | |
783 | - } | |
784 | - | |
785 | - var ob = { | |
786 | - title: title, | |
787 | - path: url, | |
788 | - }; | |
789 | - console.log(ob); | |
790 | - return ob; | |
791 | - }, | |
792 | - | |
793 | - //图片失败,默认图片 | |
794 | - bind_bnerr: function (e) { | |
795 | - var _errImg = e.target.dataset.errorimg; | |
796 | - var _errObj = {}; | |
797 | - _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg"; | |
798 | - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
799 | - }, | |
800 | - | |
801 | - //图片失败,默认图片 | |
802 | - bind_bnerr2: function (e) { | |
803 | - var _errImg = e.target.dataset.errorimg; | |
804 | - var _errurl = e.target.dataset.url; | |
805 | - var _errObj = {}; | |
806 | - _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; | |
807 | - this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
808 | - | |
809 | - }, | |
810 | - //图片失败,默认图片 | |
811 | - bind_bnerr3: function (e) { | |
812 | - var _errImg = e.target.dataset.errorimg; | |
813 | - var _Img = e.target.dataset.img; | |
814 | - if (_Img != undefined) { | |
815 | - var _errObj = {}; | |
816 | - _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; | |
817 | - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
818 | - } | |
819 | - }, | |
820 | - | |
821 | - | |
822 | - //秒杀倒计时 | |
823 | - //---小于10的格式化函数---- | |
824 | - timeFormat(param) { | |
825 | - return param < 10 ? '0' + param : param; | |
826 | - }, | |
827 | - | |
828 | - //----秒杀倒计时函数----- | |
829 | - countDown() { | |
830 | - if (!this.data.is_timer) return false; | |
831 | - var th = this; | |
832 | - // 获取当前时间,同时得到活动结束时间数组 | |
833 | - var newTime = ut.gettimestamp(); | |
834 | - var List = this.data.saleGoods; | |
835 | - for (var j = 0; j < List.length; j++) { | |
836 | - var endTimeList = List[j]; | |
837 | - // 对结束时间进行处理渲染到页面 | |
838 | - for (var i = 0; i < endTimeList.length; i++) { | |
839 | - var o = endTimeList[i]; | |
840 | - var endTime = o.end_time | |
841 | - if (o.status == 0) endTime = o.start_time | |
842 | - | |
843 | - var obj = null; | |
844 | - // 如果活动未结束,对时间进行处理 | |
845 | - if (endTime - newTime > 0) { | |
846 | - var time = (endTime - newTime); | |
847 | - // 获取天、时、分、秒 | |
848 | - var day = parseInt(time / (60 * 60 * 24)); | |
849 | - var hou = parseInt(time % (60 * 60 * 24) / 3600); | |
850 | - var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
851 | - var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
852 | - obj = { | |
853 | - day: this.timeFormat(day), | |
854 | - hou: this.timeFormat(hou), | |
855 | - min: this.timeFormat(min), | |
856 | - sec: this.timeFormat(sec) | |
857 | - } | |
858 | - } else { | |
859 | - //活动已结束,全部设置为'00' | |
860 | - obj = { | |
861 | - day: '00', | |
862 | - hou: '00', | |
863 | - min: '00', | |
864 | - sec: '00' | |
865 | - } | |
866 | - } | |
867 | - var txt = "saleGoods[" + j + "][" + i + "].djs"; | |
868 | - th.setData({ | |
869 | - [txt]: obj | |
870 | - }); | |
871 | - } | |
872 | - | |
873 | - } | |
874 | - setTimeout(th.countDown, 1000); | |
875 | - }, | |
876 | - | |
877 | - //----拼单倒计时函数----- | |
878 | - countDown2() { | |
879 | - if (!this.data.is_timer) return false; | |
880 | - | |
881 | - var th = this; | |
882 | - // 获取当前时间,同时得到活动结束时间数组 | |
883 | - var newTime = ut.gettimestamp(); | |
884 | - var List = this.data.pindGoods; | |
885 | - for (var j = 0; j < List.length; j++) { | |
886 | - var endTimeList = List[j]; | |
887 | - // 对结束时间进行处理渲染到页面 | |
888 | - for (var i = 0; i < endTimeList.length; i++) { | |
889 | - var o = endTimeList[i]; | |
890 | - var endTime = o.end_time; | |
891 | - if (o.status == 0) endTime = o.start_time; | |
892 | - | |
893 | - let obj = null; | |
894 | - // 如果活动未结束,对时间进行处理 | |
895 | - if (endTime - newTime > 0) { | |
896 | - let time = (endTime - newTime); | |
897 | - // 获取天、时、分、秒 | |
898 | - let day = parseInt(time / (60 * 60 * 24)); | |
899 | - let hou = parseInt(time % (60 * 60 * 24) / 3600); | |
900 | - let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
901 | - let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
902 | - obj = { | |
903 | - day: this.timeFormat(day), | |
904 | - hou: this.timeFormat(hou), | |
905 | - min: this.timeFormat(min), | |
906 | - sec: this.timeFormat(sec) | |
907 | - } | |
908 | - } else { | |
909 | - //活动已结束,全部设置为'00' | |
910 | - obj = { | |
911 | - day: '00', | |
912 | - hou: '00', | |
913 | - min: '00', | |
914 | - sec: '00' | |
915 | - } | |
916 | - } | |
917 | - var txt = "pindGoods[" + j + "][" + i + "].djs"; | |
918 | - th.setData({ | |
919 | - [txt]: obj | |
920 | - }); | |
921 | - } | |
922 | - } | |
923 | - setTimeout(th.countDown2, 1000); | |
924 | - }, | |
925 | - | |
926 | - bannerSwiperChange: function (e) { | |
927 | - var index = e.detail.current; | |
928 | - this.setData({ | |
929 | - banner_index: index | |
930 | - }); | |
931 | - }, | |
932 | - flashSwiperChange: function (e) { | |
933 | - var index = e.detail.current; | |
934 | - this.setData({ | |
935 | - flash_index: index | |
936 | - }); | |
937 | - }, | |
938 | - ptSwiperChange: function (e) { | |
939 | - var index = e.detail.current; | |
940 | - this.setData({ | |
941 | - pt_index: index | |
942 | - }); | |
943 | - }, | |
944 | - | |
945 | - Interval_pt() { | |
946 | - var th = this; | |
947 | - this.data.pt_timer = setInterval(function () { | |
948 | - var item = ut.get_rand_item(th.data.pt_timer_arr); | |
949 | - th.setData({ | |
950 | - pt_timer_active: 1, | |
951 | - pt_timer_item: item | |
952 | - }); | |
953 | - setTimeout(function () { | |
954 | - th.setData({ | |
955 | - pt_timer_active: 0 | |
956 | - }); | |
957 | - }, 1500) | |
958 | - }, 4000); | |
959 | - }, | |
960 | - | |
961 | - | |
962 | - //---扫一扫的函数--- | |
963 | - getScancode: function () { | |
964 | - var _this = this; | |
965 | - getApp().globalData.no_clear=1; | |
966 | - // 允许从相机和相册扫码 | |
967 | - wx.scanCode({ | |
968 | - success: (res) => { | |
969 | - var result = res.result; | |
970 | - wx.navigateTo({ | |
971 | - url: "/pages/goods/search/search?s_key=" + result, | |
972 | - }); | |
973 | - } | |
974 | - }) | |
975 | - }, | |
976 | - | |
977 | - //跳转到分类 | |
978 | - go_cate: function () { | |
979 | - getApp().goto("/pages/goods/categoryList/categoryList"); | |
980 | - }, | |
981 | - | |
982 | - // 幸运购跳转 | |
983 | - go_url: function (e) { | |
984 | - | |
985 | - var url = e.currentTarget.dataset.url; | |
986 | - getApp().goto(url); | |
987 | - | |
988 | - }, // | |
989 | - | |
990 | - bind_bnerr_icon: function (e) { | |
991 | - var def = "/miniapp/images/no_cate_def.png"; | |
992 | - var _err = e.currentTarget.dataset.err; | |
993 | - var ob = {}; | |
994 | - ob[_err] = def; | |
995 | - this.setData(ob); | |
996 | - }, | |
997 | - | |
998 | - //跳转到分类的商品列表 | |
999 | - go_cate2: function (t) { | |
1000 | - var cid = t.currentTarget.dataset.cid; | |
1001 | - var pid = t.currentTarget.dataset.pid; | |
1002 | - var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; | |
1003 | - wx.navigateTo({ | |
1004 | - url: lurl | |
1005 | - }); | |
1006 | - }, | |
1007 | - new_nav: function (e) { | |
1008 | - var th = this; | |
1009 | - var new_nav = th.data.new_nav; | |
1010 | - getApp().goto(new_nav); | |
1011 | - }, | |
1012 | - //跳转到权益 | |
1013 | - go_quanyi: function (t) { | |
1014 | - var user_info = getApp().globalData.userInfo; | |
1015 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
1016 | - wx.navigateTo({ | |
1017 | - url: '/pages/togoin/togoin', | |
1018 | - //url: '/pages/getphone/getphone', | |
1019 | - }) | |
1020 | - return false; | |
1021 | - } | |
1022 | - getApp().goto("/pages/user/userqy/userqy"); | |
1023 | - }, | |
1024 | - | |
1025 | - imageLoad: function (e) { | |
1026 | - var imgwidth = e.detail.width; | |
1027 | - var imgheight = e.detail.height; | |
1028 | - //宽高比 | |
1029 | - var ratio = imgwidth / imgheight; | |
1030 | - //计算的高度值 | |
1031 | - var viewHeight = 715 / ratio; | |
1032 | - if (this.data.max_sw_height < viewHeight) this.setData({ | |
1033 | - max_sw_height: viewHeight | |
1034 | - }); | |
1035 | - }, | |
1036 | - //判断该用户是否是新会员 | |
1037 | - is_new: function () { | |
1038 | - var th = this; | |
1039 | - wx.hideLoading(); | |
1040 | - getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", { | |
1041 | - data: { | |
1042 | - storeId: os.stoid, | |
1043 | - userId: d.user_id | |
1044 | - } | |
1045 | - }).then(res => { | |
1046 | - if (res.data.code == 0) { | |
1047 | - var actid = res.data.data.id; //活动id | |
1048 | - var giftBagId = res.data.data.giftBagId; //礼包id | |
1049 | - var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId; | |
1050 | - var new_image = res.data.data.imageurl; | |
1051 | - var swiperimage = th.data.swiperimage; | |
1052 | - var img = { | |
1053 | - image: "/miniapp/images/newpeople/newpeople.png", | |
1054 | - nav_url: new_nav | |
1055 | - } | |
1056 | - swiperimage.unshift(img); | |
1057 | - th.setData({ | |
1058 | - swiperimage: swiperimage, | |
1059 | - new_image: new_image, | |
1060 | - new_nav: new_nav | |
1061 | - }) | |
1062 | - | |
1063 | - getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/bound/judge", { | |
1064 | - data: { | |
1065 | - storeId: o.stoid, | |
1066 | - userId: d.user_id | |
1067 | - } | |
1068 | - }).then(res => { | |
1069 | - if (res.data.code == 0) { | |
1070 | - th.setData({ | |
1071 | - is_disgraceful: 1 | |
1072 | - }) | |
1073 | - } else { | |
1074 | - th.check_holiday_pop(); //节日的弹窗 | |
1075 | - } | |
1076 | - | |
1077 | - }) | |
1078 | - } else { | |
1079 | - th.check_holiday_pop(); //节日的弹窗 | |
1080 | - } | |
1081 | - | |
1082 | - }) | |
1083 | - | |
1084 | - }, | |
1085 | - | |
1086 | - is_festival: function (e) { | |
1087 | - var th = this; | |
1088 | - var url = "/api/weshop/marketing/holiday/act/judge"; | |
1089 | - getApp().request.promiseGet(url, { | |
1090 | - data: { | |
1091 | - storeId: os.stoid, | |
1092 | - userId: d.user_id | |
1093 | - } | |
1094 | - }).then(res => { | |
1095 | - if (res.data.code == 0) { | |
1096 | - var actid = res.data.data.id; //活动id | |
1097 | - var giftBagId = res.data.data.gifBagId; //礼包id | |
1098 | - var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId; | |
1099 | - var swiperimage = th.data.swiperimage; | |
1100 | - var actBoundImg = res.data.data.actBoundImg ? res.data.data.actBoundImg : '/miniapp/images/default_g_img.gif'; | |
1101 | - | |
1102 | - th.data.holiday_image = res.data.data.actImg; | |
1103 | - th.data.holiday_url = nav_url; | |
1104 | - | |
1105 | - var img = { | |
1106 | - image: actBoundImg, | |
1107 | - nav_url: nav_url, | |
1108 | - id: res.data.data.id, | |
1109 | - type: 'festival' | |
1110 | - } | |
1185 | + // 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标 | |
1186 | + closeHongbao() { | |
1187 | + this.setData({ | |
1188 | + showHongbao: false, //关闭抢红包主弹窗 | |
1189 | + showHongbaoSmall: true, //显示抢红包小图标 | |
1190 | + }); | |
1191 | + }, | |
1192 | + | |
1193 | + /*-- 全屏广告 --*/ | |
1194 | + close_full_screen() { | |
1195 | + this.setData({ is_full_screen_show: 0, sec_show: 0 }); | |
1196 | + }, | |
1197 | + //-- 跳转到满屏广告的链接 -- | |
1198 | + go_full_ad() { | |
1199 | + if (!this.data.full_ad) return false; | |
1200 | + if (!this.data.full_ad.ad_weapplink) return false; | |
1201 | + getApp().goto(this.data.full_ad.ad_weapplink); | |
1202 | + this.close_full_screen(); | |
1203 | + }, | |
1204 | + | |
1205 | + go_pre: function (e) { | |
1206 | + var userInfo = getApp().globalData.userInfo; | |
1207 | + if (!userInfo) { | |
1208 | + getApp().goto("/pages/togoin/togoin"); | |
1209 | + return false; | |
1210 | + } | |
1211 | + var url = e.currentTarget.dataset.url; | |
1212 | + getApp().goto(url); | |
1213 | + }, | |
1111 | 1214 | |
1112 | - for (var i in swiperimage) { | |
1113 | - var item = swiperimage[i]; | |
1114 | - if (item.id == img.id && item.type == img.type) { | |
1115 | - return false; | |
1116 | - } | |
1117 | - } | |
1118 | 1215 | |
1119 | - swiperimage.unshift(img); | |
1120 | - th.setData({ | |
1121 | - swiperimage: swiperimage, | |
1122 | - new_nav: nav_url | |
1123 | - }) | |
1124 | - } | |
1125 | - }) | |
1126 | - }, | |
1127 | - | |
1128 | - //弹出节日有礼 | |
1129 | - check_holiday_pop: function () { | |
1130 | - var th = this; | |
1131 | - getApp().waitfor2(th, 'w_holiday_pop', 'holiday_image', function () { | |
1132 | - //等到结果才显示 | |
1133 | - if (th.data.holiday_image) { | |
1134 | - th.setData({ | |
1135 | - new_image: th.data.holiday_image, | |
1136 | - new_nav: th.data.holiday_url, | |
1137 | - is_disgraceful: 1 | |
1138 | - }) | |
1139 | - } | |
1140 | - }) | |
1141 | - }, | |
1142 | - | |
1143 | - go_ad: function (e) { | |
1144 | - var url = e.currentTarget.dataset.url; | |
1145 | - if (!url || url == '') return; | |
1146 | - if (url[0] != '/') url = '/' + url; | |
1147 | - getApp().goto(url); | |
1148 | - }, | |
1149 | - | |
1150 | - //导航跳转 | |
1151 | - nav_goto: function (e) { | |
1152 | - var url = e.currentTarget.dataset.url; | |
1153 | - if (!url || url == '') return; | |
1154 | - if (url[0] != '/') url = '/' + url; | |
1155 | - getApp().goto(url); | |
1156 | - if (this.data.showHongbao) { | |
1157 | - this.setData({ | |
1158 | - showHongbao: false, | |
1159 | - showHongbaoSmall: true, //显示抢红包小图标 | |
1160 | - }); | |
1161 | - } | |
1162 | - }, | |
1163 | - | |
1164 | - //----跳转到搭配购买---- | |
1165 | - go_test: function () { | |
1166 | - wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", }) | |
1167 | - }, | |
1168 | - | |
1169 | - | |
1170 | - onShareTimeline() { | |
1171 | - getApp().globalData.no_clear=1; | |
1172 | - | |
1173 | - // getApp().getConfig(function(t) { | |
1174 | - // return { | |
1175 | - // title: '首页-' + getApp().globalData.config.store_name, | |
1176 | - // } | |
1177 | - // }); | |
1178 | - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
1179 | - if (!store_name) | |
1180 | - store_name = getApp().globalData.setting.appName; | |
1181 | - return { | |
1182 | - title: '首页-' + store_name, | |
1183 | - } | |
1184 | - }, | |
1185 | - | |
1186 | - | |
1187 | - // 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标 | |
1188 | - closeHongbao() { | |
1189 | - this.setData({ | |
1190 | - showHongbao: false, //关闭抢红包主弹窗 | |
1191 | - showHongbaoSmall: true, //显示抢红包小图标 | |
1192 | - }); | |
1193 | - }, | |
1194 | - | |
1195 | - /*-- 全屏广告 --*/ | |
1196 | - close_full_screen() { | |
1197 | - this.setData({ is_full_screen_show: 0, sec_show: 0 }); | |
1198 | - }, | |
1199 | - //-- 跳转到满屏广告的链接 -- | |
1200 | - go_full_ad() { | |
1201 | - if (!this.data.full_ad) return false; | |
1202 | - if (!this.data.full_ad.ad_weapplink) return false; | |
1203 | - getApp().goto(this.data.full_ad.ad_weapplink); | |
1204 | - this.close_full_screen(); | |
1205 | - }, | |
1206 | - | |
1207 | - go_pre:function (e) { | |
1208 | - var userInfo=getApp().globalData.userInfo; | |
1209 | - if(!userInfo){ | |
1210 | - getApp().goto("/pages/togoin/togoin"); | |
1211 | - return false; | |
1212 | - } | |
1213 | - var url=e.currentTarget.dataset.url; | |
1214 | - getApp().goto(url); | |
1215 | - }, | |
1216 | - | |
1217 | - | |
1218 | 1216 | |
1219 | 1217 | |
1220 | 1218 | ... | ... |
pages/user/assistance/giftpacklist.wxml
... | ... | @@ -79,7 +79,7 @@ |
79 | 79 | </block> |
80 | 80 | </block> |
81 | 81 | <block wx:if="{{item.lbType==2}}"> |
82 | - <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/coupons/coupons" bindtap="goto"></image> | |
82 | + <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/packageD/pages/user/coupons/coupons" bindtap="goto"></image> | |
83 | 83 | </block> |
84 | 84 | <block wx:if="{{item.lbType==3}}"> |
85 | 85 | <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/my_service/i_service" bindtap="goto"></image> | ... | ... |
pages/user/grow_value/grow_value.js
... | ... | @@ -182,7 +182,7 @@ Page({ |
182 | 182 | var index=e.currentTarget.dataset.ind; |
183 | 183 | switch (index) { |
184 | 184 | case "0": getApp().goto("/pages/index/index/index");break; |
185 | - case "1": getApp().goto("/pages/user/coupons/coupons"); break; | |
185 | + case "1": getApp().goto("/packageD/pages/user/coupons/coupons"); break; | |
186 | 186 | case "2": getApp().goto("/pages/user/userqy/userqy"); break; |
187 | 187 | } |
188 | 188 | }, | ... | ... |
pages/user/index/index.js
1 | 1 | var auth = require("../../../utils/auth.js"), |
2 | - rq = require("../../../utils/request.js"); | |
2 | + rq = require("../../../utils/request.js"); | |
3 | 3 | var e = getApp(), |
4 | - app = e, | |
5 | - s = e.globalData.setting, | |
6 | - os = s, | |
7 | - app_d = e.globalData; | |
4 | + app = e, | |
5 | + s = e.globalData.setting, | |
6 | + os = s, | |
7 | + app_d = e.globalData; | |
8 | 8 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
9 | 9 | const { |
10 | - barcode, | |
11 | - qrcode | |
10 | + barcode, | |
11 | + qrcode | |
12 | 12 | } = require('../../../utils/index.js'); |
13 | 13 | var ut = require("../../../utils/util.js"); |
14 | 14 | let self = null; |
15 | 15 | |
16 | 16 | Page({ |
17 | - /** | |
18 | - * 页面的初始数据 | |
19 | - */ | |
20 | - data: { | |
21 | - length: 150, | |
22 | - iurl: s.imghost, | |
23 | - defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg", | |
24 | - userInfo: null, | |
25 | - toji: null, //统计相关 | |
26 | - txmon: 0, | |
27 | - byquan: 0, | |
28 | - yuer: 0, | |
29 | - is_no_plus:1, | |
30 | - currentPage: 1, | |
31 | - recommend_list: [], | |
32 | - tc_hide: true, | |
33 | - sw_index: 0, | |
34 | - qy_list: null, | |
35 | - gradeId: null, | |
36 | - is_init: 0, | |
37 | - cz_val: 0, | |
38 | - full_cz_val: 0, | |
39 | - is_dengji: 0, //是不是等级 | |
40 | - is_banner: 0, //是不是有生日活动 | |
41 | - giftbagid: "", //生日活动的类型 | |
42 | - actId: "", //生日活动的id | |
43 | - actImg: "", | |
44 | - is_assistance: 0, //助力活动 | |
45 | - ad_img:"", | |
46 | - add_card_data:'', //等级卡的内容 | |
47 | - | |
48 | - hiddenCS: true, | |
49 | - }, | |
50 | - goto_nav: function(e) { | |
51 | - var th = this; | |
52 | - var url = e.currentTarget.dataset.url; | |
53 | - if (th.data.userInfo != null) { | |
54 | - getApp().goto(url); | |
55 | - } else { | |
56 | - wx.navigateTo({ | |
57 | - url: '/pages/togoin/togoin', | |
58 | - }) | |
59 | - } | |
60 | - }, | |
61 | - /** | |
62 | - * 生命周期函数--监听页面加载 | |
63 | - */ | |
64 | - onLoad: function(options) { | |
65 | - self = this; | |
66 | - var th=this; | |
67 | - getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { | |
68 | - data: { | |
69 | - enabled: 1 | |
70 | - }, | |
71 | - success:function(res){ | |
72 | - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
73 | - var item=res.data.data.pageData[0]; | |
74 | - if (item && item.ad_code) th.setData({ad_img:item.ad_code}) | |
75 | - } | |
76 | - } | |
77 | - }) | |
78 | - app.getUserFir(); | |
79 | - this.init_user_tool() | |
80 | - | |
81 | - }, | |
82 | - | |
83 | - /** | |
84 | - * 生命周期函数--监听页面显示 | |
85 | - */ | |
86 | - onShow: function() { | |
87 | - getApp().check_can_share(); | |
88 | - //看一下小程序是不是过期了 | |
89 | - getApp().getConfig2(function(config2){ | |
90 | - if(config2 && config2.is_overdue==1){ | |
91 | - getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{ | |
92 | - var o=res; | |
93 | - if (o.data.code == 0) { | |
94 | - var ob = { isout: 0, isbuy: 1 }; | |
95 | - var arr = o.data.data.pageData; | |
96 | - var isbuy = 0; | |
97 | - //----如果数组不为空---- | |
98 | - if (arr.length > 0) { | |
99 | - arr.forEach(function (val, ind) { | |
100 | - if (val.is_sy == 0 && val.type == 5) { | |
101 | - isbuy = 1; | |
102 | - var now = ut.gettimestamp(); | |
103 | - if (now > val.end_time) ob.isout = 1; | |
104 | - return false; | |
105 | - } | |
106 | - }) | |
107 | - } | |
108 | - ob.isbuy = isbuy; | |
109 | - th.setappdata(ob); | |
110 | - } | |
111 | - }) | |
112 | - } | |
113 | - }) | |
114 | - | |
115 | - //调用接口判断商家plus有没有过期 | |
116 | - rq.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { | |
117 | - if (res.data.code == 0) { | |
118 | - var arr = res.data.data.pageData; | |
119 | - if (arr.length > 0) { | |
120 | - var item = arr[0]; | |
121 | - if (item.is_sy == 0) { | |
122 | - var now = Date.parse(new Date()); now = now / 1000; | |
123 | - if (item.end_time < now) { | |
124 | - th.setData({ is_no_plus: 0 }) | |
125 | - } | |
126 | - } | |
127 | - } | |
128 | - } | |
129 | - }) | |
130 | - var th=this; | |
131 | - | |
17 | + /** | |
18 | + * 页面的初始数据 | |
19 | + */ | |
20 | + data: { | |
21 | + length: 150, | |
22 | + iurl: s.imghost, | |
23 | + defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg", | |
24 | + userInfo: null, | |
25 | + toji: null, //统计相关 | |
26 | + txmon: 0, | |
27 | + byquan: 0, | |
28 | + yuer: 0, | |
29 | + is_no_plus: 1, | |
30 | + currentPage: 1, | |
31 | + recommend_list: [], | |
32 | + tc_hide: true, | |
33 | + sw_index: 0, | |
34 | + qy_list: null, | |
35 | + gradeId: null, | |
36 | + is_init: 0, | |
37 | + cz_val: 0, | |
38 | + full_cz_val: 0, | |
39 | + is_dengji: 0, //是不是等级 | |
40 | + is_banner: 0, //是不是有生日活动 | |
41 | + giftbagid: "", //生日活动的类型 | |
42 | + actId: "", //生日活动的id | |
43 | + actImg: "", | |
44 | + is_assistance: 0, //助力活动 | |
45 | + ad_img: "", | |
46 | + add_card_data: '', //等级卡的内容 | |
47 | + | |
48 | + hiddenCS: true, | |
49 | + }, | |
50 | + goto_nav: function (e) { | |
51 | + var th = this; | |
52 | + var url = e.currentTarget.dataset.url; | |
53 | + if (th.data.userInfo != null) { | |
54 | + getApp().goto(url); | |
55 | + } else { | |
56 | + wx.navigateTo({ | |
57 | + url: '/pages/togoin/togoin', | |
58 | + }) | |
59 | + } | |
60 | + }, | |
61 | + /** | |
62 | + * 生命周期函数--监听页面加载 | |
63 | + */ | |
64 | + onLoad: function (options) { | |
65 | + self = this; | |
66 | + var th = this; | |
67 | + getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { | |
68 | + data: { | |
69 | + enabled: 1 | |
70 | + }, | |
71 | + success: function (res) { | |
72 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) { | |
73 | + var item = res.data.data.pageData[0]; | |
74 | + if (item && item.ad_code) th.setData({ ad_img: item.ad_code }) | |
75 | + } | |
76 | + } | |
77 | + }) | |
78 | + app.getUserFir(); | |
79 | + this.init_user_tool() | |
80 | + }, | |
81 | + | |
82 | + /** | |
83 | + * 生命周期函数--监听页面显示 | |
84 | + */ | |
85 | + onShow: function () { | |
86 | + getApp().check_can_share(); | |
87 | + //看一下小程序是不是过期了 | |
88 | + getApp().getConfig2(function (config2) { | |
89 | + if (config2 && config2.is_overdue == 1) { | |
90 | + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=5", {}).then(res => { | |
91 | + var o = res; | |
92 | + if (o.data.code == 0) { | |
93 | + var ob = { isout: 0, isbuy: 1 }; | |
94 | + var arr = o.data.data.pageData; | |
95 | + var isbuy = 0; | |
96 | + //----如果数组不为空---- | |
97 | + if (arr.length > 0) { | |
98 | + arr.forEach(function (val, ind) { | |
99 | + if (val.is_sy == 0 && val.type == 5) { | |
100 | + isbuy = 1; | |
101 | + var now = ut.gettimestamp(); | |
102 | + if (now > val.end_time) ob.isout = 1; | |
103 | + return false; | |
104 | + } | |
105 | + }) | |
106 | + } | |
107 | + ob.isbuy = isbuy; | |
108 | + th.setappdata(ob); | |
109 | + } | |
110 | + }) | |
111 | + } | |
112 | + }) | |
113 | + | |
114 | + //调用接口判断商家plus有没有过期 | |
115 | + rq.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { | |
116 | + if (res.data.code == 0) { | |
117 | + var arr = res.data.data.pageData; | |
118 | + if (arr.length > 0) { | |
119 | + var item = arr[0]; | |
120 | + if (item.is_sy == 0) { | |
121 | + var now = Date.parse(new Date()); now = now / 1000; | |
122 | + if (item.end_time < now) { | |
123 | + th.setData({ is_no_plus: 0 }) | |
124 | + } | |
125 | + } | |
126 | + } | |
127 | + } | |
128 | + }) | |
129 | + var th = this; | |
130 | + | |
132 | 131 | // 判断是否开启美业 |
133 | 132 | getApp().promiseGet('/api/weshop/store/getTabSys/' + os.stoid, {}).then(res => { |
134 | - if(res.data.code == 0) { | |
133 | + if (res.data.code == 0) { | |
135 | 134 | th.setData({ |
136 | 135 | enableMeiye: res.data.data.EnableMeiye, |
137 | 136 | }); |
138 | 137 | }; |
139 | 138 | }); |
140 | - | |
141 | - | |
142 | - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + os.stoid, {}).then(res => { | |
143 | - if(res.data.code==0){ | |
144 | - var plusCard = res.data.data; | |
145 | - for (var i = 0; i < plusCard.length; i++) { | |
146 | - if(!plusCard[i].IsStopBuy) { th.setData({show_buy_plus:1}); break; } | |
147 | - } | |
148 | - } | |
149 | - }) | |
150 | - | |
151 | - if (typeof this.getTabBar === 'function' && this.getTabBar()) { | |
152 | - var index=getApp().getPageIndex(this); | |
153 | - this.getTabBar().setData({ | |
154 | - active: index //数字是当前页面在tabbar的索引 | |
155 | - }); | |
156 | - //getApp().requestCardNum(this); | |
157 | - } | |
158 | - | |
159 | - | |
160 | - var stoid = app_d.setting.stoid; | |
161 | - var s = this, th = s, | |
162 | - need_money = 0, | |
163 | - cur_g_num = 0; | |
164 | - | |
165 | - /*------会员登录------*/ | |
166 | - var e=getApp().globalData.userInfo; | |
167 | - if (e != undefined && e != null && e.mobile) { | |
168 | - | |
169 | - this.birthday(); | |
170 | - this.is_assistance(); | |
171 | - | |
172 | - s.setData({ | |
173 | - userInfo: e | |
174 | - }); | |
175 | - | |
176 | - //-- 要调用接口,获取卡的钱 -- | |
177 | - var url="/api/weshop/wxuser/getWxCardInfo?storeId="+os.stoid+"&userId="+e.user_id; | |
178 | - rq.get(url,{ | |
179 | - isShowLoading:0, | |
180 | - success: function(su) { | |
181 | - if(su.data.code==0){ | |
182 | - s.setData({ | |
183 | - add_card_data: su.data.data, | |
184 | - }); | |
185 | - } | |
139 | + | |
140 | + | |
141 | + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + os.stoid, {}).then(res => { | |
142 | + if (res.data.code == 0) { | |
143 | + var plusCard = res.data.data; | |
144 | + for (var i = 0; i < plusCard.length; i++) { | |
145 | + if (!plusCard[i].IsStopBuy) { th.setData({ show_buy_plus: 1 }); break; } | |
146 | + } | |
186 | 147 | } |
148 | + }) | |
149 | + | |
150 | + if (typeof this.getTabBar === 'function' && this.getTabBar()) { | |
151 | + var index = getApp().getPageIndex(this); | |
152 | + this.getTabBar().setData({ | |
153 | + active: index //数字是当前页面在tabbar的索引 | |
154 | + }); | |
155 | + //getApp().requestCardNum(this); | |
156 | + } | |
157 | + | |
158 | + | |
159 | + var stoid = app_d.setting.stoid; | |
160 | + var s = this, th = s, | |
161 | + need_money = 0, | |
162 | + cur_g_num = 0; | |
163 | + | |
164 | + /*------会员登录------*/ | |
165 | + var e = getApp().globalData.userInfo; | |
166 | + if (e != undefined && e != null && e.mobile) { | |
167 | + | |
168 | + this.birthday(); | |
169 | + this.is_assistance(); | |
170 | + | |
171 | + s.setData({ | |
172 | + userInfo: e | |
173 | + }); | |
174 | + | |
175 | + //-- 要调用接口,获取卡的钱 -- | |
176 | + var url = "/api/weshop/wxuser/getWxCardInfo?storeId=" + os.stoid + "&userId=" + e.user_id; | |
177 | + rq.get(url, { | |
178 | + isShowLoading: 0, | |
179 | + success: function (su) { | |
180 | + if (su.data.code == 0) { | |
181 | + s.setData({ | |
182 | + add_card_data: su.data.data, | |
183 | + }); | |
184 | + } | |
185 | + } | |
186 | + }); | |
187 | + | |
188 | + /*-----统计-----*/ | |
189 | + rq.get("/api/weshop/order/waitlist", { | |
190 | + isShowLoading: 0, | |
191 | + data: { | |
192 | + user_id: app_d.user_id | |
193 | + }, | |
194 | + success: function (su) { | |
195 | + s.setData({ | |
196 | + toji: su.data.data, | |
197 | + }); | |
198 | + } | |
199 | + }) | |
200 | + /*-----获取线下会员的预存款和优惠券的数量-----*/ | |
201 | + rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, { | |
202 | + isShowLoading: 0, | |
203 | + success: function (su) { | |
204 | + if (su.data.code == 0 && su.data.data) { | |
205 | + var data = su.data.data; | |
206 | + if (!data) data = {}; | |
207 | + data.cashcount = parseInt(data.cashcount); | |
208 | + s.setData({ | |
209 | + udata: data, | |
210 | + }); | |
211 | + } | |
212 | + | |
213 | + } | |
214 | + }) | |
215 | + /*-----获取会员提现金额-----*/ | |
216 | + rq.get("/api/weshop/withdrawals/summoney", { | |
217 | + isShowLoading: 0, | |
218 | + data: { | |
219 | + user_id: e.user_id, | |
220 | + store_id: os.stoid, | |
221 | + status: 0 | |
222 | + }, | |
223 | + success: function (su) { | |
224 | + if (su.data.code == 0) { | |
225 | + var yuer = parseFloat(th.data.userInfo.user_money - | |
226 | + th.data.userInfo.frozen_money - su.data.data.summoney).toFixed(2); | |
227 | + th.setData({ | |
228 | + txmon: su.data.data.summoney, | |
229 | + yuer: yuer | |
230 | + }); | |
231 | + } | |
232 | + } | |
233 | + }) | |
234 | + | |
235 | + /*-----获取会员包邮券的数量-----*/ | |
236 | + rq.get("/api/weshop/userfeemail/page", { | |
237 | + isShowLoading: 0, | |
238 | + data: { | |
239 | + user_id: e.user_id, | |
240 | + store_id: os.stoid, | |
241 | + pageSize: 1, | |
242 | + isuse: 0 | |
243 | + }, | |
244 | + success: function (su) { | |
245 | + if (su.data.code == 0) { | |
246 | + th.setData({ | |
247 | + byquan: parseInt(su.data.data.total) | |
248 | + }); | |
249 | + } | |
250 | + } | |
251 | + }); | |
252 | + | |
253 | + /*-----物流信息提醒-----*/ | |
254 | + rq.get('/api/weshop/order/countDadaOrder', { | |
255 | + isShowLoading: 0, | |
256 | + data: { | |
257 | + user_id: e.user_id, | |
258 | + store_id: os.stoid, | |
259 | + }, | |
260 | + success: function (su) { | |
261 | + if (su.data.code == 0) { | |
262 | + th.setData({ | |
263 | + countDadaOrder: su.data.data | |
264 | + }); | |
265 | + } | |
266 | + } | |
267 | + }); | |
268 | + | |
269 | + | |
270 | + | |
271 | + | |
272 | + //--初始化是否有打勾-- | |
273 | + getApp().request.get("/api/weshop/users/grade/vip/init/get", { | |
274 | + data: { | |
275 | + storeId: os.stoid | |
276 | + }, | |
277 | + success: function (rs) { | |
278 | + if (rs.data.code == 0 && rs.data.data.isBool) { | |
279 | + th.setData({ is_init: 1 }); | |
280 | + /*-----获取会员权益列表-----*/ | |
281 | + rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", { | |
282 | + isShowLoading: 0, | |
283 | + data: { | |
284 | + storeId: os.stoid, | |
285 | + pageSize: 100 | |
286 | + }, | |
287 | + success: async function (res) { | |
288 | + | |
289 | + //判断有没有值,没有值返回 | |
290 | + if (!ut.ajax_ok(res)) return false; | |
291 | + | |
292 | + var arr_data = res.data.data.pageData; | |
293 | + var gid = null, | |
294 | + g_qy_list = null, | |
295 | + cz_vals = 0, | |
296 | + need_money = 0, | |
297 | + backClass = null, | |
298 | + | |
299 | + GradeName = ''; | |
300 | + | |
301 | + //获取成长值 | |
302 | + await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get", { | |
303 | + data: { | |
304 | + storeId: os.stoid, | |
305 | + userId: app_d.user_id | |
306 | + } | |
307 | + }).then(res => { | |
308 | + if (res.data.code == 0 && res.data.data) { | |
309 | + gid = res.data.data.GradeId; | |
310 | + var cz_val = res.data.data.GradeSum; | |
311 | + cz_vals = parseInt(cz_val); | |
312 | + GradeName = res.data.data.GradeName; | |
313 | + } | |
314 | + //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid}); | |
315 | + }) | |
316 | + var obj = { | |
317 | + cz_val: cz_vals, | |
318 | + GradeName: GradeName, | |
319 | + gradeId: gid, | |
320 | + is_grad_get: 1 | |
321 | + }; | |
322 | + | |
323 | + // 获取最大值 | |
324 | + await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", { | |
325 | + data: { | |
326 | + storeId: os.stoid | |
327 | + } | |
328 | + }).then(res => { | |
329 | + if (res.data.data) | |
330 | + backClass = res.data.data.pageData; | |
331 | + if (backClass) { | |
332 | + var full_cz_val = backClass[backClass.length - 1].BuyGradeSum; | |
333 | + //th.setData({ full_cz_val: full_cz_val}); | |
334 | + obj.full_cz_val = full_cz_val | |
335 | + } | |
336 | + }) | |
337 | + | |
338 | + //--会员权益中心页的修改-- | |
339 | + for (var i in backClass) { | |
340 | + var im = backClass[i]; | |
341 | + if (cz_vals < im.BuyGradeSum && need_money == 0) { | |
342 | + need_money = im.BuyGradeSum; | |
343 | + obj.need_money = need_money; | |
344 | + } | |
345 | + } | |
346 | + | |
347 | + //获取当前等级的特权 | |
348 | + await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", { | |
349 | + data: { | |
350 | + storeId: os.stoid, | |
351 | + GradeId: gid, | |
352 | + userId: app_d.user_id, | |
353 | + pageSize: 100 | |
354 | + } | |
355 | + }).then(res => { | |
356 | + if (res.data.data) | |
357 | + g_qy_list = res.data.data.pageData; | |
358 | + }); | |
359 | + | |
360 | + for (var i in arr_data) { | |
361 | + var item = arr_data[i]; | |
362 | + var FromId = th.check_is_has_qy(item, g_qy_list); | |
363 | + arr_data[i].ishas = 0; | |
364 | + if (FromId) { | |
365 | + arr_data[i].ishas = 1; | |
366 | + arr_data[i].FromId = FromId; | |
367 | + } | |
368 | + } | |
369 | + arr_data.sort(function (a, b) { | |
370 | + return b.ishas - a.ishas | |
371 | + }) | |
372 | + | |
373 | + //4个4个一组 | |
374 | + var arr = new Array(); | |
375 | + for (var i = 0; i < arr_data.length; i += 4) { | |
376 | + arr.push(arr_data.slice(i, i + 4)); | |
377 | + } | |
378 | + //th.setData({ qy_list: arr, need_money: need_money}); | |
379 | + obj.qy_list = arr; | |
380 | + th.setData(obj); | |
381 | + } | |
382 | + }) | |
383 | + } | |
384 | + } | |
385 | + }) | |
386 | + | |
387 | + /*-- 获取 --*/ | |
388 | + th.requestRecommend(); | |
389 | + | |
390 | + /*-------系统是否开通等级卡,会员是等级卡-----*/ | |
391 | + getApp().getConfig2(function (e) { | |
392 | + var t_swi = e.switch_list; | |
393 | + if (t_swi) t_swi = JSON.parse(t_swi) | |
394 | + if (t_swi) { | |
395 | + th.setData({ sys_switch: t_swi }); | |
396 | + var user_tool = []; | |
397 | + if (t_swi.usertool) user_tool = JSON.parse(t_swi.usertool); | |
398 | + th.setData({ c_list: user_tool }) | |
399 | + } | |
400 | + if (parseInt(t_swi.rank_switch) == 2) { | |
401 | + var userInfo = th.data.userInfo; | |
402 | + if (userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") { | |
403 | + var now = ut.gettimestamp(); | |
404 | + var str = userInfo.card_expiredate; | |
405 | + var end = new Date(str); | |
406 | + end = Date.parse(end) / 1000; | |
407 | + //---判断是不是有过期--- | |
408 | + if (now < end) { | |
409 | + th.setData({ | |
410 | + is_dengji: 1 | |
411 | + }) | |
412 | + } else { | |
413 | + th.setData({ | |
414 | + is_dengji: 3 | |
415 | + }) | |
416 | + } | |
417 | + } else { | |
418 | + th.setData({ | |
419 | + is_dengji: 2 | |
420 | + }) | |
421 | + } | |
422 | + } | |
423 | + }) | |
424 | + //th.requestRecommend(); | |
425 | + } | |
426 | + | |
427 | + //自定义组件一定要等到页面加载完了,才来调用selectComponnent | |
428 | + setTimeout(function () { | |
429 | + if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
430 | + var goods_list = th.selectComponent("#goods_recommend"); //组件的id | |
431 | + goods_list.init(); | |
432 | + goods_list.get_list(); | |
433 | + }, 800) | |
434 | + }, | |
435 | + | |
436 | + //判断会员是后有改服务项目 | |
437 | + check_is_has_qy: function (item, g_qy_list) { | |
438 | + if (!g_qy_list) return false; | |
439 | + | |
440 | + for (var i in g_qy_list) { | |
441 | + var iter = g_qy_list[i]; | |
442 | + if (iter.FormId == item.Id) return g_qy_list[i].FormId; | |
443 | + } | |
444 | + return false; | |
445 | + }, | |
446 | + | |
447 | + /** | |
448 | + * 生命周期函数--监听页面隐藏 | |
449 | + */ | |
450 | + onHide: function () { | |
451 | + for (var i = 1; i < 100; i++) { | |
452 | + clearInterval(i); | |
453 | + } | |
454 | + }, | |
455 | + setappdata: function (t) { | |
456 | + var t = getApp().globalData.wxapp_buy_obj; | |
457 | + if (t && t.isout == 1) | |
458 | + wx.navigateTo({ | |
459 | + url: "/pages/error/error?msg=小程序已经过期", | |
460 | + }); | |
461 | + if (t && t.isbuy == 0) | |
462 | + wx.navigateTo({ | |
463 | + url: "/pages/error/error?msg=还未购买小程序", | |
464 | + }); | |
465 | + }, | |
466 | + | |
467 | + /** | |
468 | + * 页面上拉触底事件的处理函数 | |
469 | + */ | |
470 | + onReachBottom: function () { | |
471 | + //!this.nomore && this.requestRecommend(); | |
472 | + var goods_list = this.selectComponent("#goods_recommend"); //组件的id | |
473 | + goods_list.init(); | |
474 | + setTimeout(function () { | |
475 | + goods_list.get_list(); | |
476 | + }, 300) | |
477 | + }, | |
478 | + | |
479 | + /** | |
480 | + * 用户点击右上角分享 | |
481 | + */ | |
482 | + onShareAppMessage: function () { getApp().globalData.no_clear = 1; }, | |
483 | + | |
484 | + //------卡片的显示和关闭-------- | |
485 | + show_tc: function () { | |
486 | + if (!this.data.userInfo) return false; | |
487 | + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') | |
488 | + var val = this.data.userInfo.mobile + "|" + ut.formatTime(); | |
489 | + val = "^" + ut.base64_encode(val); | |
490 | + | |
491 | + qrcode('qrcode', val, 480, 480, this); | |
492 | + this.setData({ | |
493 | + tc_hide: false, | |
187 | 494 | }); |
188 | - | |
189 | - /*-----统计-----*/ | |
190 | - rq.get("/api/weshop/order/waitlist", { | |
191 | - isShowLoading:0, | |
192 | - data: { | |
193 | - user_id: app_d.user_id | |
194 | - }, | |
195 | - success: function(su) { | |
196 | - s.setData({ | |
197 | - toji: su.data.data, | |
198 | - }); | |
199 | - } | |
200 | - }) | |
201 | - /*-----获取线下会员的预存款和优惠券的数量-----*/ | |
202 | - rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, { | |
203 | - isShowLoading:0, | |
204 | - success: function(su) { | |
205 | - if(su.data.code==0 && su.data.data ) { | |
206 | - var data = su.data.data; | |
207 | - if(!data) data={}; | |
208 | - data.cashcount = parseInt(data.cashcount); | |
209 | - s.setData({ | |
210 | - udata: data, | |
211 | - }); | |
212 | - } | |
213 | - | |
214 | - } | |
215 | - }) | |
216 | - /*-----获取会员提现金额-----*/ | |
217 | - rq.get("/api/weshop/withdrawals/summoney", { | |
218 | - isShowLoading:0, | |
219 | - data: { | |
220 | - user_id: e.user_id, | |
221 | - store_id: os.stoid, | |
222 | - status: 0 | |
223 | - }, | |
224 | - success: function(su) { | |
225 | - if (su.data.code == 0) { | |
226 | - var yuer = parseFloat(th.data.userInfo.user_money - | |
227 | - th.data.userInfo.frozen_money - su.data.data.summoney).toFixed(2); | |
228 | - th.setData({ | |
229 | - txmon: su.data.data.summoney, | |
230 | - yuer: yuer | |
231 | - }); | |
232 | - } | |
233 | - } | |
234 | - }) | |
235 | - | |
236 | - /*-----获取会员包邮券的数量-----*/ | |
237 | - rq.get("/api/weshop/userfeemail/page", { | |
238 | - isShowLoading:0, | |
239 | - data: { | |
240 | - user_id: e.user_id, | |
241 | - store_id: os.stoid, | |
242 | - pageSize: 1, | |
243 | - isuse: 0 | |
244 | - }, | |
245 | - success: function(su) { | |
246 | - if (su.data.code == 0) { | |
247 | - th.setData({ | |
248 | - byquan: parseInt(su.data.data.total) | |
249 | - }); | |
250 | - } | |
251 | - } | |
252 | - }); | |
253 | - | |
254 | - /*-----物流信息提醒-----*/ | |
255 | - rq.get('/api/weshop/order/countDadaOrder', { | |
256 | - isShowLoading:0, | |
257 | - data: { | |
258 | - user_id: e.user_id, | |
259 | - store_id: os.stoid, | |
260 | - }, | |
261 | - success: function(su) { | |
262 | - if (su.data.code == 0) { | |
263 | - th.setData({ | |
264 | - countDadaOrder: su.data.data | |
265 | - }); | |
266 | - } | |
267 | - } | |
268 | - }); | |
269 | - | |
270 | - | |
271 | - | |
272 | - | |
273 | - //--初始化是否有打勾-- | |
274 | - getApp().request.get("/api/weshop/users/grade/vip/init/get", { | |
275 | - data: { | |
276 | - storeId: os.stoid | |
277 | - }, | |
278 | - success:function (rs) { | |
279 | - if(rs.data.code==0 && rs.data.data.isBool){ | |
280 | - th.setData({is_init:1}); | |
281 | - /*-----获取会员权益列表-----*/ | |
282 | - rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", { | |
283 | - isShowLoading:0, | |
284 | - data: { | |
285 | - storeId: os.stoid, | |
286 | - pageSize: 100 | |
287 | - }, | |
288 | - success: async function(res) { | |
289 | - | |
290 | - //判断有没有值,没有值返回 | |
291 | - if(!ut.ajax_ok(res)) return false; | |
292 | - | |
293 | - var arr_data = res.data.data.pageData; | |
294 | - var gid = null, | |
295 | - g_qy_list = null, | |
296 | - cz_vals = 0, | |
297 | - need_money = 0, | |
298 | - backClass = null, | |
299 | - | |
300 | - GradeName = ''; | |
301 | - | |
302 | - //获取成长值 | |
303 | - await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get", { | |
304 | - data: { | |
305 | - storeId: os.stoid, | |
306 | - userId: app_d.user_id | |
307 | - } | |
308 | - }).then(res => { | |
309 | - if (res.data.code == 0 && res.data.data) { | |
310 | - gid = res.data.data.GradeId; | |
311 | - var cz_val = res.data.data.GradeSum; | |
312 | - cz_vals = parseInt(cz_val); | |
313 | - GradeName = res.data.data.GradeName; | |
314 | - } | |
315 | - //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid}); | |
316 | - }) | |
317 | - var obj = { | |
318 | - cz_val: cz_vals, | |
319 | - GradeName: GradeName, | |
320 | - gradeId: gid, | |
321 | - is_grad_get:1 | |
322 | - }; | |
323 | - | |
324 | - // 获取最大值 | |
325 | - await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", { | |
326 | - data: { | |
327 | - storeId: os.stoid | |
328 | - } | |
329 | - }).then(res => { | |
330 | - if (res.data.data) | |
331 | - backClass = res.data.data.pageData; | |
332 | - if (backClass) { | |
333 | - var full_cz_val = backClass[backClass.length - 1].BuyGradeSum; | |
334 | - //th.setData({ full_cz_val: full_cz_val}); | |
335 | - obj.full_cz_val = full_cz_val | |
336 | - } | |
337 | - }) | |
338 | - | |
339 | - //--会员权益中心页的修改-- | |
340 | - for (var i in backClass) { | |
341 | - var im = backClass[i]; | |
342 | - if (cz_vals < im.BuyGradeSum && need_money == 0) { | |
343 | - need_money = im.BuyGradeSum; | |
344 | - obj.need_money = need_money; | |
345 | - } | |
346 | - } | |
347 | - | |
348 | - //获取当前等级的特权 | |
349 | - await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", { | |
350 | - data: { | |
351 | - storeId: os.stoid, | |
352 | - GradeId: gid, | |
353 | - userId: app_d.user_id, | |
354 | - pageSize: 100 | |
355 | - } | |
356 | - }).then(res => { | |
357 | - if (res.data.data) | |
358 | - g_qy_list = res.data.data.pageData; | |
359 | - }); | |
360 | - | |
361 | - for (var i in arr_data) { | |
362 | - var item = arr_data[i]; | |
363 | - var FromId = th.check_is_has_qy(item, g_qy_list); | |
364 | - arr_data[i].ishas = 0; | |
365 | - if (FromId) { | |
366 | - arr_data[i].ishas = 1; | |
367 | - arr_data[i].FromId = FromId; | |
368 | - } | |
369 | - } | |
370 | - arr_data.sort(function(a, b) { | |
371 | - return b.ishas - a.ishas | |
372 | - }) | |
373 | - | |
374 | - //4个4个一组 | |
375 | - var arr = new Array(); | |
376 | - for (var i = 0; i < arr_data.length; i += 4) { | |
377 | - arr.push(arr_data.slice(i, i + 4)); | |
378 | - } | |
379 | - //th.setData({ qy_list: arr, need_money: need_money}); | |
380 | - obj.qy_list = arr; | |
381 | - th.setData(obj); | |
382 | - } | |
383 | - }) | |
384 | - } | |
385 | - } | |
386 | - }) | |
387 | - | |
388 | - | |
389 | - | |
390 | - /*-- 获取 --*/ | |
391 | - th.requestRecommend(); | |
392 | - | |
393 | - /*-------系统是否开通等级卡,会员是等级卡-----*/ | |
394 | - getApp().getConfig2(function(e) { | |
395 | - var t_swi = e.switch_list; | |
396 | - if (t_swi) t_swi = JSON.parse(t_swi) | |
397 | - if(t_swi){ | |
398 | - th.setData({sys_switch:t_swi}); | |
399 | - | |
400 | - var user_tool=[]; | |
401 | - if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); | |
402 | - th.setData({c_list:user_tool}) | |
403 | - | |
404 | - } | |
405 | - | |
406 | - | |
407 | - if (parseInt(t_swi.rank_switch) == 2) { | |
408 | - var userInfo = th.data.userInfo; | |
409 | - if (userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") { | |
410 | - var now = ut.gettimestamp(); | |
411 | - var str = userInfo.card_expiredate; | |
412 | - var end = new Date(str); | |
413 | - end = Date.parse(end) / 1000; | |
414 | - //---判断是不是有过期--- | |
415 | - if (now < end) { | |
416 | - th.setData({ | |
417 | - is_dengji: 1 | |
418 | - }) | |
419 | - } else { | |
420 | - th.setData({ | |
421 | - is_dengji: 3 | |
422 | - }) | |
423 | - } | |
424 | - } else { | |
425 | - th.setData({ | |
426 | - is_dengji: 2 | |
427 | - }) | |
428 | - } | |
429 | - } | |
430 | - }) | |
431 | - //th.requestRecommend(); | |
432 | - | |
433 | - | |
434 | - | |
435 | - | |
436 | - | |
437 | - } | |
438 | - | |
439 | - /*-- | |
440 | - var t_swi= getApp().globalData.config2.switch_list | |
441 | - if (t_swi){ | |
442 | - t_swi = JSON.parse(t_swi); | |
443 | - var user_tool=[]; | |
444 | - if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); | |
445 | - th.setData({c_list:user_tool}) | |
446 | - } --*/ | |
447 | - | |
448 | - //自定义组件一定要等到页面加载完了,才来调用selectComponnent | |
449 | - setTimeout(function () { | |
450 | - if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
451 | - var goods_list = th.selectComponent("#goods_recommend"); //组件的id | |
452 | - goods_list.init(); | |
453 | - goods_list.get_list(); | |
454 | - },800) | |
455 | - | |
456 | - | |
457 | - | |
458 | - }, | |
459 | - | |
460 | - | |
461 | - | |
462 | - //判断会员是后有改服务项目 | |
463 | - check_is_has_qy: function(item, g_qy_list) { | |
464 | - if (!g_qy_list) return false; | |
465 | - | |
466 | - for (var i in g_qy_list) { | |
467 | - var iter = g_qy_list[i]; | |
468 | - if (iter.FormId == item.Id) return g_qy_list[i].FormId; | |
469 | - } | |
470 | - return false; | |
471 | - }, | |
472 | - | |
473 | - /** | |
474 | - * 生命周期函数--监听页面隐藏 | |
475 | - */ | |
476 | - onHide: function() { | |
477 | - for(var i = 1; i < 100; i++) { | |
478 | - clearInterval(i); | |
479 | - } | |
480 | - }, | |
481 | - setappdata: function(t) { | |
482 | - var t=getApp().globalData.wxapp_buy_obj; | |
483 | - if (t && t.isout == 1) | |
484 | - wx.navigateTo({ | |
485 | - url: "/pages/error/error?msg=小程序已经过期", | |
486 | - }); | |
487 | - if (t && t.isbuy == 0) | |
488 | - wx.navigateTo({ | |
489 | - url: "/pages/error/error?msg=还未购买小程序", | |
490 | - }); | |
491 | - }, | |
492 | - | |
493 | - /** | |
494 | - * 页面上拉触底事件的处理函数 | |
495 | - */ | |
496 | - onReachBottom: function() { | |
497 | - //!this.nomore && this.requestRecommend(); | |
498 | - var goods_list = this.selectComponent("#goods_recommend"); //组件的id | |
499 | - goods_list.init(); | |
500 | - setTimeout(function() { | |
501 | - goods_list.get_list(); | |
502 | - }, 300) | |
503 | - }, | |
504 | - | |
505 | - /** | |
506 | - * 用户点击右上角分享 | |
507 | - */ | |
508 | - onShareAppMessage: function() { getApp().globalData.no_clear=1; }, | |
509 | - | |
510 | - //------卡片的显示和关闭-------- | |
511 | - show_tc: function() { | |
512 | - if (!this.data.userInfo) return false; | |
513 | - //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') | |
514 | - var val=this.data.userInfo.mobile+"|"+ut.formatTime(); | |
515 | - val="^"+ut.base64_encode(val); | |
516 | - | |
517 | - qrcode('qrcode', val, 480, 480, this); | |
518 | - this.setData({ | |
519 | - tc_hide: false, | |
520 | - }); | |
521 | - }, | |
522 | - hide_tc: function() { | |
523 | - this.setData({ | |
524 | - tc_hide: true, | |
525 | - }); | |
526 | - }, | |
527 | - | |
528 | - //--跳转到预存款页面-- | |
529 | - deposit: function() { | |
530 | - if (!this.data.userInfo) return false; | |
531 | - wx.navigateTo({ | |
532 | - url: '../deposit/deposit', | |
533 | - }) | |
534 | - }, | |
535 | - //--跳转到余额页面-- | |
536 | - balance: function() { | |
537 | - if (!this.data.userInfo) return false; | |
538 | - wx.navigateTo({ | |
539 | - url: '../member/menber', | |
540 | - }) | |
541 | - }, | |
542 | - //--跳转到优惠券-- | |
543 | - coupon: function() { | |
544 | - var th = this; | |
545 | - if (!this.data.userInfo) return false; | |
546 | - // th.sendsm(); | |
547 | - wx.navigateTo({ | |
548 | - url: '../coupons/coupons', | |
549 | - }) | |
550 | - }, | |
551 | - //--跳转到积分-- | |
552 | - integral: function() { | |
553 | - if (!this.data.userInfo) return false; | |
554 | - wx.navigateTo({ | |
555 | - url: '../integral/integral', | |
556 | - }) | |
557 | - }, | |
558 | - //--跳到绑定页面-- | |
559 | - gobindtel: function() { | |
560 | - wx.navigateTo({ | |
561 | - url: '/pages/togoin/togoin', | |
562 | - }) | |
563 | - }, | |
564 | - | |
565 | - go_order: function(e) { | |
566 | - if (!this.data.userInfo) return false; | |
567 | - var url = e.currentTarget.dataset.url; | |
568 | - wx.navigateTo({ | |
569 | - url: url, | |
570 | - }) | |
571 | - | |
572 | - }, | |
573 | - | |
574 | - //--加载更多商品-- | |
575 | - requestRecommend: function() { | |
576 | - var e = this, | |
577 | - t = '/api/weshop/goods/page?page=' + e.data.currentPage; | |
578 | - var th_recommend_list = e.data.recommend_list; | |
579 | - getApp().request.get(t, { | |
580 | - data: { | |
581 | - is_mainshow: 1, | |
582 | - isonsale: 1, | |
583 | - is_recommend: 1, | |
584 | - is_on_sale: 1, | |
585 | - store_id: os.stoid, | |
586 | - pageSize: 10 | |
587 | - }, | |
588 | - success: function(ee) { | |
589 | - var recommend_list = ee.data.data.pageData; | |
590 | - if (recommend_list && recommend_list.length > 0) { | |
591 | - var dd = [...th_recommend_list, ...recommend_list]; | |
592 | - e.setData({ | |
593 | - recommend_list, | |
594 | - dd | |
595 | - }); | |
596 | - e.data.currentPage++; | |
597 | - } else { | |
598 | - e.setData({ | |
599 | - nomore: 1 | |
600 | - }); | |
601 | - } | |
602 | - } | |
603 | - }) | |
604 | - }, | |
605 | - | |
606 | - //--跳转到权益页面-- | |
607 | - go_qy: function() { | |
608 | - if (!this.data.userInfo) return false; | |
609 | - var url = "/pages/user/userqy/userqy"; | |
610 | - getApp().goto(url); | |
611 | - }, | |
612 | - | |
613 | - //--跳转到商品详情页面-- | |
614 | - go_goods: function(e) { | |
615 | - var gid = e.currentTarget.dataset.gid; | |
616 | - var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid; | |
617 | - getApp().goto(url); | |
618 | - }, | |
619 | - | |
620 | - click_next: function() { | |
621 | - var index = this.data.sw_index; | |
622 | - index++; | |
623 | - if (index >= this.data.qy_list.length) return; | |
624 | - this.setData({ | |
625 | - sw_index: index | |
626 | - }) | |
627 | - }, | |
628 | - | |
629 | - click_pre: function() { | |
630 | - var index = this.data.sw_index; | |
631 | - index--; | |
632 | - if (index < 0) return; | |
633 | - this.setData({ | |
634 | - sw_index: index | |
635 | - }) | |
636 | - }, | |
637 | - | |
638 | - onSli: function(e) { | |
639 | - var that = this; | |
640 | - that.setData({ | |
641 | - sw_index: e.detail.current | |
642 | - }) | |
643 | - }, | |
644 | - | |
645 | - //--权益使用-- | |
646 | - go_qy_url: function(e) { | |
647 | - var th = this; | |
648 | - var no = e.currentTarget.dataset.no; | |
649 | - var ind = e.currentTarget.dataset.ind; | |
650 | - var find = e.currentTarget.dataset.find; | |
651 | - var item = th.data.qy_list[find][ind]; | |
652 | - if (item.ishas == undefined || !item.ishas) { | |
653 | - var qt_txt = th.selectComponent("#pop_txt"); //组件的id | |
654 | - var ob = { | |
655 | - title: "温馨提示", | |
656 | - content: "当前会员暂无此权益" | |
657 | - }; | |
658 | - qt_txt.open(ob); | |
659 | - return false; | |
660 | - } | |
661 | - | |
662 | - var url = e.currentTarget.dataset.img; | |
663 | - if(!url || url==""){ | |
664 | - url=`/public/upload/userqy/quanbg.jpg` | |
665 | - } | |
666 | - switch (no) { | |
667 | - case "01": | |
668 | - getApp().goto("/packageB/pages/user/user_coupon/user_coupon?img=" + | |
669 | - url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id); | |
670 | - break; | |
671 | - case "02": | |
672 | - getApp().goto("/pages/user/user_fw/user_fw?gradeId=" + th.data.gradeId + "&FormId=" + item.Id); | |
673 | - break; | |
674 | - case "03": | |
675 | - getApp().goto("/pages/user/user_spsy/user_spsy?img=" + | |
676 | - url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id); | |
677 | - break; | |
678 | - case "10": | |
679 | - getApp().request.get("/api/weshop/users/grade/vipprivilegelist/other/get", { | |
680 | - data: { | |
681 | - storeId: os.stoid, | |
682 | - formId: item.Id, | |
683 | - userId: getApp().globalData.user_id, | |
684 | - gradeId: th.data.gradeId | |
685 | - }, | |
686 | - success: function(res) { | |
687 | - var val = res.data.data.Remark; | |
688 | - var title = res.data.data.PrivilegeName; | |
689 | - var qt_txt = th.selectComponent("#pop_txt"); //组件的id | |
690 | - var ob = { | |
691 | - title: title, | |
692 | - content: val | |
693 | - }; | |
694 | - qt_txt.open(ob); | |
695 | - } | |
696 | - }) | |
697 | - break; | |
698 | - } | |
699 | - }, | |
700 | - | |
701 | - //跳转到链接 | |
702 | - goto: function(e) { | |
703 | - var url = e.currentTarget.dataset.url; | |
704 | - getApp().goto(url); | |
705 | - }, | |
706 | - | |
707 | - //---------联系客服------------ | |
708 | - contactService: function() { | |
495 | + }, | |
496 | + hide_tc: function () { | |
497 | + this.setData({ | |
498 | + tc_hide: true, | |
499 | + }); | |
500 | + }, | |
501 | + | |
502 | + //--跳转到预存款页面-- | |
503 | + deposit: function () { | |
504 | + if (!this.data.userInfo) return false; | |
505 | + wx.navigateTo({ | |
506 | + url: '/packageD/pages/user/deposit/deposit', | |
507 | + }) | |
508 | + }, | |
509 | + //--跳转到余额页面-- | |
510 | + balance: function () { | |
511 | + if (!this.data.userInfo) return false; | |
512 | + wx.navigateTo({ | |
513 | + url: '/packageD/pages/user/member/menber', | |
514 | + }) | |
515 | + }, | |
516 | + //--跳转到优惠券-- | |
517 | + coupon: function () { | |
518 | + var th = this; | |
519 | + if (!this.data.userInfo) return false; | |
520 | + // th.sendsm(); | |
521 | + wx.navigateTo({ | |
522 | + url: '/packageD/pages/user/coupons/coupons', | |
523 | + }) | |
524 | + }, | |
525 | + //--跳转到积分-- | |
526 | + integral: function () { | |
527 | + if (!this.data.userInfo) return false; | |
528 | + wx.navigateTo({ | |
529 | + url: '/packageD/pages/user/integral/integral', | |
530 | + }) | |
531 | + }, | |
532 | + //--跳到绑定页面-- | |
533 | + gobindtel: function () { | |
534 | + wx.navigateTo({ | |
535 | + url: '/pages/togoin/togoin', | |
536 | + }) | |
537 | + }, | |
538 | + | |
539 | + go_order: function (e) { | |
540 | + if (!this.data.userInfo) return false; | |
541 | + var url = e.currentTarget.dataset.url; | |
542 | + wx.navigateTo({ | |
543 | + url: url, | |
544 | + }) | |
545 | + | |
546 | + }, | |
547 | + | |
548 | + //--加载更多商品-- | |
549 | + requestRecommend: function () { | |
550 | + var e = this, | |
551 | + t = '/api/weshop/goods/page?page=' + e.data.currentPage; | |
552 | + var th_recommend_list = e.data.recommend_list; | |
553 | + getApp().request.get(t, { | |
554 | + data: { | |
555 | + is_mainshow: 1, | |
556 | + isonsale: 1, | |
557 | + is_recommend: 1, | |
558 | + is_on_sale: 1, | |
559 | + store_id: os.stoid, | |
560 | + pageSize: 10 | |
561 | + }, | |
562 | + success: function (ee) { | |
563 | + var recommend_list = ee.data.data.pageData; | |
564 | + if (recommend_list && recommend_list.length > 0) { | |
565 | + var dd = [...th_recommend_list, ...recommend_list]; | |
566 | + e.setData({ | |
567 | + recommend_list, | |
568 | + dd | |
569 | + }); | |
570 | + e.data.currentPage++; | |
571 | + } else { | |
572 | + e.setData({ | |
573 | + nomore: 1 | |
574 | + }); | |
575 | + } | |
576 | + } | |
577 | + }) | |
578 | + }, | |
579 | + | |
580 | + //--跳转到权益页面-- | |
581 | + go_qy: function () { | |
582 | + if (!this.data.userInfo) return false; | |
583 | + var url = "/pages/user/userqy/userqy"; | |
584 | + getApp().goto(url); | |
585 | + }, | |
586 | + | |
587 | + //--跳转到商品详情页面-- | |
588 | + go_goods: function (e) { | |
589 | + var gid = e.currentTarget.dataset.gid; | |
590 | + var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid; | |
591 | + getApp().goto(url); | |
592 | + }, | |
593 | + | |
594 | + click_next: function () { | |
595 | + var index = this.data.sw_index; | |
596 | + index++; | |
597 | + if (index >= this.data.qy_list.length) return; | |
598 | + this.setData({ | |
599 | + sw_index: index | |
600 | + }) | |
601 | + }, | |
602 | + | |
603 | + click_pre: function () { | |
604 | + var index = this.data.sw_index; | |
605 | + index--; | |
606 | + if (index < 0) return; | |
607 | + this.setData({ | |
608 | + sw_index: index | |
609 | + }) | |
610 | + }, | |
611 | + | |
612 | + onSli: function (e) { | |
613 | + var that = this; | |
614 | + that.setData({ | |
615 | + sw_index: e.detail.current | |
616 | + }) | |
617 | + }, | |
618 | + | |
619 | + //--权益使用-- | |
620 | + go_qy_url: function (e) { | |
621 | + var th = this; | |
622 | + var no = e.currentTarget.dataset.no; | |
623 | + var ind = e.currentTarget.dataset.ind; | |
624 | + var find = e.currentTarget.dataset.find; | |
625 | + var item = th.data.qy_list[find][ind]; | |
626 | + if (item.ishas == undefined || !item.ishas) { | |
627 | + var qt_txt = th.selectComponent("#pop_txt"); //组件的id | |
628 | + var ob = { | |
629 | + title: "温馨提示", | |
630 | + content: "当前会员暂无此权益" | |
631 | + }; | |
632 | + qt_txt.open(ob); | |
633 | + return false; | |
634 | + } | |
635 | + | |
636 | + var url = e.currentTarget.dataset.img; | |
637 | + if (!url || url == "") { | |
638 | + url = `/public/upload/userqy/quanbg.jpg` | |
639 | + } | |
640 | + switch (no) { | |
641 | + case "01": | |
642 | + getApp().goto("/packageB/pages/user/user_coupon/user_coupon?img=" + | |
643 | + url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id); | |
644 | + break; | |
645 | + case "02": | |
646 | + getApp().goto("/pages/user/user_fw/user_fw?gradeId=" + th.data.gradeId + "&FormId=" + item.Id); | |
647 | + break; | |
648 | + case "03": | |
649 | + getApp().goto("/pages/user/user_spsy/user_spsy?img=" + | |
650 | + url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id); | |
651 | + break; | |
652 | + case "10": | |
653 | + getApp().request.get("/api/weshop/users/grade/vipprivilegelist/other/get", { | |
654 | + data: { | |
655 | + storeId: os.stoid, | |
656 | + formId: item.Id, | |
657 | + userId: getApp().globalData.user_id, | |
658 | + gradeId: th.data.gradeId | |
659 | + }, | |
660 | + success: function (res) { | |
661 | + var val = res.data.data.Remark; | |
662 | + var title = res.data.data.PrivilegeName; | |
663 | + var qt_txt = th.selectComponent("#pop_txt"); //组件的id | |
664 | + var ob = { | |
665 | + title: title, | |
666 | + content: val | |
667 | + }; | |
668 | + qt_txt.open(ob); | |
669 | + } | |
670 | + }) | |
671 | + break; | |
672 | + } | |
673 | + }, | |
674 | + | |
675 | + //跳转到链接 | |
676 | + goto: function (e) { | |
677 | + var url = e.currentTarget.dataset.url; | |
678 | + getApp().goto(url); | |
679 | + }, | |
680 | + | |
681 | + //---------联系客服------------ | |
682 | + contactService: function () { | |
709 | 683 | getApp().com_call(this); |
710 | 684 | }, |
711 | - | |
685 | + | |
712 | 686 | // 获取客服热线 |
713 | 687 | getTel() { |
714 | 688 | return new Promise((resolve, reject) => { |
715 | 689 | var self = this; |
716 | 690 | var s = getApp(); |
717 | - s.getConfig(function(t) { | |
718 | - if (t.store_tel == undefined) { | |
719 | - getApp().request.get("/api/weshop/store/get/" + os.stoid, { | |
720 | - isShowLoading: 1, | |
721 | - data: {}, | |
722 | - success: function(rs) { | |
723 | - getApp().globalData.config = rs.data.data; | |
724 | - if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | |
725 | - getApp().showWarning("商家未设置电话"); | |
726 | - return false; | |
727 | - } else { | |
691 | + s.getConfig(function (t) { | |
692 | + if (t.store_tel == undefined) { | |
693 | + getApp().request.get("/api/weshop/store/get/" + os.stoid, { | |
694 | + isShowLoading: 1, | |
695 | + data: {}, | |
696 | + success: function (rs) { | |
697 | + getApp().globalData.config = rs.data.data; | |
698 | + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | |
699 | + getApp().showWarning("商家未设置电话"); | |
700 | + return false; | |
701 | + } else { | |
728 | 702 | self.setData({ |
729 | 703 | store_tel: rs.data.data.store_tel, |
730 | 704 | }); |
731 | 705 | // s.confirmBox("客服热线:" + rs.data.data.store_tel); |
732 | 706 | }; |
733 | - | |
734 | - } | |
735 | - }) | |
736 | - } else { | |
707 | + | |
708 | + } | |
709 | + }) | |
710 | + } else { | |
737 | 711 | self.setData({ |
738 | 712 | store_tel: t.store_tel, |
739 | 713 | }); |
740 | - // s.confirmBox("客服热线:" + t.store_tel); | |
741 | - } | |
714 | + // s.confirmBox("客服热线:" + t.store_tel); | |
715 | + } | |
742 | 716 | resolve(); |
743 | 717 | }); |
744 | 718 | }); |
745 | 719 | }, |
746 | - | |
747 | - | |
748 | - go_info: function() { | |
749 | - getApp().goto("/pages/user/userinfo/userinfo"); | |
750 | - }, | |
751 | - | |
752 | - jump: function() { | |
753 | - getApp().goto("/pages/user/grow_value/grow_value") | |
754 | - }, | |
755 | - // 判断生日营销的页面是不是存在 | |
756 | - birthday: function() { | |
757 | - | |
758 | - var th = this; | |
759 | - rq.get("/api/weshop/marketing/birthday/act/judge", { | |
760 | - data: { storeId: os.stoid, userId: app_d.user_id }, | |
761 | - success: function (res) { | |
762 | - | |
763 | - var code = res.data.code; | |
764 | - if (code == 0) { | |
765 | - var giftbagid = res.data.data.giftBagId; | |
766 | - var actId = res.data.data.id; | |
767 | - var actImg = res.data.data.actImg; | |
768 | - th.setData({ giftbagid: giftbagid, actId: actId, actImg: actImg }); | |
769 | - th.setData({is_banner:1}); | |
770 | - } | |
771 | - | |
772 | - } | |
773 | - }) | |
774 | - }, | |
775 | - clike_banne: function() { | |
776 | - var th = this; | |
777 | - var actId = th.data.actId; | |
778 | - var giftbagid = th.data.giftbagid; | |
779 | - | |
780 | - if (actId != "" && giftbagid != "") { | |
781 | - | |
782 | - getApp().goto("/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3); | |
783 | - } else { | |
784 | - | |
785 | - getApp().showWarning("请稍后重试"); | |
786 | - } | |
787 | - }, | |
788 | - | |
789 | - // 判断助力活动是不是存在 | |
790 | - is_assistance: function() { | |
791 | - var th = this,r=Math.random()*100; | |
792 | - rq.get("/api/weshop/marketing/help/act/judge", { | |
793 | - data: { | |
794 | - storeId: os.stoid, | |
795 | - userId: app_d.user_id, | |
796 | - r:r, | |
797 | - }, | |
798 | - success: function(res) { | |
799 | - var code = res.data.code; | |
800 | - if (code == 0) { | |
801 | - th.setData({ | |
802 | - is_assistance: 1 | |
803 | - }); | |
804 | - }else{ | |
720 | + | |
721 | + | |
722 | + go_info: function () { | |
723 | + getApp().goto("/pages/user/userinfo/userinfo"); | |
724 | + }, | |
725 | + | |
726 | + jump: function () { | |
727 | + getApp().goto("/pages/user/grow_value/grow_value") | |
728 | + }, | |
729 | + // 判断生日营销的页面是不是存在 | |
730 | + birthday: function () { | |
731 | + | |
732 | + var th = this; | |
733 | + rq.get("/api/weshop/marketing/birthday/act/judge", { | |
734 | + data: { storeId: os.stoid, userId: app_d.user_id }, | |
735 | + success: function (res) { | |
736 | + | |
737 | + var code = res.data.code; | |
738 | + if (code == 0) { | |
739 | + var giftbagid = res.data.data.giftBagId; | |
740 | + var actId = res.data.data.id; | |
741 | + var actImg = res.data.data.actImg; | |
742 | + th.setData({ giftbagid: giftbagid, actId: actId, actImg: actImg }); | |
743 | + th.setData({ is_banner: 1 }); | |
744 | + } | |
745 | + | |
746 | + } | |
747 | + }) | |
748 | + }, | |
749 | + clike_banne: function () { | |
750 | + var th = this; | |
751 | + var actId = th.data.actId; | |
752 | + var giftbagid = th.data.giftbagid; | |
753 | + | |
754 | + if (actId != "" && giftbagid != "") { | |
755 | + | |
756 | + getApp().goto("/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3); | |
757 | + } else { | |
758 | + | |
759 | + getApp().showWarning("请稍后重试"); | |
760 | + } | |
761 | + }, | |
762 | + | |
763 | + // 判断助力活动是不是存在 | |
764 | + is_assistance: function () { | |
765 | + var th = this, r = Math.random() * 100; | |
766 | + rq.get("/api/weshop/marketing/help/act/judge", { | |
767 | + data: { | |
768 | + storeId: os.stoid, | |
769 | + userId: app_d.user_id, | |
770 | + r: r, | |
771 | + }, | |
772 | + success: function (res) { | |
773 | + var code = res.data.code; | |
774 | + if (code == 0) { | |
775 | + th.setData({ | |
776 | + is_assistance: 1 | |
777 | + }); | |
778 | + } else { | |
805 | 779 | th.setData({ |
806 | 780 | is_assistance: 0 |
807 | 781 | }); |
808 | 782 | } |
809 | 783 | |
810 | - } | |
811 | - }) | |
812 | - }, | |
813 | - | |
814 | - //导航跳转 | |
815 | - nav_goto:function(e){ | |
816 | - var url=e.currentTarget.dataset.url; | |
817 | - if(!url || url=='') return; | |
818 | - if(url[0]!='/') url='/'+url; | |
819 | - getApp().goto(url); | |
820 | - }, | |
821 | - | |
822 | - //添加卡包 | |
823 | - addcard:function(){ | |
824 | - var res=this.data.add_card_data; | |
825 | - if(!res) return false; | |
826 | - | |
827 | - var arr = new Array(6) | |
828 | - arr[0] = res.code; | |
829 | - arr[1] = res.timestamp; | |
830 | - arr[2] = res.jsapiTicket; | |
831 | - arr[3] = res.openid; | |
832 | - arr[4] = res.cardid; | |
833 | - arr[5] = res.nonceStr; | |
834 | - var c=arr.sort(); | |
835 | - var newstr=""; | |
836 | - for (var i=0;i<c.length;i++) | |
837 | - { | |
838 | - newstr+=c[i]; | |
839 | - } | |
840 | - | |
841 | - var sh1= ut.sha1(newstr); | |
842 | - wx.addCard({ | |
843 | - cardList: [ | |
844 | - { | |
845 | - cardId: res.cardid, | |
846 | - cardExt: '{"code": "'+res.code+'", "openid": "'+res.openid+'","timestamp": "' + res.timestamp + '","nonce_str":"' + res.nonceStr + '","outer_str":"web", "signature":"' + sh1 + '"}' | |
847 | - } | |
848 | - | |
849 | - ], | |
850 | - success: function (res) {}, | |
851 | - cancel: function (res) {} | |
852 | - }); | |
853 | - }, | |
854 | - | |
855 | - //订阅消息提醒 | |
856 | - sendsm:function() | |
857 | - { | |
858 | - var template_id = ""; | |
859 | - rq.get("/api/wx/weappSendlist/page", { | |
860 | - data: { | |
861 | - store_id: os.stoid, | |
862 | - typeid: "1020" | |
863 | - }, | |
864 | - success: function(res) { | |
865 | - if (res.data.code == 0 && res.data.data.pageData.length > 0) { | |
866 | - template_id = res.data.data.pageData[0].template_id; | |
867 | - // //授权订阅 | |
868 | - wx.requestSubscribeMessage({ | |
869 | - tmplIds: [template_id], | |
870 | - success(res) { | |
871 | - | |
872 | - }, | |
873 | - fail(res) { | |
874 | - | |
875 | - } | |
876 | - }) | |
877 | - } | |
878 | - } | |
879 | - }) | |
880 | - }, | |
881 | - | |
882 | - con_weixin:function () { | |
883 | - getApp().con_wx(this); | |
884 | - }, | |
885 | - | |
886 | - //初始话按钮图标 | |
887 | - init_user_tool:async function () { | |
888 | - var d_list=null; | |
889 | - //读取user_tool按钮图标 | |
890 | - await getApp().promiseGet("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { | |
891 | - }).then(res=>{ | |
892 | - if(ut.ajax_ok(res)) { | |
893 | - d_list=res.data.data.pageData; | |
894 | - } | |
895 | - }) | |
896 | - if(!d_list) return false; | |
897 | - //过滤掉分销关闭的 | |
898 | - await getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ | |
899 | - if(rs.data.code==0){ | |
900 | - var dis=rs.data.data; | |
901 | - for(var i in d_list){ | |
902 | - if(d_list[i].name=='我的分销' && (!dis || dis.switch==0)){ | |
903 | - d_list.splice(i,1); | |
904 | - } | |
905 | - } | |
906 | - } | |
907 | - }) | |
908 | - | |
909 | - //判断右没有开AI测肤 | |
910 | - await getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+os.stoid,{}).then(rs=>{ | |
911 | - if(rs.data.code!=0 || !rs.data.data){ | |
912 | - for(var i in d_list){ | |
913 | - if(d_list[i].name=='AI测肤'){ | |
914 | - d_list.splice(i,1); | |
915 | - } | |
916 | - } | |
917 | - } | |
918 | - }) | |
919 | - this.setData({user_tool:d_list}); | |
920 | - }, | |
921 | - | |
922 | - | |
923 | - click_contact:function () { | |
924 | - getApp().globalData.no_clear=1; | |
925 | - }, | |
784 | + } | |
785 | + }) | |
786 | + }, | |
787 | + | |
788 | + //导航跳转 | |
789 | + nav_goto: function (e) { | |
790 | + var url = e.currentTarget.dataset.url; | |
791 | + if (!url || url == '') return; | |
792 | + if (url[0] != '/') url = '/' + url; | |
793 | + getApp().goto(url); | |
794 | + }, | |
795 | + | |
796 | + //添加卡包 | |
797 | + addcard: function () { | |
798 | + var res = this.data.add_card_data; | |
799 | + if (!res) return false; | |
800 | + | |
801 | + var arr = new Array(6) | |
802 | + arr[0] = res.code; | |
803 | + arr[1] = res.timestamp; | |
804 | + arr[2] = res.jsapiTicket; | |
805 | + arr[3] = res.openid; | |
806 | + arr[4] = res.cardid; | |
807 | + arr[5] = res.nonceStr; | |
808 | + var c = arr.sort(); | |
809 | + var newstr = ""; | |
810 | + for (var i = 0; i < c.length; i++) { | |
811 | + newstr += c[i]; | |
812 | + } | |
813 | + | |
814 | + var sh1 = ut.sha1(newstr); | |
815 | + wx.addCard({ | |
816 | + cardList: [ | |
817 | + { | |
818 | + cardId: res.cardid, | |
819 | + cardExt: '{"code": "' + res.code + '", "openid": "' + res.openid + '","timestamp": "' + res.timestamp + '","nonce_str":"' + res.nonceStr + '","outer_str":"web", "signature":"' + sh1 + '"}' | |
820 | + } | |
821 | + | |
822 | + ], | |
823 | + success: function (res) { }, | |
824 | + cancel: function (res) { } | |
825 | + }); | |
826 | + }, | |
827 | + | |
828 | + //订阅消息提醒 | |
829 | + sendsm: function () { | |
830 | + var template_id = ""; | |
831 | + rq.get("/api/wx/weappSendlist/page", { | |
832 | + data: { | |
833 | + store_id: os.stoid, | |
834 | + typeid: "1020" | |
835 | + }, | |
836 | + success: function (res) { | |
837 | + if (res.data.code == 0 && res.data.data.pageData.length > 0) { | |
838 | + template_id = res.data.data.pageData[0].template_id; | |
839 | + // //授权订阅 | |
840 | + wx.requestSubscribeMessage({ | |
841 | + tmplIds: [template_id], | |
842 | + success(res) { | |
843 | + | |
844 | + }, | |
845 | + fail(res) { | |
846 | + | |
847 | + } | |
848 | + }) | |
849 | + } | |
850 | + } | |
851 | + }) | |
852 | + }, | |
853 | + | |
854 | + con_weixin: function () { | |
855 | + getApp().con_wx(this); | |
856 | + }, | |
857 | + | |
858 | + //初始话按钮图标 | |
859 | + init_user_tool: async function () { | |
860 | + var d_list = null; | |
861 | + //读取user_tool按钮图标 | |
862 | + await getApp().promiseGet("/api/weshop/userTool/page?pageSize=100&store_id=" + os.stoid, { | |
863 | + }).then(res => { | |
864 | + if (ut.ajax_ok(res)) { | |
865 | + d_list = res.data.data.pageData; | |
866 | + } | |
867 | + }) | |
926 | 868 | |
927 | - //打开客服操作菜单 | |
928 | - openCS() { | |
929 | - // 判断会员状态 | |
930 | - let user_info = getApp().globalData.userInfo; | |
931 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { | |
932 | - wx.navigateTo({ | |
933 | - url: '/pages/togoin/togoin', | |
934 | - }) | |
935 | - return false; | |
936 | - }; | |
937 | - // csType/在线客服设置: | |
938 | - // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 | |
939 | - // 1小程序客服、 | |
940 | - // 2企业微信客服 | |
941 | - if(this.data.sys_switch) { | |
942 | - let csType = this.data.sys_switch.weapp_customertype; | |
943 | - if(csType == 0) { | |
944 | - // 拨打电话号码 | |
945 | - this.contactService(); | |
946 | - } else { | |
947 | - this.getTel() | |
869 | + if (!d_list) return false; | |
870 | + //过滤掉分销关闭的 | |
871 | + let distribut_end_time = await getApp().user_tools_endTime(2);//过滤掉分销到期的 | |
872 | + await getApp().promiseGet("/api/weshop/storeDistribut/get/" + os.stoid, {}).then(rs => { | |
873 | + if (rs.data.code == 0) { | |
874 | + var dis = rs.data.data; | |
875 | + for (var i in d_list) { | |
876 | + if (d_list[i].name == '我的分销' && (!dis || dis.switch == 0) || (d_list[i].name == '我的分销' && !distribut_end_time)) { | |
877 | + d_list.splice(i, 1); | |
878 | + } | |
879 | + } | |
880 | + } | |
881 | + }) | |
882 | + | |
883 | + //判断有没有开AI测肤 | |
884 | + await getApp().promiseGet("/api/weshop/wx/weappSkin/get/" + os.stoid, {}).then(rs => { | |
885 | + if (rs.data.code != 0 || !rs.data.data) { | |
886 | + for (var i in d_list) { | |
887 | + if (d_list[i].name == 'AI测肤') { | |
888 | + d_list.splice(i, 1); | |
889 | + } | |
890 | + } | |
891 | + } | |
892 | + }) | |
893 | + this.setData({ user_tool: d_list }); | |
894 | + }, | |
895 | + | |
896 | + | |
897 | + click_contact: function () { | |
898 | + getApp().globalData.no_clear = 1; | |
899 | + }, | |
900 | + | |
901 | + //打开客服操作菜单 | |
902 | + openCS() { | |
903 | + // 判断会员状态 | |
904 | + let user_info = getApp().globalData.userInfo; | |
905 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { | |
906 | + wx.navigateTo({ | |
907 | + url: '/pages/togoin/togoin', | |
908 | + }) | |
909 | + return false; | |
910 | + }; | |
911 | + // csType/在线客服设置: | |
912 | + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 | |
913 | + // 1小程序客服、 | |
914 | + // 2企业微信客服 | |
915 | + if (this.data.sys_switch) { | |
916 | + let csType = this.data.sys_switch.weapp_customertype; | |
917 | + if (csType == 0) { | |
918 | + // 拨打电话号码 | |
919 | + this.contactService(); | |
920 | + } else { | |
921 | + this.getTel() | |
948 | 922 | .then(() => { |
949 | 923 | self.setData({ |
950 | 924 | hiddenCS: false, |
951 | 925 | }); |
952 | 926 | }); |
953 | - }; | |
954 | 927 | }; |
955 | - | |
956 | - }, | |
957 | - | |
958 | - //关闭客服操作菜单 | |
959 | - closeCS() { | |
960 | - this.setData({ | |
961 | - hiddenCS: true, | |
962 | - }); | |
963 | - }, | |
928 | + }; | |
929 | + | |
930 | + }, | |
931 | + | |
932 | + //关闭客服操作菜单 | |
933 | + closeCS() { | |
934 | + this.setData({ | |
935 | + hiddenCS: true, | |
936 | + }); | |
937 | + }, | |
964 | 938 | |
965 | 939 | |
966 | 940 | ... | ... |
pages/user/my_service/i_service.wxml
... | ... | @@ -39,7 +39,8 @@ |
39 | 39 | |
40 | 40 | <view class="flex-center fs24 itemCount"> |
41 | 41 | <view>剩余次数:</view> |
42 | - <view>{{item.ObtainTimes}}</view> | |
42 | + <view wx:if="{{item.DisplayQty==true || DisplayQty==1}}">无限次</view> | |
43 | + <view wx:else>{{item.ObtainTimes}}</view> | |
43 | 44 | </view> |
44 | 45 | |
45 | 46 | <view class="flex-center fs24 itemEffective"> | ... | ... |
pages/user/order_detail/order_detail.js
... | ... | @@ -464,7 +464,7 @@ Page({ |
464 | 464 | } |
465 | 465 | }) |
466 | 466 | if(is_g_prom){ |
467 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { | |
467 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0"+"/"+getApp().globalData.user_id, {}).then(res => { | |
468 | 468 | if (res.data.code == 0) { |
469 | 469 | var r_data = res.data.data; |
470 | 470 | if (!r_data.collocationPromList && good.prom_type == 5) { |
... | ... | @@ -585,7 +585,7 @@ Page({ |
585 | 585 | //不是赠品的时候 |
586 | 586 | if(!good.is_gift && good.prom_type!=3){ |
587 | 587 | var t_ok=1; |
588 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0", {}).then(res => { | |
588 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0"+"/"+getApp().globalData.user_id, {}).then(res => { | |
589 | 589 | if(res.data.code==0){ |
590 | 590 | var r_data=res.data.data; |
591 | 591 | //-- 参加了全局的优惠活动 -- |
... | ... | @@ -1047,7 +1047,7 @@ Page({ |
1047 | 1047 | }) |
1048 | 1048 | |
1049 | 1049 | //调用接口判断订单优惠, |
1050 | - const res = await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + g_item.goods_id + "/0", {}) | |
1050 | + const res = await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + g_item.goods_id + "/0"+"/"+getApp().globalData.user_id, {}) | |
1051 | 1051 | if (res.data.code == 0 && res.data.data) { |
1052 | 1052 | var r_data = res.data.data; |
1053 | 1053 | if (r_data.ladderLists) { |
... | ... | @@ -1215,7 +1215,7 @@ Page({ |
1215 | 1215 | } |
1216 | 1216 | }) |
1217 | 1217 | if(is_g_prom) { |
1218 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => { | |
1218 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1"+"/"+getApp().globalData.user_id, {}).then(res => { | |
1219 | 1219 | if (res.data.code == 0) { |
1220 | 1220 | var r_data = res.data.data; |
1221 | 1221 | if (r_data.promGoodsLists) { | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -717,7 +717,7 @@ Page({ |
717 | 717 | } |
718 | 718 | }) |
719 | 719 | if(is_g_prom){ |
720 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { | |
720 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0"+"/"+getApp().globalData.user_id, {}).then(res => { | |
721 | 721 | if (res.data.code == 0) { |
722 | 722 | var r_data = res.data.data; |
723 | 723 | if (!r_data.collocationPromList && good.prom_type == 5) { |
... | ... | @@ -838,7 +838,7 @@ Page({ |
838 | 838 | else { |
839 | 839 | if (!good.is_gift && good.prom_type != 3) { |
840 | 840 | var t_ok = 1; |
841 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0", {}).then(res => { | |
841 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0"+"/"+getApp().globalData.user_id, {}).then(res => { | |
842 | 842 | if (res.data.code == 0) { |
843 | 843 | var r_data = res.data.data; |
844 | 844 | //-- 参加了全局的优惠活动 -- |
... | ... | @@ -1457,7 +1457,7 @@ Page({ |
1457 | 1457 | } |
1458 | 1458 | }) |
1459 | 1459 | if(is_g_prom) { |
1460 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => { | |
1460 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1"+"/"+getApp().globalData.user_id, {}).then(res => { | |
1461 | 1461 | if (res.data.code == 0) { |
1462 | 1462 | var r_data = res.data.data; |
1463 | 1463 | if (r_data.promGoodsLists) { | ... | ... |