|
@@ -3,14 +3,10 @@
|
|
|
<u-navbar title="充值记录" title-color="#101010"></u-navbar>
|
|
|
<!-- 折线图 -->
|
|
|
<view class="chart-box">
|
|
|
- <view class="title">
|
|
|
- 1月电费共支出
|
|
|
- </view>
|
|
|
- <view class="sum">
|
|
|
- 1000.00<text class="unit">元</text>
|
|
|
- </view>
|
|
|
- <view class="chart">
|
|
|
- <image class="img" src="@/assets/img/jVzkNKE@1x.png" mode=""></image>
|
|
|
+ <view class="chart">
|
|
|
+ <view id="pieEcharts" style="min-height:240px;">
|
|
|
+
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
@@ -27,22 +23,22 @@
|
|
|
v-if="tabsFrom.show2"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
|
|
|
</view>
|
|
|
<!-- 记录 -->
|
|
|
- <view class="records" v-for="item in 2" :key="item">
|
|
|
+ <view class="records" >
|
|
|
<view class="time">
|
|
|
- 01月 支出 1000.00元
|
|
|
+ {{queryMonth}} 充值 {{jpAmount(sumAmount)}}元
|
|
|
|
|
|
</view>
|
|
|
- <view class="details">
|
|
|
+ <view class="details" v-for="(item,i) in list" :key="i">
|
|
|
<view class="details-title">
|
|
|
<view class="name">
|
|
|
- 电费充值-联通公司-荆鹏软件园
|
|
|
+ {{item.remark}}-{{item.methodN}}
|
|
|
</view>
|
|
|
<view class="record-time">
|
|
|
- 01-07 10:00 420667788991100
|
|
|
+ {{item.createTime}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="sum">
|
|
|
- 1000.00
|
|
|
+ {{jpAmount(item.amount)}}
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
@@ -51,11 +47,27 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
+<script>
|
|
|
+ import * as API from '@/apis/pagejs/hall/deduction.js'
|
|
|
+ import {
|
|
|
+ nextDay,
|
|
|
+ nextMonth,
|
|
|
+
|
|
|
+ } from '@/apis/utils'
|
|
|
+ import * as echarts from "echarts";
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ myChart:null,
|
|
|
+ list:[],
|
|
|
+ formData:{
|
|
|
+ pageIndex:1,
|
|
|
+ pageSize:9999,
|
|
|
+ },
|
|
|
+
|
|
|
endYear:'',
|
|
|
+ queryMonth:"",
|
|
|
params: {
|
|
|
year: true,
|
|
|
month: true,
|
|
@@ -94,9 +106,34 @@
|
|
|
onLoad() {
|
|
|
this.endYear=new Date().getFullYear()
|
|
|
|
|
|
+ var date=new Date()
|
|
|
+ this.formData.startDate=date.getFullYear()+"-"+(date.getMonth() + 1) +"-1"
|
|
|
+ this.queryMonth=date.getFullYear()+"年"+(date.getMonth() + 1) +"月"
|
|
|
+
|
|
|
+ this.rechargeRecord();
|
|
|
+ this.rechargeRecordGraph();
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+
|
|
|
+ sumAmount(){
|
|
|
+ let totalAmount =0
|
|
|
+ if(this.list){
|
|
|
+ var amounts=this.list.map(item=>{
|
|
|
+ return item.amount
|
|
|
+ })
|
|
|
+
|
|
|
+ totalAmount = amounts.reduce((accumulator, currentValue) => {
|
|
|
+ return accumulator + currentValue;
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return totalAmount
|
|
|
+ }
|
|
|
},
|
|
|
methods:{
|
|
|
selector2confirm(e){
|
|
|
+
|
|
|
this.tabsFrom.show2Text=e.year+"年"+e.month+"月"
|
|
|
|
|
|
this.tabsFrom.show2Index=e.year+"-"+e.month
|
|
@@ -104,18 +141,153 @@
|
|
|
this.tabsFrom.show2Text+=e.day+"日"
|
|
|
this.tabsFrom.show2Index+='-'+e.day
|
|
|
}
|
|
|
+ //this.tabsFrom.show2Index=this.tabsFrom.show2Text
|
|
|
+
|
|
|
+
|
|
|
+ if(e.day){
|
|
|
+ this.formData.startDate=e.year+"-"+e.month +"-"+e.day
|
|
|
+
|
|
|
+ this.queryMonth=e.year+"年"+e.month+"月"+e.day+"日"
|
|
|
+ this.formData.endDate=this.formData.startDate
|
|
|
+ //nextDay(e.year,e.month, e.day)
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.queryMonth=e.year+"年"+e.month+"月"
|
|
|
+ this.formData.startDate=e.year+"-"+e.month +"-1"
|
|
|
+
|
|
|
+ this.formData.endDate=nextMonth(e.year,e.month, 1,1)
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ this.rechargeRecord()
|
|
|
},
|
|
|
selector2reset(e){
|
|
|
- console.log(e)
|
|
|
+
|
|
|
this.tabsFrom.show2Text='全部时间'
|
|
|
this.tabsFrom.show2Index='';
|
|
|
+
|
|
|
+
|
|
|
+ this.formData.startDate=date.getFullYear()+"-"+(date.getMonth() + 1) +"-1"
|
|
|
+ this.queryMonth=date.getFullYear()+"年"+(date.getMonth() + 1)+"月"
|
|
|
+ this.rechargeRecord()
|
|
|
},
|
|
|
selector1confirm(e){
|
|
|
- console.log(e)
|
|
|
+
|
|
|
var index=e[0]
|
|
|
this.tabsFrom.show1Index=index
|
|
|
this.tabsFrom.show1Text=this.tabsFrom.selector1[index].label
|
|
|
- }
|
|
|
+ this.formData.type=this.tabsFrom.selector1[index].value
|
|
|
+ this.rechargeRecord()
|
|
|
+ },
|
|
|
+ rechargeRecordGraph(){
|
|
|
+
|
|
|
+ API.rechargeRecordGraph().then((response) => {
|
|
|
+
|
|
|
+ var list=response.data;
|
|
|
+
|
|
|
+ // uni.getSystemInfo({
|
|
|
+ // success: (res) => {
|
|
|
+ // const screenWidth = res.windowWidth; // 屏幕宽度,单位为px
|
|
|
+ // console.log('屏幕宽度:', screenWidth);
|
|
|
+
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ this.getPle(list)
|
|
|
+ //uni.upx2px(600)
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getPle(list){
|
|
|
+
|
|
|
+ if (!this.myChart) {
|
|
|
+ this.myChart = echarts.init(document.getElementById('pieEcharts'),null,{
|
|
|
+ width:uni.upx2px(700),height:uni.upx2px(280)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.myChart.clear();
|
|
|
+ var data1=list.map(item=>{
|
|
|
+ return item.month.replace("-", "年")+"月"
|
|
|
+ });
|
|
|
+ var data2=list.map(item=>{
|
|
|
+ return item.monthAmount
|
|
|
+ });
|
|
|
+ var headitemby=""
|
|
|
+ var showkey = "";
|
|
|
+ var option = {
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis'
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ top: '6%',
|
|
|
+ left: '3%',
|
|
|
+ right: '8%',
|
|
|
+ bottom: '8%',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: data1,
|
|
|
+ axisLabel: {
|
|
|
+ formatter: (value) => {
|
|
|
+ if (headitemby == "") {
|
|
|
+ headitemby = value
|
|
|
+ }
|
|
|
+ var i = 0
|
|
|
+
|
|
|
+ var showvalue = "";
|
|
|
+ var key = value.substring(0, 5);
|
|
|
+
|
|
|
+ if (showkey == "" || value == headitemby) {
|
|
|
+ showkey = key
|
|
|
+
|
|
|
+ showvalue = value
|
|
|
+ showvalue = value.substring(2)
|
|
|
+ } else {
|
|
|
+ if (key != showkey) {
|
|
|
+ showkey = key
|
|
|
+ showvalue = value
|
|
|
+ showvalue = value.substring(2)
|
|
|
+ } else {
|
|
|
+ showvalue = value.substring(5)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return showvalue.replace("年", ".").replace("月", "");
|
|
|
+
|
|
|
+ },
|
|
|
+ textStyle: {
|
|
|
+ color: "#333"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value'
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '合计',
|
|
|
+ data: data2,
|
|
|
+ type: 'line'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ console.log(option)
|
|
|
+ this.myChart.setOption(option);
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ rechargeRecord(){
|
|
|
+
|
|
|
+ API.rechargeRecord(this.formData).then((response) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ this.list=response.data.data;
|
|
|
+ }).catch(error => {
|
|
|
+ uni.hideLoading();
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|