From e45c024d2f4bb54101aac8069a167c6453952629 Mon Sep 17 00:00:00 2001 From: SelfRidicule Date: Wed, 14 Aug 2024 16:27:51 +0800 Subject: [PATCH] 1 --- miniprogram/api/repair/repair.js | 8 + .../reportRepair/assign/affirm/affirm.js | 174 +++++++++++++++--- .../reportRepair/assign/affirm/affirm.json | 4 +- .../reportRepair/assign/affirm/affirm.wxml | 34 ++-- .../reportRepair/assign/affirm/affirm.wxss | 2 +- 5 files changed, 186 insertions(+), 36 deletions(-) diff --git a/miniprogram/api/repair/repair.js b/miniprogram/api/repair/repair.js index 38be7e6..028fa1a 100644 --- a/miniprogram/api/repair/repair.js +++ b/miniprogram/api/repair/repair.js @@ -79,6 +79,14 @@ export function flowHandleRq(data) { }); } +// 根据设备类型查询维修人员 +export function selectWorkerIdByTypeIdRq(id) { + return request({ + url: `/repairDeviceApi/selectWorkerIdByTypeId?typeId=${id}`, + method: "get", + }); +} + // 返回订单状态 // 状态:1 待派单,3 重新派单,5 已派单,7 处理中, 9已完成 待评价, 11 已关闭 13 已评价 diff --git a/miniprogram/pages/reportRepair/assign/affirm/affirm.js b/miniprogram/pages/reportRepair/assign/affirm/affirm.js index 8612d57..7ffc4c0 100644 --- a/miniprogram/pages/reportRepair/assign/affirm/affirm.js +++ b/miniprogram/pages/reportRepair/assign/affirm/affirm.js @@ -1,5 +1,18 @@ const app = getApp() +import Notify from '@vant/weapp/notify/notify'; + +import { + selfFormatTimeYMDHMS, +} from "../../../../utils/util.js" + +import { + getDetailRq, + getStatusName, + flowHandleRq, + selectWorkerIdByTypeIdRq +} from "../../../../api/repair/repair.js" + Page({ /** @@ -7,50 +20,167 @@ Page({ */ data: { IMG_NAME: app.IMG_NAME, - timeShow : true, + id: '', + detail: {}, + form: { + repairUserId: null, + repairUserName: null, + preDate: '', + }, + preDateVisible: false, + preDateTime: new Date().getTime(), + userVisible: false, + userColumns: [{ + values: [], + className: 'column1', + }], }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + console.log('onLoad', options); + let _this = this + _this.setData({ + ...options + }) + _this.getDetail(options.id) }, - back(){ + back() { wx.navigateBack() }, - // 提交反馈 - jumpFeedback(){ - wx.navigateTo({ - url: '/pages/reportRepair/assign/feedback/feedback', + getDetail(id) { + let _this = this + getDetailRq({ + id + }).then(res => { + console.log("getDetailRq", res); + // 详情 + let detail = res.repair + detail.statusName = getStatusName(detail.status) + // + _this.setData({ + detail, + }) + // 查询维修员 + _this.queryWorkUser(detail.typeId) }) }, - // 无效 - invalid(){ - wx.navigateBack() - }, - - // 跳转人员列表 - jumpPersonList(){ - wx.navigateTo({ - url: '/pages/reportRepair/assign/personList/personList', + // 显示-完成时间 + showPreDate() { + let _this = this; + _this.setData({ + preDateVisible: true }) }, - // 显示时间 - showTime(){ + // 关闭-完成时间 + hidePreDate() { + let _this = this; + _this.setData({ + preDateVisible: false + }) + }, + + // 确认-完成时间 + confirmPreDate(e) { + console.log('confirmPreDate', e); + let _this = this; + let form = _this.data.form; + form.preDate = selfFormatTimeYMDHMS(e.detail); + _this.setData({ + preDateVisible: false, + preDateTime: e.detail, + form + }) + }, + + // 查询维修员 + queryWorkUser(id) { + let _this = this + selectWorkerIdByTypeIdRq(id).then(res => { + console.log('selectWorkerIdByTypeIdRq', res); + let list = res.rows.map(item => { + return { + id: item.userId, + userName: item.userName, + text: item.userPhone + '-' + item.userName + } + }) + let userColumns = _this.data.userColumns + userColumns[0].values = list + _this.setData({ + userColumns + }) + }) + }, + + showUser() { this.setData({ - timeShow : true, + userVisible: true, }) }, - // 关闭时间 - closeTime(){ + hideUser() { this.setData({ - timeShow : false, + userVisible: false, + }) + }, + + // 确认用户 + userColumnsConfirm(e) { + console.log('userColumnsConfirm', e.detail); + let _this = this + const { + picker, + value, + index + } = e.detail; + let form = _this.data.form + form.repairUserId = value[0].id + form.repairUserName = value[0].text + _this.setData({ + form, + userVisible: false + }) + }, + + submit() { + let _this = this + // 参数校验 + if (!_this.data.form.repairUserId) { + // 危险通知 + app.vantNotifyErrTop(Notify, '请选择维修人员!') + return + } + if (!_this.data.form.preDate) { + // 危险通知 + app.vantNotifyErrTop(Notify, '请选择预计完成时间!') + return + } + // 提交参数 + let data = { + "repair": { + id: _this.data.id, + ..._this.data.form + }, + "content": '指派维修员', + "operate": "NEXT" + } + flowHandleRq(data).then(res => { + console.log('flowHandleRq', res); + if (res.code == 0) { + app.vantNotifySuccessTop(Notify, res.msg) + wx.navigateBack({ + delta: 2 + }) + } else { + app.vantNotifyErrTop(Notify, res.msg) + } }) }, diff --git a/miniprogram/pages/reportRepair/assign/affirm/affirm.json b/miniprogram/pages/reportRepair/assign/affirm/affirm.json index 3e0e955..ab8880c 100644 --- a/miniprogram/pages/reportRepair/assign/affirm/affirm.json +++ b/miniprogram/pages/reportRepair/assign/affirm/affirm.json @@ -2,7 +2,9 @@ "navigationStyle": "custom", "usingComponents": { "van-icon": "@vant/weapp/icon/index", + "van-popup": "@vant/weapp/popup/index", "van-datetime-picker": "@vant/weapp/datetime-picker/index", - "van-action-sheet": "@vant/weapp/action-sheet/index" + "van-notify": "@vant/weapp/notify/index", + "van-picker": "@vant/weapp/picker/index" } } \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/assign/affirm/affirm.wxml b/miniprogram/pages/reportRepair/assign/affirm/affirm.wxml index 1a5935d..dfc28ed 100644 --- a/miniprogram/pages/reportRepair/assign/affirm/affirm.wxml +++ b/miniprogram/pages/reportRepair/assign/affirm/affirm.wxml @@ -16,29 +16,39 @@ - YG123081273812 - 空调 - 待派单 + {{detail.sn}} + {{detail.typeName + '/' + detail.deviceName}} + {{detail.statusName}} 派单 - - 请选择维修人员 + + {{form.repairUserName ? form.repairUserName : '请选择维修人员'}} - - 请选择预计完成时间 + + {{form.preDate ? form.preDate : '请选择预计完成时间'}} - - - + 提交 - 提交 + - \ No newline at end of file + + + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/assign/affirm/affirm.wxss b/miniprogram/pages/reportRepair/assign/affirm/affirm.wxss index 6071318..1325e1d 100644 --- a/miniprogram/pages/reportRepair/assign/affirm/affirm.wxss +++ b/miniprogram/pages/reportRepair/assign/affirm/affirm.wxss @@ -147,5 +147,5 @@ .mainView .reportView .itemView .label { flex-shrink: 0; font-size: 30rpx; - color: gray; + color: black; }