This commit is contained in:
SelfRidicule 2024-08-07 16:21:32 +08:00
parent a6c73a023d
commit e7bff026f7
6 changed files with 170 additions and 287 deletions

View File

@ -0,0 +1,13 @@
import {
request
} from '../selfRequest';
// 派单列表
export function dispatcherListRq(data) {
return request({
url: '/repair/dispatcherList',
method: "post",
data
});
}

View File

@ -5,14 +5,15 @@ import Notify from '@vant/weapp/notify/notify';
import { import {
selfFormatTimeYMD, selfFormatTimeYMD,
selfFormatTimeHM selfFormatTimeHM,
checkIsImg
} from "../../../../utils/util.js" } from "../../../../utils/util.js"
import { import {
selectReservationListByUserIdRq, dispatcherListRq
selectVisitorInvitationRecordRq, } from "../../../../api/repair/distributionCase.js"
cancelOrderRq
} from "../../../../api/meeting/meetingRoom.js"
Page({ Page({
@ -23,17 +24,32 @@ Page({
IMG_NAME: app.IMG_NAME, IMG_NAME: app.IMG_NAME,
userData: null, userData: null,
dataChange: false, dataChange: false,
tabTitle: '预约记录', tabTitle: '待派单', // tab 标题
// 预约记录参数 resendOrderVisible: false, // 重新派单显示
reservationPageNum: 1, // 重新派单
reservationPageSize: 10, resendOrderPageNum: 1,
reservationDataList: [], resendOrderPageSize: 10,
reservationIsDataAll: false, resendOrderStatus: 0,
// 参与记录参数 resendOrderDataList: [],
participatePageNum: 1, resendOrderIsDataAll: false,
participatePageSize: 10, // 待派单
participateDataList: [], pendingOrderPageNum: 1,
participateIsDataAll: false, 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 let userId = _this.data.userData.id
// 获取预约数据 // 角色是否是:网格长
_this.getReservationData({ if (true) {
userId, _this.setData({
pageNum: _this.data.reservationPageNum, tabTitle: '重新派单', // tab 标题
pageSize: _this.data.reservationPageSize, resendOrderVisible: true, // 重新派单显示
})
// 获取参与数据
_this.getParticipateData({
userId,
pageNum: _this.data.participatePageNum,
pageSize: _this.data.participatePageSize
}) })
_this.getDataList('重新派单')
}
// 数据
_this.getDataList('待派单')
_this.getDataList('已派单')
_this.getDataList('已关闭')
}, },
// 获取数据 // 获取数据
getDataList() { getDataList(transferTabTitle) {
// 获取参数 // 获取参数
let _this = this; let _this = this;
let tabTitle = _this.data.tabTitle let tabTitle = _this.data.tabTitle
if (transferTabTitle) {
tabTitle = transferTabTitle
}
let userId = _this.data.userData.id let userId = _this.data.userData.id
let isDataAll = null let isDataAll = null
let pageNum = null let pageNum = null
let pageSize = null let pageSize = null
if (tabTitle == '预约记录') { let status = null
// 预约记录参数
isDataAll = _this.data.reservationIsDataAll if (tabTitle == '重新派单') {
pageNum = _this.data.reservationPageNum pageNum = _this.data.resendOrderPageNum
pageSize = _this.data.reservationPageSize 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 { } else {
wx.showToast({ wx.showToast({
title: `tab 切换错误(${tabTitle})`, title: `tab 切换错误(${tabTitle})`,
@ -95,179 +129,69 @@ Page({
// 传递参数 // 传递参数
let param = { let param = {
userId, userId,
pageNum,
pageSize
}
if (tabTitle == '预约记录') {
// 获取预约数据
_this.getReservationData(param)
} else if (tabTitle == '预约记录') {
// 获取参与数据
_this.getParticipateData(param)
}
},
// 获取预约数据
getReservationData(param) {
let _this = this;
let {
pageNum, pageNum,
pageSize, pageSize,
userId statusValue : status
} = param }
// 查询数据 // 查询数据
selectReservationListByUserIdRq({ dispatcherListRq(param).then(res => {
pageNum, console.log('dispatcherListRq', res);
pageSize, let dataList = res.rows
userId let isDataAll = false
}).then(res => { if (!(dataList && dataList.length > 0)) {
console.log('selectReservationListByUserIdRq', res); dataList = []
// 判断数据是否全部查询 isDataAll = true
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
})
}
})
},
// 获取参与数据
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;
_this.setData({
participatePageNum,
participateDataList,
})
} else {
_this.setData({
participateIsDataAll: true
})
}
})
},
// 格式化数据
formartData(queryDataList) {
// 格式化数据
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";
} }
// //
// 赋值 if (tabTitle == '重新派单') {
item.showPay = showPay; _this.setData({
item.showInvite = showInvite; resendOrderDataList: _this.data.resendOrderDataList.concat(_this.formartData(dataList)),
item.showCancel = showCancel; resendOrderPageNum: pageNum + 1,
item.showDetail = showDetail; resendOrderIsDataAll: isDataAll,
// 状态字体颜色 })
item.statusColor = statusColor;
// 图片 } else if (tabTitle == '待派单') {
if (item.roomContent.indoorPicUrl) { _this.setData({
try { pendingOrderDataList: _this.data.pendingOrderDataList.concat(_this.formartData(dataList)),
item.roomContent.indoorPicUrlFirst = JSON.parse(item.roomContent.indoorPicUrl)[0].url pendingOrderPageNum: pageNum + 1,
} catch (error) { pendingOrderIsDataAll: isDataAll,
console.log(`JSON error : ${error}`); })
} 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(dataList) {
// 格式化数据
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; 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 点击切换 // tab 点击切换
@ -279,50 +203,6 @@ 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({ wx.navigateTo({
@ -349,36 +229,7 @@ Page({
*/ */
onShow() { onShow() {
let _this = this; 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
})
}
}, },
/** /**

View File

@ -5,7 +5,8 @@
"van-tabs": "@vant/weapp/tabs/index", "van-tabs": "@vant/weapp/tabs/index",
"van-divider": "@vant/weapp/divider/index", "van-divider": "@vant/weapp/divider/index",
"van-dialog": "@vant/weapp/dialog/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 "onReachBottomDistance": 100
} }

View File

@ -1,11 +1,11 @@
<view class="containerView public"> <view class="containerView public">
<van-tabs bind:click="tabClickSwitch" color="#4e96f8" border animated title-active-color="black" title-inactive-color="gray"> <van-tabs bind:click="tabClickSwitch" color="#4e96f8" border animated title-active-color="black" title-inactive-color="gray">
<van-tab title="重新派单"> <van-tab title="重新派单" wx:if="{{resendOrderVisible}}">
<view class="itemView" wx:for="{{3}}" wx:for-item="item" wx:key="*this" bind:tap="jumpAgain"> <view class="itemView" wx:for="{{resendOrderDataList}}" wx:for-item="item" wx:key="*this" bind:tap="jumpAgain">
<view class="topTitle">编号: T123123123</view> <view class="topTitle">编号: T123123123</view>
<view class="selfLine"></view> <view class="selfLine"></view>
<view class="centerView"> <view class="centerView">
<view class="showImg" style="background: no-repeat center/cover url({{IMG_NAME + '/profile/static/index/banner/1.jpg'}});"></view> <view class="showImg" style="background: no-repeat center/cover url({{IMG_NAME + item.visibleImg}});"></view>
<view class="rightView"> <view class="rightView">
<view class="labelName ellipsisFont">空调损坏</view> <view class="labelName ellipsisFont">空调损坏</view>
<view class="labelContent1 ellipsisFont">设备名称: 空调</view> <view class="labelContent1 ellipsisFont">设备名称: 空调</view>
@ -18,30 +18,37 @@
<view class="time">2024-01-01 12:12:00</view> <view class="time">2024-01-01 12:12:00</view>
</view> </view>
</view> </view>
<view class="loadAllLine" wx:if="{{reservationIsDataAll}}"> <view class="loadAllLine" wx:if="{{resendOrderIsDataAll}}">
<van-divider class="van-divider" customStyle="font-size: 26rpx;" contentPosition="center">数据已全部加载</van-divider> <van-divider class="van-divider" customStyle="font-size: 26rpx;" contentPosition="center">数据已全部加载</van-divider>
</view> </view>
</van-tab> </van-tab>
<van-tab title="待派单"> <van-tab title="待派单">
<view class="itemView" wx:for="{{1}}" wx:for-item="item" wx:key="*this" bind:tap="jumpDetail"> <view class="itemView" wx:for="{{pendingOrderDataList}}" wx:for-item="item" wx:key="*this" bind:tap="jumpDetail">
<view class="topTitle">编号: T123123123</view> <view class="topTitle">编号: T123123123</view>
<view class="selfLine"></view> <view class="selfLine"></view>
<view class="centerView"> <view class="centerView">
<view class="showImg" style="background: no-repeat center/cover url({{IMG_NAME + '/profile/static/index/banner/1.jpg'}});"></view> <view class="showImg" style="background: no-repeat center/cover url({{IMG_NAME + item.visibleImg}});"></view>
<view class="rightView"> <view class="rightView">
<view class="labelName ellipsisFont">空调损坏</view> <view class="labelName ellipsisFont">空调损坏</view>
<view class="labelContent1 ellipsisFont">设备名称: 空调</view> <view class="labelContent1 ellipsisFont">类型: 空调</view>
<view class="labelContent2 ellipsisFont">设备地址: 301南楼</view> <view class="labelContent2 ellipsisFont">地点: 301南楼</view>
<view class="labelContent2 ellipsisFont">楼层: 301南楼</view>
</view> </view>
</view> </view>
<view class="selfLine"></view> <view class="selfLine"></view>
<view class="bottomView"> <view class="bottomView">
<view class="name">王军18300011120</view> <view class="name">
<view class="time">2024-01-01 12:12:00</view> <van-icon name="manager-o" size="28rpx" color="#4e96f8"/>
王军18300011120
</view>
<view class="time">
<van-icon name="calendar-o" size="30rpx" color="#4e96f8"/>
2024-01-01 12:12:00
</view> </view>
</view> </view>
<view class="loadAllLine" wx:if="{{reservationIsDataAll}}"> </view>
<view class="loadAllLine" wx:if="{{pendingOrderIsDataAll}}">
<van-divider class="van-divider" customStyle="font-size: 26rpx;" contentPosition="center">数据已全部加载</van-divider> <van-divider class="van-divider" customStyle="font-size: 26rpx;" contentPosition="center">数据已全部加载</van-divider>
</view> </view>
</van-tab> </van-tab>

View File

@ -52,9 +52,9 @@
</view> </view>
</view> </view>
<view class="rowColumnView"> <view class="rowColumnView">
<view class="label">故障图片</view> <view class="label">故障图片/视频</view>
<view class="imgContentView"> <view class="imgContentView">
<van-uploader file-list="{{ fileList }}" upload-text="点击上传图片" bind:after-read="fileAfterRead" deletable="{{ true }}" bind:delete="deleteImg" max-count="6" accept="media" multiple/> <van-uploader file-list="{{ fileList }}" upload-text="点击上传" bind:after-read="fileAfterRead" deletable="{{ true }}" bind:delete="deleteImg" max-count="6" accept="media" multiple/>
</view> </view>
</view> </view>
</view> </view>

View File

@ -231,6 +231,16 @@ function getUrlParamsObj(url) {
return obj return obj
} }
// 判断是否是图片
function checkIsImg(url) {
if (!/\.(jpg|jpeg|png|GIF|JPG|PNG)$/.test(url)) {
return false;
} else {
return true;
}
}
module.exports = { module.exports = {
formatTime: formatTime, formatTime: formatTime,
formatDate: formatDate, formatDate: formatDate,
@ -247,5 +257,6 @@ module.exports = {
twoTimeInterval, twoTimeInterval,
twoTimeIntervalReturnHours, twoTimeIntervalReturnHours,
selfArrSum, selfArrSum,
getUrlParamsObj getUrlParamsObj,
checkIsImg
} }