Commit b79b3968fcc67863bbdab9b789a5bedbb3202ae2
1 parent
3b65f194
等级卡价格显示的页面调整, 等级卡分享ID的优化完
Showing
8 changed files
with
136 additions
and
47 deletions
pages/goods/goodsInfo/g_filter.wxs
@@ -75,7 +75,7 @@ var g_filters = { | @@ -75,7 +75,7 @@ var g_filters = { | ||
75 | //-- 获取最下价钱,和相应的卡的名称 -- | 75 | //-- 获取最下价钱,和相应的卡的名称 -- |
76 | //min_price=min.price; | 76 | //min_price=min.price; |
77 | //min_name=min.name; | 77 | //min_name=min.name; |
78 | - if(type==0) return min_price; | 78 | + if(type==0) return min_price.toFixed(2); |
79 | if(min_name.length>4 ) min_name=min_name.substring(0, 4); | 79 | if(min_name.length>4 ) min_name=min_name.substring(0, 4); |
80 | return min_name; | 80 | return min_name; |
81 | }, | 81 | }, |
pages/goods/goodsList/goodsList.wxml
@@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
66 | <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}"> | 66 | <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}"> |
67 | <view class="flex ai-center"> | 67 | <view class="flex ai-center"> |
68 | <view class="price">¥{{item.shop_price}}</view> | 68 | <view class="price">¥{{item.shop_price}}</view> |
69 | - <view class="word-line">¥{{item.market_price}}</view> | 69 | + <view class="word-line xc-ash mk_price">¥{{item.market_price}}</view> |
70 | </view> | 70 | </view> |
71 | <view class="comment flex jc_sb"> | 71 | <view class="comment flex jc_sb"> |
72 | <view class="flex"> | 72 | <view class="flex"> |
pages/goods/goodsList/goodsList.wxss
@@ -92,6 +92,7 @@ | @@ -92,6 +92,7 @@ | ||
92 | .price { | 92 | .price { |
93 | display: inline-block; | 93 | display: inline-block; |
94 | color: #f23030; | 94 | color: #f23030; |
95 | + line-height: 24rpx; | ||
95 | /* padding-bottom: 20rpx; */ | 96 | /* padding-bottom: 20rpx; */ |
96 | } | 97 | } |
97 | 98 | ||
@@ -156,5 +157,7 @@ | @@ -156,5 +157,7 @@ | ||
156 | } | 157 | } |
157 | 158 | ||
158 | .card_bg {display: flex; width: 110rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; | 159 | .card_bg {display: flex; width: 110rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; |
159 | -background: #333; color: #fff; justify-content: center; margin-left: 2rpx; margin-top:8rpx; line-height: 28rpx;} | 160 | +background: #333; color: #fff; justify-content: center; margin-left: 3rpx; margin-top:7rpx; line-height: 28rpx;} |
160 | .card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx; vertical-align: middle} | 161 | .card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx; vertical-align: middle} |
162 | +.mk_price{margin-left: 10rpx; font-size: 25rpx;} | ||
163 | +.item-cont{ line-height: 38rpx} | ||
161 | \ No newline at end of file | 164 | \ No newline at end of file |
pages/goods/search/search.wxml
@@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
62 | <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}"> | 62 | <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}"> |
63 | <view class="flex ai-center"> | 63 | <view class="flex ai-center"> |
64 | <view class="price">¥{{item.shop_price}}</view> | 64 | <view class="price">¥{{item.shop_price}}</view> |
65 | - <view class="word-line">¥{{item.market_price}}</view> | 65 | + <view class="word-line xc-ash mk_price">¥{{item.market_price}}</view> |
66 | </view> | 66 | </view> |
67 | <view class="comment flex jc_sb"> | 67 | <view class="comment flex jc_sb"> |
68 | <view class="flex"> | 68 | <view class="flex"> |
pages/goods/search/search.wxss
@@ -92,8 +92,7 @@ | @@ -92,8 +92,7 @@ | ||
92 | .price { | 92 | .price { |
93 | display: inline-block; | 93 | display: inline-block; |
94 | color: #f23030; | 94 | color: #f23030; |
95 | - height: 20rpx; | ||
96 | - line-height: 20rpx; | 95 | + line-height: 24rpx; |
97 | /* padding-bottom: 20rpx; */ | 96 | /* padding-bottom: 20rpx; */ |
98 | } | 97 | } |
99 | 98 | ||
@@ -229,5 +228,7 @@ | @@ -229,5 +228,7 @@ | ||
229 | } | 228 | } |
230 | 229 | ||
231 | .card_bg {display: flex; width: 110rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; | 230 | .card_bg {display: flex; width: 110rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx; |
232 | -background: #333; color: #fff; justify-content: center; margin-left: 2rpx; margin-top:8rpx; line-height: 28rpx;} | 231 | +background: #333; color: #fff; justify-content: center; margin-left: 3rpx; margin-top:7rpx; line-height: 28rpx;} |
233 | .card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx; vertical-align: middle} | 232 | .card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx; vertical-align: middle} |
233 | +.mk_price{margin-left: 10rpx; font-size: 25rpx;} | ||
234 | +.item-cont{ line-height: 38rpx} |
pages/index/index/index.js
@@ -315,7 +315,7 @@ Page({ | @@ -315,7 +315,7 @@ Page({ | ||
315 | }); | 315 | }); |
316 | var goods_list = this.selectComponent("#goods_list"); //组件的id | 316 | var goods_list = this.selectComponent("#goods_list"); //组件的id |
317 | goods_list.init(); | 317 | goods_list.init(); |
318 | - setTimeOut(function () { goods_list.get_list();},300) | 318 | + setTimeout(function () { goods_list.get_list();},300) |
319 | }, | 319 | }, |
320 | 320 | ||
321 | //--判断小程序是否过期-- | 321 | //--判断小程序是否过期-- |
pages/user/cardinfo/cardinfo.js
@@ -106,8 +106,7 @@ Page({ | @@ -106,8 +106,7 @@ Page({ | ||
106 | }) | 106 | }) |
107 | } | 107 | } |
108 | }) | 108 | }) |
109 | - var goods_list = this.selectComponent("#goods_list"); //组件的id | ||
110 | - goods_list.get_list(); | 109 | + |
111 | 110 | ||
112 | 111 | ||
113 | }, | 112 | }, |
@@ -307,7 +306,7 @@ Page({ | @@ -307,7 +306,7 @@ Page({ | ||
307 | ///二微码 | 306 | ///二微码 |
308 | 307 | ||
309 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | 308 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
310 | - os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/index/index"; | 309 | + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/plus/plus"; |
311 | wx.getImageInfo({ | 310 | wx.getImageInfo({ |
312 | src: path3, | 311 | src: path3, |
313 | success: function (res) { | 312 | success: function (res) { |
@@ -635,6 +634,9 @@ Page({ | @@ -635,6 +634,9 @@ Page({ | ||
635 | //同步初始化 | 634 | //同步初始化 |
636 | this.init(); | 635 | this.init(); |
637 | 636 | ||
637 | + var goods_list = this.selectComponent("#goods_list"); //组件的id | ||
638 | + goods_list.init(); | ||
639 | + goods_list.get_list(); | ||
638 | 640 | ||
639 | }, | 641 | }, |
640 | 642 |
pages/user/plus/plus.js
@@ -36,7 +36,7 @@ Page({ | @@ -36,7 +36,7 @@ Page({ | ||
36 | is_fengxiang: 0, //是不是分享过来的 | 36 | is_fengxiang: 0, //是不是分享过来的 |
37 | def_recommon: null, //分享人的手机号 | 37 | def_recommon: null, //分享人的手机号 |
38 | def_serviceman: null, //分享人的营业员 | 38 | def_serviceman: null, //分享人的营业员 |
39 | - fir_leader:0, | 39 | + fir_leader:0, //分享人的ID |
40 | 40 | ||
41 | }, | 41 | }, |
42 | swiperChange: function (e) { | 42 | swiperChange: function (e) { |
@@ -49,8 +49,8 @@ Page({ | @@ -49,8 +49,8 @@ Page({ | ||
49 | * 生命周期函数--监听页面加载 | 49 | * 生命周期函数--监听页面加载 |
50 | */ | 50 | */ |
51 | onLoad: function (options) { | 51 | onLoad: function (options) { |
52 | - var that = this; | ||
53 | - var store_id=getApp().globalData.setting.stoid; | 52 | + var that = this,th=that; |
53 | + var store_id=getApp().globalData.setting.stoid; | ||
54 | //获取用户设备信息,屏幕宽度 | 54 | //获取用户设备信息,屏幕宽度 |
55 | wx.getSystemInfo({ | 55 | wx.getSystemInfo({ |
56 | success: res => { | 56 | success: res => { |
@@ -58,9 +58,43 @@ Page({ | @@ -58,9 +58,43 @@ Page({ | ||
58 | } | 58 | } |
59 | }) | 59 | }) |
60 | var fir_leader = options.scene; | 60 | var fir_leader = options.scene; |
61 | - that.setData({fir_leader:fir_leader}) | 61 | + that.setData({fir_leader:fir_leader}) |
62 | + //--先判断会员状态-- | ||
63 | + var user_info = getApp().globalData.userInfo; | ||
64 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
65 | + wx.navigateTo({ url: '/pages/getphone/getphone?first_leader=' + fir_leader, }) | ||
66 | + return false; | ||
67 | + } | ||
68 | + //-----------商家配置信息----- 等级卡规则,是否又开邀请码,营业员------------ | ||
69 | + getApp().request.get("/api/weshop/storeconfig/get/" + store_id, { | ||
70 | + success: function (res) { | ||
71 | + var is_cardrule = res.data.data.cardrules; | ||
72 | + var switch_list= res.data.data.switch_list; | ||
73 | + var swi_arr=JSON.parse(switch_list); | ||
74 | + | ||
75 | + w.wxParse("content", "html", is_cardrule, that, 6); | ||
76 | + that.setData({ | ||
77 | + is_card_rule: is_cardrule, | ||
78 | + isyaoqingma:parseInt(swi_arr.isyaoqingma), | ||
79 | + is_salesman:parseInt(swi_arr.is_staffno) | ||
80 | + }); | ||
81 | + } | ||
82 | + }); | ||
83 | + }, | ||
84 | + | ||
85 | + /** | ||
86 | + * 生命周期函数--监听页面显示 | ||
87 | + */ | ||
88 | + onShow: function () { | ||
89 | + var user_info = getApp().globalData.userInfo; | ||
90 | + if(!user_info) return false; | ||
91 | + | ||
92 | + var th=this,that=th,app_d=getApp().globalData; | ||
93 | + var store_id=os.stoid; | ||
94 | + var fir_leader=this.data.fir_leader; | ||
95 | + | ||
62 | if (fir_leader != null && fir_leader != undefined && fir_leader != "") { | 96 | if (fir_leader != null && fir_leader != undefined && fir_leader != "") { |
63 | - var r_url="/api/weshop/plus/vip/mem/list?storeId=" + store_id + "&userId=" + fir_leader | 97 | + var r_url = "/api/weshop/plus/vip/mem/list?storeId=" + store_id + "&userId=" + fir_leader |
64 | getApp().request.get(r_url, { | 98 | getApp().request.get(r_url, { |
65 | success: function (res) { | 99 | success: function (res) { |
66 | var is_ok = 1; | 100 | var is_ok = 1; |
@@ -92,40 +126,16 @@ Page({ | @@ -92,40 +126,16 @@ Page({ | ||
92 | that.back_user(); | 126 | that.back_user(); |
93 | } | 127 | } |
94 | if (is_ok == 1) { | 128 | if (is_ok == 1) { |
95 | - that.setData({def_recommon: user_information.MobileTel, def_serviceman: user_information.StaffNo,is_fengxiang:1}) | ||
96 | - //--先判断会员状态-- | ||
97 | - var user_info=getApp().globalData.userInfo; | ||
98 | - if(user_info==null || user_info.mobile==undefined || user_info.mobile=="" || user_info.mobile==null){ | ||
99 | - wx.navigateTo({ url: '/pages/getphone/getphone?first_leader='+fir_leader, }) | ||
100 | - return false; | ||
101 | - } | 129 | + //--保存或者更新会员信息-- |
130 | + that.setData({ def_recommon: user_information.MobileTel, def_serviceman: user_information.StaffNo, is_fengxiang: 1 }) | ||
131 | + th.save_th_plus_user(); | ||
102 | } | 132 | } |
103 | } | 133 | } |
104 | }); | 134 | }); |
135 | + } else { | ||
136 | + th.get_user_plus(); | ||
105 | } | 137 | } |
106 | 138 | ||
107 | - //-----------商家配置信息----- 等级卡规则,是否又开邀请码,营业员------------ | ||
108 | - getApp().request.get("/api/weshop/storeconfig/get/" + store_id, { | ||
109 | - success: function (res) { | ||
110 | - var is_cardrule = res.data.data.cardrules; | ||
111 | - var switch_list= res.data.data.switch_list; | ||
112 | - var swi_arr=JSON.parse(switch_list); | ||
113 | - | ||
114 | - w.wxParse("content", "html", is_cardrule, that, 6); | ||
115 | - that.setData({ | ||
116 | - is_card_rule: is_cardrule, | ||
117 | - isyaoqingma:parseInt(swi_arr.isyaoqingma), | ||
118 | - is_salesman:parseInt(swi_arr.is_staffno) | ||
119 | - }); | ||
120 | - } | ||
121 | - }); | ||
122 | - }, | ||
123 | - | ||
124 | - /** | ||
125 | - * 生命周期函数--监听页面显示 | ||
126 | - */ | ||
127 | - onShow: function () { | ||
128 | - var th=this,app_d=getApp().globalData; | ||
129 | getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + app_d.user_id, { | 139 | getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + app_d.user_id, { |
130 | success: function (e) { | 140 | success: function (e) { |
131 | var userInfo = e.data.data; | 141 | var userInfo = e.data.data; |
@@ -136,7 +146,7 @@ Page({ | @@ -136,7 +146,7 @@ Page({ | ||
136 | }, | 146 | }, |
137 | }); | 147 | }); |
138 | 148 | ||
139 | - this.getPlusCardType(); | 149 | + this.getPlusCardType(); |
140 | }, | 150 | }, |
141 | 151 | ||
142 | /** | 152 | /** |
@@ -190,6 +200,7 @@ Page({ | @@ -190,6 +200,7 @@ Page({ | ||
190 | is_plusCard: plusCard, is_show: 1 | 200 | is_plusCard: plusCard, is_show: 1 |
191 | }) | 201 | }) |
192 | var goods_list = th.selectComponent("#goods_list"); //组件的id | 202 | var goods_list = th.selectComponent("#goods_list"); //组件的id |
203 | + goods_list.init(); | ||
193 | goods_list.get_list(); | 204 | goods_list.get_list(); |
194 | 205 | ||
195 | }) | 206 | }) |
@@ -301,6 +312,78 @@ Page({ | @@ -301,6 +312,78 @@ Page({ | ||
301 | var ob={}; | 312 | var ob={}; |
302 | ob[name]=value | 313 | ob[name]=value |
303 | this.setData(ob); | 314 | this.setData(ob); |
304 | - } | 315 | + }, |
316 | + | ||
317 | + get_user_plus:async function(){ | ||
318 | + var user_id=getApp().globalData.user_id; | ||
319 | + var fuser=null; | ||
320 | + var user_information =null; | ||
321 | + var store_id = os.stoid; | ||
322 | + var that=this; | ||
323 | + //--获取登记卡邀请信息-- | ||
324 | + await getApp().request.promiseGet("/api/weshop/usersPlus/get/" + os.stoid + "/" + user_id,{1:1}).then(res=>{ | ||
325 | + if (res.data.code==0){ | ||
326 | + fuser=res.data.data; | ||
327 | + } | ||
328 | + }) | ||
329 | + if (!fuser) return false; | ||
330 | + var r_url = "/api/weshop/plus/vip/mem/list?storeId=" + store_id + "&userId=" + fuser.plus_user_id; | ||
331 | + //--获取等级卡信息-- | ||
332 | + await getApp().request.promiseGet(r_url,{1:1}).then(res=>{ | ||
333 | + if (res.data.code == 0) { | ||
334 | + user_information = res.data.data[0]; | ||
335 | + } | ||
336 | + }) | ||
337 | + if (user_information){ | ||
338 | + var now = ut.gettimestamp(); | ||
339 | + var is_ok = 1; | ||
340 | + if (user_information['ExpiryDate']) { | ||
341 | + var str = user_information['ExpiryDate'].replace(/-/g, '/'); | ||
342 | + var end = new Date(str); | ||
343 | + end = Date.parse(end) / 1000; | ||
344 | + if (end < now) { is_ok = 0;} | ||
345 | + } else { | ||
346 | + is_ok = 0; | ||
347 | + } | ||
305 | 348 | ||
349 | + if (is_ok == 1) { | ||
350 | + var fir_leader=fuser.plus_user_id | ||
351 | + that.setData({ def_recommon: user_information.MobileTel, def_serviceman: user_information.StaffNo, is_fengxiang: 1,fir_leader:fir_leader }) | ||
352 | + //--先判断会员状态-- | ||
353 | + var user_info = getApp().globalData.userInfo; | ||
354 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
355 | + wx.navigateTo({ url: '/pages/getphone/getphone?first_leader=' + fir_leader, }) | ||
356 | + return false; | ||
357 | + } | ||
358 | + } | ||
359 | + } | ||
360 | + }, | ||
361 | + | ||
362 | + save_th_plus_user:async function(){ | ||
363 | + var f_user_id=this.data.fir_leader; | ||
364 | + if (f_user_id){ | ||
365 | + var user_id = getApp().globalData.user_id; | ||
366 | + var user_plus = null; | ||
367 | + var now=ut.gettimestamp(); | ||
368 | + //--获取登记卡邀请信息-- | ||
369 | + await getApp().request.promiseGet("/api/weshop/usersPlus/get/" + os.stoid + "/" + user_id, { 1: 1 }).then(res => { | ||
370 | + if (res.data.code == 0) { | ||
371 | + user_plus = res.data.data; | ||
372 | + } | ||
373 | + }) | ||
374 | + | ||
375 | + //--如果有值,要更新-- | ||
376 | + if (!user_plus){ | ||
377 | + getApp().request.post("/api/weshop/usersPlus/save", { | ||
378 | + data: { store_id: os.stoid, user_id: user_id, plus_user_id: f_user_id, addtime: now }, | ||
379 | + success: function (res) { } | ||
380 | + }) | ||
381 | + }else{ | ||
382 | + getApp().request.put("/api/weshop/usersPlus/update",{ | ||
383 | + data: { store_id: os.stoid, user_id: user_id, plus_user_id: f_user_id, edittime: now}, | ||
384 | + success:function(res){ } | ||
385 | + }) | ||
386 | + } | ||
387 | + } | ||
388 | + } | ||
306 | }) | 389 | }) |
307 | \ No newline at end of file | 390 | \ No newline at end of file |