Commit 809e49fa15e607d5d8c3149ac16daccf4a5bf3c1
1 parent
38709b66
3.26 oa单
Showing
18 changed files
with
1171 additions
and
1151 deletions
app.js
@@ -51,7 +51,7 @@ App({ | @@ -51,7 +51,7 @@ App({ | ||
51 | config: null, //门店参数 | 51 | config: null, //门店参数 |
52 | config2: null, //门店配置 | 52 | config2: null, //门店配置 |
53 | code: null, | 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 | buy_now: null, | 55 | buy_now: null, |
56 | picklist: null, //门店列表 | 56 | picklist: null, //门店列表 |
57 | wuliuprice: null, //物流价格表 | 57 | wuliuprice: null, //物流价格表 |
@@ -61,7 +61,6 @@ App({ | @@ -61,7 +61,6 @@ App({ | ||
61 | getu: null, //记录会员信息 | 61 | getu: null, //记录会员信息 |
62 | sessionKey: null,//记录会员信息 | 62 | sessionKey: null,//记录会员信息 |
63 | openid: null, //记录会员信息 | 63 | openid: null, //记录会员信息 |
64 | - | ||
65 | to_group: null, //参团传递的数据 | 64 | to_group: null, //参团传递的数据 |
66 | wxapp_buy_obj: null, //微信小程序购买的Object | 65 | wxapp_buy_obj: null, //微信小程序购买的Object |
67 | pk_store: null, //选择的门店 | 66 | pk_store: null, //选择的门店 |
@@ -363,7 +362,7 @@ App({ | @@ -363,7 +362,7 @@ App({ | ||
363 | title: t, | 362 | title: t, |
364 | mask: e, | 363 | mask: e, |
365 | duration: a, | 364 | duration: a, |
366 | - icon: 'error', | 365 | + icon: 'error', |
367 | // image: "/images/gt.png", | 366 | // image: "/images/gt.png", |
368 | complete: function () { | 367 | complete: function () { |
369 | "function" == typeof o && setTimeout(o, a); | 368 | "function" == typeof o && setTimeout(o, a); |
@@ -430,12 +429,12 @@ App({ | @@ -430,12 +429,12 @@ App({ | ||
430 | }) | 429 | }) |
431 | }, | 430 | }, |
432 | //获取场景值 判断是否是单页面 | 431 | //获取场景值 判断是否是单页面 |
433 | - is_Single_page(_this,func) { | ||
434 | - let scene = wx.getLaunchOptionsSync().scene; | 432 | + is_Single_page(_this, func) { |
433 | + let scene = wx.getLaunchOptionsSync().scene; | ||
435 | //--判断是否是单页面-- | 434 | //--判断是否是单页面-- |
436 | - if(scene !== 1154){ | ||
437 | - typeof func =="function" && func.bind(_this)(); | ||
438 | - }else{ | 435 | + if (scene !== 1154) { |
436 | + typeof func == "function" && func.bind(_this)(); | ||
437 | + } else { | ||
439 | return false; | 438 | return false; |
440 | } | 439 | } |
441 | // return scene == 1154? false:true; | 440 | // return scene == 1154? false:true; |
@@ -672,11 +671,11 @@ App({ | @@ -672,11 +671,11 @@ App({ | ||
672 | 671 | ||
673 | //清空登录时候缓存的值 | 672 | //清空登录时候缓存的值 |
674 | onHide: function () { | 673 | onHide: function () { |
675 | - var th=this; | 674 | + var th = this; |
676 | setTimeout(function () { | 675 | setTimeout(function () { |
677 | console.log("app onhide"); | 676 | console.log("app onhide"); |
678 | console.log(th.globalData.no_clear); | 677 | console.log(th.globalData.no_clear); |
679 | - if(!th.globalData.no_clear) { | 678 | + if (!th.globalData.no_clear) { |
680 | th.globalData.is_test = 0; | 679 | th.globalData.is_test = 0; |
681 | th.globalData.guide_id = null; //导购清空 | 680 | th.globalData.guide_id = null; //导购清空 |
682 | th.globalData.first_leader = null; //分享的会员清空 | 681 | th.globalData.first_leader = null; //分享的会员清空 |
@@ -691,10 +690,10 @@ App({ | @@ -691,10 +690,10 @@ App({ | ||
691 | th.globalData.dis_buy_obj = null; //等级卡的购买记录 | 690 | th.globalData.dis_buy_obj = null; //等级卡的购买记录 |
692 | th.globalData.storeFooter = null; //底部的导航 | 691 | th.globalData.storeFooter = null; //底部的导航 |
693 | th.globalData.full_screen = null; //全屏 | 692 | th.globalData.full_screen = null; //全屏 |
694 | - }else{ | ||
695 | - th.globalData.no_clear=0; | 693 | + } else { |
694 | + th.globalData.no_clear = 0; | ||
696 | } | 695 | } |
697 | - },600) | 696 | + }, 600) |
698 | 697 | ||
699 | }, | 698 | }, |
700 | 699 | ||
@@ -803,7 +802,7 @@ App({ | @@ -803,7 +802,7 @@ App({ | ||
803 | if (wx.canIUse('getUpdateManager')) { | 802 | if (wx.canIUse('getUpdateManager')) { |
804 | //创建 UpdateManager 实例 | 803 | //创建 UpdateManager 实例 |
805 | const updateManager = wx.getUpdateManager(); | 804 | const updateManager = wx.getUpdateManager(); |
806 | - if(!updateManager) { | 805 | + if (!updateManager) { |
807 | return false; | 806 | return false; |
808 | } | 807 | } |
809 | //检测版本更新 | 808 | //检测版本更新 |
@@ -836,42 +835,42 @@ App({ | @@ -836,42 +835,42 @@ App({ | ||
836 | }, | 835 | }, |
837 | 836 | ||
838 | //重复函数,统一调用, | 837 | //重复函数,统一调用, |
839 | - pre_img(path){ | ||
840 | - this.globalData.no_clear=1; | 838 | + pre_img(path) { |
839 | + this.globalData.no_clear = 1; | ||
841 | wx.previewImage({ | 840 | wx.previewImage({ |
842 | //将图片预览出来 | 841 | //将图片预览出来 |
843 | urls: [path] | 842 | urls: [path] |
844 | }); | 843 | }); |
845 | }, | 844 | }, |
846 | //b是数组,t是wxml元素返回的 | 845 | //b是数组,t是wxml元素返回的 |
847 | - pre_img2(b,t){ | ||
848 | - this.globalData.no_clear=1; | 846 | + pre_img2(b, t) { |
847 | + this.globalData.no_clear = 1; | ||
849 | wx.previewImage({ | 848 | wx.previewImage({ |
850 | current: b[t.currentTarget.dataset.id], | 849 | current: b[t.currentTarget.dataset.id], |
851 | urls: b | 850 | urls: b |
852 | }); | 851 | }); |
853 | }, | 852 | }, |
854 | 853 | ||
855 | - con_wx(th){ | ||
856 | - var url=th.data.sys_switch.weapp_customertype_url; | ||
857 | - var id=th.data.sys_switch.weapp_customertype_appid; | ||
858 | - this.globalData.no_clear=1; | 854 | + con_wx(th) { |
855 | + var url = th.data.sys_switch.weapp_customertype_url; | ||
856 | + var id = th.data.sys_switch.weapp_customertype_appid; | ||
857 | + this.globalData.no_clear = 1; | ||
859 | wx.openCustomerServiceChat({ | 858 | wx.openCustomerServiceChat({ |
860 | - extInfo: {url: url}, | 859 | + extInfo: { url: url }, |
861 | corpId: id, | 860 | corpId: id, |
862 | - success(res) {} | 861 | + success(res) { } |
863 | }) | 862 | }) |
864 | }, | 863 | }, |
865 | 864 | ||
866 | - con_Service(){ | ||
867 | - var th=this; | ||
868 | - var oss= this.globalData.setting; | ||
869 | - this.getConfig(function(t) { | 865 | + con_Service() { |
866 | + var th = this; | ||
867 | + var oss = this.globalData.setting; | ||
868 | + this.getConfig(function (t) { | ||
870 | if (t.store_tel == undefined) { | 869 | if (t.store_tel == undefined) { |
871 | th.request.get("/api/weshop/store/get/" + oss.stoid, { | 870 | th.request.get("/api/weshop/store/get/" + oss.stoid, { |
872 | isShowLoading: 1, | 871 | isShowLoading: 1, |
873 | data: {}, | 872 | data: {}, |
874 | - success: function(rs) { | 873 | + success: function (rs) { |
875 | th.globalData.config = rs.data.data; | 874 | th.globalData.config = rs.data.data; |
876 | if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | 875 | if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { |
877 | wx.showToast({ | 876 | wx.showToast({ |
@@ -881,46 +880,65 @@ App({ | @@ -881,46 +880,65 @@ App({ | ||
881 | }) | 880 | }) |
882 | return false; | 881 | return false; |
883 | } | 882 | } |
884 | - th.globalData.no_clear=1; | 883 | + th.globalData.no_clear = 1; |
885 | wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, }) | 884 | wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, }) |
886 | } | 885 | } |
887 | }) | 886 | }) |
888 | } else { | 887 | } else { |
889 | - th.globalData.no_clear=1; | 888 | + th.globalData.no_clear = 1; |
890 | wx.makePhoneCall({ phoneNumber: t.store_tel, }) | 889 | wx.makePhoneCall({ phoneNumber: t.store_tel, }) |
891 | } | 890 | } |
892 | }); | 891 | }); |
893 | }, | 892 | }, |
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 | - }, | 893 | + |
894 | + user_tools_endTime(type) { | ||
895 | + //调用接口判断商家工具有没有过期 | ||
896 | + return this.request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=" + type + "", {}).then(res => { | ||
897 | + if (res.data.code == 0) { | ||
898 | + var arr = res.data.data.pageData; | ||
899 | + if (arr.length > 0) { | ||
900 | + var item = arr[0]; | ||
901 | + if (item.is_sy == 0) { | ||
902 | + var now = Date.parse(new Date()); now = now / 1000; | ||
903 | + if (item.end_time < now) { | ||
904 | + return 0 | ||
905 | + } | ||
906 | + return 1; | ||
907 | + } | ||
908 | + } | ||
909 | + } | ||
910 | + }) | ||
911 | + }, | ||
912 | + | ||
913 | + com_call(self) { | ||
914 | + self.getTel() | ||
915 | + .then(() => { | ||
916 | + if (self.data.store_tel) { | ||
917 | + wx.showModal({ | ||
918 | + title: '联系客服', | ||
919 | + content: '客服热线:' + self.data.store_tel, | ||
920 | + confirmText: '拨打', | ||
921 | + success(res) { | ||
922 | + if (res.confirm) { | ||
923 | + getApp().globalData.no_clear = 1; | ||
924 | + wx.makePhoneCall({ | ||
925 | + phoneNumber: self.data.store_tel, | ||
926 | + }) | ||
927 | + }; | ||
928 | + }, | ||
929 | + }); | ||
930 | + }; | ||
931 | + }); | ||
932 | + }, | ||
915 | 933 | ||
916 | //检验能不能分享 | 934 | //检验能不能分享 |
917 | - check_can_share(){ | ||
918 | - if(!this.globalData.user_id) wx.hideShareMenu(); | ||
919 | - else wx.showShareMenu(); | 935 | + check_can_share() { |
936 | + if (!this.globalData.user_id) wx.hideShareMenu(); | ||
937 | + else wx.showShareMenu(); | ||
920 | } | 938 | } |
921 | 939 | ||
922 | 940 | ||
923 | - | 941 | + |
924 | 942 | ||
925 | 943 | ||
926 | }); | 944 | }); |
components/diy_goodsGroup/diy_goodsGroup.js
@@ -29,7 +29,7 @@ Component({ | @@ -29,7 +29,7 @@ Component({ | ||
29 | currentPage: 1, | 29 | currentPage: 1, |
30 | requestData: null, | 30 | requestData: null, |
31 | requestUrl: "", | 31 | requestUrl: "", |
32 | - goods_array: null, | 32 | + goods_array: [], |
33 | total: null, | 33 | total: null, |
34 | prom_id: 0, | 34 | prom_id: 0, |
35 | classstyle_id: null, | 35 | classstyle_id: null, |
@@ -424,7 +424,7 @@ Component({ | @@ -424,7 +424,7 @@ Component({ | ||
424 | 424 | ||
425 | 425 | ||
426 | this.data.currentPage = 1; | 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 | this.init(this.data.classstyle_id, this.data.wgroup); | 429 | this.init(this.data.classstyle_id, this.data.wgroup); |
430 | setTimeout(function () { wx.hideLoading(); }, 1000) | 430 | setTimeout(function () { wx.hideLoading(); }, 1000) |
@@ -467,7 +467,6 @@ Component({ | @@ -467,7 +467,6 @@ Component({ | ||
467 | item.cardprice3 = val.cardprice3; | 467 | item.cardprice3 = val.cardprice3; |
468 | item.prom_type = val.prom_type; | 468 | item.prom_type = val.prom_type; |
469 | item.prom_id = val.prom_id; | 469 | item.prom_id = val.prom_id; |
470 | - | ||
471 | if (val.prom_price) item.prom_price = val.prom_price; | 470 | if (val.prom_price) item.prom_price = val.prom_price; |
472 | if (val.prom_integral) item.prom_integral = val.prom_integral; | 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,6 +3,7 @@ | ||
3 | <wxs module="g_filter" src="g_filter.wxs"></wxs> | 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 | <block wx:if="{{is_nav}}"> | 7 | <block wx:if="{{is_nav}}"> |
7 | <view class="flex gr_title_list" style="overflow-x: auto;"> | 8 | <view class="flex gr_title_list" style="overflow-x: auto;"> |
8 | <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}}"> | 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,9 +11,6 @@ | ||
10 | </view> | 11 | </view> |
11 | </view> | 12 | </view> |
12 | </block> | 13 | </block> |
13 | - | ||
14 | - | ||
15 | - | ||
16 | <view style="background-color: {{bg_color}};"> | 14 | <view style="background-color: {{bg_color}};"> |
17 | <!--1个列表的时候--> | 15 | <!--1个列表的时候--> |
18 | <view class="zs_goods_wai" wx:if='{{object.column==1}}'> | 16 | <view class="zs_goods_wai" wx:if='{{object.column==1}}'> |
packageA/pages/activity_share/activity_share.js
@@ -397,7 +397,7 @@ Page({ | @@ -397,7 +397,7 @@ Page({ | ||
397 | get_colloction: async function(){ | 397 | get_colloction: async function(){ |
398 | var list=null; | 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 | if(res.data.code==0){ | 401 | if(res.data.code==0){ |
402 | list=res.data.data.collocationList; | 402 | list=res.data.data.collocationList; |
403 | } | 403 | } |
packageA/pages/prom_list/prom_list.js
@@ -268,7 +268,7 @@ Page({ | @@ -268,7 +268,7 @@ Page({ | ||
268 | if (!ee.data.collocationList) { | 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 | if (res.data.code == 0) { | 272 | if (res.data.code == 0) { |
273 | var r_data = res.data.data; | 273 | var r_data = res.data.data; |
274 | 274 |
packageA/pages/quan_list/quan_list.js
1 | var t = require("../../../utils/util.js"), ut = t, | 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 | Page({ | 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() { | ||
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 | - }, | ||
45 | - | ||
46 | - onHide: function() { | ||
47 | - | ||
48 | - }, | ||
49 | - | ||
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 | - }, | ||
79 | - | ||
80 | - //---加载更多是靠这个函数---- | ||
81 | - onReachBottom: function() { | ||
82 | - this.get_quan_list(); | ||
83 | - }, | ||
84 | - | ||
85 | - | ||
86 | - //--滚动到顶部-- | ||
87 | - doScrollTop: function() { | ||
88 | - wx.pageScrollTo({ scrollTop: 0 }); | ||
89 | - }, | ||
90 | - | ||
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 | - | ||
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 | - | ||
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; | 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 | + | ||
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 | + | ||
46 | + onHide: function () { | ||
47 | + | ||
48 | + }, | ||
49 | + | ||
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 | + }, | ||
79 | + | ||
80 | + //---加载更多是靠这个函数---- | ||
81 | + onReachBottom: function () { | ||
82 | + this.get_quan_list(); | ||
83 | + }, | ||
84 | + | ||
85 | + | ||
86 | + //--滚动到顶部-- | ||
87 | + doScrollTop: function () { | ||
88 | + wx.pageScrollTo({ scrollTop: 0 }); | ||
89 | + }, | ||
90 | + | ||
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 | + | ||
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 | + 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 | + }) | ||
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); | ||
127 | } | 187 | } |
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 | - } | ||
158 | 188 | ||
159 | 189 | ||
160 | }); | 190 | }); |
packageC/pages/presell/cart/cart.js
@@ -2256,7 +2256,7 @@ Page({ | @@ -2256,7 +2256,7 @@ Page({ | ||
2256 | //如果优惠促销和搭配购的时候 | 2256 | //如果优惠促销和搭配购的时候 |
2257 | if ((good.prom_type == 3 || good.prom_type == 5) && good.is_collocation != 1 && good.is_gift != 1) { | 2257 | if ((good.prom_type == 3 || good.prom_type == 5) && good.is_collocation != 1 && good.is_gift != 1) { |
2258 | var p_ok = 1; | 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 | if (res.data.code == 0) { | 2260 | if (res.data.code == 0) { |
2261 | var r_data = res.data.data; | 2261 | var r_data = res.data.data; |
2262 | if (!r_data.collocationPromList && good.prom_type == 5) { | 2262 | if (!r_data.collocationPromList && good.prom_type == 5) { |
@@ -2336,7 +2336,7 @@ Page({ | @@ -2336,7 +2336,7 @@ Page({ | ||
2336 | //不是赠品的时候 | 2336 | //不是赠品的时候 |
2337 | if (!good.is_gift && good.prom_type != 3) { | 2337 | if (!good.is_gift && good.prom_type != 3) { |
2338 | var t_ok = 1; | 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 | if (res.data.code == 0) { | 2340 | if (res.data.code == 0) { |
2341 | var r_data = res.data.data; | 2341 | var r_data = res.data.data; |
2342 | //-- 参加了全局的优惠活动 -- | 2342 | //-- 参加了全局的优惠活动 -- |
packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -1281,7 +1281,7 @@ Page({ | @@ -1281,7 +1281,7 @@ Page({ | ||
1281 | callback(); | 1281 | callback(); |
1282 | } else { | 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 | if (res.data.code == 0) { | 1285 | if (res.data.code == 0) { |
1286 | var r_data = res.data.data; | 1286 | var r_data = res.data.data; |
1287 | th.data.prom_goods = r_data.promGoodsLists; | 1287 | th.data.prom_goods = r_data.promGoodsLists; |
packageC/pages/presell/pregoodsInfo/goodsInfo.js
@@ -1278,7 +1278,7 @@ Page({ | @@ -1278,7 +1278,7 @@ Page({ | ||
1278 | callback(); | 1278 | callback(); |
1279 | } else { | 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 | if (res.data.code == 0) { | 1282 | if (res.data.code == 0) { |
1283 | var r_data = res.data.data; | 1283 | var r_data = res.data.data; |
1284 | th.data.prom_goods = r_data.promGoodsLists; | 1284 | th.data.prom_goods = r_data.promGoodsLists; |
packageD/pages/AI-test-skin/success_result/success_result.wxml
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | <view style="padding: 0 50rpx 20rpx 20rpx">泪沟</view> | 7 | <view style="padding: 0 50rpx 20rpx 20rpx">泪沟</view> |
8 | </scroll-view> --> | 8 | </scroll-view> --> |
9 | <view style="height: 100rpx;"> | 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 | <view class="flex" style="height: 100%;"> | 11 | <view class="flex" style="height: 100%;"> |
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':''}}"> | 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 | {{item.name}} | 13 | {{item.name}} |
packageD/pages/AI-test-skin/success_result/success_result.wxss
pages/cart/cart/cart.js
@@ -402,7 +402,7 @@ Page({ | @@ -402,7 +402,7 @@ Page({ | ||
402 | }) | 402 | }) |
403 | 403 | ||
404 | if (is_g_prom) { | 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 | if (res.data.code == 0) { | 406 | if (res.data.code == 0) { |
407 | var r_data = res.data.data; | 407 | var r_data = res.data.data; |
408 | if (!r_data.promGoodsLists) { | 408 | if (!r_data.promGoodsLists) { |
@@ -611,7 +611,7 @@ Page({ | @@ -611,7 +611,7 @@ Page({ | ||
611 | else if(item.prom_type == 0) { | 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 | if (res.data.code == 0) { | 615 | if (res.data.code == 0) { |
616 | var r_data = res.data.data; | 616 | var r_data = res.data.data; |
617 | if (r_data.promGoodsLists) { | 617 | if (r_data.promGoodsLists) { |
@@ -2482,7 +2482,7 @@ Page({ | @@ -2482,7 +2482,7 @@ Page({ | ||
2482 | //如果是优惠活动话,要看活动有没有过期 | 2482 | //如果是优惠活动话,要看活动有没有过期 |
2483 | if (i_arr[j].prom_type == 3) { | 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 | if (res.data.code == 0) { | 2486 | if (res.data.code == 0) { |
2487 | if (!res.data.data.promGoodsLists) { | 2487 | if (!res.data.data.promGoodsLists) { |
2488 | t.my_warnning(i_arr[j].goods_name + "优惠活动已经过期", 0, th); | 2488 | t.my_warnning(i_arr[j].goods_name + "优惠活动已经过期", 0, th); |
pages/cart/cart2/cart2.js
@@ -1802,7 +1802,7 @@ Page({ | @@ -1802,7 +1802,7 @@ Page({ | ||
1802 | var order_m = 0; | 1802 | var order_m = 0; |
1803 | //---判断是不是有订单优惠--- | 1803 | //---判断是不是有订单优惠--- |
1804 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | 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 | }).then(res => { | 1806 | }).then(res => { |
1807 | if (res.data.code == 0) { | 1807 | if (res.data.code == 0) { |
1808 | var ord_prom = res.data.data; | 1808 | var ord_prom = res.data.data; |
@@ -4052,7 +4052,7 @@ Page({ | @@ -4052,7 +4052,7 @@ Page({ | ||
4052 | if (this.data.is_b_now == 1) pick = this.data.bn_pick; | 4052 | if (this.data.is_b_now == 1) pick = this.data.bn_pick; |
4053 | //---获取订单优惠--- | 4053 | //---获取订单优惠--- |
4054 | getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | 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 | }).then(res => { | 4056 | }).then(res => { |
4057 | if (res.data.code == 0) { | 4057 | if (res.data.code == 0) { |
4058 | var data = res.data.data; | 4058 | var data = res.data.data; |
pages/goods/goodsInfo/goodsInfo.js
@@ -2138,7 +2138,7 @@ Page({ | @@ -2138,7 +2138,7 @@ Page({ | ||
2138 | callback(); | 2138 | callback(); |
2139 | } else { | 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 | if (res.data.code == 0) { | 2142 | if (res.data.code == 0) { |
2143 | var r_data = res.data.data; | 2143 | var r_data = res.data.data; |
2144 | th.data.prom_goods = r_data.promGoodsLists; | 2144 | th.data.prom_goods = r_data.promGoodsLists; |
@@ -6118,9 +6118,8 @@ Page({ | @@ -6118,9 +6118,8 @@ Page({ | ||
6118 | 6118 | ||
6119 | } else { | 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 | success: function (res) { | 6122 | success: function (res) { |
6123 | - | ||
6124 | if (res.data.code == 0 && res.data.data) { | 6123 | if (res.data.code == 0 && res.data.data) { |
6125 | var r_data = res.data.data; | 6124 | var r_data = res.data.data; |
6126 | var max = 0, min = 0; | 6125 | var max = 0, min = 0; |
pages/user/index/index.js
1 | var auth = require("../../../utils/auth.js"), | 1 | var auth = require("../../../utils/auth.js"), |
2 | - rq = require("../../../utils/request.js"); | 2 | + rq = require("../../../utils/request.js"); |
3 | var e = getApp(), | 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 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 8 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
9 | const { | 9 | const { |
10 | - barcode, | ||
11 | - qrcode | 10 | + barcode, |
11 | + qrcode | ||
12 | } = require('../../../utils/index.js'); | 12 | } = require('../../../utils/index.js'); |
13 | var ut = require("../../../utils/util.js"); | 13 | var ut = require("../../../utils/util.js"); |
14 | let self = null; | 14 | let self = null; |
15 | 15 | ||
16 | Page({ | 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 | getApp().promiseGet('/api/weshop/store/getTabSys/' + os.stoid, {}).then(res => { | 132 | getApp().promiseGet('/api/weshop/store/getTabSys/' + os.stoid, {}).then(res => { |
134 | - if(res.data.code == 0) { | 133 | + if (res.data.code == 0) { |
135 | th.setData({ | 134 | th.setData({ |
136 | enableMeiye: res.data.data.EnableMeiye, | 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: '../deposit/deposit', | ||
507 | + }) | ||
508 | + }, | ||
509 | + //--跳转到余额页面-- | ||
510 | + balance: function () { | ||
511 | + if (!this.data.userInfo) return false; | ||
512 | + wx.navigateTo({ | ||
513 | + url: '../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: '../coupons/coupons', | ||
523 | + }) | ||
524 | + }, | ||
525 | + //--跳转到积分-- | ||
526 | + integral: function () { | ||
527 | + if (!this.data.userInfo) return false; | ||
528 | + wx.navigateTo({ | ||
529 | + url: '../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 | getApp().com_call(this); | 683 | getApp().com_call(this); |
710 | }, | 684 | }, |
711 | - | 685 | + |
712 | // 获取客服热线 | 686 | // 获取客服热线 |
713 | getTel() { | 687 | getTel() { |
714 | return new Promise((resolve, reject) => { | 688 | return new Promise((resolve, reject) => { |
715 | var self = this; | 689 | var self = this; |
716 | var s = getApp(); | 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 | self.setData({ | 702 | self.setData({ |
729 | store_tel: rs.data.data.store_tel, | 703 | store_tel: rs.data.data.store_tel, |
730 | }); | 704 | }); |
731 | // s.confirmBox("客服热线:" + rs.data.data.store_tel); | 705 | // s.confirmBox("客服热线:" + rs.data.data.store_tel); |
732 | }; | 706 | }; |
733 | - | ||
734 | - } | ||
735 | - }) | ||
736 | - } else { | 707 | + |
708 | + } | ||
709 | + }) | ||
710 | + } else { | ||
737 | self.setData({ | 711 | self.setData({ |
738 | store_tel: t.store_tel, | 712 | store_tel: t.store_tel, |
739 | }); | 713 | }); |
740 | - // s.confirmBox("客服热线:" + t.store_tel); | ||
741 | - } | 714 | + // s.confirmBox("客服热线:" + t.store_tel); |
715 | + } | ||
742 | resolve(); | 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 | th.setData({ | 779 | th.setData({ |
806 | is_assistance: 0 | 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 | .then(() => { | 922 | .then(() => { |
949 | self.setData({ | 923 | self.setData({ |
950 | hiddenCS: false, | 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/order_detail/order_detail.js
@@ -464,7 +464,7 @@ Page({ | @@ -464,7 +464,7 @@ Page({ | ||
464 | } | 464 | } |
465 | }) | 465 | }) |
466 | if(is_g_prom){ | 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 | if (res.data.code == 0) { | 468 | if (res.data.code == 0) { |
469 | var r_data = res.data.data; | 469 | var r_data = res.data.data; |
470 | if (!r_data.collocationPromList && good.prom_type == 5) { | 470 | if (!r_data.collocationPromList && good.prom_type == 5) { |
@@ -585,7 +585,7 @@ Page({ | @@ -585,7 +585,7 @@ Page({ | ||
585 | //不是赠品的时候 | 585 | //不是赠品的时候 |
586 | if(!good.is_gift && good.prom_type!=3){ | 586 | if(!good.is_gift && good.prom_type!=3){ |
587 | var t_ok=1; | 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 | if(res.data.code==0){ | 589 | if(res.data.code==0){ |
590 | var r_data=res.data.data; | 590 | var r_data=res.data.data; |
591 | //-- 参加了全局的优惠活动 -- | 591 | //-- 参加了全局的优惠活动 -- |
@@ -1047,7 +1047,7 @@ Page({ | @@ -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 | if (res.data.code == 0 && res.data.data) { | 1051 | if (res.data.code == 0 && res.data.data) { |
1052 | var r_data = res.data.data; | 1052 | var r_data = res.data.data; |
1053 | if (r_data.ladderLists) { | 1053 | if (r_data.ladderLists) { |
@@ -1215,7 +1215,7 @@ Page({ | @@ -1215,7 +1215,7 @@ Page({ | ||
1215 | } | 1215 | } |
1216 | }) | 1216 | }) |
1217 | if(is_g_prom) { | 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 | if (res.data.code == 0) { | 1219 | if (res.data.code == 0) { |
1220 | var r_data = res.data.data; | 1220 | var r_data = res.data.data; |
1221 | if (r_data.promGoodsLists) { | 1221 | if (r_data.promGoodsLists) { |
pages/user/order_list/order_list.js
@@ -717,7 +717,7 @@ Page({ | @@ -717,7 +717,7 @@ Page({ | ||
717 | } | 717 | } |
718 | }) | 718 | }) |
719 | if(is_g_prom){ | 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 | if (res.data.code == 0) { | 721 | if (res.data.code == 0) { |
722 | var r_data = res.data.data; | 722 | var r_data = res.data.data; |
723 | if (!r_data.collocationPromList && good.prom_type == 5) { | 723 | if (!r_data.collocationPromList && good.prom_type == 5) { |
@@ -838,7 +838,7 @@ Page({ | @@ -838,7 +838,7 @@ Page({ | ||
838 | else { | 838 | else { |
839 | if (!good.is_gift && good.prom_type != 3) { | 839 | if (!good.is_gift && good.prom_type != 3) { |
840 | var t_ok = 1; | 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 | if (res.data.code == 0) { | 842 | if (res.data.code == 0) { |
843 | var r_data = res.data.data; | 843 | var r_data = res.data.data; |
844 | //-- 参加了全局的优惠活动 -- | 844 | //-- 参加了全局的优惠活动 -- |
@@ -1457,7 +1457,7 @@ Page({ | @@ -1457,7 +1457,7 @@ Page({ | ||
1457 | } | 1457 | } |
1458 | }) | 1458 | }) |
1459 | if(is_g_prom) { | 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 | if (res.data.code == 0) { | 1461 | if (res.data.code == 0) { |
1462 | var r_data = res.data.data; | 1462 | var r_data = res.data.data; |
1463 | if (r_data.promGoodsLists) { | 1463 | if (r_data.promGoodsLists) { |