Commit 322f48f8 by zhangzhen

细节优化

parent 6a9ff6c8
......@@ -3,7 +3,7 @@
<view v-for="(item,index) in list" :key="index" class="coupon-item">
<view class="part-left">
<image :src="item.useStatus==0? '../../static/coupon_icon.png':'../../static/coupon_icon_gray.png'" mode="widthFix"></image>
<image :src="item.useStatus==0? assetsPath+'/coupon_icon.png':assetsPath+'/coupon_icon_gray.png'" mode="widthFix"></image>
</view>
<view class="part-right">
<view class="coupon-name">
......@@ -62,6 +62,7 @@
scrollTop: 0,
current: '',
hostUrl: indexConfig.hostUrl,
assetsPath: indexConfig.assetsPath,
statusBarHeight: this.statusBarHeight,
titleBarHeight: this.titleBarHeight,
list: [],
......
......@@ -95,7 +95,7 @@
</view>
<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.list && item.list[val].status==1 && item.list[val+1].status==1?'bg-pink':'bg-gray'">
<view class="box" :class="item.list && item.list[val].status==1 && item.list[val].m>=59?'bg-pink':'bg-gray'">
</view>
<text class="text-gray text-sm">{{val==24?'次日':val>24?val-24:val}}</text>
......@@ -319,6 +319,7 @@
},
onGetSortDistance(i = 0){
if(i >= this.roomVoList.length){
console.log(this.roomVoList,909090)
// this.$forceUpdate();
return
}
......@@ -329,10 +330,16 @@
orderType:1
}).then(res=>{
if(res.data.code == 200){
let list = res.data.data.map(item=>{
return {
...item,
m: item.endHoldTime? Number(moment(item.endHoldTime).format("mm")):0
}
});
this.roomVoList = this.roomVoList.map((item,k)=>{
return {
...item,
list: i === k? res.data.data: item.list && item.list.length? item.list: []
list: i === k? list: item.list && item.list.length? item.list: []
}
})
this.onGetSortDistance(++i)
......
......@@ -156,7 +156,7 @@
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 === 0 || (item.status==1 && item.m <59) ?'free':item.status==1 && item.m >=59?'used': item.status==2?'checked':'error'">
</view>
<text class="text-gray">{{item.hour}}</text>
</view>
......@@ -288,7 +288,7 @@
<view class="flex-col text-red">
<text>1.预定的订单将全时段保留,迟到不可顺延和退款。</text>
<text>2.若订单时段前包厢无使用.可提前开始订单.但订单总时长不变。</text>
<text>3.订单开始前0小时内取消订单需核收xx%退单费请合理规划您的时间。</text>
<!-- <text>3.订单开始前0小时内取消订单需核收xx%退单费请合理规划您的时间。</text> -->
</view>
</view>
</view>
......@@ -305,6 +305,19 @@
</view>
</uni-popup>
<LoginPop ref="loginPop" @success='onLoading' />
<uni-popup ref="popupConfirm" type="dialog">
<uni-popup-dialog
type="warn"
mode="base"
:content="content"
:duration="2000"
:before-close="true"
@close="close"
@confirm="confirm"
></uni-popup-dialog>
</uni-popup>
</view>
</template>
......@@ -355,7 +368,7 @@
// weekday:''
// }
],
index: 0,
index: 0, //订单模式标记
orderTypeList: [{
label: "小时模式",
type: 1
......@@ -443,7 +456,8 @@
days:1,
addM:false,//初始化加一分钟,之后不加
startHours:0,
endHours:48
endHours:48,
content:''
};
},
filters:{
......@@ -590,27 +604,32 @@
this.dateIntervalList = res.data.data.map((item, index) => {
return {
...item,
m:item.endHoldTime? Number(moment(item.endHoldTime).format("mm")):0,
hour: index > 0 && index - 24 == 0 ? '次日' : index > 24 ? index - 24 : index
}
})
// 今天可连续选择的时段
let selectNum = 0;
let t = -1;
// let startInex = this.dateIntervalList.findIndex(item => item.status === 0)
this.dateIntervalList.forEach((val,i)=>{
if(i<=23){
if(selectNum>=this.duration){
return
} else if(val.status === 0){
selectNum+=1
if(t<0){
t = i
}
}else{
selectNum = 0
}
t = -1
}
})
if( selectNum < this.duration){
if( selectNum < this.duration || (selectNum >= this.duration && t>=24)){
if(this.dateIndex>=this.dateList.length-1){
this.onInitDateList()
}else{
......@@ -993,17 +1012,22 @@
}).then(res=>{
let n = 0
let t = -1;
res.data.data.forEach((item,k)=>{
if(k<24&& n<=this.duration&&item.status===0){
if(n<=this.duration&&item.status===0){
n += 1
if(t<0){
t = k
}
}else{
if(n<this.duration){
n=0
t = -1
}
}
})
if(n < this.duration){
if(n < this.duration || (n >= this.duration && t>=24)){
uni.showToast({
icon:"none",
title:"当前日期无可预约时段"
......@@ -1097,6 +1121,27 @@
this.$refs.confirmPop.close();
},
onOrderConfirm() {
if(this.orderTypeList[this.index].type ===2){
if(this.packageMode[this.modeIndex].packaEndPeriod-this.packageMode[this.modeIndex].packaStartPeriod<23 && Number(moment(this.dateObj.endDate).format("HH"))>=this.packageMode[this.modeIndex].packaEndPeriod ){
this.content=`所选套餐为限时套餐,订单结束时间为当日${Number(this.packageMode[this.modeIndex].packaEndPeriod)>=10?this.packageMode[this.modeIndex].packaEndPeriod:'0'+this.packageMode[this.modeIndex].packaEndPeriod}:00,请注意下单结束时间!`
this.$refs.popupConfirm.open()
return
}
}
if (!this.useDateStatus) {
uni.showToast({
icon: "none",
title: "选择时段有重复,无法下单"
})
return
}
this.$refs.confirmPop.open();
},
close(){
this.$refs.popupConfirm.close()
},
confirm(){
this.close()
if (!this.useDateStatus) {
uni.showToast({
icon: "none",
......@@ -1161,11 +1206,11 @@
title: "下单成功",
success: () => {
setTimeout(() => {
uni.navigateTo({
uni.redirectTo({
url: `/pages/orderResult/orderResult?orderNo=${res.data.data.orderNo}&success=true`
})
this.startTime = moment(this.dateObj.endDate).add(31,'m').format("HH:mm")
this.onGetSortDistance()
// this.startTime = moment(this.dateObj.endDate).add(31,'m').format("HH:mm")
// this.onGetSortDistance()
}, 1000)
}
})
......@@ -1187,11 +1232,11 @@
title: "下单成功",
success: () => {
setTimeout(() => {
uni.navigateTo({
uni.redirectTo({
url: `/pages/orderResult/orderResult?orderNo=${res.data.data.orderNo}&success=true`
})
this.startTime = moment(this.dateObj.endDate).add(31,'m').format("HH:mm")
this.onGetSortDistance()
// this.startTime = moment(this.dateObj.endDate).add(31,'m').format("HH:mm")
// this.onGetSortDistance()
}, 1000)
}
})
......@@ -1248,6 +1293,7 @@
},
onSelectDatePoint(val, i) {
if(this.orderType == 2) return;
this.showHourUse = false;
if(i>=24) {
uni.showToast({
icon:"none",
......
......@@ -155,7 +155,7 @@ import NoLogin from "@/components/noLogin/noLogin"
value: "2",
},
{
label: "退单",
label: "已取消",
value: "3",
}
],
......
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