Files
electricity_bill_calc_wx/pages/workOrderDetail/index.js
2025-11-12 18:14:12 +08:00

112 lines
1.8 KiB
JavaScript

import { loadingFunc, alertSuccess, alertInfo } from "../../utils/index";
import request from "../../utils/request"
import { getNoticeFlowDetail, doNoticeFlow } from "../../service/workBench"
const { OK } = request;
// pages/workOrderDetail/index.js
Page({
/**
* 页面的初始数据
*/
data: {
detail: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { id } = options;
const that = this;
loadingFunc(async () => {
that.getDetail(id)
})
},
showImage() {
this.setData({
imageShow: true
})
},
onClose() {
this.setData({
imageShow: false
})
},
goback() {
wx.navigateBack();
},
async onSubmit() {
const {detail} = this.data;
const {id} = detail;
const { code, message } = await doNoticeFlow(id)
if (code !== OK) {
alertInfo(message)
return
}
alertSuccess("确认成功")
const that = this;
loadingFunc(async () => {
that.getDetail(id)
})
},
async getDetail(id) {
const { code, data ,message } = await getNoticeFlowDetail(id)
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
detail: data
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})