Commit 289026de authored by Mac's avatar Mac

班级

parent d0c0241d
<style scoped>
.Appointmentlist{
width: 100%;
height: 100vh;
}
.row{
display: flex;
align-items: center;
}
.box-top{
display: flex;
box-shadow: 0 4rpx 24rpx rgba(100,101,102,.12);
height: 100rpx;
background: #FFF;
}
.box-top-item{
width: 50%;
justify-content: center;
font-size: 13px;
}
.ellipsis{
max-width: 80%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.center{
width: 100%;
margin-top: 15px;
padding: 0 15px;
box-sizing: border-box;
}
.center-box{
border-radius: 6px;
padding: 15px;
box-shadow: 0px 3px 6px 0px rgba(139, 115, 64, 0.16);
}
.center-top{
border-bottom: 1px solid #E2E2E2;
align-items: flex-start;
}
.basics{
width: 100%;
height: 200rpx;
background: #F5F6F7;
padding: 10px 15px;
box-sizing: border-box;
}
.basics-box{
box-sizing: border-box;
border-radius: 6px;
background: #FFF;
padding: 10px;
font-size: 13px;
color: #111;
height: 100%;
}
</style>
<template>
<div class="Appointmentlist">
<view class="basics">
<view class="basics-box">
<view class="row" style="justify-content: space-between;">
<view class="row">
提前几天预约:{{basics.AdvanceDay}}
</view>
<view class="row">
可预约时间:{{basics.ScrollETime}}
</view>
</view>
<view class="row" style="justify-content: space-between;">
<view class="row">
可预约的天数:{{basics.AppointDay}}
</view>
<view class="row">
是否可以继续预约:{{basics.IsNextAppoint?'是':'否'}}
</view>
</view>
</view>
</view>
<view class="box-top">
<view class="box-top-item row" @click="getscreen(1)">
<view class="ellipsis">
{{msg.Date}}
</view>
<van-icon name="arrow-down" size='12' style='margin-left: 5px;'/>
</view>
<picker mode="selector" range-key="SName" style="width: 50%;"
:range="schoolList" @change="getCutomTypeCheck">
<view class="box-top-item row" style="width: 100%;height: 100rpx;" >
<view class="ellipsis">
{{SchoolName}}
</view>
<van-icon name="arrow-down" size='12' style='margin-left: 5px;'/>
</view>
</picker>
</view>
<view v-if="dataList && dataList.length>0">
<scroll-view :scroll-y="true" style="height: calc(100vh - 100rpx - 200rpx);width: calc(100vw);">
<view class="center" v-for='(x,y) in dataList' :key = 'y' @click="gotimelist(x)">
<view class="center-box">
<view class="center-top row" >
<image :src='x.TeacherHead' mode="aspectFill" style="width:38px ;height: 38px;border-radius: 50%;"></image>
<view style="margin-left: 15px;padding-bottom:10px ;">
<div style="font-size: 13px;color: #111;font-weight: bold">{{x.TeacherName}}</div>
<div style="font-size: 11px;color: #666;margin-top: 4px;">{{x.SchoolName}}</div>
<div style="font-size: 11px;color: #666;margin-top: 4px;">{{x.RoomName}}</div>
</view>
</view>
<view style="padding: 10px 0;font-size: 12px;color: #111;">
<view style="font-weight: bold;">个人简介</view>
<view style="margin-top: 5px;">暂时没的其他的</view>
</view>
</view>
</view>
<view style="width: 100%;height: 20px;"></view>
</scroll-view>
</view>
<view v-else>
<van-empty description="暂无约课老师" />
</view>
<van-calendar :show="dateshow" @confirm="onConfirm" :default-date='defaultDate' @close='dateshow=false'/>
</div>
</template>
<script>
import {
ref,
reactive,
toRefs,
toRef,
getCurrentInstance,
watch,
computed,
onMounted,
provide,
} from "vue";
export default {
components: {
},
props:['day'],
setup(props) {
let {
proxy
} = getCurrentInstance();
let data = reactive({
dateshow:false,
msg:{
Date:props.day,
School_Id:'-1',
},
SchoolName:'不限校区',
schoolList:[],
dataList:[],//数据list
basics:{},//基础信息
defaultDate:new Date(props.day).getTime()
})
let methods = {
getscreen(type){
data.dateshow = true
},
onConfirm(e){
let date = new Date(e.detail)
let year = date.getFullYear()
let month = date.getMonth()+1;
month = month<10?'0'+month:month
let day = date.getDate();
day = day<10?'0'+day:day
data.msg.Date = year+'-'+month+'-'+day;
this.dateshow = false;
that.judge()
},
getschoolList(){
proxy.$request("/user/GetDropSchoolList", {}).then(res => {
if (res.Code == 1) {
data.schoolList = res.Data;
let obj = {
SId:'-1',
SName:'不限校区'
}
data.schoolList.unshift(obj)
}
})
},
getCutomTypeCheck(e){
let i = e.detail.value;
data.msg.School_Id= data.schoolList[i].SId
data.SchoolName = data.schoolList[i].SName;
that.judge()
},
getList(){
uni.showLoading({
title:'加载中...'
})
proxy.$request("/AppletCenter/GetScrollAppointmentTeacherList", data.msg).then(res => {
if (res.Code == 1) {
data.dataList =res.Data;
uni.hideLoading()
}
})
},
getBaseInfo(){
proxy.$request("/AppletCenter/GetScrollAppointmentBaseInfo",{}).then(res => {
if (res.Code == 1) {
data.basics = res.Data;
that.judge()
}
})
},
judge(){//判断
if(data.basics.IsNextAppoint==true){//是否可以预约
let differ = that.differday(data.msg.Date)
if(differ >=data.basics.AdvanceDay && data.basics.AppointDay >=differ){//提前几天预约 和可预约的天数
//TODO 还有一个时间判断 不知道咋个处理
that.getList()
}
}
},
differday(startDate){//获取2个时间相隔多少天
var sdate = new Date(startDate.replace(/-/g, "/"));   
var now = new Date();   
var days = sdate.getTime() - now.getTime() ;   
var day = parseInt(days / (1000 * 60 * 60 * 24))+1;   
return day;
},
gotimelist(item){//跳转到时段页面
let obj={
item:item,
basics:data.basics,
Date:data.msg.Date
}
console.log(obj)
// JSON.parse(decodeURIComponent(option.formData))
uni.navigateTo({//编码
url:'/pages/appointment/timeSlot?data='+encodeURIComponent(JSON.stringify(obj))
})
}
}
onMounted(() => {
})
let that = methods;
return {
...toRefs(data),
...methods,
};
},
onShow() {
},
onLoad() {
uni.setNavigationBarTitle({
title: "约课老师",
});
this.getschoolList()//获取学校下拉
this.getBaseInfo()//获取学员基础信息
},
}
</script>
<style>
.mySubscribe{
width: 100%;
height: 100vh;
background: #F5F5F5;
}
.listbox{
width: 100%;
margin-top: 15px;
padding: 0 15px;
box-sizing: border-box;
}
.box-item{
border-radius: 6px;
padding: 15px;
background: #FFF;
font-size: 14px;
}
.row{
display: flex;
align-items: center;
}
.onetext{
width: 100%;
text-align: center;
overflow: hidden;display: inline-block;white-space: nowrap; text-overflow:ellipsis
}
.popupbox{
width: 60vw;
background: #FFF;
height: 100vh;
box-sizing: border-box;
}
.popupbox-c{
padding: 20rpx;
box-sizing: border-box;
}
.popupbox-list{
height: 45px;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
font-size: 13px;
color: #555555;
box-sizing: border-box;
}
.popupbox-item{
justify-content: space-between;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
height: 50px;
}
</style>
<template>
<view class="mySubscribe">
<view class="row">
<van-tabs
style="flex:1"
:active="data.msg.State"
title-inactive-color="#444444"
title-active-color="#00ACF9"
line-height="0"
@change="changeTab"
>
<van-tab :title="x.Name" :name="x.Id" v-for="(x,y) in stateList" :key='y'></van-tab>
</van-tabs>
<view class="onetext" style="width: 140rpx;background: #FFF;height: 44px;line-height: 44px;text-align: center;" @click="popupshow2=true">
老师
</view>
</view>
<view v-if="List.length>0">
<scroll-view :scroll-y="true" style="height: calc(100vh - 150rpx );width: calc(100vw);">
<view class="listbox" v-for='(x,y) in List' :key = 'y' >
<view class="box-item">
<view class="row" style="justify-content: space-between;line-height: 30px;">
<span>{{x.Date}}</span>
<span>{{x.StateName}}</span>
</view>
<view class="row" style="align-items: flex-start;">
<image :src='x.TeacherHead' mode="aspectFill" style="width:38px ;height: 38px;border-radius: 50%;"></image>
<view style="margin-left: 15px;padding-bottom:10px ;">
<div style="font-size: 13px;color: #111;font-weight: bold">{{x.CourseName}}</div>
<div style="font-size: 11px;color: #666;margin-top: 4px;">{{x.TeacherName}}</div>
<div style="font-size: 11px;color: #666;margin-top: 4px;">学生:{{x.StuName}}</div>
<div style="font-size: 11px;color: #666;margin-top: 4px;">{{x.ChapterNo}}次课</div>
</view>
</view>
<view >时间列表</view>
<view v-for="(item,index) in x.CourseTimeList">
<view class="row">
{{item.StartTime}}
<span style="margin: 0 5px;">-</span>
{{item.EndTime}}
<span style='margin-left: 10px;'>{{item.Minutes}}分钟</span>
</view>
</view>
<view style="display: flex;justify-content: flex-end;" v-if="x.State == 1">
<van-button size="small" @click="goquxiao(x)">取消</van-button>
</view>
</view>
</view>
<view style="width: 100%;height: 20px;"></view>
</scroll-view>
</view>
<view v-else>
<van-empty description="暂无数据" />
</view>
<van-dialog :show='show' title="提示" message='正在确认中,您确定取消预约?' show-cancel-button @cancel='show = false'
@confirm='quedquxiao'>
</van-dialog>
<van-popup :show="popupshow2" @close="popupshow2=false" position='right'>
<view class="popupbox" style="font-size: 14px;padding: 20rpx;">
<view class="popupbox-item row">
<span>开始时间</span>
<view class="row" @click="showdatePopup=true">
<span v-if="msg.StartTime==''" style="color: #999999;">请选择</span>
<span v-else >{{msg.StartTime}}</span>
</view>
</view>
<view class="popupbox-item row">
<span>结束时间</span>
<view class="row" @click="showdatePopup2=true">
<span v-if="msg.EntTime==''" style="color: #999999;">请选择</span>
<span v-else >{{msg.EntTime}}</span>
</view>
</view>
</view>
</van-popup>
<van-popup :show="popupshow" @close="popupshow=false" position='right'>
<view class="popupbox">
<view class="popupbox-top">
<van-search :value="value" placeholder="请输入搜索关键词" @change="onSearch" @cancel="onSearch"/>
</view>
<view class="popupbox-c" v-if='TeacherList.length>0'>
<scroll-view :scroll-y="true" style="height: calc(100vh - 110rpx - 150rpx);width: 100%;">
<view class="popupbox-list row" style="justify-content: space-between;" v-for='(x,y) in TeacherList' :key = 'y' @click="choice(x)">
<span >{{x.TeacherName}}</span>
<van-icon name="success" color='#0000ff' v-if='msg.TeacherId == x.TId'/>
</view>
<view style="width: 100%;height: 20px;"></view>
</scroll-view>
</view>
<view v-else>
<van-empty description="暂无数据" />
</view>
</view>
</van-popup>
<van-popup :show="showdatePopup" round position="bottom" custom-style="height: 50%" @close="showdatePopup=false">
<van-datetime-picker type="date" :value="getCurrentDate" @cancel="showdatePopup=false" @confirm="onConfirm()" />
</van-popup>
<van-popup :show="showdatePopup2" round position="bottom" custom-style="height: 50%" @close="showdatePopup2=false">
<van-datetime-picker type="date" :value="getCurrentDate2" @cancel="showdatePopup2=false" @confirm="onConfirm2()" />
</van-popup>
</view>
</template>
<script>
import {
ref,
reactive,
toRefs,
toRef,
getCurrentInstance,
watch,
computed,
onMounted,
provide,
} from "vue";
import Dialog from '../../wxcomponents/vant/dialog/dialog'
export default {
components: {
},
props:[],
setup(props) {
let {proxy} = getCurrentInstance();
let data = reactive({
msg:{
pageIndex:1,
pageSize:10,
StartTime:'',
EntTime:'',
State:0,
TeacherId:0,
},
pageState: "more",
PageCount: 0,
timer: null, //防抖
List:[],
stateList:[],
show:false,
AppointId:0,
popupshow:false,
popupshow2:false,
value:'',
TeacherList:[],
allTeacherList:[],
showdatePopup:false,
showdatePopup2:false,
getCurrentDate:new Date().getTime(),
getCurrentDate2:new Date().getTime(),
})
let methods = {
getList() {
data.pageState = "loading";
proxy.$request("/AppletCenter/GetMyAppointPageList",data.msg).then(res => {
if (res.Code == 1) {
if (data.timer) data.timer = null;
data.PageCount = res.Data.PageCount;
if (data.msg.pageIndex === 1) {
data.List = res.Data.PageData;
} else {
data.List = [...data.List,...res.Data.PageData];
}
if (data.msg.pageIndex >= res.Data.PageCount) {
data.pageState = "none";
} else {
data.pageState = "more";
}
}
})
},
lower(e) {
if (data.msg.pageIndex < data.PageCount) {
data.pageState = "loading";
if (data.timer) clearTimeout(data.timer);
data.timer = setTimeout(() => {
data.msg.pageIndex++;
that.getList();
}, 1000);
} else {
data.pageState = "none";
}
},
getState(){
proxy.$request("/AppletCenter/GetCourseAppointStateEnumList",{}).then(res => {
if (res.Code == 1) {
data.stateList = res.Data
data.stateList.unshift({
Id:0,Name:'全部'
})
}
})
},
getTeacherList(){
proxy.$request("/AppletCenter/GetTeacherList",{}).then(res => {
if (res.Code == 1) {
data.TeacherList = res.Data
data.allTeacherList = JSON.parse(JSON.stringify(res.Data))
}
})
},
choice(x){//老师选择
data.msg.TeacherId = x.TId;
data.popupshow = false;
data.value = '';
data.TeacherList = JSON.parse(JSON.stringify(data.allTeacherList))
},
onSearch(val){
if (!val.detail) {
data.TeacherList = JSON.parse(JSON.stringify(data.allTeacherList))
} else {
data.TeacherList = data.allTeacherList.filter(e => {
return e.TeacherName.indexOf(val.detail) > -1
})
}
},
changeTab(e){
data.msg.State = e.detail.name;
data.msg.pageIndex = 1;
that.getList();
},
goquxiao(x){
data.show = true;
data.AppointId = x.Id
},
quedquxiao(){
uni.showLoading({
title:'取消中...'
})
proxy.$request("/AppletCenter/CancelAppointment",{AppointId:data.AppointId}).then(res => {
if (res.Code == 1) {
uni.hideLoading()
data.show = false;
data.msg.pageIndex = 1;
that.getList();
}
})
},
onConfirm(val){
data.getCurrentDate = val.detail;
let curdate = new Date(val.detail);
let year = curdate.getFullYear();
let month = curdate.getMonth() < 9 ? "0" + (curdate.getMonth() + 1) : curdate.getMonth() + 1
let day = curdate.getDate() < 9 ? "0" + (curdate.getDate() ) : curdate.getDate()
data.msg.StartTime = year + "-" + month+'-'+day;
data.showdatePopup = false
},
onConfirm2(val){
data.getCurrentDate2 = val.detail;
let curdate = new Date(val.detail);
let year = curdate.getFullYear();
let month = curdate.getMonth() < 9 ? "0" + (curdate.getMonth() + 1) : curdate.getMonth() + 1
let day = curdate.getDate() < 9 ? "0" + (curdate.getDate() ) : curdate.getDate()
data.msg.EntTime = year + "-" + month+'-'+day;
data.showdatePopup2 = false
}
}
onMounted(() => {
})
let that = methods;
return {
...toRefs(data),
...methods,
};
},
onShow() {
},
onLoad() {
uni.setNavigationBarTitle({
title: "我的预约",
});
this.getState()
this.getTeacherList()
this.getList()
},
}
</script>
<style scoped>
.timeSlot{
width: 100%;
height: 100vh;
}
.listbox{
width: 100%;
margin-top: 15px;
padding: 0 15px;
box-sizing: border-box;
}
.box-item{
border-radius: 6px;
padding: 15px;
box-shadow: 0px 3px 6px 0px rgba(139, 115, 64, 0.16);
font-size: 14px;
}
.row{
display: flex;
align-items: center;
}
.box-top{
width: 100%;
height: 26px;
font-size: 12px;
}
.btnbox{
width: 100%;
height: 150rpx;
background: #FFF;
box-sizing: border-box;
box-shadow: 3px 3px 6px 0px rgba(139, 115, 64, 0.16);
padding: 0 15px;
position: fixed;
left: 0;
bottom: 0;
}
.btn{
width: 110px;
height: 40px;
border-radius: 6px;
background-color: #0000ff;
font-size: 14px;
color: #FFF;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<template>
<view class="timeSlot">
<view v-if="list.CourseTimeList.length>0">
<scroll-view :scroll-y="true" style="height: calc(100vh - 150rpx );width: calc(100vw);">
<view class="listbox" v-for='(x,y) in list.CourseTimeList' :key = 'y' >
<view class="box-item">
<view class="row box-top" style="justify-content: space-between;">
<view>
<van-checkbox :value="x.checked" @change="onChange(y)"></van-checkbox>
</view>
<view>
<span v-if='x.State==0'>可预约</span>
<span v-if='x.State==2'>不可预约</span>
<span v-if='x.State==3'>他人预约</span>
<span v-if='x.State==4'>我的预约</span>
</view>
</view>
<view class="row" style="line-height: 35px;justify-content: flex-end;">
{{x.StartTime}}
<span style="margin: 0 10px;">-</span>
{{x.EndTime}}
</view>
</view>
</view>
<view style="width: 100%;height: 20px;"></view>
</scroll-view>
</view>
<view v-else>
<van-empty description="暂无数据" />
</view>
<view class="btnbox row" style="justify-content: space-between;" >
<view>2</view>
<view class="btn" @click="subscribe">
立即预约
</view>
</view>
</view>
</template>
<script>
import {
ref,
reactive,
toRefs,
toRef,
getCurrentInstance,
watch,
computed,
onMounted,
provide,
} from "vue";
export default {
components: {
},
props:['data'],
setup(props) {
console.log(JSON.parse(decodeURIComponent(props.data)))
let {
proxy
} = getCurrentInstance();
let data = reactive({
basics:JSON.parse(decodeURIComponent(props.data)).basics,
list:JSON.parse(decodeURIComponent(props.data)).item,
Date:JSON.parse(decodeURIComponent(props.data)).Date
})
let methods = {
datahandle(){//进来的时候数据处理
console.log(data.list)
if(data.list.CourseTimeList && data.list.CourseTimeList.length>0){
data.list.CourseTimeList.forEach(x=>{
x.checked = false
})
}
},
onChange(index){
data.list.CourseTimeList[index].checked = !data.list.CourseTimeList[index].checked;
},
subscribe(){//立即预约
let ShiftSort = [];
let list = JSON.parse(JSON.stringify(data.list.CourseTimeList))
list.forEach(x=>{
if(x.checked == true){
ShiftSort.push(x.Sort)
}
})
ShiftSort= ShiftSort.join(',')
let obj ={
Date:data.Date,
AccountId:data.list.AccountId,
TeacherId:data.list.TeacherId,
ShiftSort:ShiftSort,
CourseId:data.basics.CourseId,
ChapterNo:data.basics.NextAppointChapterNo,
}
proxy.$request("/AppletCenter/SetScrollAppointment",obj).then(res => {
if (res.Code == 1) {
uni.showToast({
title:'保存成功',
icon:'none'
});
uni.redirectTo({
url:'/pages/appointment/mySubscribe'
})
}
})
}
}
onMounted(() => {
})
let that = methods;
return {
...toRefs(data),
...methods,
};
},
onShow() {
},
onLoad() {
uni.setNavigationBarTitle({
title: "时段选择",
});
this.datahandle()
},
}
</script>
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
<van-loading size="48rpx" type="spinner">加载中...</van-loading> <van-loading size="48rpx" type="spinner">加载中...</van-loading>
</view> </view>
<van-empty description="暂无课程" v-if="dataList.length === 0" /> <van-empty description="暂无课程" v-if="dataList.length === 0" />
<view class="btnfixed">
<image @click="goappointment" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/jiaheb2b/checkDuplicate_btn.png" mode="widthFix"></image>
</view>
<view v-for="(item, index) in dataList" :key="index" v-if="dataList.length > 0"> <view v-for="(item, index) in dataList" :key="index" v-if="dataList.length > 0">
<Item :data="item"/> <Item :data="item"/>
</view> </view>
...@@ -257,6 +260,12 @@ ...@@ -257,6 +260,12 @@
} }
} }
return res return res
},
goappointment(){
let day = currentDate.value+'-'+activeDay.value;
uni.navigateTo({
url: '/pages/appointment/list?day='+day,
});
} }
}; };
onMounted(() => { onMounted(() => {
...@@ -292,10 +301,11 @@ ...@@ -292,10 +301,11 @@
}, },
onShow() { onShow() {
const indexData = uni.getStorageSync('indexData') const indexData = uni.getStorageSync('indexData')
this.msg.ClassId = indexData.ClassId // this.msg.ClassId = indexData.ClassId
this.msg.ClassId = '1'
this.msg.StartTime = getToday('y', 'm') + '-01'; this.msg.StartTime = getToday('y', 'm') + '-01';
this.msg.EndTime = getToday('y', 'm') + '-'+ getMonthMaxDay(); this.msg.EndTime = getToday('y', 'm') + '-'+ getMonthMaxDay();
if (this.$isLogin()&&this.msg.ClassId>0) { if (this.$isLogin()) {
this.getData() this.getData()
this.getAllData() this.getAllData()
} }
...@@ -417,4 +427,14 @@ ...@@ -417,4 +427,14 @@
top: 10rpx; top: 10rpx;
right: 10rpx; right: 10rpx;
} }
.btnfixed{
position: fixed;
right: 0px;
bottom: 92px;
z-index: 9999;
}
.btnfixed image{
width: 80px;
height: auto;
}
</style> </style>
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