From 0bcbc4b3e1adbb55b07196f1fe66ac618d827f93 Mon Sep 17 00:00:00 2001 From: xk_guohonglei <2057494155@qq.com> Date: Wed, 9 Sep 2020 17:07:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=9D=E6=9C=88=E7=BA=BF=E4=B8=8A=E7=89=88?= =?UTF-8?q?=E6=9C=AC1.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/analysis-card/analysis-card.vue | 24 +++---- components/area-month.vue | 2 +- components/area-time.vue | 2 +- components/staff-item.vue | 11 ++- pages.json | 46 ++++++------- pages/Auth/Auth.vue | 69 +++++++++++++------ pages/index/index.vue | 4 +- pages/login/posLogin/posLogin.vue | 12 +++- pages/operation-analysis/analysis/daily.vue | 4 +- pages/operation-analysis/analysis/monthly.vue | 29 +++----- .../operation-analysis/operation-analysis.vue | 6 +- utils/request.js | 18 ++--- 12 files changed, 125 insertions(+), 102 deletions(-) diff --git a/components/analysis-card/analysis-card.vue b/components/analysis-card/analysis-card.vue index 19739fe..5a7de20 100644 --- a/components/analysis-card/analysis-card.vue +++ b/components/analysis-card/analysis-card.vue @@ -4,7 +4,7 @@ - 交易金额(元) + 交易金额 ¥{{basicData.totalAmout|numberFilter}} @@ -13,24 +13,24 @@ - + 交易笔数 - {{basicData.totalCount}} + {{basicData.totalCount}} 客单均价 - ¥{{basicData.totalAmout/basicData.totalAccount|numberFilter}} + ¥{{basicData.totalAmout/basicData.totalAccount|numberFilter}} 顾客数 - {{basicData.totalAccount}} + {{basicData.totalAccount}} @@ -58,13 +58,13 @@ } }, watch: { - basicData: { - handler(newVal, oldVal) { - console.log('深度监听', newVal, oldVal) - this.basicData = newVal - }, - deep: true - } + basicData: { + handler(newVal, oldVal) { + console.log('深度监听', newVal, oldVal) + this.basicData = newVal + }, + deep: true + } }, filters: { numberFilter(value) { diff --git a/components/area-month.vue b/components/area-month.vue index ffb3958..b3b3cac 100644 --- a/components/area-month.vue +++ b/components/area-month.vue @@ -141,7 +141,7 @@ export default { gridColor: '#CCCCCC', dashLength: 8, splitNumber: 5, - format: (val) => { return val > 0 ? val.toFixed(0) : 0 + '单' } + format: (val) => { return val + '单' } }, width: _self.cWidth * _self.pixelRatio, height: _self.cHeight * _self.pixelRatio, diff --git a/components/area-time.vue b/components/area-time.vue index 2d25dce..f8697fc 100644 --- a/components/area-time.vue +++ b/components/area-time.vue @@ -136,7 +136,7 @@ export default { gridColor: '#CCCCCC', dashLength: 8, splitNumber: 5, - format: (val) => { return val>0?val.toFixed(0):0 + '单' } + format: (val) => { return val + '单' } }, width: _self.cWidth * _self.pixelRatio, height: _self.cHeight * _self.pixelRatio, diff --git a/components/staff-item.vue b/components/staff-item.vue index 1e1a303..e1fb19b 100644 --- a/components/staff-item.vue +++ b/components/staff-item.vue @@ -3,11 +3,15 @@ - - {{staff.cUserName}} + {{staff.cUserName}} + + (当前登录账号) + + @@ -34,7 +38,8 @@ }, data() { return { - mainURL: this.global.mainURL + mainURL: this.global.mainURL, + loginUser: uni.getStorageSync('loginUser'), }; }, methods: { diff --git a/pages.json b/pages.json index 8fd2a6e..e0abaa1 100644 --- a/pages.json +++ b/pages.json @@ -4,27 +4,27 @@ "path": "pages/startPage/startPage", "style": {} },{ + "path": "pages/login/login", + "style": { + + } + }, { "path": "pages/operation-analysis/operation-analysis", "style": { "enablePullDownRefresh": true } - },{ - "path" : "pages/operation-analysis/analysis/daily", - "style" : { + }, { + "path": "pages/operation-analysis/analysis/daily", + "style": { "enablePullDownRefresh": true } - },{ - "path": "pages/login/login", - "style": { - - } - },{ - "path": "pages/login/posLogin/posLogin", - "style": {} - } - - , - + }, { + "path": "pages/login/posLogin/posLogin", + "style": {} + } + + , + { "path": "pages/login/boforeLogin/boforeLogin", "style": {} @@ -81,16 +81,16 @@ "style": {} } - ,{ - "path" : "pages/operation-analysis/analysis/analysis", - "style" : {} - },{ - "path" : "pages/operation-analysis/analysis/monthly", - "style" : { + , { + "path": "pages/operation-analysis/analysis/analysis", + "style": {} + }, { + "path": "pages/operation-analysis/analysis/monthly", + "style": { "enablePullDownRefresh": true } - } - ], + } + ], "globalStyle": { "mp-alipay": { /* 支付宝小程序特有相关 */ diff --git a/pages/Auth/Auth.vue b/pages/Auth/Auth.vue index 68aa508..8afb61a 100644 --- a/pages/Auth/Auth.vue +++ b/pages/Auth/Auth.vue @@ -34,7 +34,7 @@ 手机号 - + {{tips}} 验证码 @@ -71,6 +71,8 @@ mainURL: this.global.mainURL, oilSiteNo: '', oilSite: {}, + tips: '发送验证码', + frozen: false, // 二维码冷却时间 auth: { } @@ -90,30 +92,53 @@ }, methods: { sendMsg() { - uni.login({ - provider: 'weixin', - success: loginRes => { - const code = loginRes.code - console.log(code) - const data2 = { - code: code, - name: this.auth.userName, - phone: this.auth.phone, - oilSiteCode: this.oilSiteNo - } - loginApi.registerWeixinSMS(data2).then(res => { - console.log('res', res) - uni.showToast({ - title: res.msg, - icon: 'none' - }) + if (!this.frozen) { + if (this.auth.phone) { + uni.login({ + provider: 'weixin', + success: loginRes => { + const code = loginRes.code + console.log(code) + const data2 = { + code: code, + name: this.auth.userName, + phone: this.auth.phone, + oilSiteCode: this.oilSiteNo + } + loginApi.registerWeixinSMS(data2).then(res => { + console.log('res', res) + uni.showToast({ + title: res.msg, + icon: 'none' + }) + if (res.code === 20000) { + this.frozen = true + setTimeout(() => { + this.frozen = false + clearInterval(timer) + this.tips = `发送验证码` + }, 1000 * 60); + let second = 60 + const timer = setInterval(() => { + second-- + if (second) { + this.tips = `${second}秒后重发` + } else { + this.tips = `发送验证码` + } + }, 1000) + + } + + }) + }, + fail: err => { + console.log(err) + } }) - }, - fail: err => { - console.log(err) } - }); + } }, register() { uni.login({ diff --git a/pages/index/index.vue b/pages/index/index.vue index 2495613..6d241c3 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -7,7 +7,7 @@ - 今日收款(元) + 今日收款 ¥{{userAccount.totalMoney|numberFilter}} @@ -29,7 +29,7 @@ --> - 账户余额(元) + 账户余额 ¥{{userAccount.totalMoney|numberFilter}} diff --git a/pages/login/posLogin/posLogin.vue b/pages/login/posLogin/posLogin.vue index cea0370..3bfa243 100644 --- a/pages/login/posLogin/posLogin.vue +++ b/pages/login/posLogin/posLogin.vue @@ -22,7 +22,7 @@ 密码 - + @@ -191,13 +191,16 @@ icon: 'none' }) if (res.code === 20000) { + this.frozen = true setTimeout(() => { - this.frozen = true + this.frozen = false clearInterval(timer) + this.tips = `发送验证码` }, 1000 * 60); let second = 60 const timer = setInterval(() => { + second-- if (second) { this.tips = `${second}秒后重发` } else { @@ -205,10 +208,12 @@ this.disabled = false this.btnColor = '#FE0505' } - second-- }, 1000) + } + }) + } else { uni.showToast({ title: '请输入您的账号', @@ -217,6 +222,7 @@ } } }, + loginRandom() { uni.login({ provider: 'weixin', diff --git a/pages/operation-analysis/analysis/daily.vue b/pages/operation-analysis/analysis/daily.vue index 7152c36..24e2288 100644 --- a/pages/operation-analysis/analysis/daily.vue +++ b/pages/operation-analysis/analysis/daily.vue @@ -24,7 +24,7 @@ - + 取消 @@ -66,7 +66,7 @@ const months = [] const month = date.getMonth() + 1 const days = [] - const day = date.getDate() - 1 + const day = date.getDate() for (let i = 2020; i <= date.getFullYear(); i++) { years.push(i) } diff --git a/pages/operation-analysis/analysis/monthly.vue b/pages/operation-analysis/analysis/monthly.vue index 1b8966b..e5a146b 100644 --- a/pages/operation-analysis/analysis/monthly.vue +++ b/pages/operation-analysis/analysis/monthly.vue @@ -19,11 +19,11 @@ - + - + 取消 @@ -37,16 +37,8 @@ {{item}}月 - - {{item}}日 - - - - - - - + @@ -91,7 +83,7 @@ day: day, // value: [9999, month - 1, day - 1], value: [0, month - 1, day - 1], - selDate: year + '-' + month + '-' + day, + selDate: year + '-' + month, detailData: [], basicData: { totalAccount: 0, @@ -117,15 +109,15 @@ }, methods: { getMonthly() { - cloudSiteApi.getAnyMonth(this.selDate).then(res => { + cloudSiteApi.getAnyMonth(this.selDate+'-5').then(res => { uni.stopPullDownRefresh() if (res.code === 20000) { this.basicData = res.data.basicData - res.data.detailData.forEach(item=>{ + res.data.detailData.forEach(item => { var date = item[0] date = date.substring(0, 19); date = date.replace(/-/g, '/'); - item[0] = new Date(date).getTime(); + item[0] = new Date(date).getTime(); }) this.detailData = res.data.detailData } @@ -144,12 +136,7 @@ } else { m = this.month } - if (this.day < 10) { - d = '0' + this.day - } else { - d = this.day - } - this.selDate = this.year + '-' + m + '-' + d + this.selDate = this.year + '-' + m console.log(this.selDate) }, showModal(e) { diff --git a/pages/operation-analysis/operation-analysis.vue b/pages/operation-analysis/operation-analysis.vue index e3a916a..ab3edc9 100644 --- a/pages/operation-analysis/operation-analysis.vue +++ b/pages/operation-analysis/operation-analysis.vue @@ -33,7 +33,7 @@ 顾客数 - ¥{{basicData.totalAccount|numberFilter}} + {{basicData.totalAccount}}