diff --git a/components/goods_list/g_filter.wxs b/components/goods_list/g_filter.wxs index 297810c..10a90ce 100644 --- a/components/goods_list/g_filter.wxs +++ b/components/goods_list/g_filter.wxs @@ -8,44 +8,54 @@ var g_filters = { //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- get_card_price:function(goods,all_card,type){ - var price1=parseInt(goods['cardprice1']); - var price2=parseInt(goods['cardprice2']); - var price3=parseInt(goods['cardprice3']); + var price1=parseFloat(goods['cardprice1']); + var price2 = parseFloat(goods['cardprice2']); + var price3 = parseFloat(goods['cardprice3']); if(!all_card){ if(type==0) return 0; return ""; - } - - var arr=[]; - var min_price= 0; - var min_name=""; + } + + var min_price=null; + var min_name=null; //---设置对应的价格名字---- for(var i=0;i<3;i++) { - var vl=all_card[i]; + var vl=all_card[i]; if(vl['CorrPrice']=="Price1" && price1>0) - arr.push({'price':price1, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price1;min_name=vl['CardName']; + } + else if(price10) - arr.push({'price':price2, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price2;min_name=vl['CardName']; + } + else if(price20) - arr.push({'price':price3, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price3;min_name=vl['CardName']; + } + else if(price34 ) min_name=min_name.substring(0, 4); return min_name; diff --git a/components/goods_list/goods_list.js b/components/goods_list/goods_list.js index 04e4275..11e118c 100644 --- a/components/goods_list/goods_list.js +++ b/components/goods_list/goods_list.js @@ -18,77 +18,89 @@ Component({ // 这里定义了innerText属性,属性值可以在组件使用时指定 }, ready: function () { - var th=this; - getApp().getConfig2(function(e){ - var swithc_list=e.switch_list; - var sw_arr=JSON.parse(swithc_list); - //---如果后台又开等级卡的开关--- - if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){ - th.setData({rank_switch:true}); - var user=getApp().globalData.userInfo; - var ti=setInterval(function(){ - if(!user) return false; - clearInterval(ti); - //---回调卡的列表--- - th.getPlusCardType(function(ob){ - th.setData({card_list:ob.card_list}); - if(user.card_field ){ - var str = user['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; - var now = ut.gettimestamp(); - - //--- 判断是等级会员,且在有效期范围内 --- - if(user.card_field && now4) card_name=card_name.substring(0,4); - th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list}); - } - } - }) - },500) - } - }) - + }, + methods: { + init:function(){ + var th = this; + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { + success: function (e) { + getApp().globalData.userInfo = e.data.data; + getApp().getConfig2(function (e) { + var swithc_list = e.switch_list; + var sw_arr = JSON.parse(swithc_list); + //---如果后台又开等级卡的开关--- + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + th.setData({ rank_switch: true }); + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + th.setData({ card_list: ob.card_list }); + var ti = setInterval(function () { + var user = getApp().globalData.userInfo; + if (!user) return false; + clearInterval(ti); - methods: { - - get_list:function(){ + if (user.card_field) { + var str = user['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + var now = ut.gettimestamp(); + + //--- 判断是等级会员,且在有效期范围内 --- + if (user.card_field && now < end) { + var card_name = ob.name_map.get(user.card_field); + if (card_name.length > 4) card_name = card_name.substring(0, 4); + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list }); + } + } + }, 500) + }) + + } + }) + } + }) + + }, + + + get_list:function(){ var that = this; - if(that.data.is_no_more==0) return false; + if (that.data.is_no_more == 0) return false; var curPage = that.data.curPage; - getApp().request.get('/api/weshop/goods/page?page',{ - data: { is_mainshow: 1, isonsale: 1, - is_recommend: 1, is_on_sale: 1, + getApp().request.get('/api/weshop/goods/page?page', { + data: { + is_mainshow: 1, isonsale: 1, + is_recommend: 1, is_on_sale: 1, store_id: o.stoid, page: curPage, - pageSize:6, - }, - success: function (res){ - var data=res.data; - var total=data.data.total; - if (total <= curPage*6){ - that.setData({ is_no_more: 0 }); - }else{ - that.data.curPage++; + pageSize: 6, + }, + success: function (res) { + var data = res.data; + var total = data.data.total; + if (total <= curPage * 6) { + that.setData({ is_no_more: 0 }); + } else { + that.data.curPage++; } - + //加载完成 if (data.data.pageData) { - that.setData({load_complete:1}); + that.setData({ load_complete: 1 }); } - if(that.data.recommend!=null){ - var ra=that.data.recommend.concat(data.data.pageData); + if (that.data.recommend != null) { + var ra = that.data.recommend.concat(data.data.pageData); that.setData({ recommend: ra }); - }else{ - that.setData({recommend:data.data.pageData}); + } else { + that.setData({ recommend: data.data.pageData }); } - } - }) + } + }) }, - + + bind_bnerr_xc: function (e) { var _errImg = e.target.dataset.errorimg; var _errurl = e.target.dataset.url; @@ -114,7 +126,7 @@ Component({ var name="card"+plusCard[i].CorrPrice.toLowerCase(); card_name_map.set(name,plusCard[i].CardName); } - + var ob={"card_list":plusCard,"name_map":card_name_map}; func(ob); }) diff --git a/components/goods_list/goods_list.wxss b/components/goods_list/goods_list.wxss index 9adcbbe..15429bb 100644 --- a/components/goods_list/goods_list.wxss +++ b/components/goods_list/goods_list.wxss @@ -151,6 +151,6 @@ color: #b9b9b9; } .line_th{ text-decoration: line-through} -.card_bg {display: flex; width: 106rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; +.card_bg {display: flex; width: 108rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; background: #333; color: #fff; justify-content: center; margin-left: 2rpx;} .card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx;} \ No newline at end of file diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 2377685..f99152a 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -705,10 +705,14 @@ Page({ if (g_arr[i].goods_id == val.goods_id) { //如果会员是等级会员,商品有等级价,且不是活动商品 - if(card_field && val[card_field]>0 && val.prom_type==0 ){ - + if(card_field && val[card_field]>0 && (val.prom_type==0 || val.prom_type==3 || val.prom_type==4 || val.prom_type==5) ){ + if (g_arr[i].goods_price != val[card_field]){ + isok = 0; + gname = val.goods_name; + throw "商品价格已经变化"; + } }else{ - if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price) { + if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price) { isok = 0; gname = val.goods_name; throw "商品价格已经变化"; diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 55ba3ec..191d706 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -414,6 +414,7 @@ Page({ case 2: case 3: case 4: + case 5: case 6: //--此时开始计算商品的使用券相关,如果有等级价还要计算和等级价相关的, // 如果有优惠促销,还要把促销的部分计算在内,因为促销还有不能使用优惠券-- diff --git a/pages/getphone/getphone.js b/pages/getphone/getphone.js index 0cebb37..c2a8042 100644 --- a/pages/getphone/getphone.js +++ b/pages/getphone/getphone.js @@ -15,9 +15,13 @@ Page({ var th=this,app = getApp(); var sessionKey = getApp().globalData.sessionKey; var openid = getApp().globalData.openid; + + if (openid == "" || openid == null) { + openid = getApp().globalData.userInfo.weapp_openid; + } if(openid=="" || openid==null ){ - getApp().globalData.user_id=null; + getApp().globalData.user_id=null; getApp().globalData.userInfo=null; console.log("openid"); wx.navigateTo({ url: '/pages/togoin/togoin', }) diff --git a/pages/goods/goodsInfo/g_filter.wxs b/pages/goods/goodsInfo/g_filter.wxs index 2b77cdb..65a4f4b 100644 --- a/pages/goods/goodsInfo/g_filter.wxs +++ b/pages/goods/goodsInfo/g_filter.wxs @@ -8,9 +8,9 @@ var g_filters = { //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- get_card_price:function(goods,all_card,type){ - var price1=parseInt(goods['cardprice1']); - var price2=parseInt(goods['cardprice2']); - var price3=parseInt(goods['cardprice3']); + var price1=parseFloat(goods['cardprice1']); + var price2=parseFloat(goods['cardprice2']); + var price3=parseFloat(goods['cardprice3']); if(!all_card){ if(type==0) return 0; return ""; @@ -18,22 +18,51 @@ var g_filters = { var arr=[]; var min_price= 0; - var min_name=""; + var min_name=""; + + var min_price=null; + var min_name=null; //---设置对应的价格名字---- for(var i=0;i<3;i++) { - var vl=all_card[i]; + var vl=all_card[i]; if(vl['CorrPrice']=="Price1" && price1>0) - arr.push({'price':price1, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price1;min_name=vl['CardName']; + } + else if(price10) - arr.push({'price':price2, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price2;min_name=vl['CardName']; + } + else if(price20) - arr.push({'price':price3, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price3;min_name=vl['CardName']; + } + else if(price35 ) min_name=min_name.substring(0, 5); + //min_price=min.price; + //min_name=min.name; + if(type==0) return min_price.toFixed(2); + if(min_name.length>4 ) min_name=min_name.substring(0, 4); return min_name; }, } diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 2ec65d4..cbe4ee7 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -202,7 +202,6 @@ Page({ canvasHidden: 1, //--推荐-- - recommend_list: [], store_config: null, is_show_pl: 0, //是否品类 is_show_pp: 0, //是否品牌 @@ -236,6 +235,9 @@ Page({ //------初始化加载---------- onLoad: function(t) { + + + wx.setNavigationBarTitle({ title: "商品详情", }) @@ -294,34 +296,36 @@ Page({ //---如果后台又开等级卡的开关--- if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){ th.setData({rank_switch:true}); - var user=getApp().globalData.userInfo; - var ti=setInterval(function(){ - if(!user) return false; - clearInterval(ti); + //---回调卡的列表--- th.getPlusCardType(function(ob){ - th.setData({card_list:ob.card_list}); - if(user.card_field ){ - var str = user['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; - var now = ut.gettimestamp(); - //--- 判断是等级会员,且在有效期范围内 --- - if(user.card_field && now5) card_name=card_name.substring(0,5); - - var is_near_date=0; - if(end-now<60*60*30*24) is_near_date=1; //如果小于30天 - th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list,is_near_date:is_near_date}); - } - } + th.setData({card_list:ob.card_list}); + var ti = setInterval(function () { + var user = getApp().globalData.userInfo; + if (!user) return false; + clearInterval(ti); + + + if(user.card_field ){ + var str = user['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + var now = ut.gettimestamp(); + //--- 判断是等级会员,且在有效期范围内 --- + if(user.card_field && now5) card_name=card_name.substring(0,5); + + var is_near_date=0; + if(end-now<60*60*30*24) is_near_date=1; //如果小于30天 + th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list,is_near_date:is_near_date}); + } + } + }, 500) }) - },500) + } - - - + }); //获取用户设备信息,屏幕宽度 @@ -496,12 +500,21 @@ Page({ mapurl: mapurl, }); - ee.requestRecommend(); }, //---展示--- onShow: function() { + var goods_list = null,th = this; + var ui = setInterval(function () { + goods_list = th.selectComponent("#goods_list"); + if (goods_list) { + clearInterval(ui); + goods_list.init(); + return false + } + }, 300) + this.data.is_timer = 1; var ee = this, @@ -569,7 +582,7 @@ Page({ //获取门店 ee.get_sto(); //获取统一条形码,普通商品和优惠促销的商品 - if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3) + if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5) ee.get_sku(o.stoid, t.data.data.sku, gid); else { var gg = "", @@ -638,6 +651,9 @@ Page({ this.data.enterAddressPage && (this.data.enterAddressPage = !1); + + + }, enterAddress: function() { @@ -1555,13 +1571,16 @@ Page({ if (this.data.activeCategoryId == 2){ if(!this.data.comments_no_more) this.requestComments_new(); } + + var goods_list = this.selectComponent("#goods_list"); //组件的id + goods_list.get_list(); }, //--------检查是否活动,活动是否开始,或者是否结束------- async check_prom(gid, prom_type, prom_id) { var ee = this, th = ee; - if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 4) { + if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 4 || prom_type == 5) { this.setData({ prom_type: 0, isshow: 1, @@ -2889,37 +2908,6 @@ Page({ }, - //--加载更多商品-- - requestRecommend: function() { - var e = this, - t = '/api/weshop/goods/page?page=1'; - var th_recommend_list = e.data.recommend_list; - getApp().request.get(t, { - data: { - is_mainshow: 1, - isonsale: 1, - is_recommend: 1, - is_on_sale: 1, - store_id: os.stoid, - pageSize: 6 - }, - success: function(ee) { - var recommend_list = ee.data.data.pageData; - if (recommend_list && recommend_list.length > 0) { - var dd = [...th_recommend_list, ...recommend_list]; - e.setData({ - recommend_list, - dd - }); - e.data.currentPage++; - } else { - e.setData({ - nomore: 1 - }); - } - } - }) - }, //--获取头像的本地缓存,回调写法-- get_head_temp: function(tt, func) { diff --git a/pages/goods/goodsInfo/goodsInfo.json b/pages/goods/goodsInfo/goodsInfo.json index faef7a3..7e2283d 100644 --- a/pages/goods/goodsInfo/goodsInfo.json +++ b/pages/goods/goodsInfo/goodsInfo.json @@ -3,6 +3,7 @@ "enablePullDownRefresh": false, "usingComponents": { "nav_box": "/components/nav_box/nav_box", - "warn": "/components/long_warn/long_warn" + "warn": "/components/long_warn/long_warn", + "goods_recommend": "/components/goods_list/goods_list" } } \ No newline at end of file diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index a4bff08..7bf7aa6 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -229,12 +229,15 @@ - + {{card_name}} {{filters.toFix(data[card_field],2)}} + + 原价:¥{{data.market_price}} + {{ filters.toFix(data.shop_price,2)}} @@ -255,7 +258,10 @@ {{g_filters.get_card_price(data,card_list,1)}} - {{g_filters.get_card_price(data,card_list,0)}} + + + ¥{{g_filters.get_card_price(data,card_list,0)}} + @@ -269,7 +275,7 @@ {{g_filters.get_card_price(data,card_list,1)}} - 成为黄钻卡会员立省{{data.market_price-g_filters.get_card_price(data,card_list,0)}} + 成为{{g_filters.get_card_price(data,card_list,1)}}立省{{data.market_price-g_filters.get_card_price(data,card_list,0)}} 开通会员 尽享更多优惠 @@ -281,7 +287,7 @@ - + - - - - - - - - - {{item.shop_price}} - - 原价¥{{item.market_price}} - - {{item.goods_name}} - - - - + @@ -807,7 +797,7 @@ - + ¥ {{sele_g[card_field]}} @@ -902,7 +892,7 @@ - + ¥ {{sele_g[card_field]}} diff --git a/pages/goods/goodsInfo/goodsInfo.wxss b/pages/goods/goodsInfo/goodsInfo.wxss index fe14616..e533e88 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxss +++ b/pages/goods/goodsInfo/goodsInfo.wxss @@ -2298,4 +2298,8 @@ right:17rpx; top:55rpx; transform: rotate(45deg);display:inline-block; margin-bottom:3rpx; +} +.carde_frame{ + height: 50rpx; + line-height: 18rpx } \ No newline at end of file diff --git a/pages/goods/goodsList/g_filter.wxs b/pages/goods/goodsList/g_filter.wxs index 297810c..eea87b8 100644 --- a/pages/goods/goodsList/g_filter.wxs +++ b/pages/goods/goodsList/g_filter.wxs @@ -8,44 +8,55 @@ var g_filters = { //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- get_card_price:function(goods,all_card,type){ - var price1=parseInt(goods['cardprice1']); - var price2=parseInt(goods['cardprice2']); - var price3=parseInt(goods['cardprice3']); - if(!all_card){ + var price1=parseFloat(goods['cardprice1']); + var price2=parseFloat(goods['cardprice2']); + var price3=parseFloat(goods['cardprice3']); + + if(!all_card){ if(type==0) return 0; return ""; - } - - var arr=[]; - var min_price= 0; - var min_name=""; + } + + var min_price=null; + var min_name=null; //---设置对应的价格名字---- for(var i=0;i<3;i++) { - var vl=all_card[i]; + var vl=all_card[i]; if(vl['CorrPrice']=="Price1" && price1>0) - arr.push({'price':price1, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price1;min_name=vl['CardName']; + } + else if(price10) - arr.push({'price':price2, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price2;min_name=vl['CardName']; + } + else if(price20) - arr.push({'price':price3, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price3;min_name=vl['CardName']; + } + else if(price34 ) min_name=min_name.substring(0, 4); return min_name; diff --git a/pages/goods/goodsList/goodsList.wxml b/pages/goods/goodsList/goodsList.wxml index 38290d2..735d087 100644 --- a/pages/goods/goodsList/goodsList.wxml +++ b/pages/goods/goodsList/goodsList.wxml @@ -66,11 +66,11 @@ ¥{{item.shop_price}} - ¥{{item.market_price}} + ¥{{item.market_price}} - ¥{{g_filter.get_card_price(item,card_list,0)}} + ¥{{g_filter.get_card_price(item,card_list,0)}} {{g_filter.get_card_price(item,card_list,1)}} diff --git a/pages/goods/goodsList/goodsList.wxss b/pages/goods/goodsList/goodsList.wxss index 0db3679..2029a59 100644 --- a/pages/goods/goodsList/goodsList.wxss +++ b/pages/goods/goodsList/goodsList.wxss @@ -92,6 +92,7 @@ .price { display: inline-block; color: #f23030; + line-height: 24rpx; /* padding-bottom: 20rpx; */ } @@ -155,6 +156,8 @@ width: 300rpx; } -.card_bg {display: flex; width: 106rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; -background: #333; color: #fff; justify-content: center; margin-left: 4rpx;} -.card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx;} +.card_bg {display: flex; width: 110rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; +background: #333; color: #fff; justify-content: center; margin-left: 3rpx; margin-top:7rpx; line-height: 28rpx;} +.card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx; vertical-align: middle} +.mk_price{margin-left: 10rpx; font-size: 25rpx;} +.item-cont{ line-height: 38rpx} \ No newline at end of file diff --git a/pages/goods/search/g_filter.wxs b/pages/goods/search/g_filter.wxs index 297810c..e28ecb8 100644 --- a/pages/goods/search/g_filter.wxs +++ b/pages/goods/search/g_filter.wxs @@ -8,49 +8,61 @@ var g_filters = { //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- get_card_price:function(goods,all_card,type){ - var price1=parseInt(goods['cardprice1']); - var price2=parseInt(goods['cardprice2']); - var price3=parseInt(goods['cardprice3']); - if(!all_card){ + var price1 = parseFloat(goods['cardprice1']); + var price2 = parseFloat(goods['cardprice2']); + var price3 = parseFloat(goods['cardprice3']); + + if(!all_card){ if(type==0) return 0; return ""; - } - - var arr=[]; - var min_price= 0; - var min_name=""; + } + + var min_price=null; + var min_name=null; //---设置对应的价格名字---- for(var i=0;i<3;i++) { - var vl=all_card[i]; + var vl=all_card[i]; if(vl['CorrPrice']=="Price1" && price1>0) - arr.push({'price':price1, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price1;min_name=vl['CardName']; + } + else if(price10) - arr.push({'price':price2, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price2;min_name=vl['CardName']; + } + else if(price20) - arr.push({'price':price3, 'name':vl['CardName']}); + { + if(min_price==null) { + min_price=price3;min_name=vl['CardName']; + } + else if(price34 ) min_name=min_name.substring(0, 4); return min_name; }, } + module.exports = { is_has_rank:g_filters.is_has_rank, get_card_price:g_filters.get_card_price, diff --git a/pages/goods/search/search.wxml b/pages/goods/search/search.wxml index 71dc07a..9f28aa8 100644 --- a/pages/goods/search/search.wxml +++ b/pages/goods/search/search.wxml @@ -62,11 +62,11 @@ ¥{{item.shop_price}} - ¥{{item.market_price}} + ¥{{item.market_price}} - ¥{{g_filter.get_card_price(item,card_list,0)}} + ¥{{g_filter.get_card_price(item,card_list,0)}} {{g_filter.get_card_price(item,card_list,1)}} diff --git a/pages/goods/search/search.wxss b/pages/goods/search/search.wxss index 0176b95..f1920c3 100644 --- a/pages/goods/search/search.wxss +++ b/pages/goods/search/search.wxss @@ -92,6 +92,7 @@ .price { display: inline-block; color: #f23030; + line-height: 24rpx; /* padding-bottom: 20rpx; */ } @@ -226,6 +227,8 @@ margin-left: 15rpx; } -.card_bg {display: flex; width: 106rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; -background: #333; color: #fff; justify-content: center; margin-left: 2rpx;} -.card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx;} +.card_bg {display: flex; width: 110rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; +background: #333; color: #fff; justify-content: center; margin-left: 3rpx; margin-top:7rpx; line-height: 28rpx;} +.card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx; vertical-align: middle} +.mk_price{margin-left: 10rpx; font-size: 25rpx;} +.item-cont{ line-height: 38rpx} diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 5e01fbb..6231d92 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -314,7 +314,8 @@ Page({ }); var goods_list = this.selectComponent("#goods_list"); //组件的id - goods_list.get_list(); + goods_list.init(); + setTimeout(function () { goods_list.get_list();},300) }, //--判断小程序是否过期-- diff --git a/pages/user/Change_phone/Change_phone.js b/pages/user/Change_phone/Change_phone.js index a1d979a..33a7e7f 100644 --- a/pages/user/Change_phone/Change_phone.js +++ b/pages/user/Change_phone/Change_phone.js @@ -14,21 +14,35 @@ Page({ inputxphone: 0, mobile: null, //旧手机号码 currentTime: "", //验证码发送倒计时 - getvcode: "获取验证码", + getvcode: "获取验证码", //显示文字 + time_len: 0, //重新获取时长 wxopenid: null, isver: 0, //是否有发送验证码 code: "", //验证码 - url: "", //确认更换手机号码跳转路径 change_phone: "", //新手机号码 + send: 1, //发送类型 }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { - this.setData({ - mobile: options.mobile, - wxopenid: options.openid + var th = this; + var pages = getCurrentPages(); + var prevPage = pages[pages.length - 2]; //上一个页面 + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 + prevPage.setData({ + is_zy: 1 + }) + getApp().getConfig2(function(ee) { + var sms_conf = ee.sms_send_type; + sms_conf = JSON.parse(sms_conf); + th.setData({ + mobile: getApp().globalData.userInfo.mobile, + wxopenid: getApp().globalData.userInfo.weapp_openid, + time_len: sms_conf.time_out + }) }) + }, //获取手机验证码 Ver_phone: function() { @@ -37,6 +51,7 @@ Page({ var wxopenid = th.data.wxopenid; var change_phone = th.data.change_phone; var isver = th.data.isver; + var send = th.data.send; var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; if (mobile.length < 11) { getApp().my_warnning("请输入11位的手机号码", 0, th); @@ -61,7 +76,7 @@ Page({ getApp().request.post("/api/weshop/smslog/sendsms", { data: { store_id: r.stoid, - scene: 1, //发送类型(1短信 2语音) + scene: send, //发送类型(1短信 2语音) mobile: mobile, wxopenid: wxopenid }, @@ -69,14 +84,15 @@ Page({ if (res.data.code == 0) { th.setData({ isver: 0, - getvcode: 60, + getvcode: th.data.time_len, currentTime: setInterval(th.gettime, 1000), + send: 2 }) } else { getApp().my_warnning(res.data.msg, 0, th); th.setData({ isver: 0, - getvcode: "重新获取" + getvcode: "重新获取", }) return false; } @@ -106,21 +122,22 @@ Page({ if (change_phone.length > 1) { mobile = change_phone } - getApp().request.put("/api/weshop/users/updateMobile/" + r.stoid + '/' + o.user_id + '/' + code + '/' + mobile, { - success: function(res) { - if (res.data.code == 0) { - getApp().my_warnning("更换成功", 0, th); - th.setData({ - url: "/pages/user/userinfo/userinfo?change_phone" + change_phone - }) - } else { - getApp().my_warnning(res.data.msg, 0, th); - return false; - } + getApp().request.put("/api/weshop/users/updateMobile/" + r.stoid + '/' + o.user_id + '/' + code + '/' + mobile, { + success: function(res) { + if (res.data.code == 0) { + var url = "/pages/user/userinfo/userinfo?change_phone" + change_phone + getApp().globalData.userInfo.mobile = mobile; + getApp().my_warnning("更换成功", 0, th); + getApp().goto(url); + } else { + getApp().my_warnning(res.data.msg, 0, th); + return false; } - }) - + + } + }) + }, //判断验证码是否正确 ver_code: function(e) { diff --git a/pages/user/Change_phone/Change_phone.wxml b/pages/user/Change_phone/Change_phone.wxml index 96da9ff..be714c2 100644 --- a/pages/user/Change_phone/Change_phone.wxml +++ b/pages/user/Change_phone/Change_phone.wxml @@ -12,7 +12,7 @@ {{mobile}} - + @@ -51,10 +51,9 @@ 确定更换 - + - \ No newline at end of file diff --git a/pages/user/address_list/address_list.js b/pages/user/address_list/address_list.js index b5caeec..ce198f7 100644 --- a/pages/user/address_list/address_list.js +++ b/pages/user/address_list/address_list.js @@ -15,7 +15,12 @@ Page({ is_address_read:0 }, onLoad: function (e) { - + var pages = getCurrentPages(); + var prevPage = pages[pages.length - 2]; //上一个页面 + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 + prevPage.setData({ + is_zy: 1 + }) //清空is_pick_up getApp().request.put("/api/weshop/useraddress/updatePickUp", { data: {user_id: getApp().globalData.user_id, is_pickup: 0}, diff --git a/pages/user/address_list/address_list.wxml b/pages/user/address_list/address_list.wxml index 2cd0d7d..26def32 100644 --- a/pages/user/address_list/address_list.wxml +++ b/pages/user/address_list/address_list.wxml @@ -21,7 +21,7 @@ - + diff --git a/pages/user/cardinfo/cardinfo.js b/pages/user/cardinfo/cardinfo.js index be1f175..d3aaa6b 100644 --- a/pages/user/cardinfo/cardinfo.js +++ b/pages/user/cardinfo/cardinfo.js @@ -53,7 +53,7 @@ Page({ */ onLoad: function (options) { var that = this,ee=this; - + var th=this; //-----------等级卡说明------------------- getApp().request.promiseGet("/api/weshop/storeconfig/get/" + os.stoid, { }).then(res => { @@ -106,8 +106,7 @@ Page({ }) } }) - var goods_list = this.selectComponent("#goods_list"); //组件的id - goods_list.get_list(); + }, @@ -307,7 +306,7 @@ Page({ ///二微码 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + - os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/index/index"; + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/plus/plus"; wx.getImageInfo({ src: path3, success: function (res) { @@ -635,6 +634,9 @@ Page({ //同步初始化 this.init(); + var goods_list = this.selectComponent("#goods_list"); //组件的id + goods_list.init(); + goods_list.get_list(); }, diff --git a/pages/user/collect_list/collect_list.js b/pages/user/collect_list/collect_list.js index 0cc324b..5d7c3ea 100644 --- a/pages/user/collect_list/collect_list.js +++ b/pages/user/collect_list/collect_list.js @@ -49,9 +49,8 @@ Page({ is_goods: 1 }) var goods_list = th.selectComponent("#goods_recommend"); //组件的id - goods_list.get_list(); - - + goods_list.init(); + setTimeOut(function () { goods_list.get_list(); }, 300) } }); }, diff --git a/pages/user/index/index.js b/pages/user/index/index.js index b5ab482..8bb7ac5 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -38,8 +38,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - var goods_list = this.selectComponent("#goods_recommend"); //组件的id - goods_list.get_list(); + }, /** * 生命周期函数--监听页面显示 @@ -217,6 +216,10 @@ Page({ } }); + var goods_list = this.selectComponent("#goods_recommend"); //组件的id + goods_list.init(); + goods_list.get_list(); + }, //判断会员是后有改服务项目 @@ -252,8 +255,9 @@ Page({ */ onReachBottom: function () { //!this.nomore && this.requestRecommend(); - var goods_list = this.selectComponent("#goods_recommend"); //组件的id - goods_list.get_list(); + var goods_list = this.selectComponent("#goods_recommend"); //组件的id + goods_list.init(); + setTimeOut(function () { goods_list.get_list(); }, 300) }, /** diff --git a/pages/user/index/index.json b/pages/user/index/index.json index 420bee0..8421248 100644 --- a/pages/user/index/index.json +++ b/pages/user/index/index.json @@ -1,7 +1,7 @@ { "usingComponents": { "pop_txt": "/components/userqy_pop_up/userqy_pop_up", - "goods_recommend": "/components/goods_list/goods_list" + "goods_recommend": "/components/goods_list/goods_list" }, "navigationBarTitleText": "会员中心" } \ No newline at end of file diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js index 976c270..f78b016 100644 --- a/pages/user/plus/plus.js +++ b/pages/user/plus/plus.js @@ -36,7 +36,7 @@ Page({ is_fengxiang: 0, //是不是分享过来的 def_recommon: null, //分享人的手机号 def_serviceman: null, //分享人的营业员 - fir_leader:0, + fir_leader:0, //分享人的ID }, swiperChange: function (e) { @@ -49,8 +49,8 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - var that = this; - var store_id=getApp().globalData.setting.stoid; + var that = this,th=that; + var store_id=getApp().globalData.setting.stoid; //获取用户设备信息,屏幕宽度 wx.getSystemInfo({ success: res => { @@ -58,9 +58,43 @@ Page({ } }) var fir_leader = options.scene; - that.setData({fir_leader:fir_leader}) + that.setData({fir_leader:fir_leader}) + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ url: '/pages/getphone/getphone?first_leader=' + fir_leader, }) + return false; + } + //-----------商家配置信息----- 等级卡规则,是否又开邀请码,营业员------------ + getApp().request.get("/api/weshop/storeconfig/get/" + store_id, { + success: function (res) { + var is_cardrule = res.data.data.cardrules; + var switch_list= res.data.data.switch_list; + var swi_arr=JSON.parse(switch_list); + + w.wxParse("content", "html", is_cardrule, that, 6); + that.setData({ + is_card_rule: is_cardrule, + isyaoqingma:parseInt(swi_arr.isyaoqingma), + is_salesman:parseInt(swi_arr.is_staffno) + }); + } + }); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + var user_info = getApp().globalData.userInfo; + if(!user_info) return false; + + var th=this,that=th,app_d=getApp().globalData; + var store_id=os.stoid; + var fir_leader=this.data.fir_leader; + if (fir_leader != null && fir_leader != undefined && fir_leader != "") { - var r_url="/api/weshop/plus/vip/mem/list?storeId=" + store_id + "&userId=" + fir_leader + var r_url = "/api/weshop/plus/vip/mem/list?storeId=" + store_id + "&userId=" + fir_leader getApp().request.get(r_url, { success: function (res) { var is_ok = 1; @@ -92,40 +126,16 @@ Page({ that.back_user(); } if (is_ok == 1) { - that.setData({def_recommon: user_information.MobileTel, def_serviceman: user_information.StaffNo,is_fengxiang:1}) - //--先判断会员状态-- - var user_info=getApp().globalData.userInfo; - if(user_info==null || user_info.mobile==undefined || user_info.mobile=="" || user_info.mobile==null){ - wx.navigateTo({ url: '/pages/getphone/getphone?first_leader='+fir_leader, }) - return false; - } + //--保存或者更新会员信息-- + that.setData({ def_recommon: user_information.MobileTel, def_serviceman: user_information.StaffNo, is_fengxiang: 1 }) + th.save_th_plus_user(); } } }); + } else { + th.get_user_plus(); } - //-----------商家配置信息----- 等级卡规则,是否又开邀请码,营业员------------ - getApp().request.get("/api/weshop/storeconfig/get/" + store_id, { - success: function (res) { - var is_cardrule = res.data.data.cardrules; - var switch_list= res.data.data.switch_list; - var swi_arr=JSON.parse(switch_list); - - w.wxParse("content", "html", is_cardrule, that, 6); - that.setData({ - is_card_rule: is_cardrule, - isyaoqingma:parseInt(swi_arr.isyaoqingma), - is_salesman:parseInt(swi_arr.is_staffno) - }); - } - }); - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - var th=this,app_d=getApp().globalData; getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + app_d.user_id, { success: function (e) { var userInfo = e.data.data; @@ -136,7 +146,7 @@ Page({ }, }); - this.getPlusCardType(); + this.getPlusCardType(); }, /** @@ -190,6 +200,7 @@ Page({ is_plusCard: plusCard, is_show: 1 }) var goods_list = th.selectComponent("#goods_list"); //组件的id + goods_list.init(); goods_list.get_list(); }) @@ -301,6 +312,78 @@ Page({ var ob={}; ob[name]=value this.setData(ob); - } + }, + + get_user_plus:async function(){ + var user_id=getApp().globalData.user_id; + var fuser=null; + var user_information =null; + var store_id = os.stoid; + var that=this; + //--获取登记卡邀请信息-- + await getApp().request.promiseGet("/api/weshop/usersPlus/get/" + os.stoid + "/" + user_id,{1:1}).then(res=>{ + if (res.data.code==0){ + fuser=res.data.data; + } + }) + if (!fuser) return false; + var r_url = "/api/weshop/plus/vip/mem/list?storeId=" + store_id + "&userId=" + fuser.plus_user_id; + //--获取等级卡信息-- + await getApp().request.promiseGet(r_url,{1:1}).then(res=>{ + if (res.data.code == 0) { + user_information = res.data.data[0]; + } + }) + if (user_information){ + var now = ut.gettimestamp(); + var is_ok = 1; + if (user_information['ExpiryDate']) { + var str = user_information['ExpiryDate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + if (end < now) { is_ok = 0;} + } else { + is_ok = 0; + } + if (is_ok == 1) { + var fir_leader=fuser.plus_user_id + that.setData({ def_recommon: user_information.MobileTel, def_serviceman: user_information.StaffNo, is_fengxiang: 1,fir_leader:fir_leader }) + //--先判断会员状态-- + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ url: '/pages/getphone/getphone?first_leader=' + fir_leader, }) + return false; + } + } + } + }, + + save_th_plus_user:async function(){ + var f_user_id=this.data.fir_leader; + if (f_user_id){ + var user_id = getApp().globalData.user_id; + var user_plus = null; + var now=ut.gettimestamp(); + //--获取登记卡邀请信息-- + await getApp().request.promiseGet("/api/weshop/usersPlus/get/" + os.stoid + "/" + user_id, { 1: 1 }).then(res => { + if (res.data.code == 0) { + user_plus = res.data.data; + } + }) + + //--如果有值,要更新-- + if (!user_plus){ + getApp().request.post("/api/weshop/usersPlus/save", { + data: { store_id: os.stoid, user_id: user_id, plus_user_id: f_user_id, addtime: now }, + success: function (res) { } + }) + }else{ + getApp().request.put("/api/weshop/usersPlus/update",{ + data: { store_id: os.stoid, user_id: user_id, plus_user_id: f_user_id, edittime: now}, + success:function(res){ } + }) + } + } + } }) \ No newline at end of file diff --git a/pages/user/plus/plus.wxml b/pages/user/plus/plus.wxml index 069a0bc..26a54c5 100644 --- a/pages/user/plus/plus.wxml +++ b/pages/user/plus/plus.wxml @@ -18,7 +18,7 @@ {{item.CardName}} - 开通会员年卡仅{{item.CardFee}}元 + 开通会员卡仅{{item.CardFee}}元 立即购买 diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index e92182d..f0361d6 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -2,7 +2,7 @@ function e(e, a, r) { return a in e ? Object.defineProperty(e, a, { value: r, enumerable: !0, - configurable: !0, + configurable: !0, writable: !0 }) : e[a] = r, e; } @@ -58,7 +58,8 @@ Page({ gradename:"",//会员权益的卡 isBool:"", sto_sele_id:"",//所属门店id - is_zy:0, + is_zy:0, + }, //是否启动密码消费 isstcsp:function(){ @@ -504,7 +505,7 @@ Page({ }, //------初始化加载---------- onLoad: function(t) { - + console.log("oNLOAD", "你好"); var user=getApp().globalData.userInfo; if(user.card_field!=''&& user.card_field!=null && user.card_field!=undefined){ var now=ut.gettimestamp(); @@ -568,14 +569,15 @@ Page({ }, onShow: function() { + console.log(this.data.is_zy ,"是什么东西"); if(this.data.is_zy) return false; this.wait_for_store_config(); + console.log(this.data.is_zy, "sssss是什么东西"); var e = this; var req = t; req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, { success: function (src) { var a=src.data.data; - console.log(a,"剩什么llllll",a.data); var time = util.formatTime(a.reg_time,"'Y/M/D"); var birthday = util.formatTime(a.birthday, "'Y/M/D"); a.reg_time = time; @@ -785,7 +787,11 @@ Page({ } }) } , - + //选择地址 + goto_address:function(){ + // this.setData({ is_zy: 1 }); + }, + //更换手机 go_phone:function(e){ var url=e.currentTarget.dataset.url; this.setData({is_zy:1}); diff --git a/pages/user/userinfo/userinfo.wxml b/pages/user/userinfo/userinfo.wxml index 50e05a6..d79bdc5 100644 --- a/pages/user/userinfo/userinfo.wxml +++ b/pages/user/userinfo/userinfo.wxml @@ -17,7 +17,7 @@ - + {{gradename}} @@ -159,7 +159,7 @@ --> - + 更换手机 {{phone}} @@ -187,7 +187,7 @@ - + 收货地址 @@ -201,11 +201,11 @@ - + 确认修改 - +