账单支持峰谷

This commit is contained in:
2025-04-27 08:59:56 +08:00
parent 34995ef9a3
commit 3e9857bdcd
10 changed files with 315 additions and 54 deletions

View File

@@ -2,8 +2,11 @@ import { getReportDetail } from "../../../service/report";
import { alertInfo, alertSuccess, getPixelRatio, loadingFunc } from "../../../utils/index";
import request from '../../../utils/request'
import * as echarts from '../../components/echarts/echarts';
import { getRoundNumber } from "../../../utils/index"
const { OK } = request
// pages/billDetail/index.js
Page({
@@ -53,8 +56,11 @@ Page({
detail,
amount: amount,
meters: detail?.meters?.map(item => {
const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0)
item.finalAmount = Number(finalAmount).toFixed(2)
if (item?.loss?.amount) {
item.loss.amount = getRoundNumber(Number(item.loss.amount))
}
// const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0)
item.finalAmount = getRoundNumber(Number(item.finalAmount))
return item;
})
})
@@ -162,6 +168,13 @@ Page({
return pieChart;
});
},
jumpToDetail(e) {
const { meter } = e.currentTarget.dataset;
console.log("meter", meter)
wx.navigateTo({
url: '/pages/billMeterDetail/index?data=' + JSON.stringify(meter),
})
},
download() {
const { id: tenement } = wx.getStorageSync('tenement')
const { id } = this.data;

View File

@@ -1,7 +1,7 @@
<!--pages/billDetail/index.wxml-->
<navigator title="{{ time }}电费账单" canBack="{{true}}" />
<view class="title" style="top: {{statusBarHeight + 46}}px">
<avatar text="{{detail.tenement.shortName}}" />
<avatar text="{{detail.tenement.shortName}}" />
<view class="titleContent">
<view class="park">
<view class="label">
@@ -19,7 +19,7 @@
<view class="label">
账单周期:
</view>
<view class="value"> {{ detail.comprehensive.startDate }} 至 {{ detail.comprehensive.endDate }} </view>
<view class="value"> {{ detail.comprehensive.startDate }} 至 {{ detail.comprehensive.endDate }} </view>
</view>
</view>
<van-button type="info" size="small" class="download" bind:click="download">下载</van-button>
@@ -50,14 +50,7 @@
</van-row>
<view class="line"></view>
<view class="contentTitle"> 电费构成 </view>
<echarts
style="width:200rpx;height:180rpx;"
id="echarts"
class='mychart-bar'
canvas-id="mychart-bar"
ec="{{ ec }}"
forceUseOldCanvas="{{false}}"
>
<echarts style="width:200rpx;height:180rpx;" id="echarts" class='mychart-bar' canvas-id="mychart-bar" ec="{{ ec }}" forceUseOldCanvas="{{false}}">
</echarts>
<view class="tooltip">
(本月电量+本月线损电量)*电单价+摊薄公摊电费+摊薄调整电费
@@ -113,7 +106,7 @@
<van-col span="12">
<view class="colContent">
<view class="colContentTitle">本期用电量</view>
<view class="colContentValue" > {{ amount }} 千瓦时 </view>
<view class="colContentValue"> {{ detail.comprehensive.finalAmount }} 千瓦时 </view>
</view>
</van-col>
<van-col span="12">
@@ -126,40 +119,28 @@
<view class="line"></view>
<view class="contentTitle"> 分时明细 </view>
<van-row gutter="10">
<van-col span="8">
<van-col span="12">
<view class="colContent">
<view class="colContentTitle">
分时电量
<view> (千瓦时) </view>
</view>
<view class="colContentValue2" >尖: {{ detail.comprehensive.sharpAmount }} </view>
<view class="colContentValue2" >峰: {{ detail.comprehensive.peakAmount }} </view>
<view class="colContentValue2" >平: {{ detail.comprehensive.flatAmount }} </view>
<view class="colContentValue2" >谷: {{ detail.comprehensive.valleyAmount }} </view>
<view class="colContentValue2">尖: {{ detail.comprehensive.sharpAmount }} </view>
<view class="colContentValue2">峰: {{ detail.comprehensive.peakAmount }} </view>
<view class="colContentValue2">平: {{ detail.comprehensive.flatAmount }} </view>
<view class="colContentValue2">谷: {{ detail.comprehensive.valleyAmount }} </view>
</view>
</van-col>
<van-col span="8">
<van-col span="12">
<view class="colContent">
<view class="colContentTitle">
分时单价
<view> (元/千瓦时) </view>
</view>
<view class="colContentValue2" >尖: {{ detail.comprehensive.priceSharp }} </view>
<view class="colContentValue2" >峰: {{ detail.comprehensive.pricePeak }} </view>
<view class="colContentValue2" >平: {{ detail.comprehensive.priceFlat }} </view>
<view class="colContentValue2" >谷: {{ detail.comprehensive.priceValley }} </view>
</view>
</van-col>
<van-col span="8">
<view class="colContent">
<view class="colContentTitle">
分时电费
<view> (元) </view>
</view>
<view class="colContentValue2" >尖: {{ detail.comprehensive.sharpFee }} </view>
<view class="colContentValue2" >峰: {{ detail.comprehensive.peakFee }} </view>
<view class="colContentValue2" >平: {{ detail.comprehensive.flatFee }} </view>
<view class="colContentValue2" >谷: {{ detail.comprehensive.valleyFee }} </view>
<view class="colContentValue2">尖: {{ detail.comprehensive.priceSharp }} </view>
<view class="colContentValue2">峰: {{ detail.comprehensive.pricePeak }} </view>
<view class="colContentValue2">平: {{ detail.comprehensive.priceFlat }} </view>
<view class="colContentValue2">谷: {{ detail.comprehensive.priceValley }} </view>
</view>
</van-col>
</van-row>
@@ -169,46 +150,117 @@
</view>
<view class="line"></view>
<view class="contentTitle"> 分时电量明细 </view>
<view class="tableWrapper" wx:for="{{meters}}">
<view style="font-size: 30rpx;font-weight: 600;"> 尖 </view>
<view style="margin: 20rpx 0; background-color: #fff;">
<view class="tableWrapper">
<view class="meterListItem" wx:for="{{meters}}" wx:key="id">
<div class="top">
<view class="address">{{item.address}}</view>
<view class="detail primaryTextBtn" bind:tap="jumpToDetail" data-meter="{{item}}"> 详情 </view>
</div>
<view style="margin: 20rpx 0; background-color: #fff;">
<van-row custom-style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
<van-col span="6">
<view class="tableTitle"> 电度电量 </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 线损电量 </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电量 </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电费 </view>
</van-col>
</van-row>
<van-row class="meterListItemContent">
<van-col span="6">
<view class="tableContent"> {{item.overall.amount}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{item.loss.amount}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{item.finalAmount}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{item.finalTotal}} </view>
</van-col>
</van-row>
</view>
</view>
<!-- <view style="font-size: 30rpx;font-weight: 600;"> 尖 </view> -->
<!-- <view style="margin: 20rpx 0; background-color: #fff;">
<van-row custom-style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
<van-col span="6">
<view class="tableTitle"> 电表地址 </view>
<view class="tableContent"> {{item.address}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 起码 </view>
<view class="tableContent"> {{item.startSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 止码 </view>
<view class="tableContent"> {{item.endSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 电度电量 </view>
<view class="tableContent"> {{item.critical.amount}} </view>
</van-col>
</van-row>
<view class="top">
<view class="meterListItem" wx:for="{{meters}}" wx:key="id">
<van-row>
<van-col span="6">
<view class="tableContent"> {{item.address}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{item.startSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{item.endSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{item.critical.amount}} </view>
</van-col>
</van-row>
</view>
</view>
<van-row>
<van-col span="6">
<view class="tableTitle"> 线损电量 </view>
<view class="tableContent"> {{item.lossSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 公摊电量 </view>
<view class="tableContent"> {{item.poolSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电量 </view>
<view class="tableContent"> {{item.finalSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电费 </view>
<view class="tableContent"> {{item.chargeSharp}} </view>
</van-col>
</van-row>
</view>
<view class="bottom">
<view class="meterListItem" wx:for="{{meters}}" wx:key="id">
<van-row>
<van-col span="6">
<view class="tableContent"> {{item.lossSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{item.poolSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{item.finalSharp}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{item.chargeSharp}} </view>
</van-col>
</van-row>
</view>
</view>
</view>
<view style="font-size: 30rpx;font-weight: 600;"> 峰 </view>
<view style="margin: 20rpx 0; background-color: #fff;">
<van-row custom-style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
@@ -327,7 +379,7 @@
<view class="tableContent"> {{item.chargeValley}} </view>
</van-col>
</van-row>
</view>
</view> -->
</view>
</view>
<view style="height: 20rpx;"></view>

View File

@@ -74,7 +74,7 @@ page {
.colContentValue2 {
padding-bottom: 20rpx;
padding-left: 20rpx;
padding-left: 40rpx;
overflow: hidden;
}
@@ -100,10 +100,37 @@ page {
background-color: #fff;
box-sizing: border-box;
flex: 1;
word-break: break-all;
}
.download {
position: absolute;
top: 20rpx;
right: 20rpx;
}
.meterListItem {
font-size: 32rpx;
}
.meterListItem .top {
display: flex;
align-items: center;
}
.meterListItem .address {
flex: 1;
}
/* .top .meterListItem:nth-child(even) .tableContent,
.bottom .meterListItem:nth-child(even) .tableContent,
.top .meterListItem:nth-child(even),
.bottom .meterListItem:nth-child(even)
{
} */
.meterListItemContent, .meterListItemContent .tableContent {
background-color: #fff;
}