Commit 322f48f8 by zhangzhen

细节优化

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