diff --git a/childPackage/pages/electricQuery/components/reading/index.js b/childPackage/pages/electricQuery/components/reading/index.js index 072b0fb..6a5347e 100644 --- a/childPackage/pages/electricQuery/components/reading/index.js +++ b/childPackage/pages/electricQuery/components/reading/index.js @@ -2,6 +2,7 @@ import { exportElectricityList, getAccountingList, getElectricityList, getMeterReadingList } from "../../../../../service/accounting"; import { getTenementMeterList } from "../../../../../service/meter"; import dayjs from "../../../../../utils/dayjs"; +import { getParkInfoByTime } from "../../../../../service/park"; import request from '../../../../../utils/request'; import { alertInfo, getPixelRatio, loadingFunc } from "../../../../../utils/index"; const { OK } = request; @@ -19,6 +20,9 @@ Component({ loadingFunc(async () => { await this.getReadingList(); }) + }, + "parkInfo": function(newValue) { + this.setData({ park: newValue }) } }, /** @@ -27,6 +31,7 @@ Component({ data: { readingDetailShow: false, readingDetail: {}, + park: {}, meterReadingHeader: [ { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address }, { title: '倍率', key: 'ratio' }, @@ -76,10 +81,32 @@ Component({ readingPage: 1, }, () => { loadingFunc(async () => { + console.log("----------") + await this.getParkInfo(time) + console.log("===========") await this.getReadingList(); }) }) + }, + async getParkInfo(time) { + const park = wx.getStorageSync('park'); + const { park:parkInfo, code, message } = await getParkInfoByTime(park?.id, `${time}`, `${0}`,) + if (code !== OK) { + alertInfo(message) + return; + } + const that = this; + return new Promise((resolve) => { + + that.setData({ + parkInfo: parkInfo + }, () => { + resolve() + }) + }) + + }, showDetail(e) { const { index, data = {} } = e.detail; diff --git a/childPackage/pages/electricQuery/components/reading/index.wxml b/childPackage/pages/electricQuery/components/reading/index.wxml index 5820358..204d925 100644 --- a/childPackage/pages/electricQuery/components/reading/index.wxml +++ b/childPackage/pages/electricQuery/components/reading/index.wxml @@ -66,7 +66,7 @@ border="{{ false }}" label="表字" readonly - wx:if="{{parkInfo.category !== 1}}" + wx:if="{{park.meter04kvType !== 1}}" /> + \ No newline at end of file diff --git a/childPackage/pages/electricQuery/index.js b/childPackage/pages/electricQuery/index.js index f3698e5..3947497 100644 --- a/childPackage/pages/electricQuery/index.js +++ b/childPackage/pages/electricQuery/index.js @@ -356,6 +356,7 @@ Page({ case "year": this.setData({ year: time, visible: false, }, () => { loadingFunc(async () => { + await this.getParkInfo() await this.init(); }) }); @@ -364,6 +365,7 @@ Page({ const [year, month] = time.split("-") this.setData({ yearMonth: time, yearMonthStamp: new Date(Number(year), Number(month) - 1, 1).getTime(), visible: false }, () => { loadingFunc(async () => { + await this.getParkInfo() await this.init(); }) }); @@ -376,13 +378,16 @@ Page({ page: 1, }, () => { loadingFunc(async () => { + await this.getParkInfo() await this.init(); }) }) break; } }, - + readingChangeTime(e) { + console.log('e', e.detail) + }, /** * 生命周期函数--监听页面初次渲染完成 */ @@ -410,7 +415,7 @@ Page({ case 2: time = year; } - const { data, code, message } = await getParkInfoByTime(park?.id, `${time}`, `${timeType}`,) + const { park:parkInfo, code, message } = await getParkInfoByTime(park?.id, `${time}`, `${timeType}`,) if (code !== OK) { alertInfo(message) return; @@ -419,7 +424,7 @@ Page({ return new Promise((resolve) => { that.setData({ - parkInfo: data + parkInfo: parkInfo }, () => { resolve() }) diff --git a/childPackage/pages/electricQuery/index.wxml b/childPackage/pages/electricQuery/index.wxml index 0733d42..3598af7 100644 --- a/childPackage/pages/electricQuery/index.wxml +++ b/childPackage/pages/electricQuery/index.wxml @@ -99,7 +99,7 @@ - + diff --git a/utils/index.js b/utils/index.js index e909304..d2bfee7 100644 --- a/utils/index.js +++ b/utils/index.js @@ -45,8 +45,8 @@ export function getConfigByEnv() { switch (envVersion) { // 开发版 case 'develop': - api = "http://localhost:8000" - // api = "https://zgd.hbhcbn.com/api3" + // api = "http://localhost:8000" + api = "https://zgd.hbhcbn.com/api3" // api = "https://zgd.hbhcbn.com/wxApi" // api = "http://127.0.0.1:4523/m1/4143821-0-default" break;