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

This commit is contained in:
qiaomu 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)' } },
],
}

View File

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

View File

@ -47,6 +47,7 @@ export function getConfigByEnv() {
case 'develop':
api = "http://localhost:8000"
// 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;