@@ -137,6 +137,10 @@ let config = { | |||
* 预约确认 | |||
*/ | |||
appointConfirm: "/api/wxCouponOrderReservation/updateStatus", | |||
/** | |||
* 预约确认 | |||
*/ | |||
appointSetDate: "/api/wxCouponOrderReservation/update", | |||
/** | |||
* 获得openId | |||
*/ | |||
@@ -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) { | |||
@@ -12,8 +12,9 @@ | |||
</view> | |||
<view class="{{ currentID == 1 ? 'type active' : 'type' }}"> | |||
<view class="item" bindtap="setType" data-type="">全部</view> | |||
<view class="item" bindtap="setType" data-type="0">未确认</view> | |||
<view class="item" bindtap="setType" data-type="X">全部</view> | |||
<view class="item" bindtap="setType" data-type="Y">待确认</view> | |||
<view class="item" bindtap="setType" data-type="-1">未预约</view> | |||
<view class="item" bindtap="setType" data-type="5">已确认</view> | |||
<view class="item" bindtap="setType" data-type="8">已完成</view> | |||
</view> | |||
@@ -27,19 +28,20 @@ | |||
<view class="{{ currentID != 1 ? 'list active' : 'list' }}"> | |||
<view tt:if="{{ list.length > 0 }}" class="item" tt:for="{{ list }}"> | |||
<view class="head"> | |||
<view>订单编号:{{ item.couponOrderId }}</view> | |||
<view tt:if="{{ item.status == 0 }}" class="notice noAppoint">未确认</view> | |||
<view>券码:{{ item.couponOrderId }}</view> | |||
<view tt:if="{{ item.status == 0 }}" class="notice noAppoint">待确认</view> | |||
<view tt:if="{{ item.status == 1 }}" class="notice noAppoint">已取消</view> | |||
<view tt:if="{{ item.status == 3 }}" class="notice refund">已退款</view> | |||
<view tt:if="{{ item.status == 5 }}" class="notice confirm">已确认</view> | |||
<view tt:if="{{ item.status == '-1' }}" class="notice confirm">未预约</view> | |||
<view tt:if="{{ item.status == 8 }}" class="notice complete">已完成</view> | |||
<view tt:if="{{ item.status == 9 }}" class="notice complete">已评价</view> | |||
</view> | |||
<view class="body"> | |||
<view class="items">商品名称:{{ item.couponTitle }}</view> | |||
<view class="items">用户手机号码:{{ item.userPhone }}</view> | |||
<view class="items">服务预约时间:</view> | |||
<view class="items">{{ item.appointTime }}</view> | |||
<view class="items">服务预约时间:<text tt:if="{{ item.appointTime == '暂无' }}">暂无</text></view> | |||
<view tt:if="{{ item.appointTime != '暂无' }}" class="items">{{ item.appointTime }}</view> | |||
</view> | |||
<view class="footer"> | |||
<button type="primary" bindtap="goDetail" data-id="{{ item.id }}">详情</button> | |||
@@ -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; | |||
} | |||
@@ -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" | |||
}); | |||
}) | |||
} | |||
}) |
@@ -1,20 +1,54 @@ | |||
<!-- c:\Users\Holy-Knight-IX\Desktop\Working Space\4.TikTok-MiniPro\ttb\pages\appointDetail\appointDetail.ttml --> | |||
<view> | |||
<view class="card"> | |||
<view class="item">订单编号:{{ detail.couponOrderId }}</view> | |||
<view class="item">券码:{{ detail.couponOrderId }}</view> | |||
<view class="item">商品名称:{{ detail.couponTitle }}</view> | |||
<view class="item">服务预约时间:{{ detail.appointTime }}</view> | |||
<view class="item">服务预约时间:{{ detail.appointTime }}<span | |||
tt:if="{{ detail.status == 0 || detail.status == 5 || detail.status == '-1' }}" class="edit" | |||
bindtap="setDate">修改</span></view> | |||
<view class="item">服务预约地址:<text class="lineHeight">{{ detail.userAddress }}</text></view> | |||
<view class="item">服务详细地址:<text class="lineHeight">{{ detail.detailedAddress }}</text></view> | |||
<view class="item">服务详细地址:<text class="lineHeight">{{ detail.detailedAddress }}</text><span | |||
tt:if="{{ detail.status == 0 || detail.status == 5 || detail.status == '-1' }}" class="edit" | |||
bindtap="setAddress">修改</span></view> | |||
<view class="item">用户手机号码:{{ detail.userPhone }}</view> | |||
<view class="item">备注:{{ detail.describeStr }}</view> | |||
</view> | |||
<view class="btns"> | |||
<button class="back" bindtap="back">返回</button> | |||
<view tt:if="{{ isSetTime }}"> | |||
<view class="datePickerFlex"> | |||
<picker mode="date" start="{{ startTime }}" end="{{ endTime }}" disabled="{{ !isShowBtns }}" | |||
bindchange='chooseDate'>选择服务日期:</picker> | |||
<picker mode="date" start="{{ startTime }}" end="{{ endTime }}" disabled="{{ !isShowBtns }}" | |||
bindchange='chooseDate' class="address"> | |||
{{ pickedDate }}</picker> | |||
</view> | |||
<view class="datePickerFlex"> | |||
<picker mode="time" disabled="{{ !isShowBtns }}" bindchange='chooseTime'>预计上门时间:</picker> | |||
<picker mode="time" disabled="{{ !isShowBtns }}" bindchange='chooseStartTime' class="address">{{ | |||
pickedStartTime | |||
}}</picker> | |||
- | |||
<picker mode="time" start="{{ pickedStartTime }}" disabled="{{ !isShowBtns }}" bindchange='chooseEndTime' | |||
class="address">{{ pickedEndTime }} | |||
</picker> | |||
</view> | |||
</view> | |||
<view tt:if="{{ isSetAddress }}"> | |||
<textarea class="detailedAddress" placeholder="请输入服务详细地址" bindinput="settingAddress" | |||
value="{{ detail.detailedAddress }}"></textarea> | |||
</view> | |||
<view class="{{ (isSetTime || isSetAddress) ? 'btns' : 'btns active' }}"> | |||
<block tt:if="{{ detail.status != 8 }}"> | |||
<button tt:if="{{ isSetTime }}" class="confirm" bindtap="confirmDate">确定预约时间</button> | |||
<button tt:if="{{ isSetAddress }}" class="confirm" bindtap="confirmAddress">确定详细地址</button> | |||
<button tt:if="{{ detail.status == 0 }}" class="confirm" bindtap="confirm">确认预约</button> | |||
<!-- <button tt:if="{{ detail.status == 0 }}" class="confirm" bindtap="confirm">修改预约时间</button> --> | |||
<button tt:if="{{ detail.status == 5 }}" class="confirm" bindtap="cancel">取消预约</button> | |||
<button tt:if="{{ detail.status == 5 }}" class="confirm" bindtap="cancel">取消确认</button> | |||
</block> | |||
</view> | |||
</view> |
@@ -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; | |||
} |