diff --git a/app.wxss b/app.wxss index 3145801..8458ada 100644 --- a/app.wxss +++ b/app.wxss @@ -88,6 +88,10 @@ t-cell { bottom:50rpx; } /* 占位置 */ +.empty-view { + color: red; + margin-top: 200rpx; +} .placeholder { height: 168rpx; } diff --git a/pages/chart/group/index.js b/pages/chart/group/index.js index 55a9dd1..c960ea2 100644 --- a/pages/chart/group/index.js +++ b/pages/chart/group/index.js @@ -12,7 +12,7 @@ Page({ this.setData({expendID,rangeDate}) }, onShow() { - app.$api.listBillGroupDetail({expendId:this.data.expendID,rangeDate:this.data.rangeDate}).then(res =>{ + app.$api.listGroupDetail({expendId:this.data.expendID,rangeDate:this.data.rangeDate}).then(res =>{ if (res.data){ let sumMoney = res.data.sumMoney let billList = res.data.billList diff --git a/pages/chart/index.js b/pages/chart/index.js index 851b7cc..4c3d6d2 100644 --- a/pages/chart/index.js +++ b/pages/chart/index.js @@ -72,27 +72,7 @@ function initLineChart1(canvas, width, height, dpr) { } } }, - series: [{ - name: '支出', - type: 'line', - smooth: true, - data: [18, 36, 65, 30, 78, 40, 33,123,123,12,23,123,123,123,123,213,23,21,12,31,3,12,32,31,3,31,5,4324,1,74,123,43] - }, { - name: '收入', - type: 'line', - smooth: true, - data: [12, 50, 51, 35, 70, 30, 20] - }, { - name: '转账', - type: 'line', - smooth: true, - data: [10, 30, 31, 50, 40, 20, 10] - }, { - name: '还款', - type: 'line', - smooth: true, - data: [50, 80, 11, 25, 30, 110, 20] - }] + series: line1Data }; chart.setOption(option); return chart; @@ -134,27 +114,7 @@ function initLineChart2(canvas, width, height, dpr) { } // show: false }, - series: [{ - name: '支出', - type: 'line', - smooth: true, - data: [18, 36, 65, 30, 78, 40, 33] - }, { - name: '收入', - type: 'line', - smooth: true, - data: [12, 50, 51, 35, 70, 30, 20] - }, { - name: '转账', - type: 'line', - smooth: true, - data: [10, 30, 31, 50, 40, 20, 10] - }, { - name: '还款', - type: 'line', - smooth: true, - data: [50, 80, 11, 25, 30, 110, 20] - }] + series: line2Data }; chart.setOption(option); return chart; @@ -198,6 +158,78 @@ Page({ } }, updateView(){ + app.$api.listBillGroup({'rangeDate':this.data.showDate}).then(res => { + if (res){ + let payTypeList = res.data + pieData = []; + if (payTypeList){ + payTypeList.forEach(x => { + pieData = pieData.concat({ + sId: x.expendId, + sDate: this.data.showDate, + value: x.progress, + name: x.moneyName + }); + }) + } + this.setData({payTypeList}) + } + }) + app.$api.listBillChart({'rangeDate':this.data.showDate}).then(res => { + if (res.data){ + line1Data = []; + line2Data = []; + line1Data = line1Data.concat({ + name: '支出', + type: 'line', + smooth: true, + data: res.data.lineDayExpend + }) + line1Data = line1Data.concat({ + name: '收入', + type: 'line', + smooth: true, + data: res.data.lineDayIncome + }) + line1Data = line1Data.concat({ + name: '转账', + type: 'line', + smooth: true, + data: res.data.lineDayTransfer + }) + line1Data = line1Data.concat({ + name: '还款', + type: 'line', + smooth: true, + data: res.data.lineDayRepayment + }) + // 近六个月 + line2Data = line2Data.concat({ + name: '支出', + type: 'line', + smooth: true, + data: res.data.lineMonthExpend + }) + line2Data = line2Data.concat({ + name: '收入', + type: 'line', + smooth: true, + data: res.data.lineMonthIncome + }) + line2Data = line2Data.concat({ + name: '转账', + type: 'line', + smooth: true, + data: res.data.lineMonthTransfer + }) + line2Data = line2Data.concat({ + name: '还款', + type: 'line', + smooth: true, + data: res.data.lineMonthRepayment + }) + } + }) app.$api.listBillByAMonth({'rangeDate':this.data.showDate}).then(res => { if (res.data){ let accountList = res.data.accountList @@ -220,23 +252,6 @@ Page({ this.setData({incomeList}) } }) - app.$api.listBillGroup({'rangeDate':this.data.showDate}).then(res => { - if (res){ - let payTypeList = res.data - pieData = []; - if (payTypeList){ - payTypeList.forEach(x => { - pieData = pieData.concat({ - sId: x.expendId, - sDate: this.data.showDate, - value: x.progress, - name: x.moneyName - }); - }) - } - this.setData({payTypeList}) - } - }) }, showPicker(e) { const { mode } = e.currentTarget.dataset; diff --git a/pages/chart/index.wxml b/pages/chart/index.wxml index 22dd51f..686edfe 100644 --- a/pages/chart/index.wxml +++ b/pages/chart/index.wxml @@ -44,6 +44,9 @@ /> + + + diff --git a/pages/chart/index.wxss b/pages/chart/index.wxss index e8fc738..e98ea02 100644 --- a/pages/chart/index.wxss +++ b/pages/chart/index.wxss @@ -17,12 +17,12 @@ } .chart_title{ margin-top: 18rpx; - margin-left: 20rpx; + margin-left: 25rpx; color: orange; } .chart-title2{ margin-top: 50rpx; - margin-left: 20rpx; + margin-left: 25rpx; color: orange; } ec-canvas { diff --git a/pages/index/index.wxss b/pages/index/index.wxss index abc8bfd..7deec01 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -18,7 +18,3 @@ display: flex; justify-content: space-between; } -.empty-view { - margin-top: 200rpx; -} - diff --git a/utils/api.js b/utils/api.js index e5fc03e..abd552c 100644 --- a/utils/api.js +++ b/utils/api.js @@ -1,10 +1,10 @@ import utils from './util' //testURL -// const BASE_URL = 'http://127.0.0.1:8080/wx'; +const BASE_URL = 'http://127.0.0.1:8080/wx'; //devURL // const BASE_URL = 'https://lmqhznn.goho.co/wx'; //prodURL -const BASE_URL = 'https://www.qnforever.top/wx'; +// const BASE_URL = 'https://www.qnforever.top/wx'; function buildURL(url, needToken) { let userId = wx.getStorageSync('userId'); if (!userId && url != '/user/login') { @@ -250,8 +250,11 @@ export default { listBillGroup(params){ return fetchPost('/user/bills/group/list' ,params,true,false); }, - listBillGroupDetail(params){ + listGroupDetail(params){ return fetchPost('/user/bills/group/detail' ,params,true,false); }, + listBillChart(params) { + return fetchPost('/user/bills/line/chart' ,params,true,false); + } }