Commit 361304c6 by zhangzhen

细节优化

parent 8f861dfe
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
<view class="flex-row list-point-box"> <view class="flex-row list-point-box">
<view v-for="(val,k) in list" :key="k" class="flex-1 flex-col"> <view v-for="(val,k) in list" :key="k" class="flex-1 flex-col">
<view class="box" <view class="box"
:class="item.roomStatusList && item.roomStatusList[val].status==1 && item.roomStatusList[val].m>=59?'bg-pink':'bg-gray'"> :class="item.roomStatusList && item.roomStatusList[val].status==1 ? 'bg-pink':'bg-gray'">
</view> </view>
<text class="text-gray text-sm">{{val==24?'次日':val>24?val-24:val}}</text> <text class="text-gray text-sm">{{val==24?'次日':val>24?val-24:val}}</text>
...@@ -504,10 +504,16 @@ ...@@ -504,10 +504,16 @@
images: item.images ? item.images.split(",").map(val => this.hostUrl + images: item.images ? item.images.split(",").map(val => this.hostUrl +
val) : [], val) : [],
roomStatusList: item.roomStatusList.map(val => { roomStatusList: item.roomStatusList.map(val => {
let status = val.status;
if(status ==1){
if(!this.onCheckHourUse(val.startHoldTime,val.endHoldTime)){
status = 0
}
}
return { return {
...val, ...val,
m: val.endHoldTime ? Number(moment(val.endHoldTime).format( status
"mm")) : 0
} }
}) })
} }
...@@ -529,6 +535,11 @@ ...@@ -529,6 +535,11 @@
uni.hideLoading() uni.hideLoading()
}) })
}, },
// 检查当前小时段是否被全部占用 true 完全占用 false 部分占用
onCheckHourUse(startDate,endDate) {
let timeStamp = moment(endDate).valueOf()-moment(startDate).valueOf();
return timeStamp >= 3599000
},
onGetSortDistance(i = 0) { onGetSortDistance(i = 0) {
if (i >= this.roomVoList.length) { if (i >= this.roomVoList.length) {
// this.$forceUpdate(); // this.$forceUpdate();
...@@ -1132,11 +1143,11 @@ ...@@ -1132,11 +1143,11 @@
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.4);
z-index: 2; z-index: 2;
text{ text{
color: #ffffff; color: #ffffff;
font-size: 24upx; font-size: 28upx;
margin: 4upx 0; margin: 4upx 0;
} }
} }
......
...@@ -85,12 +85,15 @@ ...@@ -85,12 +85,15 @@
</view> </view>
</view> </view>
</view> </view>
<view class="flex-col package-list"> <view v-if="packageMode.length" 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,item)"> @tap="onChangePackage2(index,item)">
<view class="item" :class=" !item.show? 'gray': modeIndex2===index?'active':''"> <view class="item" :class=" !item.show? 'gray': modeIndex2===index?'active':''">
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view> </view>
<view class="pre-icon">
<image :src="assetsPath+'/pre_icon.png'" mode="widthFix"></image>
</view>
</view> </view>
</view> </view>
...@@ -181,7 +184,7 @@ ...@@ -181,7 +184,7 @@
<view v-for="(item,k) in formatAllData.list" :key="k" class="date-point-item" <view v-for="(item,k) in formatAllData.list" :key="k" class="date-point-item"
v-if="k>=startHours && k<=endHours" @tap="onSelectDatePoint(item,k)"> v-if="k>=startHours && k<=endHours" @tap="onSelectDatePoint(item,k)">
<view class="date-point" <view class="date-point"
:class="item.status === 0 ?'free':item.status===1?'used': item.status==2?'checked':'error'"> :class=" item.status==2?'checked': item.tagStatus === 0 ?'free':item.tagStatus===1?'used':'error'">
</view> </view>
<text class="text-gray">{{item.hour}}</text> <text class="text-gray">{{item.hour}}</text>
</view> </view>
...@@ -1029,9 +1032,15 @@ ...@@ -1029,9 +1032,15 @@
}).then(res => { }).then(res => {
uni.hideLoading() uni.hideLoading()
this.dateIntervalList = res.data.data.map((item, index) => { this.dateIntervalList = res.data.data.map((item, index) => {
let status = item.status;
if(status ==1){
if(!this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){
status = 0
}
}
return { return {
...item, ...item,
m: item.endHoldTime ? Number(moment(item.endHoldTime).format("mm")) : 0, tagStatus: status,
hour: index > 0 && index - 24 == 0 ? '次日' : index > 24 ? index - 24 : index hour: index > 0 && index - 24 == 0 ? '次日' : index > 24 ? index - 24 : index
} }
}) })
...@@ -1495,16 +1504,40 @@ ...@@ -1495,16 +1504,40 @@
if(this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){ if(this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){
useStatus = true; useStatus = true;
nextStatus = true; nextStatus = true;
console.log("节点1")
}else{ }else{
if( startStemp >= moment(item.startHoldTime).valueOf() && startStemp < moment(item.endHoldTime).valueOf()){ if(this.orderType == 1){
useStatus = true; if( startStemp >= moment(item.startHoldTime).valueOf() && startStemp < moment(item.endHoldTime).valueOf()){
nextStatus = true; useStatus = true;
} nextStatus = true;
console.log("节点2")
if( endStemp > moment(item.startHoldTime).valueOf() && endStemp <= moment(item.endHoldTime).valueOf()){ }
useStatus = true;
nextStatus = true; if( endStemp > moment(item.startHoldTime).valueOf() && endStemp <= moment(item.endHoldTime).valueOf()){
useStatus = true;
nextStatus = true;
console.log("节点3")
}
} else if(this.orderType == 2){
if( m <60 && !(startStemp >= moment(item.endHoldTime).valueOf() && endStemp < end) ){
useStatus = true;
nextStatus = true;
console.log("节点5")
}else{
if( startStemp > moment(item.startHoldTime).valueOf() && startStemp < moment(item.endHoldTime).valueOf()){
useStatus = true;
nextStatus = true;
console.log("节点2")
}
if( endStemp >= moment(item.startHoldTime).valueOf() && endStemp <= moment(item.endHoldTime).valueOf()){
useStatus = true;
nextStatus = true;
console.log("节点3")
}
}
} }
} }
} }
} }
...@@ -1901,6 +1934,7 @@ ...@@ -1901,6 +1934,7 @@
margin-left: 20upx; margin-left: 20upx;
padding: 10upx 6upx; padding: 10upx 6upx;
.package-list-box{ .package-list-box{
position: relative;
padding: 10upx 6upx; padding: 10upx 6upx;
.item{ .item{
padding: 8rpx 20rpx; padding: 8rpx 20rpx;
...@@ -1909,6 +1943,18 @@ ...@@ -1909,6 +1943,18 @@
background: #c3c3c3; background: #c3c3c3;
color: #f5f5f5; color: #f5f5f5;
} }
.pre-icon{
position: absolute;
top: -8upx;
right: -10upx;
display: flex;
width: 64upx;
z-index: 6;
image{
width: 100%;
max-height: 64upx;
}
}
} }
} }
.item { .item {
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
<view class="part"> <view class="part">
<button class="cu-btn block round line-pink lg" open-type="share">分享好友</button> <button class="cu-btn block round line-pink lg" open-type="share">分享好友</button>
</view> </view>
<view v-if="(continStatus || orderInfo.status ==1) && userInfo.id == orderInfo.consumerId" class="part"> <view v-if="continStatus || orderInfo.status ==1" class="part">
<button class="cu-btn block round bg-mauve lg" @tap="onNavToOrder">房间续单</button> <button class="cu-btn block round bg-mauve lg" @tap="onNavToOrder">房间续单</button>
</view> </view>
</view> </view>
...@@ -355,69 +355,49 @@ ...@@ -355,69 +355,49 @@
// 续单开始时间戳,订单未结束使用订单实际结束时间,订单结束使用当前时间 // 续单开始时间戳,订单未结束使用订单实际结束时间,订单结束使用当前时间
let startDateStemp = this.orderInfo.status == 2? moment(moment().format("YYYY-MM-DD HH:mm:00")).valueOf(): moment(orderEndDate).valueOf(); let startDateStemp = this.orderInfo.status == 2? moment(moment().format("YYYY-MM-DD HH:mm:00")).valueOf(): moment(orderEndDate).valueOf();
//订单开始时间 //可续单的结束时间戳
let orderStartTime = 0; let endDateStemp = startDateStemp + 60*60*1000;
let continueStatus = false; let continueStatus = true;
if(res.data.code ==200 && res.data.data && res.data.data.length){ if(res.data.code ==200 && res.data.data && res.data.data.length){
res.data.data.forEach(item=>{ res.data.data.forEach(item=>{
if(continueStatus) return;
if(orderStartTime){ let start = moment(item.timeHour+':00:00').valueOf();
if(item.status == 0){ let end = moment(item.timeHour+':59:59').valueOf();
uni.navigateTo({
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}` if( end >= startDateStemp && start <= end ){
}) if(item.stauts ==1){
continueStatus = true; if(this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){
}else{ continueStatus = false;
let d = moment(item.startHoldTime).valueOf() console.log("节点1")
if(d - orderStartTime >= 3600*1000){
uni.navigateTo({
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}`
})
continueStatus = true;
return
}else{ }else{
uni.showToast({
icon:"none", if( startDateStemp > moment(item.startHoldTime).valueOf() && startDateStemp < moment(item.endHoldTime).valueOf()){
title:"此订单已无可续单时段" continueStatus = false;
}) console.log("节点2")
continueStatus = true; }
return
if( endDateStemp >= moment(item.startHoldTime).valueOf() && endDateStemp <= moment(item.endHoldTime).valueOf()){
continueStatus = false;
console.log("节点3")
}
} }
} }
}else{
if(item.status == 1) {
let d = moment(item.endHoldTime).valueOf();
if( d >= startDateStemp ){
orderStartTime = d;
console.log(moment(orderStartTime).format("YYYY-MM-DD HH:mm:ss"),"续单可开始的时间2")
}
}
} }
}) })
} if(continueStatus){
return;
let h = this.orderInfo.endTime.split(":").map(item=>Number(item))
if(res.data.code == 200){
let val = res.data.data[h[0]+1];
if(val.status ===0){
uni.navigateTo({ uni.navigateTo({
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}` url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}`
}) })
}else if(val.status ===1){
let nextStartH = moment(val.startHoldTime).format("HH:mm").split(":").map(item=>Number(item)) }else{
if(nextStartH[1]>h[1]){ uni.showToast({
uni.navigateTo({ icon:"none",
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}`
})
}else{
uni.showToast({
icon:"none",
title:"此订单已无可续单时段" title:"此订单已无可续单时段"
}) })
}
} }
} }
}).catch(err=>{ }).catch(err=>{
...@@ -429,6 +409,11 @@ ...@@ -429,6 +409,11 @@
}) })
}) })
}, },
// 检查当前小时段是否被全部占用 true 完全占用 false 部分占用
onCheckHourUse(startDate,endDate) {
let timeStamp = moment(endDate).valueOf()-moment(startDate).valueOf();
return timeStamp >= 3599000
},
onOrderRefund(){ onOrderRefund(){
this.$refs.popup.open(); this.$refs.popup.open();
}, },
......
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