Commit 60755f0c by zhangzhen

细节优化

parent ae7d46f5
...@@ -66,10 +66,11 @@ ...@@ -66,10 +66,11 @@
<script> <script>
import {dictList} from "@/api/index.js"; import {dictList} from "@/api/index.js";
import {getDictItem} from "@/utils/tools.js"
import indexConfig from "@/config/index.config"; import indexConfig from "@/config/index.config";
import FixedHeader from "@/components/fixedHeader/index"; import FixedHeader from "@/components/fixedHeader/index";
import {getCouponList} from "@/api/coupon" import {getCouponList} from "@/api/coupon"
import {getDictItem} from "@/utils/tools.js"
export default { export default {
data() { data() {
......
...@@ -7,29 +7,29 @@ ...@@ -7,29 +7,29 @@
<view class="part-right"> <view class="part-right">
<text <text
class="text-title text-xl text-bold">{{roomInfo.name||'凑角'}}{{roomInfo.roomType?'【'+roomTypeEnum[roomInfo.roomType]+'】':''}}</text> class="text-title text-xl text-bold">{{roomInfo.name||'凑角'}}{{roomInfo.roomType?'【'+roomTypeEnum[roomInfo.roomType]+'】':''}}</text>
<view v-if="roomInfo.roomStat >= 3" class="status-icon-box"> <view v-if="roomInfo.roomStat >= 3" class="status-icon-box">
<view class="status-box" :class="'status-box-1'"> <view class="status-box" :class="'status-box-1'">
<text>维护中</text> <text>维护中</text>
</view> </view>
<image class="img" :src="assetsPath+'/fa_icon_1.png'" mode="widthFix"></image> <image class="img" :src="assetsPath+'/fa_icon_1.png'" mode="widthFix"></image>
</view> </view>
<view v-else-if="roomInfo.isDirtyRoom >=1" class="status-icon-box"> <view v-else-if="roomInfo.isDirtyRoom >=1" class="status-icon-box">
<view class="status-box" :class="'status-box-1'"> <view class="status-box" :class="'status-box-1'">
<text>未保洁</text> <text>未保洁</text>
</view> </view>
<image class="img" :src="assetsPath+'/fa_icon_1.png'" mode="widthFix"></image> <image class="img" :src="assetsPath+'/fa_icon_1.png'" mode="widthFix"></image>
</view> </view>
<view v-else class="status-icon-box"> <view v-else class="status-icon-box">
<view class="status-box" :class="'status-box-'+roomInfo.status"> <view class="status-box" :class="'status-box-'+roomInfo.status">
<text>{{roomStatusEnum[roomInfo.status]}}</text> <text>{{roomStatusEnum[roomInfo.status]}}</text>
</view> </view>
<image class="img" :src="assetsPath+'/fa_icon_'+roomInfo.status+'.png'" mode="widthFix"></image> <image class="img" :src="assetsPath+'/fa_icon_'+roomInfo.status+'.png'" mode="widthFix"></image>
</view> </view>
</view> </view>
<view class="part-left"> <view class="part-left">
<image :src="roomInfo.images.length?roomInfo.images[0]: assetsPath+'/banner.jpg'" mode="widthFix"> <image :src="roomInfo.images.length?roomInfo.images[0]: assetsPath+'/banner.jpg'" mode="widthFix">
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
@tap="onTypeChange(i)"> @tap="onTypeChange(i)">
<text class="text-gray text-xl text-bold">{{item.label}}</text> <text class="text-gray text-xl text-bold">{{item.label}}</text>
<view v-if="item.type == 2" class="hot-icon"> <view v-if="item.type == 2" class="hot-icon">
<view class="img-icon"> <view class="img-icon">
<image src="../../static/hot_icon.png" mode="widthFix"></image> <image src="../../static/hot_icon.png" mode="widthFix"></image>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
</view> </view>
<view v-for="(item,k) in dateList" :key="k" class="flex-1 flex-col date-item" <view v-for="(item,k) in dateList" :key="k" class="flex-1 flex-col date-item"
:class="{active:dateIndex === k}" @tap="onDateChange(k)"> :class="{active:dateIndex === k}" @tap="onDateChange(k)">
<text class="text-title text-bold text-first ">{{ k === 0 && item.readDate === toDayDate? '今天' : item.weekday}}</text> <text
class="text-title text-bold text-first ">{{ k === 0 && item.readDate === toDayDate? '今天' : item.weekday}}</text>
<text class="text-title text-bold" style="margin-top: 12upx;">{{ item.date}}</text> <text class="text-title text-bold" style="margin-top: 12upx;">{{ item.date}}</text>
</view> </view>
</view> </view>
...@@ -69,22 +70,21 @@ ...@@ -69,22 +70,21 @@
<view v-show="index==1" class="flex-col package-mode"> <view v-show="index==1" class="flex-col package-mode">
<view class="part-1"> <view class="part-1">
<text class="text-title text-lg text-bold">套餐选择:</text> <text class="text-title text-lg text-bold">套餐选择:</text>
</view> </view>
<scroll-view scroll-x="true" class="scroll-view" > <scroll-view scroll-x="true" class="scroll-view">
<view class="flex-row package-box"> <view class="flex-row package-box">
<view v-for="(item,index) in packageMode" :key="index" class="flex-col item" <view v-for="(item,index) in packageMode" :key="index" class="flex-col item"
:class="{active: modeIndex===index}" :class="{active: modeIndex===index}" @tap="onChangeMode(index)">
@tap="onChangeMode(index)">
<text class="text-title">{{item.name}}</text> <text class="text-title">{{item.name}}</text>
<view class="flex-row" style="margin-top: 8upx;"> <view class="flex-row" style="margin-top: 8upx;">
<!-- <text>{{item.duration}}小时/</text>--> <!-- <text>{{item.duration}}小时/</text>-->
<text style="margin-bottom: 2upx;" ></text> <text style="margin-bottom: 2upx;"></text>
<text class="text-bold text-xl">{{item.price}}</text> <text class="text-bold text-xl">{{item.price}}</text>
</view> </view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view v-if="packageMode[modeIndex].remark" class="flex-col tip-box"> <view v-if="packageMode[modeIndex].remark" class="flex-col tip-box">
<text class="" style="margin-bottom: 12upx;">套餐说明:</text> <text class="" style="margin-bottom: 12upx;">套餐说明:</text>
<text class="text-sm">{{packageMode[modeIndex].remark}}</text> <text class="text-sm">{{packageMode[modeIndex].remark}}</text>
</view> </view>
...@@ -105,7 +105,8 @@ ...@@ -105,7 +105,8 @@
</view> </view>
</view> </view>
<view v-if="orderType ===2 && index == 0" class="flex-col distance-mode" style="margin: 40upx 20upx 40upx;"> <view v-if="orderType ===2 && index == 0" class="flex-col distance-mode"
style="margin: 40upx 20upx 40upx;">
<view class="distance-title"> <view class="distance-title">
<text class="text-title text-lg text-bold">时长选择:</text> <text class="text-title text-lg text-bold">时长选择:</text>
</view> </view>
...@@ -171,8 +172,7 @@ ...@@ -171,8 +172,7 @@
</view> </view>
<view class="date-point-box"> <view class="date-point-box">
<view v-for="(item,k) in intervalList" :key="k" class="date-point-item" <view v-for="(item,k) in intervalList" :key="k" class="date-point-item"
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 || (item.status==1 && item.m <59) ?'free':item.status==1 && item.m >=59?'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>
...@@ -203,7 +203,8 @@ ...@@ -203,7 +203,8 @@
</view> </view>
</view> </view>
<view class="flex-between price use-coupon-box"> <view class="flex-between price use-coupon-box">
<text class="text-black text-left">{{useCouponList[selectCouponIndex].couponType==2? '团购券':'优惠券'}}</text> <text
class="text-black text-left">{{useCouponList[selectCouponIndex].couponType==2? '团购券':'优惠券'}}</text>
<view class="flex-row" @tap="onNavToSelectCoupon"> <view class="flex-row" @tap="onNavToSelectCoupon">
<text class="" :class="useCouponList.length?'text-pink':'text-gray'"> <text class="" :class="useCouponList.length?'text-pink':'text-gray'">
{{ useCouponList.length && selectCouponIndex>=0? useCouponList[selectCouponIndex].name: couponList.length? '请选择':'暂无可用'}}</text> {{ useCouponList.length && selectCouponIndex>=0? useCouponList[selectCouponIndex].name: couponList.length? '请选择':'暂无可用'}}</text>
...@@ -228,8 +229,7 @@ ...@@ -228,8 +229,7 @@
</view> </view>
</view> </view>
<view class="btn-box"> <view class="btn-box">
<button class="cu-btn cu-btn-1 margin-right" <button class="cu-btn cu-btn-1 margin-right" @tap="onNavToCheckedCoupon">团购验券</button>
@tap="onNavToCheckedCoupon">团购验券</button>
<button class="cu-btn cu-btn-2 " @tap="onOrderConfirmBefore">{{orderType===1?'预约':'续单'}} </button> <button class="cu-btn cu-btn-2 " @tap="onOrderConfirmBefore">{{orderType===1?'预约':'续单'}} </button>
</view> </view>
</view> </view>
...@@ -241,8 +241,8 @@ ...@@ -241,8 +241,8 @@
<view class="action text-pink" @tap="onSelectedDate">确定</view> <view class="action text-pink" @tap="onSelectedDate">确定</view>
</view> </view>
<view class="select-box"> <view class="select-box">
<picker-view class="picker-view" indicator-style="height: 42px;" :immediate-change="true" v-model="checkedDateList" <picker-view class="picker-view" indicator-style="height: 42px;" :immediate-change="true"
@change="onBindChange"> v-model="checkedDateList" @change="onBindChange">
<picker-view-column> <picker-view-column>
<view class="item" v-for="(item,index) in hourList" :key="index"> <view class="item" v-for="(item,index) in hourList" :key="index">
<text>{{item}}</text> <text>{{item}}</text>
...@@ -265,8 +265,8 @@ ...@@ -265,8 +265,8 @@
<view class="action text-pink" @tap="onSelectedDuration">确定</view> <view class="action text-pink" @tap="onSelectedDuration">确定</view>
</view> </view>
<view class="select-box"> <view class="select-box">
<picker-view class="picker-view" indicator-style="height: 42px;" :immediate-change="true" v-model="durationIndex2" <picker-view class="picker-view" indicator-style="height: 42px;" :immediate-change="true"
@change="onBindDuratin"> v-model="durationIndex2" @change="onBindDuratin">
<picker-view-column> <picker-view-column>
<view class="item" v-for="(item,index) in hourList2" :key="index"> <view class="item" v-for="(item,index) in hourList2" :key="index">
<text>{{item}}小时</text> <text>{{item}}小时</text>
...@@ -323,19 +323,12 @@ ...@@ -323,19 +323,12 @@
</view> </view>
</uni-popup> </uni-popup>
<LoginPop ref="loginPop" @success='onLoading' /> <LoginPop ref="loginPop" @success='onLoading' />
<uni-popup ref="popupConfirm" type="dialog"> <uni-popup ref="popupConfirm" type="dialog">
<uni-popup-dialog <uni-popup-dialog type="warn" mode="base" :content="content" :duration="2000" :before-close="true"
type="warn" @close="close" @confirm="confirm"></uni-popup-dialog>
mode="base"
:content="content"
:duration="2000"
:before-close="true"
@close="close"
@confirm="confirm"
></uni-popup-dialog>
</uni-popup> </uni-popup>
<uni-popup ref="popupMessage" type="center"> <uni-popup ref="popupMessage" type="center">
<view class="flex-col message-box"> <view class="flex-col message-box">
<view class="header"> <view class="header">
...@@ -351,7 +344,7 @@ ...@@ -351,7 +344,7 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
...@@ -386,7 +379,7 @@ ...@@ -386,7 +379,7 @@
data() { data() {
return { return {
id: '', id: '',
orderType: 1,//订单模式,1:下单;2续单 orderType: 1, //订单模式,1:下单;2续单
payWay: 1, payWay: 1,
hostUrl: config.hostUrl, hostUrl: config.hostUrl,
assetsPath: config.assetsPath, assetsPath: config.assetsPath,
...@@ -396,7 +389,7 @@ ...@@ -396,7 +389,7 @@
startTime: moment().format("HH:mm"), startTime: moment().format("HH:mm"),
endTime: '12:00', endTime: '12:00',
dateIndex: 0, dateIndex: 0,
dateList:[ dateList: [
// { // {
// date:"02-28", // date:"02-28",
// readDate:'2024-02-28', // readDate:'2024-02-28',
...@@ -459,8 +452,8 @@ ...@@ -459,8 +452,8 @@
"16", "16",
"17", "18", "19", "20", "21", "22", "23" "17", "18", "19", "20", "21", "22", "23"
], ],
durationIndex2:[0], durationIndex2: [0],
hourList2: [4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24], hourList2: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
minuteList: ['00', "30"], minuteList: ['00', "30"],
orderTypeEnum: { orderTypeEnum: {
1: "预定", 1: "预定",
...@@ -482,38 +475,38 @@ ...@@ -482,38 +475,38 @@
roomStatusEnum: {}, roomStatusEnum: {},
roomTypeEnum: {}, roomTypeEnum: {},
setStartTime: { setStartTime: {
status:false, status: false,
startTime:'', startTime: '',
startDate:'', startDate: '',
duration:0, duration: 0,
days:1 days: 1
}, },
days:1, days: 1,
addM:false,//初始化加一分钟,之后不加 addM: false, //初始化加一分钟,之后不加
startHours:0, startHours: 0,
endHours:48, endHours: 48,
content:'', content: '',
toDayDate: '', // 今天日期 toDayDate: '', // 今天日期
}; };
}, },
filters:{ filters: {
resetStartTime(val){ resetStartTime(val) {
let hour = val.split(':').map((n,k)=> { let hour = val.split(':').map((n, k) => {
let t = Number(n) let t = Number(n)
if(k == 0){ if (k == 0) {
if(n>=24){ if (n >= 24) {
t = n>=24? n-24: n t = n >= 24 ? n - 24 : n
} }
} }
return t>=10? t: `0${t}` return t >= 10 ? t : `0${t}`
}).join(":") }).join(":")
return hour; return hour;
} }
}, },
watch:{ watch: {
dateIndex(){ dateIndex() {
this.onSetSelectTime() this.onSetSelectTime()
this.onSetStartHours() this.onSetStartHours()
} }
}, },
...@@ -539,41 +532,45 @@ ...@@ -539,41 +532,45 @@
} }
}, },
methods: { methods: {
onInitDateList(){ onInitDateList() {
this.toDayDate = moment().format("YYYY-MM-DD") this.toDayDate = moment().format("YYYY-MM-DD")
let dateList = []; let dateList = [];
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
let obj = { let obj = {
date: this.dateList.length? moment(this.dateList[1].readDate).add(i, "days").format("MM-DD"):moment().add(i, "days").format("MM-DD"), date: this.dateList.length ? moment(this.dateList[1].readDate).add(i, "days").format("MM-DD") :
readDate: this.dateList.length? moment(this.dateList[1].readDate).add(i, "days").format("YYYY-MM-DD") : moment().add(i, "days").format("YYYY-MM-DD"), moment().add(i, "days").format("MM-DD"),
weekday: this.dateList.length? moment(this.dateList[1].readDate).add(i, "days").format("dddd") : moment().add(i, "days").format("dddd") readDate: this.dateList.length ? moment(this.dateList[1].readDate).add(i, "days").format(
"YYYY-MM-DD") : moment().add(i, "days").format("YYYY-MM-DD"),
weekday: this.dateList.length ? moment(this.dateList[1].readDate).add(i, "days").format(
"dddd") : moment().add(i, "days").format("dddd")
} }
dateList.push(obj) dateList.push(obj)
} }
this.dateList = dateList; this.dateList = dateList;
}, },
onSetSelectTime(){ onSetSelectTime() {
if(this.dateIndex === 0){ if (this.dateIndex === 0) {
let h = Number(moment().format("HH")) let h = Number(moment().format("HH"))
this.hourList = this.hourList.filter(item=> Number(item)>=h).map(item=> { this.hourList = this.hourList.filter(item => Number(item) >= h).map(item => {
let i = Number(item) let i = Number(item)
return i>=10? i: `0${i}` return i >= 10 ? i : `0${i}`
} ) })
}else{ } else {
this.hourList = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", this.hourList = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13",
"16", "14", "15",
"17", "18", "19", "20", "21", "22", "23" "16",
] "17", "18", "19", "20", "21", "22", "23"
]
} }
}, },
onSetStartHours(){ onSetStartHours() {
if(this.dateIndex === 0){ if (this.dateIndex === 0) {
this.startHours = Number(moment().format("HH")); this.startHours = Number(moment().format("HH"));
}else{ } else {
this.startHours = 0 this.startHours = 0
} }
this.endHours = this.startHours+23; this.endHours = this.startHours + 23;
this.onSetSelectTime(); this.onSetSelectTime();
}, },
onGetDicts() { onGetDicts() {
...@@ -603,13 +600,13 @@ ...@@ -603,13 +600,13 @@
images: res.data.data.images ? res.data.data.images images: res.data.data.images ? res.data.data.images
.split(",").map(val => this.hostUrl + val) : [] .split(",").map(val => this.hostUrl + val) : []
} }
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: `${this.roomInfo.storeName}-房间${this.orderType ==1? '预约':'续单' }` title: `${this.roomInfo.storeName}-房间${this.orderType ==1? '预约':'续单' }`
}) })
// 判断房间有没有绑定套餐 // 判断房间有没有绑定套餐
if (this.roomInfo.packList && this.roomInfo.packList.length) { if (this.roomInfo.packList && this.roomInfo.packList.length) {
this.packageMode = this.roomInfo.packList this.packageMode = this.roomInfo.packList
if(this.orderType === 1){ if (this.orderType === 1) {
this.index = 1; this.index = 1;
} }
this.modeIndex = 0; this.modeIndex = 0;
...@@ -617,14 +614,14 @@ ...@@ -617,14 +614,14 @@
this.index = 0; this.index = 0;
this.orderTypeList = this.orderTypeList.filter(item => item.type == 1) this.orderTypeList = this.orderTypeList.filter(item => item.type == 1)
} }
// if(this.roomInfo.isDirtyRoom >=1){ // if(this.roomInfo.isDirtyRoom >=1){
// uni.showToast({ // uni.showToast({
// icon:"none", // icon:"none",
// title:'当前房间未保洁,无法预定,请选择其他房间' // title:'当前房间未保洁,无法预定,请选择其他房间'
// }) // })
// } // }
this.onGetSortDistance() this.onGetSortDistance()
} }
}) })
...@@ -646,27 +643,27 @@ ...@@ -646,27 +643,27 @@
storeId: this.roomInfo.storeId, storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id, roomId: this.roomInfo.id,
day: this.dateList[this.dateIndex].readDate, day: this.dateList[this.dateIndex].readDate,
orderType:this.orderType orderType: this.orderType
}).then(res => { }).then(res => {
uni.hideLoading() uni.hideLoading()
if (this.orderTypeList[this.index].type == 2){ if (this.orderTypeList[this.index].type == 2) {
this.duration = Number(this.packageMode[this.modeIndex].duration); this.duration = Number(this.packageMode[this.modeIndex].duration);
}else{ } else {
this.duration = Number(this.distanceMode[this.distanceIndex].duration); this.duration = Number(this.distanceMode[this.distanceIndex].duration);
} }
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, 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
} }
}) })
if(this.orderType === 2){ if (this.orderType === 2) {
this.onSetEndTime() this.onSetEndTime()
}else{ } else {
this.onCheckDate(); this.onCheckDate();
} }
}) })
}, },
...@@ -741,13 +738,13 @@ ...@@ -741,13 +738,13 @@
let end = Number(this.endTime.split(":")[0]) let end = Number(this.endTime.split(":")[0])
let endM = Number(this.endTime.split(":")[1]) let endM = Number(this.endTime.split(":")[1])
// 如果开始时间是第二天 // 如果开始时间是第二天
// if(this.setStartTime.days >=2 || this.days == 2){ // if(this.setStartTime.days >=2 || this.days == 2){
// start +=24 // start +=24
// } // }
if (this.orderType ==2 && end < start){ if (this.orderType == 2 && end < start) {
end += 24 end += 24
}else if(this.orderType ==1 && end <= start) { } else if (this.orderType == 1 && end <= start) {
end += 24 end += 24
} }
this.dateObj = await this.onSetDateTime(this.startTime, this.endTime); this.dateObj = await this.onSetDateTime(this.startTime, this.endTime);
...@@ -757,13 +754,14 @@ ...@@ -757,13 +754,14 @@
...this.dateIntervalList ...this.dateIntervalList
] ]
for (let index = start; index <= end; index++) { for (let index = start; index <= end; index++) {
let endTimeM = 0 let endTimeM = 0
if(this.dateIntervalList[index].status ==1){ if (this.dateIntervalList[index].status == 1) {
endTimeM = moment(this.dateIntervalList[index].startHoldTime).format('mm') endTimeM = moment(this.dateIntervalList[index].startHoldTime).format('mm')
} }
// 在时间小时段内,在被占用的情况下,新增订单的开始分钟时间需要占用结束时间后,结束分钟时间需在时间占用开始前 // 在时间小时段内,在被占用的情况下,新增订单的开始分钟时间需要占用结束时间后,结束分钟时间需在时间占用开始前
if ((this.dateIntervalList[index].status == 1 && index > start && index < start+this.duration)|| if ((this.dateIntervalList[index].status == 1 && index > start && index < start + this.duration) ||
(this.dateIntervalList[index].status == 1 && index == end && Number(startM)>= Number(endTimeM) ) (this.dateIntervalList[index].status == 1 && index == end && Number(startM) >= Number(
endTimeM))
) { ) {
// 表示时间点被占用,无法选择 // 表示时间点被占用,无法选择
this.useDateStatus = false this.useDateStatus = false
...@@ -797,23 +795,29 @@ ...@@ -797,23 +795,29 @@
preStartDate: this.dateObj.startDate, preStartDate: this.dateObj.startDate,
preEndDate: this.dateObj.endDate, preEndDate: this.dateObj.endDate,
orderType: this.orderType, orderType: this.orderType,
packageId: this.index>0? this.packageMode[this.modeIndex].id:'' packageId: this.index > 0 ? this.packageMode[this.modeIndex].id : ''
}).then(res => { }).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data && res.data.data.length) { if (res.data && res.data.data.length) {
this.couponList = res.data.data; this.couponList = res.data.data;
let list = res.data.data.filter(item => item.isAvailable === 0).map(item=> { let list = res.data.data.filter(item => item.isAvailable === 0)
return {
...item, if (list.length) {
subPrice: item.subPrice || 0
} list = list.map(item => {
}) return {
list.sort((a,b) => b.subPrice - a.subPrice) ...item,
this.useCouponList = list; subPrice: item.subPrice || 0
if(this.useCouponList.length){ }
let i = this.useCouponList.findIndex(item=> item.duration == this.duration) })
this.selectCouponIndex = i>=0? i : 0; list.sort((a, b) => b.subPrice - a.subPrice)
} this.useCouponList = list;
let i = this.useCouponList.findIndex(item => item.duration == this.duration)
this.selectCouponIndex = i >= 0 ? i : 0
}else{
this.useCouponList = list;
this.selectCouponIndex = -1
}
} }
} else if (res.data.code == 401) { } else if (res.data.code == 401) {
this.$refs.loginPop.open(); this.$refs.loginPop.open();
...@@ -828,9 +832,10 @@ ...@@ -828,9 +832,10 @@
url: "/pages/useCoupon/index", url: "/pages/useCoupon/index",
events: { events: {
getSelectData(data) { getSelectData(data) {
if(data.couponId){ if (data.couponId) {
that.selectCouponIndex = that.useCouponList.findIndex(item => item.id === data.couponId) that.selectCouponIndex = that.useCouponList.findIndex(item => item.id === data
}else{ .couponId)
} else {
that.selectCouponIndex = -1 that.selectCouponIndex = -1
} }
that.onComputePrice(); that.onComputePrice();
...@@ -843,9 +848,10 @@ ...@@ -843,9 +848,10 @@
orderMode: that.orderTypeList[that.index].type, orderMode: that.orderTypeList[that.index].type,
preStartDate: that.dateObj.startDate, preStartDate: that.dateObj.startDate,
orderType: that.orderType, orderType: that.orderType,
packageId:that.packageMode[that.modeIndex].id, packageId: that.packageMode[that.modeIndex].id,
preEndDate: that.dateObj.endDate, preEndDate: that.dateObj.endDate,
selectId: that.selectCouponIndex >= 0 ? that.useCouponList[that.selectCouponIndex].id :'' selectId: that.selectCouponIndex >= 0 ? that.useCouponList[that
.selectCouponIndex].id : ''
}) })
} }
}) })
...@@ -860,7 +866,8 @@ ...@@ -860,7 +866,8 @@
storeId: this.roomInfo.storeId, storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id, roomId: this.roomInfo.id,
buyType: this.orderTypeList[this.index].type, buyType: this.orderTypeList[this.index].type,
couponId: this.useCouponList.length && this.selectCouponIndex >= 0 ? this.useCouponList[this.selectCouponIndex].id : '', couponId: this.useCouponList.length && this.selectCouponIndex >= 0 ? this.useCouponList[this
.selectCouponIndex].id : '',
orderType: this.orderType, orderType: this.orderType,
preStartDate: this.dateObj.startDate, preStartDate: this.dateObj.startDate,
preEndDate: this.dateObj.endDate, preEndDate: this.dateObj.endDate,
...@@ -873,10 +880,10 @@ ...@@ -873,10 +880,10 @@
// uni.hideLoading() // uni.hideLoading()
if (res.data.code == 200) { if (res.data.code == 200) {
this.computePriceInfo = res.data.data; this.computePriceInfo = res.data.data;
}else { } else {
uni.showToast({ uni.showToast({
icon:"none", icon: "none",
title:res.data.msg title: res.data.msg
}) })
} }
...@@ -895,20 +902,20 @@ ...@@ -895,20 +902,20 @@
this.index = i this.index = i
this.modeIndex = 0; this.modeIndex = 0;
this.addM = false; this.addM = false;
this.distanceIndex = this.orderType == 2? 1: 0; this.distanceIndex = this.orderType == 2 ? 1 : 0;
this.setStartTime = { this.setStartTime = {
status:false, status: false,
startTime:'', startTime: '',
startDate:'', startDate: '',
duration:0, duration: 0,
days:1 days: 1
} }
// if(Number(this.startTime.split(":")[0])< new Date().getHours()){ // if(Number(this.startTime.split(":")[0])< new Date().getHours()){
// this.days = 2 // this.days = 2
// }else{ // }else{
// this.days =1 // this.days =1
// } // }
this.days =1 this.days = 1
// this.checkedDateList= [0,0] // this.checkedDateList= [0,0]
// this.onSetEndTime(); // this.onSetEndTime();
this.onGetSortDistance(); this.onGetSortDistance();
...@@ -919,39 +926,40 @@ ...@@ -919,39 +926,40 @@
this.selectCouponIndex = -1; this.selectCouponIndex = -1;
this.useDateStatus = true; 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;
let duration = Number(this.packageMode[this.modeIndex].duration); let duration = Number(this.packageMode[this.modeIndex].duration);
let start = Number(this.startTime.split(":")[0]) let start = Number(this.startTime.split(":")[0])
let startM = Number(this.startTime.split(":")[1]) let startM = Number(this.startTime.split(":")[1])
let h = val; let h = val;
if(val>=24){ if (val >= 24) {
this.setStartTime.days = 2; this.setStartTime.days = 2;
this.days = 2; this.days = 2;
} }
if(val+duration>=24){ if (val + duration >= 24) {
h = val+duration-24 h = val + duration - 24
} else{ } else {
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}`;
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
let endTimeM = 0 let endTimeM = 0
if(this.dateIntervalList[index].status ==1){ if (this.dateIntervalList[index].status == 1) {
endTimeM = moment(this.dateIntervalList[index].startHoldTime).format('mm') endTimeM = moment(this.dateIntervalList[index].startHoldTime).format('mm')
} }
if((this.dateIntervalList[index].status === 1 && index > val && index < val+duration) || if ((this.dateIntervalList[index].status === 1 && index > val && index < val + duration) ||
(this.dateIntervalList[index].status === 1 && index == val+duration && Number(startM)>= Number(endTimeM))){ (this.dateIntervalList[index].status === 1 && index == val + duration && Number(
startM) >= Number(endTimeM))) {
this.useDateStatus = false this.useDateStatus = false
} }
}else{ } else {
status = this.dateIntervalList[index].status status = this.dateIntervalList[index].status
} }
return { return {
...@@ -964,13 +972,14 @@ ...@@ -964,13 +972,14 @@
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);
this.onGetUseCoupon() this.onGetUseCoupon()
},1000) }, 1000)
} }
}) })
}else{ } else {
this.dateObj = this.onSetDateTime(this.startTime, this.endTime); this.dateObj = this.onSetDateTime(this.startTime, this.endTime);
this.onGetUseCoupon(); this.onGetUseCoupon();
} }
...@@ -994,13 +1003,13 @@ ...@@ -994,13 +1003,13 @@
onDateChange(k) { onDateChange(k) {
if (this.orderType == 2) return; if (this.orderType == 2) return;
if (this.dateIndex === k) return; if (this.dateIndex === k) return;
listSortDistance({ listSortDistance({
storeId: this.roomInfo.storeId, storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id, roomId: this.roomInfo.id,
day: this.dateList[k].readDate, day: this.dateList[k].readDate,
orderType:this.orderType orderType: this.orderType
}).then(res=>{ }).then(res => {
// 今天可连续选择的时段 // 今天可连续选择的时段
let selectNum = 0; let selectNum = 0;
//预定节点 //预定节点
...@@ -1010,63 +1019,65 @@ ...@@ -1010,63 +1019,65 @@
let ms = 0; let ms = 0;
let endDate = "" let endDate = ""
// 查询有无可预定的时段 // 查询有无可预定的时段
let todaySelectStatus = false; let todaySelectStatus = false;
res.data.data.forEach((val,i)=>{ res.data.data.forEach((val, i) => {
if(val.status ==1 && moment(val.endHoldTime).format('mm')<59 && selectNum == 0){ if (val.status == 1 && moment(val.endHoldTime).format('mm') < 59 && selectNum ==
startDate = moment(val.endHoldTime).format("YYYY-MM-DD HH:mm:ss") 0) {
selectNum += 1 startDate = moment(val.endHoldTime).format("YYYY-MM-DD HH:mm:ss")
t = i selectNum += 1
} else if(val.status ==1 && selectNum > 0 ){ t = i
let start = moment(startDate).valueOf() } else if (val.status == 1 && selectNum > 0) {
let end = moment(val.startHoldTime).valueOf() let start = moment(startDate).valueOf()
if(end-start >this.duration*60*60*1000){ let end = moment(val.startHoldTime).valueOf()
todaySelectStatus = true; if (end - start > this.duration * 60 * 60 * 1000) {
} else { todaySelectStatus = true;
startDate = '' } else {
selectNum = 0 startDate = ''
endDate = "" selectNum = 0
t = -1 endDate = ""
} t = -1
} else if(selectNum == 0 && !val.status){ }
startDate = val.timeHour+":00:00"; } else if (selectNum == 0 && !val.status) {
selectNum+=1 startDate = val.timeHour + ":00:00";
t = i selectNum += 1
}else if(selectNum>0 && !val.status){ t = i
// 计算时长 } else if (selectNum > 0 && !val.status) {
let start = moment(startDate).valueOf() // 计算时长
endDate = endDate? moment(endDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") : moment(startDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") let start = moment(startDate).valueOf()
let end = moment(endDate).valueOf() endDate = endDate ? moment(endDate).add(1, 'h').format("YYYY-MM-DD HH:mm:ss") :
moment(startDate).add(1, 'h').format("YYYY-MM-DD HH:mm:ss")
if(end-start > this.duration*60*60*1000){ let end = moment(endDate).valueOf()
todaySelectStatus = true;
} else { if (end - start > this.duration * 60 * 60 * 1000) {
selectNum+=1 todaySelectStatus = true;
} } else {
} selectNum += 1
}
}
}) })
if((todaySelectStatus && t >=24) || !todaySelectStatus ){ if ((todaySelectStatus && t >= 24) || !todaySelectStatus) {
uni.showToast({ uni.showToast({
icon:"none", icon: "none",
title:"当前日期无可预约时段" title: "当前日期无可预约时段"
}) })
return; return;
} }
this.dateIndex = k this.dateIndex = k
this.selectCouponIndex = -1 this.selectCouponIndex = -1
this.addM = false; this.addM = false;
this.onGetSortDistance() this.onGetSortDistance()
}) })
}, },
// 开始选择时间 // 开始选择时间
onSelectDate() { onSelectDate() {
if (this.orderType === 2) return; if (this.orderType === 2) return;
if (!this.checkedIndex.length) { if (!this.checkedIndex.length) {
let arr = this.startTime.split(":").map((item,k)=>{ let arr = this.startTime.split(":").map((item, k) => {
let n = Number(item) let n = Number(item)
if(k === 0 && this.dateIndex === 0){ if (k === 0 && this.dateIndex === 0) {
n = this.hourList.findIndex(val => Number(val) === n) n = this.hourList.findIndex(val => Number(val) === n)
} }
return n return n
...@@ -1097,7 +1108,7 @@ ...@@ -1097,7 +1108,7 @@
}, },
// 选择完时间 // 选择完时间
onSelectedDate() { onSelectedDate() {
this.checkedDateList = this.checkedIndex.length?this.checkedIndex.map(item=>Number(item)):[0,0]; this.checkedDateList = this.checkedIndex.length ? this.checkedIndex.map(item => Number(item)) : [0, 0];
this.startTime = `${this.hourList[this.checkedDateList[0]]}:${this.minuteList[this.checkedDateList[1]]}`; this.startTime = `${this.hourList[this.checkedDateList[0]]}:${this.minuteList[this.checkedDateList[1]]}`;
this.$forceUpdate(); this.$forceUpdate();
//重新设置结束时间 //重新设置结束时间
...@@ -1132,26 +1143,26 @@ ...@@ -1132,26 +1143,26 @@
onCancle() { onCancle() {
this.$refs.confirmPop.close(); this.$refs.confirmPop.close();
}, },
onOrderConfirmBefore(){ onOrderConfirmBefore() {
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: [ tmplIds: [
'UkvsRnZkZB_w3MqXPbRhi4jEk8ML4N9PWT3rnd3Bhxg', 'UkvsRnZkZB_w3MqXPbRhi4jEk8ML4N9PWT3rnd3Bhxg',
], ],
success: (res) => { success: (res) => {
}, },
complete: (res) => { complete: (res) => {
console.log(res,909090) console.log(res, 909090)
// this.$refs.confirmPop.open(); // this.$refs.confirmPop.open();
this.onOrderConfirm(); this.onOrderConfirm();
} }
}) })
}, },
onOrderConfirm() { onOrderConfirm() {
if(this.roomInfo.roomStat >=3){ if (this.roomInfo.roomStat >= 3) {
uni.showToast({ uni.showToast({
icon:"none", icon: "none",
title:'当前房间维护中,无法预定,请选择其他房间' title: '当前房间维护中,无法预定,请选择其他房间'
}) })
return; return;
} }
...@@ -1162,27 +1173,30 @@ ...@@ -1162,27 +1173,30 @@
// }) // })
// return; // return;
// } // }
let nowDate = moment().format("MMDD") let nowDate = moment().format("MMDD")
let nowTime = moment().format("HHmm") let nowTime = moment().format("HHmm")
let setDate = moment(this.dateObj.startDate).format("MMDD"); let setDate = moment(this.dateObj.startDate).format("MMDD");
let setTime = moment(this.dateObj.startDate).format("HHmm"); let setTime = moment(this.dateObj.startDate).format("HHmm");
// 如果当前时间大于开始时间,则不允许下单 // 如果当前时间大于开始时间,则不允许下单
if(this.orderType ==1 && nowDate == setDate && nowTime > setTime){ if (this.orderType == 1 && nowDate == setDate && nowTime > setTime) {
uni.showToast({ uni.showToast({
icon:"none", icon: "none",
title:"当前时间晚于预约开始时间,请重新选择预约时间" title: "当前时间晚于预约开始时间,请重新选择预约时间"
}) })
return return
} }
if(this.orderTypeList[this.index].type ===2){ 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 ){ if (this.packageMode[this.modeIndex].packaEndPeriod - this.packageMode[this.modeIndex]
this.content=`所选套餐为限时套餐,订单结束时间为当日${Number(this.packageMode[this.modeIndex].packaEndPeriod)>=10?this.packageMode[this.modeIndex].packaEndPeriod:'0'+this.packageMode[this.modeIndex].packaEndPeriod}:00,请注意下单结束时间!` .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() this.$refs.popupConfirm.open()
return return
} }
...@@ -1196,10 +1210,10 @@ ...@@ -1196,10 +1210,10 @@
} }
this.$refs.confirmPop.open(); this.$refs.confirmPop.open();
}, },
close(){ close() {
this.$refs.popupConfirm.close() this.$refs.popupConfirm.close()
}, },
confirm(){ confirm() {
this.close() this.close()
if (!this.useDateStatus) { if (!this.useDateStatus) {
uni.showToast({ uni.showToast({
...@@ -1210,17 +1224,17 @@ ...@@ -1210,17 +1224,17 @@
} }
this.$refs.confirmPop.open(); this.$refs.confirmPop.open();
}, },
onOrder(){ onOrder() {
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: [ tmplIds: [
'HB2_moQRQrXC2cKw6zE08FF8UZJ5ue1h_qXZhvOkacc', 'HB2_moQRQrXC2cKw6zE08FF8UZJ5ue1h_qXZhvOkacc',
'K8fbcKVq46w9o7Ekpesn70wK3mYjXqdSfFUth4AufqU' 'K8fbcKVq46w9o7Ekpesn70wK3mYjXqdSfFUth4AufqU'
], ],
success: (res) => { success: (res) => {
}, },
complete: (res) => { complete: (res) => {
console.log(res,909090) console.log(res, 909090)
// this.$refs.confirmPop.open(); // this.$refs.confirmPop.open();
this.onOrderCreate(); this.onOrderCreate();
} }
...@@ -1237,7 +1251,8 @@ ...@@ -1237,7 +1251,8 @@
orderType: this.orderType, orderType: this.orderType,
buyType: this.orderTypeList[this.index].type, buyType: this.orderTypeList[this.index].type,
payType: 1, payType: 1,
couponId: this.useCouponList.length && this.selectCouponIndex >=0 ? this.useCouponList[this.selectCouponIndex].id : '', couponId: this.useCouponList.length && this.selectCouponIndex >= 0 ? this.useCouponList[this
.selectCouponIndex].id : '',
preStartDate: this.dateObj.startDate, preStartDate: this.dateObj.startDate,
preEndDate: this.dateObj.endDate, preEndDate: this.dateObj.endDate,
totalFee: Number(this.roomInfo.price) * this.duration, totalFee: Number(this.roomInfo.price) * this.duration,
...@@ -1274,19 +1289,19 @@ ...@@ -1274,19 +1289,19 @@
}) })
}, },
"fail": (resp) => { "fail": (resp) => {
console.log(resp,"支付失败") console.log(resp, "支付失败")
// 取消支付或支付失败 // 取消支付或支付失败
uni.showToast({ uni.showToast({
title: "取消支付" title: "取消支付"
}) })
orderCancelPay({ orderCancelPay({
orderNo:res.data.data.orderNo orderNo: res.data.data.orderNo
}).then(res=>{ }).then(res => {
console.log(res) console.log(res)
}) })
}, },
"complete": (resp) => { "complete": (resp) => {
console.log(resp,"支付完成") console.log(resp, "支付完成")
// 接口调用结束的回调函数(调用成功、失败都会执行) // 接口调用结束的回调函数(调用成功、失败都会执行)
} }
}); });
...@@ -1309,7 +1324,7 @@ ...@@ -1309,7 +1324,7 @@
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: res.data.msg || "下单失败", title: res.data.msg || "下单失败",
duration:2000, duration: 2000,
success: () => { success: () => {
// setTimeout(()=>{ // setTimeout(()=>{
// this.onGetSortDistance() // this.onGetSortDistance()
...@@ -1356,68 +1371,68 @@ ...@@ -1356,68 +1371,68 @@
}) })
}, },
onSelectDatePoint(val, i) { onSelectDatePoint(val, i) {
if(this.orderType == 2) return; if (this.orderType == 2) return;
if(i>=24) { if (i >= 24) {
uni.showToast({ uni.showToast({
icon:"none", icon: "none",
title:'预约次日时段,请先选择日期' title: '预约次日时段,请先选择日期'
}) })
return return
} }
let time = i; let time = i;
if(i>=24){ if (i >= 24) {
time = i-24; time = i - 24;
if(this.dateIndex === 0){ if (this.dateIndex === 0) {
this.dateIndex+=1; this.dateIndex += 1;
} }
} }
if ( val.endHoldTime ) { if (val.endHoldTime) {
let mTime = Number(moment(val.endHoldTime).format("mm")) let mTime = Number(moment(val.endHoldTime).format("mm"))
if (mTime >= 59) { if (mTime >= 59) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '当前时段不可预定' title: '当前时段不可预定'
}) })
return; return;
} else { } else {
this.startTime = `${time>=10?time:'0'+time}:${mTime>=10?mTime:'0'+mTime}`; this.startTime = `${time>=10?time:'0'+time}:${mTime>=10?mTime:'0'+mTime}`;
if(time >= 0){ if (time >= 0) {
// 开始时间加一分钟 // 开始时间加一分钟
let arr = this.startTime.split(":"); let arr = this.startTime.split(":");
let m = Number(arr[1])+1 let m = Number(arr[1]) + 1
let h = Number(arr[0]) let h = Number(arr[0])
this.startTime = `${h>=10?h:'0'+h}:${m>=10?m:'0'+m}` this.startTime = `${h>=10?h:'0'+h}:${m>=10?m:'0'+m}`
}
this.endTime = this.startTime.split(":").map((item,k)=>{
let n = Number(item);
if(k==0){
n = n+this.duration>=24? n+this.duration-24:n+this.duration
}
return n>=10? n: `0${n}`
}).join(":")
} }
} else { this.endTime = this.startTime.split(":").map((item, k) => {
this.startTime = `${time>=10?time:'0'+time}:00`;
this.endTime = this.startTime.split(":").map((item,k)=>{
let n = Number(item); let n = Number(item);
if(k==0){ if (k == 0) {
n = n+this.duration >=24 ? n+this.duration-24: n+this.duration n = n + this.duration >= 24 ? n + this.duration - 24 : n + this.duration
} }
return n>=10? n: `0${n}` return n >= 10 ? n : `0${n}`
}).join(":") }).join(":")
}
} else {
this.startTime = `${time>=10?time:'0'+time}:00`;
this.endTime = this.startTime.split(":").map((item, k) => {
let n = Number(item);
if (k == 0) {
n = n + this.duration >= 24 ? n + this.duration - 24 : n + this.duration
}
return n >= 10 ? n : `0${n}`
}).join(":")
} }
this.dateObj = this.onSetDateTime(this.startTime, this.endTime); this.dateObj = this.onSetDateTime(this.startTime, this.endTime);
this.onGetUseCoupon(); this.onGetUseCoupon();
this.useDateStatus = true; 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) {
this.useDateStatus = false; this.useDateStatus = false;
} }
}else{ } else {
status = this.dateIntervalList[index].status status = this.dateIntervalList[index].status
} }
return { return {
...@@ -1440,13 +1455,13 @@ ...@@ -1440,13 +1455,13 @@
} }
let startArr = startTime.split(":") let startArr = startTime.split(":")
let endArr = endTime.split(":") let endArr = endTime.split(":")
obj.startDate = `${this.dateList[this.dateIndex].readDate} ${startTime}:00` obj.startDate = `${this.dateList[this.dateIndex].readDate} ${startTime}:00`
if ((this.orderType == 1 && Number(endArr[0]) <= Number(startArr[0]))) { if ((this.orderType == 1 && Number(endArr[0]) <= Number(startArr[0]))) {
obj.endDate = obj.endDate =
`${moment(obj.startDate).add(1,"days").format("YYYY-MM-DD")} ${endTime}:00` `${moment(obj.startDate).add(1,"days").format("YYYY-MM-DD")} ${endTime}:00`
}else if(this.orderType == 2 && Number(endArr[0]) < Number(startArr[0])) { } else if (this.orderType == 2 && Number(endArr[0]) < Number(startArr[0])) {
obj.endDate = obj.endDate =
`${moment(obj.startDate).add(1,"days").format("YYYY-MM-DD")} ${endTime}:00` `${moment(obj.startDate).add(1,"days").format("YYYY-MM-DD")} ${endTime}:00`
} else { } else {
...@@ -1454,86 +1469,87 @@ ...@@ -1454,86 +1469,87 @@
} }
return obj; return obj;
}, },
onCheckDate(){ onCheckDate() {
// 今天可连续选择的时段 // 今天可连续选择的时段
let selectNum = 0; let selectNum = 0;
//预定节点 //预定节点
let t = -1; let t = -1;
//预定开始时间 //预定开始时间
let startDate = ''; let startDate = '';
let ms = 0; let ms = 0;
let endDate = "" let endDate = ""
// 查询有无可预定的时段 // 查询有无可预定的时段
let todaySelectStatus = false; let todaySelectStatus = false;
this.dateIntervalList.forEach((val,i)=>{ this.dateIntervalList.forEach((val, i) => {
if(val.status ==1 && moment(val.endHoldTime).format('mm')<59 && selectNum == 0){ if (val.status == 1 && moment(val.endHoldTime).format('mm') < 59 && selectNum == 0) {
startDate = moment(val.endHoldTime).format("YYYY-MM-DD HH:mm:ss") startDate = moment(val.endHoldTime).format("YYYY-MM-DD HH:mm:ss")
selectNum += 1 selectNum += 1
t = i t = i
} else if(val.status ==1 && selectNum > 0 ){ } else if (val.status == 1 && selectNum > 0) {
let start = moment(startDate).valueOf() let start = moment(startDate).valueOf()
let end = moment(val.startHoldTime).valueOf() let end = moment(val.startHoldTime).valueOf()
if(end-start >this.duration*60*60*1000){ if (end - start > this.duration * 60 * 60 * 1000) {
todaySelectStatus = true; todaySelectStatus = true;
} else { } else {
startDate = '' startDate = ''
selectNum = 0 selectNum = 0
endDate = "" endDate = ""
t = -1 t = -1
} }
} else if(selectNum == 0 && !val.status){ } else if (selectNum == 0 && !val.status) {
startDate =val.timeHour+":00:00"; startDate = val.timeHour + ":00:00";
selectNum+=1 selectNum += 1
t = i t = i
}else if(selectNum>0 && !val.status){ } else if (selectNum > 0 && !val.status) {
// 计算时长 // 计算时长
let start = moment(startDate).valueOf() let start = moment(startDate).valueOf()
endDate = endDate? moment(endDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") : moment(startDate).add(1,'h').format("YYYY-MM-DD HH:mm:ss") endDate = endDate ? moment(endDate).add(1, 'h').format("YYYY-MM-DD HH:mm:ss") : moment(
let end = moment(endDate).valueOf() startDate).add(1, 'h').format("YYYY-MM-DD HH:mm:ss")
if(end-start > this.duration*60*60*1000){ let end = moment(endDate).valueOf()
todaySelectStatus = true; if (end - start > this.duration * 60 * 60 * 1000) {
} else { todaySelectStatus = true;
selectNum+=1 } else {
} selectNum += 1
} }
}
}) })
if((todaySelectStatus && t >=24) || !todaySelectStatus ){ if ((todaySelectStatus && t >= 24) || !todaySelectStatus) {
if(this.dateIndex>=this.dateList.length-1){ if (this.dateIndex >= this.dateList.length - 1) {
this.onInitDateList() this.onInitDateList()
}else{ } else {
this.dateIndex+=1; this.dateIndex += 1;
} }
//房间维护就不循环 //房间维护就不循环
if(this.roomInfo.roomStat !==3){ if (this.roomInfo.roomStat !== 3) {
this.onGetSortDistance(); this.onGetSortDistance();
} }
return; return;
}else{ } else {
let startDateTime= ""; let startDateTime = "";
if(!this.addM && (t != 0 || (t==0 && this.dateIntervalList[0].status==1))){ if (!this.addM && (t != 0 || (t == 0 && this.dateIntervalList[0].status == 1))) {
this.addM = true this.addM = true
startDateTime = moment(startDate).add(1,"m").format("YYYY-MM-DD"); startDateTime = moment(startDate).add(1, "m").format("YYYY-MM-DD");
this.startTime = moment(startDate).add(1,"m").format("HH:mm"); this.startTime = moment(startDate).add(1, "m").format("HH:mm");
} else{ } else {
startDateTime = moment(startDate).format("YYYY-MM-DD"); startDateTime = moment(startDate).format("YYYY-MM-DD");
this.startTime = moment(startDate).format("HH:mm"); this.startTime = moment(startDate).format("HH:mm");
} }
let i = this.dateList.findIndex(item => item.readDate === startDateTime) let i = this.dateList.findIndex(item => item.readDate === startDateTime)
if(this.dateIndex !== i && this.dateIndex>=0){ if (this.dateIndex !== i && this.dateIndex >= 0) {
this.dateIndex = i; this.dateIndex = i;
//房间维护就不循环 //房间维护就不循环
if(this.roomInfo.roomStat !==3){ if (this.roomInfo.roomStat !== 3) {
this.onGetSortDistance(); this.onGetSortDistance();
}
return;
} }
this.onSetEndTime() return;
}
this.onSetEndTime()
} }
} }
} }
...@@ -1583,7 +1599,8 @@ ...@@ -1583,7 +1599,8 @@
display: block; display: block;
width: 100%; width: 100%;
border-radius: 6upx; border-radius: 6upx;
overflow: hidden; overflow: hidden;
image { image {
display: block; display: block;
width: 100%; width: 100%;
...@@ -1640,53 +1657,60 @@ ...@@ -1640,53 +1657,60 @@
} }
} }
.tab-box {
.tab-box {
display: flex;
flex-direction: row;
justify-content: center;
width: 92%;
margin: 20upx 0 30upx;
background: #ffffff;
border-radius: 10upx;
overflow: hidden;
.tab-item {
position: relative;
display: flex; display: flex;
flex-direction: row; flex: 1;
justify-content: center; justify-content: center;
width: 92%; align-items: center;
margin: 20upx 0 30upx; height: 80upx;
background: #ffffff;
border-radius: 10upx;
overflow: hidden;
.tab-item { text {
color: #000000;
font-size: 34upx;
font-weight: 700;
}
.hot-icon {
position: relative; position: relative;
display: flex; height: 40upx;
flex: 1;
justify-content: center; .img-icon {
align-items: center; position: absolute;
height: 80upx; top: -4upx;
text { left: 4upx;
color: #000000; width: 46upx;
font-size: 34upx;
font-weight: 700; image {
} width: 100%;
.hot-icon{
position: relative;
height: 40upx;
.img-icon{
position: absolute;
top: -4upx;
left: 4upx;
width: 46upx;
image{
width: 100%;
}
} }
} }
} }
}
.active {
background-color: #dc4397; .active {
text { background-color: #dc4397;
color: #ffffff;
font-weight: 800; text {
} color: #ffffff;
font-weight: 800;
} }
} }
}
.order-type-box { .order-type-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -1694,8 +1718,9 @@ ...@@ -1694,8 +1718,9 @@
min-height: 600upx; min-height: 600upx;
overflow: hidden; overflow: hidden;
border: 4upx solid #DC4397; border: 4upx solid #DC4397;
box-shadow: 0 0 8upx #DC4397; box-shadow: 0 0 8upx #DC4397;
border-radius: 12upx 12upx 0 0; border-radius: 12upx 12upx 0 0;
.date-content-box { .date-content-box {
width: 100%; width: 100%;
background-color: #FFF7F5; background-color: #FFF7F5;
...@@ -1763,6 +1788,7 @@ ...@@ -1763,6 +1788,7 @@
.package-mode { .package-mode {
padding: 0 0 30upx; padding: 0 0 30upx;
border-bottom: 2upx solid #F1F1F1; border-bottom: 2upx solid #F1F1F1;
.part-1 { .part-1 {
margin: 30upx; margin: 30upx;
} }
...@@ -1813,11 +1839,12 @@ ...@@ -1813,11 +1839,12 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
.cu-tag{
.cu-tag {
padding: 4upx 16upx; padding: 4upx 16upx;
border-radius: 20upx; border-radius: 20upx;
} }
} }
} }
...@@ -2136,7 +2163,8 @@ ...@@ -2136,7 +2163,8 @@
} }
} }
} }
.tip-box{
.tip-box {
padding: 12upx; padding: 12upx;
border: 4upx solid #DBA556; border: 4upx solid #DBA556;
border-radius: 12upx; border-radius: 12upx;
...@@ -2145,10 +2173,12 @@ ...@@ -2145,10 +2173,12 @@
color: #B67D32; color: #B67D32;
// font-size: 24upx; // font-size: 24upx;
} }
.scroll-view{
.scroll-view {
height: 136upx; height: 136upx;
width: 100vw; width: 100vw;
.package-box{
.package-box {
position: absolute; position: absolute;
top: 0; top: 0;
left: 2vw; left: 2vw;
...@@ -2156,28 +2186,33 @@ ...@@ -2156,28 +2186,33 @@
width: 96vw; width: 96vw;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
.item{
.item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
height: 100%; height: 100%;
.text-title{
.text-title {
font-size: 28upx; font-size: 28upx;
} }
.flex-row{
.flex-row {
// font-size: 23upx; // font-size: 23upx;
} }
} }
} }
} }
.message-box{
.message-box {
display: flex; display: flex;
width: 80%; width: 80%;
background-color: #ffffff; background-color: #ffffff;
border-radius: 12upx; border-radius: 12upx;
overflow: hidden; overflow: hidden;
margin: 0 auto; margin: 0 auto;
.header{
.header {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
...@@ -2185,7 +2220,8 @@ ...@@ -2185,7 +2220,8 @@
height: 90upx; height: 90upx;
border-bottom: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5;
} }
.content{
.content {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
...@@ -2193,12 +2229,14 @@ ...@@ -2193,12 +2229,14 @@
border-bottom: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5;
padding: 0 30upx; padding: 0 30upx;
} }
.button-box{
.button-box {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 90upx; height: 90upx;
text{
text {
color: #55aaff; color: #55aaff;
} }
} }
......
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
<text class="text-black">可用时段:</text> <text class="text-black">可用时段:</text>
<text class="text-black">{{item.couponTimeStart}}-{{item.couponTimeEnd}}</text> <text class="text-black">{{item.couponTimeStart}}-{{item.couponTimeEnd}}</text>
</view> </view>
<text>{{item.platformType==2?'美团核销':''}}</text> <text>{{platformEnum[item.platformType]}}</text>
</view> </view>
<view v-else class="des margin-top"> <view v-else class="des margin-top">
<text class="">全天通用</text> <text class="">全天通用</text>
<text>{{item.platformType==2?'美团核销':''}}</text> <text>{{platformEnum[item.platformType]}}</text>
</view> </view>
</view> </view>
...@@ -62,12 +62,12 @@ ...@@ -62,12 +62,12 @@
</template> </template>
<script> <script>
import {dictList} from "@/api/index.js";
import {getDictItem} from "@/utils/tools.js"
import config from "@/config/index.config" import config from "@/config/index.config"
import indexConfig from "@/config/index.config"; import indexConfig from "@/config/index.config";
import FixedHeader from "@/components/fixedHeader/index"; import FixedHeader from "@/components/fixedHeader/index";
import { import {getUseCoupon} from "@/api/coupon"
getUseCoupon
} from "@/api/coupon"
export default { export default {
data() { data() {
...@@ -90,13 +90,15 @@ ...@@ -90,13 +90,15 @@
tipText: "", tipText: "",
show: false, show: false,
eventChannel: null, eventChannel: null,
selectId: '' selectId: '',
platformEnum:{}
}; };
}, },
components: { components: {
'fixed-header': FixedHeader 'fixed-header': FixedHeader
}, },
onLoad() { onLoad() {
this.onGetDicts();
this.eventChannel = this.getOpenerEventChannel(); this.eventChannel = this.getOpenerEventChannel();
// eventChannel.emit('acceptDataFromOpenedPage', {data: 'data from test page'}); // eventChannel.emit('acceptDataFromOpenedPage', {data: 'data from test page'});
...@@ -106,6 +108,24 @@ ...@@ -106,6 +108,24 @@
}) })
}, },
methods: { methods: {
onGetDicts() {
let dicts = []
let dictStr = uni.getStorageSync('dicts')
if (dictStr) {
let dicts = JSON.parse(dictStr)
this.platformEnum = getDictItem(dicts, "consumer_coupon_platform_type");
this.couponSourceEnum = getDictItem(dicts, "consumer_coupon_source_type");
this.$forceUpdate()
}
dictList().then(res => {
dicts = res.data.data;
uni.setStorageSync('dicts', JSON.stringify(res.data.data))
this.platformEnum = getDictItem(dicts, "consumer_coupon_platform_type");
this.couponSourceEnum = getDictItem(dicts, "consumer_coupon_source_type");
this.$forceUpdate()
})
},
onLoading(d) { onLoading(d) {
getUseCoupon(d).then(res => { getUseCoupon(d).then(res => {
if (res.statusCode == 200) { if (res.statusCode == 200) {
......
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