diff --git a/pages/goods/goodsInfo/g_filter.wxs b/pages/goods/goodsInfo/g_filter.wxs index a663201..65a4f4b 100644 --- a/pages/goods/goodsInfo/g_filter.wxs +++ b/pages/goods/goodsInfo/g_filter.wxs @@ -75,7 +75,7 @@ var g_filters = { //-- 获取最下价钱,和相应的卡的名称 -- //min_price=min.price; //min_name=min.name; - if(type==0) return min_price; + 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/goodsList/goodsList.wxml b/pages/goods/goodsList/goodsList.wxml index d4c7908..735d087 100644 --- a/pages/goods/goodsList/goodsList.wxml +++ b/pages/goods/goodsList/goodsList.wxml @@ -66,7 +66,7 @@ ¥{{item.shop_price}} - ¥{{item.market_price}} + ¥{{item.market_price}} diff --git a/pages/goods/goodsList/goodsList.wxss b/pages/goods/goodsList/goodsList.wxss index 71b6d15..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; */ } @@ -156,5 +157,7 @@ } .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: 2rpx; margin-top:8rpx; line-height: 28rpx;} +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/search.wxml b/pages/goods/search/search.wxml index b6eff6f..9f28aa8 100644 --- a/pages/goods/search/search.wxml +++ b/pages/goods/search/search.wxml @@ -62,7 +62,7 @@ ¥{{item.shop_price}} - ¥{{item.market_price}} + ¥{{item.market_price}} diff --git a/pages/goods/search/search.wxss b/pages/goods/search/search.wxss index fc2c120..f1920c3 100644 --- a/pages/goods/search/search.wxss +++ b/pages/goods/search/search.wxss @@ -92,8 +92,7 @@ .price { display: inline-block; color: #f23030; - height: 20rpx; - line-height: 20rpx; + line-height: 24rpx; /* padding-bottom: 20rpx; */ } @@ -229,5 +228,7 @@ } .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: 2rpx; margin-top:8rpx; line-height: 28rpx;} +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 add2847..6231d92 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -315,7 +315,7 @@ Page({ }); var goods_list = this.selectComponent("#goods_list"); //组件的id goods_list.init(); - setTimeOut(function () { goods_list.get_list();},300) + setTimeout(function () { goods_list.get_list();},300) }, //--判断小程序是否过期-- diff --git a/pages/user/cardinfo/cardinfo.js b/pages/user/cardinfo/cardinfo.js index 11a762c..d3aaa6b 100644 --- a/pages/user/cardinfo/cardinfo.js +++ b/pages/user/cardinfo/cardinfo.js @@ -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/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