Commit 3dfaf9bf364522989dc9eac8d4fb88ae906b6c7d

Authored by 后端研发-苏明海
2 parents f3577aea 149f55a5

Merge branch 'dev' into 'test'

Dev

See merge request !268
components/qr_code/qr_code.wxml
1 1  
2   -<view class="xc-pop-up" wx:if="{{q_show}}">
  2 +<view class="xc-pop-up" wx:if="{{q_show}}" catchtouchmove='true'>
3 3 <!-- <scroll-view scroll-y="false" style=" height: 100%;"> -->
4 4 <view class="xc-obscuration" bindtap='close' catchtouchmove="ture"></view>
5 5 <view>
... ...
pages/index/index/index.js
... ... @@ -90,7 +90,7 @@ Page({
90 90 });
91 91 }
92 92 })
93   - // th.is_festival();
  93 + th.is_festival();
94 94  
95 95 },
96 96 //关闭新用户领取广告
... ...
pages/user/assistance/task_assistance.js
... ... @@ -13,6 +13,8 @@ Page({
13 13 * 页面的初始数据
14 14 */
15 15 data: {
  16 + swpie_img: s.imghost +"/miniapp/images/user_index_powder.jpg",
  17 + defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg",//助力头像的默认图
16 18 sw_index: 0, //轮播的下标控制
17 19 url: s.url, //接口网址
18 20 iurl: s.imghost,
... ... @@ -25,17 +27,22 @@ Page({
25 27 help_id: "", //活动的id canvasHidden: 0, //分享图片是否已经生成
26 28 gid: "",
27 29 timer: null, //全局的定时器
28   - user_task_list: null, //会员列表
  30 + user_task_list: [], //会员列表
29 31 taskid: "", //任务id
30 32 usercount: 0, //参与的人数
31   - dismantle: null, //帮拆记录数据集
  33 + dismantle:[], //帮拆记录数据集
32 34 is_user_task: null, //判断是不是领取的任务
33 35 zzjx_id: "", //真正进行的任务id
34 36 is_show: 0, //任务的加载更多
35 37 is_bc_show: 0, //帮拆的加载更多
36 38 bc_page: 1, //帮拆的页码
37 39 rw_page: 1, //任务的页码
38   - block: 0, //阻断助力的用户图片多次添加
  40 + block: 0, //阻断助力的我的任务在当前位置多次点击
  41 + is_dismantle:0, //阻断助力的帮拆记录在当前位置多次点击
  42 + is_clik:0,//点击的时候控制划动
  43 + is_dis_list:0,//多个数据的时候
  44 + is_user_list:0,//我的任务点击加载更多的后
  45 +
39 46 //*********************************************start钱
40 47 canvasHidden: 0, //分享图片是否已经生成
41 48 is_share: 0, //是否显示画布
... ... @@ -208,14 +215,18 @@ Page({
208 215 this.get_user_task_num();
209 216  
210 217 },
211   -
212   -
  218 + //记录加载更多
  219 + dismantle_record_list:function(){
  220 + this.setData({ is_dismantle:0});
  221 + this.dismantle_record();
  222 + },
213 223 //帮拆记录的
214 224 dismantle_record: function(e) {
215   - //优化444444444444444444
216   - if (this.data.switch_head == 1) {
  225 + //优化
  226 + if (this.data.is_dismantle == 1) {
217 227 return false;
218 228 }
  229 +
219 230 var aitem = this.data.aitem; //任务的数据集
220 231 var sw_index = this.data.sw_index; //轮播的下标
221 232 //任务id
... ... @@ -235,6 +246,7 @@ Page({
235 246 switch_head: 1,
236 247 block: 0,
237 248 });
  249 +
238 250 var bc_page = th.data.bc_page;
239 251 rq.get("/api/weshop/marketing/help/help/task/involve/page", {
240 252 data: {
... ... @@ -246,19 +258,32 @@ Page({
246 258 },
247 259 success: function(res) {
248 260 if (res.data.code == 0) {
  261 + th.setData({is_dismantle: 1});
249 262 var dismantle = res.data.data.pageData[0].zlHelpUser;
250 263 if (res.data.data.total > 5) {
251 264 var bc_page = th.data.bc_page + 1;
252   - th.data({
  265 + var dismantle_s = th.data.dismantle.concat(dismantle);
  266 + th.setData({
253 267 bc_page: bc_page,
254   - is_bc_show: 1
  268 + is_bc_show: 1,
  269 + dismantle: dismantle_s,
  270 + is_dis_list:1
255 271 })
256 272 } else {
257   - getApp().my_warnning("暂无更多内容", 0, th);
  273 + th.setData({
  274 + dismantle: dismantle,
  275 + is_dis_list: 0
  276 + });
  277 + }
  278 + var dis_len=th.data.dismantle.length;
  279 + if (res.data.data.total == dis_len){
  280 + th.setData({
  281 + is_dis_list: 0,
  282 + })
258 283 }
259   -
260 284 th.setData({
261   - dismantle: dismantle
  285 +
  286 + is_clik: 0,
262 287 });
263 288 } else {
264 289 th.setData({
... ... @@ -273,7 +298,8 @@ Page({
273 298 get_libao: function(e) {
274 299 var libao_id = e.currentTarget.dataset.libaoid; //礼包id
275 300 var taskid= e.currentTarget.dataset.taskid;
276   - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 +"&taskId="+taskid);
  301 + var taskingid = e.currentTarget.dataset.taskingid;
  302 + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + this.data.help_id + "&is_libao=" + 1 + "&taskId=" + taskid + "&id="+taskingid);
277 303 },
278 304 //查看礼包id
279 305 select_libao: function(e) {
... ... @@ -283,6 +309,10 @@ Page({
283 309  
284 310 //划动的时候监听
285 311 onSli: function(e) {
  312 + var arr=[];
  313 + this.setData({
  314 + dismantle: arr
  315 + });
286 316 var th = this;
287 317 var ind = e.detail.current;
288 318 var aitem = this.data.aitem;
... ... @@ -291,10 +321,12 @@ Page({
291 321 th.setData({
292 322 sw_index: ind,
293 323 task_number: task_number,
294   - taskid: task_id
  324 + taskid: task_id,
  325 + is_dismantle: 0,
  326 + bc_page:1
295 327 });
296   -
297   - if (this.data.switch_head == 1) {
  328 +
  329 + if (this.data.switch_head == 1&&th.data.is_clik==0) {
298 330 //判断有没有帮拆记录
299 331 this.dismantle_record();
300 332 }
... ... @@ -308,6 +340,11 @@ Page({
308 340 var nav_b = th.selectComponent("#nav_b"); //组件的id
309 341 nav_b.close_box();
310 342 },
  343 + //我的任务点击加载更多
  344 + task_list:function(){
  345 + this.setData({ block:0});
  346 + this.user_task_list();
  347 + },
311 348 // 获取会员的参与的任务列表 我的任务
312 349 user_task_list: function(e) {
313 350 var th = this;
... ... @@ -346,14 +383,24 @@ Page({
346 383 rw_page: rw_page,
347 384 is_show: 1
348 385 })
349   - getApp().my_warnning(su.data.msg, 1, th);
  386 +
350 387 }
351   -
352   - var user_list = su.data.data.pageData;
  388 +
  389 +
  390 + var user_list = su.data.data.pageData;
  391 + // if (user_list == "" || user_list.length == 0 || user_list==null){
  392 + // th.setData({
  393 + // is_user_list: 1
  394 + // });
  395 + // console.log("走哪里1111");
  396 + // }else{}
  397 + console.log("走哪里22222222");
  398 + var user_lists=th.data.user_task_list.concat(user_list);
353 399 th.setData({
354   - user_task_list: user_list
  400 + user_task_list: user_lists
355 401 });
356 402 } else {
  403 + th.setData({ is_user_list: 1 });
357 404 getApp().my_warnning(su.data.msg, 0, th);
358 405 }
359 406 }
... ... @@ -436,6 +483,10 @@ Page({
436 483  
437 484 // 轮播图点击左边
438 485 click_pre: function() {
  486 + var arr=[];
  487 + this.setData({
  488 + dismantle:arr
  489 + });
439 490 var index = this.data.sw_index;
440 491 index--;
441 492 if (index < 0) return;
... ... @@ -445,18 +496,29 @@ Page({
445 496 this.setData({
446 497 sw_index: index,
447 498 task_number: task_number,
448   - taskid: task_id
  499 + taskid: task_id,
  500 + is_dismantle: 0,
  501 + is_clik:1,
  502 + bc_page:1
449 503 })
450 504 if (this.data.switch_head == 1) {
451 505 //判断有没有帮拆记录
  506 + console.log("往左点////////////////////");
452 507 this.dismantle_record();
453 508 }
454   - //判断有没有领取任务
455   - this.get_user_task();
  509 + if (this.data.switch_head == 0){
  510 + //判断有没有领取任务
  511 + this.get_user_task();
  512 + }
  513 +
456 514 },
457 515 //轮播图点击右边
458 516 click_next: function() {
459   -
  517 + var arr=[];
  518 + this.setData({
  519 + is_clik:1,
  520 + dismantle: arr
  521 + });
460 522 var index = this.data.sw_index;
461 523 index++;
462 524 if (index >= this.data.aitem.length) return;
... ... @@ -466,7 +528,9 @@ Page({
466 528 this.setData({
467 529 sw_index: index,
468 530 task_number: task_number,
469   - taskid: task_id
  531 + taskid: task_id,
  532 + is_dismantle: 0,
  533 + bc_page:1,
470 534 })
471 535 if (this.data.switch_head == 1) {
472 536 this.dismantle_record();
... ... @@ -901,8 +965,11 @@ Page({
901 965 //立即兑换
902 966 redeem_now: function (e) {
903 967 var libao_id = e.currentTarget.dataset.libaoid;
904   - var taskid = e.currentTarget.dataset.taskid;
905   - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&taskId=" + taskid);
  968 + var sw_index=this.data.sw_index;
  969 + var aitem=this.data.aitem;
  970 + var taskid = aitem[sw_index].id;
  971 + var taskingid= e.currentTarget.dataset.taskingid;
  972 + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + this.data.help_id + "&is_libao=" + 1 + "&taskId=" + taskid + "&id="+taskingid);
906 973 },
907 974  
908 975  
... ...
pages/user/assistance/task_assistance.wxml
1 1 <wxs module="filter" src="../../../utils/filter.wxs"></wxs>
2   -<view class="top-back" style="background-image: url({{iurl}}/miniapp/images/friendhelp/lumi.png)" bindtap="close">
  2 +<view class="top-back" style="padding-bottom:{{is_user_task!=null&&is_user_task.status==0?50:0}}rpx;background-image: url({{iurl}}/miniapp/images/friendhelp/lumi.png)" bindtap="close">
3 3 <!-- 助力活动头部 -->
4 4 <view class="top-frame">
5 5 <view class="flex-center">
... ... @@ -23,7 +23,7 @@
23 23 <swiper bindanimationfinish="changeGoodsSwip" current="{{sw_index}}" style='width:82.7%; height:100%' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}">
24 24 <swiper-item class="rel" wx:for="{{aitem}}" wx:for-item="aitem" wx:for-index="pidx">
25 25  
26   - <image class="xc-center-img" bindtap="libao_details" data-taskid="{{aitem.id}}" src="{{iurl+aitem.giftBagUrl}}"></image>
  26 + <image class="xc-center-img" bindtap="libao_details" data-taskid="{{aitem.id}}" src="{{aitem.giftBagUrl!=null&&aitem.giftBagUrl!=''?iurl+aitem.giftBagUrl:swpie_img}}"></image>
27 27 <view class="abs select_details fs26 white">礼包详情</view>
28 28  
29 29 </swiper-item>
... ... @@ -52,7 +52,7 @@
52 52 <view wx:if="{{is_user_task!=null&&is_user_task.status==0}}" class="task_clike fs40 t-c flex-center" bindtap="save_share">
53 53 好友拆一拆
54 54 </view>
55   - <view wx:if="{{is_user_task!=null&&is_user_task.status==1}}" class="task_clike fs40 t-c flex-center" data-libaoid="{{is_user_task.helpListGiftBagId}}"data-taskid="{{is_user_task.id}}" bindtap="redeem_now">
  55 + <view wx:if="{{is_user_task!=null&&is_user_task.status==1}}" class="task_clike fs40 t-c flex-center" data-libaoid="{{is_user_task.helpListGiftBagId}}"data-taskingid="{{is_user_task.id}}" bindtap="redeem_now">
56 56 立即兑换
57 57 </view>
58 58 <view wx:if="{{is_user_task!=null&&is_user_task.status==0}}" class="task_clike fs40 t-c flex-center"data-taskid="{{is_user_task.id}}" bindtap="test">
... ... @@ -90,7 +90,7 @@
90 90 <view class="ellipsis-1">
91 91 <text wx:if="{{item.status==0}}">{{item.zlHelpNum}}/{{item.helpNum}}</text>
92 92 <text wx:if="{{item.status==2}}" bindtap="select_libao" data-orderSn="{{item.orderSn}}">查看礼包</text>
93   - <text wx:if="{{item.status==1}}" bindtap="get_libao" data-libaoid="{{item.helpListGiftBagId}}"data-taskid="{{item.id}}">领取礼包 </text>
  93 + <text wx:if="{{item.status==1}}" bindtap="get_libao" data-libaoid="{{item.helpListGiftBagId}}"data-taskingid="{{item.id}}" data-taskid="{{item.helpTaskId}}">领取礼包 </text>
94 94 </view>
95 95 </view>
96 96 </view>
... ... @@ -110,21 +110,20 @@
110 110 <view class="items" wx:if="{{is_task==1}}">
111 111 <block wx:if="{{ dismantle!=null|| dismantle!=''}}">
112 112  
113   -
  113 + <view class="tesk_list">
114 114 <view class="item fs26 flex flex-vertical-between padding" wx:for="{{dismantle}}" wx:for-index="idx">
115   -
116   - <view class="flex white" style="justify-content: space-around; width: 90%;margin:auto">
117   - <image class="circle user_img" src="{{item.headPic}}"></image>
  115 + <view class="flex white is_dismantle_frame" style="justify-content: space-around; width: 90%;margin:auto">
  116 + <image class="circle user_img" src="{{item.headPic==null?defaultAvatar:item.headPic}}"></image>
118 117 <view class="ellipsis-1 width">{{item.nickName}}
119 118 </view>
120 119 <view class="ellipsis-1">{{filter.format_time(item.zltime)}}
121 120 </view>
122 121 </view>
123 122 </view>
124   -
125   - <view class="flex-center fs32" wx:if="{{is_bc_show==1}}">
  123 + </view>
  124 + <view class="flex-center fs32" wx:if="{{is_bc_show==1&&dismantle!=null&&is_dis_list==1}}">
126 125 <view class="line"></view>
127   - <view class="load white" bindtap="dismantle_record">点击加载更多</view>
  126 + <view class="load white" bindtap="dismantle_record_list">点击加载更多</view>
128 127 <view class="line"></view>
129 128 </view>
130 129 </block>
... ... @@ -141,12 +140,12 @@
141 140 </view>
142 141 <!-- 加载更多 -->
143 142 <view class="fs32">
144   - <view class="flex-center" wx:if="{{is_show==1}}">
  143 + <view class="flex-center" wx:if="{{is_show==1&&is_user_list==0}}">
145 144 <view class="line"></view>
146   - <view class="load white" bindtap="user_task_list">点击加载更多</view>
  145 + <view class="load white" bindtap="task_list">点击加载更多</view>
147 146 <view class="line"></view>
148 147 </view>
149   - <view class="flex-center white" style="margin-top: 20rpx;" wx:if="{{usercount>0}}">
  148 + <view class="flex-center white bottom" wx:if="{{usercount>0}}">
150 149 <view>已有{{usercount}}人领取了任务</view>
151 150 </view>
152 151 </view>
... ...
pages/user/assistance/task_assistance.wxss
... ... @@ -226,3 +226,13 @@ page {
226 226 filter: alpha(opacity=60);
227 227 bottom: 0rpx;
228 228 }
  229 +.is_dismantle_frame{
  230 + align-content: center;
  231 +height: 56rpx;
  232 +line-height: 48rpx;
  233 +
  234 +}
  235 +.bottom{
  236 + margin-bottom: 50rpx;
  237 + margin-top: 20rpx;
  238 +}
229 239 \ No newline at end of file
... ...
pages/user/index/index.js
1   -var auth = require("../../../utils/auth.js"),rq = require("../../../utils/request.js");
2   -var e = getApp(),app=e, s = e.globalData.setting,os=s,app_d = e.globalData;
  1 +var auth = require("../../../utils/auth.js"),
  2 + rq = require("../../../utils/request.js");
  3 +var e = getApp(),
  4 + app = e,
  5 + s = e.globalData.setting,
  6 + os = s,
  7 + app_d = e.globalData;
3 8 var regeneratorRuntime = require('../../../utils/runtime.js');
4 9 const {
5 10 barcode,
... ... @@ -12,69 +17,74 @@ Page({
12 17 * 页面的初始数据
13 18 */
14 19 data: {
15   - length:150,
16   - iurl: s.imghost,
17   - defaultAvatar:s.imghost+"/miniapp/images/no-head.jpg",
18   - userInfo:null,
19   - toji:null, //统计相关
20   - txmon:0,
21   - byquan: 0,
22   - yuer: 0,
23   - currentPage:1,
24   - recommend_list:[],
25   - tc_hide: true,
26   - sw_index:0,
27   - qy_list:null,
28   - gradeId:null,
29   - is_init:0,
30   - cz_val:0,
31   - full_cz_val:0,
32   - is_dengji:0, //是不是等级
33   - is_banner:0,//是不是有生日活动
34   - giftbagid:"",//生日活动的类型
35   - actId:"",//生日活动的id
36   - actImg:"",
37   - is_assistance:0,//助力活动
  20 + length: 150,
  21 + iurl: s.imghost,
  22 + defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg",
  23 + userInfo: null,
  24 + toji: null, //统计相关
  25 + txmon: 0,
  26 + byquan: 0,
  27 + yuer: 0,
  28 + currentPage: 1,
  29 + recommend_list: [],
  30 + tc_hide: true,
  31 + sw_index: 0,
  32 + qy_list: null,
  33 + gradeId: null,
  34 + is_init: 0,
  35 + cz_val: 0,
  36 + full_cz_val: 0,
  37 + is_dengji: 0, //是不是等级
  38 + is_banner: 0, //是不是有生日活动
  39 + giftbagid: "", //生日活动的类型
  40 + actId: "", //生日活动的id
  41 + actImg: "",
  42 + is_assistance: 0, //助力活动
38 43 },
39   - goto_nav: function (e) {
  44 + goto_nav: function(e) {
40 45 var th = this;
41 46 var url = e.currentTarget.dataset.url;
42 47 if (th.data.userInfo != null) {
43 48 getApp().goto(url);
44 49 } else {
45   - wx.navigateTo({
46   - url: '/pages/getphone/getphone',
47   - })
  50 + wx.navigateTo({
  51 + url: '/pages/getphone/getphone',
  52 + })
48 53 }
49 54 },
50 55 /**
51 56 * 生命周期函数--监听页面加载
52 57 */
53   - onLoad: function (options) {
54   - this.birthday();
  58 + onLoad: function(options) {
  59 + this.birthday();
55 60 },
56 61  
57 62 /**
58 63 * 生命周期函数--监听页面显示
59 64 */
60   - onShow: function () {
61   -
62   - this.is_assistance();
63   -
  65 + onShow: function() {
  66 +
  67 + this.is_assistance();
  68 +
64 69 var stoid = app_d.setting.stoid;
65   - var s = this,th=s,need_money=0,cur_g_num=0;
  70 + var s = this,
  71 + th = s,
  72 + need_money = 0,
  73 + cur_g_num = 0;
66 74 getApp().get_isbuy(th.setappdata);
67   - if(getApp().globalData.user_id) getApp().requestCardNum();
  75 + if (getApp().globalData.user_id) getApp().requestCardNum();
68 76 /*------会员登录------*/
69   - app.getUserFir(async function(e){
70   - if(e!=undefined && e!=null && e.mobile){
  77 + app.getUserFir(async function(e) {
  78 + if (e != undefined && e != null && e.mobile) {
71 79 s.setData({
72 80 userInfo: e
73 81 });
74 82 /*-----统计-----*/
75   - rq.get("/api/weshop/order/waitlist",{
76   - data: { user_id: app_d.user_id},
77   - success: function (su) {
  83 + rq.get("/api/weshop/order/waitlist", {
  84 + data: {
  85 + user_id: app_d.user_id
  86 + },
  87 + success: function(su) {
78 88 s.setData({
79 89 toji: su.data.data,
80 90 });
... ... @@ -82,114 +92,155 @@ Page({
82 92 })
83 93 /*-----获取线下会员的预存款和优惠券的数量-----*/
84 94 rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, {
85   - success: function (su) {
86   - var data=su.data.data;
  95 + success: function(su) {
  96 + var data = su.data.data;
87 97 data.cashcount = parseInt(data.cashcount);
88   - s.setData({ udata: data, });
  98 + s.setData({
  99 + udata: data,
  100 + });
89 101 }
90 102 })
91 103 /*-----获取会员提现金额-----*/
92 104 rq.get("/api/weshop/withdrawals/summoney", {
93   - data: { user_id: e.user_id, store_id: os.stoid, status: 0 },
94   - success: function (su) {
  105 + data: {
  106 + user_id: e.user_id,
  107 + store_id: os.stoid,
  108 + status: 0
  109 + },
  110 + success: function(su) {
95 111 if (su.data.code == 0) {
96 112 var yuer = parseFloat(th.data.userInfo.user_money -
97   - th.data.userInfo.frozen_money - su.data.data.summoney).toFixed(2);
98   - th.setData({ txmon: su.data.data.summoney, yuer: yuer });
  113 + th.data.userInfo.frozen_money - su.data.data.summoney).toFixed(2);
  114 + th.setData({
  115 + txmon: su.data.data.summoney,
  116 + yuer: yuer
  117 + });
99 118 }
100 119 }
101 120 })
102 121  
103 122 /*-----获取会员包邮券的数量-----*/
104 123 rq.get("/api/weshop/userfeemail/page", {
105   - data: { user_id: e.user_id, store_id: os.stoid, pageSize:1,isuse:0},
106   - success: function (su) {
  124 + data: {
  125 + user_id: e.user_id,
  126 + store_id: os.stoid,
  127 + pageSize: 1,
  128 + isuse: 0
  129 + },
  130 + success: function(su) {
107 131 if (su.data.code == 0) {
108   - th.setData({ byquan: parseInt(su.data.data.total)});
  132 + th.setData({
  133 + byquan: parseInt(su.data.data.total)
  134 + });
109 135 }
110 136 }
111 137 })
112 138  
113 139 /*-----获取会员权益列表-----*/
114 140 rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", {
115   - data: { storeId: os.stoid,pageSize:100},
116   - success: async function (res) {
117   - var arr_data=res.data.data.pageData;
118   - var gid=null,g_qy_list=null,cz_vals=0,need_money=0,
119   - backClass = null, is_init = 0, GradeName='';
  141 + data: {
  142 + storeId: os.stoid,
  143 + pageSize: 100
  144 + },
  145 + success: async function(res) {
  146 + var arr_data = res.data.data.pageData;
  147 + var gid = null,
  148 + g_qy_list = null,
  149 + cz_vals = 0,
  150 + need_money = 0,
  151 + backClass = null,
  152 + is_init = 0,
  153 + GradeName = '';
120 154  
121 155 //--初始化是否有打勾--
122 156 await getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
123   - data: { storeId: os.stoid}
  157 + data: {
  158 + storeId: os.stoid
  159 + }
124 160 }).then(res => {
125   - is_init=res.data.data.isBool;
  161 + is_init = res.data.data.isBool;
126 162 })
127 163  
128 164 //获取成长值
129   - await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get",{
130   - data:{ storeId:os.stoid,userId:app_d.user_id }
131   - }).then(res=>{
132   - if (res.data.code == 0 && res.data.data){
133   - gid=res.data.data.GradeId;
134   - var cz_val = res.data.data.GradeSum;
135   - cz_vals=parseInt(cz_val);
136   - GradeName=res.data.data.GradeName;
137   - }
138   - //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid});
139   - })
140   - var obj = { cz_val: cz_vals, GradeName:GradeName, is_init: is_init, gradeId: gid };
141   -
142   - // 获取最大值
143   - await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", {
144   - data: { storeId: os.stoid }
145   - }).then(res => {
146   - if (res.data.data)
147   - backClass = res.data.data.pageData;
148   - if (backClass){
149   - var full_cz_val = backClass[backClass.length - 1].BuyGradeSum;
150   - //th.setData({ full_cz_val: full_cz_val});
151   - obj.full_cz_val = full_cz_val
152   - }
153   - })
154   -
155   - //--会员权益中心页的修改--
156   - for(var i in backClass){
157   - var im=backClass[i];
158   - if(cz_vals<im.BuyGradeSum && need_money==0){
159   - need_money=im.BuyGradeSum;
160   - obj.need_money = need_money;
161   - }
  165 + await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get", {
  166 + data: {
  167 + storeId: os.stoid,
  168 + userId: app_d.user_id
  169 + }
  170 + }).then(res => {
  171 + if (res.data.code == 0 && res.data.data) {
  172 + gid = res.data.data.GradeId;
  173 + var cz_val = res.data.data.GradeSum;
  174 + cz_vals = parseInt(cz_val);
  175 + GradeName = res.data.data.GradeName;
162 176 }
  177 + //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid});
  178 + })
  179 + var obj = {
  180 + cz_val: cz_vals,
  181 + GradeName: GradeName,
  182 + is_init: is_init,
  183 + gradeId: gid
  184 + };
  185 +
  186 + // 获取最大值
  187 + await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", {
  188 + data: {
  189 + storeId: os.stoid
  190 + }
  191 + }).then(res => {
  192 + if (res.data.data)
  193 + backClass = res.data.data.pageData;
  194 + if (backClass) {
  195 + var full_cz_val = backClass[backClass.length - 1].BuyGradeSum;
  196 + //th.setData({ full_cz_val: full_cz_val});
  197 + obj.full_cz_val = full_cz_val
  198 + }
  199 + })
163 200  
164   - //获取当前等级的特权
165   - await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page",{
166   - data: { storeId: os.stoid, GradeId: gid, userId: app_d.user_id, pageSize: 100}
167   - }).then(res=>{
168   - if (res.data.data)
169   - g_qy_list=res.data.data.pageData;
170   - });
  201 + //--会员权益中心页的修改--
  202 + for (var i in backClass) {
  203 + var im = backClass[i];
  204 + if (cz_vals < im.BuyGradeSum && need_money == 0) {
  205 + need_money = im.BuyGradeSum;
  206 + obj.need_money = need_money;
  207 + }
  208 + }
171 209  
172   - for(var i in arr_data){
173   - var item=arr_data[i];
174   - var FromId=th.check_is_has_qy(item,g_qy_list);
175   - arr_data[i].ishas=0;
176   - if(FromId){
177   - arr_data[i].ishas=1;
178   - arr_data[i].FromId=FromId;
179   - }
  210 + //获取当前等级的特权
  211 + await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", {
  212 + data: {
  213 + storeId: os.stoid,
  214 + GradeId: gid,
  215 + userId: app_d.user_id,
  216 + pageSize: 100
180 217 }
181   - arr_data.sort(function(a,b){
182   - return b.ishas-a.ishas
183   - })
  218 + }).then(res => {
  219 + if (res.data.data)
  220 + g_qy_list = res.data.data.pageData;
  221 + });
184 222  
185   - //4个4个一组
186   - var arr = new Array();
187   - for(var i=0;i< arr_data.length;i+=4){
188   - arr.push(arr_data.slice(i,i+4));
  223 + for (var i in arr_data) {
  224 + var item = arr_data[i];
  225 + var FromId = th.check_is_has_qy(item, g_qy_list);
  226 + arr_data[i].ishas = 0;
  227 + if (FromId) {
  228 + arr_data[i].ishas = 1;
  229 + arr_data[i].FromId = FromId;
189 230 }
190   - //th.setData({ qy_list: arr, need_money: need_money});
191   - obj.qy_list=arr;
192   - th.setData(obj);
  231 + }
  232 + arr_data.sort(function(a, b) {
  233 + return b.ishas - a.ishas
  234 + })
  235 +
  236 + //4个4个一组
  237 + var arr = new Array();
  238 + for (var i = 0; i < arr_data.length; i += 4) {
  239 + arr.push(arr_data.slice(i, i + 4));
  240 + }
  241 + //th.setData({ qy_list: arr, need_money: need_money});
  242 + obj.qy_list = arr;
  243 + th.setData(obj);
193 244 }
194 245 })
195 246  
... ... @@ -197,21 +248,31 @@ Page({
197 248 th.requestRecommend();
198 249  
199 250 /*-------系统是否开通等级卡,会员是等级卡-----*/
200   - getApp().getConfig2(function (e) {
201   - var t_swi=e.switch_list;
202   - if(t_swi) t_swi=JSON.parse(t_swi)
203   - if(parseInt(t_swi.rank_switch)==2){
204   - var userInfo=th.data.userInfo;
205   - if(userInfo.card_field!=null && userInfo.card_field!=undefined && userInfo.card_field!="" ){
206   - var now=ut.gettimestamp();
207   - var str= userInfo.card_expiredate;
208   - var end = new Date(str);
209   - end = Date.parse(end) / 1000;
210   - //---判断是不是有过期---
211   - if(now<end){ th.setData({is_dengji:1}) }else{ th.setData({is_dengji:3}) }
212   - }else{
213   - th.setData({is_dengji:2})
  251 + getApp().getConfig2(function(e) {
  252 + var t_swi = e.switch_list;
  253 + if (t_swi) t_swi = JSON.parse(t_swi)
  254 + if (parseInt(t_swi.rank_switch) == 2) {
  255 + var userInfo = th.data.userInfo;
  256 + if (userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") {
  257 + var now = ut.gettimestamp();
  258 + var str = userInfo.card_expiredate;
  259 + var end = new Date(str);
  260 + end = Date.parse(end) / 1000;
  261 + //---判断是不是有过期---
  262 + if (now < end) {
  263 + th.setData({
  264 + is_dengji: 1
  265 + })
  266 + } else {
  267 + th.setData({
  268 + is_dengji: 3
  269 + })
214 270 }
  271 + } else {
  272 + th.setData({
  273 + is_dengji: 2
  274 + })
  275 + }
215 276 }
216 277 })
217 278  
... ... @@ -228,12 +289,12 @@ Page({
228 289 },
229 290  
230 291 //判断会员是后有改服务项目
231   - check_is_has_qy:function(item,g_qy_list){
232   - if(!g_qy_list) return false;
  292 + check_is_has_qy: function(item, g_qy_list) {
  293 + if (!g_qy_list) return false;
233 294  
234   - for(var i in g_qy_list){
235   - var iter=g_qy_list[i];
236   - if(iter.FormId==item.Id) return g_qy_list[i].FormId;
  295 + for (var i in g_qy_list) {
  296 + var iter = g_qy_list[i];
  297 + if (iter.FormId == item.Id) return g_qy_list[i].FormId;
237 298 }
238 299 return false;
239 300 },
... ... @@ -241,8 +302,8 @@ Page({
241 302 /**
242 303 * 生命周期函数--监听页面隐藏
243 304 */
244   - onHide: function () {},
245   - setappdata: function (t) {
  305 + onHide: function() {},
  306 + setappdata: function(t) {
246 307 if (t.isout == 1)
247 308 wx.navigateTo({
248 309 url: "/pages/error/error?msg=小程序已经过期",
... ... @@ -256,70 +317,72 @@ Page({
256 317 /**
257 318 * 页面上拉触底事件的处理函数
258 319 */
259   - onReachBottom: function () {
  320 + onReachBottom: function() {
260 321 //!this.nomore && this.requestRecommend();
261   - var goods_list = this.selectComponent("#goods_recommend"); //组件的id
  322 + var goods_list = this.selectComponent("#goods_recommend"); //组件的id
262 323 goods_list.init();
263   - setTimeout(function () { goods_list.get_list(); }, 300)
  324 + setTimeout(function() {
  325 + goods_list.get_list();
  326 + }, 300)
264 327 },
265 328  
266 329 /**
267 330 * 用户点击右上角分享
268 331 */
269   - onShareAppMessage: function () {},
  332 + onShareAppMessage: function() {},
270 333  
271 334 //------卡片的显示和关闭--------
272   - show_tc:function(){
273   - if(!this.data.userInfo) return false;
274   - qrcode('qrcode',this.data.userInfo.mobile, 480, 480,this);
  335 + show_tc: function() {
  336 + if (!this.data.userInfo) return false;
  337 + qrcode('qrcode', this.data.userInfo.mobile, 480, 480, this);
275 338 this.setData({
276   - tc_hide:false,
  339 + tc_hide: false,
277 340 });
278 341 },
279   - hide_tc:function(){
  342 + hide_tc: function() {
280 343 this.setData({
281 344 tc_hide: true,
282 345 });
283 346 },
284 347  
285 348 //--跳转到预存款页面--
286   - deposit: function () {
287   - if(!this.data.userInfo) return false;
288   - wx.navigateTo({
289   - url: '../deposit/deposit',
290   - })
  349 + deposit: function() {
  350 + if (!this.data.userInfo) return false;
  351 + wx.navigateTo({
  352 + url: '../deposit/deposit',
  353 + })
291 354 },
292 355 //--跳转到余额页面--
293   - balance: function () {
294   - if(!this.data.userInfo) return false;
  356 + balance: function() {
  357 + if (!this.data.userInfo) return false;
295 358 wx.navigateTo({
296 359 url: '../member/menber',
297 360 })
298 361 },
299 362 //--跳转到优惠券--
300   - coupon: function () {
301   - if(!this.data.userInfo) return false;
  363 + coupon: function() {
  364 + if (!this.data.userInfo) return false;
302 365 wx.navigateTo({
303 366 url: '../coupons/coupons',
304 367 })
305 368 },
306 369 //--跳转到积分--
307   - integral: function () {
308   - if(!this.data.userInfo) return false;
  370 + integral: function() {
  371 + if (!this.data.userInfo) return false;
309 372 wx.navigateTo({
310 373 url: '../integral/integral',
311 374 })
312 375 },
313 376 //--跳到绑定页面--
314   - gobindtel:function(){
  377 + gobindtel: function() {
315 378 wx.navigateTo({
316 379 url: '/pages/getphone/getphone',
317 380 })
318 381 },
319 382  
320   - go_order:function (e) {
321   - if(!this.data.userInfo) return false;
322   - var url=e.currentTarget.dataset.url;
  383 + go_order: function(e) {
  384 + if (!this.data.userInfo) return false;
  385 + var url = e.currentTarget.dataset.url;
323 386 wx.navigateTo({
324 387 url: url,
325 388 })
... ... @@ -327,53 +390,70 @@ Page({
327 390 },
328 391  
329 392 //--加载更多商品--
330   - requestRecommend: function () {
331   - var e = this, t = '/api/weshop/goods/page?page=' + e.data.currentPage;
332   - var th_recommend_list=e.data.recommend_list;
333   - getApp().request.get(t,{
334   - data: { is_mainshow: 1, isonsale: 1, is_recommend:1, is_on_sale: 1, store_id: os.stoid, pageSize: 10 },
335   - success:function (ee) {
336   - var recommend_list=ee.data.data.pageData;
337   - if(recommend_list && recommend_list.length>0){
338   - var dd=[...th_recommend_list,...recommend_list];
339   - e.setData({recommend_list,dd});
340   - e.data.currentPage++;
341   - }else{
342   - e.setData({nomore:1});
343   - }
344   - }
  393 + requestRecommend: function() {
  394 + var e = this,
  395 + t = '/api/weshop/goods/page?page=' + e.data.currentPage;
  396 + var th_recommend_list = e.data.recommend_list;
  397 + getApp().request.get(t, {
  398 + data: {
  399 + is_mainshow: 1,
  400 + isonsale: 1,
  401 + is_recommend: 1,
  402 + is_on_sale: 1,
  403 + store_id: os.stoid,
  404 + pageSize: 10
  405 + },
  406 + success: function(ee) {
  407 + var recommend_list = ee.data.data.pageData;
  408 + if (recommend_list && recommend_list.length > 0) {
  409 + var dd = [...th_recommend_list, ...recommend_list];
  410 + e.setData({
  411 + recommend_list,
  412 + dd
  413 + });
  414 + e.data.currentPage++;
  415 + } else {
  416 + e.setData({
  417 + nomore: 1
  418 + });
  419 + }
  420 + }
345 421 })
346 422 },
347 423  
348 424 //--跳转到权益页面--
349   - go_qy:function () {
350   - if(!this.data.userInfo) return false;
351   - var url="/pages/user/userqy/userqy";
  425 + go_qy: function() {
  426 + if (!this.data.userInfo) return false;
  427 + var url = "/pages/user/userqy/userqy";
352 428 getApp().goto(url);
353 429 },
354 430  
355 431 //--跳转到商品详情页面--
356   - go_goods:function (e) {
357   - var gid=e.currentTarget.dataset.gid;
358   - var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+gid;
  432 + go_goods: function(e) {
  433 + var gid = e.currentTarget.dataset.gid;
  434 + var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid;
359 435 getApp().goto(url);
360 436 },
361 437  
362   - click_next:function(){
363   - var index=this.data.sw_index;
  438 + click_next: function() {
  439 + var index = this.data.sw_index;
364 440 index++;
365   - if(index>=this.data.qy_list.length) return;
366   - this.setData({ sw_index:index})
  441 + if (index >= this.data.qy_list.length) return;
  442 + this.setData({
  443 + sw_index: index
  444 + })
367 445 },
368 446  
369   - click_pre:function(){
370   - var index=this.data.sw_index;
  447 + click_pre: function() {
  448 + var index = this.data.sw_index;
371 449 index--;
372   - if(index<0) return;
373   - this.setData({ sw_index:index})
  450 + if (index < 0) return;
  451 + this.setData({
  452 + sw_index: index
  453 + })
374 454 },
375 455  
376   - onSli:function(e){
  456 + onSli: function(e) {
377 457 var that = this;
378 458 that.setData({
379 459 sw_index: e.detail.current
... ... @@ -381,40 +461,51 @@ Page({
381 461 },
382 462  
383 463 //--权益使用--
384   - go_qy_url:function (e) {
385   - var th=this;
386   - var no=e.currentTarget.dataset.no;
387   - var ind=e.currentTarget.dataset.ind;
388   - var find=e.currentTarget.dataset.find;
389   - var item=th.data.qy_list[find][ind];
390   - if(item.ishas==undefined || !item.ishas){
  464 + go_qy_url: function(e) {
  465 + var th = this;
  466 + var no = e.currentTarget.dataset.no;
  467 + var ind = e.currentTarget.dataset.ind;
  468 + var find = e.currentTarget.dataset.find;
  469 + var item = th.data.qy_list[find][ind];
  470 + if (item.ishas == undefined || !item.ishas) {
391 471 var qt_txt = th.selectComponent("#pop_txt"); //组件的id
392   - var ob={title:"温馨提示",content:"当前会员暂无此权益"};
  472 + var ob = {
  473 + title: "温馨提示",
  474 + content: "当前会员暂无此权益"
  475 + };
393 476 qt_txt.open(ob);
394 477 return false;
395 478 }
396 479  
397   - var url=e.currentTarget.dataset.img;
  480 + var url = e.currentTarget.dataset.img;
398 481  
399 482 switch (no) {
400 483 case "01":
401   - getApp().goto("/pages/user/user_coupon/user_coupon?img="
402   - +url+"&gradeId="+th.data.gradeId+"&FormId="+item.Id);
  484 + getApp().goto("/pages/user/user_coupon/user_coupon?img=" +
  485 + url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
403 486 break;
404 487 case "02":
405   - getApp().goto("/pages/user/user_fw/user_fw?gradeId="+th.data.gradeId+"&FormId="+item.Id);
  488 + getApp().goto("/pages/user/user_fw/user_fw?gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
406 489 break;
407 490 case "03":
408 491 getApp().goto("/pages/user/user_spsy/user_spsy");
409 492 break;
410 493 case "10":
411   - getApp().request.get("/api/weshop/users/grade/vipprivilegelist/other/get",{
412   - data:{storeId:os.stoid, formId:item.Id,userId:getApp().globalData.user_id,gradeId:th.data.gradeId},
413   - success:function (res) {
414   - var val=res.data.data.Remark;
415   - var title=res.data.data.PrivilegeName;
  494 + getApp().request.get("/api/weshop/users/grade/vipprivilegelist/other/get", {
  495 + data: {
  496 + storeId: os.stoid,
  497 + formId: item.Id,
  498 + userId: getApp().globalData.user_id,
  499 + gradeId: th.data.gradeId
  500 + },
  501 + success: function(res) {
  502 + var val = res.data.data.Remark;
  503 + var title = res.data.data.PrivilegeName;
416 504 var qt_txt = th.selectComponent("#pop_txt"); //组件的id
417   - var ob={title:title,content:val};
  505 + var ob = {
  506 + title: title,
  507 + content: val
  508 + };
418 509 qt_txt.open(ob);
419 510 }
420 511 })
... ... @@ -423,88 +514,93 @@ Page({
423 514 },
424 515  
425 516 //跳转到链接
426   - goto:function (e) {
427   - var url=e.currentTarget.dataset.url;
428   - getApp().goto(url);
  517 + goto: function(e) {
  518 + var url = e.currentTarget.dataset.url;
  519 + getApp().goto(url);
429 520 },
430 521  
431 522 //---------联系客服------------
432 523 contactService: function() {
433   - var s=getApp();
  524 + var s = getApp();
434 525 s.getConfig(function(t) {
435   - if(t.store_tel==undefined){
436   - getApp().request.get("/api/weshop/store/get/" + os.stoid,{
437   - isShowLoading:1,
438   - data:{},
439   - success:function (rs) {
  526 + if (t.store_tel == undefined) {
  527 + getApp().request.get("/api/weshop/store/get/" + os.stoid, {
  528 + isShowLoading: 1,
  529 + data: {},
  530 + success: function(rs) {
440 531 getApp().globalData.config = rs.data.data;
441   - if(rs.data.data.store_tel==null && rs.data.data.store_tel==undefined ){
  532 + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
442 533 getApp().showWarning("商家未设置电话");
443 534 return false;
444 535 }
445 536 s.confirmBox("请联系客服:" + rs.data.data.store_tel);
446 537 }
447 538 })
448   - }else{
  539 + } else {
449 540 s.confirmBox("请联系客服:" + t.store_tel);
450 541 }
451 542 });
452 543 },
453 544  
454   - go_info:function () {
455   - getApp().goto("/pages/user/userinfo/userinfo");
  545 + go_info: function() {
  546 + getApp().goto("/pages/user/userinfo/userinfo");
456 547 },
457 548  
458   - jump: function () {
  549 + jump: function() {
459 550 getApp().goto("/pages/user/grow_value/grow_value")
460 551 },
461 552 // 判断生日营销的页面是不是存在
462   - birthday:function(){
  553 + birthday: function() {
463 554 var th = this;
464   - // rq.get("/api/weshop/marketing/birthday/act/judge", {
465   - // data: { storeId: os.stoid, userId: app_d.user_id },
466   - // success: function (res) {
467   - // var code = res.data.code;
468   - // if (code == 0) {
469   - // var giftbagid = res.data.data.giftBagId;
470   - // var actId = res.data.data.id;
471   - // var actImg = res.data.data.actImg;
472   - // t.setData({ giftbagid: giftbagid, actId: actId, actImg: actImg });
473   - // t.setData({ is_banner: 1 });
474   - // }
475   -
476   - // }
477   - // })
  555 + rq.get("/api/weshop/marketing/birthday/act/judge", {
  556 + data: { storeId: os.stoid, userId: app_d.user_id },
  557 + success: function (res) {
  558 + var code = res.data.code;
  559 + if (code == 0) {
  560 + var giftbagid = res.data.data.giftBagId;
  561 + var actId = res.data.data.id;
  562 + var actImg = res.data.data.actImg;
  563 + t.setData({ giftbagid: giftbagid, actId: actId, actImg: actImg });
  564 + t.setData({ is_banner: 1 });
  565 + }
  566 +
  567 + }
  568 + })
478 569  
479 570  
480 571 },
481   - clike_banne:function(){
  572 + clike_banne: function() {
482 573 var th = this;
483   - var actId=th.data.actId;
484   - var giftbagid=th.data.giftbagid;
485   - if (actId != "" && giftbagid!=""){
  574 + var actId = th.data.actId;
  575 + var giftbagid = th.data.giftbagid;
  576 + if (actId != "" && giftbagid != "") {
486 577  
487   - wx.redirectTo({
488   - url: "/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3
489   - });
490   - }else{
491   -
492   - getApp().showWarning("请稍后重试");
  578 + wx.redirectTo({
  579 + url: "/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3
  580 + });
  581 + } else {
  582 +
  583 + getApp().showWarning("请稍后重试");
493 584 }
494 585 },
495 586 // 判断助力活动是不是存在
496   - is_assistance:function(){
497   - // var th = this;
498   - // rq.get("/api/weshop/marketing/help/act/judge", {
499   - // data: { storeId: os.stoid, userId: app_d.user_id },
500   - // success: function (res) {
501   - // var code = res.data.code;
502   - // if (code == 0) {
503   - // th.setData({ is_assistance:1});
504   - // }
505   -
506   - // }
507   - // })
  587 + is_assistance: function() {
  588 + var th = this;
  589 + rq.get("/api/weshop/marketing/help/act/judge", {
  590 + data: {
  591 + storeId: os.stoid,
  592 + userId: app_d.user_id
  593 + },
  594 + success: function(res) {
  595 + var code = res.data.code;
  596 + if (code == 0) {
  597 + th.setData({
  598 + is_assistance: 1
  599 + });
  600 + }
  601 +
  602 + }
  603 + })
508 604 }
509 605  
510 606  
... ...