修改状态

This commit is contained in:
2025-09-24 10:24:52 +08:00
parent e64318f174
commit a2f92a0959
12 changed files with 70 additions and 24 deletions

View File

@@ -53,9 +53,9 @@ Page({
})
},
jumpToReading(e) {
const { id } = e.currentTarget.dataset;
const { id, type } = e.currentTarget.dataset;
wx.navigateTo({
url: `/pages/writeReading/index?id=${id}`,
url: `/pages/writeReading/index?id=${id}&type=${type}`,
})
},
async changeStartStatus(e) {
@@ -73,14 +73,28 @@ Page({
}, 500)
},
async changeEndStatus(e) {
const { id, routeid: routeId } = e.currentTarget.dataset;
const { code, message } = await changeMeterRouteStatus({ id, status: 0, routeId })
if (code !== OK) {
alertError(message)
return
}
alertSuccess("操作成功")
this.init()
const that = this;
wx.showModal({
title: '提示',
content: '确认要结束吗?',
complete: async (res) => {
if (res.cancel) {
}
if (res.confirm) {
const { id, routeid: routeId } = e.currentTarget.dataset;
const { code, message } = await changeMeterRouteStatus({ id, status: 0, routeId })
if (code !== OK) {
alertError(message)
return
}
alertSuccess("操作成功")
that.init()
}
}
})
},
/**
* 生命周期函数--监听页面加载

View File

@@ -31,7 +31,10 @@
wx:for="{{list}}"
wx:key="id"
title="{{item.readingRouteName}}"
label="包含{{item.meterRoute}}个抄表点"
label="包含{{item.meterRoute}}个抄表点"
data-id="{{item.id}}"
data-type="look"
bind:click="jumpToReading"
>
<view slot="right-icon">
<van-button
@@ -42,6 +45,7 @@
data-routeId="{{item.readingRouteId}}"
custom-style="margin-right: 20rpx;"
data-id="{{item.id}}"
wx:if="{{item.status === 0}}"
> 开始抄表 </van-button>
<van-button
@@ -49,6 +53,7 @@
size="small"
bind:tap="jumpToReading"
data-id="{{item.id}}"
data-type="edit"
custom-style="margin-right: 20rpx;"
wx:if="{{item.status === 1}}"
> 去抄表 </van-button>