Compare commits

...

2 Commits

Author SHA1 Message Date
Mr.jiang 657c3fc38f 解决冲突 忙时设置 2024-08-30 16:29:22 +08:00
Mr.jiang fe600b762c 忙时 2024-08-30 16:27:19 +08:00
7 changed files with 725 additions and 193 deletions

View File

@ -757,6 +757,9 @@ export default {
// /deep/.uni-scroll-view-content{
// height: 350px !important;
// }
/deep/.uni-picker-view-wrapper uni-picker-view-column:nth-child(1) {
display: none !important;
}
/deep/uni-page-body {
background-color: #f7f7f7 !important;
}

View File

@ -1,13 +1,14 @@
//生产环境
const PROT = "https://"//生产需替换
// const ROOTHOST = "admin.sjajk.com";//生产需替换
const ROOTHOST = "sausers.blxinchuang.com";
const ROOTHOST = "admin.sjajk.com";//生产需替换
//测试环境
// const PROT = "http://"
// const ROOTHOST = "47.75.182.93:8090";
// const ROOTHOST = "1.92.152.160";
// const ROOTHOST = "1.92.152.160";
// const ROOTHOST1 = "sausers.blxinchuang.com";
// const ROOTHOST = "sausers.blxinchuang.com";
// const ROOTHOST = "192.168.2.222:8187";
// const ROOTHOST = "120.46.52.165";
// const ROOTHOST = "192.168.0.115:8187";

View File

@ -126,6 +126,7 @@ export default {
data.multiArray[0] = monthDay;
data.multiArray[1] = hours;
data.multiArray[2] = minute;
this.multiArray = data.multiArray;
this.multiIndex = data.multiIndex;
},
@ -194,13 +195,11 @@ export default {
}
},
bindStartMultiPickerChange(e) {
console.log(e);
this.multiIndex = e.detail.value;
let da = this.multiArray;
let di = e.detail.value;
let caseDate = da[1][di[1]].replace('时', ':') + this.timeFormat(da[2][di[2]].replace('分', ''));
let appointTime = new Date(caseDate.replace(/-/g,'/')).getTime() / 1000;
if (appointTime < new Date().getTime() / 1000) {
uni.showToast({

View File

@ -89,7 +89,7 @@
},
beginTime: {
type: String,
default: "00:30"
default: "00:00"
},
endTime: {
type: String,
@ -113,7 +113,9 @@
handler(val) {
if (val && val.length) {
this.initOnload()
console.log('11111',val)
}else{
console.log('22222',val)
this.orderTimeArr={}
this.initOnload()
}
@ -248,7 +250,6 @@
//
selectTimeEvent(index, item) {
if (this.isQuantum) {
console.log("333333")
return this.handleSelectQuantum(index, item)
}

View File

@ -3,103 +3,524 @@
<view class="timeView">
<view class="timeView-top">
<span class="dx_title">是否接单 <!-- <text class="switchTxt">{{switchTxt=='true'?'接单':'不接单'}}</text> --></span>
<switch checked style="transform:scale(0.7)" @change="switch1Change"/>
<switch :checked='isTrue' style="transform:scale(0.7)" @change="switch1Change"/>
</view>
<view class="selectTimt">
<view class="dx_title">选择接单时问</view>
<view class="selectTimt-bottom">
<picker class="selectTimt-time" mode="time" :value="starTime" :start="starTime" end="23:59" @change="bindTimeChange">
<view class="selectTimt-time-title">开始时间</view>
<view class="uni-input">{{starTime}}</view>
</picker>
<picker class="selectTimt-time" mode="time" :value="endTime" start="00:00" end="23:59" @change="bindTimeChangeEndTime">
<view class="selectTimt-time-title">结束时间</view>
<view class="uni-input">
<span style="margin-right: 5px;">次日</span>
<span>{{endTime}}</span>
</view>
</picker>
<hTimePicker class="selectTimt-time" dayNum='0' sTime="0" cTime="23" interval="30" @changeTime="bindTimeChange">
<view slot="pCon" class="changeTime">
<view class="selectTimt-time-title">开始时间</view>
<view class="uni-input">{{starTime}}</view>
</view>
</hTimePicker>
<hTimePickerEnd class="selectTimt-time" dayNum='0' sTime="0" cTime="23" interval="30" @changeTime="bindTimeChangeEndTime">
<view slot="pCon" class="changeTime">
<view class="selectTimt-time-title">结束时间</view>
<view class="uni-input">
<span style="margin-right: 5px;">次日</span>
<span>{{endTime}}</span>
</view>
</view>
</hTimePickerEnd>
</view>
</view>
<times selectedTabColor="#28BA92" selectedItemColor="#28BA92" @change="getTime" :timeInterval="0.5" :appointTime="msList"
:isMultiple="true" :disableTimeSlot = "disableTimeSlot"></times>
<!-- <its-calendar :sta_num="0" :end_num="24" :int_num="msTimeDate" @getTime="TimeData" @getDate="SelData">
</its-calendar> -->
<view class="dx_view margin-bottom-sm" v-if="msList.length > 0">
<view class="dx_title">不可接单时间</view>
<view class="flex align-center flex-wrap ">
<view v-for="(item,index) in msList" :key="index" class="btn flex align-center margin-top">
<view>{{item}}</view>
<view class="margin-left-sm" @tap.stop="bindupdata(index,item)">x</view>
<view class="container-top">
<span>设置不可接单时间</span>
<span>(只能设置近3天的时间)</span>
</view>
<scroll-view class="scroll-view_H b-t b-b" scroll-x>
<block v-for="(item,index) in dateArr" :key="index">
<div class="flex-box" @click="selectDateEvent(index,item)" :class="{ borderb: index==dateActive}">
<view class="date-box" :style="{color:index==dateActive?selectedTabColor:'#333'}">
<text class="fontw">{{item.week}}</text>
<text>{{item.date}}</text>
</view>
</div>
</block>
</scroll-view>
<view class="time-box">
<view class="item" v-for="(item,index) in today" :key="index" @click="selectTime(index,item)">
<view class="item-box" :class="[item.isSelected==false?'disable':'active']">
<text>{{item.artificerTime}}</text>
<text class="all">{{item.title}}</text>
</view>
</view>
</view>
<view class="sub" @click="sub()" v-if="switchTxt==true">保存选择1</view>
<view class="sub" @click="sub()" v-if="switchTxt==false">保存选择2</view>
<view class="sub" @click="sub()">保存选择</view>
</view>
</view>
</template>
<script>
import hTimePicker from "@/components/h-timePicker/h-timePicker.vue";
import hTimePickerEnd from "@/components/h-timePicker/h-timePickerEnd.vue";
import {
currentTime,
tomorrow,
dayAfterTomorrow,
initData,
tomorrow
initTime,
timeStamp,
currentTime
} from '../../utils/date.js'
import times from '@/components/pretty-times/pretty-times.vue'
import itsCalendar from '@/components/its-calendar/its-calendar.vue';
export default {
components: {
itsCalendar,
times
times,
hTimePicker,
hTimePickerEnd
},
data() {
return {
starTime:'',
today: [
{
artificerTime: '00:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '00:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '01:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '01:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '02:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '02:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '03:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '03:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '04:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '04:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '05:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '05:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '06:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '06:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '07:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '07:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '08:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '08:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '09:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '09:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '10:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '10:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '11:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '11:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '12:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '12:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '13:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '13:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '14:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '14:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '15:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '15:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '16:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '16:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '17:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '17:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '18:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '18:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '19:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '19:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '20:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '20:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '21:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '21:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '22:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '22:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '23:00',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}, {
artificerTime: '23:30',
isSelected: false,
disable:false,
title:'可预约',
createTime:currentTime().date
}
],
checkbox1: [],
selectedTabColor:'rgb(40, 186, 146)',
dateActive: 0, //
dateArr: [], //
multiSelector: '',
isTrue: true,
starTime:'00:00',
endTime: '00:00',
endTimes:'23:30',
appointTime:[],
disableTimeSlot:[],
msTimeDate: 0,
newmsList: [],
msList: [],
startTime: '',
yearsDate: '',
switchTxt:'',
timeCurrent:'',
tomorrowTime:''
tomorrowTime:'',
selected:[],
timeData:[],
timeList:''
}
},
onLoad() {
if (this.$queue.getData('msTimeDate')) {
this.msTimeDate = parseInt(this.$queue.getData('msTimeDate'));
} else {
this.msTimeDate = 60;
}
if(this.timeCurrent==''){
this.timeCurrent=tomorrow().tomorrow+' '+this.endTime;
}
this.starTime=currentTime().times;
this.tomorrowTime=currentTime().date+' '+currentTime().times;
var date = new Date();
var year = date.getFullYear();
let month = (parseInt(date.getMonth()) + 1) > 9 ? (parseInt(date.getMonth()) + 1) : "0" + (parseInt(
date.getMonth()) + 1) //
let days = (date.getDate()) > 9 ? date.getDate() : "0" + date.getDate() //
let fullDate = `${month}-${days}`
let Time = year + '-' + fullDate
this.yearsDate = Time;
// this.getMsTime(Time);
// this.tomorrowTime=currentTime().date+' '+currentTime().times;
this.timeList=currentTime().date;
this.getMsTime(currentTime().date);
this.initOnload();
this.getTimeMs(currentTime().myDate)
},
methods: {
isToday(date){
const today = new Date();
return date.getDate() === today.getDate() //
&& date.getMonth() === today.getMonth() //
&& date.getFullYear() === today.getFullYear(); //
},
getTimeMs(someDate){
// const someDate = new Date(); //
var data=[];
if (this.isToday(someDate)) {
var time=currentTime().times
for(var i=0;i<this.today.length;i++){
if(time<=this.today[i].artificerTime){
data.push({
artificerTime: this.today[i].artificerTime,
isSelected: true,
disable:true,
title:'可预约',
createTime:currentTime().date
})
}else{
data.push({
artificerTime: this.today[i].artificerTime,
isSelected: false,
disable:false,
title:'不可预约',
createTime:currentTime().date
})
}
}
this.today=data
} else {
for(var i=0;i<this.today.length;i++){
data.push({
artificerTime: this.today[i].artificerTime,
isSelected: true,
disable:true,
title:'可预约',
createTime:this.timeList
})
}
this.today=data;
console.log("这个日期不是今天");
}
},
selectTime(index,item){
var data = [];
if(item.disable==true){
if(item.isSelected==true){
item.isSelected=false;
item.title='不可预约';
}else{
item.isSelected=true;
item.title='可预约';
}
var index = this.selected.indexOf(item);
if(item.huixian==false){//
item.huixian=true
this.selected.splice(index, 1);
}else{
if (index === -1) {
this.selected.push(item);
} else {
this.selected.splice(index, 1);
}
}
this.timeData=this.selected;
console.log("this.timeData",this.timeData)
}else{
console.log("时间过了")
}
},
//
selectDateEvent(index, item) {
const today = new Date();
this.dateActive = index
this.selectDate = item.date
if(item.week=='明天'){
this.selected=[];
this.timeList=tomorrow().tomorrow;
this.getTimeMs(tomorrow().todayT)
}else if(item.week=='后天'){
this.selected=[];
this.timeList=dayAfterTomorrow().dayAfterTomorrow;
this.getTimeMs(dayAfterTomorrow().todayD)
}else{
this.selected=[];
this.timeList=currentTime().date;
this.getTimeMs(today)
}
this.initOnload()
this.getMsTime(this.timeList)
},
initOnload() {
var danqian=initData() //
// this.dateArr = initData() //
let newObj = [];
for (let i = 0; i < 3; i++) {
let key = danqian[i];
if (key.week == '今天') {
key.week = "今天"
} else if (key.week == "明天") {
key.week = "明天"
} else if (key.week == '后天') {
key.week = "后天";
}
newObj.push(key)
}
this.dateArr = newObj
},
bindTimeChange: function(e) {//
this.starTime = e.detail.value;
this.starTime = e;
this.tomorrowTime=currentTime().date+' '+this.starTime;
},
bindTimeChangeEndTime(e){//
this.endTime = e.detail.value;
this.endTime = e;
this.timeCurrent=tomorrow().tomorrow+' '+this.endTime;
},
switch1Change: function (e) {
@ -116,20 +537,19 @@
sfJdan(time){//
var data={
flag:time,
userId:uni.getStorageSync('userId')
artificerId:uni.getStorageSync('artificerId')
}
this.$Request.postT('/app/artificerTime/setArtificerAccept',data).then(res => {
if (res.code == 0) {
this.$queue.showToast('设置成功!')
this.getMsTime(this.timeList)
} else {
this.$queue.showToast(res.msg);
}
});
},
getTime(time){
this.msList=time;
},
sub() {
this.saveMangShi();
@ -165,69 +585,183 @@
if (!over) {
this.msList.splice(index1, 1)
} else {
this.$queue.showToast('当前时间已被用户下单,禁止删除!')
ithis.$queue.showToast('当前时间已被用户下单,禁止删除!')
}
},
saveMangShi() {
// artificerId:uni.getStorageSync('artificerId')
var time=[];
for(var i=0;i<this.timeData.length;i++){
time.push(
this.timeData[i].createTime+' '+this.timeData[i].artificerTime
)
}
var data={
idleTime:this.tomorrowTime+','+this.timeCurrent,
busyTime:this.msList.toString(),
userId:uni.getStorageSync('userId')
busyTime:time.toString(),
artificerId:uni.getStorageSync('artificerId')
}
this.$Request.postT('/app/artificerTime/setArtificerTime',data).then(res => {
if (res.code == 0) {
this.$queue.showToast('设置成功!')
this.getMsTime(this.timeList)
} else {
this.$queue.showToast(res.msg);
}
});
},
getMsTime(artificerDate) {
this.yearsDate = artificerDate;
this.$Request.getT('/selectArtificerTimeByArtificerId?userId=' + uni.getStorageSync('userId') + '&artificerDate=' + artificerDate).then(res => {
if (res && res.code == 0 && res.data) {
this.msList = [];
this.newmsList = res.data;
this.msList = res.data.map((item)=> item.artificerTime);
console.log('getMsTime',this.msList);
uni.$emit("sendChildMsList",this.msList);
}
// this.yearsDate = artificerDate;
this.$Request.getT('/app/artificerTime/selectArtificerTimeByArtificerId?artificerId=' + uni.getStorageSync('artificerId') + '&artificerDate=' + artificerDate).then(res => {
if (res.code == 0) {
var data=[];
for(var i=0;i<res.data.length;i++){
data.push({
artificerTime: res.data[i].artificerTime,
isSelected: false,
disable:true,
title:'不可预约',
createTime:res.data[i].artificerDate,
})
}
this.today.forEach(item1 => {
let item2 = data.find(item => item.artificerTime == item1.artificerTime);
if(item2){
item1.isSelected=false;
item1.title='不可预约';
item1.huixian=false;
}else{
item1.isSelected=true
item1.title='可预约'
item1.huixian=true;
}
});
var jintian=currentTime().date;//
var mingtian=tomorrow().tomorrow;//
var houtian=dayAfterTomorrow().dayAfterTomorrow;//
if (res.acceptOrders == 1) {
this.isTrue = true
} else if (res.acceptOrders == 2) {
this.isTrue = false
}
if(res.startTime){
this.starTime=res.startTime.slice(11,16);
this.tomorrowTime=jintian+' '+this.starTime;
}else{
//
const now = new Date();
//
const hours = now.getHours();
const minutes = now.getMinutes();
//
let halfHour = false;
if (minutes >= 30) {
halfHour = true;
}
//
this.starTime = `${hours.toString().padStart(2, '0')}:${halfHour ? '30' : '00'}`;
this.tomorrowTime=jintian+' '+this.starTime;
}
this.endTime=res.endTime.slice(11,16);
}else {
this.isTrue = false
}
});
},
SelData(e) {
console.log(e)
var date = new Date();
var year = date.getFullYear();
let Time = year + '-' + e.days
this.getMsTime(Time);
this.msList = [];
},
//
TimeData(e) {
console.log(e, e.days)
var date = new Date();
var year = date.getFullYear();
this.startTime = year + '-' + e.days + ' ' + e.hours
this.yearsDate = year + '-' + e.days
console.log(this.yearsDate)
var hours=e.hours;
for(var i=0;i<hours.length;i++){
if (!this.msList.includes(hours[i].hours)) {
this.msList.push(hours[i].hours);
}
}
console.log('忙时list' + JSON.stringify(this.msList) );
// this.msList.push(e.hours);
}
}
}
</script>
<style lang="scss" scoped>
.container-top span:nth-child(1){
font-size: 14px;
font-weight: bold;
margin-right: 5px;
}
.container-top span:nth-child(2){
font-size: 13px;
color: #ccc;
}
.container-top{
width:100%;
display: flex;
flex-direction: row;
background: #fff;
padding-top: 10px;
padding-left: 5px;
}
.active{
border: 1px solid #28ba92;
font-weight: bold;
color: rgb(40, 186, 146);
}
.disable{
border: 1px solid #EEEEEE;
background: #F1F3F6 !important;
color: #999;
}
/deep/.checkbox__inner{
display: none;
}
.all{
white-space: nowrap;
font-size: 10px;
padding-top: 5px;
}
.item-box{
width: 100%;
height: 50px;
padding: 0 21px;
background: #fff;
font-size: 13px;
border-radius: 4px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.item{
width: 25%;
padding: 0 4px;
margin: 10px 0;
}
.time-box{
width:100%;
padding: 13px 5px 12px;
display: flex;
flex-wrap: wrap;
background-color: #fff;
}
.flex-box .date-box{
border: none;
display: flex;
height: 50px;
flex-direction: column;
align-items: center;
justify-content: space-around;
font-size: 14px;
color: #818181;
}
.flex-box{
display: inline-block;
height: 60px;
width: 25%;
margin: 0 3px 0 3px;
box-sizing: border-box;
}
/deep/.uni-scroll-view-content{
display:flex;
}
/deep/.scroll-view_H{
width: 100%;
white-space: nowrap;
height: 75px;
background-color: #fff;
position: relative;
padding-top: 10px;
}
.borderb {
border-bottom: 2px solid rgb(40, 186, 146);
}
.selectTimt-time-title{
text-align: center;
margin-bottom: 5px;
@ -344,10 +878,7 @@
margin-right: 25rpx;
}
.active {
/* background: #FCD202; */
/* border: none; */
}
.topView {
width: 750rpx;

View File

@ -8,24 +8,26 @@
<view class="selectTimt">
<view class="dx_title">选择接单时问</view>
<view class="selectTimt-bottom">
<picker class="selectTimt-time" range="halfHours" mode="time" :value="starTime" step="30" start="00:30" end="23:30" @change="bindTimeChange">
<view class="selectTimt-time-title">开始时间</view>
<view class="uni-input">{{starTime}}</view>
</picker>
<picker class="selectTimt-time" mode="time" :value="endTime" start="00:00" end="23:59" @change="bindTimeChangeEndTime">
<view class="selectTimt-time-title">结束时间</view>
<view class="uni-input">
<span style="margin-right: 5px;">次日</span>
<span>{{endTime}}</span>
</view>
</picker>
<hTimePicker class="selectTimt-time" dayNum='0' sTime="0" cTime="23" interval="30" @changeTime="bindTimeChange">
<view slot="pCon" class="changeTime">
<view class="selectTimt-time-title">开始时间</view>
<view class="uni-input">{{starTime}}</view>
</view>
</hTimePicker>
<hTimePickerEnd class="selectTimt-time" dayNum='0' sTime="0" cTime="23" interval="30" @changeTime="bindTimeChangeEndTime">
<view slot="pCon" class="changeTime">
<view class="selectTimt-time-title">结束时间</view>
<view class="uni-input">
<span style="margin-right: 5px;">次日</span>
<span>{{endTime}}</span>
</view>
</view>
</hTimePickerEnd>
</view>
</view>
<times selectedTabColor="#28BA92" selectedItemColor="#28BA92" @change="getTime" :timeInterval="0.5" :appointTime="msList"
:isMultiple="true" :disableTimeSlot = "disableTimeSlot"></times>
<!-- <its-calendar :sta_num="0" :end_num="24" :int_num="msTimeDate" @getTime="TimeData" @getDate="SelData">
</its-calendar> -->
<view class="dx_view margin-bottom-sm" v-if="msList.length > 0">
<view class="dx_title">不可接单时间</view>
<view class="flex align-center flex-wrap ">
@ -42,27 +44,28 @@
</template>
<script>
import hTimePicker from "@/components/h-timePicker/h-timePicker.vue";
import hTimePickerEnd from "@/components/h-timePicker/h-timePickerEnd.vue";
import {
currentTime,
initData,
tomorrow
} from '../../utils/date.js'
import times from '@/components/pretty-times/pretty-times.vue'
import itsCalendar from '@/components/its-calendar/its-calendar.vue';
export default {
components: {
itsCalendar,
times
times,
hTimePicker,
hTimePickerEnd
},
data() {
return {
multiSelector: '',
isTrue: true,
starTime:'00:00',
endTime: '00:00',
endTimes:'23:30',
appointTime:[],
disableTimeSlot:[],
msTimeDate: 0,
newmsList: [],
msList: [],
startTime: '',
@ -73,34 +76,20 @@
}
},
onLoad() {
if (this.$queue.getData('msTimeDate')) {
this.msTimeDate = parseInt(this.$queue.getData('msTimeDate'));
} else {
this.msTimeDate = 60;
}
if(this.timeCurrent==''){
this.timeCurrent=tomorrow().tomorrow+' '+this.endTime;
}
// this.starTime=currentTime().times;
this.tomorrowTime=currentTime().date+' '+currentTime().times;
var date = new Date();
var year = date.getFullYear();
let month = (parseInt(date.getMonth()) + 1) > 9 ? (parseInt(date.getMonth()) + 1) : "0" + (parseInt(
date.getMonth()) + 1) //
let days = (date.getDate()) > 9 ? date.getDate() : "0" + date.getDate() //
let fullDate = `${month}-${days}`
let Time = year + '-' + fullDate
this.yearsDate = Time;
this.getMsTime(Time);
// this.tomorrowTime=currentTime().date+' '+currentTime().times;
this.getMsTime(currentTime().date);
},
methods: {
bindTimeChange: function(e) {//
this.starTime = e.detail.value;
this.starTime = e;
this.tomorrowTime=currentTime().date+' '+this.starTime;
},
bindTimeChangeEndTime(e){//
this.endTime = e.detail.value;
this.endTime = e;
this.timeCurrent=tomorrow().tomorrow+' '+this.endTime;
},
switch1Change: function (e) {
@ -171,7 +160,6 @@
}
},
saveMangShi() {
// artificerId:uni.getStorageSync('artificerId')
var data={
idleTime:this.tomorrowTime+','+this.timeCurrent,
busyTime:this.msList.toString(),
@ -180,65 +168,57 @@
this.$Request.postT('/app/artificerTime/setArtificerTime',data).then(res => {
if (res.code == 0) {
this.$queue.showToast('设置成功!')
this.getMsTime(currentTime().date)
} else {
this.$queue.showToast(res.msg);
}
});
},
getMsTime(artificerDate) {
this.yearsDate = artificerDate;
// this.yearsDate = artificerDate;
this.$Request.getT('/app/artificerTime/selectArtificerTimeByArtificerId?artificerId=' + uni.getStorageSync('artificerId') + '&artificerDate=' + artificerDate).then(res => {
if (res && res.code == 0 && res.data) {
if (res.data) {
if (res.data.acceptOrders == 1) {
this.isTrue = true
} else if (res.data.acceptOrders == 2) {
this.isTrue = false
if (res.acceptOrders == 1) {
this.isTrue = true
} else if (res.acceptOrders == 2) {
this.isTrue = false
}
if(res.startTime){
this.starTime=res.startTime.slice(11,18);
this.tomorrowTime=currentTime().date+' '+this.starTime;
}else{
//
const now = new Date();
//
const hours = now.getHours();
const minutes = now.getMinutes();
//
let halfHour = false;
if (minutes >= 30) {
halfHour = true;
}
}
// this.msList = [];
// this.newmsList = res.data;
// this.msList = res.data.map((item)=> item.artificerTime);
// console.log('getMsTime',this.msList);
//
this.starTime = `${hours.toString().padStart(2, '0')}:${halfHour ? '30' : '00'}`;
this.tomorrowTime=currentTime().date+' '+this.starTime;
}
this.endTime=res.endTime.slice(11,18);
this.msList = [];
this.newmsList = res.data;
this.msList = res.data.map((item)=> item.createTime);
this.disableTimeSlot=this.msList
// uni.$emit("sendChildMsList",this.msList);
}else {
this.isTrue = false
}
});
},
SelData(e) {
console.log(e)
var date = new Date();
var year = date.getFullYear();
let Time = year + '-' + e.days
this.getMsTime(Time);
this.msList = [];
},
//
TimeData(e) {
console.log(e, e.days)
var date = new Date();
var year = date.getFullYear();
this.startTime = year + '-' + e.days + ' ' + e.hours
this.yearsDate = year + '-' + e.days
console.log(this.yearsDate)
var hours=e.hours;
for(var i=0;i<hours.length;i++){
if (!this.msList.includes(hours[i].hours)) {
this.msList.push(hours[i].hours);
}
}
console.log('忙时list' + JSON.stringify(this.msList) );
// this.msList.push(e.hours);
}
}
}
</script>
<style lang="scss" scoped>
<style lang="scss">
.selectTimt-time-title{
text-align: center;
margin-bottom: 5px;

View File

@ -2,18 +2,34 @@
function strFormat(str) {
return str < 10 ? `0${str}` : str
}
// 获取当前时间
// 获取明天日期
export function tomorrow() {
// 获取当前日期
const today = new Date();
// 获取明天日期
const todayT= new Date();
// 增加一天
today.setDate(today.getDate() + 1);
todayT.setDate(todayT.getDate() + 1);
// 格式化日期为YYYY-MM-DD
const tomorrow = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate().toString().padStart(2, '0')}`;
const tomorrow = `${todayT.getFullYear()}-${(todayT.getMonth() + 1).toString().padStart(2, '0')}-${todayT.getDate().toString().padStart(2, '0')}`;
return {
tomorrow
tomorrow,
todayT
}
}
// 获取后天日期
export function dayAfterTomorrow() {
// 获取明天日期
const todayD = new Date();
// 增加一天
todayD.setDate(todayD.getDate() + 2);
// 格式化日期为YYYY-MM-DD
const dayAfterTomorrow = `${todayD.getFullYear()}-${(todayD.getMonth() + 1).toString().padStart(2, '0')}-${todayD.getDate().toString().padStart(2, '0')}`;
return {
dayAfterTomorrow,
todayD
}
}
// 获取当前时间
@ -32,7 +48,8 @@ export function currentTime() {
return {
date,
time,
times
times,
myDate
}
}
@ -59,7 +76,7 @@ export function timeStamp(time, isQuantum) {
export function initData() {
const time = []
const date = new Date()
const now = date.getTime() //获取当前日期的时间戳
let timeStr = 3600 * 24 * 1000 //一天的时间戳
let obj = {