From 24f2ec9ead349cad5c66d92189160af9f1ee2763 Mon Sep 17 00:00:00 2001
From: qiaomu <3520484422@qq.com>
Date: Fri, 17 Jan 2025 08:44:59 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=B5=E8=A1=A8=E6=8A=A5?=
=?UTF-8?q?=E8=A1=A8=E6=8A=84=E8=A1=A8=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../electricQuery/components/reading/index.js | 102 ++++++++++++++++++
.../components/reading/index.json | 13 +++
.../components/reading/index.wxml | 72 +++++++++++++
.../components/reading/index.wxss | 95 ++++++++++++++++
childPackage/pages/electricQuery/index.js | 33 +++---
childPackage/pages/electricQuery/index.json | 5 +-
childPackage/pages/electricQuery/index.wxml | 21 +---
pages/discountCoupon/index.wxml | 2 +-
pages/invoiceList/components/info/index.js | 2 +-
pages/meterList/index.js | 8 +-
pages/meterList/index.wxml | 3 +-
project.private.config.json | 7 ++
service/accounting.js | 4 +-
13 files changed, 323 insertions(+), 44 deletions(-)
create mode 100644 childPackage/pages/electricQuery/components/reading/index.js
create mode 100644 childPackage/pages/electricQuery/components/reading/index.json
create mode 100644 childPackage/pages/electricQuery/components/reading/index.wxml
create mode 100644 childPackage/pages/electricQuery/components/reading/index.wxss
diff --git a/childPackage/pages/electricQuery/components/reading/index.js b/childPackage/pages/electricQuery/components/reading/index.js
new file mode 100644
index 0000000..850cfc1
--- /dev/null
+++ b/childPackage/pages/electricQuery/components/reading/index.js
@@ -0,0 +1,102 @@
+// childPackage/pages/electricQuery/components/reading/index.js
+import { exportElectricityList, getAccountingList, getElectricityList, getMeterReadingList } from "../../../../../service/accounting";
+import { getTenementMeterList } from "../../../../../service/meter";
+import dayjs from "../../../../../utils/dayjs";
+import request from '../../../../../utils/request';
+import { alertInfo, getPixelRatio, loadingFunc } from "../../../../../utils/index";
+const { OK } = request;
+Component({
+
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+ meter: String,
+ },
+ observers: {
+ 'meter': function() {
+ loadingFunc(async () => {
+ await this.getReadingList();
+ })
+ }
+ },
+ /**
+ * 组件的初始数据
+ */
+ data: {
+ readingDetailShow: false,
+ readingDetail: {},
+ meterReadingHeader: [
+ { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
+ { title: '倍率', key: 'ratio' },
+ { key: 'number', title: '抄表记录' },
+ ],
+ meterReadingList: [],
+ yearMonthDayReading: dayjs().format("YYYY-MM-DD"),
+ yearMonthDayReadingStamp: new Date().getTime(),
+ readingPage: 1,
+ },
+
+ /**
+ * 组件的方法列表
+ */
+ methods: {
+ clickReadingTime() {
+ this.setData({
+ readingVisible: true
+ })
+ },
+ async getReadingList() {
+ const { meter, yearMonthDayReading, readingPage } = this.data;
+ const { code, message, data, total } = await getMeterReadingList({
+ id: meter,
+ time: yearMonthDayReading,
+ page: readingPage
+ })
+ if (code !== OK) {
+ alertInfo(message)
+ return;
+ }
+ this.setData({ meterReadingList: data, totalPage: Math.ceil(total / 20) })
+ },
+ onReadingTimeClose() {
+ this.setData({ readingVisible: false })
+ },
+ onReadingTimeCancel() {
+ this.setData({ readingVisible: false })
+ },
+ onReadingTimeConfirm(e) {
+ const { time } = e.detail;
+
+ this.setData({
+ yearMonthDayReading: time,
+ yearMonthDayReadingStamp: new Date(time).getTime(),
+ readingVisible: false,
+ readingPage: 1,
+ }, () => {
+ loadingFunc(async () => {
+ await this.getReadingList();
+ })
+ })
+
+ },
+ showDetail(e) {
+ const { index, data = {} } = e.detail;
+ this.setData({
+ readingDetailShow: true,
+ readingDetail: data || {}
+ })
+ },
+ async onChangePage(e) {
+ const page = e.detail.currentIndex;
+ const that = this;
+ this.setData({
+ readingPage: page
+ }, () => {
+ loadingFunc(async () => {
+ await that.getReadingList();
+ })
+ })
+ },
+ }
+})
\ No newline at end of file
diff --git a/childPackage/pages/electricQuery/components/reading/index.json b/childPackage/pages/electricQuery/components/reading/index.json
new file mode 100644
index 0000000..dbe66d1
--- /dev/null
+++ b/childPackage/pages/electricQuery/components/reading/index.json
@@ -0,0 +1,13 @@
+{
+ "component": true,
+ "usingComponents": {
+ "custom-picker": "/components/picker/index",
+ "table": "/components/table/table",
+ "empty": "/components/empty/index",
+ "timePicker": "/components/timePicker/index",
+ "pagination": "/components/pagination/index",
+ "van-dialog": "@vant/weapp/dialog/index",
+ "van-field": "@vant/weapp/field/index",
+ "van-icon": "@vant/weapp/icon/index"
+ }
+}
\ No newline at end of file
diff --git a/childPackage/pages/electricQuery/components/reading/index.wxml b/childPackage/pages/electricQuery/components/reading/index.wxml
new file mode 100644
index 0000000..f9d7c8c
--- /dev/null
+++ b/childPackage/pages/electricQuery/components/reading/index.wxml
@@ -0,0 +1,72 @@
+
+
+
+ 选择时间
+
+ {{yearMonthDayReading}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/childPackage/pages/electricQuery/components/reading/index.wxss b/childPackage/pages/electricQuery/components/reading/index.wxss
new file mode 100644
index 0000000..3779087
--- /dev/null
+++ b/childPackage/pages/electricQuery/components/reading/index.wxss
@@ -0,0 +1,95 @@
+/* childPackage/pages/electricQuery/components/reading/index.wxss */
+
+/* pages/electricQuery/index.wxss */
+page {
+ background-color: var(--transparent-green);
+ }
+
+ .queryWrapper {
+ margin: 20rpx 0rpx;
+ background-color: #fff;
+ padding:15rpx 20rpx;
+ box-sizing: border-box;
+ border-radius: 20rpx;
+ display: flex;
+ align-items: center;
+ font-size: 32rpx;
+ }
+
+ .label {
+ width: 180rpx;
+ font-size: 32rpx;
+ }
+
+ .sum {
+ margin-bottom: 30rpx;
+ margin-left: 30rpx;
+ margin-right: 30rpx;
+ padding-bottom: 50rpx;
+ }
+
+ .query {
+ margin: 20rpx 0rpx;
+ }
+
+ .typeQueryText {
+ text-align: center;
+ padding: 20rpx;
+ background-color: var(--light-green);
+ font-size: 32rpx;
+ }
+
+ .select {
+ border: 1rpx solid #ccc;
+ padding: 12rpx;
+ border-radius: 12rpx;
+ flex: 1;
+ display: flex;
+ justify-content: space-between;
+ font-size: 30rpx;
+ }
+
+ .timeQueryText {
+ text-align: center;
+ padding: 20rpx;
+ background-color: rgb(242,248,246);
+ font-size: 30rpx;
+ }
+
+ .wrapper {
+ margin-left: 30rpx;
+ margin-right: 30rpx;
+ padding: 0;
+ }
+
+ .tooltip {
+ margin: 20rpx 0;
+ font-size: 28rpx;
+ color: rgb(97, 93, 93);
+ }
+ .timeChooseWrapper {
+ display: flex;
+ align-items: center;
+ font-size: 30rpx;
+ }
+
+ .time {
+ flex: 1;
+ margin-left: 30rpx;
+ margin-right: 30rpx;
+ display: flex;
+ padding: 10rpx 20rpx;
+ border-radius: 12rpx;
+ border: 1rpx solid #ccc;
+ background-color: #fff;
+ }
+
+ .timeText {
+ flex: 1;
+ }
+
+ .mychart-bar::after{
+ content:"";
+ display:block;
+ clear:both
+ }
\ No newline at end of file
diff --git a/childPackage/pages/electricQuery/index.js b/childPackage/pages/electricQuery/index.js
index a12a3fa..264c586 100644
--- a/childPackage/pages/electricQuery/index.js
+++ b/childPackage/pages/electricQuery/index.js
@@ -22,26 +22,26 @@ Page({
year: dayjs().format('YYYY'),
yearMonth: dayjs().format("YYYY-MM"),
yearMonthDay: dayjs().format("YYYY-MM-DD"),
+
yearStamp: new Date().getTime(),
yearMonthStamp: new Date().getTime(),
yearMonthDayStamp: new Date().getTime(),
+
+
header: [
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
{ title: '时间',renderBody: (item) => { return item.time } },
{ key: 'number', title: '耗量' },
],
- meterReadingHeader: [
- { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
- { title: '倍率', key: 'ratio' },
- { key: 'number', title: '抄表记录' },
- ],
+
list: [],
visible: false,
- meterReadingList: [],
+
accountingList: [],
electricNumber: 0,
meterNumber: 0,
page: 1,
+ readingPage: 1,
},
changeQueryType(e) {
const { type } = e.currentTarget.dataset
@@ -53,10 +53,10 @@ Page({
})
break;
case 1:
- loadingFunc(async () => {
- await this.getReadingList();
- })
- break;
+ // loadingFunc(async () => {
+ // await this.getReadingList();
+ // })
+ // break;
case 2:
loadingFunc(async () => {
await this.getAccountingBalanceList();
@@ -74,6 +74,7 @@ Page({
visible: true
})
},
+
changeTimeType(e) {
const { type } = e.currentTarget.dataset
const that = this;
@@ -164,15 +165,7 @@ Page({
return pieChart;
});
},
- async getReadingList() {
- const { meterId } = this.data;
- const { code, message, data } = await getMeterReadingList(meterId)
- if (code !== OK) {
- alertInfo(message)
- return;
- }
- this.setData({ meterReadingList: data, totalPage: 1 })
- },
+
async export() {
loadingFunc(async () => {
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay } = this.data;
@@ -287,6 +280,7 @@ Page({
onTimeCancel() {
this.setData({ visible: false })
},
+
onTimeConfirm(e) {
const { type, time } = e.detail;
switch(type) {
@@ -319,6 +313,7 @@ Page({
break;
}
},
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
diff --git a/childPackage/pages/electricQuery/index.json b/childPackage/pages/electricQuery/index.json
index 175ba0d..54750e4 100644
--- a/childPackage/pages/electricQuery/index.json
+++ b/childPackage/pages/electricQuery/index.json
@@ -12,7 +12,10 @@
"accountingCard": "./components/accountingCard/index",
"pagination": "/components/pagination/index",
"echarts": "/childPackage/components/echarts/ec-canvas",
- "listTable": "./components/listTable/index"
+ "listTable": "./components/listTable/index",
+ "van-dialog": "@vant/weapp/dialog/index",
+ "van-field": "@vant/weapp/field/index",
+ "reading": "./components/reading/index"
},
"navigationStyle": "custom"
}
\ No newline at end of file
diff --git a/childPackage/pages/electricQuery/index.wxml b/childPackage/pages/electricQuery/index.wxml
index 8171e81..9190d29 100644
--- a/childPackage/pages/electricQuery/index.wxml
+++ b/childPackage/pages/electricQuery/index.wxml
@@ -57,9 +57,9 @@
-
+
@@ -88,19 +88,7 @@
-
-
-
-
-
-
-
-
-
-
+
@@ -139,4 +127,5 @@
bind:cancel="onTimeCancel"
bind:close="onTimeClose"
bind:confirm="onTimeConfirm"
-/>
\ No newline at end of file
+/>
+
diff --git a/pages/discountCoupon/index.wxml b/pages/discountCoupon/index.wxml
index 9f03dd2..35ef08a 100644
--- a/pages/discountCoupon/index.wxml
+++ b/pages/discountCoupon/index.wxml
@@ -15,6 +15,6 @@
-
+
\ No newline at end of file
diff --git a/pages/invoiceList/components/info/index.js b/pages/invoiceList/components/info/index.js
index 7fadab6..5448552 100644
--- a/pages/invoiceList/components/info/index.js
+++ b/pages/invoiceList/components/info/index.js
@@ -38,7 +38,7 @@ Component({
alertInfo(message)
return;
}
- this.setData({ detail: {...data,name: wx.getStorageSync('tenement')?.name, },editType: 'detail', })
+ this.setData({ detail: {...data,name: data?.name || wx.getStorageSync('tenement')?.name, },editType: 'detail', })
},
async getUser() {
const tenement = wx.getStorageSync('tenement')
diff --git a/pages/meterList/index.js b/pages/meterList/index.js
index cda4f37..d941831 100644
--- a/pages/meterList/index.js
+++ b/pages/meterList/index.js
@@ -1,5 +1,6 @@
// pages/meterList/index.js
import { getTenementMeterList } from "../../service/meter";
+import dayjs from "../../utils/dayjs";
import { alertInfo, loadingFunc } from "../../utils/index";
import request from '../../utils/request';
const { OK } = request;
@@ -14,7 +15,7 @@ Page({
{ key: "money", title: '电表余额', },
{ key: 'overall', title: '电表总量' },
],
- list: [{}],
+ list: [],
},
async getMeters({ id }) {
const { code, message, data } = await getTenementMeterList(id);
@@ -35,7 +36,6 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
- console.log('options', options)
loadingFunc(async () => {
await this.getMeters({ id: options?.id })
})
@@ -52,7 +52,9 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
-
+ this.setData({
+ time: dayjs().format("YYYY-MM-DD HH:mm:ss"),
+ })
},
/**
diff --git a/pages/meterList/index.wxml b/pages/meterList/index.wxml
index da99331..163119e 100644
--- a/pages/meterList/index.wxml
+++ b/pages/meterList/index.wxml
@@ -1,3 +1,4 @@
-
\ No newline at end of file
+ 当前时间:{{ time }}
+
\ No newline at end of file
diff --git a/project.private.config.json b/project.private.config.json
index 5d56456..a784ce0 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -10,6 +10,13 @@
"condition": {
"miniprogram": {
"list": [
+ {
+ "name": "childPackage/pages/electricQuery/index",
+ "pathName": "childPackage/pages/electricQuery/index",
+ "query": "",
+ "launchMode": "default",
+ "scene": null
+ },
{
"name": "pages/handleLogin/index",
"pathName": "pages/handleLogin/index",
diff --git a/service/accounting.js b/service/accounting.js
index 8892afe..5c8ade0 100644
--- a/service/accounting.js
+++ b/service/accounting.js
@@ -15,9 +15,9 @@ export const getElectricityList = async function({ meter, type, time, page }) {
}
// 抄表记录列表
-export const getMeterReadingList = async function(meter) {
+export const getMeterReadingList = async function({ id = '', time, page }) {
const tenement = wx.getStorageSync('tenement')?.id || ""
- return await GET(`/wx/getMeterReadingList?tenement=${tenement}&meter=${meter}`);
+ return await GET(`/wx/getMeterReadingList?tenement=${tenement}&meter=${id}&page=${page}&readAt=${time}`);
}
// 账务余额列表
export const getAccountingList = async function(meter) {