Commit 6f8cfb5e by zhangzhen

页面优化

parent 2ad5fc38
...@@ -225,10 +225,16 @@ ...@@ -225,10 +225,16 @@
icon:'success', icon:'success',
title:'开门成功' title:'开门成功'
}) })
} else {
uni.showToast({
icon:'success',
title:res.data.msg
})
}
setTimeout(()=>{ setTimeout(()=>{
this.openDoorStatus = false; this.openDoorStatus = false;
},5000) },5000)
}
}) })
}, },
onOrderConfirm(){ onOrderConfirm(){
......
<template> <template>
<view class="coupon-list-box"> <view class="coupon-list-box">
<scroll-view scroll-x class="bg-white nav">
<view class="flex text-center">
<view class="cu-item flex-sub" :class="index==statusIndex?'text-orange cur':''"
v-for="(item,index) in statusList" :key="index" @tap="tabSelect(index)">
<text>{{item.label}}</text>
</view>
</view>
</scroll-view>
<view v-for="(item,index) in list" :key="index" class="coupon-item"> <view v-for="(item,index) in list" :key="index" class="coupon-item">
<view class="part-left"> <view class="part-left">
...@@ -43,7 +51,7 @@ ...@@ -43,7 +51,7 @@
</u-empty> </u-empty>
</view> </view>
<!-- 当数据没有更多时 --> <!-- 当数据没有更多时 -->
<view v-if="list.length" style="padding: 12px 6% 0;"> <view v-if="list.length" style="padding: 12px 6%;">
<u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText" <u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText"
:loadmore-text="loadmoreText" :nomore-text="nomoreText" /> :loadmore-text="loadmoreText" :nomore-text="nomoreText" />
</view> </view>
...@@ -80,6 +88,21 @@ ...@@ -80,6 +88,21 @@
tipText:"", tipText:"",
show:false, show:false,
listBlankImage:indexConfig.assetsPath+'/no_data_icon.png', listBlankImage:indexConfig.assetsPath+'/no_data_icon.png',
statusIndex: 0,
statusList: [
{
label: "全部",
value: "",
},
{
label: "待使用",
value: "0",
},
{
label: "已使用",
value: "1",
}
]
}; };
}, },
components: { components: {
...@@ -109,7 +132,14 @@ ...@@ -109,7 +132,14 @@
} }
} }
}) })
} },
tabSelect(i) {
this.statusIndex = i;
this.queryParams.pageNum = 1;
this.queryParams.useStatus = this.statusList[this.statusIndex].value
this.list = []
this.onLoading()
},
} }
} }
</script> </script>
...@@ -120,6 +150,14 @@ ...@@ -120,6 +150,14 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 100%; width: 100%;
padding-top: 100upx;
.nav{
position: fixed;
top: 0;
left: 0;
height: 90upx;
z-index: 999;
}
.coupon-item{ .coupon-item{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
......
...@@ -633,9 +633,9 @@ ...@@ -633,9 +633,9 @@
// let startInex = this.dateIntervalList.findIndex(item => item.status === 0) // let startInex = this.dateIntervalList.findIndex(item => item.status === 0)
this.dateIntervalList.forEach((val,i)=>{ this.dateIntervalList.forEach((val,i)=>{
if(selectNum>=this.duration){ if(selectNum>this.duration){
return return
} else if(val.status === 0 || (val.status ==1 && Number(moment(val.endHoldTime).format('mm'))<59)){ } else if(val.status === 0 || (val.status ==1 && Number(moment(val.endHoldTime).format('mm'))<29)){
selectNum+=1 selectNum+=1
if(t<0){ if(t<0){
t = i t = i
...@@ -647,7 +647,7 @@ ...@@ -647,7 +647,7 @@
}) })
if( selectNum < this.duration || (selectNum >= this.duration && t>=24)){ if( selectNum <= this.duration || (selectNum >= this.duration && t>=24)){
if(this.dateIndex>=this.dateList.length-1){ if(this.dateIndex>=this.dateList.length-1){
this.onInitDateList() this.onInitDateList()
}else{ }else{
...@@ -843,7 +843,7 @@ ...@@ -843,7 +843,7 @@
if (!this.useDateStatus) { if (!this.useDateStatus) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "选择时段有重复" title: "所选时段已被其他订单占用"
}) })
} }
}, 1000) }, 1000)
...@@ -963,6 +963,7 @@ ...@@ -963,6 +963,7 @@
if (this.modeIndex === i) return; if (this.modeIndex === i) return;
this.modeIndex = i; this.modeIndex = i;
this.selectCouponIndex = -1; this.selectCouponIndex = -1;
this.useDateStatus = true;
this.duration = Number(this.packageMode[this.modeIndex].duration); this.duration = Number(this.packageMode[this.modeIndex].duration);
let val = this.intervalList.findIndex(item=>item.status === 2) let val = this.intervalList.findIndex(item=>item.status === 2)
let len = this.intervalList.filter(item=> item.status ===2).length; let len = this.intervalList.filter(item=> item.status ===2).length;
...@@ -981,13 +982,13 @@ ...@@ -981,13 +982,13 @@
h = val+duration h = val+duration
} }
this.endTime = `${h>=10?h:'0'+h}:${startM>=10?startM:'0'+startM}`; this.endTime = `${h>=10?h:'0'+h}:${startM>=10?startM:'0'+startM}`;
let showHourUse = false;
this.intervalList = this.intervalList.map((item,index) =>{ this.intervalList = this.intervalList.map((item,index) =>{
let status = item.status; let status = item.status;
if(index>=val && index<= val+duration){ if(index>=val && index<= val+duration){
status = 2 status = 2
if(this.dateIntervalList[index].status === 1 && index !== val){ if(this.dateIntervalList[index].status === 1 && index !== val){
showHourUse = true this.useDateStatus = false
} }
}else{ }else{
status = this.dateIntervalList[index].status status = this.dateIntervalList[index].status
...@@ -997,10 +998,10 @@ ...@@ -997,10 +998,10 @@
status status
} }
}) })
if (showHourUse) { if (!this.useDateStatus) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "选择时段有重复", title: "所选时段已被其他订单占用",
success: () => { success: () => {
setTimeout(async ()=>{ setTimeout(async ()=>{
this.dateObj =await this.onSetDateTime(this.startTime, this.endTime); this.dateObj =await this.onSetDateTime(this.startTime, this.endTime);
...@@ -1043,7 +1044,7 @@ ...@@ -1043,7 +1044,7 @@
let n = 0 let n = 0
let t = -1; let t = -1;
res.data.data.forEach((item,k)=>{ res.data.data.forEach((item,k)=>{
if(n<=this.duration && (item.status===0||(item.status ==1 && Number(moment(item.endHoldTime).format('mm'))<59))){ if(n<=this.duration && (item.status===0||(item.status ==1 && Number(moment(item.endHoldTime).format('mm'))<29))){
n += 1 n += 1
if(t<0){ if(t<0){
t = k t = k
...@@ -1056,7 +1057,7 @@ ...@@ -1056,7 +1057,7 @@
} }
}) })
if(n < this.duration || (n >= this.duration && t>=24)){ if(n <= this.duration || (n >= this.duration && t>=24)){
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
title:"当前日期无可预约时段" title:"当前日期无可预约时段"
...@@ -1161,7 +1162,7 @@ ...@@ -1161,7 +1162,7 @@
if (!this.useDateStatus) { if (!this.useDateStatus) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "选择时段有重复,无法下单" title: "所选时段已被其他订单占用"
}) })
return return
} }
...@@ -1175,7 +1176,7 @@ ...@@ -1175,7 +1176,7 @@
if (!this.useDateStatus) { if (!this.useDateStatus) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "选择时段有重复,无法下单" title: "所选时段已被其他订单占用"
}) })
return return
} }
...@@ -1323,7 +1324,6 @@ ...@@ -1323,7 +1324,6 @@
}, },
onSelectDatePoint(val, i) { onSelectDatePoint(val, i) {
if(this.orderType == 2) return; if(this.orderType == 2) return;
this.showHourUse = false;
if(i>=24) { if(i>=24) {
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
...@@ -1343,7 +1343,7 @@ ...@@ -1343,7 +1343,7 @@
if (mTime >= 59) { if (mTime >= 59) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '当前时段不可' title: '当前时段不可预定'
}) })
return; return;
} else { } else {
...@@ -1385,14 +1385,14 @@ ...@@ -1385,14 +1385,14 @@
} }
this.dateObj = this.onSetDateTime(this.startTime, this.endTime); this.dateObj = this.onSetDateTime(this.startTime, this.endTime);
let showHourUse = false; this.useDateStatus = true;
this.intervalList = this.intervalList.map((item,index) =>{ this.intervalList = this.intervalList.map((item,index) =>{
let status = item.status; let status = item.status;
if(index>=i && index<= i+this.duration){ if(index>=i && index<= i+this.duration){
status = 2 status = 2
if(this.dateIntervalList[index].status === 1 && index !== i ){ if(this.dateIntervalList[index].status === 1 && index !== i ){
showHourUse = true this.useDateStatus = false;
} }
}else{ }else{
status = this.dateIntervalList[index].status status = this.dateIntervalList[index].status
...@@ -1402,10 +1402,10 @@ ...@@ -1402,10 +1402,10 @@
status status
} }
}) })
if (showHourUse) { if (!this.useDateStatus) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "选择时段有重复" title: "所选时段已被其他订单占用"
}) })
} }
}, },
......
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