From e7bff026f7ad2dd08b42b5dfc75468e5ebf29eb8 Mon Sep 17 00:00:00 2001 From: SelfRidicule Date: Wed, 7 Aug 2024 16:21:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=8F=E8=BF=B0:1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/api/repair/distributionCase.js | 13 + .../reportRepair/assign/record/record.js | 395 ++++++------------ .../reportRepair/assign/record/record.json | 3 +- .../reportRepair/assign/record/record.wxml | 29 +- .../pages/reportRepair/report/report.wxml | 4 +- miniprogram/utils/util.js | 13 +- 6 files changed, 170 insertions(+), 287 deletions(-) create mode 100644 miniprogram/api/repair/distributionCase.js diff --git a/miniprogram/api/repair/distributionCase.js b/miniprogram/api/repair/distributionCase.js new file mode 100644 index 0000000..21e862e --- /dev/null +++ b/miniprogram/api/repair/distributionCase.js @@ -0,0 +1,13 @@ +import { + request +} from '../selfRequest'; + + +// 派单列表 +export function dispatcherListRq(data) { + return request({ + url: '/repair/dispatcherList', + method: "post", + data + }); +} diff --git a/miniprogram/pages/reportRepair/assign/record/record.js b/miniprogram/pages/reportRepair/assign/record/record.js index 2adb9c9..23dfaf2 100644 --- a/miniprogram/pages/reportRepair/assign/record/record.js +++ b/miniprogram/pages/reportRepair/assign/record/record.js @@ -5,14 +5,15 @@ import Notify from '@vant/weapp/notify/notify'; import { selfFormatTimeYMD, - selfFormatTimeHM + selfFormatTimeHM, + checkIsImg } from "../../../../utils/util.js" + import { - selectReservationListByUserIdRq, - selectVisitorInvitationRecordRq, - cancelOrderRq -} from "../../../../api/meeting/meetingRoom.js" + dispatcherListRq +} from "../../../../api/repair/distributionCase.js" + Page({ @@ -23,17 +24,32 @@ Page({ IMG_NAME: app.IMG_NAME, userData: null, dataChange: false, - tabTitle: '预约记录', - // 预约记录参数 - reservationPageNum: 1, - reservationPageSize: 10, - reservationDataList: [], - reservationIsDataAll: false, - // 参与记录参数 - participatePageNum: 1, - participatePageSize: 10, - participateDataList: [], - participateIsDataAll: false, + tabTitle: '待派单', // tab 标题 + resendOrderVisible: false, // 重新派单显示 + // 重新派单 + resendOrderPageNum: 1, + resendOrderPageSize: 10, + resendOrderStatus: 0, + resendOrderDataList: [], + resendOrderIsDataAll: false, + // 待派单 + pendingOrderPageNum: 1, + pendingOrderPageSize: 10, + pendingOrderStatus: 1, + pendingOrderDataList: [], + pendingOrderIsDataAll: false, + // 已派单 + assignOrderPageNum: 1, + assignOrderPageSize: 10, + assignOrderStatus: 2, + assignOrderDataList: [], + assignOrderIsDataAll: false, + // 已关闭 + closeOrderPageNum: 1, + closeOrderPageSize: 10, + closeOrderStatus: 3, + closeOrderDataList: [], + closeOrderIsDataAll: false, }, /** @@ -46,40 +62,58 @@ Page({ }) // 获取数据 let userId = _this.data.userData.id - // 获取预约数据 - _this.getReservationData({ - userId, - pageNum: _this.data.reservationPageNum, - pageSize: _this.data.reservationPageSize, - }) - // 获取参与数据 - _this.getParticipateData({ - userId, - pageNum: _this.data.participatePageNum, - pageSize: _this.data.participatePageSize - }) + // 角色是否是:网格长 + if (true) { + _this.setData({ + tabTitle: '重新派单', // tab 标题 + resendOrderVisible: true, // 重新派单显示 + }) + _this.getDataList('重新派单') + } + // 数据 + _this.getDataList('待派单') + _this.getDataList('已派单') + _this.getDataList('已关闭') }, // 获取数据 - getDataList() { + getDataList(transferTabTitle) { // 获取参数 let _this = this; let tabTitle = _this.data.tabTitle + if (transferTabTitle) { + tabTitle = transferTabTitle + } let userId = _this.data.userData.id let isDataAll = null let pageNum = null let pageSize = null - if (tabTitle == '预约记录') { - // 预约记录参数 - isDataAll = _this.data.reservationIsDataAll - pageNum = _this.data.reservationPageNum - pageSize = _this.data.reservationPageSize + let status = null + + if (tabTitle == '重新派单') { + pageNum = _this.data.resendOrderPageNum + pageSize = _this.data.resendOrderPageSize + status = _this.data.resendOrderStatus + isDataAll = _this.data.resendOrderIsDataAll + + } else if (tabTitle == '待派单') { + pageNum = _this.data.pendingOrderPageNum + pageSize = _this.data.pendingOrderPageSize + status = _this.data.pendingOrderStatus + isDataAll = _this.data.pendingOrderIsDataAll + + } else if (tabTitle == '已派单') { + pageNum = _this.data.assignOrderPageNum + pageSize = _this.data.assignOrderPageSize + status = _this.data.assignOrderStatus + isDataAll = _this.data.assignOrderIsDataAll + + } else if (tabTitle == '已关闭') { + pageNum = _this.data.closeOrderPageNum + pageSize = _this.data.closeOrderPageSize + status = _this.data.closeOrderStatus + isDataAll = _this.data.closeOrderIsDataAll - } else if (tabTitle == '预约记录') { - // 参与记录参数 - isDataAll = _this.data.participateIsDataAll - pageNum = _this.data.participatePageNum - pageSize = _this.data.participatePageSize } else { wx.showToast({ title: `tab 切换错误(${tabTitle})`, @@ -95,179 +129,69 @@ Page({ // 传递参数 let param = { userId, - pageNum, - pageSize - } - if (tabTitle == '预约记录') { - // 获取预约数据 - _this.getReservationData(param) - } else if (tabTitle == '预约记录') { - // 获取参与数据 - _this.getParticipateData(param) - } - }, - - // 获取预约数据 - getReservationData(param) { - let _this = this; - let { pageNum, pageSize, - userId - } = param - // 查询数据 - selectReservationListByUserIdRq({ - pageNum, - pageSize, - userId - }).then(res => { - console.log('selectReservationListByUserIdRq', res); - // 判断数据是否全部查询 - let queryDataList = res.page.records; - if (queryDataList && queryDataList.length > 0) { - // 更新参数 - let reservationDataList = _this.data.reservationDataList.concat(_this.formartData(queryDataList)); - let reservationPageNum = _this.data.reservationPageNum + 1; - _this.setData({ - reservationPageNum, - reservationDataList, - }) - } else { - _this.setData({ - reservationIsDataAll: true - }) + statusValue : status + } + // 查询数据 + dispatcherListRq(param).then(res => { + console.log('dispatcherListRq', res); + let dataList = res.rows + let isDataAll = false + if (!(dataList && dataList.length > 0)) { + dataList = [] + isDataAll = true } - }) - }, - - // 获取参与数据 - getParticipateData(param) { - let _this = this; - let { - pageNum, - pageSize, - userId - } = param - // 查询数据 - selectVisitorInvitationRecordRq({ - pageNum, - pageSize, - userId - }).then(res => { - console.log('selectVisitorInvitationRecordRq', res); - // 判断数据是否全部查询 - let queryDataList = res.page.records; - if (queryDataList && queryDataList.length > 0) { - // 更新参数 - let participateDataList = _this.data.participateDataList.concat(_this.formartData(queryDataList)); - let participatePageNum = _this.data.participatePageNum + 1; + // + if (tabTitle == '重新派单') { _this.setData({ - participatePageNum, - participateDataList, + resendOrderDataList: _this.data.resendOrderDataList.concat(_this.formartData(dataList)), + resendOrderPageNum: pageNum + 1, + resendOrderIsDataAll: isDataAll, }) - } else { + + } else if (tabTitle == '待派单') { _this.setData({ - participateIsDataAll: true + pendingOrderDataList: _this.data.pendingOrderDataList.concat(_this.formartData(dataList)), + pendingOrderPageNum: pageNum + 1, + pendingOrderIsDataAll: isDataAll, + }) + + } else if (tabTitle == '已派单') { + _this.setData({ + assignOrderDataList: _this.data.assignOrderDataList.concat(_this.formartData(dataList)), + assignOrderPageNum: pageNum + 1, + assignOrderIsDataAll: isDataAll, + }) + + } else if (tabTitle == '已关闭') { + _this.setData({ + closeOrderDataList: _this.data.closeOrderDataList.concat(_this.formartData(dataList)), + closeOrderPageNum: pageNum + 1, + closeOrderIsDataAll: isDataAll, }) } }) }, // 格式化数据 - formartData(queryDataList) { + formartData(dataList) { // 格式化数据 - return queryDataList.map(item => { - item.timeSlot = selfFormatTimeYMD(item.startTime) + ' ' + selfFormatTimeHM(item.startTime) + '~' + selfFormatTimeHM(item.endDate); - // 状态字体颜色 - let statusColor = "#FFB119"; - // 按钮是否显示 - let statusValue = item.statusValue; - let showPay = false; - let showInvite = false; - let showCancel = false; - let showDetail = false; - // 待支付 0 :去支付、取消订单、查看详情 - if (statusValue == 0) { - showPay = true; - showCancel = true; - showDetail = true; - // 状态字体颜色 - statusColor = "#FFB119"; - } - // 待使用 1:去邀请、取消订单、查看详情 - if (statusValue == 1) { - showInvite = true; - showCancel = true; - showDetail = true; - // 状态字体颜色 - statusColor = "#3794FF"; - // 待使用 修改为 预约成功 - item.statusName = '预约成功' - } - // 进行中 2:去邀请、查看详情 - if (statusValue == 2) { - showInvite = true; - showDetail = true; - // 状态字体颜色 - statusColor = "#FF4040"; - } - // 已结束 3:查看详情 - if (statusValue == 3) { - showDetail = true; - // 状态字体颜色 - statusColor = "#333333"; - } - // 已取消 4:查看详情 - if (statusValue == 4) { - showDetail = true; - // 状态字体颜色 - statusColor = "#7F7F7F"; - } - // - // 赋值 - item.showPay = showPay; - item.showInvite = showInvite; - item.showCancel = showCancel; - item.showDetail = showDetail; - // 状态字体颜色 - item.statusColor = statusColor; - // 图片 - if (item.roomContent.indoorPicUrl) { - try { - item.roomContent.indoorPicUrlFirst = JSON.parse(item.roomContent.indoorPicUrl)[0].url - } catch (error) { - console.log(`JSON error : ${error}`); + return dataList.map(item => { + let repairImages = item.repairImages + if(repairImages){ + let fileList = JSON.parse(repairImages) + let file = fileList.find(item=> checkIsImg(item.url)) + if(file){ + item.visibleImg = file.url + }else{ + item.visibleImg = '/profile/static/repair/index/noneImg.png' } + }else{ + item.visibleImg = '/profile/static/repair/index/noneImg.png' } return item; }) - - }, - - // 跳转-支付 - jumpPay(e) { - console.log('jumpPay', e); - wx.navigateTo({ - url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id + "&type=meetingRoom" - }) - }, - - // 跳转-预约详情 - jumpMeetingDetail(e) { - console.log('jumpMeetingDetail', e); - let id = e.currentTarget.dataset.id - wx.navigateTo({ - url: "/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail?id=" + id, - }) - }, - - // 跳转-参与详情 - jumpParticipateDetail(e) { - console.log('jumpParticipateDetail', e); - let id = e.currentTarget.dataset.id - wx.navigateTo({ - url: "/pages/meeting/invite/invite?id=" + id, - }) }, // tab 点击切换 @@ -279,61 +203,17 @@ Page({ }) }, - // 取消订单 - cancelOrder(e) { - console.log('cancelOrder', e); - let _this = this; - let id = e.currentTarget.dataset.id - const beforeClose = (action) => { - console.log('action', action); - return new Promise((resolve) => { - if (action === 'confirm') { - cancelOrderRq({ - id, - cancelResaon: "" - }).then(res => { - console.log('cancelOrderRq', res); - if (res.code == 0) { - // 刷新预约数据 - _this.setData({ - reservationPageNum: 1, - reservationDataList: [], - reservationIsDataAll: false, - }) - _this.getDataList() - } else { - // 危险通知 - Notify({ - type: 'danger', - message: res.msg - }); - } - resolve(true); - }) - } else { - // 拦截取消操作 - resolve(true); - } - }); - } - Dialog.confirm({ - title: '提示', - message: '是否取消预约!', - beforeClose, - }); - }, - // 跳转-详情 - jumpDetail(){ + jumpDetail() { wx.navigateTo({ - url: '/pages/reportRepair/assign/detail/detail', + url: '/pages/reportRepair/assign/detail/detail', }) }, // 跳转-重新分配 - jumpAgain(){ + jumpAgain() { wx.navigateTo({ - url: '/pages/reportRepair/assign/again/again', + url: '/pages/reportRepair/assign/again/again', }) }, @@ -349,36 +229,7 @@ Page({ */ onShow() { let _this = this; - // 数据是否变化 - if (_this.data.dataChange) { - // 刷新数据 - _this.setData({ - dataChange: false, - // 预约记录参数 - reservationPageNum: 1, - reservationDataList: [], - reservationIsDataAll: false, - // 参与记录参数 - participatePageNum: 1, - participateDataList: [], - participateIsDataAll: false, - }) - // 获取数据 - let userId = _this.data.userData.id - // 获取预约数据 - _this.getReservationData({ - userId, - pageNum: _this.data.reservationPageNum, - pageSize: _this.data.reservationPageSize, - }) - // 获取参与数据 - _this.getParticipateData({ - userId, - pageNum: _this.data.participatePageNum, - pageSize: _this.data.participatePageSize - }) - } }, /** diff --git a/miniprogram/pages/reportRepair/assign/record/record.json b/miniprogram/pages/reportRepair/assign/record/record.json index 9de6165..e53c9d2 100644 --- a/miniprogram/pages/reportRepair/assign/record/record.json +++ b/miniprogram/pages/reportRepair/assign/record/record.json @@ -5,7 +5,8 @@ "van-tabs": "@vant/weapp/tabs/index", "van-divider": "@vant/weapp/divider/index", "van-dialog": "@vant/weapp/dialog/index", - "van-notify": "@vant/weapp/notify/index" + "van-notify": "@vant/weapp/notify/index", + "van-icon": "@vant/weapp/icon/index" }, "onReachBottomDistance": 100 } \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/assign/record/record.wxml b/miniprogram/pages/reportRepair/assign/record/record.wxml index ea578fd..cd24156 100644 --- a/miniprogram/pages/reportRepair/assign/record/record.wxml +++ b/miniprogram/pages/reportRepair/assign/record/record.wxml @@ -1,11 +1,11 @@ - - + + 编号: T123123123 - + 空调损坏 设备名称: 空调 @@ -18,30 +18,37 @@ 2024-01-01 12:12:00 - + 数据已全部加载 - + 编号: T123123123 - + 空调损坏 - 设备名称: 空调 - 设备地址: 301南楼 + 类型: 空调 + 地点: 301南楼 + 楼层: 301南楼 - 王军(18300011120) - 2024-01-01 12:12:00 + + + 王军(18300011120) + + + + 2024-01-01 12:12:00 + - + 数据已全部加载 diff --git a/miniprogram/pages/reportRepair/report/report.wxml b/miniprogram/pages/reportRepair/report/report.wxml index df125b2..f9dd6fa 100644 --- a/miniprogram/pages/reportRepair/report/report.wxml +++ b/miniprogram/pages/reportRepair/report/report.wxml @@ -52,9 +52,9 @@ - 故障图片 + 故障图片/视频 - + diff --git a/miniprogram/utils/util.js b/miniprogram/utils/util.js index 4c6b787..534db56 100644 --- a/miniprogram/utils/util.js +++ b/miniprogram/utils/util.js @@ -231,6 +231,16 @@ function getUrlParamsObj(url) { return obj } +// 判断是否是图片 +function checkIsImg(url) { + if (!/\.(jpg|jpeg|png|GIF|JPG|PNG)$/.test(url)) { + return false; + } else { + return true; + } +} + + module.exports = { formatTime: formatTime, formatDate: formatDate, @@ -247,5 +257,6 @@ module.exports = { twoTimeInterval, twoTimeIntervalReturnHours, selfArrSum, - getUrlParamsObj + getUrlParamsObj, + checkIsImg } \ No newline at end of file