diff --git a/miniprogram/app.js b/miniprogram/app.js index 46f1e55..db7160e 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -5,7 +5,6 @@ App({ tenantId : '12', // 地区 parkId : '26', // 园区id parkName : '长阳智会云控', // 园区名称 - ownership : 'Copyrights@2019淮安市行政中心报修版权所有', // 本地测试 // DOMAIN_NAME_PREFIX: 'http://192.168.0.11', // DOMAIN_NAME: 'http://192.168.0.11:9227', //接口域名 diff --git a/miniprogram/app.json b/miniprogram/app.json index 7f40305..4629ef0 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -73,8 +73,9 @@ "pages/meeting/reservationRecord/exhibitionRecord/list/list", "pages/meeting/reservationRecord/exhibitionRecord/detail/detail", "pages/meeting/meetingRoom/meetingService/meetingService", - "pages/reportRepair/reportRepair", - "pages/reportRepair/repairAdd/repairAdd" + "pages/reportRepair/repairIndex/index", + "pages/reportRepair/repairAdd/add", + "pages/reportRepair/repairRecord/reportPerson/record" ], "window": { "backgroundTextStyle": "light", diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js index 5e519a2..caf162c 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -111,7 +111,7 @@ Page({ { name: "随手拍", img: "/profile/static/index/menu-bxfw.png", - path: "/pages/reportRepair/reportRepair" + path: "/pages/reportRepair/repairIndex/index" }, // { // name: "展厅预约", diff --git a/miniprogram/pages/reportRepair/repairAdd/repairAdd.js b/miniprogram/pages/reportRepair/repairAdd/add.js similarity index 100% rename from miniprogram/pages/reportRepair/repairAdd/repairAdd.js rename to miniprogram/pages/reportRepair/repairAdd/add.js diff --git a/miniprogram/pages/reportRepair/repairAdd/repairAdd.json b/miniprogram/pages/reportRepair/repairAdd/add.json similarity index 100% rename from miniprogram/pages/reportRepair/repairAdd/repairAdd.json rename to miniprogram/pages/reportRepair/repairAdd/add.json diff --git a/miniprogram/pages/reportRepair/repairAdd/repairAdd.wxml b/miniprogram/pages/reportRepair/repairAdd/add.wxml similarity index 100% rename from miniprogram/pages/reportRepair/repairAdd/repairAdd.wxml rename to miniprogram/pages/reportRepair/repairAdd/add.wxml diff --git a/miniprogram/pages/reportRepair/repairAdd/repairAdd.wxss b/miniprogram/pages/reportRepair/repairAdd/add.wxss similarity index 100% rename from miniprogram/pages/reportRepair/repairAdd/repairAdd.wxss rename to miniprogram/pages/reportRepair/repairAdd/add.wxss diff --git a/miniprogram/pages/reportRepair/reportRepair.js b/miniprogram/pages/reportRepair/repairIndex/index.js similarity index 91% rename from miniprogram/pages/reportRepair/reportRepair.js rename to miniprogram/pages/reportRepair/repairIndex/index.js index 617928a..656ec41 100644 --- a/miniprogram/pages/reportRepair/reportRepair.js +++ b/miniprogram/pages/reportRepair/repairIndex/index.js @@ -7,15 +7,14 @@ Page({ */ data: { IMG_NAME: app.IMG_NAME, - ownership: app.ownership, menuList: [{ name: "我要报修", img: "/profile/static/index/menu-bxfw.png", - path: "/pages/reportRepair/repairAdd/repairAdd" + path: "/pages/reportRepair/repairAdd/add" }, { name: "报修查询", img: "/profile/static/index/menu-ztyy.png", - path: "/pages/reportRepair/reportRepair" + path: "/pages/reportRepair/repairRecord/reportPerson/record" }, { name: "维修入口", img: "/profile/static/index/menu-bxfw.png", diff --git a/miniprogram/pages/reportRepair/reportRepair.json b/miniprogram/pages/reportRepair/repairIndex/index.json similarity index 100% rename from miniprogram/pages/reportRepair/reportRepair.json rename to miniprogram/pages/reportRepair/repairIndex/index.json diff --git a/miniprogram/pages/reportRepair/reportRepair.wxml b/miniprogram/pages/reportRepair/repairIndex/index.wxml similarity index 93% rename from miniprogram/pages/reportRepair/reportRepair.wxml rename to miniprogram/pages/reportRepair/repairIndex/index.wxml index 142c627..2cd1421 100644 --- a/miniprogram/pages/reportRepair/reportRepair.wxml +++ b/miniprogram/pages/reportRepair/repairIndex/index.wxml @@ -20,6 +20,6 @@ - {{ownership}} + \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/reportRepair.wxss b/miniprogram/pages/reportRepair/repairIndex/index.wxss similarity index 100% rename from miniprogram/pages/reportRepair/reportRepair.wxss rename to miniprogram/pages/reportRepair/repairIndex/index.wxss diff --git a/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.js b/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.js new file mode 100644 index 0000000..714c019 --- /dev/null +++ b/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.js @@ -0,0 +1,419 @@ +const app = getApp() + +import Dialog from '@vant/weapp/dialog/dialog'; +import Notify from '@vant/weapp/notify/notify'; + +import { + selfFormatTimeYMD, + selfFormatTimeHM +} from "../../../../utils/util.js" + +import { + selectReservationListByUserIdRq, + selectVisitorInvitationRecordRq, + cancelOrderRq +} from "../../../../api/meeting/meetingRoom.js" + +Page({ + + /** + * 页面的初始数据 + */ + data: { + IMG_NAME: app.IMG_NAME, + userData: null, + dataChange: false, + tabTitle: '预约记录', + // 预约记录参数 + reservationPageNum: 1, + reservationPageSize: 10, + reservationDataList: [], + reservationIsDataAll: false, + // 参与记录参数 + participatePageNum: 1, + participatePageSize: 10, + participateDataList: [], + participateIsDataAll: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let _this = this; + _this.setData({ + userData: wx.getStorageSync('user'), + }) + // 获取数据 + 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 + }) + }, + + // 获取数据 + getDataList() { + // 获取参数 + let _this = this; + let tabTitle = _this.data.tabTitle + 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 + + } else if (tabTitle == '预约记录') { + // 参与记录参数 + isDataAll = _this.data.participateIsDataAll + pageNum = _this.data.participatePageNum + pageSize = _this.data.participatePageSize + } else { + wx.showToast({ + title: `tab 切换错误(${tabTitle})`, + icon: 'none', + }); + return; + } + + // 判断数据是否已全部加载 + if (isDataAll) { + return; + } + // 传递参数 + 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 + }) + } + }) + }, + + // 获取参与数据 + 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"; + } + // + // 赋值 + 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 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 点击切换 + tabClickSwitch(event) { + console.log('tabClickSwitch', event); + let _this = this; + _this.setData({ + tabTitle: event.detail.title + }) + }, + + // 取消订单 + 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, + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + 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 + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + console.log('onPullDownRefresh', '页面相关事件处理函数--监听用户下拉动作'); + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + console.log('onReachBottom', '页面上拉触底事件的处理函数'); + let _this = this; + // 获取数据 + _this.getDataList() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage(e) { + console.log('onShareAppMessage', e); + let _this = this; + let id = e.target.dataset.id; + let detail = _this.data.reservationDataList.find(item => item.id == id) + // + let param = { + title: detail.title, + path: "/pages/meeting/invite/invite?id=" + id, + imageUrl: app.IMG_NAME + detail.roomContent.indoorPicUrlFirst, + } + console.log('onShareAppMessage', param); + return param; + } +}) \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.json b/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.json new file mode 100644 index 0000000..073ffc5 --- /dev/null +++ b/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.json @@ -0,0 +1,11 @@ +{ + "navigationBarTitleText": "报修记录", + "usingComponents": { + "van-tab": "@vant/weapp/tab/index", + "van-tabs": "@vant/weapp/tabs/index", + "van-divider": "@vant/weapp/divider/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-notify": "@vant/weapp/notify/index" + }, + "onReachBottomDistance": 100 +} \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.wxml b/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.wxml new file mode 100644 index 0000000..1ec6343 --- /dev/null +++ b/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.wxml @@ -0,0 +1,70 @@ + + + + + + {{item.title}} + {{item.statusName}} + + + + + {{item.roomContent.capacityNum}}人间 | {{item.roomContent.roomName}} | {{item.roomContent.buildingName}} + 预约人: {{item.createBy}} + {{item.timeSlot}} + + + + 取消原因: {{item.cancelResaon}} + + + + + 去邀请 + + + 取消预约 + 查看详情 + + + + 数据已全部加载 + + + + + + + {{item.title}} + {{item.statusName}} + + + + + {{item.roomContent.capacityNum}}人间 | {{item.roomContent.roomName}} | {{item.roomContent.buildingName}} + 预约人: {{item.createBy}} + {{item.timeSlot}} + + + + + 数据已全部加载 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.wxss b/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.wxss new file mode 100644 index 0000000..5e9f80e --- /dev/null +++ b/miniprogram/pages/reportRepair/repairRecord/reportPerson/record.wxss @@ -0,0 +1,136 @@ +.containerView.public { + background: none; + height: auto; +} + +.itemView { + background: white; + margin: 30rpx 20rpx; + padding: 30rpx 20rpx; + /* box-shadow: rgba(210,210,210,0.5) 0px 3.752px 3.752px 0px; */ +} + +.itemView .headView { + display: flex; + justify-content: space-between; + align-items: center; +} + +.itemView .headView .number { + flex: 1; + margin-right: 30rpx; + font-size: 26rpx; + + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + white-space: nowrap; +} + +.itemView .headView .status { + font-size: 26rpx; + color: #4e96f8; + margin-right: 20rpx; +} + +.itemView .contentView { + box-sizing: border-box; + border-radius: 10rpx; + width: 100%; + margin-top: 20rpx; + padding: 30rpx 20rpx; + display: flex; + justify-content: flex-start; + align-items: center; + background: #f2f2f2; +} + +.itemView .contentView .img { + border-radius: 10rpx; + width: 200rpx; + height: 110rpx; +} + +.itemView .contentView .msgView { + flex: 1; + margin-left: 20rpx; + word-break: break-all; +} + +.itemView .contentView .msgView .title { + font-size: 28rpx; +} + +.itemView .contentView .msgView .name, +.itemView .contentView .msgView .time { + font-size: 24rpx; + color: gray; + margin-top: 6rpx; +} + +.itemView .priceView { + display: flex; + justify-content: flex-end; + align-items: center; + margin: 30rpx 0; +} + +.itemView .priceView .cancelContent { + flex: 1; + margin-right: 40rpx; + font-size: 26rpx; + color: #7F7F7F; + + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + white-space: nowrap; +} + +.itemView .priceView .priceContent { + display: flex; + justify-content: flex-start; + align-items: center; +} + +.itemView .priceView .priceContent .name { + font-size: 26rpx; +} + +.itemView .priceView .priceContent .price { + font-size: 28rpx; + font-weight: bold; + color: red; + margin-left: 10rpx; +} + +.itemView .btnView { + display: flex; + justify-content: flex-end; + align-items: center; + +} + +.itemView .btnView .btn { + border: 1px solid #4e96f8; + position: relative; + border-radius: 10rpx; + margin-left: 16rpx; + padding: 10rpx 24rpx; + font-size: 24rpx; + color: #4e96f8; +} + +.shareBtn { + position: absolute; + z-index: 1; + width: 100%; + height: 100%; + left: 0; + top: 0; + opacity: 0; +} + +.loadAllLine { + margin-top: 80rpx; +} \ No newline at end of file