|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<mNavbar title="服务时间" :leftClick="leftClick"> |
|
|
|
</mNavbar> |
|
|
|
|
|
|
|
|
|
|
|
<view class="box"> |
|
|
|
<van-dropdown-menu> |
|
|
|
<van-dropdown-item @change='changeServer' v-model="serviceTitle" :options="techniService" /> |
|
|
@ -30,8 +30,9 @@ |
|
|
|
|
|
|
|
<view class="time-list" v-else-if="timeList.length"> |
|
|
|
|
|
|
|
<view :class="{'time-item' : true , no : !item.timeOut && item.isDelete == 'Y' , timeOut : item.timeout }" v-for="(item, index) in timeList" |
|
|
|
@click="selectTime({time : item, date : dateList[i]})"> |
|
|
|
<view |
|
|
|
:class="{'time-item' : true , no : !item.timeOut && item.isDelete == 'Y' , timeOut : item.timeout }" |
|
|
|
v-for="(item, index) in timeList" @click="selectTime({time : item, date : dateList[i]})"> |
|
|
|
<van-checkbox-group v-model="checked"> |
|
|
|
<view v-if="multipleChoice" class="checked"> |
|
|
|
<van-checkbox :name="item.id" :disabled="item.timeout"></van-checkbox> |
|
|
@ -45,53 +46,50 @@ |
|
|
|
</van-checkbox-group> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<van-empty v-else image="/static/empty/data.png" image-size="400rpx" description="无数据请上线初始化"/> |
|
|
|
|
|
|
|
<van-empty v-else image="/static/empty/data.png" image-size="400rpx" description="无数据请上线初始化" /> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view v-show="serviceTitle == 1" class="project"> |
|
|
|
<view v-if="projectList.length > 0" class="server-list"> |
|
|
|
<van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" ref="list" |
|
|
|
@load="onLoad"> |
|
|
|
<van-checkbox-group v-model="checked"> |
|
|
|
<view v-for="item in projectList" class="server-item"> |
|
|
|
<view v-if="multipleChoice" class="checked"> |
|
|
|
<van-checkbox :name="item.shopObject.id"></van-checkbox> |
|
|
|
</view> |
|
|
|
<view class="img-box"> |
|
|
|
<image :src="item.shopObject.image" mode="aspectFill"></image> |
|
|
|
<van-checkbox-group v-model="checked"> |
|
|
|
<view v-for="item in projectList" class="server-item"> |
|
|
|
<view v-if="multipleChoice" class="checked"> |
|
|
|
<van-checkbox :name="item.id"></van-checkbox> |
|
|
|
</view> |
|
|
|
<view class="img-box"> |
|
|
|
<image :src="item.shopObject.image" mode="aspectFill"></image> |
|
|
|
</view> |
|
|
|
<view class="server-info"> |
|
|
|
<view class="server-title">{{ item.shopObject.title }}</view> |
|
|
|
<view class="time-coupon"> |
|
|
|
<image src="@/static/home/time-icon.png"></image> |
|
|
|
<view class="time">{{ item.shopObject.times }}分钟</view> |
|
|
|
</view> |
|
|
|
<view class="server-info"> |
|
|
|
<view class="server-title">{{ item.shopObject.title }}</view> |
|
|
|
<view class="time-coupon"> |
|
|
|
<image src="@/static/home/time-icon.png"></image> |
|
|
|
<view class="time">{{ item.shopObject.times }}分钟</view> |
|
|
|
</view> |
|
|
|
<view class="price"> |
|
|
|
<view class="current-price"> |
|
|
|
<text class="unit">¥</text>{{ item.shopObject.price }} |
|
|
|
</view> |
|
|
|
<view class="original-price"> |
|
|
|
<text class="unit">¥</text>{{ item.shopObject.oldPrice }} |
|
|
|
</view> |
|
|
|
<view class="price"> |
|
|
|
<view class="current-price"> |
|
|
|
<text class="unit">¥</text>{{ item.shopObject.price }} |
|
|
|
</view> |
|
|
|
<view class="sales-volume"> |
|
|
|
<image src="@/static/icons/icon1.png"></image> |
|
|
|
<view class="desc">已售出{{ item.shopObject.payNum }}+单</view> |
|
|
|
<view class="original-price"> |
|
|
|
<text class="unit">¥</text>{{ item.shopObject.oldPrice }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="selective-technician"> |
|
|
|
<view @click.stop="selectProject(item)" class="btn"> |
|
|
|
{{ item.isDelete == 'Y' ? '取消项目' : '选择项目'}} |
|
|
|
</view> |
|
|
|
<view class="sales-volume"> |
|
|
|
<image src="@/static/icons/icon1.png"></image> |
|
|
|
<view class="desc">已售出{{ item.shopObject.payNum }}+单</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</van-checkbox-group> |
|
|
|
</van-list> |
|
|
|
<view class="selective-technician"> |
|
|
|
<view @click.stop="selectProject(item)" class="btn"> |
|
|
|
{{ item.isDelete == 'Y' ? '取消项目' : '选择项目'}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</van-checkbox-group> |
|
|
|
</view> |
|
|
|
|
|
|
|
<van-empty v-else image="/static/empty/data.png" image-size="400rpx" description="无数据请上线初始化"/> |
|
|
|
|
|
|
|
<van-empty v-else image="/static/empty/data.png" image-size="400rpx" description="无数据请上线初始化" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
@ -140,23 +138,23 @@ |
|
|
|
value: 3 |
|
|
|
} |
|
|
|
], |
|
|
|
today : null, |
|
|
|
selDate : null, |
|
|
|
isInit : false |
|
|
|
today: null, |
|
|
|
selDate: null, |
|
|
|
isInit: false |
|
|
|
}; |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
if(this.dateList.length >= 7) return; //防止多次添加日期,onShow这个钩子每次离开页面然后回来都会调用一下 |
|
|
|
if (this.dateList.length >= 7) return; //防止多次添加日期,onShow这个钩子每次离开页面然后回来都会调用一下 |
|
|
|
this.today = this.dayjs() |
|
|
|
this.dateList.push(this.today) |
|
|
|
for (let i = 1; i < 7; i++) { |
|
|
|
this.dateList.push(this.today.add(i, 'day')) |
|
|
|
} |
|
|
|
this.selectDate(this.today,0) |
|
|
|
this.selectDate(this.today, 0) |
|
|
|
this.getProjectList() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
|
|
// 选择日期 |
|
|
|
selectDate(item, index) { |
|
|
|
this.i = index |
|
|
@ -167,9 +165,12 @@ |
|
|
|
}, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
res.result.forEach(time => { |
|
|
|
if(this.isFormerly({ time, date : this.dateList[this.i] })){ //判断时间是否超时了 |
|
|
|
if (this.isFormerly({ |
|
|
|
time, |
|
|
|
date: this.dateList[this.i] |
|
|
|
})) { //判断时间是否超时了 |
|
|
|
time.timeout = true |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
time.timeout = false |
|
|
|
} |
|
|
|
}) |
|
|
@ -179,16 +180,13 @@ |
|
|
|
this.loading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//选择时间 |
|
|
|
selectTime(item) { |
|
|
|
if(item.time.timeout){ //判断是否是过去时间 |
|
|
|
return uni.showToast({ |
|
|
|
title: '选择时间已过时', |
|
|
|
duration: 2000 |
|
|
|
}); |
|
|
|
if (item.time.timeout) { //判断是否是过去时间 |
|
|
|
return uni.showToast({title: '选择时间已过时',icon:'none'}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.multipleChoice) { |
|
|
|
if (this.checked.includes(item.time.id)) { |
|
|
|
this.checked = this.checked.filter(id => id !== item.time.id); |
|
|
@ -199,16 +197,16 @@ |
|
|
|
} |
|
|
|
this.updateTerTime([item.time.id], item.time.isDelete == 'Y' ? 'N' : 'Y'); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//返回个人中心 |
|
|
|
leftClick() { |
|
|
|
uni.switchTab({ |
|
|
|
url: '/pages/index/center' |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//修改上钟时间 |
|
|
|
updateTerTime(selectTimeArr, isDelete) { |
|
|
|
updateTerTime(selectTimeArr, isDelete) { |
|
|
|
let data = { |
|
|
|
ids: selectTimeArr.toString(), |
|
|
|
isDelete |
|
|
@ -216,51 +214,54 @@ |
|
|
|
this.$api('updateTerTime', data, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.selectDate(this.selDate, this.i) |
|
|
|
uni.showToast({title : '操作成功',con : 'none'}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//获取项目列表 |
|
|
|
getProjectList() { |
|
|
|
getProjectList() { |
|
|
|
this.$api('queryTerProject', this.queryParams, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.projectList = res.result; |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//开启或关闭项目 |
|
|
|
updateTerProject(selectTimeArr, isDelete) { |
|
|
|
updateTerProject(selectTimeArr, isDelete) { |
|
|
|
let data = { |
|
|
|
ids: selectTimeArr.toString(), |
|
|
|
isDelete |
|
|
|
} |
|
|
|
this.$api('updateTerProject', data, res => { |
|
|
|
if(res.code == 200){ |
|
|
|
if (res.code == 200) { |
|
|
|
this.getProjectList() |
|
|
|
uni.showToast({title : '操作成功',con : 'none'}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//切换选择 |
|
|
|
changeServer() { |
|
|
|
this.checked = []; //清空已经选择的时间id或项目id |
|
|
|
changeServer() { |
|
|
|
this.checked = []; //清空已经选择的时间id或项目id |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//打开关闭时间、项目 |
|
|
|
operationItem(isOpen) { |
|
|
|
if (this.serviceTitle == 0) { //打开关闭时间 isOpen 是否打开(打开Y 关闭N) |
|
|
|
this.updateTerTime(this.checked, isOpen) |
|
|
|
} else { //打开关闭项目 |
|
|
|
operationItem(isOpen) { //打开关闭项目 |
|
|
|
if (this.serviceTitle) { |
|
|
|
this.updateTerProject(this.checked, isOpen) |
|
|
|
|
|
|
|
} else { //打开关闭时间 isOpen 是否打开(打开Y 关闭N) |
|
|
|
this.updateTerTime(this.checked, isOpen) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//选择项目 |
|
|
|
selectProject(item) { |
|
|
|
selectProject(item) { |
|
|
|
if (this.multipleChoice) { |
|
|
|
if (this.checked.includes(item.id)) { |
|
|
|
this.checked = this.checked.filter( id => id !== item.id); |
|
|
|
this.checked = this.checked.filter(id => id !== item.id); |
|
|
|
} else { |
|
|
|
this.checked.push(item.id); |
|
|
|
} |
|
|
@ -268,7 +269,7 @@ |
|
|
|
} |
|
|
|
this.updateTerProject([item.id], item.isDelete == 'Y' ? 'N' : 'Y') |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//区分不同操作列表不同操作(全选,打开,关闭等) |
|
|
|
change(value) { |
|
|
|
if (value == 0) { |
|
|
@ -279,7 +280,7 @@ |
|
|
|
this.multipleChoice = !this.multipleChoice |
|
|
|
this.operationList[2].text = this.multipleChoice ? '取消多选' : '开启多选' |
|
|
|
this.checked = [] |
|
|
|
|
|
|
|
|
|
|
|
if (this.operationList[3].text == '取消全选') { //取消全选逻辑 |
|
|
|
this.operationList[3].text = '全选' |
|
|
|
} |
|
|
@ -290,46 +291,46 @@ |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.operationList[3].text == '取消全选') { //取消全选逻辑 |
|
|
|
this.operationList[3].text = '全选' |
|
|
|
return this.checked = [] |
|
|
|
} |
|
|
|
|
|
|
|
let arr = [] |
|
|
|
if (this.serviceTitle == 0) { //遍历时间列表 |
|
|
|
if (this.serviceTitle == 0) { //遍历时间列表 |
|
|
|
this.timeList.forEach(time => { |
|
|
|
if(!time.timeout){ //筛选掉已过时的 |
|
|
|
if (!time.timeout) { //筛选掉已过时的 |
|
|
|
arr.push(time.id) |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.projectList.forEach(project => { |
|
|
|
arr.push(project.shopObject.id) |
|
|
|
arr.push(project.id) |
|
|
|
}) |
|
|
|
} |
|
|
|
this.checked = arr |
|
|
|
this.operationList[3].text = '取消全选' |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//项目滑动到底部 |
|
|
|
onLoad(){}, |
|
|
|
|
|
|
|
onLoad() {}, |
|
|
|
|
|
|
|
//判断时间是否为过去时间 |
|
|
|
isFormerly(e){ |
|
|
|
isFormerly(e) { |
|
|
|
let day = e.date.format('YYYY-MM-DD') |
|
|
|
let selectTime = this.dayjs(`${day} ${e.time.timeName}`) |
|
|
|
let nowTime = this.dayjs() |
|
|
|
|
|
|
|
if(selectTime.isBefore(nowTime)){ |
|
|
|
|
|
|
|
if (selectTime.isBefore(nowTime)) { |
|
|
|
return true |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
@ -398,12 +399,12 @@ |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
&.timeOut { |
|
|
|
background: #ccc; |
|
|
|
color: #FFFFFF; |
|
|
|
|
|
|
|
.status{ |
|
|
|
|
|
|
|
.status { |
|
|
|
color: #FFFFFF; |
|
|
|
} |
|
|
|
} |
|
|
|