This commit is contained in:
qiaomu 2024-09-03 09:59:52 +08:00
commit b990456593
2 changed files with 9 additions and 5 deletions

View File

@ -39,13 +39,17 @@ Page({
this.init(id, time); this.init(id, time);
}, },
async init(id, time) { async init(id, time) {
const { code, message, detail } = await getReportDetail(id) const { code, message, detail, amount } = await getReportDetail(id)
if (code !== OK) { if (code !== OK) {
alertInfo(message) alertInfo(message)
return; return;
} }
this.setData({ this.setData({
id, time, detail, meters: detail?.meters?.map(item => { id,
time,
detail,
amount: amount,
meters: detail?.meters?.map(item => {
const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0) const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0)
item.finalAmount = Number(finalAmount).toFixed(2) item.finalAmount = Number(finalAmount).toFixed(2)
return item; return item;
@ -77,8 +81,8 @@ Page({
type: 'pie', type: 'pie',
radius: '50%', radius: '50%',
data: [ data: [
{ value: 18.3, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } }, { value: detail.comprehensive.lossAmount, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } },
{ value: 187.56, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } }, { value: detail.comprehensive.consumption, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } },
], ],
} }

View File

@ -32,7 +32,7 @@
<van-col span="8"> <van-col span="8">
<view class="colContent"> <view class="colContent">
<view class="colContentTitle">本期用电量</view> <view class="colContentTitle">本期用电量</view>
<view class="colContentValue"> {{ detail.comprehensive.consumption }} 千瓦时 </view> <view class="colContentValue"> {{ amount }} 千瓦时 </view>
</view> </view>
</van-col> </van-col>
<van-col span="8"> <van-col span="8">