修改工作台开户建筑必填和优化报错信息,账单支持峰谷

This commit is contained in:
qiaomu 2025-04-22 18:00:12 +08:00
parent 721937fa5b
commit fb9e727efd
9 changed files with 360 additions and 65 deletions

View File

@ -1,5 +1,5 @@
import { getReportDetail } from "../../../service/report";
import { alertInfo, alertSuccess, getPixelRatio } from "../../../utils/index";
import { alertInfo, alertSuccess, getPixelRatio, loadingFunc } from "../../../utils/index";
import request from '../../../utils/request'
import * as echarts from '../../components/echarts/echarts';
const { OK } = request
@ -15,20 +15,20 @@ Page({
time: "",
detail: {},
meters: [],
header1: [
{ key: 'address', title: '电表地址' },
{ title: '起码',renderBody: (item) => { return item?.startNumber } },
{ title: '止码',renderBody: (item) => { return item?.endNumber } },
{ title: '倍率',renderBody: (item) => { return item?.displayRatio } },
],
header2: [
{ title: '用电量', renderBody: (item) => item?.overall?.amount },
{ title: '线损电量',renderBody: (item) => item?.loss?.amount },
{ title: '公摊电量',renderBody: (item) => item?.publicAmount },
{ title: '合计电量',renderBody: (item) => {
// header1: [
// { key: 'address', title: '电表地址' },
// { title: '起码',renderBody: (item) => { return item?.startNumber } },
// { title: '止码',renderBody: (item) => { return item?.endNumber } },
// { title: '倍率',renderBody: (item) => { return item?.displayRatio } },
// ],
// header2: [
// { title: '用电量', renderBody: (item) => item?.overall?.amount },
// { title: '线损电量',renderBody: (item) => item?.loss?.amount },
// { title: '公摊电量',renderBody: (item) => item?.publicAmount },
// { title: '合计电量',renderBody: (item) => {
} },
]
// } },
// ]
},
/**
@ -36,7 +36,10 @@ Page({
*/
onLoad(options) {
const { id, time } = options;
this.init(id, time);
const that = this;
loadingFunc(async () => {
await that.init(id, time);
})
},
async init(id, time) {
const { code, message, detail, amount } = await getReportDetail(id)
@ -55,40 +58,84 @@ Page({
return item;
})
})
const option = {
tooltip: {
trigger: 'item'
},
legend: {
top: 10,
left: 'center'
},
label: {
alignTo: 'edge',
formatter: '{name|{b}}\n{value|{c} }',
minMargin: 5,
edgeDistance: 10,
lineHeight: 15,
rich: {
time: {
fontSize: 10,
color: '#999'
if (detail?.park?.meter04kvType === 0) {
const option = {
tooltip: {
trigger: 'item'
},
legend: {
top: 10,
left: 'center'
},
label: {
alignTo: 'edge',
formatter: '{name|{b}}\n{value|{c} }',
minMargin: 5,
edgeDistance: 10,
lineHeight: 15,
rich: {
time: {
fontSize: 10,
color: '#999'
}
}
}
},
series: [
{
type: 'pie',
radius: '50%',
data: [
{ value: detail.comprehensive.lossAmount, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } },
{ value: detail.comprehensive.consumption, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } },
],
}
]
};
this.init_pieCharts(option);
},
series: [
{
type: 'pie',
radius: '50%',
data: [
{ value: detail.comprehensive.lossAmount, name: '线损电量', itemStyle: { color: 'rgb(104,187,196)' } },
{ value: detail.comprehensive.consumption, name: '电度电量', itemStyle: { color: 'rgb(80,135,236)' } },
],
}
]
};
this.init_pieCharts(option);
} else {
// const option = {
// tooltip: {
// trigger: 'item'
// },
// legend: {
// top: 10,
// left: 'center'
// },
// label: {
// alignTo: 'edge',
// formatter: '{name|{b}}\n{value|{c} }',
// minMargin: 5,
// edgeDistance: 10,
// lineHeight: 15,
// rich: {
// time: {
// fontSize: 10,
// color: '#999'
// }
// }
// },
// series: [
// {
// type: 'pie',
// radius: '50%',
// data: [
// {
// value: detail.comprehensive.lossAmount,
// name: '线损电量',
// },
// {
// value: detail.comprehensive.consumption,
// name: '电度电量',
// },
// ],
// }
// ]
// };
// this.init_pieCharts(option);
}
const that = this;
wx.getSystemInfo({
success: function (res) {

View File

@ -25,14 +25,14 @@
<van-button type="info" size="small" class="download" bind:click="download">下载</van-button>
</view>
<view class="wrapper">
<view class="wrapper" wx:if="{{detail.park.meter04kvType !== 1}}">
<view class="line"></view>
<view class="contentTitle"> 本期账单 </view>
<van-row gutter="10">
<van-col span="8">
<view class="colContent">
<view class="colContentTitle">本期用电量</view>
<view class="colContentValue"> {{ amount }} 千瓦时 </view>
<view class="colContentValue" wx:if="{{detail.park.meter04kvType === 0}}"> {{ amount }} 千瓦时 </view>
</view>
</van-col>
<van-col span="8">
@ -86,7 +86,7 @@
</van-row>
<van-row>
<van-col span="6">
<view class="tableTitle"> 电量 </view>
<view class="tableTitle"> 电度电量 </view>
<view class="tableContent"> {{item.overall.amount}} </view>
</van-col>
@ -106,4 +106,228 @@
</view>
</view>
</view>
<view class="wrapper" wx:if="{{detail.park.meter04kvType === 1}}">
<view class="line"></view>
<view class="contentTitle"> 本期账单 </view>
<van-row gutter="10">
<van-col span="12">
<view class="colContent">
<view class="colContentTitle">本期用电量</view>
<view class="colContentValue" > {{ amount }} 千瓦时 </view>
</view>
</van-col>
<van-col span="12">
<view class="colContent">
<view class="colContentTitle">本期电费</view>
<view class="colContentValue"> {{ detail.comprehensive.total }} 元 </view>
</view>
</van-col>
</van-row>
<view class="line"></view>
<view class="contentTitle"> 分时明细 </view>
<van-row gutter="10">
<van-col span="8">
<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>
</van-col>
<van-col span="8">
<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>
</van-col>
</van-row>
<view class="line"></view>
<view class="tooltip">
(电量+线损电量)*单价+摊薄公摊电费+摊薄调整电费
</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;">
<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.startNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 止码 </view>
<view class="tableContent"> {{item.endNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 电度电量 </view>
<view class="tableContent"> {{item.critical.amount}} </view>
</van-col>
</van-row>
<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 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.startNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 止码 </view>
<view class="tableContent"> {{item.endNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 电度电量 </view>
<view class="tableContent"> {{item.peak.amount}} </view>
</van-col>
</van-row>
<van-row>
<van-col span="6">
<view class="tableTitle"> 线损电量 </view>
<view class="tableContent"> {{item.lossPeak}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 公摊电量 </view>
<view class="tableContent"> {{item.poolPeak}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电量 </view>
<view class="tableContent"> {{item.finalPeak}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电费 </view>
<view class="tableContent"> {{item.chargePeak}} </view>
</van-col>
</van-row>
</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.startNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 止码 </view>
<view class="tableContent"> {{item.endNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 电度电量 </view>
<view class="tableContent"> {{item.flat.amount}} </view>
</van-col>
</van-row>
<van-row>
<van-col span="6">
<view class="tableTitle"> 线损电量 </view>
<view class="tableContent"> {{item.lossFlat}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 公摊电量 </view>
<view class="tableContent"> {{item.poolFlat}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电量 </view>
<view class="tableContent"> {{item.finalFlat}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电费 </view>
<view class="tableContent"> {{item.chargeFlat}} </view>
</van-col>
</van-row>
</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.startNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 止码 </view>
<view class="tableContent"> {{item.endNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 电度电量 </view>
<view class="tableContent"> {{item.valley.amount}} </view>
</van-col>
</van-row>
<van-row>
<van-col span="6">
<view class="tableTitle"> 线损电量 </view>
<view class="tableContent"> {{item.lossValley}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 公摊电量 </view>
<view class="tableContent"> {{item.poolValley}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电量 </view>
<view class="tableContent"> {{item.finalValley}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电费 </view>
<view class="tableContent"> {{item.chargeValley}} </view>
</van-col>
</van-row>
</view>
</view>
</view>
<view style="height: 20rpx;"></view>

View File

@ -59,12 +59,25 @@ page {
text-align: center;
font-weight: 500;
}
.colContentTitle2 {
padding: 30rpx 0;
text-align: center;
font-weight: 500;
}
.colContentValue {
padding-bottom: 30rpx;
text-align: center;
overflow: hidden;
}
.colContentValue2 {
padding-bottom: 20rpx;
padding-left: 20rpx;
overflow: hidden;
}
.tooltip {
font-size: 30rpx;
color: rgb(136, 132, 132);

View File

@ -1,5 +1,5 @@
import { getBillList } from "../../service/accounting"
import { alertInfo } from "../../utils/index";
import { alertInfo, loadingFunc } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
@ -17,11 +17,19 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init();
const that = this;
loadingFunc(async () => {
await that.init();
})
},
async init() {
const { page, list } = this.data;
const { code, data, message } = await getBillList(page)
if (code !== OK) {
alertInfo(message)
return;
}
if (!data?.length) {
alertInfo("没有更多了")
return;

View File

@ -14,7 +14,7 @@ Component({
},
lifetimes: {
attached() {
loadingFunc(() => this.init())
loadingFunc(async () => await this.init())
}
},
/**
@ -42,7 +42,7 @@ Component({
this.setData({ list: data, selectList: new Array(data?.length).map(() => false), allChecked: false, })
},
onRefresh() {
loadingFunc(() => this.init())
loadingFunc(async () => await this.init())
},
onChange(e) {
const { id, index } = e.currentTarget.dataset;

View File

@ -69,6 +69,7 @@
use-button-slot
readonly
title-width="120rpx"
required
>
<van-button slot="button" size="small" type="info" bind:click="onBuildingFocus">
选择

View File

@ -11,9 +11,9 @@
"miniprogram": {
"list": [
{
"name": "pages/discountCoupon/index",
"pathName": "pages/discountCoupon/index",
"query": "",
"name": "childPackage/pages/billDetail/index",
"pathName": "childPackage/pages/billDetail/index",
"query": "id=R00102714036256769&tiem=2025-03",
"launchMode": "default",
"scene": null
},

View File

@ -45,9 +45,9 @@ export function getConfigByEnv() {
switch (envVersion) {
// 开发版
case 'develop':
// api = "http://localhost:8000"
api = "http://localhost:8000"
// api = "https://zgd.hbhcbn.com/api3"
// api = "https://zgd.hbhcbn.com/api3"
api = "https://zgd.hbhcbn.com/api3"
// api = "https://zgd.hbhcbn.com/wxApi"
// api = "http://127.0.0.1:4523/m1/4143821-0-default"
break;

View File

@ -35,10 +35,10 @@ const request = async function (options, config = {}) {
try {
response = await requestWithoutCookie(options);
// 服务器没有返回200直接报错
// if (!response || response.statusCode !== 200) {
// alertError(response?.data?.message || "发生错误,请稍后重试")
// return;
// }
if (!response || response.statusCode !== 200) {
alertError(response?.data?.message || "发生错误,请稍后重试")
return;
}
// 处理cookie
const setCookie = response.header['set-cookie'] || response.header['Set-Cookie'];
@ -78,9 +78,11 @@ const request = async function (options, config = {}) {
// 处理返回结果,默认直接返回数据
const parseResponse = function (response, url) {
console.log('response', response)
if (!response) {
alertError("服务异常")
alertError("服务无响应")
return
}
const { statusCode } = response;
if (!statusCode) {