Commit 361304c6 by zhangzhen

细节优化

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