Commit 93cb23def7abdd4c900995d2736d4e839007ab7f

Authored by taiyuan
2 parents a5ffbf74 6368d495

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

pages/user/index/index.js
@@ -72,25 +72,25 @@ Page({ @@ -72,25 +72,25 @@ Page({
72 } 72 }
73 } 73 }
74 th.setData({user_tool:d_list}); 74 th.setData({user_tool:d_list});
  75 +
  76 + getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, {
  77 + data: {
  78 + enabled: 1
  79 + },
  80 + success:function(res){
  81 + if(res.data.code==0 && res.data.data){
  82 + var item=res.data.data.pageData[0];
  83 + if (item && item.ad_code) th.setData({ad_img:item.ad_code})
  84 + }
  85 + }
  86 + })
  87 +
  88 + app.getUserFir();
  89 +
75 }) 90 })
76 } 91 }
77 } 92 }
78 }) 93 })
79 - this.birthday();  
80 - getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, {  
81 - data: {  
82 - enabled: 1  
83 - },  
84 - success:function(res){  
85 - if(res.data.code==0 && res.data.data){  
86 - var item=res.data.data.pageData[0];  
87 - if (item && item.ad_code) th.setData({ad_img:item.ad_code})  
88 - }  
89 - }  
90 - })  
91 -  
92 -  
93 - app.getUserFir();  
94 94
95 }, 95 },
96 96
@@ -98,6 +98,34 @@ Page({ @@ -98,6 +98,34 @@ Page({
98 * 生命周期函数--监听页面显示 98 * 生命周期函数--监听页面显示
99 */ 99 */
100 onShow: function() { 100 onShow: function() {
  101 + //看一下小程序是不是过期了
  102 + getApp().getConfig2(function(config2){
  103 + if(config2 && config2.is_overdue==1){
  104 + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{
  105 + var o=res;
  106 + if (o.data.code == 0) {
  107 + var ob = { isout: 0, isbuy: 1 };
  108 + var arr = o.data.data.pageData;
  109 + var isbuy = 0;
  110 + //----如果数组不为空----
  111 + if (arr.length > 0) {
  112 + arr.forEach(function (val, ind) {
  113 + if (val.is_sy == 0 && val.type == 5) {
  114 + isbuy = 1;
  115 + var now = ut.gettimestamp();
  116 + if (now > val.end_time) ob.isout = 1;
  117 + return false;
  118 + }
  119 + })
  120 + }
  121 + ob.isbuy = isbuy;
  122 + th.setappdata(ob);
  123 + }
  124 + })
  125 + }
  126 + })
  127 +
  128 +
101 var th=this; 129 var th=this;
102 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + os.stoid, {}).then(res => { 130 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + os.stoid, {}).then(res => {
103 if(res.data.code==0){ 131 if(res.data.code==0){
@@ -113,51 +141,22 @@ Page({ @@ -113,51 +141,22 @@ Page({
113 this.getTabBar().setData({ 141 this.getTabBar().setData({
114 active: index //数字是当前页面在tabbar的索引 142 active: index //数字是当前页面在tabbar的索引
115 }); 143 });
116 -  
117 - getApp().requestCardNum(this);  
118 - } 144 + //getApp().requestCardNum(this);
  145 + }
  146 +
119 147
120 - this.is_assistance();  
121 var stoid = app_d.setting.stoid; 148 var stoid = app_d.setting.stoid;
122 - var s = this,  
123 - th = s, 149 + var s = this, th = s,
124 need_money = 0, 150 need_money = 0,
125 cur_g_num = 0; 151 cur_g_num = 0;
126 -  
127 - getApp().getConfig2(function(config2){  
128 - if(config2 && config2.is_overdue==1){  
129 - getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{  
130 - var o=res;  
131 - if (o.data.code == 0) {  
132 - var ob = { isout: 0, isbuy: 1 };  
133 - var arr = o.data.data.pageData;  
134 - var isbuy = 0;  
135 - //----如果数组不为空----  
136 - if (arr.length > 0) {  
137 - arr.forEach(function (val, ind) {  
138 - if (val.is_sy == 0 && val.type == 5) {  
139 - isbuy = 1;  
140 - var now = ut.gettimestamp();  
141 - if (now > val.end_time) ob.isout = 1;  
142 - return false;  
143 - }  
144 - })  
145 - }  
146 - ob.isbuy = isbuy;  
147 - th.setappdata(ob);  
148 - }  
149 - })  
150 - }  
151 - })  
152 -  
153 -  
154 - setTimeout(function () {  
155 - if (getApp().globalData.user_id) getApp().requestCardNum(th);  
156 - },500) 152 +
157 /*------会员登录------*/ 153 /*------会员登录------*/
158 - var e=getApp().globalData.userInfo;  
159 - 154 + var e=getApp().globalData.userInfo;
160 if (e != undefined && e != null && e.mobile) { 155 if (e != undefined && e != null && e.mobile) {
  156 +
  157 + this.birthday();
  158 + this.is_assistance();
  159 +
161 s.setData({ 160 s.setData({
162 userInfo: e 161 userInfo: e
163 }); 162 });
@@ -165,6 +164,7 @@ Page({ @@ -165,6 +164,7 @@ Page({
165 //-- 要调用接口,获取卡的钱 -- 164 //-- 要调用接口,获取卡的钱 --
166 var url="/api/weshop/wxuser/getWxCardInfo?storeId="+os.stoid+"&userId="+e.user_id; 165 var url="/api/weshop/wxuser/getWxCardInfo?storeId="+os.stoid+"&userId="+e.user_id;
167 rq.get(url,{ 166 rq.get(url,{
  167 + isShowLoading:0,
168 success: function(su) { 168 success: function(su) {
169 if(su.data.code==0){ 169 if(su.data.code==0){
170 s.setData({ 170 s.setData({
@@ -176,6 +176,7 @@ Page({ @@ -176,6 +176,7 @@ Page({
176 176
177 /*-----统计-----*/ 177 /*-----统计-----*/
178 rq.get("/api/weshop/order/waitlist", { 178 rq.get("/api/weshop/order/waitlist", {
  179 + isShowLoading:0,
179 data: { 180 data: {
180 user_id: app_d.user_id 181 user_id: app_d.user_id
181 }, 182 },
@@ -187,6 +188,7 @@ Page({ @@ -187,6 +188,7 @@ Page({
187 }) 188 })
188 /*-----获取线下会员的预存款和优惠券的数量-----*/ 189 /*-----获取线下会员的预存款和优惠券的数量-----*/
189 rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, { 190 rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, {
  191 + isShowLoading:0,
190 success: function(su) { 192 success: function(su) {
191 if(su.data.code==0 && su.data.data ) { 193 if(su.data.code==0 && su.data.data ) {
192 var data = su.data.data; 194 var data = su.data.data;
@@ -201,6 +203,7 @@ Page({ @@ -201,6 +203,7 @@ Page({
201 }) 203 })
202 /*-----获取会员提现金额-----*/ 204 /*-----获取会员提现金额-----*/
203 rq.get("/api/weshop/withdrawals/summoney", { 205 rq.get("/api/weshop/withdrawals/summoney", {
  206 + isShowLoading:0,
204 data: { 207 data: {
205 user_id: e.user_id, 208 user_id: e.user_id,
206 store_id: os.stoid, 209 store_id: os.stoid,
@@ -220,6 +223,7 @@ Page({ @@ -220,6 +223,7 @@ Page({
220 223
221 /*-----获取会员包邮券的数量-----*/ 224 /*-----获取会员包邮券的数量-----*/
222 rq.get("/api/weshop/userfeemail/page", { 225 rq.get("/api/weshop/userfeemail/page", {
  226 + isShowLoading:0,
223 data: { 227 data: {
224 user_id: e.user_id, 228 user_id: e.user_id,
225 store_id: os.stoid, 229 store_id: os.stoid,
@@ -234,114 +238,120 @@ Page({ @@ -234,114 +238,120 @@ Page({
234 } 238 }
235 } 239 }
236 }) 240 })
237 -  
238 - /*-----获取会员权益列表-----*/  
239 - rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", {  
240 - data: {  
241 - storeId: os.stoid,  
242 - pageSize: 100  
243 - },  
244 - success: async function(res) {  
245 - var arr_data = res.data.data.pageData;  
246 - var gid = null,  
247 - g_qy_list = null,  
248 - cz_vals = 0,  
249 - need_money = 0,  
250 - backClass = null,  
251 - is_init = 0,  
252 - GradeName = '';  
253 -  
254 - //--初始化是否有打勾--  
255 - await getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {  
256 - data: {  
257 - storeId: os.stoid  
258 - }  
259 - }).then(res => {  
260 - is_init = res.data.data.isBool;  
261 - })  
262 241
263 - //获取成长值  
264 - await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get", {  
265 - data: {  
266 - storeId: os.stoid,  
267 - userId: app_d.user_id  
268 - }  
269 - }).then(res => {  
270 - if (res.data.code == 0 && res.data.data) {  
271 - gid = res.data.data.GradeId;  
272 - var cz_val = res.data.data.GradeSum;  
273 - cz_vals = parseInt(cz_val);  
274 - GradeName = res.data.data.GradeName;  
275 - }  
276 - //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid});  
277 - })  
278 - var obj = {  
279 - cz_val: cz_vals,  
280 - GradeName: GradeName,  
281 - is_init: is_init,  
282 - gradeId: gid  
283 - };  
284 242
285 - // 获取最大值  
286 - await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", {  
287 - data: { 243 + //--初始化是否有打勾--
  244 + getApp().request.get("/api/weshop/users/grade/vip/init/get", {
  245 + data: {
288 storeId: os.stoid 246 storeId: os.stoid
289 - }  
290 - }).then(res => {  
291 - if (res.data.data)  
292 - backClass = res.data.data.pageData;  
293 - if (backClass) {  
294 - var full_cz_val = backClass[backClass.length - 1].BuyGradeSum;  
295 - //th.setData({ full_cz_val: full_cz_val});  
296 - obj.full_cz_val = full_cz_val  
297 - }  
298 - })  
299 -  
300 - //--会员权益中心页的修改--  
301 - for (var i in backClass) {  
302 - var im = backClass[i];  
303 - if (cz_vals < im.BuyGradeSum && need_money == 0) {  
304 - need_money = im.BuyGradeSum;  
305 - obj.need_money = need_money;  
306 - }  
307 - }  
308 -  
309 - //获取当前等级的特权  
310 - await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", {  
311 - data: {  
312 - storeId: os.stoid,  
313 - GradeId: gid,  
314 - userId: app_d.user_id,  
315 - pageSize: 100  
316 - }  
317 - }).then(res => {  
318 - if (res.data.data)  
319 - g_qy_list = res.data.data.pageData;  
320 - });  
321 -  
322 - for (var i in arr_data) {  
323 - var item = arr_data[i];  
324 - var FromId = th.check_is_has_qy(item, g_qy_list);  
325 - arr_data[i].ishas = 0;  
326 - if (FromId) {  
327 - arr_data[i].ishas = 1;  
328 - arr_data[i].FromId = FromId;  
329 - }  
330 - }  
331 - arr_data.sort(function(a, b) {  
332 - return b.ishas - a.ishas  
333 - })  
334 -  
335 - //4个4个一组  
336 - var arr = new Array();  
337 - for (var i = 0; i < arr_data.length; i += 4) {  
338 - arr.push(arr_data.slice(i, i + 4)); 247 + },
  248 + success:function (rs) {
  249 + if(rs.data.code==0 && rs.data.data.isBool){
  250 + th.setData({is_init:1});
  251 + /*-----获取会员权益列表-----*/
  252 + rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", {
  253 + isShowLoading:0,
  254 + data: {
  255 + storeId: os.stoid,
  256 + pageSize: 100
  257 + },
  258 + success: async function(res) {
  259 + var arr_data = res.data.data.pageData;
  260 + var gid = null,
  261 + g_qy_list = null,
  262 + cz_vals = 0,
  263 + need_money = 0,
  264 + backClass = null,
  265 +
  266 + GradeName = '';
  267 +
  268 + //获取成长值
  269 + await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get", {
  270 + data: {
  271 + storeId: os.stoid,
  272 + userId: app_d.user_id
  273 + }
  274 + }).then(res => {
  275 + if (res.data.code == 0 && res.data.data) {
  276 + gid = res.data.data.GradeId;
  277 + var cz_val = res.data.data.GradeSum;
  278 + cz_vals = parseInt(cz_val);
  279 + GradeName = res.data.data.GradeName;
  280 + }
  281 + //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid});
  282 + })
  283 + var obj = {
  284 + cz_val: cz_vals,
  285 + GradeName: GradeName,
  286 + gradeId: gid,
  287 + is_grad_get:1
  288 + };
  289 +
  290 + // 获取最大值
  291 + await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", {
  292 + data: {
  293 + storeId: os.stoid
  294 + }
  295 + }).then(res => {
  296 + if (res.data.data)
  297 + backClass = res.data.data.pageData;
  298 + if (backClass) {
  299 + var full_cz_val = backClass[backClass.length - 1].BuyGradeSum;
  300 + //th.setData({ full_cz_val: full_cz_val});
  301 + obj.full_cz_val = full_cz_val
  302 + }
  303 + })
  304 +
  305 + //--会员权益中心页的修改--
  306 + for (var i in backClass) {
  307 + var im = backClass[i];
  308 + if (cz_vals < im.BuyGradeSum && need_money == 0) {
  309 + need_money = im.BuyGradeSum;
  310 + obj.need_money = need_money;
  311 + }
  312 + }
  313 +
  314 + //获取当前等级的特权
  315 + await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", {
  316 + data: {
  317 + storeId: os.stoid,
  318 + GradeId: gid,
  319 + userId: app_d.user_id,
  320 + pageSize: 100
  321 + }
  322 + }).then(res => {
  323 + if (res.data.data)
  324 + g_qy_list = res.data.data.pageData;
  325 + });
  326 +
  327 + for (var i in arr_data) {
  328 + var item = arr_data[i];
  329 + var FromId = th.check_is_has_qy(item, g_qy_list);
  330 + arr_data[i].ishas = 0;
  331 + if (FromId) {
  332 + arr_data[i].ishas = 1;
  333 + arr_data[i].FromId = FromId;
  334 + }
  335 + }
  336 + arr_data.sort(function(a, b) {
  337 + return b.ishas - a.ishas
  338 + })
  339 +
  340 + //4个4个一组
  341 + var arr = new Array();
  342 + for (var i = 0; i < arr_data.length; i += 4) {
  343 + arr.push(arr_data.slice(i, i + 4));
  344 + }
  345 + //th.setData({ qy_list: arr, need_money: need_money});
  346 + obj.qy_list = arr;
  347 + th.setData(obj);
  348 + }
  349 + })
  350 + }
339 } 351 }
340 - //th.setData({ qy_list: arr, need_money: need_money});  
341 - obj.qy_list = arr;  
342 - th.setData(obj);  
343 - }  
344 }) 352 })
  353 +
  354 +
345 355
346 /*-- 获取 --*/ 356 /*-- 获取 --*/
347 th.requestRecommend(); 357 th.requestRecommend();
@@ -395,11 +405,16 @@ Page({ @@ -395,11 +405,16 @@ Page({
395 if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); 405 if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool);
396 th.setData({c_list:user_tool}) 406 th.setData({c_list:user_tool})
397 } --*/ 407 } --*/
398 -  
399 408
400 - var goods_list = this.selectComponent("#goods_recommend"); //组件的id  
401 - goods_list.init();  
402 - goods_list.get_list(); 409 + //自定义组件一定要等到页面加载完了,才来调用selectComponnent
  410 + setTimeout(function () {
  411 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  412 + var goods_list = th.selectComponent("#goods_recommend"); //组件的id
  413 + goods_list.init();
  414 + goods_list.get_list();
  415 + },800)
  416 +
  417 +
403 418
404 }, 419 },
405 420
pages/user/index/index.wxml
@@ -9,9 +9,12 @@ @@ -9,9 +9,12 @@
9 <view class="xc-user-left flex" wx:if="{{userInfo}}"> 9 <view class="xc-user-left flex" wx:if="{{userInfo}}">
10 <image class="xc-user-img circle" bindtap="go_info" src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}"></image> 10 <image class="xc-user-img circle" bindtap="go_info" src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}"></image>
11 <view class="xc-uesr-name"> 11 <view class="xc-uesr-name">
  12 + <view class="flex ai-center">
12 <text class="ellipsis-1" style="max-width: 290rpx;display: inline-block">{{userInfo.nickname}}</text> 13 <text class="ellipsis-1" style="max-width: 290rpx;display: inline-block">{{userInfo.nickname}}</text>
13 <view class="hvip" wx:if='{{GradeName && is_init}}'> 14 <view class="hvip" wx:if='{{GradeName && is_init}}'>
14 <image class="vip-mem" src="{{iurl}}/miniapp/images/vip_hg0.png"></image>{{GradeName}}</view> 15 <image class="vip-mem" src="{{iurl}}/miniapp/images/vip_hg0.png"></image>{{GradeName}}</view>
  16 + </view>
  17 +
15 <view class="flex fs24 xc-grow-ups" style="margin-left:8rpx;margin-top:6rpx" wx:if="{{is_init && gradeId}}" bindtap='jump'> 18 <view class="flex fs24 xc-grow-ups" style="margin-left:8rpx;margin-top:6rpx" wx:if="{{is_init && gradeId}}" bindtap='jump'>
16 <block wx:if="{{cz_val<full_cz_val}}"> 19 <block wx:if="{{cz_val<full_cz_val}}">
17 {{" "}} 20 {{" "}}
@@ -142,7 +145,7 @@ @@ -142,7 +145,7 @@
142 </view> 145 </view>
143 146
144 <!-- 我的权益 --> 147 <!-- 我的权益 -->
145 - <view class="xc-my-equity-frame" wx:if="{{qy_list!=null && is_init && gradeId}}"> 148 + <view class="xc-my-equity-frame" wx:if="{{is_init }}">
146 <view class="xc-equity-title flex-level" bindtap="go_qy"> 149 <view class="xc-equity-title flex-level" bindtap="go_qy">
147 <view class="xc-title-frame flex-space-between"> 150 <view class="xc-title-frame flex-space-between">
148 <view class="flex-vertical xc-title-content"> 151 <view class="flex-vertical xc-title-content">
@@ -150,37 +153,51 @@ @@ -150,37 +153,51 @@
150 <view class="three-level-word">我的权益</view> 153 <view class="three-level-word">我的权益</view>
151 </view> 154 </view>
152 </view> 155 </view>
153 - <view class="three-level-word xc-more-frame flex-vertical"> 156 + <view wx:if="{{is_grad_get}}" class="three-level-word xc-more-frame flex-vertical">
154 <view class="three-level-word xc-more">更多</view> 157 <view class="three-level-word xc-more">更多</view>
155 <view class="bg_right xc-more-click bcolor"></view> 158 <view class="bg_right xc-more-click bcolor"></view>
156 </view> 159 </view>
  160 + <view wx:else class="three-level-word xc-more-frame flex-vertical" style="justify-content: flex-end">
  161 + <image style="width: 40rpx; height: 40rpx; margin-right: 20rpx" src="{{iurl}}/miniapp/images/loader.gif"></image>
  162 + </view>
157 </view> 163 </view>
158 164
159 - <view class="xc-specific-more-frame flex-vertical"> 165 + <block wx:if="{{is_grad_get}}">
  166 + <block wx:if="{{qy_list && gradeId}}">
  167 + <view class="xc-specific-more-frame flex-vertical" wx:if="{{qy_list}}">
160 168
161 - <view bindtap="click_pre">  
162 - <view class="bg_left xc-left bcolor"></view>  
163 - </view> 169 + <view bindtap="click_pre">
  170 + <view class="bg_left xc-left bcolor"></view>
  171 + </view>
164 172
165 - <swiper current="{{sw_index}}" style='width:82.7%; height:108rpx' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}"> 173 + <swiper current="{{sw_index}}" style='width:82.7%; height:108rpx' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}">
166 174
167 - <swiper-item wx:for="{{qy_list}}" wx:for-item="aitem" wx:for-index="pidx">  
168 - <view class="flex xc-middle"> 175 + <swiper-item wx:for="{{qy_list}}" wx:for-item="aitem" wx:for-index="pidx">
  176 + <view class="flex xc-middle">
169 177
170 - <view class="xc-center-frame t-c" wx:for="{{aitem}}" data-img="{{item.PrivilegeImageUrl}}" data-no="{{item.PrivilegeType}}" data-ind="{{index}}" data-find="{{pidx}}" bindtap="go_qy_url">  
171 - <!-- <text>qy_list.privilegeICOUrl</text> -->  
172 - <image class="xc-center-img {{item.ishas==1?'':'img_gray'}}" src="{{item.PrivilegeICOUrl}}"></image>  
173 - <view class="four-level-word">{{item.PrivilegeName}}</view> 178 + <view class="xc-center-frame t-c" wx:for="{{aitem}}" data-img="{{item.PrivilegeImageUrl}}" data-no="{{item.PrivilegeType}}" data-ind="{{index}}" data-find="{{pidx}}" bindtap="go_qy_url">
  179 + <!-- <text>qy_list.privilegeICOUrl</text> -->
  180 + <image class="xc-center-img {{item.ishas==1?'':'img_gray'}}" src="{{item.PrivilegeICOUrl}}"></image>
  181 + <view class="four-level-word">{{item.PrivilegeName}}</view>
  182 + </view>
174 </view> 183 </view>
175 - </view>  
176 - </swiper-item> 184 + </swiper-item>
177 185
178 - </swiper> 186 + </swiper>
179 187
180 - <view bindtap="click_next">  
181 - <view class="bg_right xc-right bcolor mt"></view> 188 + <view bindtap="click_next">
  189 + <view class="bg_right xc-right bcolor mt"></view>
  190 + </view>
182 </view> 191 </view>
183 - </view> 192 + </block>
  193 + <view wx:else style="text-align: center">
  194 + 未找到数据
  195 + </view>
  196 + </block>
  197 +
  198 +
  199 +
  200 +
184 </view> 201 </view>
185 <!-- 生日营销 is_banner--> 202 <!-- 生日营销 is_banner-->
186 <block wx:if="{{is_banner}}"> 203 <block wx:if="{{is_banner}}">
pages/user/index/index.wxss
@@ -692,7 +692,7 @@ @@ -692,7 +692,7 @@
692 background: #383838; 692 background: #383838;
693 padding: 0 15rpx; 693 padding: 0 15rpx;
694 border-radius: 20rpx; 694 border-radius: 20rpx;
695 - vertical-align: top; 695 + margin-left: 5rpx;
696 } 696 }
697 697
698 .vip-mem { 698 .vip-mem {