diff --git a/config/config.js b/config/config.js index 08aa8dc..44164cd 100644 --- a/config/config.js +++ b/config/config.js @@ -137,6 +137,10 @@ let config = { * 预约确认 */ appointConfirm: "/api/wxCouponOrderReservation/updateStatus", + /** + * 预约确认 + */ + appointSetDate: "/api/wxCouponOrderReservation/update", /** * 获得openId */ diff --git a/pages/Appointment/appointment.js b/pages/Appointment/appointment.js index a6247c0..4e4abb2 100644 --- a/pages/Appointment/appointment.js +++ b/pages/Appointment/appointment.js @@ -23,7 +23,7 @@ Page({ const that = this const data = { pageNum: this.data.pageNum, - pageSize: 20, + pageSize: 200, } if (startTime && endTime) { @@ -31,7 +31,7 @@ Page({ data.serchEndDate = endTime } - if (status) { + if (status || status === 0) { data.status = status } @@ -44,7 +44,12 @@ Page({ res.data.list.forEach(item => { const appointStart = util.timestampToTime(item.startDate, 'YYYY-MM-DD hh:mm:ss') const appointEnd = util.timestampToTime(item.endDate, 'hh:mm:ss') - item.appointTime = appointStart + ' - ' + appointEnd + if (item.startDate && item.endDate) { + item.appointTime = appointStart + ' - ' + appointEnd + } else { + item.appointTime = "暂无"; + } + }) that.setData({ list: res.data.list, @@ -64,11 +69,21 @@ Page({ }, setType(e) { - const type = e.currentTarget.dataset.type * 1 + const type = e.currentTarget.dataset.type + this.setData({ currentID: '', }) - this.getList(type) + + if (type === 'X') { + this.getList(false) + } else if (type === 'Y') { + this.getList(0) + } else { + this.getList(type * 1) + } + + }, setStartTime(e) { diff --git a/pages/Appointment/appointment.ttml b/pages/Appointment/appointment.ttml index 683eff5..979bc28 100644 --- a/pages/Appointment/appointment.ttml +++ b/pages/Appointment/appointment.ttml @@ -12,8 +12,9 @@ - 全部 - 未确认 + 全部 + 待确认 + 未预约 已确认 已完成 @@ -27,19 +28,20 @@ - 订单编号:{{ item.couponOrderId }} - 未确认 + 券码:{{ item.couponOrderId }} + 待确认 已取消 已退款 已确认 + 未预约 已完成 已评价 商品名称:{{ item.couponTitle }} 用户手机号码:{{ item.userPhone }} - 服务预约时间: - {{ item.appointTime }} + 服务预约时间:暂无 + {{ item.appointTime }} diff --git a/pages/Appointment/appointment.ttss b/pages/Appointment/appointment.ttss index 49b506b..1b2e582 100644 --- a/pages/Appointment/appointment.ttss +++ b/pages/Appointment/appointment.ttss @@ -54,13 +54,14 @@ .pickedTime { position: relative; - bottom: 480rpx; + bottom: 590rpx; text-align: center; } .pickedTime .picker { display: inline-block; background-color: #529ffd86; + font-size: 30rpx; padding: 10rpx; border-radius: 10rpx; color: #ffffff; @@ -70,14 +71,14 @@ display: inline-block; width: 120rpx; height: 60rpx; - line-height: 60rpx; + line-height: 50rpx; padding: 5rpx; margin-left: 40rpx; } .list { position: relative; - bottom: 480rpx; + bottom: 590rpx; margin-top: 20rpx; z-index: -1; } diff --git a/pages/appointDetail/appointDetail.js b/pages/appointDetail/appointDetail.js index 0fee461..c35b821 100644 --- a/pages/appointDetail/appointDetail.js +++ b/pages/appointDetail/appointDetail.js @@ -8,7 +8,15 @@ var app = getApp() Page({ data: { id: "", - detail: null + detail: null, + isShowBtns: true, + isSetTime: false, + isSetAddress: false, + pickedDate: "请选择日期", + pickedStartTime: "请选择", + pickedEndTime: "请选择", + startTime: "", + endTime: "" }, onLoad(options) { @@ -34,9 +42,17 @@ Page({ console.log(res, 'res'); const appointStart = util.timestampToTime(res.data.startDate, 'YYYY-MM-DD hh:mm:ss') const appointEnd = util.timestampToTime(res.data.endDate, 'hh:mm:ss') - res.data.appointTime = appointStart + ' - ' + appointEnd + + if (res.data.startDate && res.data.endDate) { + res.data.appointTime = appointStart + ' - ' + appointEnd + } else { + res.data.appointTime = "暂无"; + } that.setData({ - detail: res.data + detail: res.data, + pickedDate: util.timestampToTime(res.data.startDate, 'YYYY-MM-DD') || '请选择日期', + pickedStartTime: util.timestampToTime(res.data.startDate, 'hh:mm') || '请选择', + pickedEndTime: util.timestampToTime(res.data.endDate, 'hh:mm') || '请选择', }) }).catch(err => { console.log(err, 'err'); @@ -47,11 +63,32 @@ Page({ tt.navigateBack(); }, + chooseDate(e) { + console.log(e.detail.value, 'e'); + this.setData({ + pickedDate: e.detail.value + }) + }, + + chooseStartTime(e) { + console.log(e.detail.value, 'e'); + this.setData({ + pickedStartTime: e.detail.value + }) + }, + + chooseEndTime(e) { + console.log(e.detail.value, 'e'); + this.setData({ + pickedEndTime: e.detail.value + }) + }, + cancel() { const that = this tt.showModal({ title: "提示", - content: "是否与用户取得联系并取消预约?", + content: "是否与用户取得联系并取消确认?", showCancel: true, confirmText: "确认取消", confirmColor: "#52a0fd", @@ -87,6 +124,87 @@ Page({ }); }, + setDate() { + const isSetTime = !this.data.isSetTime + this.setData({ + isSetTime, + isSetAddress: false + }) + }, + + confirmDate() { + const isSetTime = !this.data.isSetTime + this.setData({ + isSetTime, + isSetAddress: false + }) + if (!isSetTime) { + const tempData = this.data + + if (tempData.pickedDate == '请选择日期') { + tt.showToast({ + title: '请请选择日期!', + icon: 'fail' + }); + return + } + + if (tempData.pickedStartTime == '请选择') { + tt.showToast({ + title: '请起始时间!', + icon: 'fail' + }); + return + } + + if (tempData.pickedEndTime == '请选择') { + tt.showToast({ + title: '请结束时间!', + icon: 'fail' + }); + return + } + const data = { + id: this.data.detail.id, + couponOrderId: this.data.detail.couponOrderId, + startDate: tempData.pickedDate + " " + tempData.pickedStartTime + ":00", + endDate: tempData.pickedDate + " " + tempData.pickedEndTime + ":00" + } + this.goSetDate(data) + console.log(data, 'data'); + } + }, + + setAddress() { + const isSetAddress = !this.data.isSetAddress + this.setData({ + isSetAddress, + isSetTime: false + }) + }, + + settingAddress(e) { + const detail = this.data.detail + detail.detailedAddress = e.detail.value + this.setData({ + detail + }) + }, + + confirmAddress() { + const isSetAddress = !this.data.isSetAddress + this.setData({ + isSetAddress, + isSetTime: false + }) + const data = { + id: this.data.detail.id, + couponOrderId: this.data.detail.couponOrderId, + detailedAddress: this.data.detail.detailedAddress, + } + this.goSetDate(data) + }, + goChange(id, status) { const data = { id, @@ -113,5 +231,28 @@ Page({ icon: "none" }); }) + }, + + goSetDate(data) { + const that = this + HttpBasics.post({ + url: config.api.appointSetDate, + data + }) + .then(res => { + console.log(res, 'res'); + tt.showToast({ + title: '修改成功!', + icon: "success", + duration: 2000 + }); + that.getDetail(that.data.id) + }).catch(err => { + console.log(err, 'err'); + tt.showToast({ + title: err.message, + icon: "none" + }); + }) } }) \ No newline at end of file diff --git a/pages/appointDetail/appointDetail.ttml b/pages/appointDetail/appointDetail.ttml index 0d67067..4381a14 100644 --- a/pages/appointDetail/appointDetail.ttml +++ b/pages/appointDetail/appointDetail.ttml @@ -1,20 +1,54 @@ - 订单编号:{{ detail.couponOrderId }} + 券码:{{ detail.couponOrderId }} 商品名称:{{ detail.couponTitle }} - 服务预约时间:{{ detail.appointTime }} + 服务预约时间:{{ detail.appointTime }}修改 服务预约地址:{{ detail.userAddress }} - 服务详细地址:{{ detail.detailedAddress }} + 服务详细地址:{{ detail.detailedAddress }}修改 用户手机号码:{{ detail.userPhone }} 备注:{{ detail.describeStr }} - - + + + + 选择服务日期: + + {{ pickedDate }} + + + + 预计上门时间: + {{ + pickedStartTime + }} + - + {{ pickedEndTime }} + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/pages/appointDetail/appointDetail.ttss b/pages/appointDetail/appointDetail.ttss index b261fab..796a30e 100644 --- a/pages/appointDetail/appointDetail.ttss +++ b/pages/appointDetail/appointDetail.ttss @@ -17,13 +17,17 @@ } .btns { - position: fixed; width: 95%; - left: 50%; - bottom: 130rpx; - transform: translateX(-50%); padding: 0 80rpx; box-sizing: border-box; + margin: auto; +} + +.btns.active { + position: absolute; + left: 50%; + bottom: 110rpx; + transform: translateX(-50%); } .btns .back { @@ -33,4 +37,42 @@ .btns .confirm { color: #ffffff; background-color: #52a0fd; + margin-top: 40rpx; +} + +.datePickerFlex { + display: flex; + justify-content: space-between; + width: 85%; + background-color: #f4f5f6; + border-radius: 20rpx; + padding: 30rpx; + margin: 35rpx auto; +} + +.address { + color: #8a8a8a; +} + +.edit { + display: inline-block; + width: 70rpx; + height: 40rpx; + line-height: 40rpx; + font-size: 30rpx; + color: #ffffff; + text-align: center; + background-color: #c85963; + border-radius: 10rpx; + padding: 2rpx 5rpx; + margin-left: 20rpx; +} + +.detailedAddress { + width: 95%; + padding: 20rpx; + border-radius: 15rpx; + box-sizing: border-box; + border: 1px solid #00000063; + margin: 0 auto; } \ No newline at end of file