Browse Source

我的排课

master
unknown 1 year ago
parent
commit
dfbe92420a
  1. 9
      common/js/mixins.js
  2. 6
      components/myRadio/myRadio.vue
  3. 334
      components/pickDateTimer/pickDateTimer - 副本.vue
  4. 464
      components/pickDateTimer/pickDateTimer.vue
  5. 5
      config/api.js
  6. 12
      config/utils.js
  7. 4
      pages.json
  8. 76
      pages/recordEntry/operate/mySchedule/comp/mySchedulePopup.vue
  9. 32
      pages/recordEntry/operate/mySchedule/detail/detail.vue
  10. 2
      pages/recordEntry/operate/mySchedule/mould/mould.vue
  11. 4
      pages/recordEntry/operate/mySchedule/mouldEdit/mouldAdd.vue
  12. 152
      pages/recordEntry/operate/mySchedule/mySchedule.vue
  13. 11
      pages/recordEntry/operate/mySchedule/plan/plan.vue

9
common/js/mixins.js

@ -8,12 +8,17 @@ export default {
role: state=>state.user.vuex_userInfo.roles,
vuex_userInfo: state=>state.user.vuex_userInfo,
vuex_deptId: state=>state.user.vuex_userInfo.user.deptId,
vuex_coachId: state=>state.user.vuex_userInfo.coachId || '1591015108974329858',
vuex_coachId: state=>state.user.vuex_userInfo.user.coachId,
}),
},
data() {
return {
}
}
},
onPullDownRefresh() {
setTimeout(()=>{
uni.stopPullDownRefresh()
},1500)
},
}

6
components/myRadio/myRadio.vue

@ -1,7 +1,7 @@
<template>
<view class="radioBox">
<u-radio-group
v-model="radioVal.value"
:value="value"
placement="row"
size="14"
>
@ -21,11 +21,11 @@
<script>
export default {
props: ['radioData', 'radioVal'],
props: ['radioData', 'value'],
data() {
return {
value: ''
// value: ''
}
},
mounted() {

334
components/pickDateTimer/pickDateTimer - 副本.vue

@ -0,0 +1,334 @@
<template>
<view class="step1">
<view class="card">
<view class="dateBox">
<view class="month-row">
<view class="month" @click="show=true">{{ currentMonth }}</view>
<view class="arrow">
<u-icon name="arrow-down" :size="12" :color="'#1989FA'"></u-icon>
</view>
</view>
<view class="date_row">
<view class="icon left" @click="changeDateIndex(-1)">
<u-icon name="arrow-left" :size="12" :color="'#fff'"></u-icon>
</view>
<view class="dateArr" >
<view class="dateWidth" v-for="(item,index) in dateArr[currentDay]" :key="index" @click="chooseDate(item)" >
<view class="date" :class="{active: chooseDay==item.date}">
<view class="dian"></view>
<view class="week">{{ item.week }}</view>
<view class="num">{{ item.num }}</view>
</view>
</view>
</view>
<view class="icon right" @click="changeDateIndex(1)">
<u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
</view>
</view>
</view>
</view>
<view class="card">
<view class="timeCon">
<view class="h2">上午</view>
<view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseTimerClick(item)" :class="{active: item.id==chooseTimerId, disable: item.status!==1}">
<view class="lab" v-if="item.status==3">已过期</view>
<view class="lab" v-if="item.status==2">已约满</view>
<view class="lab" v-if="item.status==1">可预约</view>
<view class="time">{{ item.timer }}</view>
</view>
</view>
<view class="h2">下午</view>
<view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseTimerClick(item)" :class="{active: item.id==chooseTimerId,disable: item.status!==1}">
<view class="lab" v-if="item.status==3">已过期</view>
<view class="lab" v-if="item.status==2">已约满</view>
<view class="lab" v-if="item.status==1">可预约</view>
<view class="time">{{ item.timer }}</view>
</view>
</view>
</view>
</view>
<view class="card">
<view class="noDate">
<image src="http://192.168.1.20:81/zhili/image/20230927/ad178ebdf5394518b27b020c03ee48ab.png" mode=""></image>
</view>
</view>
<u-datetime-picker
:show="show"
v-model="chooseMonth"
:minDate="minDate"
:maxDate="maxDate"
mode="year-month"
@confirm="changeMonth"
></u-datetime-picker>
</view>
</template>
<script>
import { getDates, getMonthsBetweenDates } from '@/config/utils.js'
import { scheduleClassGetById, scheduleClassGet, getClassDateLimit } from '@/config/api.js'
export default {
data() {
return {
maxDate: 0,
minDate: 0,
monthArr: [],
show: false,
dateArr: [],
currentDay: 0,//
chooseDay: '',
chooseMonth: '',
timerArr: [
{status: 1, timer: '06:00-07:00', id: 1},
{status: 2, timer: '06:00-07:00', id: 2},
{status: 3, timer: '06:00-07:00', id: 3},
],
timerArr2: [
{status: 1, timer: '06:00-07:00', id: 4},
{status: 2, timer: '06:00-07:00', id: 5},
{status: 3, timer: '06:00-07:00', id: 6},
],
chooseTimerId: '',
endDate: null,
startDate: null,
}
},
mounted() {
this.initDate()
},
computed: {
currentMonth() {
let tiemr = new Date(this.chooseDay) * 1
return this.$u.date(tiemr, 'yyyy.mm')
}
},
methods: {
//
async getClassDateLimitFn() {
let obj = {
coachId: this.vuex_coachId
}
const {data: res} = await getClassDateLimit(obj)
this.startDate = res.beginDateLimit
this.endDate = res.endDateLimit
this.minDate = new Date(res.beginDateLimit)*1 + 86400000
this.maxDate = new Date(res.endDateLimit)*1
},
//
async scheduleClassGetFn() {
let id = this.vuex_userInfo.user.id
let coachId = this.vuex_userInfo.user.coachId || '1591015108974329858'
let classDate = '2023-10-1'
const {data: res} = await scheduleClassGet({id, coachId, classDate: this.chooseDay})
},
//
async initDate() {
await this.getClassDateLimitFn()
this.dateArr = getDates(this.startDate, this.endDate);
console.log('this.dateArr')
console.log(this.startDate)
console.log(this.endDate)
// this.chooseDay = this.dateArr[0][0].date
// console.log(this.chooseDay)
},
//
changeMonth(val) {
let startDate = this.$u.date(val.value, 'yyyy-mm-dd')
for(let i=0; i<this.dateArr.length; i++) {
for(let j=0; j<this.dateArr[i].length; j++) {
let date = this.dateArr[i][j].date
if(startDate==date) {
this.currentDay = i
this.chooseDay = date
}
}
}
this.show = false
},
//
chooseTimerClick(item) {
if(item.status!=1) return this.$u.toast('请选择可预约时间')
this.chooseTimerId = item.id
},
//
chooseDate(item) {
this.chooseDay = item.date
this.scheduleClassGetFn()
console.log('*****')
console.log(this.chooseDay)
},
changeDateIndex(num) {
if(this.currentDay==0&&num==-1) return this.$u.toast('已是可选最小日期')
if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期')
this.currentDay = this.currentDay + num
this.chooseDay = this.dateArr[this.currentDay][0].date
},
}
}
</script>
<style lang="scss" scoped>
.card {
width: 100%;
margin-bottom: 24rpx;
overflow: hidden;
.dateBox {
padding: 36rpx 0 40rpx 0;
.month-row {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 36rpx;
.month {
font-size: 32rpx;
color: $themC;
}
.arrow {
margin-left: 6rpx;
}
}
.date_row {
width: 100%;
height: 100rpx;
position: relative;
.icon {
width: 40rpx;
height: 40rpx;
background: rgba(51,51,51,0.18);
backdrop-filter: blur(4rpx);
position: absolute;
top: 50%;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
&.left {
left: 16rpx;
}
&.right {
right: 16rpx;
}
}
.dateArr {
display: flex;
padding: 0 70rpx;
// justify-content: space-between;
&.oneDate {
justify-content: center;
}
.dateWidth {
width: 20%;
display: flex;
justify-content: center;
}
.date {
width: 74rpx;
height: 100rpx;
border-radius: 16rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #333;
.dian {
width: 12rpx;
height: 12rpx;
background: #D8D8D8;
border-radius: 50%;
&.active {
background: #1989FA;
}
}
&.active {
background: rgba(25,137,250,0.1);
border: 2rpx solid #1989FA;
color: $themC;
}
.week {
}
.num {
margin-top: 4rpx;
}
}
}
}
}
}
.card {
.timeCon {
padding: 0 24rpx 40rpx 24rpx;
}
.h2 {
line-height: 90rpx;
font-weight: 500;
color: #333;
}
.time_box {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.time_item {
width: 30%;
height: 120rpx;
background: #F8F8F8;
border-radius: 12rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 12rpx;
color: #333;
&.active {
background: rgba(25,137,250,0.1);
border: 2rpx solid #1989FA;
color: $themC;
}
&.disable {
opacity: 0.4;
}
.lab {
font-size: 28rpx;
font-weight: 500;
}
.time {
font-size: 24rpx;
margin-top: 4rpx;
}
}
}
}
.btn {
width: 47%;
height: 72rpx;
background: #1989FA;
border-radius: 8rpx;
font-size: 28rpx;
color: #fff;
text-align: center;
line-height: 72rpx;
margin: 108rpx auto 50rpx auto;
}
.noDate {
}
</style>

464
components/pickDateTimer/pickDateTimer.vue

@ -0,0 +1,464 @@
<template>
<view class="step1">
<view class="card">
<view class="dateBox">
<view class="month-row">
<view class="month" @click="show=true">{{ currentMonth }}</view>
<view class="arrow">
<u-icon name="arrow-down" :size="12" :color="'#1989FA'"></u-icon>
</view>
</view>
<view class="date_row">
<view class="icon left" @click="changeDateIndex(-1)">
<u-icon name="arrow-left" :size="12" :color="'#fff'"></u-icon>
</view>
<view class="dateArr" >
<view class="dateWidth" v-for="(item,index) in dateArr[currentDay]" :key="index" @click="chooseDate(item)" >
<view class="date" :class="{active: chooseDay==item.date}">
<!-- <view class="dian"></view> -->
<view class="week">{{ item.week }}</view>
<view class="num">{{ item.num }}</view>
</view>
</view>
</view>
<view class="icon right" @click="changeDateIndex(1)">
<u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
</view>
</view>
</view>
</view>
<view class="card">
<view class="timeCon">
<view class="h2">上午</view>
<view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseCourse(item)" :class="{active: courseIds.indexOf(item.classTime)!=-1, disable: item.status==2}" >
<view class="flex" v-if="item.status==0">
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSumCount}} </view>
<view class="iconArrowBg" v-if="item.appointmentAlreadyCount">
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon>
</view>
</view>
<view class="lab" v-else>{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view>
</view>
</view>
<view class="h2">下午</view>
<view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseCourse(item)" :class="{active: courseIds.indexOf(item.classTime)!=-1, disable: item.status==2}">
<view class="flex" v-if="item.status==0">
<view class="lab">{{ item.appointmentAlreadyCount ||0 }} <text>/</text> {{ item.appointmentSumCount}} </view>
<view class="iconArrowBg" v-if="item.appointmentAlreadyCount">
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon>
</view>
</view>
<view class="lab" v-else>{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view>
</view>
</view>
</view>
</view>
<view class="card">
<view class="noDate">
<image src="http://192.168.1.20:81/zhili/image/20230927/ad178ebdf5394518b27b020c03ee48ab.png" mode=""></image>
</view>
</view>
<view class="step2" v-if="step==2">
<view class="">
<u-radio-group
v-model="radioVal"
placement="row"
size="14"
>
<u-radio
:customStyle="{marginLeft: '8px'}"
v-for="(item, index) in radioData"
:key="index"
:label="item.name"
:name="item.id"
labelSize="14"
@change="changeRadio"
>
</u-radio>
</u-radio-group>
</view>
<view class="btnBg" @click="confirmPopup">确认发布</view>
</view>
<u-datetime-picker
:show="show"
v-model="chooseMonth"
:minDate="minDate"
:maxDate="maxDate"
mode="year-month"
@confirm="changeMonth"
></u-datetime-picker>
</view>
</template>
<script>
import { getDates, getMonthsBetweenDates } from '@/config/utils.js'
import { scheduleClassGetById, scheduleClassGet, getClassDateLimit } from '@/config/api.js'
export default {
props: ['step'],
data() {
return {
maxDate: 0,
minDate: 0,
monthArr: [],
show: false,
dateArr: [],
currentDay: 0,//
chooseDay: '',
chooseMonth: '',
timerArr: [],
statusTxt: ['未过期', '未排课', '已过期', '已约满'], //0 1,2,3
timerArr2: [],
chooseTimerId: '',
endDate: null,
startDate: null,
radioData: [
{name: '全选', id: 0},
{name: '取消选择', id: 1},
],
courseIds: [],
radioVal: '',
}
},
mounted() {
this.initDate()
// uni.$on('refreshMySchedule',()=>{
// console.log('')
// this.scheduleClassGetFn()
// })
},
computed: {
currentMonth() {
let tiemr = new Date(this.chooseDay) * 1
return this.$u.date(tiemr, 'yyyy.mm')
}
},
watch: {
courseIds: {
handler(val) {
let allTimer = [...this.timerArr,...this.timerArr2]
let total = allTimer.reduce((pre, item)=>{
if(item.status==1) {
pre.push(item.classTime)
}
return pre
},[])
if(total.length==this.courseIds.length) {
this.radioVal = 0
}
}
}
},
methods: {
//
async getClassDateLimitFn() {
let obj = {
coachId: this.vuex_coachId
}
const {data: res} = await getClassDateLimit(obj)
this.startDate = new Date(res.beginDateLimit)
this.endDate = new Date(res.endDateLimit)
this.minDate = new Date(res.beginDateLimit)*1 + 86400000
this.maxDate = new Date(res.endDateLimit)*1
},
//
async scheduleClassGetFn() {
let id = this.vuex_userInfo.user.id
let coachId = this.vuex_userInfo.user.coachId
let deptId = this.vuex_deptId
const {data: res} = await scheduleClassGet({id, coachId, classDate: this.chooseDay, deptId})
this.timerArr = res.morningScheduleClass
this.timerArr2 = res.afternoonScheduleClass
if(this.chooseDay==this.dateArr[0][0].date) {
let arr = [...this.timerArr,...this.timerArr2]
arr.forEach(item=>{
let timer = new Date() * 1
let date = this.chooseDay+' '+(item.classTime.split('-')[0])
date = date.replace(/-/g,'/');
let timer2 = new Date(date).getTime();
// console.log(timer)
// console.log(timer2)
// console.log(date)
if(timer>timer2) {
item.status = 2
}
})
}
},
//
async initDate() {
await this.getClassDateLimitFn()
this.dateArr = getDates(this.startDate, this.endDate);
this.chooseDay = this.dateArr[0][0].date
this.scheduleClassGetFn()
},
//
changeMonth(val) {
let startDate = this.$u.date(val.value, 'yyyy-mm-dd')
for(let i=0; i<this.dateArr.length; i++) {
for(let j=0; j<this.dateArr[i].length; j++) {
let date = this.dateArr[i][j].date
if(startDate==date) {
this.currentDay = i
this.chooseDay = date
}
}
}
this.show = false
},
//
chooseDate(item) {
this.chooseDay = item.date
this.scheduleClassGetFn()
console.log('*****')
console.log(this.chooseDay)
},
changeDateIndex(num) {
if(this.currentDay==0&&num==-1) return this.$u.toast('已是可选最小日期')
if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期')
this.currentDay = this.currentDay + num
this.chooseDay = this.dateArr[this.currentDay][0].date
},
chooseCourse(item) {
if(this.step!=2) {
//
console.log(item)
if(item.appointmentAlreadyCount&&item.status==0) {
this.$goPage('/pages/recordEntry/operate/mySchedule/detail/detail?id='+ item.id)
}
}else {
this.radioVal = -1
if(item.status!=1) return this.$u.toast('请选择未排课选项')
let index = this.courseIds.indexOf(item.classTime)
if(index!==-1) {
this.courseIds.splice(index, 1)
}else {
this.courseIds.push(item.classTime)
}
}
},
//
changeRadio(val) {
if(val==1) {
this.courseIds = []
this.$emit('cancelChoose')
// this.step = 1
}else {
let allTimer = [...this.timerArr,...this.timerArr2]
let total = allTimer.reduce((pre, item)=>{
if(item.status==1) {
pre.push(item.classTime)
}
return pre
},[])
// console.log(total.length)
// console.log(this.courseIds.length)
if(total.length==this.courseIds.length) {
this.courseIds = []
// this.$emit('upDateCheck', [])
}else {
this.courseIds = total
}
}
},
//
confirmPopup() {
let pickDate = {
timeList: this.courseIds,
classDate: this.chooseDay
}
this.$emit('confirmPopup', pickDate)
}
}
}
</script>
<style lang="scss" scoped>
.card {
width: 100%;
margin-bottom: 24rpx;
overflow: hidden;
.dateBox {
padding: 36rpx 0 40rpx 0;
.month-row {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 36rpx;
.month {
font-size: 32rpx;
color: $themC;
}
.arrow {
margin-left: 6rpx;
}
}
.date_row {
width: 100%;
height: 100rpx;
position: relative;
.icon {
width: 40rpx;
height: 40rpx;
background: rgba(51,51,51,0.18);
backdrop-filter: blur(4rpx);
position: absolute;
top: 50%;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
&.left {
left: 16rpx;
}
&.right {
right: 16rpx;
}
}
.dateArr {
display: flex;
padding: 0 70rpx;
// justify-content: space-between;
&.oneDate {
justify-content: center;
}
.dateWidth {
width: 20%;
display: flex;
justify-content: center;
}
.date {
width: 74rpx;
height: 100rpx;
border-radius: 16rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #333;
.dian {
width: 12rpx;
height: 12rpx;
background: #D8D8D8;
border-radius: 50%;
&.active {
background: #1989FA;
}
}
&.active {
background: rgba(25,137,250,0.1);
border: 2rpx solid #1989FA;
color: $themC;
}
.week {
}
.num {
margin-top: 4rpx;
}
}
}
}
}
}
.card {
.timeCon {
padding: 0 24rpx 40rpx 24rpx;
}
.h2 {
line-height: 90rpx;
font-weight: 500;
color: #333;
}
.time_box {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
&::after{
display:block;
content:"";
width: 32%;
height:0px;
}
.time_item {
width: 30%;
height: 120rpx;
background: #F8F8F8;
border-radius: 12rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 12rpx;
margin-bottom: 20rpx;
color: #333;
&.active {
background: rgba(25,137,250,0.1);
border: 2rpx solid #1989FA;
color: $themC;
}
&.disable {
opacity: 0.4;
}
.lab {
font-size: 28rpx;
font-weight: 500;
}
.time {
font-size: 24rpx;
margin-top: 4rpx;
}
}
}
}
.btn {
width: 47%;
height: 72rpx;
background: #1989FA;
border-radius: 8rpx;
font-size: 28rpx;
color: #fff;
text-align: center;
line-height: 72rpx;
margin: 108rpx auto 50rpx auto;
}
.iconArrowBg {
background: #D8D8D8;
width: 26rpx;
height: 26rpx;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
margin-left: 4px;
}
.step2 {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 40px;
.btnBg {
width: 310rpx;
}
}
</style>

5
config/api.js

@ -18,10 +18,14 @@ export const tenantPage = (params) => http.get('system/tenant/pages', {params: p
export const bookingMasterPage = (params) => http.get('business/booking/master/page', {params: params, })
// 获得我的排课详情
export const scheduleClassGetById = (params) => http.get('business/booking/schedule-class/getById', {params: params, })
// 获得我的排课详情预约记录
export const getBookingDetailByClassId = (params) => http.get('business/booking/master/getBookingDetailByClassId', {params: params, })
// 获得排课
export const scheduleClassGet = (params) => http.get('business/booking/schedule-class/get', {params: params, })
// 发布排课计划
export const scheduleClassCreate = (data) => http.post('business/booking/schedule-class/create', data)
// 根据时间段发布排课计划
export const scheduleClassCreateByTime = (data) => http.post('business/booking/schedule-class/createByTime', data)
// 获取排课日期范围
export const getClassDateLimit = (params) => http.get('business/booking/global-config/getClassDateLimit', {params} ,)
// 获取排课时间段范围
@ -50,3 +54,4 @@ export const trainingSiteList = (params) => http.get('business/training-site/lis

12
config/utils.js

@ -1,12 +1,12 @@
export function checkToken(vm) {
let expiresTime = vm.$store.state.user.vuex_loginInfo.expiresTime
let nowTime = new Date() * 1
console.log('超时了')
console.log(expiresTime)
// console.log('超时了')
// console.log(expiresTime)
if (nowTime > expiresTime * 1) {
vm.$store.commit('goLogin')
// 如果小于20分钟就刷新一下token &&
} else if ((expiresTime * 1 - nowTime) / 60000 < 30) {
} else if ((expiresTime * 1 - nowTime) / 60000 <5) {
vm.$store.dispatch('refreshToken')
}
}
@ -20,8 +20,8 @@ function dateRangeFn(dateRange) {
const daysOfWeek = ['日', '一', '二', '三', '四', '五', '六'];
const dayOfWeek = date.getDay();
const weekName = daysOfWeek[dayOfWeek];
console.log(dateStr)
console.log(weekName)
// console.log(dateStr)
// console.log(weekName)
if (tmp.length == 0) {
dateArr.push(tmp)
}
@ -35,7 +35,7 @@ function dateRangeFn(dateRange) {
tmp = []
}
});
console.log(dateArr)
// console.log(dateArr)
return dateArr
}

4
pages.json

@ -89,7 +89,7 @@
"style": {
"navigationBarTitleText": "考场记录",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}
},
@ -134,7 +134,7 @@
"style": {
"navigationBarTitleText": "模板",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}
},

76
pages/recordEntry/operate/mySchedule/comp/mySchedulePopup.vue

@ -1,64 +1,114 @@
<template>
<view class="box">
<view class="item">
<view class="lab">我的场地</view>
<view class="val" style="display: flex;" @click="showSite=true">
<mySelect :value="form.siteName" placeholder="请选择您的场地"/>
<u-icon name="arrow-down" :size="12" :color="'#ADADAD'" style="margin-left: 12rpx;"></u-icon>
</view>
</view>
<view class="item">
<view class="lab">科目类型</view>
<view class="val">
<myRadio :radioData="radioData1"/>
<myRadio :radioData="radioData1" :value="form.subject" @changeRadio="(val)=>{form.subject=val}"/>
</view>
</view>
<view class="item">
<view class="lab">我的教练车</view>
<view class="val">
<myRadio :radioData="radioData2"/>
<myRadio :radioData="radioData2" :value="form.carNumber" @changeRadio="(val)=>{form.carNumber=val}"/>
</view>
</view>
<view class="item">
<view class="lab">可约人数</view>
<view class="val">
<myRadio :radioData="radioData3"/>
<myRadio :radioData="radioData3" :value="form.appointmentSumCount" @changeRadio="(val)=>{form.appointmentSumCount=val}"/>
</view>
</view>
<view class="item">
<view class="lab">开放范围</view>
<view class="val">
<myRadio :radioData="radioData4"/>
<myRadio :radioData="radioData4" :value="form.openRange" @changeRadio="(val)=>{form.openRange=val}"/>
</view>
</view>
<view class="btn_row">
<view class="btnBorder btn" @click="confirmPopup(0)">取消</view>
<view class="btnBg btn" @click="confirmPopup(1)">确认</view>
</view>
<u-picker :show="showSite" :columns="siteColumns" keyName="name" @confirm="changeSite" @cancel="showSite=false" ></u-picker>
</view>
</template>
<script>
import { trainingSiteList } from '@/config/api.js'
export default {
data() {
return {
showSite: false,
siteColumns: [],
// scheduleClassCreateByTime
radioData1: [
{name: '不限', id: 0},
{name: '科目二', id: 1},
{name: '科目三', id: 2},
{name: '科目二', id: 2},
{name: '科目三', id: 3},
],
// 023
radioData2: [
{name: '浙A66666学', id: 0},
{name: '浙A66667学', id: 0},
{name: '浙A66666学', id: '浙A66666学'},
{name: '浙A66667学', id: '浙A66667学'},
],
radioData3: [
{name: '1人', id: 0},
{name: '2人', id: 1},
{name: '3人', id: 2},
{name: '1人', id: 1},
{name: '2人', id: 2},
{name: '3人', id: 3},
{name: '4人', id: 4},
],
radioData4: [
{name: '我的学员', id: 0},
{name: '本校学员', id: 1}
]
],//01
form: {
siteName: '',
openRange: 0,
appointmentSumCount: 1,
carNumber: '浙A66666学',
subject: 0
}
}
},
created() {
this.trainingSiteListFn()
},
methods: {
confirmPopup(val) {
this.$emit('confirmPopup', val)
if(val==1&&!this.form.siteName) return this.$u.toast('请选择场地')
this.$emit('confirmClass', val, this.form)
},
//
changeSite(val) {
let item = val.value[0]
this.form.address = item.address
this.form.seq = item.seq
this.form.area = item.area
this.form.siteName = item.name
this.form.siteId = item.id
this.showSite = false
},
//
async trainingSiteListFn() {
let obj = {
pageNo: 1,
pageSize: 100,
schoolId: this.vuex_userInfo.user.schoolId
}
const {data: res} = await trainingSiteList(obj)
this.siteColumns = [ res ]
console.log(res)
},
changeRadio(e,val) {
console.log(e)
console.log(val)
}
}
}

32
pages/recordEntry/operate/mySchedule/detail/detail.vue

@ -6,15 +6,15 @@
<view class="info">
<view class="row">
<view class="lab">训练科目</view>
<view class="val">科目二</view>
<view class="val">{{subjectText[info.subject]}}</view>
</view>
<view class="row">
<view class="lab">预约车辆</view>
<view class="val">02号车浙A98299</view>
<view class="val">{{ info.carNumber }}</view>
</view>
<view class="row">
<view class="lab">开放范围</view>
<view class="val">我的学员</view>
<view class="val">{{ info.openRange==0?'自己的学员': '所有学员'}}</view>
</view>
</view>
</view>
@ -30,6 +30,32 @@
</template>
<script>
import { scheduleClassGetById, getBookingDetailByClassId } from '@/config/api.js'
export default {
data() {
return {
info: {},
id: '',
subjectText: ['不限', '科目二', '科目三'],//023
}
},
onLoad(options) {
this.id = options.id
this.scheduleClassGetByIdFn()
},
methods: {
async scheduleClassGetByIdFn() {
const {data: res} = await scheduleClassGetById({id: this.id})
this.info = res
console.log(res)
this.getBookingDetailByClassIdFn(res.id)
},
async getBookingDetailByClassIdFn(id) {
const {data: res} = await getBookingDetailByClassId({classId: id})
console.log(res)
}
}
}
</script>
<style lang="scss" scoped>

2
pages/recordEntry/operate/mySchedule/mould/mould.vue

@ -5,7 +5,7 @@
<view class="card" v-for="(item,index) in list" :key="index" @click="chooseMould(item)">
<view class="tit_row">
<view class="tit">{{item.templateName}}</view>
<view class="manage" @click="$goPage('/pages/recordEntry/operate/mySchedule/mouldEdit/mouldEdit?id='+item.id)">管理</view>
<view class="manage" @click.stop="$goPage('/pages/recordEntry/operate/mySchedule/mouldEdit/mouldEdit?id='+item.id)">管理</view>
</view>
<view class="ul">
<view class="li lab">

4
pages/recordEntry/operate/mySchedule/mouldEdit/mouldAdd.vue

@ -110,7 +110,9 @@
}
const {data: res} = await getClassCreate(this.FormData)
if(res) this.$u.toast('创建成功')
this.initFormData()
uni.$emit('refreshMould')
uni.navigateBack()
// this.initFormData()
},
addFn() {
let obj = {startTime: '',endTime: '', people: 1, id: new Date() * 1}

152
pages/recordEntry/operate/mySchedule/mySchedule.vue

@ -2,83 +2,22 @@
<view class="pageBgImg">
<topNavbar title="我的排课"></topNavbar>
<view class="pad">
<view class="step1">
<view class="card">
<view class="dateBox">
<view class="month-row">
<view class="month">2032.08</view>
<view class="arrow">
<u-icon name="arrow-down" :size="12" :color="'#1989FA'"></u-icon>
</view>
</view>
<view class="date_row">
<view class="icon left">
<u-icon name="arrow-left" :size="12" :color="'#fff'"></u-icon>
</view>
<view class="dateArr">
<view class="date" v-for="(item,index) in dateArr" :key="index" :class="{active: index==1}">
<view class="week">{{ item.week }}</view>
<view class="num">{{ item.num }}</view>
</view>
</view>
<view class="icon right">
<u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
</view>
</view>
</view>
</view>
<view class="card">
<view class="timeCon">
<view class="h2">上午</view>
<view class="time_box">
<view class="time_item" v-for="(item, index) in course" :key="index" @click="chooseCourse(item)" :class="{active: courseIds.indexOf(item.time)!=-1}">
<view class="lab" v-if="item.status==0">未排课</view>
<view class="lab" v-if="item.status==1">已约满</view>
<view class="lab" v-if="item.status==2">已过期</view>
<view class="lab" v-if="item.status==3">
<view class="text">4/4</view>
<view class="icon right">
<u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
</view>
</view>
<view class="time">{{ item.time }}</view>
</view>
</view>
<view class="h2">下午</view>
<view class="time_box">
<view class="time_item" v-for="(item, index) in course" :key="index" @click="chooseCourse(item)" :class="{active: courseIds.indexOf(item.time)!=-1}">
<view class="lab" v-if="item.status==0">未排课</view>
<view class="lab" v-if="item.status==1">已约满</view>
<view class="lab" v-if="item.status==2">已过期</view>
<view class="lab" v-if="item.status==3">
<view class="text">4/4</view>
<view class="icon right" @click="$goPage('/pages/recordEntry/operate/mySchedule/detail/detail')">
<u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
</view>
</view>
<view class="time">{{ item.time }}</view>
</view>
</view>
</view>
</view>
<view class="btn_row" v-if="step==1">
<view class="btnBorder btn" @click="changeStep(1)">管理排课计划</view>
<view class="btnBg btn" @click="changeStep(2)">编辑排课信息</view>
</view>
<view class="step2" v-if="step==2">
<view class="">
<myCheckbox :checkData="checkData" @changeCheck="changeCheck"></myCheckbox>
</view>
<view class="btnBg" @click="showPopupFn">确认发布</view>
</view>
<pickDateTimer @confirmPopup="confirmPopup" :step="step" @cancelChoose="step=1" ref="pickDateRef"/>
<view class="btn_row" v-if="step==1">
<view class="btnBorder btn" @click="changeStep(1)">管理排课计划</view>
<view class="btnBg btn" @click="changeStep(2)">编辑排课信息</view>
</view>
<!-- <view class="step2" v-if="step==2">
<view class="">
<myCheckbox :checkData="checkData" @changeCheck="changeCheck"></myCheckbox>
</view>
<view class="btnBg" @click="showPopupFn">确认发布</view>
</view> -->
</view>
<u-popup :show="show" @close="show=false" mode="center" :round="16">
<view>
<mySchedulePopup @confirmPopup="confirmPopup"/>
<mySchedulePopup @confirmClass="confirmClass"/>
</view>
</u-popup>
</view>
@ -86,7 +25,7 @@
<script>
import mySchedulePopup from './comp/mySchedulePopup'
import { scheduleClassGetById, scheduleClassGet } from '@/config/api.js'
import { scheduleClassGetById, scheduleClassGet, scheduleClassCreateByTime } from '@/config/api.js'
export default {
components: { mySchedulePopup },
data() {
@ -115,22 +54,9 @@
}
},
onLoad() {
// this.scheduleClassGetByIdFn()
this.scheduleClassGetFn()
},
methods: {
//
async scheduleClassGetByIdFn() {
let id = this.vuex_userInfo.user.id
const {data: res} = await scheduleClassGetById({id})
},
//
async scheduleClassGetFn() {
let id = this.vuex_userInfo.user.id
let coachId = this.vuex_userInfo.user.coachId || '1591015108974329858'
let classDate = '2023-09-18'
const {data: res} = await scheduleClassGet({id, coachId, classDate})
},
changeStep(val) {
if(val==1) {
this.$goPage('/pages/recordEntry/operate/mySchedule/plan/plan')
@ -139,45 +65,22 @@
}
// this.$emit('changeStep', val)
},
changeCheck(val) {
// console.log(val)
if(val.indexOf(1)!=-1) {
this.courseIds = []
this.step = 1
}else {
let total = this.course.reduce((pre, item)=>{
if(item.status==0) {
pre.push(item.time)
}
return pre
},[])
console.log(total.length)
console.log(this.courseIds.length)
if(total.length==this.courseIds.length) {
this.courseIds = []
this.$emit('upDateCheck', [])
}else {
this.courseIds = total
}
}
},
chooseCourse(item) {
if(this.step==1) return
if(item.status!=0) return //
let index = this.courseIds.indexOf(item.time)
if(index!==-1) {
this.courseIds.splice(index, 1)
}else {
this.courseIds.push(item.time)
}
},
confirmPopup(val) {
//
async confirmClass(val, obj) {
this.show = false
if(val==0) return
obj.deptId = this.vuex_deptId
obj.coachId = this.vuex_coachId
const res = await scheduleClassCreateByTime(Object.assign(this.pickDate, obj))
if(res.code==0) this.$u.toast('发布排课成功')
// uni.$emit('refreshMySchedule')
this.step = 1
this.$refs.pickDateRef.scheduleClassGetFn()
},
//
showPopupFn() {
if(!this.courseIds.length) return this.$u.toast('请选择排课时间')
confirmPopup(pickDate) {
if(!pickDate.timeList.length) return this.$u.toast('请选择排课时间')
this.pickDate = pickDate
this.show = true
}
}
@ -333,6 +236,7 @@
.btn_row {
display: flex;
justify-content: space-between;
padding-bottom: 40rpx;
.btn {
width: 47%;
}

11
pages/recordEntry/operate/mySchedule/plan/plan.vue

@ -142,15 +142,15 @@
],
radiolist3: [{
name: '我的学员',
id: 1,
id: 0,
disabled: false
},
{
name: '所有学员',
id: 2,
id: 1,
disabled: false
},
]
] //01
}
},
onLoad() {
@ -177,7 +177,10 @@
//
async scheduleClassCreateFn() {
console.log(this.form)
const {data: res} = await scheduleClassCreate(this.form)
const res = await scheduleClassCreate(this.form)
if(res.code==0) {
this.$goPage('/pages/recordEntry/operate/mySchedule/mySchedule')
}
console.log(res)
},
//

Loading…
Cancel
Save