Compare commits
7 Commits
af749eb638
...
17c992fb0b
| Author | SHA1 | Date | |
|---|---|---|---|
| 17c992fb0b | |||
| 493be62f44 | |||
| cdbc3fa959 | |||
| b1cca8f8a5 | |||
| 70737fa2b8 | |||
| 71ad4995c8 | |||
| 399ef43d07 |
2
app.json
2
app.json
@@ -28,6 +28,8 @@
|
||||
"pages/aid/law/index",
|
||||
"pages/aid/detail/index",
|
||||
"pages/aid/consult/index",
|
||||
"pages/writeReading/index",
|
||||
"pages/readingHistory/index",
|
||||
"pages/integral/index",
|
||||
"pages/discountCoupon/index",
|
||||
"pages/integralRecord/index",
|
||||
|
||||
@@ -45,7 +45,6 @@ Page({
|
||||
})
|
||||
},
|
||||
async init(id, time, tenement) {
|
||||
console.log("time:", tenement)
|
||||
const { code, message, detail, amount } = await getReportDetail(id, tenement)
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
@@ -171,7 +170,6 @@ Page({
|
||||
},
|
||||
jumpToDetail(e) {
|
||||
const { meter } = e.currentTarget.dataset;
|
||||
console.log("meter", meter)
|
||||
wx.navigateTo({
|
||||
url: '/pages/billMeterDetail/index?data=' + JSON.stringify(meter),
|
||||
})
|
||||
|
||||
@@ -81,9 +81,7 @@ Component({
|
||||
readingPage: 1,
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
console.log("----------")
|
||||
await this.getParkInfo(time)
|
||||
console.log("===========")
|
||||
await this.getReadingList();
|
||||
})
|
||||
})
|
||||
|
||||
@@ -143,7 +143,7 @@ Page({
|
||||
map(item => Number(item.replace(point, ""))).
|
||||
sort((a, b) => a - b).
|
||||
map(ele => `${ele}${point}`.padStart(3, "0"));
|
||||
console.log(times)
|
||||
|
||||
const options = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
@@ -297,8 +297,6 @@ Page({
|
||||
},
|
||||
onOk(e) {
|
||||
const { id, code, address } = e.detail.value;
|
||||
console.log('e', e)
|
||||
console.log("id, code, address", id, code, address)
|
||||
this.setData({
|
||||
// year: currentYear,
|
||||
meterId: id,
|
||||
@@ -372,7 +370,7 @@ Page({
|
||||
}
|
||||
},
|
||||
readingChangeTime(e) {
|
||||
console.log('e', e.detail)
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
|
||||
@@ -20,7 +20,7 @@ Component({
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
console.log("attached", this.data.show)
|
||||
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,6 @@ Component({
|
||||
*/
|
||||
methods: {
|
||||
handleChange(e) {
|
||||
console.log(e, this.data.active)
|
||||
const { index } = e.currentTarget.dataset;
|
||||
if (index === this.data.active) {
|
||||
return;
|
||||
|
||||
@@ -61,7 +61,6 @@ Component({
|
||||
onConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
const { list = [], type } = this.data;
|
||||
console.log("index", index)
|
||||
const item = list[index];
|
||||
if (!item) {
|
||||
alertInfo("请选择一项")
|
||||
|
||||
@@ -20,9 +20,7 @@ Page({
|
||||
*/
|
||||
onLoad(options) {
|
||||
const querys = decodeURIComponent(options.scene)
|
||||
console.log('querys', querys)
|
||||
const id = querys.slice(querys.indexOf("=") + 1)
|
||||
console.log("id", id)
|
||||
this.getInfo(id);
|
||||
},
|
||||
async getInfo(id) {
|
||||
|
||||
@@ -125,7 +125,6 @@ Page({
|
||||
wx.scanCode({
|
||||
scanType: "qrCode",
|
||||
success: ({ path }) => {
|
||||
console.log('path', path)
|
||||
wx.navigateTo({
|
||||
url: '/' + path,
|
||||
})
|
||||
@@ -137,7 +136,6 @@ Page({
|
||||
})
|
||||
},
|
||||
onConfirm(e) {
|
||||
console.log('e', e.detail)
|
||||
const { type, data = {} } = e.detail;
|
||||
switch(type) {
|
||||
case "park":
|
||||
|
||||
84
pages/readingHistory/components/editModal/index.js
Normal file
84
pages/readingHistory/components/editModal/index.js
Normal file
@@ -0,0 +1,84 @@
|
||||
// pages/workBench/components/tenement/components/bindMeter/index.js
|
||||
// 0015980101
|
||||
import { bindMeter, } from "../../../../service/tenement"
|
||||
import { getWorkMeterDetail } from "../../../../service/meter"
|
||||
import { alertInfo, alertSuccess } from "../../../../utils/index";
|
||||
import request from "../../../../utils/request"
|
||||
import dayjs from "../../../../utils/dayjs"
|
||||
const { OK } = request
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
visible: Boolean,
|
||||
title: String,
|
||||
timeProps: String,
|
||||
numberProps: String,
|
||||
id: String
|
||||
},
|
||||
observers: {
|
||||
"timeProps": function(newValue) {
|
||||
this.setData({
|
||||
time: newValue
|
||||
})
|
||||
},
|
||||
"numberProps": function(newValue) {
|
||||
this.setData({
|
||||
number: newValue
|
||||
})
|
||||
},
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
dateTimeShow: false,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onCancel() {
|
||||
this.setData({
|
||||
show: false,
|
||||
title: "",
|
||||
type: "",
|
||||
})
|
||||
// this.triggerEvent("close")
|
||||
},
|
||||
onClose() {
|
||||
this.setData({
|
||||
show: false,
|
||||
title: "",
|
||||
type: "",
|
||||
})
|
||||
},
|
||||
onChange(e) {
|
||||
const { name } = e.currentTarget.dataset;
|
||||
this.setData({
|
||||
[name]: e.detail
|
||||
})
|
||||
},
|
||||
async onSubmit() {
|
||||
const { time, number } = this.data;
|
||||
if (time == null || number == null) {
|
||||
alertInfo("请正确填写后保存")
|
||||
return;
|
||||
}
|
||||
this.triggerEvent("ok")
|
||||
},
|
||||
|
||||
dateTimeConfirm(e) {
|
||||
this.setData({ time: e.detail.time, dateTimeShow: false })
|
||||
},
|
||||
dateTimeCancal(e) {
|
||||
this.setData({ dateTimeShow: false })
|
||||
},
|
||||
onTimeFocus() {
|
||||
this.setData({ dateTimeShow: true })
|
||||
}
|
||||
}
|
||||
})
|
||||
10
pages/readingHistory/components/editModal/index.json
Normal file
10
pages/readingHistory/components/editModal/index.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"search-select": "/components/searchSelect/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"date-time-picker": "/components/DateTimePicker/index"
|
||||
}
|
||||
}
|
||||
50
pages/readingHistory/components/editModal/index.wxml
Normal file
50
pages/readingHistory/components/editModal/index.wxml
Normal file
@@ -0,0 +1,50 @@
|
||||
<!--pages/workBench/components/tenement/components/bindMeter/index.wxml-->
|
||||
<van-dialog
|
||||
use-slot
|
||||
title="{{title}}"
|
||||
show="{{ visible }}"
|
||||
show-cancel-button
|
||||
bind:confirm="onSubmit"
|
||||
bind:close="onClose"
|
||||
>
|
||||
<view class="modalContentWrapper">
|
||||
<van-field
|
||||
value="{{ time }}"
|
||||
placeholder="请选择绑定时间"
|
||||
label="时间"
|
||||
readonly
|
||||
border="{{ false }}"
|
||||
use-button-slot
|
||||
title-width="100rpx"
|
||||
>
|
||||
<van-button slot="button" size="small" type="info" bind:click="onTimeFocus">
|
||||
选择
|
||||
</van-button>
|
||||
</van-field>
|
||||
<van-field
|
||||
value="{{ number }}"
|
||||
placeholder="请输入读数"
|
||||
label="读数"
|
||||
type="digit"
|
||||
border="{{ false }}"
|
||||
title-width="100rpx"
|
||||
>
|
||||
</van-field>
|
||||
</view>
|
||||
|
||||
</van-dialog>
|
||||
|
||||
<search-select
|
||||
show="{{show}}"
|
||||
title="{{title}}"
|
||||
type="{{type}}"
|
||||
park="{{park}}"
|
||||
bindconfirm="onConfirm"
|
||||
bindcancel="onCancel"
|
||||
/>
|
||||
|
||||
<date-time-picker
|
||||
show="{{dateTimeShow}}"
|
||||
bind:confirm="dateTimeConfirm"
|
||||
bind:cancel="dateTimeCancal"
|
||||
/>
|
||||
1
pages/readingHistory/components/editModal/index.wxss
Normal file
1
pages/readingHistory/components/editModal/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* pages/workBench/components/tenement/components/bindMeter/index.wxss */
|
||||
24
pages/readingHistory/components/meterInfo/index.js
Normal file
24
pages/readingHistory/components/meterInfo/index.js
Normal file
@@ -0,0 +1,24 @@
|
||||
// pages/readingHistory/components/meterInfo/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
meterInfo: Object,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
||||
8
pages/readingHistory/components/meterInfo/index.json
Normal file
8
pages/readingHistory/components/meterInfo/index.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-row": "@vant/weapp/row/index",
|
||||
"van-col": "@vant/weapp/col/index",
|
||||
"van-tag": "@vant/weapp/tag/index"
|
||||
}
|
||||
}
|
||||
68
pages/readingHistory/components/meterInfo/index.wxml
Normal file
68
pages/readingHistory/components/meterInfo/index.wxml
Normal file
@@ -0,0 +1,68 @@
|
||||
<!--pages/readingHistory/components/meterInfo/index.wxml-->
|
||||
<view class="wrapper">
|
||||
<view class="title">
|
||||
<view class="address">
|
||||
{{meterInfo.address}}
|
||||
</view>
|
||||
<view class="status">
|
||||
<view wx:if="{{meterInfo.enabled}}">
|
||||
正常
|
||||
</view>
|
||||
<view wx:else>
|
||||
停用
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail">
|
||||
<van-row gutter="20">
|
||||
<van-col span="12">
|
||||
<view class="text">
|
||||
<view>
|
||||
设备编号
|
||||
</view>
|
||||
<view>
|
||||
{{meterInfo.meterSn}}
|
||||
</view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<view class="text">
|
||||
<view>
|
||||
电表类型
|
||||
</view>
|
||||
<view>
|
||||
<view wx:if="{{meterInfo.meterBelongType === 0}}">
|
||||
商户电表
|
||||
</view>
|
||||
<view wx:elif="{{meterInfo.meterBelongType === 1}}">
|
||||
公区电表
|
||||
</view>
|
||||
<view wx:elif="{{meterInfo.meterBelongType === 2}}">
|
||||
公摊电表
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<view class="text">
|
||||
<view>
|
||||
最近读数
|
||||
</view>
|
||||
<view>
|
||||
{{meterInfo.overall}}
|
||||
</view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<view class="text">
|
||||
<view>
|
||||
读数日期
|
||||
</view>
|
||||
<view>
|
||||
{{meterInfo.readAt}}
|
||||
</view>
|
||||
</view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
</view>
|
||||
22
pages/readingHistory/components/meterInfo/index.wxss
Normal file
22
pages/readingHistory/components/meterInfo/index.wxss
Normal file
@@ -0,0 +1,22 @@
|
||||
/* pages/readingHistory/components/meterInfo/index.wxss */
|
||||
.wrapper {
|
||||
margin: 20rpx 0;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: white;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.detail .text {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
112
pages/readingHistory/index.js
Normal file
112
pages/readingHistory/index.js
Normal file
@@ -0,0 +1,112 @@
|
||||
// pages/readingHistory/index.js
|
||||
import { getMeterReadingRouteMeterDetail } from "../../service/workBench"
|
||||
import request from "../../utils/request"
|
||||
import { alertInfo, alertSuccess, alertError } from "../../utils/index"
|
||||
const { OK } = request;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
list: [{time: "2025-05-05 14:10:09", number: 90803.87}]
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { meter, park } = options;
|
||||
this.setData({
|
||||
meter,
|
||||
park
|
||||
})
|
||||
this.getMeterInfo(meter);
|
||||
},
|
||||
async getMeterInfo(id) {
|
||||
const { code, message, data } = await getMeterReadingRouteMeterDetail(id)
|
||||
if (code !== OK) {
|
||||
alertError(message)
|
||||
return;
|
||||
}
|
||||
this.setData({ meterInfo: data })
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
handleCreate() {
|
||||
this.setData({
|
||||
title: "新增记录",
|
||||
visible: true
|
||||
})
|
||||
},
|
||||
handleUpdate() {
|
||||
this.setData({
|
||||
title: "编辑记录",
|
||||
visible: true,
|
||||
time: "2025-09-11",
|
||||
number: 100,
|
||||
id: ""
|
||||
})
|
||||
},
|
||||
handleDelete(e) {
|
||||
const { id } = e.currentTarget.dataset;
|
||||
wx.showModal({
|
||||
title: '删除确认',
|
||||
content: '确认要删除这一项记录吗?',
|
||||
complete: (res) => {
|
||||
if (res.cancel) {
|
||||
|
||||
}
|
||||
|
||||
if (res.confirm) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
10
pages/readingHistory/index.json
Normal file
10
pages/readingHistory/index.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index",
|
||||
"meterInfo": "./components/meterInfo/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"editModal": "./components/editModal/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
49
pages/readingHistory/index.wxml
Normal file
49
pages/readingHistory/index.wxml
Normal file
@@ -0,0 +1,49 @@
|
||||
<!--pages/readingHistory/index.wxml-->
|
||||
<navigator title="历史抄表记录" canBack="{{true}}" />
|
||||
|
||||
<view class="wrapper">
|
||||
<meterInfo meterInfo="{{meterInfo}}" />
|
||||
<view class="historyTitle">
|
||||
<view class="text">
|
||||
抄表记录历史
|
||||
</view>
|
||||
<van-button type="info" size="small" icon="plus" bind:tap="handleCreate"> 新增记录 </van-button>
|
||||
</view>
|
||||
<view>
|
||||
<view wx:if="{{list.length}}">
|
||||
<view class="tableWrapper">
|
||||
<view class="table">
|
||||
<view class="thead">
|
||||
<view class="th" style="width: 40%; text-align: center;"> 抄表时间 </view>
|
||||
<view class="th" style="width: 35%; text-align: center;"> 抄表读数 </view>
|
||||
<view class="th" style="width: 25%; text-align: center;"> 操作 </view>
|
||||
</view>
|
||||
<view class="tbody">
|
||||
<view wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
|
||||
<view class="tr" style="display: flex; align-items: center; ">
|
||||
<view class="th" style="width: 40%; text-align: center; font-size: 30rpx;">
|
||||
{{ item.time }}
|
||||
</view>
|
||||
<view class="th" style="width: 35%; text-align: center; font-size: 30rpx;">
|
||||
{{ item.number }}
|
||||
</view>
|
||||
|
||||
<view class="th" style="width: 25%; text-align: center; justify-content: center; display: flex; align-items: center;">
|
||||
<van-icon name="edit" size="40rpx" bind:tap="handleUpdate" data-data="{{item}}" color="#15755e" />
|
||||
<van-icon name="delete" size="40rpx" bind:tap="handleDelete" data-id="{{item.id}}" color="#15755e" custom-style="margin-left: 20rpx" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<pagination currentIndex="{{page}}" totalPage="{{totalPage}}" bind:pagingChange="onChangePage" />
|
||||
|
||||
</view>
|
||||
<empty bind:refresh="init" wx:else />
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<editModal title="{{title}}" visible="{{visible}}" timeProps="{{time}}" numberProps="{{number}}" id="{{id}}" />
|
||||
72
pages/readingHistory/index.wxss
Normal file
72
pages/readingHistory/index.wxss
Normal file
@@ -0,0 +1,72 @@
|
||||
/* pages/readingHistory/index.wxss */
|
||||
page {
|
||||
background-color: #ebedf0;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
padding: 0 20rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.historyTitle {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
.tableWrapper {
|
||||
width: 100%;
|
||||
margin-top: 30rpx;
|
||||
background-color: #fff;
|
||||
overflow-x: auto;
|
||||
padding: 20rpx 12rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.thead {
|
||||
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
}
|
||||
|
||||
.thead .th {
|
||||
padding: 10rpx;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.primaryTextBtn {
|
||||
color: #1989fa;
|
||||
}
|
||||
|
||||
.tbody {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tbody .tr {
|
||||
padding: 10rpx;
|
||||
border-bottom: 1rpx solid #EEEEEE;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.tbody .tr {
|
||||
word-break: break-all;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.more-icon {
|
||||
padding: 20rpx;
|
||||
color: #1989fa;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,6 @@ Page({
|
||||
},
|
||||
onChangePay(e) {
|
||||
const { id, name } = e;
|
||||
console.log('e', e)
|
||||
const { year, codeId } = this.data;
|
||||
this.setData({
|
||||
payType: name,
|
||||
|
||||
@@ -71,11 +71,9 @@ Page({
|
||||
})
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log('fail', res)
|
||||
alertInfo("请稍后重试")
|
||||
},
|
||||
complete: (res) => {
|
||||
console.log('complete')
|
||||
that.handleGetMeterDetail(meter.id)
|
||||
}
|
||||
})
|
||||
|
||||
97
pages/workBench/components/reading/index.js
Normal file
97
pages/workBench/components/reading/index.js
Normal file
@@ -0,0 +1,97 @@
|
||||
// pages/workBench/components/reading/index.js
|
||||
import { getMeterReadingRouteList, changeMeterRouteStatus } from "../../../../service/workBench"
|
||||
import { alertError, alertSuccess, loadingFunc } from "../../../../utils/index"
|
||||
import request from "../../../../utils/request"
|
||||
const { OK } = request
|
||||
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
park: "",
|
||||
parkName: ""
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onParkFocus(e) {
|
||||
this.setData({
|
||||
show: true,
|
||||
title: "园区",
|
||||
type: 'park'
|
||||
})
|
||||
},
|
||||
async init() {
|
||||
const { parkName, park } = this.data;
|
||||
const { code, message, data } = await getMeterReadingRouteList(parkName)
|
||||
if (code !== OK) {
|
||||
alertError(message)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
list: data
|
||||
})
|
||||
},
|
||||
onConfirm(e) {
|
||||
const { data } = e.detail;
|
||||
const that = this;
|
||||
this.setData({
|
||||
parkName: data.name,
|
||||
park: data.id,
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await that.init();
|
||||
})
|
||||
})
|
||||
this.onConcal();
|
||||
},
|
||||
onConcal() {
|
||||
this.setData({
|
||||
show: false,
|
||||
title: "",
|
||||
type: "",
|
||||
})
|
||||
},
|
||||
jumpToReading(e) {
|
||||
const { id } = e.currentTarget.dataset;
|
||||
wx.navigateTo({
|
||||
url: `/pages/writeReading/index?id=${id}`,
|
||||
})
|
||||
},
|
||||
async changeStartStatus(e) {
|
||||
const that = this;
|
||||
const { id } = e.currentTarget.dataset;
|
||||
const { code, message } = await changeMeterRouteStatus({ id, status: 1 })
|
||||
if (code !== OK) {
|
||||
alertError(message)
|
||||
return
|
||||
}
|
||||
alertSuccess("操作成功")
|
||||
this.init()
|
||||
setTimeout(() => {
|
||||
that.jumpToReading()
|
||||
}, 500)
|
||||
},
|
||||
async changeEndStatus(e) {
|
||||
const { id } = e.currentTarget.dataset;
|
||||
const { code, message } = await changeMeterRouteStatus({ id, status: 0 })
|
||||
if (code !== OK) {
|
||||
alertError(message)
|
||||
return
|
||||
}
|
||||
alertSuccess("操作成功")
|
||||
this.init()
|
||||
}
|
||||
}
|
||||
})
|
||||
16
pages/workBench/components/reading/index.json
Normal file
16
pages/workBench/components/reading/index.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"search-select": "/components/searchSelect/index",
|
||||
"van-empty": "@vant/weapp/empty/index",
|
||||
"table": "/components/table/table",
|
||||
"pagination": "/components/pagination/index",
|
||||
"empty": "/components/empty/index",
|
||||
"van-radio": "@vant/weapp/radio/index",
|
||||
"van-radio-group": "@vant/weapp/radio-group/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-cell": "@vant/weapp/cell/index"
|
||||
}
|
||||
}
|
||||
61
pages/workBench/components/reading/index.wxml
Normal file
61
pages/workBench/components/reading/index.wxml
Normal file
@@ -0,0 +1,61 @@
|
||||
<!--pages/workBench/components/reading/index.wxml-->
|
||||
<van-field
|
||||
value="{{ parkName }}"
|
||||
placeholder="请选择园区"
|
||||
label="园区"
|
||||
readonly
|
||||
border="{{ false }}"
|
||||
use-button-slot
|
||||
title-width="100rpx"
|
||||
>
|
||||
<van-button slot="button" size="small" type="primary" bind:click="onParkFocus">
|
||||
选择
|
||||
</van-button>
|
||||
</van-field>
|
||||
|
||||
<search-select
|
||||
show="{{show}}"
|
||||
title="{{title}}"
|
||||
type="{{type}}"
|
||||
park="{{park}}"
|
||||
bindconfirm="onConfirm"
|
||||
bindcancel="onConcal"
|
||||
/>
|
||||
|
||||
<van-empty description="请先选择园区" wx:if="{{!park}}" />
|
||||
|
||||
<view wx:else>
|
||||
<van-cell
|
||||
wx:for="{{list}}"
|
||||
wx:key="id"
|
||||
title="{{item.readingRouteName}}"
|
||||
label="包含{{item.meterRoute}}个抄表点"
|
||||
>
|
||||
<view slot="right-icon">
|
||||
<van-button
|
||||
type="primary"
|
||||
size="small"
|
||||
type="primary"
|
||||
bind:tap="changeStartStatus"
|
||||
custom-style="margin-right: 20rpx;"
|
||||
data-id="{{item.id}}"
|
||||
wx:if="{{item.status === 0}}"
|
||||
> 开始抄表 </van-button>
|
||||
<van-button
|
||||
type="primary"
|
||||
size="small"
|
||||
bind:tap="jumpToReading"
|
||||
data-id="{{item.id}}"
|
||||
custom-style="margin-right: 20rpx;"
|
||||
wx:if="{{item.status === 1}}"
|
||||
> 去抄表 </van-button>
|
||||
<van-button
|
||||
size="small"
|
||||
type="danger"
|
||||
bind:tap="changeEndStatus"
|
||||
data-id="{{item.id}}"
|
||||
wx:if="{{item.status === 1}}"
|
||||
> 结束抄表 </van-button>
|
||||
</view>
|
||||
</van-cell>
|
||||
</view>
|
||||
1
pages/workBench/components/reading/index.wxss
Normal file
1
pages/workBench/components/reading/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* pages/workBench/components/reading/index.wxss */
|
||||
@@ -23,7 +23,6 @@ Component({
|
||||
*/
|
||||
methods: {
|
||||
changeQueryType(e) {
|
||||
console.log("change", e)
|
||||
const { type } = e.currentTarget.dataset;
|
||||
this.setData({
|
||||
active: type
|
||||
|
||||
@@ -87,7 +87,6 @@ Component({
|
||||
onConfirm(e) {
|
||||
const { type, data } = e.detail;
|
||||
const that = this;
|
||||
console.log("e.deail", e.detail)
|
||||
switch(type) {
|
||||
case "meter":
|
||||
this.setData({
|
||||
|
||||
@@ -126,7 +126,6 @@ Component({
|
||||
})
|
||||
},
|
||||
onBindClose() {
|
||||
console.log("-----------")
|
||||
this.setData({
|
||||
bindVisible: false,
|
||||
})
|
||||
@@ -185,7 +184,7 @@ Component({
|
||||
this.getTenementMeters();
|
||||
},
|
||||
onTimeConfirm(e) {
|
||||
console.log('e', e)
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -5,7 +5,7 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
active: 0,
|
||||
active: 4
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -28,7 +28,7 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
console.log("this,data", this.data)
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"navigator": "/components/navigator/index",
|
||||
"recharge": "./components/recharge/index",
|
||||
"record": "./components/record/index",
|
||||
"reading": "./components/reading/index",
|
||||
"tenement": "./components/tenement/index",
|
||||
"account": "./components/account/index"
|
||||
},
|
||||
|
||||
@@ -13,4 +13,7 @@
|
||||
<van-tab title="C端账号" >
|
||||
<account />
|
||||
</van-tab>
|
||||
<van-tab title="抄表">
|
||||
<reading />
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
24
pages/writeReading/components/meterInfo/index.js
Normal file
24
pages/writeReading/components/meterInfo/index.js
Normal file
@@ -0,0 +1,24 @@
|
||||
// pages/writeReading/components/meterInfo/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
meterInfo: Object,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
||||
8
pages/writeReading/components/meterInfo/index.json
Normal file
8
pages/writeReading/components/meterInfo/index.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-tag": "@vant/weapp/tag/index",
|
||||
"van-row": "@vant/weapp/row/index",
|
||||
"van-col": "@vant/weapp/col/index"
|
||||
}
|
||||
}
|
||||
70
pages/writeReading/components/meterInfo/index.wxml
Normal file
70
pages/writeReading/components/meterInfo/index.wxml
Normal file
@@ -0,0 +1,70 @@
|
||||
<!--pages/writeReading/components/meterInfo/index.wxml-->
|
||||
<view class="wrapper">
|
||||
<view class="title">
|
||||
<text> 电表列表 </text>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="title">
|
||||
<view class="address">
|
||||
标1东-307
|
||||
</view>
|
||||
<view class="meterType">
|
||||
<van-tag type="primary">华昌宝能收费</van-tag>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="detail">
|
||||
<van-row gutter="20">
|
||||
<van-col span="12">
|
||||
<view class="text">
|
||||
<view>
|
||||
编号
|
||||
</view>
|
||||
<view>
|
||||
{{meterInfo.meterSn}}
|
||||
</view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<view class="text">
|
||||
<view>
|
||||
类型
|
||||
</view>
|
||||
<view wx:if="{{meterInfo.meterBelongType === 0}}">
|
||||
商户电表
|
||||
</view>
|
||||
<view wx:elif="{{meterInfo.meterBelongType === 1}}">
|
||||
公区电表
|
||||
</view>
|
||||
<view wx:elif="{{meterInfo.meterBelongType === 2}}">
|
||||
公摊电表
|
||||
</view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<view class="text">
|
||||
<view>
|
||||
状态
|
||||
</view>
|
||||
<view wx:if="{{meterInfo.enabled}}">
|
||||
正常
|
||||
</view>
|
||||
<view wx:else>
|
||||
停用
|
||||
</view>
|
||||
</view>
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
<view class="text">
|
||||
<view>
|
||||
读数
|
||||
</view>
|
||||
<view>
|
||||
{{meterInfo.overall}}
|
||||
</view>
|
||||
</view>
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
33
pages/writeReading/components/meterInfo/index.wxss
Normal file
33
pages/writeReading/components/meterInfo/index.wxss
Normal file
@@ -0,0 +1,33 @@
|
||||
/* pages/writeReading/components/meterInfo/index.wxss */
|
||||
|
||||
.wrapper {
|
||||
padding: 0 20rpx 20rpx;
|
||||
}
|
||||
|
||||
.info {
|
||||
margin-top: 20rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: 15rpx;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.info .title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.info .title .address {
|
||||
font-size: 36rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.info .detail {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.info .detail .text {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// pages/writeReading/components/meterList/components/meterItem/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
active: Boolean,
|
||||
meter: Object
|
||||
},
|
||||
observers: {
|
||||
"active": function (newValue) {
|
||||
this.setData({
|
||||
isDeep: newValue
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onClick: function() {
|
||||
this.triggerEvent("click")
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<!--pages/writeReading/components/meterList/components/meterItem/index.wxml-->
|
||||
<view class="wrapper {{isDeep ? 'deepBg' : ''}}" bind:tap="onClick">
|
||||
{{meter.meterAddress}}
|
||||
</view>
|
||||
@@ -0,0 +1,24 @@
|
||||
/* pages/writeReading/components/meterList/components/meterItem/index.wxss */
|
||||
|
||||
.wrapper {
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 30rpx;
|
||||
width: 200rpx;
|
||||
box-sizing: border-box;
|
||||
margin-right: 20rpx;
|
||||
background-color: white;
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
font-size: 32rpx;
|
||||
height: 150rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.deepBg {
|
||||
background-color: var(--deep-green);
|
||||
color: white;
|
||||
}
|
||||
134
pages/writeReading/components/meterList/index.js
Normal file
134
pages/writeReading/components/meterList/index.js
Normal file
@@ -0,0 +1,134 @@
|
||||
// pages/writeReading/components/meterList/index.js
|
||||
import { getMeterReadingRouteMeterDetail } from "../../../../service/workBench"
|
||||
import request from "../../../../utils/request"
|
||||
import { alertInfo, alertSuccess, alertError } from "../../../../utils/index"
|
||||
const { OK } = request;
|
||||
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
list: Array,
|
||||
active: Number,
|
||||
meterInfo: Object
|
||||
},
|
||||
observers: {
|
||||
"active,list": function(newActive, newList) {
|
||||
if (newActive >= 0 && newList.length) {
|
||||
this.getMeterInfo(newList?.[newActive]?.meterId, newActive, true)
|
||||
}
|
||||
if (newActive === 0) {
|
||||
this.setData({ scrollLeft: 0 })
|
||||
} else if (newActive > 0) {
|
||||
this.setData({ scrollLeft: 220 * newList.length - 20 })
|
||||
}
|
||||
const { scrollWidth } = this.data;
|
||||
if (scrollWidth) {
|
||||
this.setData({
|
||||
maxScrollLeft: newList?.length ? 220 * newList.length - (scrollWidth || 0) - 20 : 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
animationData: {}, // 存储动画数据
|
||||
position: 0,
|
||||
scrollLeft: 0, // 当前滚动位置
|
||||
maxScrollLeft: 0, // 最大可滚动距离
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
const that = this;
|
||||
const query = this.createSelectorQuery();
|
||||
query.select('.meterListScrollView').boundingClientRect()
|
||||
query.exec(function(res){
|
||||
const { list } = that.data;
|
||||
const length = that.data.list?.length || 0;
|
||||
that.setData({
|
||||
maxScrollLeft:length ? 220 * list.length - (res?.[0]?.width || 0) - 20 : 0,
|
||||
scrollWidth: res?.[0]?.width || 0
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
handleLeft() {
|
||||
// 将动画数据设置到 data 中,从而触发视图更新
|
||||
const currentPosition = this.data.position
|
||||
if (currentPosition === 0) {
|
||||
this.setData({
|
||||
position: currentPosition,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
position: this.data.position + 300,
|
||||
});
|
||||
|
||||
},
|
||||
handleRight() {
|
||||
// // 将动画数据设置到 data 中,从而触发视图更新
|
||||
// const currentPosition = this.data.position
|
||||
// if (currentPosition === 0) {
|
||||
// this.setData({
|
||||
// position: currentPosition,
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
|
||||
this.setData({
|
||||
position: this.data.position - 300,
|
||||
});
|
||||
|
||||
},
|
||||
handleSelect(e) {
|
||||
const { id, index } = e.currentTarget.dataset;
|
||||
this.getMeterInfo(id, index)
|
||||
},
|
||||
async getMeterInfo(id, index, noChange) {
|
||||
const { code, message, data } = await getMeterReadingRouteMeterDetail(id)
|
||||
if (code !== OK) {
|
||||
alertError(message)
|
||||
return;
|
||||
}
|
||||
if (noChange) {
|
||||
this.triggerEvent("changeMeter", { meter: data })
|
||||
return;
|
||||
}
|
||||
this.triggerEvent("changeMeterAndIndex", { index: index, meter: data })
|
||||
},
|
||||
// onScroll(e) {
|
||||
// // 实时更新当前滚动位置,可用于更复杂的边界判断
|
||||
// console.log("e", e)
|
||||
// this.setData({
|
||||
// scrollLeft: e.detail.scrollLeft
|
||||
// });
|
||||
// },
|
||||
|
||||
scrollLeft() {
|
||||
// 向左滚动:减少 scrollLeft,但不能小于0
|
||||
const newScrollLeft = Math.max(0, this.data.scrollLeft - 200);
|
||||
this.setData({
|
||||
scrollLeft: newScrollLeft
|
||||
});
|
||||
},
|
||||
|
||||
scrollRight() {
|
||||
// 向右滚动:增加 scrollLeft,但不能超过 maxScrollLeft
|
||||
const newScrollLeft = Math.min(this.data.maxScrollLeft, this.data.scrollLeft + 200);
|
||||
this.setData({
|
||||
scrollLeft: newScrollLeft
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
7
pages/writeReading/components/meterList/index.json
Normal file
7
pages/writeReading/components/meterList/index.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"meter-item": "./components/meterItem/index"
|
||||
}
|
||||
}
|
||||
31
pages/writeReading/components/meterList/index.wxml
Normal file
31
pages/writeReading/components/meterList/index.wxml
Normal file
@@ -0,0 +1,31 @@
|
||||
<!--pages/writeReading/components/meterList/index.wxml-->
|
||||
|
||||
<view class="wrapper">
|
||||
<view class="title">
|
||||
<text> 电表列表 </text>
|
||||
</view>
|
||||
<view style="display: flex; align-items: center;margin-top: 20rpx;">
|
||||
<van-icon name="arrow-left" size="50rpx" bind:tap="scrollLeft" />
|
||||
<scroll-view
|
||||
scroll-x="{{true}}"
|
||||
class="meterListScrollView"
|
||||
scroll-left="{{scrollLeft}}"
|
||||
bindscroll="onScroll"
|
||||
scroll-with-animation="true"
|
||||
>
|
||||
<view style="display: flex;" class="scroll-content">
|
||||
<meter-item
|
||||
active="{{active === index}}"
|
||||
wx:for="{{list}}"
|
||||
wx:key="id"
|
||||
meter="{{item}}"
|
||||
bind:click="handleSelect"
|
||||
data-index="{{index}}"
|
||||
data-id="{{item.meterId}}"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<van-icon name="arrow" size="50rpx" bind:tap="scrollRight" />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
20
pages/writeReading/components/meterList/index.wxss
Normal file
20
pages/writeReading/components/meterList/index.wxss
Normal file
@@ -0,0 +1,20 @@
|
||||
/* pages/writeReading/components/meterList/index.wxss */
|
||||
|
||||
.wrapper {
|
||||
padding: 0 20rpx 20rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.meterListScrollView {
|
||||
flex: 1;
|
||||
margin-left: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
page {
|
||||
background-color: #ebedf0;
|
||||
}
|
||||
24
pages/writeReading/components/photo/index.js
Normal file
24
pages/writeReading/components/photo/index.js
Normal file
@@ -0,0 +1,24 @@
|
||||
// pages/writeReading/components/photo/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
||||
4
pages/writeReading/components/photo/index.json
Normal file
4
pages/writeReading/components/photo/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
4
pages/writeReading/components/photo/index.wxml
Normal file
4
pages/writeReading/components/photo/index.wxml
Normal file
@@ -0,0 +1,4 @@
|
||||
<!--pages/writeReading/components/photo/index.wxml-->
|
||||
<view class="wrapper">
|
||||
拍照
|
||||
</view>
|
||||
4
pages/writeReading/components/photo/index.wxss
Normal file
4
pages/writeReading/components/photo/index.wxss
Normal file
@@ -0,0 +1,4 @@
|
||||
/* pages/writeReading/components/photo/index.wxss */
|
||||
.wrapper {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
106
pages/writeReading/components/readingInfo/index.js
Normal file
106
pages/writeReading/components/readingInfo/index.js
Normal file
@@ -0,0 +1,106 @@
|
||||
// pages/writeReading/components/readingInfo/index.js
|
||||
|
||||
import { createReading } from "../../../../service/workBench"
|
||||
import { alertError, alertInfo, alertSuccess } from "../../../../utils/index"
|
||||
import request from "../../../../utils/request"
|
||||
const { OK } = request
|
||||
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
meterInfo: Object,
|
||||
showLeft: Boolean,
|
||||
showRight: Boolean,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
currentNumber: null
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
jumpToHistory() {
|
||||
const { meterInfo } = this.data;
|
||||
wx.navigateTo({
|
||||
url: `/pages/readingHistory/index?meter=${meterInfo?.id}&park=${meterInfo?.park}`,
|
||||
})
|
||||
},
|
||||
handlePrev() {
|
||||
this.triggerEvent("prev")
|
||||
},
|
||||
handleNext() {
|
||||
this.triggerEvent("next")
|
||||
},
|
||||
onChange(e) {
|
||||
this.setData({
|
||||
currentNumber: e.detail ? Number(e.detail) : 0
|
||||
})
|
||||
},
|
||||
handleClear() {
|
||||
this.setData({
|
||||
currentNumber: null,
|
||||
})
|
||||
},
|
||||
async onSubmit() {
|
||||
const { meterInfo, currentNumber } = this.data;
|
||||
const { parkId, id } = meterInfo;
|
||||
const { code, message } = await createReading(parkId, id, {
|
||||
overall: `${currentNumber}`,
|
||||
flat: `${currentNumber}`
|
||||
})
|
||||
if (code !== OK) {
|
||||
alertError(message)
|
||||
return
|
||||
}
|
||||
alertSuccess("录入成功")
|
||||
this.handleNext()
|
||||
this.handleClear()
|
||||
},
|
||||
handleCreateReading() {
|
||||
const { meterInfo, currentNumber } = this.data;
|
||||
if (currentNumber == null || currentNumber == undefined) {
|
||||
alertInfo("请填写本次表字后保存")
|
||||
return;
|
||||
}
|
||||
const that = this;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定要录入吗?',
|
||||
complete: (res) => {
|
||||
if (res.cancel) {
|
||||
|
||||
}
|
||||
|
||||
if (res.confirm) {
|
||||
if (meterInfo.consumption < currentNumber) {
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '本次用电量已抄过历史平均水平的100%,是否确认录入?',
|
||||
complete: (res) => {
|
||||
if (res.cancel) {
|
||||
|
||||
}
|
||||
|
||||
if (res.confirm) {
|
||||
that.onSubmit()
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
that.onSubmit()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
10
pages/writeReading/components/readingInfo/index.json
Normal file
10
pages/writeReading/components/readingInfo/index.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-divider": "@vant/weapp/divider/index",
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"photo": "../photo/index",
|
||||
"van-field": "@vant/weapp/field/index"
|
||||
}
|
||||
}
|
||||
90
pages/writeReading/components/readingInfo/index.wxml
Normal file
90
pages/writeReading/components/readingInfo/index.wxml
Normal file
@@ -0,0 +1,90 @@
|
||||
<!--pages/writeReading/components/readingInfo/index.wxml-->
|
||||
|
||||
<view class="wrapper">
|
||||
<view class="bodyTitle">
|
||||
<view class="text">
|
||||
<!-- 电表数据记录器 -->
|
||||
</view>
|
||||
<view class="time" bind:tap="jumpToHistory">
|
||||
<!-- 2025年9月5日 -->
|
||||
历史记录
|
||||
</view>
|
||||
</view>
|
||||
<view class="contentWrapper">
|
||||
<view class="currentMeter">
|
||||
<view class="text">
|
||||
当前电表
|
||||
</view>
|
||||
<view class="address">
|
||||
{{meterInfo.address}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="change">
|
||||
<van-button wx:if="{{showLeft}}" type="info" size="small" bind:click="handlePrev">
|
||||
<van-icon name="arrow-left" />
|
||||
上一块
|
||||
</van-button>
|
||||
<view wx:else></view>
|
||||
<van-button wx:if="{{showRight}}" type="info" size="small" bind:click="handleNext">
|
||||
下一块
|
||||
<van-icon name="arrow" />
|
||||
</van-button>
|
||||
<view wx:else></view>
|
||||
</view>
|
||||
<van-divider />
|
||||
<view class="readingNumber">
|
||||
<view class="lastNumber">
|
||||
<view class="title">
|
||||
上次表字
|
||||
</view>
|
||||
<view class="number">
|
||||
{{meterInfo.overall}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="lastTime">
|
||||
{{meterInfo.readAt}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="nextReadingNumber">
|
||||
<view class="currentNumber">
|
||||
<view class="title">
|
||||
本次表字
|
||||
</view>
|
||||
|
||||
<view class="number">
|
||||
<van-field
|
||||
value="{{currentNumber}}"
|
||||
placeholder="请输入本次读数"
|
||||
bind:change="onChange"
|
||||
border="{{false}}"
|
||||
custom-style="border: 1rpx solid #ccc; padding: 2px 14rpx; font-size: 32rpx; border-radius: 10rpx;"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="photo">
|
||||
<photo />
|
||||
</view>
|
||||
</view>
|
||||
<view class="calc">
|
||||
<view class="title">
|
||||
表字差
|
||||
</view>
|
||||
<view class="rightNumber" wx:if="{{currentNumber - meterInfo.overall >= 0}}">
|
||||
{{(currentNumber || 0) - meterInfo.overall}}
|
||||
</view>
|
||||
<view class="wrongNumber" wx:else>
|
||||
{{(currentNumber || 0) - meterInfo.overall}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="operate">
|
||||
<view style="flex: 1;">
|
||||
<van-button size="small" type="info" block bind:click="handleCreateReading"> 确定录入 </van-button>
|
||||
</view>
|
||||
<view style="flex: 1; margin-left: 20rpx;">
|
||||
<van-button size="small" block bind:click="handleClear"> 清除记录 </van-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view style="height: 10rpx;"></view>
|
||||
112
pages/writeReading/components/readingInfo/index.wxss
Normal file
112
pages/writeReading/components/readingInfo/index.wxss
Normal file
@@ -0,0 +1,112 @@
|
||||
/* pages/writeReading/components/readingInfo/index.wxss */
|
||||
|
||||
.wrapper {
|
||||
margin-left: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.bodyTitle {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: var(--deep-green);
|
||||
padding: 32rpx 20rpx;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
box-sizing: border-box;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.bodyTitle .text {
|
||||
font-size: 40rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.bodyTitle .time {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.contentWrapper {
|
||||
padding: 0 20rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.currentMeter {
|
||||
margin-top: 24rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.currentMeter .address {
|
||||
color: var(--deep-green);
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.change {
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.readingNumber {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.readingNumber .title {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.readingNumber .number {
|
||||
font-size: 42rpx;
|
||||
font-weight: 800;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
.readingNumber .lastTime {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.nextReadingNumber {
|
||||
display: flex;
|
||||
align-items: bottom;
|
||||
}
|
||||
|
||||
.nextReadingNumber .title {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.nextReadingNumber .number {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.currentNumber {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.calc {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.rightNumber {
|
||||
font-size: 38rpx;
|
||||
font-weight: 700;
|
||||
margin-top: 12rpx;
|
||||
color: #73d13d;
|
||||
}
|
||||
|
||||
.wrongNumber {
|
||||
font-size: 38rpx;
|
||||
font-weight: 700;
|
||||
margin-top: 12rpx;
|
||||
color: #ff4d4f;
|
||||
}
|
||||
|
||||
.operate {
|
||||
margin-top: 24rpx;
|
||||
display: flex;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
109
pages/writeReading/index.js
Normal file
109
pages/writeReading/index.js
Normal file
@@ -0,0 +1,109 @@
|
||||
// pages/writeReading/index.js
|
||||
import { getMeterReadingRouteDetail } from "../../service/workBench"
|
||||
import request from "../../utils/request"
|
||||
import { alertSuccess, alertInfo, alertError } from "../../utils/index"
|
||||
const { OK } = request
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
meterList: [],
|
||||
meterInfo: {},
|
||||
active: 0,
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { id } = options;
|
||||
this.getMeterList(id)
|
||||
},
|
||||
async getMeterList(id) {
|
||||
const { code, message, data } = await getMeterReadingRouteDetail(id);
|
||||
if (code !== OK) {
|
||||
alertError(message)
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
meterList: data?.meterRouteDetail || [],
|
||||
meterInfo: data?.meterRouteDetail?.[0] || {}
|
||||
})
|
||||
},
|
||||
changeMeter(e) {
|
||||
this.setData({
|
||||
meterInfo: e.detail.meter,
|
||||
})
|
||||
},
|
||||
changeMeterAndIndex(e) {
|
||||
this.setData({
|
||||
meterInfo: e.detail.meter,
|
||||
active: e.detail.index,
|
||||
})
|
||||
},
|
||||
handleNext() {
|
||||
const { active = 0, meterList } = this.data;
|
||||
let newIndex = active + 1
|
||||
if (active > meterList?.length - 1) {
|
||||
newIndex = meterList?.length - 1
|
||||
}
|
||||
this.setData({
|
||||
active: newIndex
|
||||
})
|
||||
},
|
||||
handlePrev() {
|
||||
this.setData({
|
||||
active: this.data.active === 0 ? 0 : this.data.active - 1
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
},
|
||||
})
|
||||
9
pages/writeReading/index.json
Normal file
9
pages/writeReading/index.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index",
|
||||
"meter-list": "./components/meterList/index",
|
||||
"meter-info": "./components/meterInfo/index",
|
||||
"reading-info": "./components/readingInfo/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
17
pages/writeReading/index.wxml
Normal file
17
pages/writeReading/index.wxml
Normal file
@@ -0,0 +1,17 @@
|
||||
<!--pages/writeReading/index.wxml-->
|
||||
<navigator title="录入抄表记录" canBack="{{true}}" />
|
||||
<meter-list
|
||||
list="{{meterList}}"
|
||||
bind:changeMeter="changeMeter"
|
||||
bind:changeMeterAndIndex="changeMeterAndIndex"
|
||||
active="{{active}}"
|
||||
meterInfo="{{meterInfo}}"
|
||||
/>
|
||||
<meter-info meterInfo="{{meterInfo}}" />
|
||||
<reading-info
|
||||
meterInfo="{{meterInfo}}"
|
||||
showLeft="{{active !== 0}}"
|
||||
showRight="{{active < meterList.length - 1}}"
|
||||
bind:prev="handlePrev"
|
||||
bind:next="handleNext"
|
||||
/>
|
||||
1
pages/writeReading/index.wxss
Normal file
1
pages/writeReading/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* pages/writeReading/index.wxss */
|
||||
@@ -58,5 +58,6 @@
|
||||
},
|
||||
"appid": "wxb34b4e70f8a5c6f1",
|
||||
"libVersion": "development",
|
||||
"simulatorPluginLibVersion": {}
|
||||
"simulatorPluginLibVersion": {},
|
||||
"projectname": "electricity_bill_calc_wx"
|
||||
}
|
||||
@@ -23,6 +23,20 @@
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "pages/writeReading/index",
|
||||
"pathName": "pages/writeReading/index",
|
||||
"query": "id=PR00117566262804481",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/readingHistory/index",
|
||||
"pathName": "pages/readingHistory/index",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/workBench/index",
|
||||
"pathName": "pages/workBench/index",
|
||||
|
||||
@@ -13,7 +13,6 @@ export const userValidate = async function(data) {
|
||||
|
||||
// 获取用户邀请二维码
|
||||
export const getWxCode = async function(id) {
|
||||
console.log("id", id)
|
||||
return await GET(`/wx/getWxCode?id=${id}`);
|
||||
}
|
||||
|
||||
|
||||
27
service/workBench.js
Normal file
27
service/workBench.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import apis from '../utils/request';
|
||||
const { GET, POST, PUT, DELETE } = apis
|
||||
|
||||
// 检索园区路线列表
|
||||
export const getMeterReadingRouteList = async function(keyword) {
|
||||
return await GET(`/park/route/list?keyword=${keyword}`);
|
||||
}
|
||||
|
||||
// 更新园区路线状态
|
||||
export const changeMeterRouteStatus = async function(data) {
|
||||
return await PUT(`/park/route/${data?.id}/status/update`, data);
|
||||
}
|
||||
|
||||
// 检索电表路线详细
|
||||
export const getMeterReadingRouteDetail = async function(id) {
|
||||
return await GET(`/park/meter/${id}/route/list`);
|
||||
}
|
||||
|
||||
// 抄表路线中的表计详细信息
|
||||
export const getMeterReadingRouteMeterDetail = async function(id) {
|
||||
return await GET(`/route/meter/${id}`);
|
||||
}
|
||||
|
||||
// 新建一条抄表记录
|
||||
export const createReading = async function(park, code, data) {
|
||||
return await POST(`/reading/${park}/${code}`, data);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ const request = async function (options, config = {}) {
|
||||
|
||||
// 处理返回结果,默认直接返回数据
|
||||
const parseResponse = function (response, url) {
|
||||
console.log('response', response)
|
||||
console.log('response', response, url)
|
||||
if (!response) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/login/index',
|
||||
@@ -146,6 +146,7 @@ const CUD = async function (method, uri, data = null) {
|
||||
options.data = data;
|
||||
}
|
||||
const response = await request(options);
|
||||
console.log("response---------",response)
|
||||
return parseResponse(response);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user