Commit 149f55a5c65d3d604cc6b92d152c40198cfd2774

Authored by iceling
1 parent fb705cd8

生日和节日的开放

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/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  
... ...