修改部分字段未根据接口修改的问题

This commit is contained in:
2024-08-30 14:39:41 +08:00
parent 86c1166dcd
commit 75dab4b1ac
3 changed files with 10 additions and 5 deletions

View File

@@ -39,13 +39,17 @@ Page({
this.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) {
alertInfo(message)
return;
}
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)
item.finalAmount = Number(finalAmount).toFixed(2)
return item;
@@ -77,8 +81,8 @@ Page({
type: 'pie',
radius: '50%',
data: [
{ value: 18.3, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } },
{ value: 187.56, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } },
{ value: detail.comprehensive.lossAmount, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } },
{ value: detail.comprehensive.consumption, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } },
],
}