Commit a198237c by zhangzhen

细节优化

parent 8bc4e6ca
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</view> </view>
<view class="flex-col data-content-box"> <view class="flex-col data-content-box">
<view v-show="orderType==1" class="flex-col package-mode"> <view class="flex-col package-mode">
<view class="part-1"> <view class="part-1">
<text class="text-title text-lg text-bold">套餐选择:</text> <text class="text-title text-lg text-bold">套餐选择:</text>
</view> </view>
...@@ -78,11 +78,11 @@ ...@@ -78,11 +78,11 @@
<view v-for="(item,index) in roomLabelList" :key="index" class="room-label-box" <view v-for="(item,index) in roomLabelList" :key="index" class="room-label-box"
@tap="onChangePackage(index)"> @tap="onChangePackage(index)">
<view class="item" :class="{active: modeIndex===index}"> <view class="item" :class="{active: modeIndex===index}">
<text>{{item.labelDuration}}小时</text> <text>{{item.labelName}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="flex-col package-list"> <view v-if="orderType ==1" class="flex-col package-list">
<view v-for="(item,index) in packageMode" :key="index" class="package-list-box" <view v-for="(item,index) in packageMode" :key="index" class="package-list-box"
@tap="onChangePackage2(index)"> @tap="onChangePackage2(index)">
...@@ -95,8 +95,7 @@ ...@@ -95,8 +95,7 @@
</view> </view>
<!-- <view v-if="orderType ===1 && !roomLabelList.length && !packageMode.length"
<view v-if="orderType ===1 && !roomLabelList.length && !packageMode.length"
class="flex-col distance-mode"> class="flex-col distance-mode">
<view class="distance-title"> <view class="distance-title">
<text class="text-title text-lg text-bold">时长选择:</text> <text class="text-title text-lg text-bold">时长选择:</text>
...@@ -110,10 +109,10 @@ ...@@ -110,10 +109,10 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view> -->
</view> </view>
<view v-if="orderType ===2" class="flex-col distance-mode" style="margin: 40upx 20upx 40upx;"> <!-- <view v-if="orderType ===2" class="flex-col distance-mode" style="margin: 40upx 20upx 40upx;">
<view class="distance-title"> <view class="distance-title">
<text class="text-title text-lg text-bold">时长选择:</text> <text class="text-title text-lg text-bold">时长选择:</text>
</view> </view>
...@@ -125,7 +124,7 @@ ...@@ -125,7 +124,7 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view> -->
<view class="flex-col date-mode"> <view class="flex-col date-mode">
<view class="flex-row date-box"> <view class="flex-row date-box">
...@@ -242,10 +241,10 @@ ...@@ -242,10 +241,10 @@
</view> </view>
<uni-popup ref="popup" type="bottom"> <uni-popup ref="popup" type="bottom">
<view class="flex-col"> <view class="flex-col select-datetime-box">
<view class="cu-bar bg-white"> <view class="cu-bar bg-white">
<view class="action text-gray" @tap="onHideModal">取消</view> <view class="action text-lg text-gray" @tap="onHideModal">取消</view>
<view class="action text-pink" @tap="onSelectedDate">确定</view> <view class="action text-lg text-pink" @tap="onSelectedDate">确定</view>
</view> </view>
<view class="select-box"> <view class="select-box">
<picker-view class="picker-view" indicator-style="height: 42px;" :immediate-change="true" <picker-view class="picker-view" indicator-style="height: 42px;" :immediate-change="true"
...@@ -346,7 +345,7 @@ ...@@ -346,7 +345,7 @@
您选的预定时间已有被占用,请选择其他空闲时段 您选的预定时间已有被占用,请选择其他空闲时段
</text> </text>
</view> </view>
<view class="button-box"> <view class="button-box" @tap="onCancleTip">
<text>好的</text> <text>好的</text>
</view> </view>
</view> </view>
...@@ -400,7 +399,7 @@ ...@@ -400,7 +399,7 @@
index: 0, //订单模式标记 index: 0, //订单模式标记
orderTypeList: [{ orderTypeList: [{
label: "房间预定", label: "房间预定",
type: 1 type: 0
}], }],
// 时长选择 // 时长选择
distanceIndex: 0, distanceIndex: 0,
...@@ -453,7 +452,7 @@ ...@@ -453,7 +452,7 @@
], ],
durationIndex2: [0], durationIndex2: [0],
hourList2: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], hourList2: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
minuteList: ['00', "30"], minuteList: ['00', "05", "10", "15", "20", "25",'30', "35", "40", "45", "50", "55"],
orderTypeEnum: { orderTypeEnum: {
1: "预定", 1: "预定",
2: "续费", 2: "续费",
...@@ -492,7 +491,8 @@ ...@@ -492,7 +491,8 @@
}, },
formatAllData:{ formatAllData:{
list:[] list:[]
} },
orderInfo:{}
}; };
}, },
filters: { filters: {
...@@ -536,9 +536,10 @@ ...@@ -536,9 +536,10 @@
} }
}, },
methods: { methods: {
// 日期切换 // 日期切换
onDateChange(k) { onDateChange(k) {
if (this.dateIndex === k) return; if (this.dateIndex === k || this.orderType ==2) return;
this.dateIndex = k; this.dateIndex = k;
if(this.modeIndex<0){ if(this.modeIndex<0){
this.modeIndex = 0; this.modeIndex = 0;
...@@ -559,6 +560,7 @@ ...@@ -559,6 +560,7 @@
startDateTime, startDateTime,
duration: this.roomLabelList[this.modeIndex].labelDuration, duration: this.roomLabelList[this.modeIndex].labelDuration,
}); });
console.log(this.formatAllData,"this.formatAllData")
}, },
// 套餐切换 // 套餐切换
onChangePackage2(index){ onChangePackage2(index){
...@@ -643,6 +645,16 @@ ...@@ -643,6 +645,16 @@
}) })
} }
}, },
onGetOrderInfo() {
getOrderInfoByNo(this.preOrderNo).then(res => {
console.log(res, "订单信息")
if (res.data.code == 200) {
this.orderInfo = res.data.data;
this.id = this.orderInfo.roomId;
this.onLoading();
}
})
},
// 获取房间信息相关 // 获取房间信息相关
onLoading() { onLoading() {
roomInfo({ roomInfo({
...@@ -663,33 +675,15 @@ ...@@ -663,33 +675,15 @@
if (this.roomInfo.packList && this.roomInfo.packList.length) { if (this.roomInfo.packList && this.roomInfo.packList.length) {
this.packageMode = this.roomInfo.packList this.packageMode = this.roomInfo.packList
this.modeIndex = 0; this.modeIndex = 0;
} else {
this.orderTypeList = this.orderTypeList.filter(item => item.type == 1)
} }
if (this.roomInfo.roomLabelList && this.roomInfo.roomLabelList.length) { if (this.roomInfo.roomLabelList && this.roomInfo.roomLabelList.length) {
let typeNum = this.orderType == 1 ? 0 : 1; this.roomLabelList = this.roomInfo.roomLabelList
this.roomLabelList = this.roomInfo.roomLabelList.filter(item => item.labelType ==
typeNum);
} }
this.onGetSortDistance() this.onGetSortDistance()
} }
}) })
}, },
onGetOrderInfo() {
getOrderInfoByNo(this.preOrderNo).then(res => {
console.log(res, "订单信息")
if (res.data.code == 200) {
let endDate = res.data.data.endDate || res.data.data.preEndDate;
if (res.data.data.status == 2) {
endDate = moment().format('YYYY-MM-DD HH:mm')
}
this.startTime = moment(endDate).format("HH:mm");
let date = moment(endDate).format("YYYY-MM-DD")
this.dateIndex = this.dateList.findIndex(item => item.readDate === date)
this.onLoading()
}
})
},
//获取时间段是否被占用 //获取时间段是否被占用
onGetSortDistance() { onGetSortDistance() {
listSortDistance({ listSortDistance({
...@@ -707,10 +701,11 @@ ...@@ -707,10 +701,11 @@
} }
}) })
this.formatAllData = this.onTransiteForDate({ this.formatAllData = this.onTransiteForDate({
startDateTime:this.orderType ==2 && this.orderInfo.status == 1? this.orderInfo.endDate : '' ,
list: JSON.parse(JSON.stringify(this.dateIntervalList)), list: JSON.parse(JSON.stringify(this.dateIntervalList)),
duration: this.orderType ==1 ? this.roomLabelList[this.modeIndex].labelDuration : null, duration: this.roomLabelList[this.modeIndex].labelDuration
}); });
console.log(this.formatAllData, "transiteForDate") console.log(this.formatAllData, "transiteForDate2222")
}) })
}, },
// 获取可用优惠券 // 获取可用优惠券
...@@ -718,13 +713,12 @@ ...@@ -718,13 +713,12 @@
getUseCoupon({ getUseCoupon({
storeId: this.roomInfo.storeId, storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id, roomId: this.roomInfo.id,
orderMode: this.orderTypeList[this.index].type,
preStartDate: p != null ? p.startDateTime : this.formatAllData.startDateTime, preStartDate: p != null ? p.startDateTime : this.formatAllData.startDateTime,
preEndDate: p != null ? p.endDateTime : this.formatAllData.endDateTime, preEndDate: p != null ? p.endDateTime : this.formatAllData.endDateTime,
orderType: this.orderType, orderType: this.orderType,
packageId: this.modeIndex2 >= 0 ? this.packageMode[this.modeIndex2].id : '', orderMode: this.modeIndex2 >= 0 || (this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1)? 1 : 0,
packageId: this.modeIndex2 >= 0 ? this.packageMode[this.modeIndex2].id : this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1? this.roomLabelList[this.modeIndex].packId : '',
roomLabelId: this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '' roomLabelId: this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : ''
}).then(res => { }).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data && res.data.data.length) { if (res.data && res.data.data.length) {
...@@ -773,17 +767,15 @@ ...@@ -773,17 +767,15 @@
}, },
success(res) { success(res) {
res.eventChannel.emit('sendData', { res.eventChannel.emit('sendData', {
orderType: that.orderType,
storeId: that.roomInfo.storeId, storeId: that.roomInfo.storeId,
roomId: that.roomInfo.id, roomId: that.roomInfo.id,
orderMode: that.orderTypeList[that.index].type, orderMode: that.modeIndex2 >= 0 || (that.modeIndex>=0 && that.roomLabelList.length && that.roomLabelList[that.modeIndex].openPack==1)? 1 : 0,
preStartDate: that.dateObj.startDate, preStartDate: that.formatAllData.startDateTime,
orderType: that.orderType, preEndDate: that.formatAllData.endDateTime,
packageId: that.packageMode.length ? that.packageMode[that.modeIndex].id : packageId: that.modeIndex2 >= 0 ? that.packageMode[that.modeIndex2].id : that.modeIndex>=0 && that.roomLabelList.length && that.roomLabelList[that.modeIndex].openPack==1? that.roomLabelList[that.modeIndex].packId : '',
'', roomLabelId: that.modeIndex >= 0 ? that.roomLabelList[that.modeIndex].id : '',
preEndDate: that.dateObj.endDate, selectId: that.selectCouponIndex >= 0 && that.useCouponList.length ? that.useCouponList[that.selectCouponIndex].id : ''
selectId: that.selectCouponIndex >= 0 && that.useCouponList.length ? that
.useCouponList[that
.selectCouponIndex].id : ''
}) })
} }
}) })
...@@ -802,8 +794,8 @@ ...@@ -802,8 +794,8 @@
orderType: this.orderType, orderType: this.orderType,
preStartDate: p != null ? p.startDateTime : this.formatAllData.startDateTime, preStartDate: p != null ? p.startDateTime : this.formatAllData.startDateTime,
preEndDate: p != null ? p.endDateTime : this.formatAllData.endDateTime, preEndDate: p != null ? p.endDateTime : this.formatAllData.endDateTime,
orderMode: this.orderTypeList[this.index].type, orderMode: this.modeIndex2 >= 0 || (this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1)? 1 : 0,
packId : this.modeIndex2 >= 0 ? this.packageMode[this.modeIndex2].id : '', packId: this.modeIndex2 >= 0 ? this.packageMode[this.modeIndex2].id : this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1? this.roomLabelList[this.modeIndex].packId : '',
roomLabelId : this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '', roomLabelId : this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '',
} }
...@@ -832,7 +824,40 @@ ...@@ -832,7 +824,40 @@
}, },
// 开始选择时间 // 开始选择时间
onSelectDate() { onSelectDate() {
if(this.orderType==1){
this.hourList = [
"00",
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23"
];
if (this.dateIndex === 0) {
let h = Number(moment().format("HH"))
this.hourList = this.hourList.filter(item => Number(item) >= Number(h));
}
this.$refs.popup.open();
}
}, },
// 切换时间 // 切换时间
...@@ -842,7 +867,17 @@ ...@@ -842,7 +867,17 @@
// 选择完时间 // 选择完时间
onSelectedDate() { onSelectedDate() {
this.checkedDateList = this.checkedIndex.length ? this.checkedIndex.map(item => Number(item)) : [0, 0]; this.checkedDateList = this.checkedIndex.length ? this.checkedIndex.map(item => Number(item)) : [0, 0];
this.startTime = `${this.hourList[this.checkedDateList[0]]}:${this.minuteList[this.checkedDateList[1]]}`; let startTime = `${this.hourList[this.checkedDateList[0]]}:${this.minuteList[this.checkedDateList[1]]}`;
this.formatAllData.startTime = startTime;
console.log(startTime,"开始时间,888")
this.formatAllData = this.onTransiteForDate({
...this.formatAllData,
list: JSON.parse(JSON.stringify(this.dateIntervalList)),
startDateTime: `${this.dateList[this.dateIndex].readDate} ${startTime}:00`,
endDateTime: '',
endTime:''
});
console.log(this.formatAllData,9911199)
this.$forceUpdate(); this.$forceUpdate();
this.onHideModal(); this.onHideModal();
}, },
...@@ -874,6 +909,13 @@ ...@@ -874,6 +909,13 @@
this.$refs.confirmPop.close(); this.$refs.confirmPop.close();
}, },
onOrderConfirmBefore() { onOrderConfirmBefore() {
if(this.formatAllData.useStatus){
uni.showToast({
icon:"none",
title:"所选时段有被占用,请选择其他空闲时段"
})
return;
}
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: [ tmplIds: [
'UkvsRnZkZB_w3MqXPbRhi4jEk8ML4N9PWT3rnd3Bhxg', 'UkvsRnZkZB_w3MqXPbRhi4jEk8ML4N9PWT3rnd3Bhxg',
...@@ -945,13 +987,13 @@ ...@@ -945,13 +987,13 @@
}, },
confirm() { confirm() {
this.close() this.close()
if (!this.useDateStatus) { // if (!this.useDateStatus) {
uni.showToast({ // uni.showToast({
icon: "none", // icon: "none",
title: "所选时段已被其他订单占用" // title: "所选时段已被其他订单占用"
}) // })
return // return
} // }
this.$refs.confirmPop.open(); this.$refs.confirmPop.open();
}, },
onOrder() { onOrder() {
...@@ -986,8 +1028,9 @@ ...@@ -986,8 +1028,9 @@
preEndDate: this.formatAllData.endDateTime, preEndDate: this.formatAllData.endDateTime,
totalFee: this.computePriceInfo.totalFee || 0, totalFee: this.computePriceInfo.totalFee || 0,
payFee: this.computePriceInfo.payFee || 0, payFee: this.computePriceInfo.payFee || 0,
packId: this.modeIndex2 >= 0 ? this.packageMode[this.modeIndex2].id : '', packId: this.modeIndex2 >= 0 ? this.packageMode[this.modeIndex2].id : this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1? this.roomLabelList[this.modeIndex].packId : '',
roomLabelId: this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '' roomLabelId: this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '',
} }
if (this.orderType === 2 && this.preOrderNo) { if (this.orderType === 2 && this.preOrderNo) {
params.preOrderNo = this.preOrderNo params.preOrderNo = this.preOrderNo
...@@ -1094,6 +1137,17 @@ ...@@ -1094,6 +1137,17 @@
}) })
return return
} }
console.log(val,9999)
let startDate = val.endHoldTime? moment(val.endHoldTime).format("YYYY-MM-DD HH:mm:00") : moment(val.timeHour).format("YYYY-MM-DD HH:00:00")
this.formatAllData = this.onTransiteForDate({
list: JSON.parse(JSON.stringify(this.dateIntervalList)),
startDateTime: startDate,
duration:this.formatAllData.duration,
durationType:2
});
this.$forceUpdate();
console.log(this.formatAllData,"处理后的数据")
}, },
...@@ -1122,22 +1176,43 @@ ...@@ -1122,22 +1176,43 @@
m = Number(params.duration) m = Number(params.duration)
} }
// 开始时间的毫秒数 // 开始时间的毫秒数
let startStamp = this.dateIndex > 0? moment(params.list[0].timeHour).valueOf() : !params.startDateTime || params.startDateTime == null ? moment().valueOf() : moment(params.startDateTime).valueOf(); let startStamp = this.dateIndex > 0 && !params.startDateTime ? moment(params.list[0].timeHour).valueOf() : !params.startDateTime || params.startDateTime == null ? moment(moment().add(1,'m').format("YYYY-MM-DD HH:mm:00")).valueOf() : moment(params.startDateTime).valueOf();
let endStamp = startStamp + m * 60 * 1000; let endStamp = startStamp + m * 60 * 1000;
console.log(startStamp, endStamp) console.log(moment(endStamp).format("YYYY-MM-DD HH:mm:ss"),"结束时间戳")
console.log(endStamp - startStamp)
// 记录可开始的时间点 // 记录可开始的时间点
let startPoint = startStamp; let startPoint = startStamp;
let endPoint = endStamp let endPoint = endStamp
let useStatus = false;
// 获取开始时间的当前小时 // 获取开始时间的当前小时
let startPointDate = moment(moment(startStamp).format("YYYY-MM-DD HH:00:00")).valueOf(); let startPointDate = moment(moment(startStamp).format("YYYY-MM-DD HH:00:00")).valueOf();
// 截取可预定时间段状态,true表示也筛选到 // 截取可预定时间段状态,true表示也筛选到
let interceptDateStatus = false; let interceptDateStatus = false;
let list = params.list.map((item, index) => { let list = params.list.map((item, index) => {
console.log(interceptDateStatus,"interceptDateStatus")
if (interceptDateStatus) { if (interceptDateStatus) {
return item return item
} }
if(item.status == 0){
let s = moment(moment(item.timeHour).format("YYYY-MM-DD HH:59:59")).valueOf();
if(s>endStamp){
interceptDateStatus = true;
}
}else if(item.status == 1){
let startH = moment(moment(item.timeHour).format("YYYY-MM-DD HH:00:00")).valueOf();
let endH = moment(moment(item.timeHour).format("YYYY-MM-DD HH:59:59")).valueOf();
let end = moment(moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:00")).valueOf();
if( startStamp >= startH && startStamp < endH && startStamp < end && endStamp > endH){
useStatus = true;
}
let start = moment(item.startHoldTime).valueOf();
if(endStamp >= startH && endStamp < endH && endStamp > start && startStamp < startH ){
useStatus = true;
interceptDateStatus = true;
}
}
let point = moment(moment(item.timeHour).format("YYYY-MM-DD HH:00:00")).valueOf(); let point = moment(moment(item.timeHour).format("YYYY-MM-DD HH:00:00")).valueOf();
if (point >= startPointDate && point < endStamp) { if (point >= startPointDate && point < endStamp) {
item.status = 2; item.status = 2;
...@@ -1151,13 +1226,21 @@ ...@@ -1151,13 +1226,21 @@
endDateTime: moment(endPoint).format("YYYY-MM-DD HH:mm:ss"), endDateTime: moment(endPoint).format("YYYY-MM-DD HH:mm:ss"),
endTime: moment(endPoint).format("HH:mm"), endTime: moment(endPoint).format("HH:mm"),
duration: m, duration: m,
useStatus,
durationType: 2,
interceptDateStatus interceptDateStatus
} }
// 获取用户可用优化券 // 获取用户可用优化券
this.onGetUseCoupon(paramsData) this.onGetUseCoupon(paramsData)
if(paramsData.useStatus){
this.$refs.popupMessage.open();
}
return paramsData return paramsData
}, },
onCancleTip(){
this.$refs.popupMessage.close();
},
onCheckDate() {} onCheckDate() {}
} }
} }
...@@ -1417,6 +1500,9 @@ ...@@ -1417,6 +1500,9 @@
padding: 10upx 6upx; padding: 10upx 6upx;
.package-list-box{ .package-list-box{
padding: 10upx 6upx; padding: 10upx 6upx;
.item{
padding: 8rpx 20rpx;
}
} }
} }
.item { .item {
...@@ -1705,6 +1791,13 @@ ...@@ -1705,6 +1791,13 @@
} }
} }
.select-datetime-box{
display: flex;
flex-direction: column;
.bg-white{
border-bottom: 1px solid #e5e5e5;
}
}
.select-box { .select-box {
height: 420upx; height: 420upx;
background-color: #f1f1f1; background-color: #f1f1f1;
......
...@@ -333,12 +333,16 @@ ...@@ -333,12 +333,16 @@
}) })
}, },
onNavToOrder(){ onNavToOrder(){
uni.showLoading({
title:'加载中'
})
listSortDistance({ listSortDistance({
storeId: this.orderInfo.storeId, storeId: this.orderInfo.storeId,
roomId: this.orderInfo.roomId, roomId: this.orderInfo.roomId,
day: this.orderInfo.endDate, day: this.orderInfo.endDate,
orderType:2 orderType:2
}).then(res=>{ }).then(res=>{
uni.hideLoading()
if(res.data.code != 200){ if(res.data.code != 200){
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
...@@ -416,6 +420,13 @@ ...@@ -416,6 +420,13 @@
} }
} }
} }
}).catch(err=>{
uni.hideLoading()
uni.showToast({
icon:"none",
title:err.msg || err.message||'请求数据出错'
})
}) })
}, },
onOrderRefund(){ onOrderRefund(){
......
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
// eventChannel.emit('acceptDataFromOpenedPage', {data: 'data from test page'}); // eventChannel.emit('acceptDataFromOpenedPage', {data: 'data from test page'});
this.eventChannel.on('sendData', (data) => { this.eventChannel.on('sendData', (data) => {
console.log(data,99999)
this.selectId = data.selectId || '' this.selectId = data.selectId || ''
this.onLoading(data); this.onLoading(data);
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment