Commit 5415949ce99e8fd1b6421df926d783e6575be081

Authored by 后端研发-苏泰源
2 parents 3ed9ffdf 0a9264d9

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

Showing 93 changed files with 2767 additions and 1495 deletions
@@ -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 });
app.json
@@ -31,16 +31,9 @@ @@ -31,16 +31,9 @@
31 "pages/team/team_ping/team_ping", 31 "pages/team/team_ping/team_ping",
32 "pages/cart/cart2_pt/cart2_pt", 32 "pages/cart/cart2_pt/cart2_pt",
33 "pages/cart/cart_wk/cart_wk", 33 "pages/cart/cart_wk/cart_wk",
34 - "pages/user/member/menber",  
35 - "pages/user/member/bring/bring",  
36 - "pages/user/member/bring/msg/msg",  
37 - "pages/user/member/account/account",  
38 - "pages/user/member/account_unable/account_unable",  
39 - "pages/user/member/cash_record/cash_record",  
40 - "pages/user/coupons/coupons",  
41 - "pages/user/integral/integral",  
42 - "pages/user/integral/query/index",  
43 - "pages/user/integral/msg/msg", 34 +
  35 +
  36 +
44 "pages/user/userqy/userqy", 37 "pages/user/userqy/userqy",
45 "pages/user/user_spsy/user_spsy", 38 "pages/user/user_spsy/user_spsy",
46 "pages/user/user_fw/user_fw", 39 "pages/user/user_fw/user_fw",
@@ -74,9 +67,7 @@ @@ -74,9 +67,7 @@
74 "pages/cart/cart2_inte/cart2_inte", 67 "pages/cart/cart2_inte/cart2_inte",
75 "pages/giftpack/festival/festival", 68 "pages/giftpack/festival/festival",
76 "pages/team/team_more/team_more", 69 "pages/team/team_more/team_more",
77 - "pages/user/deposit/deposit",  
78 - "pages/user/deposit/prepaid/msg/msg",  
79 - "pages/user/deposit/prepaid/prepaid", 70 +
80 "pages/distribution/distribution", 71 "pages/distribution/distribution",
81 "pages/template/index" 72 "pages/template/index"
82 ], 73 ],
@@ -189,7 +180,21 @@ @@ -189,7 +180,21 @@
189 "pages/AI-test-skin/select_photo/select_photo", 180 "pages/AI-test-skin/select_photo/select_photo",
190 "pages/AI-test-skin/fail_result/fail_result", 181 "pages/AI-test-skin/fail_result/fail_result",
191 "pages/AI-test-skin/success_result/success_result", 182 "pages/AI-test-skin/success_result/success_result",
192 - "pages/AI-test-skin/analyse/analyse" 183 + "pages/AI-test-skin/analyse/analyse",
  184 +
  185 + "pages/user/coupons/coupons",
  186 + "pages/user/integral/integral",
  187 + "pages/user/integral/query/index",
  188 + "pages/user/integral/msg/msg",
  189 + "pages/user/deposit/deposit",
  190 + "pages/user/deposit/prepaid/msg/msg",
  191 + "pages/user/deposit/prepaid/prepaid",
  192 + "pages/user/member/menber",
  193 + "pages/user/member/bring/bring",
  194 + "pages/user/member/bring/msg/msg",
  195 + "pages/user/member/account/account",
  196 + "pages/user/member/account_unable/account_unable",
  197 + "pages/user/member/cash_record/cash_record"
193 ] 198 ]
194 } 199 }
195 200
components/diy_goodsGroup/diy_goodsGroup.js
@@ -29,7 +29,7 @@ Component({ @@ -29,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
1 { 1 {
2 "component": true, 2 "component": true,
3 - "usingComponents": {} 3 + "usingComponents": {
  4 + "mp-loading": "weui-miniprogram/loading/loading"
  5 + }
4 } 6 }
5 \ No newline at end of file 7 \ No newline at end of file
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/checkin/checkin.wxml
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <view class="checkin-container"> 4 <view class="checkin-container">
5 <view class="rule-container flex"> 5 <view class="rule-container flex">
6 <view class="rule" bindtap="showRules">规则</view> 6 <view class="rule" bindtap="showRules">规则</view>
7 - <view class="points" bindtap="goto" data-url="/pages/user/integral/integral"> 7 + <view class="points" bindtap="goto" data-url="/packageD/pages/user/integral/integral">
8 <image class="coin" src="https://mshop-lib.yolipai.net/template/mobile/new/static/images/integral/coins.png"></image>我的积分 8 <image class="coin" src="https://mshop-lib.yolipai.net/template/mobile/new/static/images/integral/coins.png"></image>我的积分
9 </view> 9 </view>
10 </view> 10 </view>
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() { 10 + data: {
  11 + stoid: os.stoid,
  12 + url: os.url,
  13 + resourceUrl: os.resourceUrl,
  14 + iurl: os.imghost,
  15 + defaultAvatar: os.resourceUrl + "/static/images/user68.jpg",
  16 + dataList: null,
  17 + config2: null,
  18 + curpage: 1,
  19 + loading: 0,
  20 + get_item: null,
  21 + show_success: 0,
  22 + getcurday: null,
  23 + },
  24 + //------初始化加载----------
  25 + onLoad: function (t) {
  26 + var th = this;
  27 + getApp().getConfig2(function (conf) {
  28 + if (conf.couponset) conf.couponset = conf.couponset.replace(/\<img/g, '<img style="width:100%;height:auto;display:block"');
  29 + th.setData({ config2: conf });
  30 + })
  31 + },
  32 + //---展示---
  33 + onShow: function () {
34 34
35 - console.log("onShow:1");  
36 - this.data.curpage=1;  
37 - this.setData({dataList:null});  
38 - console.log("onShow:2");  
39 - this.get_quan_list();  
40 - //券的模拟数据  
41 - //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}];  
42 - //th.setData({dataList: data});  
43 - this.setData({getcurday:ut.gettimestamp()});  
44 - }, 35 + console.log("onShow:1");
  36 + this.data.curpage = 1;
  37 + this.setData({ dataList: null });
  38 + console.log("onShow:2");
  39 + this.get_quan_list();
  40 + //券的模拟数据
  41 + //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}];
  42 + //th.setData({dataList: data});
  43 + this.setData({ getcurday: ut.gettimestamp() });
  44 + },
45 45
46 - onHide: function() {  
47 -  
48 - }, 46 + onHide: function () {
49 47
50 - //--券的列表页面的函数--  
51 - get_quan_list:function(){  
52 - console.log("onShow:3");  
53 - var th=this;  
54 - if(th.data.loading) return false;  
55 - th.data.loading=1;  
56 - var user_id=getApp().globalData.user_id;  
57 - console.log("onShow:4");  
58 - var data={store_id:os.stoid,type:1,pageSize:10,page:th.data.curpage,user_id:user_id,is_share:0};  
59 - console.log(data);  
60 - getApp().request.get("/api/weshop/prom/coupon/pageCouponList", {  
61 - data:data,  
62 - success:function (res){  
63 - console.log("onShow:5");  
64 - console.log(res);  
65 - th.data.loading=0;  
66 - if(res.data.code==0){  
67 - if(!th.data.dataList) th.data.dataList=new Array();  
68 - th.data.dataList=th.data.dataList.concat(res.data.data.pageData);  
69 - th.data.curpage++;  
70 - th.setData({dataList:th.data.dataList});  
71 - }  
72 - },  
73 - fail:function (e){  
74 - console.log("onShow:6");  
75 - console.log(e);  
76 - }  
77 - });  
78 - }, 48 + },
79 49
80 - //---加载更多是靠这个函数----  
81 - onReachBottom: function() {  
82 - this.get_quan_list();  
83 - }, 50 + //--券的列表页面的函数--
  51 + get_quan_list: function () {
  52 + console.log("onShow:3");
  53 + var th = this;
  54 + if (th.data.loading) return false;
  55 + th.data.loading = 1;
  56 + var user_id = getApp().globalData.user_id;
  57 + console.log("onShow:4");
  58 + var data = { store_id: os.stoid, type: 1, pageSize: 10, page: th.data.curpage, user_id: user_id, is_share: 0 };
  59 + console.log(data);
  60 + getApp().request.get("/api/weshop/prom/coupon/pageCouponList", {
  61 + data: data,
  62 + success: function (res) {
  63 + console.log("onShow:5");
  64 + console.log(res);
  65 + th.data.loading = 0;
  66 + if (res.data.code == 0) {
  67 + if (!th.data.dataList) th.data.dataList = new Array();
  68 + th.data.dataList = th.data.dataList.concat(res.data.data.pageData);
  69 + th.data.curpage++;
  70 + th.setData({ dataList: th.data.dataList });
  71 + }
  72 + },
  73 + fail: function (e) {
  74 + console.log("onShow:6");
  75 + console.log(e);
  76 + }
  77 + });
  78 + },
84 79
  80 + //---加载更多是靠这个函数----
  81 + onReachBottom: function () {
  82 + this.get_quan_list();
  83 + },
85 84
86 - //--滚动到顶部--  
87 - doScrollTop: function() {  
88 - wx.pageScrollTo({ scrollTop: 0 });  
89 - },  
90 85
91 - //-----领取券-----  
92 - get_quan: function(e) {  
93 - var cid = e.currentTarget.dataset.cid;  
94 - var index = e.currentTarget.dataset.ind;  
95 - var item = this.data.dataList[index]; 86 + //--滚动到顶部--
  87 + doScrollTop: function () {
  88 + wx.pageScrollTo({ scrollTop: 0 });
  89 + },
96 90
97 - //--先判断会员状态--  
98 - var user_info = getApp().globalData.userInfo;  
99 - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {  
100 - wx.navigateTo({  
101 - url: '/pages/togoin/togoin',  
102 - })  
103 - return false;  
104 - } 91 + //-----领取券-----
  92 + get_quan: function (e) {
  93 + var cid = e.currentTarget.dataset.cid;
  94 + var index = e.currentTarget.dataset.ind;
  95 + var item = this.data.dataList[index];
  96 + var good = new Array(); //单品且是免费领取专门使用
  97 + //--先判断会员状态--
  98 + var user_info = getApp().globalData.userInfo;
  99 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  100 + wx.navigateTo({
  101 + url: '/pages/togoin/togoin',
  102 + })
  103 + return false;
  104 + }
105 105
106 - //如果券还在领取中,不能再点  
107 - if (item.linging == 1) {  
108 - getApp().my_warnning('领取中..', 0, this);  
109 - return false;  
110 - }  
111 -  
112 - //如果领取的次数到了  
113 - if (item.everyone_num > 0 && item.lqnum >= item.everyone_num) {  
114 - getApp().my_warnning('领取失败,您已领完该券', 0, this);  
115 - return false;  
116 - }  
117 - var lq_num = item.lqnum;  
118 - var pdata = {  
119 - 'uid': oo.user_id,  
120 - 'cid': cid,  
121 - 'store_id': os.stoid,  
122 - 'type': 5  
123 - };  
124 - //-- 导购ID --  
125 - if(getApp().globalData.guide_id){  
126 - pdata.guide_id=getApp().globalData.guide_id;  
127 - }  
128 - var app = getApp(),  
129 - th = this;  
130 - app.request.post("/api/weshop/couponList/saveCouponList", {  
131 - data: pdata,  
132 - success: function(res) {  
133 - if (res.data.code == 0) {  
134 - var text = "dataList[" + index + "].is_get";  
135 - var text2 = "dataList[" + index + "].linging";  
136 - var text3 = "get_item";  
137 - var obj = {};obj[text] = 1; obj[text2] = 0;obj[text3] = item;obj['show_success']=1;  
138 - th.setData(obj);  
139 - } else {  
140 - app.confirmBox(res.data.msg);  
141 - var text2 = "dataList[" + index + "].linging";  
142 - th.setData({[text2]:0});  
143 - }  
144 - }  
145 - })  
146 - },  
147 - close_show:function () {  
148 - this.setData({show_success:0,get_item:null})  
149 - },  
150 - go_quan:function () {  
151 - getApp().goto("/pages/user/coupons/coupons");  
152 - },  
153 - go_detail:function (e) {  
154 - var index=e.currentTarget.dataset.ind;  
155 - var item=this.data.dataList[index];  
156 - getApp().goto("/packageA/pages/quan_pro/quan_pro?id="+item.id);  
157 - } 106 + //如果券还在领取中,不能再点
  107 + if (item.linging == 1) {
  108 + getApp().my_warnning('领取中..', 0, this);
  109 + return false;
  110 + }
158 111
  112 + //如果领取的次数到了
  113 + if (item.everyone_num > 0 && item.lqnum >= item.everyone_num) {
  114 + getApp().my_warnning('领取失败,您已领完该券', 0, this);
  115 + return false;
  116 + }
  117 + var lq_num = item.lqnum;
  118 + var pdata = {
  119 + 'uid': oo.user_id,
  120 + 'cid': cid,
  121 + 'store_id': os.stoid,
  122 + 'type': 5
  123 + };
  124 + if (item.useobjecttype == 20 && item.type == 1) {
  125 + getApp().request.get('/api/weshop/goods/list', {
  126 + data: {
  127 + store_id: os.stoid,
  128 + erpwareid: item.useobjectid,
  129 + },
  130 + success(res) {
  131 + if (ut.ajax_ok2(res)) {
  132 + good = res.data.data;
  133 + }
  134 + }
  135 + })
  136 + }
  137 + //-- 导购ID --
  138 + if (getApp().globalData.guide_id) {
  139 + pdata.guide_id = getApp().globalData.guide_id;
  140 + }
  141 + var app = getApp(),
  142 + th = this;
  143 + app.request.post("/api/weshop/couponList/saveCouponList", {
  144 + data: pdata,
  145 + success: function (res) {
  146 + if (res.data.code == 0) {
  147 + var text = "dataList[" + index + "].is_get";
  148 + var text2 = "dataList[" + index + "].linging";
  149 + var text3 = "get_item";
  150 + var obj = {}; obj[text] = 1; obj[text2] = 0; obj[text3] = item;
  151 + th.setData(obj);
  152 + if (good.length > 0) {
  153 + wx.showToast({
  154 + title: '领取成功',
  155 + success() {
  156 + let item = good[0];
  157 + let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}`
  158 + setTimeout(()=>{
  159 + getApp().goto(url)
  160 + },500)
  161 + }
  162 + })
159 163
  164 + } else {
  165 + th.setData({
  166 + show_success: 1,
  167 + })
  168 + }
  169 + } else {
  170 + app.confirmBox(res.data.msg);
  171 + var text2 = "dataList[" + index + "].linging";
  172 + th.setData({ [text2]: 0 });
  173 + }
  174 + }
  175 + })
  176 + },
  177 + close_show: function () {
  178 + this.setData({ show_success: 0, get_item: null })
  179 + },
  180 + go_quan: function () {
  181 + getApp().goto("/pages/user/coupons/coupons");
  182 + },
  183 + go_detail: function (e) {
  184 + var index = e.currentTarget.dataset.ind;
  185 + var item = this.data.dataList[index];
  186 + getApp().goto("/packageA/pages/quan_pro/quan_pro?id=" + item.id);
  187 + }
160 }); 188 });
packageA/pages/quan_pro/quan_pro.js
@@ -132,7 +132,7 @@ Page({ @@ -132,7 +132,7 @@ Page({
132 this.setData({ 132 this.setData({
133 show_success:0 133 show_success:0
134 }) 134 })
135 - getApp().goto("/pages/user/coupons/coupons"); 135 + getApp().goto("/packageD/pages/user/coupons/coupons");
136 }, 136 },
137 137
138 close_show(){ 138 close_show(){
packageB/pages/luckactivity/luckinfo/luckinfo.js
@@ -1279,7 +1279,7 @@ Page({ @@ -1279,7 +1279,7 @@ Page({
1279 }; 1279 };
1280 switch(type) { 1280 switch(type) {
1281 case 1: { 1281 case 1: {
1282 - url = '/pages/user/integral/integral'; 1282 + url = '/packageD/pages/user/integral/integral';
1283 break; 1283 break;
1284 }; 1284 };
1285 case 2: { 1285 case 2: {
@@ -1287,7 +1287,7 @@ Page({ @@ -1287,7 +1287,7 @@ Page({
1287 break; 1287 break;
1288 }; 1288 };
1289 case 3: { 1289 case 3: {
1290 - url = '/pages/user/coupons/coupons'; 1290 + url = '/packageD/pages/user/coupons/coupons';
1291 break; 1291 break;
1292 }; 1292 };
1293 case 4: { 1293 case 4: {
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
@@ -6,7 +6,7 @@ page { @@ -6,7 +6,7 @@ page {
6 } 6 }
7 7
8 .tab_scroll { 8 .tab_scroll {
9 - position: fixed; 9 + position: sticky;
10 top: 0; 10 top: 0;
11 z-index: 99; 11 z-index: 99;
12 display: flex; 12 display: flex;
pages/user/coupons/coupons.js renamed to packageD/pages/user/coupons/coupons.js
@@ -2,14 +2,14 @@ var t = getApp(), @@ -2,14 +2,14 @@ var t = getApp(),
2 a = t.request, 2 a = t.request,
3 o = t.globalData.setting, 3 o = t.globalData.setting,
4 os = o, 4 os = o,
5 - i = require("../../../utils/util.js"), 5 + i = require("../../../../utils/util.js"),
6 ut = i, 6 ut = i,
7 - s = require("../../../utils/common.js");  
8 -var regeneratorRuntime = require('../../../utils/runtime.js'); 7 + s = require("../../../../utils/common.js");
  8 +var regeneratorRuntime = require('../../../../utils/runtime.js');
9 const { 9 const {
10 barcode, 10 barcode,
11 qrcode 11 qrcode
12 -} = require('../../../utils/index.js'); 12 +} = require('../../../../utils/index.js');
13 let _this = null; 13 let _this = null;
14 14
15 Page({ 15 Page({
pages/user/coupons/coupons.json renamed to packageD/pages/user/coupons/coupons.json
pages/user/coupons/coupons.wxml renamed to packageD/pages/user/coupons/coupons.wxml
1 <wxs module="filter" src="filter.wxs"></wxs> 1 <wxs module="filter" src="filter.wxs"></wxs>
2 -<wxs module="time" src="../../../utils/filter.wxs"></wxs> 2 +<wxs module="time" src="../../../../utils/filter.wxs"></wxs>
3 3
4 <view> 4 <view>
5 5
@@ -57,8 +57,8 @@ @@ -57,8 +57,8 @@
57 </view> 57 </view>
58 </view> 58 </view>
59 <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}"> 59 <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}">
60 - <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:if="{{detail.Remark1!=''}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}}</view>  
61 - <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:else><text style="margin-right: 15rpx">使用说明:</text> {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}}</view> 60 + <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:if="{{detail.Remark1!=''}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}</view>
  61 + <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:else><text style="margin-right: 15rpx">使用说明:</text> {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}</view>
62 </view> 62 </view>
63 </block> 63 </block>
64 </view> 64 </view>
pages/user/coupons/coupons.wxss renamed to packageD/pages/user/coupons/coupons.wxss
pages/user/coupons/filter.wxs renamed to packageD/pages/user/coupons/filter.wxs
pages/user/deposit/deposit.js renamed to packageD/pages/user/deposit/deposit.js
@@ -2,10 +2,10 @@ var t = getApp(), @@ -2,10 +2,10 @@ var t = getApp(),
2 a = t.request, 2 a = t.request,
3 o = t.globalData.setting, 3 o = t.globalData.setting,
4 os = o, 4 os = o,
5 - i = require("../../../utils/util.js"), 5 + i = require("../../../../utils/util.js"),
6 ut = i, 6 ut = i,
7 - s = require("../../../utils/common.js");  
8 -var regeneratorRuntime = require('../../../utils/runtime.js'); 7 + s = require("../../../../utils/common.js");
  8 +var regeneratorRuntime = require('../../../../utils/runtime.js');
9 Page({ 9 Page({
10 data:{ 10 data:{
11 yucun_money:0, 11 yucun_money:0,
pages/user/deposit/deposit.json renamed to packageD/pages/user/deposit/deposit.json
pages/user/deposit/deposit.wxml renamed to packageD/pages/user/deposit/deposit.wxml
pages/user/deposit/deposit.wxss renamed to packageD/pages/user/deposit/deposit.wxss
pages/user/deposit/prepaid/fil.wxs renamed to packageD/pages/user/deposit/prepaid/fil.wxs
pages/user/deposit/prepaid/msg/msg.js renamed to packageD/pages/user/deposit/prepaid/msg/msg.js
pages/user/deposit/prepaid/msg/msg.json renamed to packageD/pages/user/deposit/prepaid/msg/msg.json
pages/user/deposit/prepaid/msg/msg.wxml renamed to packageD/pages/user/deposit/prepaid/msg/msg.wxml
pages/user/deposit/prepaid/msg/msg.wxss renamed to packageD/pages/user/deposit/prepaid/msg/msg.wxss
pages/user/deposit/prepaid/prepaid.js renamed to packageD/pages/user/deposit/prepaid/prepaid.js
@@ -2,10 +2,10 @@ var t = getApp(), @@ -2,10 +2,10 @@ var t = getApp(),
2 a = t.request, 2 a = t.request,
3 o = t.globalData.setting, 3 o = t.globalData.setting,
4 os = o, 4 os = o,
5 - i = require("../../../../utils/util.js"), 5 + i = require("../../../../../utils/util.js"),
6 ut = i, 6 ut = i,
7 - s = require("../../../../utils/common.js");  
8 -var regeneratorRuntime = require('../../../../utils/runtime.js'); 7 + s = require("../../../../../utils/common.js");
  8 +var regeneratorRuntime = require('../../../../../utils/runtime.js');
9 Page({ 9 Page({
10 data: { 10 data: {
11 iurl: o.imghost, 11 iurl: o.imghost,
pages/user/deposit/prepaid/prepaid.json renamed to packageD/pages/user/deposit/prepaid/prepaid.json
pages/user/deposit/prepaid/prepaid.wxml renamed to packageD/pages/user/deposit/prepaid/prepaid.wxml
pages/user/deposit/prepaid/prepaid.wxss renamed to packageD/pages/user/deposit/prepaid/prepaid.wxss
pages/user/integral/filter.wxs renamed to packageD/pages/user/integral/filter.wxs
pages/user/integral/integral.js renamed to packageD/pages/user/integral/integral.js
@@ -3,9 +3,9 @@ var e = function (e) { @@ -3,9 +3,9 @@ var e = function (e) {
3 return e && e.__esModule ? e : { 3 return e && e.__esModule ? e : {
4 default: e 4 default: e
5 }; 5 };
6 -}(require("../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o,  
7 - i = require("../../../utils/util.js"), ut = i, b = require("../../../app.js"), app = b, s = require("../../../utils/common.js"), n = new e.default();  
8 -var regeneratorRuntime = require('../../../utils/runtime.js'); 6 +}(require("../../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o,
  7 + i = require("../../../../utils/util.js"), ut = i, b = require("../../../../app.js"), app = b, s = require("../../../../utils/common.js"), n = new e.default();
  8 +var regeneratorRuntime = require('../../../../utils/runtime.js');
9 Page({ 9 Page({
10 10
11 /** 11 /**
pages/user/integral/integral.json renamed to packageD/pages/user/integral/integral.json
pages/user/integral/integral.wxml renamed to packageD/pages/user/integral/integral.wxml
pages/user/integral/integral.wxss renamed to packageD/pages/user/integral/integral.wxss
pages/user/integral/msg/msg.js renamed to packageD/pages/user/integral/msg/msg.js
pages/user/integral/msg/msg.json renamed to packageD/pages/user/integral/msg/msg.json
pages/user/integral/msg/msg.wxml renamed to packageD/pages/user/integral/msg/msg.wxml
pages/user/integral/msg/msg.wxss renamed to packageD/pages/user/integral/msg/msg.wxss
pages/user/integral/query/index.js renamed to packageD/pages/user/integral/query/index.js
@@ -2,10 +2,10 @@ var t = getApp(), @@ -2,10 +2,10 @@ var t = getApp(),
2 a = t.request, 2 a = t.request,
3 o = t.globalData.setting, 3 o = t.globalData.setting,
4 os = o, 4 os = o,
5 - i = require("../../../../utils/util.js"), 5 + i = require("../../../../../utils/util.js"),
6 ut = i, 6 ut = i,
7 - s = require("../../../../utils/common.js");  
8 -var regeneratorRuntime = require('../../../../utils/runtime.js'); 7 + s = require("../../../../../utils/common.js");
  8 +var regeneratorRuntime = require('../../../../../utils/runtime.js');
9 Page({ 9 Page({
10 data: { 10 data: {
11 11
pages/user/integral/query/index.json renamed to packageD/pages/user/integral/query/index.json
pages/user/integral/query/index.wxml renamed to packageD/pages/user/integral/query/index.wxml
pages/user/integral/query/index.wxss renamed to packageD/pages/user/integral/query/index.wxss
pages/user/member/account/account.js renamed to packageD/pages/user/member/account/account.js
@@ -2,10 +2,10 @@ var t = getApp(), @@ -2,10 +2,10 @@ var t = getApp(),
2 a = t.request, 2 a = t.request,
3 o = t.globalData.setting, 3 o = t.globalData.setting,
4 os = o, 4 os = o,
5 - i = require("../../../../utils/util.js"), 5 + i = require("../../../../../utils/util.js"),
6 ut = i, 6 ut = i,
7 - s = require("../../../../utils/common.js");  
8 -var regeneratorRuntime = require('../../../../utils/runtime.js'); 7 + s = require("../../../../../utils/common.js");
  8 +var regeneratorRuntime = require('../../../../../utils/runtime.js');
9 Page({ 9 Page({
10 data: { 10 data: {
11 details:[],//数据 11 details:[],//数据
pages/user/member/account/account.json renamed to packageD/pages/user/member/account/account.json
pages/user/member/account/account.wxml renamed to packageD/pages/user/member/account/account.wxml
pages/user/member/account/account.wxss renamed to packageD/pages/user/member/account/account.wxss
pages/user/member/account/index.wxs renamed to packageD/pages/user/member/account/index.wxs
pages/user/member/account_unable/account_unable.js renamed to packageD/pages/user/member/account_unable/account_unable.js
@@ -2,10 +2,10 @@ var t = getApp(), @@ -2,10 +2,10 @@ var t = getApp(),
2 a = t.request, 2 a = t.request,
3 o = t.globalData.setting, 3 o = t.globalData.setting,
4 os = o, 4 os = o,
5 - i = require("../../../../utils/util.js"), 5 + i = require("../../../../../utils/util.js"),
6 ut = i, 6 ut = i,
7 - s = require("../../../../utils/common.js");  
8 -var regeneratorRuntime = require('../../../../utils/runtime.js'); 7 + s = require("../../../../../utils/common.js");
  8 +var regeneratorRuntime = require('../../../../../utils/runtime.js');
9 Page({ 9 Page({
10 data: { 10 data: {
11 details: [],//数据 11 details: [],//数据
pages/user/member/account_unable/account_unable.json renamed to packageD/pages/user/member/account_unable/account_unable.json
pages/user/member/account_unable/account_unable.wxml renamed to packageD/pages/user/member/account_unable/account_unable.wxml
pages/user/member/account_unable/account_unable.wxss renamed to packageD/pages/user/member/account_unable/account_unable.wxss
pages/user/member/account_unable/index.wxs renamed to packageD/pages/user/member/account_unable/index.wxs
pages/user/member/bring/bring.js renamed to packageD/pages/user/member/bring/bring.js
@@ -2,10 +2,10 @@ var t = getApp(), @@ -2,10 +2,10 @@ var t = getApp(),
2 a = t.request, 2 a = t.request,
3 o = t.globalData.setting, 3 o = t.globalData.setting,
4 os = o, 4 os = o,
5 - i = require("../../../../utils/util.js"), 5 + i = require("../../../../../utils/util.js"),
6 ut = i, 6 ut = i,
7 - s = require("../../../../utils/common.js");  
8 -var regeneratorRuntime = require('../../../../utils/runtime.js'); 7 + s = require("../../../../../utils/common.js");
  8 +var regeneratorRuntime = require('../../../../../utils/runtime.js');
9 var oo = t.globalData.setting; 9 var oo = t.globalData.setting;
10 Page({ 10 Page({
11 /** 11 /**
pages/user/member/bring/bring.json renamed to packageD/pages/user/member/bring/bring.json
pages/user/member/bring/bring.wxml renamed to packageD/pages/user/member/bring/bring.wxml
pages/user/member/bring/bring.wxss renamed to packageD/pages/user/member/bring/bring.wxss
pages/user/member/bring/msg/msg.js renamed to packageD/pages/user/member/bring/msg/msg.js
pages/user/member/bring/msg/msg.json renamed to packageD/pages/user/member/bring/msg/msg.json
pages/user/member/bring/msg/msg.wxml renamed to packageD/pages/user/member/bring/msg/msg.wxml
pages/user/member/bring/msg/msg.wxss renamed to packageD/pages/user/member/bring/msg/msg.wxss
pages/user/member/cash_record/cash_record.js renamed to packageD/pages/user/member/cash_record/cash_record.js
@@ -2,10 +2,10 @@ var t = getApp(), @@ -2,10 +2,10 @@ var t = getApp(),
2 a = t.request, 2 a = t.request,
3 o = t.globalData.setting, 3 o = t.globalData.setting,
4 os = o, 4 os = o,
5 - i = require("../../../../utils/util.js"), 5 + i = require("../../../../../utils/util.js"),
6 ut = i, 6 ut = i,
7 - s = require("../../../../utils/common.js");  
8 -var regeneratorRuntime = require('../../../../utils/runtime.js'); 7 + s = require("../../../../../utils/common.js");
  8 +var regeneratorRuntime = require('../../../../../utils/runtime.js');
9 Page({ 9 Page({
10 data: { 10 data: {
11 parameter: false,//控制有没有数据的时候 11 parameter: false,//控制有没有数据的时候
pages/user/member/cash_record/cash_record.json renamed to packageD/pages/user/member/cash_record/cash_record.json
pages/user/member/cash_record/cash_record.wxml renamed to packageD/pages/user/member/cash_record/cash_record.wxml
pages/user/member/cash_record/cash_record.wxss renamed to packageD/pages/user/member/cash_record/cash_record.wxss
pages/user/member/cash_record/index.wxs renamed to packageD/pages/user/member/cash_record/index.wxs
pages/user/member/filter.wxs renamed to packageD/pages/user/member/filter.wxs
pages/user/member/menber.js renamed to packageD/pages/user/member/menber.js
@@ -2,9 +2,9 @@ var e = function (e) { @@ -2,9 +2,9 @@ var e = function (e) {
2 return e && e.__esModule ? e : { 2 return e && e.__esModule ? e : {
3 default: e 3 default: e
4 }; 4 };
5 -}(require("../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o,  
6 - i = require("../../../utils/util.js"), ut = i, s = require("../../../utils/common.js"), n = new e.default();  
7 -var regeneratorRuntime = require('../../../utils/runtime.js'); 5 +}(require("../../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o,
  6 + i = require("../../../../utils/util.js"), ut = i, s = require("../../../../utils/common.js"), n = new e.default();
  7 +var regeneratorRuntime = require('../../../../utils/runtime.js');
8 Page({ 8 Page({
9 /** 9 /**
10 * 页面的初始数据 10 * 页面的初始数据
pages/user/member/menber.json renamed to packageD/pages/user/member/menber.json
pages/user/member/menber.wxml renamed to packageD/pages/user/member/menber.wxml
pages/user/member/menber.wxss renamed to packageD/pages/user/member/menber.wxss
pages/cart/cart/cart.js
@@ -402,7 +402,7 @@ Page({ @@ -402,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/distribution/distribution.wxml
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <view> 14 <view>
15 <view class="flex ai-center jc_sb pd2622 bdb arrow-r" bindtap="goto"> 15 <view class="flex ai-center jc_sb pd2622 bdb arrow-r" bindtap="goto">
16 <view><text class="iconfont icon-jine pdr10 ctb"></text>可提现金额</view> 16 <view><text class="iconfont icon-jine pdr10 ctb"></text>可提现金额</view>
17 - <view class="ctb money" data-url="/pages/user/member/menber">{{filter.show_default(data.liudong_money)}}</view> 17 + <view class="ctb money" data-url="/packageD/pages/user/member/menber">{{filter.show_default(data.liudong_money)}}</view>
18 </view> 18 </view>
19 19
20 <view class="flex jc_sa t-c"> 20 <view class="flex jc_sa t-c">
pages/giftpack/buygiftpack/giftpackbuy.js
1 var i = require("../../../utils/util.js"); 1 var i = require("../../../utils/util.js");
  2 +var com = require("../public/buy_com.js");
2 var e = getApp(), 3 var e = getApp(),
3 a = e.globalData.setting, 4 a = e.globalData.setting,
4 os = a, 5 os = a,
@@ -27,6 +28,44 @@ Page({ @@ -27,6 +28,44 @@ Page({
27 total: 0, //总数量 28 total: 0, //总数量
28 ad_data: null, 29 ad_data: null,
29 first_leader: e.globalData.first_leader || 0, // 推荐人ID 30 first_leader: e.globalData.first_leader || 0, // 推荐人ID
  31 +
  32 + //门店相关
  33 + ismend: 0,
  34 + is_sec_mend: 0,
  35 + sto_sele_name: "", //选中的门店名称
  36 + sto_sele_id: "", //选中的门店id
  37 + sto_sele_distr: "", //选择的门店的配送方式
  38 + is_show_sto_cat: 1, //是否显示门店分类
  39 + only_pk: null,
  40 + all_sto: null,
  41 + sec_sto: null, //选择了的门店分类
  42 + pickpu_list: null, //读出的所有门店list
  43 + def_pickpu_list: null, //一开始5个门店list
  44 + sec_pick_index: 0, //第二级门店选择ID
  45 + fir_pick_index: 0, //第一级门店选择ID
  46 + all_pick_list: null,//所有的门店先记录起来
  47 +
  48 + select_store: 0, //选择更多
  49 + index: 1,
  50 + more_store: 0, //选择门店
  51 + sort_store: 0, //门店分类
  52 + choice_sort_store: 0, //选择分类门店
  53 + new_user: 0, //新用户
  54 +
  55 + def_pick_store: null, // 默认的门店
  56 + fir_def_store: null, //客户默认的门店的
  57 + lat: null, //维度
  58 + lon: null, //经度
  59 +
  60 + is_get_local_ok: 0, //获取坐标是否完成
  61 + region_name: "门店分类", //区域的名字
  62 + is_gps: 1,
  63 + open_ind_store: 0, //哪里打开的门店列表的控制属性
  64 + default_store: {}, //创建添加默认门店地址的对象
  65 +
  66 + store:0,
  67 + openSpecModal:0
  68 +
30 }, 69 },
31 onLoad: function (options) { 70 onLoad: function (options) {
32 this.setData({ 71 this.setData({
@@ -80,6 +119,7 @@ Page({ @@ -80,6 +119,7 @@ Page({
80 }, 119 },
81 onShow: function () { 120 onShow: function () {
82 getApp().check_can_share(); 121 getApp().check_can_share();
  122 + var th=this;
83 //--先判断会员状态-- 123 //--先判断会员状态--
84 getApp().is_Single_page(this, function () { 124 getApp().is_Single_page(this, function () {
85 var user_info = getApp().globalData.userInfo; 125 var user_info = getApp().globalData.userInfo;
@@ -87,170 +127,112 @@ Page({ @@ -87,170 +127,112 @@ Page({
87 getApp().goto('/pages/togoin/togoin'); 127 getApp().goto('/pages/togoin/togoin');
88 return false; 128 return false;
89 } 129 }
  130 + com.wait_for_store_config(th);
  131 + com.set_user_mo_store(th,os);
  132 +
90 }) 133 })
91 this.init(); 134 this.init();
92 }, 135 },
93 136
94 //购买礼包 137 //购买礼包
95 GetBuyPrice: function (e) { 138 GetBuyPrice: function (e) {
96 - var that = this.data;  
97 - var th = this;  
98 - var id = e.currentTarget.dataset.id; //活动id  
99 - var my_confirm = th.selectComponent("#my_confirm"); //组件的id  
100 - var order_sn = e.currentTarget.dataset.order_sn; //订单号  
101 - var money = e.currentTarget.dataset.money; //支付金额  
102 - my_confirm.open(  
103 - "是否确定购买该礼包",  
104 - "取消",  
105 - "确定",  
106 - function () {  
107 - my_confirm.open_cancel(0);  
108 - },  
109 - function () {  
110 - my_confirm.open_cancel(0);  
111 - var json = {  
112 - "actId": '', //活动Id  
113 - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销  
114 - "buyType": '2', //1=积分兑换 2=余额购买  
115 - "giftBagId": id, //礼包Id  
116 - "storeId": that.getStorageID, //商家Id  
117 - "userId": that.getUserID, //用户ID  
118 - "buyFrom": 2,  
119 - "first_leader": that.first_leader,  
120 - };  
121 139
122 - //-- 分享导购要记录 --  
123 - if (getApp().globalData.guide_id) {  
124 - json.guide_id = getApp().globalData.guide_id; 140 + var th = this;
  141 + var index = e.currentTarget.dataset.index; //活动id
  142 + var sele_g=th.data.wareCard[index];
  143 + th.setData({sele_g:sele_g,buyType:2,})
  144 + if(sele_g.is_pickup){
  145 + if(sele_g.pickup_list && th.data.def_pick_store){
  146 + com.check_def_pk(th);
125 } 147 }
126 -  
127 - var data = JSON.stringify(json);  
128 - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";  
129 - getApp().request.json_post(url, json,  
130 - function (res) {  
131 - if (res.data.code == 0 && res.data.data) {  
132 - var order_sn = res.data.data.orderSn;  
133 - res = res.data.data.result;  
134 - if (!res) return false;  
135 - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;  
136 - wx.requestPayment({  
137 - timeStamp: String(res.timeStamp),  
138 - nonceStr: res.nonceStr,  
139 - package: res.packageValue,  
140 - signType: res.signType,  
141 - paySign: res.paySign,  
142 - success: function (res) {  
143 - getApp().goto(url);  
144 - },  
145 - fail: function (res) {  
146 - getApp().my_warnning("取消支付", 0, th);  
147 - }  
148 - });  
149 - } else {  
150 - getApp().my_warnning(res.data.msg, 0, th); 148 + com.get_sto(th,os)
  149 + th.setData({
  150 + openSpecModal:1
  151 + })
  152 + }else{
  153 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  154 + my_confirm.open(
  155 + "是否确定购买该礼包",
  156 + "取消",
  157 + "确定",
  158 + function () {
  159 + my_confirm.open_cancel(0);
  160 + },
  161 + function () {
  162 + my_confirm.open_cancel(0);
  163 + com.buy_libao(th)
151 } 164 }
152 - },  
153 - function (res) {  
154 -  
155 - }  
156 165
157 ) 166 )
  167 + }
158 168
159 169
160 - }  
161 170
162 - )  
163 171
164 172
165 }, 173 },
166 // 积分兑换 174 // 积分兑换
167 GetBuyIntegral: function (e) { 175 GetBuyIntegral: function (e) {
168 - var that = this.data;  
169 - var th = this;  
170 - var id = e.currentTarget.dataset.id; //活动id  
171 - var my_confirm = th.selectComponent("#my_confirm"); //组件的id  
172 -  
173 - my_confirm.open(  
174 - "是否确定兑换该礼包",  
175 - "取消",  
176 - "确定",  
177 - function () {  
178 - my_confirm.open_cancel(0);  
179 - },  
180 - function () {  
181 - my_confirm.open_cancel(0);  
182 - var json = {  
183 - "actId": '', //活动Id  
184 - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销  
185 - "buyType": '1', //1=积分兑换 2=余额购买 3=免费领取  
186 - "giftBagId": id, //礼包Id  
187 - "storeId": that.getStorageID, //商家Id  
188 - "userId": that.getUserID, //用户ID  
189 - "buyFrom": 2,  
190 - "first_leader": that.first_leader  
191 - };  
192 -  
193 - //-- 分享导购要记录 --  
194 - if (getApp().globalData.guide_id) {  
195 - json.guide_id = getApp().globalData.guide_id;  
196 - }  
197 - console.log(json, 'json');  
198 - var data = JSON.stringify(json);  
199 - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";  
200 - getApp().request.json_post(url, json,  
201 - function (res) {  
202 - if (res.data.code == 0) {  
203 - getApp().my_warnning("兑换成功!", 1, th);  
204 - } else {  
205 - getApp().my_warnning(res.data.msg, 0, th);  
206 - }  
207 - },  
208 - function (res) { })  
209 -  
210 - }) 176 + var th = this;
  177 + var index = e.currentTarget.dataset.index; //活动id
  178 + var sele_g=th.data.wareCard[index];
  179 + th.setData({sele_g:sele_g, buyType:1,})
  180 + if(sele_g.is_pickup){
  181 + if(sele_g.pickup_list && th.data.def_pick_store){
  182 + com.check_def_pk(th);
  183 + }
  184 + com.get_sto(th,os)
  185 + th.setData({
  186 + openSpecModal:1
  187 + })
  188 + }else {
  189 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  190 + my_confirm.open(
  191 + "是否确定兑换该礼包",
  192 + "取消",
  193 + "确定",
  194 + function () {
  195 + my_confirm.open_cancel(0);
  196 + },
  197 + function () {
  198 + my_confirm.open_cancel(0);
  199 + com.buy_libao(th)
  200 + })
  201 + }
211 202
212 }, 203 },
213 //免费领取 204 //免费领取
214 GetFree: function (e) { 205 GetFree: function (e) {
215 - var that = this.data;  
216 - var th = this;  
217 - var id = e.currentTarget.dataset.id; //活动id  
218 - var my_confirm = th.selectComponent("#my_confirm"); //组件的id  
219 - my_confirm.open(  
220 - "是否确定领取该礼包",  
221 - "取消",  
222 - "确定",  
223 - function () {  
224 - my_confirm.open_cancel(0);  
225 - },  
226 - function () {  
227 - my_confirm.open_cancel(0);  
228 - var json = {  
229 - "actId": '', //活动Id  
230 - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销  
231 - "buyType": '3', //1=积分兑换 2=余额购买 3=免费领取  
232 - "giftBagId": id, //礼包Id  
233 - "storeId": that.getStorageID, //商家Id  
234 - "userId": that.getUserID, //用户ID  
235 - "buyFrom": 2,  
236 - "first_leader": that.first_leader  
237 - };  
238 - //-- 分享导购要记录 --  
239 - if (getApp().globalData.guide_id) {  
240 - json.guide_id = getApp().globalData.guide_id;  
241 - }  
242 - var data = JSON.stringify(json);  
243 - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";  
244 - getApp().request.json_post(url, json,  
245 - function (res) {  
246 - if (res.data.code == 0) {  
247 - getApp().my_warnning("领取成功!", 1, th);  
248 - } else {  
249 - getApp().my_warnning(res.data.msg, 0, th);  
250 - }  
251 - },  
252 - function (res) { })  
253 - }) 206 +
  207 + var th = this;
  208 + var index = e.currentTarget.dataset.index; //活动id
  209 + var sele_g=th.data.wareCard[index];
  210 + th.setData({sele_g:sele_g, buyType:3,})
  211 +
  212 + if(sele_g.is_pickup){
  213 + if(sele_g.pickup_list && th.data.def_pick_store){
  214 + com.check_def_pk(th);
  215 + }
  216 + com.get_sto(th,os)
  217 + th.setData({
  218 + openSpecModal:1
  219 + })
  220 + }else {
  221 +
  222 +
  223 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  224 + my_confirm.open(
  225 + "是否确定领取该礼包",
  226 + "取消",
  227 + "确定",
  228 + function () {
  229 + my_confirm.open_cancel(0);
  230 + },
  231 + function () {
  232 + my_confirm.open_cancel(0);
  233 + com.buy_libao(th)
  234 + })
  235 + }
254 }, 236 },
255 237
256 getList: function (e) { 238 getList: function (e) {
@@ -327,6 +309,7 @@ Page({ @@ -327,6 +309,7 @@ Page({
327 }, 309 },
328 310
329 onShareAppMessage: function (e) { 311 onShareAppMessage: function (e) {
  312 + getApp().globalData.no_clear=1;
330 var curPage = this; 313 var curPage = this;
331 var pagePath = curPage.route; //当前页面url 314 var pagePath = curPage.route; //当前页面url
332 if (pagePath.indexOf('/') != 0) { 315 if (pagePath.indexOf('/') != 0) {
@@ -341,6 +324,7 @@ Page({ @@ -341,6 +324,7 @@ Page({
341 324
342 // 分享朋友圈 325 // 分享朋友圈
343 onShareTimeline() { 326 onShareTimeline() {
  327 + getApp().globalData.no_clear=1;
344 var curPage = this; 328 var curPage = this;
345 var pagePath = curPage.route; //当前页面url 329 var pagePath = curPage.route; //当前页面url
346 if (pagePath.indexOf('/') != 0) { 330 if (pagePath.indexOf('/') != 0) {
@@ -354,4 +338,271 @@ Page({ @@ -354,4 +338,271 @@ Page({
354 } 338 }
355 }, 339 },
356 340
  341 +
  342 + //--- 设置一下默认库存的数量 ----
  343 + set_def_storage(ee) {
  344 + var that = this, th = this;
  345 + that.data.fir_def_store = ee;
  346 + that.setData({
  347 + def_pick_store: ee,
  348 + sto_sele_name: ee.pickup_name,
  349 + sto_sele_id: ee.pickup_id,
  350 + sto_sele_distr: ee.distr_type
  351 + })
  352 + },
  353 + // 选择门店
  354 + choice_store: function (ee) {
  355 + var th = this;
  356 + var ind = ee.currentTarget.dataset.ind;
  357 + var bconfig = th.data.bconfig;
  358 +
  359 + if (!th.data.only_pk && !th.data.def_pickpu_list) {
  360 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  361 + return false;
  362 + }
  363 +
  364 + if (th.data.only_pk && !th.data.only_pk.length) {
  365 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  366 + return false;
  367 + }
  368 + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) {
  369 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  370 + return false;
  371 + }
  372 +
  373 +
  374 + if (bconfig && bconfig.is_sort_storage) {
  375 + wx.getLocation({
  376 + type: 'gcj02',
  377 + success: function (res) {
  378 +
  379 + th.data.lat = res.latitude;
  380 + th.data.lon = res.longitude;
  381 + th.data.is_get_local_ok = 1;
  382 + th.setData({
  383 + is_gps: 1
  384 + });
  385 + //th.onShow();
  386 + com.get_sto(th,os);
  387 + },
  388 + fail: function (res) {
  389 + //th.onShow();
  390 + th.data.is_get_local_ok = 1;
  391 + com.get_sto(th,os);
  392 + if (res.errCode == 2) {
  393 + th.setData({
  394 + is_gps: 0
  395 + });
  396 + if (th.data.is_gps == 0) {
  397 + getApp().confirmBox("请开启GPS定位", null, 25000, !1);
  398 + }
  399 + } else {
  400 + th.setData({
  401 + is_gps: "3"
  402 + });
  403 + }
  404 +
  405 + }
  406 + })
  407 + } else {
  408 + th.data.is_get_local_ok = 1;
  409 + com.get_sto(th,os);
  410 + }
  411 +
  412 + if (ind != undefined && ind != null) {
  413 + this.setData({
  414 + open_ind_store: ind,
  415 + store: 1,
  416 + openSpecModal: !1,
  417 + openSpecModal_pt: !1,
  418 + openSpecModal_flash_normal: !1,
  419 + })
  420 + } else {
  421 + this.setData({
  422 + store: 1,
  423 + openSpecModal: !1,
  424 + openSpecModal_pt: !1,
  425 + openSpecModal_flash_normal: !1
  426 +
  427 + })
  428 + }
  429 + },
  430 + //关闭选择门店
  431 + close_popup: function (e) {
  432 + var th = this;
  433 + this.setData({
  434 + store: 0,
  435 + choice_sort_store: 0,
  436 + sort_store: 0,
  437 + fir_pick_index: 0,
  438 + sec_pick_index: 0
  439 + })
  440 +
  441 + var openindstore = this.data.open_ind_store;
  442 + if (openindstore == 1) {
  443 + th.setData({
  444 + openSpecModal: !0,
  445 + openSpecModal_ind: openindstore,
  446 + });
  447 + } else if (openindstore == 2) {
  448 + th.setData({
  449 + openSpecModal: !0,
  450 + openSpecModal_ind: openindstore,
  451 + });
  452 + }
  453 + else if (openindstore == 4) { //4就是拼团
  454 + th.setData({
  455 + openSpecModal_pt: 1, //打开拼团购买界面
  456 + store: 0, //关闭门店
  457 + choice_sort_store: 0, //关闭门店2级
  458 + sort_store: 0, //关闭门店2级
  459 + });
  460 + }
  461 + else {
  462 + th.setData({
  463 + store: 0,
  464 + choice_sort_store: 0,
  465 + sort_store: 0
  466 + })
  467 + }
  468 +
  469 +
  470 + },
  471 +
  472 + //选择更多门店
  473 + more_store: function () {
  474 + this.setData({
  475 + sort_store: 1
  476 + });
  477 + },
  478 + // 返回按钮
  479 + returns: function () {
  480 + this.setData({
  481 + sort_store: 0,
  482 + choice_sort_store: 0
  483 + });
  484 + },
  485 + //---选择分类门店---
  486 + choice_sort_store: function (e) {
  487 + var index = e.currentTarget.dataset.index;
  488 + var region_name = e.currentTarget.dataset.region;
  489 + var item = this.data.all_sto[index];
  490 + this.setData({
  491 + region_name: region_name,
  492 + sort_store: 0,
  493 + choice_sort_store: 1,
  494 + sec_sto: item,
  495 + sec_pick_index: 0
  496 + });
  497 + },
  498 +
  499 + choose_for_store_fir: function (e) {
  500 + var index_c = e.currentTarget.dataset.ind;
  501 + var th = this;
  502 + th.setData({
  503 + fir_pick_index: index_c
  504 + })
  505 +
  506 + },
  507 +
  508 + //确定def_pick为选择的门店
  509 + sure_pick: function (e) {
  510 + var th = this;
  511 + var item = null;
  512 + var openindstore = th.data.open_ind_store;
  513 +
  514 + if (th.data.choice_sort_store == 0) {
  515 + var index = th.data.fir_pick_index;
  516 + if (th.data.is_show_sto_cat == 1) {
  517 + item = th.data.def_pickpu_list[index];
  518 + } else {
  519 + item = th.data.only_pk[index]; //当没有门店分类的时候
  520 + }
  521 +
  522 + } else {
  523 + var index = th.data.sec_pick_index;
  524 + item = th.data.sec_sto.s_arr[index];
  525 + }
  526 +
  527 + if (!th.data.sele_g) return false;
  528 +
  529 + th.setData({
  530 + def_pick_store: item,
  531 + sto_sele_name: item.pickup_name,
  532 + sto_sele_id: item.pickup_id,
  533 + sto_sele_distr: item.distr_type,
  534 + store: 0,
  535 + choice_sort_store: 0,
  536 + fir_pick_index: 0,
  537 + openSpecModal: !0,
  538 + });
  539 +
  540 +
  541 + },
  542 + //---点击二级之后的选择---
  543 + choose_for_store: function (e) {
  544 + var index_c = e.currentTarget.dataset.ind;
  545 + var th = this;
  546 + th.setData({
  547 + sec_pick_index: index_c,
  548 + fir_pick_index: index_c
  549 + })
  550 +
  551 + },
  552 + //把选择的门店设置成默认的门店def_pick
  553 + set_def_pick: function (e) {
  554 + var th = this;
  555 + var item = null;
  556 + if (th.data.choice_sort_store == 0) {
  557 + var index = th.data.fir_pick_index;
  558 + if (th.data.is_show_sto_cat == 1) {
  559 + item = th.data.def_pickpu_list[index];
  560 + } else {
  561 + item = th.data.only_pk[index]; //当没有门店分类的时候
  562 + }
  563 + } else {
  564 + var index = th.data.sec_pick_index;
  565 + item = th.data.sec_sto.s_arr[index];
  566 + }
  567 +
  568 + th.setData({
  569 + def_pick_store: item,
  570 + sto_sele_name: item.pickup_name,
  571 + sto_sele_id: item.pickup_id,
  572 + sto_sele_distr: item.distr_type,
  573 + store: 0,
  574 + choice_sort_store: 0,
  575 + openSpecModal: !0,
  576 + });
  577 +
  578 + var user_id=getApp().globalData.user_id;
  579 + var def_pickup_id = item.pickup_id;
  580 + getApp().request.put('/api/weshop/users/update', {
  581 + data: {
  582 + user_id: user_id,
  583 + def_pickup_id: def_pickup_id
  584 + },
  585 + success: function (res) {
  586 + if (res.data.code == 0) {
  587 + if (th.data.choice_sort_store == 0) th.setData({
  588 + fir_pick_index: 0
  589 + });
  590 + getApp().globalData.pk_store = item;
  591 + } else {
  592 + getApp().my_warnning("设置默认门店地址失败", 0, th)
  593 + }
  594 +
  595 + }
  596 + });
  597 +
  598 +
  599 +
  600 + },
  601 + closeSpecModal: function () {
  602 + this.setData({openSpecModal: 0});
  603 + },
  604 +
  605 + buy_libao:function () {
  606 + com.buy_libao(this)
  607 + }
357 }) 608 })
358 \ No newline at end of file 609 \ No newline at end of file
pages/giftpack/buygiftpack/giftpackbuy.wxml
@@ -62,30 +62,30 @@ @@ -62,30 +62,30 @@
62 <view class="flex-vertical"> 62 <view class="flex-vertical">
63 <block wx:if="{{items.payMoney>0 && items.payIntegral>0}}"> 63 <block wx:if="{{items.payMoney>0 && items.payIntegral>0}}">
64 <block wx:if="{{items.payMoney>0}}"> 64 <block wx:if="{{items.payMoney>0}}">
65 - <view class="flex" bindtap="GetBuyPrice" data-id="{{items.lbId}}" data-money="{{items.payMoney}}"> 65 + <view class="flex" bindtap="GetBuyPrice" data-index="{{index}}">
66 <button class="box_button_dui">立即购买</button> 66 <button class="box_button_dui">立即购买</button>
67 </view> 67 </view>
68 </block> 68 </block>
69 <block wx:if="{{items.payIntegral>0}}"> 69 <block wx:if="{{items.payIntegral>0}}">
70 - <view class="flex" bindtap="GetBuyIntegral" data-id="{{items.lbId}}"> 70 + <view class="flex" bindtap="GetBuyIntegral" data-index="{{index}}">
71 <button class="box_button_dui box_button_buy">立即兑换</button> 71 <button class="box_button_dui box_button_buy">立即兑换</button>
72 </view> 72 </view>
73 </block> 73 </block>
74 </block> 74 </block>
75 <block wx:else> 75 <block wx:else>
76 <block wx:if="{{items.payMoney>0}}"> 76 <block wx:if="{{items.payMoney>0}}">
77 - <view class="flex" bindtap="GetBuyPrice" data-id="{{items.lbId}}" data-money="{{items.payMoney}}"> 77 + <view class="flex" bindtap="GetBuyPrice" data-index="{{index}}">
78 <button class="box_button_dui box_button_buy">立即购买</button> 78 <button class="box_button_dui box_button_buy">立即购买</button>
79 </view> 79 </view>
80 </block> 80 </block>
81 <block wx:if="{{items.payIntegral>0}}"> 81 <block wx:if="{{items.payIntegral>0}}">
82 - <view class="flex" bindtap="GetBuyIntegral" data-id="{{items.lbId}}"> 82 + <view class="flex" bindtap="GetBuyIntegral" data-index="{{index}}">
83 <button class="box_button_dui box_button_buy">立即兑换</button> 83 <button class="box_button_dui box_button_buy">立即兑换</button>
84 </view> 84 </view>
85 </block> 85 </block>
86 </block> 86 </block>
87 <block wx:if="{{!items.payMoney && !items.payIntegral}}"> 87 <block wx:if="{{!items.payMoney && !items.payIntegral}}">
88 - <view class="flex" bindtap="GetFree" data-id="{{items.lbId}}"> 88 + <view class="flex" bindtap="GetFree" data-index="{{index}}">
89 <button class="box_button_dui box_button_buy">免费领取</button> 89 <button class="box_button_dui box_button_buy">免费领取</button>
90 </view> 90 </view>
91 </block> 91 </block>
@@ -116,4 +116,6 @@ @@ -116,4 +116,6 @@
116 </view> 116 </view>
117 <!-- 引入提示组件 --> 117 <!-- 引入提示组件 -->
118 <warn id="warn"></warn> 118 <warn id="warn"></warn>
119 -<my_confirm id="my_confirm"></my_confirm>  
120 \ No newline at end of file 119 \ No newline at end of file
  120 +<my_confirm id="my_confirm"></my_confirm>
  121 +
  122 +<include src="../public/buy_com.wxml"></include>
121 \ No newline at end of file 123 \ No newline at end of file
pages/giftpack/buygiftpack/giftpackbuy.wxss
1 /*引用样式路径*/ 1 /*引用样式路径*/
2 @charset "UTF-8"; 2 @charset "UTF-8";
3 -  
4 -/* Author XGQ  
5 - * 2019-11-12  
6 - */ 3 +@import '../../goods/goodsInfo/goodsInfo.wxss';
7 4
8 page { 5 page {
9 /* background-color: #fb7454; */ 6 /* background-color: #fb7454; */
pages/giftpack/giftpacklist/giftpacklist.js
@@ -4,6 +4,7 @@ var e = getApp(), @@ -4,6 +4,7 @@ var e = getApp(),
4 t = e.request, 4 t = e.request,
5 d = e.globalData; 5 d = e.globalData;
6 var ut = require("../../../utils/util.js"); 6 var ut = require("../../../utils/util.js");
  7 +var com = require("../public/buy_com.js");
7 8
8 Page({ 9 Page({
9 data: { 10 data: {
@@ -30,6 +31,43 @@ Page({ @@ -30,6 +31,43 @@ Page({
30 is_lb: 0, //是否有礼包 31 is_lb: 0, //是否有礼包
31 default_color: null, 32 default_color: null,
32 first_leader: e.globalData.first_leader || 0, // 推荐人ID 33 first_leader: e.globalData.first_leader || 0, // 推荐人ID
  34 +
  35 + //门店相关
  36 + ismend: 0,
  37 + is_sec_mend: 0,
  38 + sto_sele_name: "", //选中的门店名称
  39 + sto_sele_id: "", //选中的门店id
  40 + sto_sele_distr: "", //选择的门店的配送方式
  41 + is_show_sto_cat: 1, //是否显示门店分类
  42 + only_pk: null,
  43 + all_sto: null,
  44 + sec_sto: null, //选择了的门店分类
  45 + pickpu_list: null, //读出的所有门店list
  46 + def_pickpu_list: null, //一开始5个门店list
  47 + sec_pick_index: 0, //第二级门店选择ID
  48 + fir_pick_index: 0, //第一级门店选择ID
  49 + all_pick_list: null,//所有的门店先记录起来
  50 +
  51 + select_store: 0, //选择更多
  52 + index: 1,
  53 + more_store: 0, //选择门店
  54 + sort_store: 0, //门店分类
  55 + choice_sort_store: 0, //选择分类门店
  56 + new_user: 0, //新用户
  57 +
  58 + def_pick_store: null, // 默认的门店
  59 + fir_def_store: null, //客户默认的门店的
  60 + lat: null, //维度
  61 + lon: null, //经度
  62 +
  63 + is_get_local_ok: 0, //获取坐标是否完成
  64 + region_name: "门店分类", //区域的名字
  65 + is_gps: 1,
  66 + open_ind_store: 0, //哪里打开的门店列表的控制属性
  67 + default_store: {}, //创建添加默认门店地址的对象
  68 +
  69 + store:0,
  70 + openSpecModal:0
33 }, 71 },
34 onLoad: function (options) { 72 onLoad: function (options) {
35 this.setData({ 73 this.setData({
@@ -87,81 +125,36 @@ Page({ @@ -87,81 +125,36 @@ Page({
87 GetBuyPrice: function (e) { 125 GetBuyPrice: function (e) {
88 var that = this.data; 126 var that = this.data;
89 var th = this; 127 var th = this;
90 - // var id = e.currentTarget.dataset.id;//活动id  
91 //如果还没有开始的话 128 //如果还没有开始的话
92 if (th.data.isStart != 1) { 129 if (th.data.isStart != 1) {
93 getApp().my_warnning("活动还没有开始", 0, th); 130 getApp().my_warnning("活动还没有开始", 0, th);
94 return false; 131 return false;
95 } 132 }
96 133
97 -  
98 - var money = e.currentTarget.dataset.money;  
99 - var my_confirm = th.selectComponent("#my_confirm"); //组件的id  
100 - my_confirm.open(  
101 - "是否确定购买该礼包",  
102 - "取消",  
103 - "确定",  
104 - function () {  
105 - my_confirm.open_cancel(0);  
106 - },  
107 - function () {  
108 - my_confirm.open_cancel(0);  
109 -  
110 - var json = {  
111 - "actId": '', //活动Id  
112 - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销  
113 - "buyType": '2', //1=积分兑换 2=余额购买  
114 - "giftBagId": that.getGiftID, //礼包Id  
115 - "storeId": a.stoid, //商家Id  
116 - "userId": d.user_id, //用户ID  
117 - "buyFrom": 2,  
118 - "first_leader": that.first_leader,  
119 - };  
120 -  
121 - //-- 分享导购要记录 --  
122 - if (getApp().globalData.guide_id) {  
123 - json.guide_id = getApp().globalData.guide_id;  
124 - }  
125 -  
126 - var data = JSON.stringify(json);  
127 - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";  
128 -  
129 - getApp().request.json_post(url, json,  
130 - function (res) {  
131 - if (res.data.code == 0) {  
132 - var res = res.data.data;  
133 - if (!res) return false;  
134 - if (!res.result) return false;  
135 -  
136 - var order_sn = res.orderSn;  
137 - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;  
138 - wx.requestPayment({  
139 - timeStamp: String(res.result.timeStamp),  
140 - nonceStr: res.result.nonceStr,  
141 - package: res.result.packageValue,  
142 - signType: res.result.signType,  
143 - paySign: res.result.paySign,  
144 - success: function (n) {  
145 - getApp().goto(url);  
146 - },  
147 - fail: function (n) {  
148 - getApp().my_warnning("取消支付", 0, th);  
149 - }  
150 - });  
151 - } else {  
152 - getApp().my_warnning(res.data.msg, 0, th); 134 + th.setData({ buyType:2 })
  135 + if(th.data.sele_g.is_pickup){
  136 + th.setData({
  137 + openSpecModal:1
  138 + })
  139 + }else{
  140 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  141 + my_confirm.open(
  142 + "是否确定购买该礼包",
  143 + "取消",
  144 + "确定",
  145 + function () {
  146 + my_confirm.open_cancel(0);
  147 + },
  148 + function () {
  149 + my_confirm.open_cancel(0);
  150 + com.buy_libao(th)
153 } 151 }
154 - },  
155 - function (res) {  
156 -  
157 - }  
158 152
159 ) 153 )
  154 + }
160 155
161 156
162 - }  
163 157
164 - )  
165 158
166 }, 159 },
167 GetBuyIntegral: function (e) { 160 GetBuyIntegral: function (e) {
@@ -173,48 +166,28 @@ Page({ @@ -173,48 +166,28 @@ Page({
173 getApp().my_warnning("活动还没有开始", 0, th); 166 getApp().my_warnning("活动还没有开始", 0, th);
174 return false; 167 return false;
175 } 168 }
176 - // var id = e.currentTarget.dataset.id;//活动id  
177 - var my_confirm = th.selectComponent("#my_confirm"); //组件的id  
178 - my_confirm.open(  
179 - "是否确定兑换该礼包",  
180 - "取消",  
181 - "确定",  
182 - function () {  
183 - my_confirm.open_cancel(0);  
184 - },  
185 - function () {  
186 - my_confirm.open_cancel(0);  
187 - var json = {  
188 - "actId": '', //活动Id  
189 - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销  
190 - "buyType": '1', //1=积分兑换 2=余额购买  
191 - "giftBagId": that.getGiftID, //礼包Id  
192 - "storeId": a.stoid, //商家ID  
193 - "userId": d.user_id, //用户ID  
194 - "buyFrom": 2,  
195 - "first_leader": that.first_leader,  
196 - };  
197 - //-- 分享导购要记录 --  
198 - if (getApp().globalData.guide_id) {  
199 - json.guide_id = getApp().globalData.guide_id;  
200 - }  
201 169
202 - var data = JSON.stringify(json);  
203 - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";  
204 - getApp().request.json_post(url, json,  
205 - function (res) {  
206 - if (res.data.code == 0) {  
207 - getApp().my_warnning("兑换成功!", 1, th);  
208 - } else {  
209 - getApp().my_warnning(res.data.msg, 0, th);  
210 - }  
211 - },  
212 - function (res) { 170 + th.setData({ buyType:1 });
  171 + if(th.data.sele_g.is_pickup){
  172 + th.setData({
  173 + openSpecModal:1
  174 + })
  175 + }else {
  176 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  177 + my_confirm.open(
  178 + "是否确定兑换该礼包",
  179 + "取消",
  180 + "确定",
  181 + function () {
  182 + my_confirm.open_cancel(0);
  183 + },
  184 + function () {
  185 + my_confirm.open_cancel(0);
  186 + com.buy_libao(th)
  187 + })
  188 + }
213 189
214 - }  
215 190
216 - )  
217 - })  
218 191
219 192
220 }, 193 },
@@ -334,7 +307,20 @@ Page({ @@ -334,7 +307,20 @@ Page({
334 actTitle: res.data.data.actTitle, 307 actTitle: res.data.data.actTitle,
335 wareCard: res.data.data.wareCard, 308 wareCard: res.data.data.wareCard,
336 isStart: isStart, 309 isStart: isStart,
  310 + sele_g:res.data.data
337 }) 311 })
  312 +
  313 +
  314 + var sele_g=res.data.data;
  315 + com.wait_for_store_config(_this2);
  316 + com.set_user_mo_store(_this2,os,function () {
  317 + if(sele_g.pickup_list && _this2.data.def_pick_store){
  318 + com.check_def_pk(_this2);
  319 + }
  320 + });
  321 + com.get_sto(_this2,os);
  322 +
  323 +
338 } else { 324 } else {
339 getApp().my_warnning(res.data.msg, 0, _this2); 325 getApp().my_warnning(res.data.msg, 0, _this2);
340 return false; 326 return false;
@@ -421,6 +407,7 @@ Page({ @@ -421,6 +407,7 @@ Page({
421 407
422 //--- 分享设置 -- 408 //--- 分享设置 --
423 onShareAppMessage: function (e) { 409 onShareAppMessage: function (e) {
  410 + getApp().globalData.no_clear=1;
424 var curPage = this; 411 var curPage = this;
425 var pagePath = curPage.route; //当前页面url 412 var pagePath = curPage.route; //当前页面url
426 if (pagePath.indexOf('/') != 0) { 413 if (pagePath.indexOf('/') != 0) {
@@ -443,6 +430,7 @@ Page({ @@ -443,6 +430,7 @@ Page({
443 * 用户分享朋友圈 430 * 用户分享朋友圈
444 */ 431 */
445 onShareTimeline() { 432 onShareTimeline() {
  433 + getApp().globalData.no_clear=1;
446 var curPage = this; 434 var curPage = this;
447 var pagePath = curPage.route; //当前页面url 435 var pagePath = curPage.route; //当前页面url
448 if (pagePath.indexOf('/') != 0) { 436 if (pagePath.indexOf('/') != 0) {
@@ -471,50 +459,298 @@ Page({ @@ -471,50 +459,298 @@ Page({
471 getApp().my_warnning("活动还没有开始", 0, th); 459 getApp().my_warnning("活动还没有开始", 0, th);
472 return false; 460 return false;
473 } 461 }
474 - // var id = e.currentTarget.dataset.id;//活动id  
475 - var my_confirm = th.selectComponent("#my_confirm"); //组件的id  
476 - my_confirm.open(  
477 - "是否确定领取该礼包",  
478 - "取消",  
479 - "确定",  
480 - function () {  
481 - my_confirm.open_cancel(0);  
482 - },  
483 - function () {  
484 - my_confirm.open_cancel(0);  
485 - var json = {  
486 - "actId": '', //活动Id  
487 - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销  
488 - "buyType": '3', //1=积分兑换 2=余额购买  
489 - "giftBagId": that.getGiftID, //礼包Id  
490 - "storeId": a.stoid, //商家ID  
491 - "userId": d.user_id, //用户ID  
492 - "buyFrom": 2,  
493 - "first_leader": that.first_leader,  
494 - };  
495 -  
496 - //-- 分享导购要记录 --  
497 - if (getApp().globalData.guide_id) {  
498 - json.guide_id = getApp().globalData.guide_id; 462 +
  463 + th.setData({ buyType:3 });
  464 + if(th.data.sele_g.is_pickup){
  465 + th.setData({
  466 + openSpecModal:1
  467 + })
  468 + }else {
  469 +
  470 +
  471 + // var id = e.currentTarget.dataset.id;//活动id
  472 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  473 + my_confirm.open(
  474 + "是否确定领取该礼包",
  475 + "取消",
  476 + "确定",
  477 + function () {
  478 + my_confirm.open_cancel(0);
  479 + },
  480 + function () {
  481 + my_confirm.open_cancel(0);
  482 + com.buy_libao(th)
  483 + })
  484 + }
  485 +
  486 +
  487 + },
  488 +
  489 + //--- 设置一下默认库存的数量 ----
  490 + set_def_storage(ee) {
  491 + var that = this, th = this;
  492 + that.data.fir_def_store = ee;
  493 +
  494 + that.setData({
  495 + def_pick_store: ee,
  496 + sto_sele_name: ee.pickup_name,
  497 + sto_sele_id: ee.pickup_id,
  498 + sto_sele_distr: ee.distr_type
  499 + })
  500 + },
  501 + // 选择门店
  502 + choice_store: function (ee) {
  503 + var th = this;
  504 + var ind = ee.currentTarget.dataset.ind;
  505 + var bconfig = th.data.bconfig;
  506 +
  507 + if (!th.data.only_pk && !th.data.def_pickpu_list) {
  508 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  509 + return false;
  510 + }
  511 +
  512 + if (th.data.only_pk && !th.data.only_pk.length) {
  513 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  514 + return false;
  515 + }
  516 + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) {
  517 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  518 + return false;
499 } 519 }
500 520
501 - var data = JSON.stringify(json);  
502 - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";  
503 - getApp().request.json_post(url, json,  
504 - function (res) {  
505 - if (res.data.code == 0) {  
506 - getApp().my_warnning("领取成功!", 1, th); 521 +
  522 + if (bconfig && bconfig.is_sort_storage) {
  523 + wx.getLocation({
  524 + type: 'gcj02',
  525 + success: function (res) {
  526 +
  527 + th.data.lat = res.latitude;
  528 + th.data.lon = res.longitude;
  529 + th.data.is_get_local_ok = 1;
  530 + th.setData({
  531 + is_gps: 1
  532 + });
  533 + //th.onShow();
  534 + com.get_sto(th,os);
  535 + },
  536 + fail: function (res) {
  537 + //th.onShow();
  538 + th.data.is_get_local_ok = 1;
  539 + com.get_sto(th,os);
  540 + if (res.errCode == 2) {
  541 + th.setData({
  542 + is_gps: 0
  543 + });
  544 + if (th.data.is_gps == 0) {
  545 + getApp().confirmBox("请开启GPS定位", null, 25000, !1);
  546 + }
  547 + } else {
  548 + th.setData({
  549 + is_gps: "3"
  550 + });
  551 + }
  552 +
  553 + }
  554 + })
  555 + } else {
  556 + th.data.is_get_local_ok = 1;
  557 + com.get_sto(th,os);
  558 + }
  559 +
  560 + if (ind != undefined && ind != null) {
  561 + this.setData({
  562 + open_ind_store: ind,
  563 + store: 1,
  564 + openSpecModal: !1,
  565 + openSpecModal_pt: !1,
  566 + openSpecModal_flash_normal: !1,
  567 + })
  568 + } else {
  569 + this.setData({
  570 + store: 1,
  571 + openSpecModal: !1,
  572 + openSpecModal_pt: !1,
  573 + openSpecModal_flash_normal: !1
  574 +
  575 + })
  576 + }
  577 + },
  578 + //关闭选择门店
  579 + close_popup: function (e) {
  580 + var th = this;
  581 + this.setData({
  582 + store: 0,
  583 + choice_sort_store: 0,
  584 + sort_store: 0,
  585 + fir_pick_index: 0,
  586 + sec_pick_index: 0
  587 + })
  588 +
  589 + var openindstore = this.data.open_ind_store;
  590 + if (openindstore == 1) {
  591 + th.setData({
  592 + openSpecModal: !0,
  593 + openSpecModal_ind: openindstore,
  594 + });
  595 + } else if (openindstore == 2) {
  596 + th.setData({
  597 + openSpecModal: !0,
  598 + openSpecModal_ind: openindstore,
  599 + });
  600 + }
  601 + else if (openindstore == 4) { //4就是拼团
  602 + th.setData({
  603 + openSpecModal_pt: 1, //打开拼团购买界面
  604 + store: 0, //关闭门店
  605 + choice_sort_store: 0, //关闭门店2级
  606 + sort_store: 0, //关闭门店2级
  607 + });
  608 + }
  609 + else {
  610 + th.setData({
  611 + store: 0,
  612 + choice_sort_store: 0,
  613 + sort_store: 0
  614 + })
  615 + }
  616 +
  617 +
  618 + },
  619 +
  620 + //选择更多门店
  621 + more_store: function () {
  622 + this.setData({
  623 + sort_store: 1
  624 + });
  625 + },
  626 + // 返回按钮
  627 + returns: function () {
  628 + this.setData({
  629 + sort_store: 0,
  630 + choice_sort_store: 0
  631 + });
  632 + },
  633 + //---选择分类门店---
  634 + choice_sort_store: function (e) {
  635 + var index = e.currentTarget.dataset.index;
  636 + var region_name = e.currentTarget.dataset.region;
  637 + var item = this.data.all_sto[index];
  638 + this.setData({
  639 + region_name: region_name,
  640 + sort_store: 0,
  641 + choice_sort_store: 1,
  642 + sec_sto: item,
  643 + sec_pick_index: 0
  644 + });
  645 + },
  646 +
  647 + choose_for_store_fir: function (e) {
  648 + var index_c = e.currentTarget.dataset.ind;
  649 + var th = this;
  650 + th.setData({
  651 + fir_pick_index: index_c
  652 + })
  653 +
  654 + },
  655 +
  656 + //确定def_pick为选择的门店
  657 + sure_pick: function (e) {
  658 + var th = this;
  659 + var item = null;
  660 + var openindstore = th.data.open_ind_store;
  661 +
  662 + if (th.data.choice_sort_store == 0) {
  663 + var index = th.data.fir_pick_index;
  664 + if (th.data.is_show_sto_cat == 1) {
  665 + item = th.data.def_pickpu_list[index];
507 } else { 666 } else {
508 - getApp().my_warnning(res.data.msg, 0, th); 667 + item = th.data.only_pk[index]; //当没有门店分类的时候
509 } 668 }
510 - },  
511 - function (res) { }  
512 669
513 - )  
514 - }) 670 + } else {
  671 + var index = th.data.sec_pick_index;
  672 + item = th.data.sec_sto.s_arr[index];
  673 + }
515 674
  675 + if (!th.data.sele_g) return false;
  676 +
  677 + th.setData({
  678 + def_pick_store: item,
  679 + sto_sele_name: item.pickup_name,
  680 + sto_sele_id: item.pickup_id,
  681 + sto_sele_distr: item.distr_type,
  682 + store: 0,
  683 + choice_sort_store: 0,
  684 + fir_pick_index: 0,
  685 + openSpecModal: !0,
  686 + });
  687 +
  688 +
  689 + },
  690 + //---点击二级之后的选择---
  691 + choose_for_store: function (e) {
  692 + var index_c = e.currentTarget.dataset.ind;
  693 + var th = this;
  694 + th.setData({
  695 + sec_pick_index: index_c,
  696 + fir_pick_index: index_c
  697 + })
  698 +
  699 + },
  700 + //把选择的门店设置成默认的门店def_pick
  701 + set_def_pick: function (e) {
  702 + var th = this;
  703 + var item = null;
  704 + if (th.data.choice_sort_store == 0) {
  705 + var index = th.data.fir_pick_index;
  706 + if (th.data.is_show_sto_cat == 1) {
  707 + item = th.data.def_pickpu_list[index];
  708 + } else {
  709 + item = th.data.only_pk[index]; //当没有门店分类的时候
  710 + }
  711 + } else {
  712 + var index = th.data.sec_pick_index;
  713 + item = th.data.sec_sto.s_arr[index];
  714 + }
  715 + th.setData({
  716 + def_pick_store: item,
  717 + sto_sele_name: item.pickup_name,
  718 + sto_sele_id: item.pickup_id,
  719 + sto_sele_distr: item.distr_type,
  720 + store: 0,
  721 + choice_sort_store: 0,
  722 + openSpecModal: !0,
  723 + });
  724 +
  725 + var user_id=getApp().globalData.user_id;
  726 + var def_pickup_id = item.pickup_id;
  727 + getApp().request.put('/api/weshop/users/update', {
  728 + data: {
  729 + user_id: user_id,
  730 + def_pickup_id: def_pickup_id
  731 + },
  732 + success: function (res) {
  733 + if (res.data.code == 0) {
  734 + if (th.data.choice_sort_store == 0) th.setData({
  735 + fir_pick_index: 0
  736 + });
  737 + getApp().globalData.pk_store = item;
  738 + } else {
  739 + getApp().my_warnning("设置默认门店地址失败", 0, th)
  740 + }
516 741
517 - }, 742 + }
  743 + });
  744 +
  745 +
  746 + },
  747 + closeSpecModal: function () {
  748 + this.setData({openSpecModal: 0});
  749 + },
  750 +
  751 + buy_libao:function () {
  752 + com.buy_libao(this)
  753 + }
518 754
519 755
520 756
pages/giftpack/giftpacklist/giftpacklist.wxml
@@ -100,7 +100,7 @@ @@ -100,7 +100,7 @@
100 </block>--> 100 </block>-->
101 101
102 <block wx:if="{{isBuy==0&item.lbType==2}}"> 102 <block wx:if="{{isBuy==0&item.lbType==2}}">
103 - <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/coupons/coupons" bindtap="goto"></image> 103 + <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/packageD/pages/user/coupons/coupons" bindtap="goto"></image>
104 </block> 104 </block>
105 <block wx:if="{{isBuy==0&item.lbType==3}}"> 105 <block wx:if="{{isBuy==0&item.lbType==3}}">
106 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/my_service/i_service" bindtap="goto"></image> 106 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/my_service/i_service" bindtap="goto"></image>
@@ -190,4 +190,6 @@ @@ -190,4 +190,6 @@
190 <!-- 弹出框扫描 --> 190 <!-- 弹出框扫描 -->
191 <qr_code id="qc_com"></qr_code> 191 <qr_code id="qc_com"></qr_code>
192 <!-- 制作一个圆球导航 --> 192 <!-- 制作一个圆球导航 -->
193 -<nav_b id="nav_b"></nav_b>  
194 \ No newline at end of file 193 \ No newline at end of file
  194 +<nav_b id="nav_b"></nav_b>
  195 +
  196 +<include src="../public/buy_com.wxml"></include>
195 \ No newline at end of file 197 \ No newline at end of file
pages/giftpack/giftpacklist/giftpacklist.wxss
1 @charset "UTF-8"; 1 @charset "UTF-8";
2 -  
3 -/* Author XGQ  
4 - * 2019-12-12  
5 - */ 2 +@import '../../goods/goodsInfo/goodsInfo.wxss';
6 3
7 .box.data-v-3a5b7e36 { 4 .box.data-v-3a5b7e36 {
8 -webkit-align-content: center; 5 -webkit-align-content: center;
pages/giftpack/public/buy_com.js 0 → 100644
  1 +module.exports = {
  2 + //开启定位
  3 + wait_for_store_config: function (th) {
  4 + var t_time = setInterval(function () {
  5 + if (th.data.bconfig == null) false;
  6 + var e = th.data.bconfig;
  7 + if (e && e.is_sort_storage) {
  8 + wx.getLocation({
  9 + type: 'gcj02',
  10 + success: function (res) {
  11 + th.data.lat = res.latitude;
  12 + th.data.lon = res.longitude;
  13 + th.data.is_get_local_ok = 1;
  14 + },
  15 + fail: function (res) {
  16 + if (res.errCode == 2) {
  17 + th.setData({
  18 + is_gps: 0
  19 + });
  20 + if (th.data.is_gps == 0) {
  21 + getApp().confirmBox("请开启GPS定位", null, 10000, !1);
  22 + }
  23 +
  24 + } else {
  25 + th.setData({
  26 + is_gps: "3"
  27 + });
  28 + }
  29 +
  30 + th.data.is_get_local_ok = 1;
  31 + }
  32 + })
  33 + } else {
  34 + th.data.is_get_local_ok = 1;
  35 + }
  36 + clearInterval(t_time);
  37 + }, 500)
  38 + },
  39 + set_user_mo_store(th,os,func){
  40 + var that=th;
  41 + //获取用户的默认门店
  42 + getApp().get_user_store(function (e) {
  43 + if (!e) {
  44 + th.data.fir_def_store = {}; //赋值空对象
  45 + return false;
  46 + }
  47 + var ee = JSON.parse(JSON.stringify(e));
  48 + //--定时器推迟一下--
  49 + setTimeout(function () {
  50 + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
  51 + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
  52 + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
  53 + ee.is_no_dis = 1;
  54 + }
  55 +
  56 + var appd = getApp().globalData;
  57 + var w_time = setInterval(function () {
  58 + if (that.data.is_get_local_ok == 0) return false;
  59 + clearInterval(w_time);
  60 + var distance = null;
  61 + var e = JSON.parse(JSON.stringify(ee));
  62 +
  63 + //如果有开启近距离的话,同时距离优不一样了
  64 + if (that.data.lat != null) {
  65 + //如果经纬度有变化的话
  66 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
  67 + that.set_def_storage(e);
  68 + if(func) func();
  69 + } else {
  70 + //要用接口是获取距离,js的计算不准
  71 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  72 + data: {
  73 + store_id: os.stoid,
  74 + pickup_id: e.pickup_id,
  75 + lat: th.data.lat,
  76 + lon: th.data.lon,
  77 + isstop: 0,
  78 + is_pos: 1
  79 + },
  80 + }).then(res => {
  81 + if (res.data.code == 0) {
  82 + e = res.data.data.pageData[0];
  83 + if (e) {
  84 + e.is_no_dis = ee.is_no_dis;
  85 + appd.pk_store = e;
  86 + that.set_def_storage(e);
  87 + }
  88 +
  89 + }
  90 + if(func) func();
  91 + })
  92 + }
  93 + //e.distance = distance;
  94 + appd.lat = that.data.lat;
  95 + appd.lon = that.data.lon;
  96 +
  97 + } else {
  98 + if (e) {
  99 + e.distance = null;
  100 + that.set_def_storage(e);
  101 + }
  102 + if(func) func();
  103 + }
  104 + }, 500)
  105 + }, 700)
  106 + })
  107 +
  108 + },
  109 +
  110 + //---------拿出门店分类和门店------------
  111 + get_sto(th,os) {
  112 + var that = th;
  113 + var self=this;
  114 + var timer_get = setInterval(function () {
  115 + if (th.data.is_get_local_ok == 0) return false;
  116 + var dd = null;
  117 +
  118 + dd = {
  119 + store_id: os.stoid,
  120 + isstop: 0,
  121 + is_pos: 1,
  122 + pageSize: 2000,
  123 + }
  124 +
  125 + //如果有距离的话
  126 + if (th.data.lat != null) {
  127 + dd.lat = th.data.lat;
  128 + dd.lon = th.data.lon;
  129 + }
  130 +
  131 + if(th.data.sele_g && th.data.sele_g.pickup_list){
  132 + dd.ids=th.data.sele_g.pickup_list
  133 + }
  134 +
  135 + clearInterval(timer_get);
  136 +
  137 + //如果会员是有默认的门店话
  138 + if (!th.data.def_pick_store && th.data.fir_def_store) {
  139 + th.setData({def_pick_store: th.data.fir_def_store});
  140 + }
  141 + wx.showLoading({
  142 + title: '加载中.'
  143 + });
  144 + //----------获取门店----------------
  145 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  146 + data: dd,
  147 + }).then(res => {
  148 + var e = res;
  149 +
  150 + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
  151 +
  152 + var his_cate_num = 0;
  153 + for (let i in e.data.data.pageData) {
  154 + let item = e.data.data.pageData[i];
  155 + if (item.category_id > 0) {
  156 + his_cate_num = 1;
  157 + break;
  158 + }
  159 + }
  160 + e.his_cate_num = his_cate_num;
  161 +
  162 + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
  163 + if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  164 + th.setData({
  165 + def_pick_store: e.data.data.pageData[0],
  166 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  167 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  168 + sto_sele_distr: e.data.data.pageData[0].distr_type
  169 + });
  170 + th.data.fir_def_store = e.data.data.pageData[0];
  171 + }
  172 +
  173 + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 --
  174 + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') {
  175 + for (var k = 0; k < e.data.data.pageData.length; k++) {
  176 + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
  177 + e.data.data.pageData.splice(k, 1); //删除
  178 + break;
  179 + }
  180 + }
  181 + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
  182 + }
  183 +
  184 + th.setData({all_pick_list: e.data.data.pageData});
  185 +
  186 + setTimeout(function () {
  187 + self.deal_pickup(e,th,os); //--普通门店排版--
  188 + }, 800)
  189 +
  190 + }
  191 + })
  192 + }, 200)
  193 +
  194 + },
  195 +
  196 + //-- 统一购买 --
  197 + buy_libao:function (th) {
  198 + if(th.data.sele_g.is_pickup){
  199 + if(!th.data.def_pick_store && !th.data.def_pick_store.pickup_id){
  200 + getApp().my_warnning("请先选择门店", 1, th);
  201 + return false;
  202 + }
  203 +
  204 + if(th.data.def_pick_store.is_no_dis){
  205 + getApp().my_warnning("门店不匹配,请重新选择", 1, th);
  206 + return false;
  207 + }
  208 + }
  209 +
  210 + th.setData({submit:1})
  211 + var id=th.data.sele_g.lbId;
  212 + var that=th;
  213 + var json = {
  214 + "actId": '', //活动Id
  215 + "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
  216 + "buyType":""+that.data.buyType, //1=积分兑换 2=余额购买
  217 + "giftBagId": id, //礼包Id
  218 + "storeId": that.data.getStorageID, //商家Id
  219 + "userId": that.data.getUserID, //用户ID
  220 + "buyFrom": 2,
  221 + };
  222 +
  223 + if(that.data.first_leader){
  224 + json.first_leader=that.data.first_leader
  225 + }
  226 + if(that.data.guide_id){
  227 + json.guide_id=that.data.guide_id
  228 + }
  229 +
  230 + if(that.data.def_pick_store){
  231 + json.pickup_id=that.data.def_pick_store.pickup_id;
  232 + }
  233 +
  234 + //-- 分享导购要记录 --
  235 + if (getApp().globalData.guide_id) {
  236 + json.guide_id = getApp().globalData.guide_id;
  237 + }
  238 +
  239 + var url ="/api/weshop/marketing/buy/receive/gift/record/insert";
  240 + getApp().request.json_post(url, json,
  241 + function (res) {
  242 + if (res.data.code == 0 && res.data.data) {
  243 + switch(that.data.buyType){
  244 + case 1://立即兑换
  245 + th.setData({submit:0})
  246 + getApp().my_warnning("兑换成功!", 1, th);
  247 + th.closeSpecModal();
  248 + break;
  249 + case 2://立即购买
  250 + var order_sn = res.data.data.orderSn;
  251 + res = res.data.data.result;
  252 + if (!res) return false;
  253 + var money=that.data.payMoney;
  254 + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;
  255 + wx.requestPayment({
  256 + timeStamp: String(res.timeStamp),
  257 + nonceStr: res.nonceStr,
  258 + package: res.packageValue,
  259 + signType: res.signType,
  260 + paySign: res.paySign,
  261 + success: function (res) {
  262 + th.setData({submit:0})
  263 + getApp().goto(url);
  264 + },
  265 + fail: function (res) {
  266 + th.setData({submit:0})
  267 + getApp().my_warnning("取消支付", 0, th);
  268 + }
  269 + });
  270 + break;
  271 + case 3://立即领取
  272 + th.setData({submit:0})
  273 + getApp().my_warnning("领取成功!", 1, th);
  274 + th.closeSpecModal();
  275 + break;
  276 + }
  277 +
  278 + } else {
  279 + th.setData({submit:0})
  280 + getApp().my_warnning(res.data.msg, 0, th);
  281 + }
  282 + },
  283 + function (res) {
  284 + th.setData({submit:0})
  285 + }
  286 + )
  287 +
  288 + },
  289 +
  290 + //------------处理门店---------------
  291 + deal_pickup(e,th,os) {
  292 +
  293 + if (!th.data.sele_g) return false
  294 + wx.hideLoading();
  295 +
  296 + //单总量超出10个的时候,同时门店有分类
  297 + if (e.data.data.total > 10 && e.his_cate_num) {
  298 + getApp().request.get("/api/weshop/storagecategory/page", {
  299 + data: {
  300 + store_id: os.stoid,
  301 + pageSize: 1000,
  302 + orderField: "sort",
  303 + orderType: 'asc',
  304 + },
  305 + success: function (ee) {
  306 + if (ee.data.code == 0) {
  307 + var check_all_cate = 0;
  308 + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
  309 + for (let i in ee.data.data.pageData) {
  310 + let item = ee.data.data.pageData[i];
  311 + if (item.is_show == 1) {
  312 + check_all_cate = 1;
  313 + break
  314 + }
  315 + }
  316 + }
  317 + if (check_all_cate) {
  318 + var sto_cate = ee.data.data.pageData;
  319 + var sto_arr = e.data.data.pageData;
  320 + var newarr = new Array();
  321 + var qita = new Array();
  322 +
  323 +
  324 + var is_del_pk = 0;
  325 + //----要进行门店分组--------
  326 + for (var i = 0; i < sto_arr.length; i++) {
  327 + //找一下这个门店有没有在分类数组内
  328 + var find2 = 0, find2name = "", sort = 0;
  329 + is_del_pk = 0;
  330 + for (var m = 0; m < sto_cate.length; m++) {
  331 + if (sto_arr[i].category_id == sto_cate[m].cat_id) {
  332 + if (sto_cate[m].is_show != 1) {
  333 + is_del_pk = 1;
  334 + sto_arr.splice(i, 1);
  335 + i--;
  336 + } else {
  337 + find2 = sto_cate[m].cat_id;
  338 + find2name = sto_cate[m].cat_name;
  339 + sort = sto_cate[m].sort;
  340 + is_del_pk = 0;
  341 + }
  342 + break;
  343 + }
  344 + }
  345 + if (is_del_pk) continue;
  346 +
  347 + if (newarr.length > 0) {
  348 + var find = 0;
  349 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  350 + if (find2 != 0) {
  351 + for (var ii = 0; ii < newarr.length; ii++) {
  352 + if (sto_arr[i].category_id == newarr[ii].cat_id) {
  353 + newarr[ii].s_arr.push(sto_arr[i]);
  354 + find = 1;
  355 + break;
  356 + }
  357 + }
  358 + if (find == 0) {
  359 + var arr0 = new Array();
  360 + arr0.push(sto_arr[i]);
  361 + var item = {
  362 + cat_id: find2,
  363 + name: find2name,
  364 + sort: sort,
  365 + s_arr: arr0
  366 + };
  367 + newarr.push(item);
  368 + }
  369 + } else {
  370 + qita.push(sto_arr[i]);
  371 + }
  372 + } else {
  373 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  374 + if (find2 != 0) {
  375 + var arr0 = new Array();
  376 + arr0.push(sto_arr[i]);
  377 + var item = {
  378 + cat_id: find2,
  379 + name: find2name,
  380 + sort: sort,
  381 + s_arr: arr0
  382 + };
  383 + newarr.push(item);
  384 + } else {
  385 + qita.push(sto_arr[i]);
  386 + }
  387 + }
  388 + }
  389 +
  390 + var def_arr = new Array();
  391 + //-- 开始就看10个门店 --
  392 + for (var k = 0; k < 10; k++) {
  393 + if (k == sto_arr.length) break;
  394 + def_arr.push(sto_arr[k]);
  395 + }
  396 +
  397 + th.setData({
  398 + def_pickpu_list: def_arr,
  399 + pickpu_list: ee.data.data.pageData
  400 + });
  401 +
  402 +
  403 + //门店分类要排序下
  404 + function compare(property) {
  405 + return function (a, b) {
  406 + var value1 = a[property];
  407 + var value2 = b[property];
  408 + return value1 - value2;
  409 + }
  410 + }
  411 +
  412 + if (newarr.length > 0)
  413 + newarr.sort(compare("sort"));
  414 +
  415 +
  416 + //----安排其他的分类-----
  417 + if (qita.length > 0) {
  418 + var item = {
  419 + cat_id: -1,
  420 + name: "其他",
  421 + s_arr: qita
  422 + };
  423 + newarr.push(item);
  424 + }
  425 +
  426 + var sd = {
  427 + all_sto: newarr,
  428 + is_show_sto_cat: 1
  429 + }
  430 + if (!sto_arr || sto_arr.length <= 10) {
  431 + sd.is_show_sto_cat = -1;
  432 + sd.only_pk = sto_arr;
  433 + }
  434 + th.setData(sd);
  435 +
  436 + } else {
  437 + th.setData({
  438 + is_show_sto_cat: -1,
  439 + only_pk: e.data.data.pageData
  440 + });
  441 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  442 + if (!th.data.def_pick_store) {
  443 + th.setData({
  444 + def_pick_store: e.data.data.pageData[0],
  445 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  446 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  447 + sto_sele_distr: e.data.data.pageData[0].distr_type
  448 + })
  449 + }
  450 + }
  451 + } else {
  452 + th.setData({
  453 + is_show_sto_cat: -1,
  454 + only_pk: e.data.data.pageData
  455 + });
  456 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  457 + if (!th.data.def_pick_store) {
  458 + th.setData({
  459 + def_pick_store: e.data.data.pageData[0],
  460 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  461 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  462 + sto_sele_distr: e.data.data.pageData[0].distr_type
  463 + })
  464 + }
  465 +
  466 + }
  467 + }
  468 + });
  469 + } else {
  470 + th.setData({
  471 + is_show_sto_cat: 0,
  472 + only_pk: e.data.data.pageData
  473 + });
  474 + //-----如果没有默认门店,要取第一个门店作为默认店------
  475 + if (!th.data.def_pick_store && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  476 + th.setData({
  477 + def_pick_store: e.data.data.pageData[0],
  478 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  479 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  480 + sto_sele_distr: e.data.data.pageData[0].distr_type
  481 + })
  482 + }
  483 + }
  484 + },
  485 +
  486 + check_def_pk:function (th) {
  487 + var def_pick_store=th.data.def_pick_store
  488 + var sele_g=th.data.sele_g;
  489 + var arr=sele_g.pickup_list.split(',');
  490 +
  491 + var idx=arr.findIndex(function (e) {
  492 + return e==def_pick_store.pickup_id;
  493 + })
  494 +
  495 + if(idx==-1){
  496 + def_pick_store.is_no_dis=1;
  497 + th.setData({def_pick_store})
  498 + }
  499 +
  500 +
  501 + }
  502 +
  503 +
  504 +
  505 +
  506 +}
0 \ No newline at end of file 507 \ No newline at end of file
pages/giftpack/public/buy_com.wxml 0 → 100644
  1 +<!-- 选择门店的弹框,1.1版最新的 -->
  2 +<block wx:if="{{store}}">
  3 + <view class="mongolia-layer" bindtap="close_popup"></view>
  4 + <view class="popup-frame">
  5 + <block wx:if="{{sort_store==0}}">
  6 + <!-- 头部 标题 -->
  7 + <view class="popup-top flex-space-between">
  8 + <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text>
  9 + <view>
  10 + <view>
  11 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  12 + </view>
  13 + <view class="felx choose_more" bindtap="more_store" wx:if="{{is_show_sto_cat>0}}">
  14 + <text class="fs26 red-co" >{{choice_sort_store==0?'更多门店':'返回'}}</text> <view class="bg_rights" ></view>
  15 + </view>
  16 + </view>
  17 + </view>
  18 + <!-- 门店列表,最外层的门店列表,一开始 -->
  19 + <view class="store-list">
  20 + <!-- 如果还没有点击更多门店的时候 -->
  21 + <block wx:if="{{choice_sort_store==0}}">
  22 + <!-- 需要for循环 -->
  23 + <block wx:if="{{is_show_sto_cat==1}}">
  24 + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  25 + <view class="store flex-vertical">
  26 + <!-- 需要点击事件 -->
  27 + <block wx:if="{{index==fir_pick_index}}">
  28 + <view class="circle white xc-hook fs20 red-b">Г</view>
  29 + </block>
  30 + <block wx:else>
  31 + <view class="circle xc-hooks"></view>
  32 + </block>
  33 + <view class="address-frame xc-ash">
  34 + <view class="flex-vertical-between butttem5">
  35 + <view class="flex xc-ash">
  36 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  37 + </view>
  38 + <view>
  39 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  40 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}}
  41 + </view>
  42 + </view>
  43 + </view>
  44 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  45 + </view>
  46 + </view>
  47 + </view>
  48 + </block>
  49 + <block wx:else>
  50 + <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  51 + <view class="store flex-vertical">
  52 + <!-- 需要点击事件 -->
  53 + <block wx:if="{{index==fir_pick_index}}">
  54 + <view class="circle white xc-hook fs20 red-b">Г</view>
  55 + </block>
  56 + <block wx:else>
  57 + <view class="circle xc-hooks"></view>
  58 + </block>
  59 + <view class="address-frame xc-ash">
  60 + <view class="flex-vertical-between ">
  61 + <view class="flex xc-ash">
  62 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  63 + </view>
  64 + <view>
  65 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  66 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  67 + </view>
  68 + </view>
  69 + </view>
  70 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  71 + </view>
  72 + </view>
  73 + </view>
  74 + </block>
  75 + </block>
  76 + <block wx:else>
  77 + <!-- 如果是点击选择门店分类后显示分类下的门店 -->
  78 + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}" bindtap="choose_for_store">
  79 + <view class="store flex-vertical">
  80 + <!-- 需要点击事件 -->
  81 + <block wx:if="{{index==sec_pick_index}}">
  82 + <view class="circle white xc-hook fs20 red-b">Г</view>
  83 + </block>
  84 + <block wx:else>
  85 + <view class="circle xc-hooks"></view>
  86 + </block>
  87 + <view class="address-frame xc-ash">
  88 + <view class="flex-vertical-between ">
  89 + <view class="flex xc-ash">
  90 + <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
  91 + </view>
  92 + <view>
  93 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  94 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  95 + </view>
  96 + </view>
  97 + </view>
  98 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  99 + </view>
  100 + </view>
  101 + </view>
  102 + </block>
  103 + </view>
  104 + <!-- 门店列表底部 -->
  105 + <view class="store-bottom-frame">
  106 + <view class="store-bottom flex-vertical-between">
  107 + <view class="determine red-b fs28 white t-c" bindtap="sure_pick" data-openindstore="{{open_ind_store}}">
  108 + 确定
  109 + </view>
  110 + <view class="default t-c fs28" bindtap="set_def_pick" data-openindstore="{{open_ind_store}}">
  111 + 设为默认
  112 + </view>
  113 + </view>
  114 + </view>
  115 + </block>
  116 + <block wx:else>
  117 + <view class="popup-top flex-space-between">
  118 + <text class="fs32 nearby_store">门店分类选择</text>
  119 + <view>
  120 + <view>
  121 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  122 + </view>
  123 + <view class="felx choose_mores" bindtap="returns">
  124 + <text class="fs26 red-co">返回</text>
  125 + </view>
  126 + </view>
  127 + </view>
  128 + <view class="sort_store_list">
  129 + <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}">
  130 + <view class="sort-store flex-vertical-between">
  131 + <view class="fs30" di>{{item.name}}</view>
  132 + <view class="black_rights-frame">
  133 + <view class="black_rights"></view>
  134 + </view>
  135 + </view>
  136 + </view>
  137 + </view>
  138 + </block>
  139 + </view>
  140 +</block>
  141 +<!-- --弹起来,选择规格数量,普通商品购买和秒杀---- -->
  142 +<view hidden="{{!openSpecModal}}">
  143 + <view bindtap="closeSpecModal" class="cover-layer"></view>
  144 + <view class="spec-model">
  145 + <view class="pding">
  146 + <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon>
  147 + <view class="spec-goods">
  148 + <image class="wh100 spec-img xc-distance-bottom" bindtap="previewImage" src="{{iurl+(sele_g.cover_img?sele_g.cover_img:sele_g.lbUrl)}}" binderror="pop_err_img" data-errorimg=""></image>
  149 + <view class="spec-goods-info">
  150 + <view class="spec-goods-name ellipsis-2">{{sele_g.giftTitle}}</view>
  151 + <view class="flex ai_end xc-val-money">
  152 + <view class="spec-goods-price">
  153 + <block wx:if="{{sele_g.payMoney>0}}">
  154 + <text>{{"¥"+sele_g.payMoney}}</text>
  155 + </block>
  156 + <block wx:if="{{sele_g.payMoney>0&&sele_g.payIntegral>0}}">
  157 + <text>/</text>
  158 + </block>
  159 + <block wx:if="{{sele_g.payIntegral>0}}">
  160 + <view class="flex">
  161 + <text class="ellipsis-1">{{sele_g.payIntegral}}</text>
  162 + <view>积分</view>
  163 + </view>
  164 + </block>
  165 +
  166 + </view>
  167 + </view>
  168 +
  169 +
  170 + <view class="flex">
  171 + <view class="spec-goods-stock" >已售:{{sele_g.giftQty}}</view>
  172 + <view class="spec-goods-stock">可售:{{sele_g.lbnum-sele_g.giftQty+(sele_g.virtualsales?sele_g.virtualsales:0)}}</view>
  173 + </view>
  174 +
  175 + </view>
  176 + <!-- 选择门店模块 -->
  177 + <view class="flex-space-between address ai_end xc-width ">
  178 + <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
  179 + <text class="fs30 xc-black3 shop_name bold">{{def_pick_store.pickup_name}}</text>
  180 + <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
  181 + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
  182 + </view>
  183 + </view>
  184 + <!-- 没有门店的时候 -->
  185 + <view class="flex" bindtap="choice_store" wx:else>
  186 + <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
  187 + <view class="fs30" style="color:black;">选择门店</view>
  188 + </view>
  189 + <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view>
  190 + </view>
  191 + <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
  192 + <block wx:else>
  193 + <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
  194 + <block wx:else>
  195 + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
  196 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">
  197 + (库存不足)
  198 + </view>
  199 + </block>
  200 + </block>
  201 + <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store && def_pick_store.fulladdress}}">
  202 + 地址:{{def_pick_store.fulladdress}}
  203 + </view>
  204 + </view>
  205 + <!-- 商品的属性项目 -->
  206 +
  207 +
  208 + </view>
  209 + <view class="spec-cart-btns">
  210 + <!-- 根本就找不到门店 -->
  211 + <block wx:if="{{!only_pk && !def_pickpu_list}}">
  212 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">
  213 + 未找到门店
  214 + </view>
  215 + </block>
  216 + <block wx:else>
  217 + <block wx:if="{{only_pk && !only_pk.length}}">
  218 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">
  219 + 未找到门店
  220 + </view>
  221 + </block>
  222 + <block wx:else>
  223 + <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">
  224 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
  225 + 库存不足
  226 + </view>
  227 + </block>
  228 + <block wx:else>
  229 + <block wx:if="{{!def_pick_store}}">
  230 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
  231 + 请先选择门店
  232 + </view>
  233 + </block>
  234 + <block wx:else>
  235 + <block wx:if="{{sele_g.store_count<=0}}">
  236 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
  237 + 库存不足
  238 + </view>
  239 + </block>
  240 + <block wx:else>
  241 + <button bindtap="buy_libao" disabled="{{submit}}" style="display: block" class="spec-cart-btn {{buyType==2?'yellow':'red-b'}} fs32" data-action="add">
  242 + <text wx:if="{{buyType==1}}">立即兑换</text>
  243 + <text wx:if="{{buyType==2}}">立即购买</text>
  244 + <text wx:if="{{buyType==3}}">立即领取</text>
  245 + </button>
  246 + </block>
  247 +
  248 + </block>
  249 + </block>
  250 + </block>
  251 + </block>
  252 +
  253 + </view>
  254 + <view class="clear"></view>
  255 +
  256 + </view>
  257 +</view>
0 \ No newline at end of file 258 \ No newline at end of file
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/assistance/giftpacklist.wxml
@@ -79,7 +79,7 @@ @@ -79,7 +79,7 @@
79 </block> 79 </block>
80 </block> 80 </block>
81 <block wx:if="{{item.lbType==2}}"> 81 <block wx:if="{{item.lbType==2}}">
82 - <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/coupons/coupons" bindtap="goto"></image> 82 + <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/packageD/pages/user/coupons/coupons" bindtap="goto"></image>
83 </block> 83 </block>
84 <block wx:if="{{item.lbType==3}}"> 84 <block wx:if="{{item.lbType==3}}">
85 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/my_service/i_service" bindtap="goto"></image> 85 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" class="data-v-3a5b7e36" lazy-load="true" data-url="/pages/user/my_service/i_service" bindtap="goto"></image>
pages/user/grow_value/grow_value.js
@@ -182,7 +182,7 @@ Page({ @@ -182,7 +182,7 @@ Page({
182 var index=e.currentTarget.dataset.ind; 182 var index=e.currentTarget.dataset.ind;
183 switch (index) { 183 switch (index) {
184 case "0": getApp().goto("/pages/index/index/index");break; 184 case "0": getApp().goto("/pages/index/index/index");break;
185 - case "1": getApp().goto("/pages/user/coupons/coupons"); break; 185 + case "1": getApp().goto("/packageD/pages/user/coupons/coupons"); break;
186 case "2": getApp().goto("/pages/user/userqy/userqy"); break; 186 case "2": getApp().goto("/pages/user/userqy/userqy"); break;
187 } 187 }
188 }, 188 },
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: '/packageD/pages/user/deposit/deposit',
  507 + })
  508 + },
  509 + //--跳转到余额页面--
  510 + balance: function () {
  511 + if (!this.data.userInfo) return false;
  512 + wx.navigateTo({
  513 + url: '/packageD/pages/user/member/menber',
  514 + })
  515 + },
  516 + //--跳转到优惠券--
  517 + coupon: function () {
  518 + var th = this;
  519 + if (!this.data.userInfo) return false;
  520 + // th.sendsm();
  521 + wx.navigateTo({
  522 + url: '/packageD/pages/user/coupons/coupons',
  523 + })
  524 + },
  525 + //--跳转到积分--
  526 + integral: function () {
  527 + if (!this.data.userInfo) return false;
  528 + wx.navigateTo({
  529 + url: '/packageD/pages/user/integral/integral',
  530 + })
  531 + },
  532 + //--跳到绑定页面--
  533 + gobindtel: function () {
  534 + wx.navigateTo({
  535 + url: '/pages/togoin/togoin',
  536 + })
  537 + },
  538 +
  539 + go_order: function (e) {
  540 + if (!this.data.userInfo) return false;
  541 + var url = e.currentTarget.dataset.url;
  542 + wx.navigateTo({
  543 + url: url,
  544 + })
  545 +
  546 + },
  547 +
  548 + //--加载更多商品--
  549 + requestRecommend: function () {
  550 + var e = this,
  551 + t = '/api/weshop/goods/page?page=' + e.data.currentPage;
  552 + var th_recommend_list = e.data.recommend_list;
  553 + getApp().request.get(t, {
  554 + data: {
  555 + is_mainshow: 1,
  556 + isonsale: 1,
  557 + is_recommend: 1,
  558 + is_on_sale: 1,
  559 + store_id: os.stoid,
  560 + pageSize: 10
  561 + },
  562 + success: function (ee) {
  563 + var recommend_list = ee.data.data.pageData;
  564 + if (recommend_list && recommend_list.length > 0) {
  565 + var dd = [...th_recommend_list, ...recommend_list];
  566 + e.setData({
  567 + recommend_list,
  568 + dd
  569 + });
  570 + e.data.currentPage++;
  571 + } else {
  572 + e.setData({
  573 + nomore: 1
  574 + });
  575 + }
  576 + }
  577 + })
  578 + },
  579 +
  580 + //--跳转到权益页面--
  581 + go_qy: function () {
  582 + if (!this.data.userInfo) return false;
  583 + var url = "/pages/user/userqy/userqy";
  584 + getApp().goto(url);
  585 + },
  586 +
  587 + //--跳转到商品详情页面--
  588 + go_goods: function (e) {
  589 + var gid = e.currentTarget.dataset.gid;
  590 + var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid;
  591 + getApp().goto(url);
  592 + },
  593 +
  594 + click_next: function () {
  595 + var index = this.data.sw_index;
  596 + index++;
  597 + if (index >= this.data.qy_list.length) return;
  598 + this.setData({
  599 + sw_index: index
  600 + })
  601 + },
  602 +
  603 + click_pre: function () {
  604 + var index = this.data.sw_index;
  605 + index--;
  606 + if (index < 0) return;
  607 + this.setData({
  608 + sw_index: index
  609 + })
  610 + },
  611 +
  612 + onSli: function (e) {
  613 + var that = this;
  614 + that.setData({
  615 + sw_index: e.detail.current
  616 + })
  617 + },
  618 +
  619 + //--权益使用--
  620 + go_qy_url: function (e) {
  621 + var th = this;
  622 + var no = e.currentTarget.dataset.no;
  623 + var ind = e.currentTarget.dataset.ind;
  624 + var find = e.currentTarget.dataset.find;
  625 + var item = th.data.qy_list[find][ind];
  626 + if (item.ishas == undefined || !item.ishas) {
  627 + var qt_txt = th.selectComponent("#pop_txt"); //组件的id
  628 + var ob = {
  629 + title: "温馨提示",
  630 + content: "当前会员暂无此权益"
  631 + };
  632 + qt_txt.open(ob);
  633 + return false;
  634 + }
  635 +
  636 + var url = e.currentTarget.dataset.img;
  637 + if (!url || url == "") {
  638 + url = `/public/upload/userqy/quanbg.jpg`
  639 + }
  640 + switch (no) {
  641 + case "01":
  642 + getApp().goto("/packageB/pages/user/user_coupon/user_coupon?img=" +
  643 + url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
  644 + break;
  645 + case "02":
  646 + getApp().goto("/pages/user/user_fw/user_fw?gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
  647 + break;
  648 + case "03":
  649 + getApp().goto("/pages/user/user_spsy/user_spsy?img=" +
  650 + url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
  651 + break;
  652 + case "10":
  653 + getApp().request.get("/api/weshop/users/grade/vipprivilegelist/other/get", {
  654 + data: {
  655 + storeId: os.stoid,
  656 + formId: item.Id,
  657 + userId: getApp().globalData.user_id,
  658 + gradeId: th.data.gradeId
  659 + },
  660 + success: function (res) {
  661 + var val = res.data.data.Remark;
  662 + var title = res.data.data.PrivilegeName;
  663 + var qt_txt = th.selectComponent("#pop_txt"); //组件的id
  664 + var ob = {
  665 + title: title,
  666 + content: val
  667 + };
  668 + qt_txt.open(ob);
  669 + }
  670 + })
  671 + break;
  672 + }
  673 + },
  674 +
  675 + //跳转到链接
  676 + goto: function (e) {
  677 + var url = e.currentTarget.dataset.url;
  678 + getApp().goto(url);
  679 + },
  680 +
  681 + //---------联系客服------------
  682 + contactService: function () {
709 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/my_service/i_service.wxml
@@ -39,7 +39,8 @@ @@ -39,7 +39,8 @@
39 39
40 <view class="flex-center fs24 itemCount"> 40 <view class="flex-center fs24 itemCount">
41 <view>剩余次数:</view> 41 <view>剩余次数:</view>
42 - <view>{{item.ObtainTimes}}</view> 42 + <view wx:if="{{item.DisplayQty==true || DisplayQty==1}}">无限次</view>
  43 + <view wx:else>{{item.ObtainTimes}}</view>
43 </view> 44 </view>
44 45
45 <view class="flex-center fs24 itemEffective"> 46 <view class="flex-center fs24 itemEffective">
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) {