diff --git a/app.js b/app.js index 7d35cf9..55e8796 100644 --- a/app.js +++ b/app.js @@ -51,7 +51,7 @@ App({ config: null, //门店参数 config2: null, //门店配置 code: null, - user_id:null,//15240065,//6520352,//6520390,//6520352 + user_id:null,//6520390,//6520352 // user_id:6520314,// qa-6519858,// // user_id:14148118,// qa-6519858,// buy_now: null, @@ -124,6 +124,7 @@ App({ getApp().globalData.guide_id = res.data.data.id; } }) + app.promiseGet("/api/weshop/users/getAndUpdateUser/" +user.store_id + "/" + user.user_id, {}) } wx.setStorageSync("userinfo", user); @@ -140,6 +141,8 @@ App({ if(res.data.code==0){ app.globalData.userInfo = res.data.data; wx.setStorageSync("userinfo",app.globalData.userInfo); + //刷一下导购 + app.promiseGet("/api/weshop/users/getAndUpdateUser/" +app.globalData.setting.stoid + "/" + app.globalData.user_id, {}) } }) } diff --git a/packageA/pages/checkin/checkin.js b/packageA/pages/checkin/checkin.js index 05cd0db..27795b3 100644 --- a/packageA/pages/checkin/checkin.js +++ b/packageA/pages/checkin/checkin.js @@ -236,13 +236,29 @@ Page({ // 点击签到 checkInToday() { - const self = this; + var ck = this.data.day; + if (parseInt(ck) < 10) ck = "0" + ck; + if(this.data.res && this.data.res.qddaylist){ + var isCheckInToday = this.data.res.qddaylist.indexOf(ck); + //已经签到 + if (isCheckInToday >-1) { + return false; + } + } + + + if(this.data.td_cked) return false; + if(this.data.cking) return false; + this.setData({cking:1}); + + const self = this; getApp().request.get("/api/weshop/users/getServerTime", { success: function (res) { if (res.data.code == 0) { var getnowtime = res.data.data; if (!getnowtime) { + self.setData({cking:0}); getApp().showWarning("获取服务时间失败"); return; } else { @@ -254,24 +270,32 @@ Page({ // 如果还没签到, 可以点击签到 if (isCheckInToday == -1) { + getnowtime = getnowtime.replace(/-/g, "/") var timeid = Date.parse(getnowtime)/1000; var key = "rgqsqLYhw67sgaIQBF6dw9JK7CDKSS"; var str = app.globalData.setting.stoid + ":" + app.globalData.user_id + ":" + timeid + ":" + key var sign = md5(str); + var qdbh='qd'+ut.format(null,'yyyyMMddhhmmssS')+(Math.floor(Math.random()*9999)+1000)+app.globalData.user_id; + app.request.promisePost('/api/weshop/qdrecord/saveQd', { data: { store_id: app.globalData.setting.stoid, user_id: app.globalData.user_id, timeid: timeid, - sign: sign + sign: sign, + qdbh:qdbh } }).then(res2 => { // 改变签到状态,由false置为true // let newDateArr = self.data.dateArr; - // newDateArr[self.data.day-1].isCheckIn = true; + // newDateArr[self.data.day-1].isCheckIn = true; + self.setData({cking:0}); + if (res2.data.code == 0) { + + self.data.td_cked=1; for (var i in self.data.dateArr) { self.data.dateArr[i].isCheckIn = false; self.data.dateArr[i].isBq = false; @@ -295,12 +319,16 @@ Page({ } - }) } + else{ + self.data.td_cked=1; + self.setData({cking:0}); + } } } else { + self.setData({cking:0}); getApp().showWarning(res.data.msg); } } @@ -311,18 +339,24 @@ Page({ // 补签 reCheckIn() { + + + if(this.data.cking) return false; + this.setDate({cking:1}); + var self = this; // var i = 0; console.log('补签~'); if (this.data.flag) { this.data.flag = false; + app.request.promisePost('/api/weshop/qdrecord/saveBQd', { data: { store_id: app.globalData.setting.stoid, user_id: app.globalData.user_id, daynum: self.data.res.getBQIntegral1, bqnum: self.data.res.getbqnum2, - bqintegral: self.data.res.getBQIntegral, + bqintegral: self.data.res.getBQIntegral } }).then(res => { // 改变签到状态,由false置为true @@ -335,6 +369,7 @@ Page({ var date = new Date(item); list.push(date.getDate()); }--*/ + self.setDate({cking:0}); if (res.data.code == 0) { for (var i in self.data.dateArr) { self.data.dateArr[i].isCheckIn = false; @@ -427,6 +462,26 @@ Page({ back_to() { wx.navigateBack(); + }, + + setDate_is_act(){ + let year=this.data.year; + let sday3=res.sday3; + let qddaylist=res.qddaylist; + + + var date = getDate(year + '-' + startDate); + date.setDate(date.getDate() + num); + date = getDate(date).getDate(); + if(date<10) date="0"+date; + if(!qdlist) return false; + if(qdlist.indexOf(date)!=-1){ + return true + } + return false; + + + } }) diff --git a/packageA/pages/checkin/checkin.wxml b/packageA/pages/checkin/checkin.wxml index 1bd64da..33af107 100644 --- a/packageA/pages/checkin/checkin.wxml +++ b/packageA/pages/checkin/checkin.wxml @@ -44,13 +44,13 @@ - + {{!myUtil.setDate_is_act(year, res.sday3, 0,res.qddaylist) ? '立即签到':'今日已签到'}} 签到请登录 - 补签(-{{res.getBQIntegral}}分) + 补签(-{{res.getBQIntegral}}分) diff --git a/packageA/pages/checkin/checkin.wxss b/packageA/pages/checkin/checkin.wxss index 94836dd..d733e13 100644 --- a/packageA/pages/checkin/checkin.wxss +++ b/packageA/pages/checkin/checkin.wxss @@ -94,6 +94,11 @@ page, font-weight: bold; } +.btn.gray{ + background-color: gainsboro; +} + + .list { margin: 80rpx 20rpx 60rpx; color: rgba(255,255,255,.3); diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js index b9a202e..8dd2b15 100644 --- a/pages/user/plus/plus.js +++ b/pages/user/plus/plus.js @@ -242,18 +242,19 @@ Page({ getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + app_d.user_id, { success: function (e) { - var userInfo = e.data.data; - if (userInfo['card_field'] && !getApp().globalData.is_card_back) { - var u_url = "/packageE/pages/user/cardinfo/cardinfo"; - wx.reLaunch({ - url: u_url - }) - - } + var userInfo = e.data.data; + if (userInfo && userInfo['card_field'] && !getApp().globalData.is_card_back) { + var u_url = "/packageE/pages/user/cardinfo/cardinfo"; + wx.reLaunch({ + url: u_url + }) + }else{ + th.getPlusCardType(); + } }, }); - this.getPlusCardType(); + }, /** diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index 93499df..44d8a2c 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -148,6 +148,12 @@ Page({ isstcsp: 1 }) } else { + + if(this.data.user.isVerification) { + getApp().my_warnning("已设置消费需启用密码,无法取消", 0, th); + return false; + } + th.setData({ isstcsp: 0 }) diff --git a/utils/util.js b/utils/util.js index 7987d9e..77237f9 100644 --- a/utils/util.js +++ b/utils/util.js @@ -608,9 +608,10 @@ module.exports = { }; return void 0 !== r && 0 == r ? [ n, o, a ].map(s).join("-") + " " + [ u, i ].map(s).join(":") : [ n, o, a ].map(s).join("-") + " " + [ u, i, f ].map(s).join(":"); }, + format: function(e, r) { var t = new Date(); - t.setTime(1e3 * e); + if(e) t.setTime(1e3 * e); var n = { "M+": t.getMonth() + 1, "d+": t.getDate(), @@ -624,6 +625,7 @@ module.exports = { for (var o in n) new RegExp("(" + o + ")").test(r) && (r = r.replace(RegExp.$1, 1 == RegExp.$1.length ? n[o] : ("00" + n[o]).substr(("" + n[o]).length))); return r; }, + formar_no_full(e,char){ var t= new Date(1e3 * e); var c="-";