账单报表
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import * as echarts from '../../ec-canvas/echarts';
|
||||
let pieData = [];
|
||||
let line1Data = [];
|
||||
let line2Data = [];
|
||||
function initPieChart(canvas, width, height, dpr) {
|
||||
if (pieData.length <= 0){
|
||||
return;
|
||||
}
|
||||
const chart = echarts.init(canvas, null, {
|
||||
width: 400,
|
||||
height: 250,
|
||||
@@ -17,29 +23,14 @@ function initPieChart(canvas, width, height, dpr) {
|
||||
type: 'pie',
|
||||
center: ['50%', '50%'],
|
||||
radius: ['0%', '70%'],
|
||||
data: [{
|
||||
value: 55,
|
||||
name: '数码产品',
|
||||
id: 1
|
||||
}, {
|
||||
value: 20,
|
||||
name: '零食'
|
||||
}, {
|
||||
value: 10,
|
||||
name: '娱乐'
|
||||
}, {
|
||||
value: 20,
|
||||
name: '房贷'
|
||||
}, {
|
||||
value: 38,
|
||||
name: '房租'
|
||||
}]
|
||||
data: pieData
|
||||
}]
|
||||
};
|
||||
chart.setOption(option);
|
||||
chart.on('click', 'series.pie', function(param) {
|
||||
console.log(param);
|
||||
wx.navigateTo({
|
||||
url: "./group/index?type=1"
|
||||
url: "./group/index?expendId=" + param.data.sId + '&rangeDate=' + param.data.sDate
|
||||
})
|
||||
});
|
||||
return chart;
|
||||
@@ -52,12 +43,7 @@ function initLineChart1(canvas, width, height, dpr) {
|
||||
devicePixelRatio: dpr // new
|
||||
});
|
||||
canvas.setChart(chart);
|
||||
|
||||
var option = {
|
||||
title: {
|
||||
text: '的撒打',
|
||||
left: 'center'
|
||||
},
|
||||
legend: {
|
||||
data: ['支出', '收入', '转账','还款'],
|
||||
top: 20,
|
||||
@@ -75,8 +61,7 @@ function initLineChart1(canvas, width, height, dpr) {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['第一周', '第二周', '第三周', '第四周'],
|
||||
// show: false
|
||||
show: false
|
||||
},
|
||||
yAxis: {
|
||||
x: 'center',
|
||||
@@ -86,13 +71,12 @@ function initLineChart1(canvas, width, height, dpr) {
|
||||
type: 'dashed'
|
||||
}
|
||||
}
|
||||
// show: false
|
||||
},
|
||||
series: [{
|
||||
name: '支出',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
data: [18, 36, 65, 30, 78, 40, 33]
|
||||
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',
|
||||
@@ -120,12 +104,7 @@ function initLineChart2(canvas, width, height, dpr) {
|
||||
devicePixelRatio: dpr // new
|
||||
});
|
||||
canvas.setChart(chart);
|
||||
|
||||
var option = {
|
||||
title: {
|
||||
text: '的撒打',
|
||||
left: 'center'
|
||||
},
|
||||
legend: {
|
||||
data: ['支出', '收入', '转账','还款'],
|
||||
top: 20,
|
||||
@@ -143,8 +122,7 @@ function initLineChart2(canvas, width, height, dpr) {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['1月', '2月', '3月', '4月', '5月', '6月'],
|
||||
// show: false
|
||||
show: false
|
||||
},
|
||||
yAxis: {
|
||||
x: 'center',
|
||||
@@ -194,53 +172,9 @@ Page({
|
||||
sumIncome: 0,
|
||||
sumTransfer: 0,
|
||||
sumRepayment: 0,
|
||||
payTypeList: [
|
||||
{"title":"数码产品","type":"expend","progress":"80","money":"4500.00"},
|
||||
{"title":"房贷","type":"expend","progress":"20","money":"35.00"},
|
||||
{"title":"数码产品","type":"expend","progress":"80","money":"4500.00"},
|
||||
{"title":"房贷","type":"expend","progress":"20","money":"35.00"},
|
||||
{"title":"数码产品","type":"expend","progress":"80","money":"4500.00"},
|
||||
{"title":"房贷","type":"expend","progress":"20","money":"35.00"},
|
||||
{"title":"数码产品","type":"expend","progress":"80","money":"4500.00"},
|
||||
{"title":"房贷","type":"expend","progress":"20","money":"35.00"},
|
||||
{"title":"数码产品","type":"expend","progress":"80","money":"4500.00"},
|
||||
{"title":"房贷","type":"expend","progress":"20","money":"35.00"},
|
||||
],
|
||||
incomeList : [
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"},
|
||||
{"id":1,"title":"电脑","type":"income","dateTime":"01-06","from":"银行卡","money":"4500.00"}
|
||||
],
|
||||
payList : [
|
||||
{"id":1,"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"id":2,"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"id":2,"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"id":2,"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"id":2,"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"id":2,"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"id":2,"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"id":2,"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
{"id":3,"title":"狗粮","type":"expend","dateTime":"01-06","from":"支付宝","money":"35.00"},
|
||||
],
|
||||
payTypeList: [],
|
||||
incomeList : [],
|
||||
payList : [],
|
||||
ecPie: {
|
||||
onInit: initPieChart
|
||||
},
|
||||
@@ -251,6 +185,12 @@ Page({
|
||||
onInit: initLineChart2
|
||||
}
|
||||
},
|
||||
onLoad: function (options) {
|
||||
if (options.rangeDate){
|
||||
let showDate = options.rangeDate
|
||||
this.setData({showDate})
|
||||
}
|
||||
},
|
||||
onShow: function () {
|
||||
this.updateView();
|
||||
if (wx.canIUse('hideHomeButton')) {
|
||||
@@ -268,6 +208,35 @@ Page({
|
||||
this.setData({accountList,sumExpend,sumIncome,sumTransfer,sumRepayment})
|
||||
}
|
||||
})
|
||||
app.$api.listExpendOrderBills({'rangeDate':this.data.showDate}).then(res => {
|
||||
if (res){
|
||||
let payList = res.data
|
||||
this.setData({payList})
|
||||
}
|
||||
})
|
||||
app.$api.listIncomeOrderBills({'rangeDate':this.data.showDate}).then(res => {
|
||||
if (res){
|
||||
let incomeList = res.data
|
||||
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;
|
||||
@@ -289,8 +258,9 @@ Page({
|
||||
[mode]: value
|
||||
// [`${mode}Text`]: value,
|
||||
});
|
||||
this.updateView()
|
||||
// this.updateView()
|
||||
this.hidePicker()
|
||||
wx.redirectTo({url:"./index?rangeDate=" + this.data.showDate})
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user