初始化

This commit is contained in:
魏啾
2024-03-21 15:38:10 +08:00
parent e2f200ae7a
commit 81321b648f
479 changed files with 60060 additions and 1 deletions

343
pages/stafflist/index.vue Normal file
View File

@@ -0,0 +1,343 @@
<template>
<view class="content">
<view class="contentitem" v-for="(item,index) in list" :key="index">
<view class="onecontentitem flex-start">
<view class="onecontentitemone flex-colum-start">
<image :src="item.user_avatar" mode=""></image>
</view>
<view class="onecontentitemtow flex-colum-start">
<view class="onecontentitemtowone flex-start" @click="makePhoneCall(item.mobile)">
<view class="onecontentitemtowone_text">
{{item.user_nickname}}
</view>
<view class="onecontentitemtowone_phone">
{{item.mobile.replace(/(\d{3})\d{4}(\d{4})/,'$1****$2')}}
</view>
<u-icon name="phone" color="#000" size="18"></u-icon>
</view>
<view class="onecontentitemtowtow">
预约项目{{item.title}}
</view>
<view class="onecontentitemtowthere">
预约时间{{item.time}}
</view>
</view>
</view>
<view class="onecontentitembox flex-center">
<view class="onecontentitemboxone" @click="orderokprebook(item)"
v-if="item.status == 2 || item.status == 0 ||item.status == 1">
确认预约
</view>
<view style="background:#F9F9F9;color:#999999 ;" class="onecontentitemboxone" v-if="item.status == 3">
已预约
</view>
<view class="onecontentitemboxtow" @click="orderrefuseprebook(item)">
拒绝预约
</view>
</view>
</view>
<view class="contentfixed" @click="userlogout">
<image src="@/static/exit.png" mode=""></image>
</view>
<view class="positionfixed flex-between">
<view class="positionfixeditem flex-center positionfixeditems" @click="ange(1)">
<u-icon name="list-dot" color="#2979ff" size="14"></u-icon>
<text class="positionfixedtext">预约列表</text>
</view>
<view class="positionfixeditem flex-center" @click="ange(2)">
<u-icon name="clock" color="#2979ff" size="14"></u-icon>
<text class="positionfixedtext">修改时间</text>
</view>
</view>
<view v-if="list.length==0 && is_end == true" class="flex-colum">
<image style="margin-top:100rpx;"
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
<view :style="{height:height}"></view>
</view>
</template>
<script>
export default {
data() {
return {
height: '',
list: [],
is_end: false,
form: {
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.infn()
},
onLoad() {
// #ifdef MP-WEIXIN
wx.hideHomeButton()
// #endif
},
mounted() {
var query = uni.createSelectorQuery().in(this).select('.positionfixed')
query.boundingClientRect(ele => {
var that = this;
uni.getSystemInfo({
success(res) {
that.height = ele.height + "px";
that = null;
}
})
}).exec();
},
onReachBottom() {
this.orderreselist()
},
methods: {
async userlogout() { //退出登录
uni.showModal({
title: '注意',
content: '确定要退出登录吗?',
success: async (res) => {
console.log(111)
if (res.confirm) {
try {
let data = await this.api.userlogout();
console.log(data)
if (data.code == 1) {
uni.cache.clear();
uni.reLaunch({
url: '/pages/login/login'
});
}
} catch (e) {
//TODO handle the exception
}
}
}
});
},
infn() {
this.list = []
this.form = {
page: 1,
status: 'loadmore',
},
this.is_end = false
this.orderreselist()
},
makePhoneCall(e) {
uni.makePhoneCall({
phoneNumber: e //仅为示例
});
},
async orderokprebook(e) {
let res = await this.api.orderokprebook({
order_id: e.id
})
if (res.code == 1) {
uni.showToast({
title: '预约成功',
icon: 'none'
});
this.infn()
}
},
async orderrefuseprebook(e) {
let res = await this.api.orderrefuseprebook({
order_id: e.id,
refuse_str: ''
})
if (res.code == 1) {
uni.showToast({
title: '拒绝成功',
icon: 'none'
});
this.infn()
}
},
async orderreselist() {
let res = await this.api.orderreselist({
page: this.form.page
})
if (res.code == 1) {
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
ange(w) {
if (w == 1) {
uni.reLaunch({
url: '/pages/stafflist/index'
})
} else {
uni.reLaunch({
url: '/pages/stafflist/time'
})
}
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.content {
padding: 32rpx 28rpx 0 28rpx;
.contentitem {
width: 100%;
padding: 24rpx 32rpx;
background: #FFFFFF;
border-radius: 12rpx;
.onecontentitem {
height: 100%;
.onecontentitemone {
height: 100%;
justify-content: flex-start;
image {
width: 72rpx;
height: 72rpx;
}
}
.onecontentitemtow {
margin-left: 14rpx;
height: 100%;
.onecontentitemtowone {
.onecontentitemtowone_text {
font-size: 32rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.onecontentitemtowone_phone {
margin: 0 15rpx;
font-size: 28rpx;
font-family: Roboto-Regular, Roboto;
font-weight: 400;
color: #999999;
}
}
.onecontentitemtowtow {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.onecontentitemtowthere {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
}
}
.onecontentitembox {
margin-top: 32rpx;
.onecontentitemboxone {
background: #2F87FD;
padding: 16rpx 58rpx;
border-radius: 8rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
}
.onecontentitemboxtow {
margin-left: 52rpx;
padding: 16rpx 58rpx;
border-radius: 8rpx;
border: 2rpx solid #2F87FD;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #2F87FD;
}
}
}
.contentfixed {
position: fixed;
bottom: 16%;
right: 5%;
font-size: 52rpx;
color: #FFFFFF;
image {
width: 100rpx;
height: 100rpx;
}
// width: 100rpx;
// height: 100rpx;
// line-height: 100rpx;
// text-align: center;
// border-radius: 50%;
}
.positionfixed {
position: fixed;
background: #FFFFFF;
width: 100%;
bottom: 0;
left: 0;
padding: 15rpx;
.positionfixeditems::after {
position: absolute;
content: '';
height: 50rpx;
left: 50%;
border-right: 1rpx solid #999;
}
.positionfixeditem {
padding: 20rpx 0;
text-align: center;
width: 50%;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
.positionfixedtext {
margin-left: 10rpx;
}
}
}
}
</style>

445
pages/stafflist/time.vue Normal file
View File

@@ -0,0 +1,445 @@
<template>
<view class="content">
<view class="contentone">
<view class="onecontenttowone flex-start">
<view class="onecontenttowone_one">
选择休息时间
</view>
</view>
<view class="onecontenttowtow flex-between">
<view class="onecontenttowtow_item flex-between">
<view class=" flex-colum" v-for="(item,index) in reservationlist" :key="index"
:class="reservationshow == index ? 'onecontenttowtow_item_ones':'onecontenttowtow_item_one'"
@click="reservation(item,index)">
<text class="onecontenttowtow_item_one_textone">{{item.week}}</text>
<text class="onecontenttowtow_item_one_texttow">{{item.date.slice(5,10)}}</text>
</view>
</view>
<view class="onecontenttowtow_left flex-colum" @click="calendarshow = true">
<u-icon name="calendar" color="#b4b4b4" size="20"></u-icon>
<text class="onecontenttowtow_lefttext">选择</text>
</view>
</view>
<view class="onecontenttowthere flex-start">
<view v-for="(item,index) in listday_time" :key="index" @click="clicktime(item,index)"
:class="item.select?'onecontenttowthere_items':'onecontenttowthere_item'">
{{item.time}}
</view>
</view>
</view>
<view class="contentone" style="margin-top: 40rpx;">
<view class="onecontenttowone flex-start">
<view class="onecontenttowone_one">
我的休息时间
</view>
</view>
<view class="onecontenttowthere flex-start">
<view v-for="(item,index) in listday_xx" :key="index" class="onecontenttowthere_item">
{{item.time}}
</view>
</view>
</view>
<view class="contentbox" @click="staffsavestaffhours">
提交
</view>
<view class="positionfixed flex-between">
<view class="positionfixeditem flex-center positionfixeditems" @click="ange(1)">
<u-icon name="list-dot" color="#2979ff" size="14"></u-icon>
<text class="positionfixedtext">预约列表</text>
</view>
<view class="positionfixeditem flex-center" @click="ange(2)">
<u-icon name="clock" color="#2979ff" size="14"></u-icon>
<text class="positionfixedtext">修改时间</text>
</view>
</view>
<view :style="{height:height}"></view>
<u-calendar mode="single" @confirm="confirm" :show="calendarshow" @close="calendarshow = false"></u-calendar>
</view>
</template>
<script>
export default {
data() {
return {
height: '',
reservationshow: 0,
reservationlist: [],
calendarshow: false,
listday_time: [],
listday_xx: [],
listday_xxxxx: [],
day_time: '', //日期
day_hour: '', //小时
}
},
onLoad() {
// #ifdef MP-WEIXIN
wx.hideHomeButton()
// #endif
this.confirm() //初始时间
},
onShow() {},
mounted() {
var query = uni.createSelectorQuery().in(this).select('.positionfixed')
query.boundingClientRect(ele => {
var that = this;
uni.getSystemInfo({
success(res) {
that.height = ele.height + "px";
that = null;
}
})
}).exec();
},
methods: {
ange(w) {
if (w == 1) {
uni.reLaunch({
url: '/pages/stafflist/index'
})
} else {
uni.reLaunch({
url: '/pages/stafflist/time'
})
}
},
clicktime(d, p) {
this.listday_time[p].select = !d.select
let res = this.listday_time.filter((num, index) => {
return num.select !== false
})
this.listday_xx = [...this.listday_xxxxx, ...res]
},
reservation(a, b) {
this.reservationshow = b
this.day_time = a.date
this.staffbhoures() //获取预约时间
},
async staffsavestaffhours() { //提交
let hours_str = this.listday_xx.map(ele => {
return ele.time
});
let res = await this.api.staffsavestaffhours({
day_time: this.day_time,
hours_str: hours_str.toString()
})
if (res.code == 1) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
}
},
async staffbhoures() {
let res = await this.api.staffbhoures({
day_time: this.day_time
})
this.listday_xxxxx = []
if (res.length != 0) {
this.listday_time = res.data.hours
let dataxx = res.data.hours.filter((num, index) => {
return num.select !== false
})
try {
if (res.data.xx.split(",").length > dataxx.length) {
this.listday_xxxxx = res.data.xx.split(",").slice(0, (res.data.xx.split(",").length -
dataxx
.length)).map(ele => {
return {
select: true,
time: ele
}
});
}
} catch (e) {
//TODO handle the exception
}
this.listday_xx = [...this.listday_xxxxx, ...dataxx]
} else {
this.listday_time = []
}
},
confirm(e) {
if (e) {
this.calendarshow = false
console.log(new Date(e[0]));
var now = new Date(e[0]);
} else {
//获取当前年月日
var now = new Date();
// var year = now.getFullYear(); //得到年份
// var month = now.getMonth() + 1; //得到月份
// var date = now.getDate(); //得到日期
// data = year + "年" + month + "月" + date + "日";
}
this.reservationlist = []
for (let i = 0; i < 7; i++) {
var date = new Date(now.getTime() + i * 24 * 3600 * 1000);
var year = date.getFullYear();
var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1);
var day = (date.getDate()) > 9 ? (date.getDate()) : '0' + (date.getDate());
var dt2 = new Date(now.getTime() + i * 24 * 3600 * 1000);
var weekDay = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
// var weekDays = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
this.reservationlist.push({
date: year + "-" + month + "-" + day,
// date: month + "-" + day,
// day: day,
// weekday: weekDays[dt2.getDay()],
week: weekDay[dt2.getDay()],
});
}
this.day_time = this.reservationlist[0].date
this.staffbhoures() //获取预约时间
}
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.content {
padding: 32rpx 28rpx 0 28rpx;
.contentbox {
width: 80%;
margin: 40rpx auto;
padding: 24rpx 0;
background: #2F87FD;
font-size: 36rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
text-align: center;
border-radius: 48rpx;
}
.contentone {
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx 28rpx;
.onecontenttowone {
.onecontenttowone_one {
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-size: 28rpx;
font-weight: 500;
color: #333333;
}
}
.onecontenttowtow {
margin-top: 32rpx;
.onecontenttowtow_item {
flex: 1;
flex-wrap: nowrap;
.onecontenttowtow_item_one:nth-child(1) {
margin: 0 !important;
}
.onecontenttowtow_item_one {
padding: 6rpx;
.onecontenttowtow_item_one_textone {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
.onecontenttowtow_item_one_texttow {
margin-top: 5rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
}
.onecontenttowtow_item_ones {
padding: 6rpx;
border-radius: 10rpx;
background: #2f87fd;
.onecontenttowtow_item_one_textone {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
}
.onecontenttowtow_item_one_texttow {
margin-top: 5rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
}
}
}
.onecontenttowtow_left {
border-left: 1rpx solid #f9f9f9;
background: #FFFFFF;
padding-left: 24rpx;
box-shadow: -2rpx 0px 4rpx 2rpx rgba(193, 193, 193, 0.09);
.onecontenttowtow_lefttext {
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
}
}
.onecontenttowthere {
.onecontenttowthere_item {
width: 20%;
margin: 16rpx 2.5%;
text-align: center;
background: #F7F7F7;
border-radius: 8rpx;
border: 2rpx solid #F7F7F7;
padding: 8rpx 26rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #999999;
}
.onecontenttowthere_items {
width: 20%;
margin: 16rpx 2.5%;
background: #FFFFFF;
border: 2rpx solid #2F87FD;
text-align: center;
border-radius: 8rpx;
padding: 8rpx 26rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #2F87FD;
}
}
}
.contentitem {
width: 100%;
padding: 24rpx 32rpx;
background: #FFFFFF;
border-radius: 12rpx;
.onecontentitem {
height: 100%;
.onecontentitemone {
height: 100%;
justify-content: flex-start;
image {
width: 72rpx;
height: 72rpx;
}
}
.onecontentitemtow {
margin-left: 14rpx;
height: 100%;
.onecontentitemtowone {
.onecontentitemtowone_text {
font-size: 32rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.onecontentitemtowone_phone {
font-size: 28rpx;
font-family: Roboto-Regular, Roboto;
font-weight: 400;
color: #999999;
}
}
.onecontentitemtowtow {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.onecontentitemtowthere {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
}
}
.onecontentitembox {
margin-top: 32rpx;
.onecontentitemboxone {
background: #2F87FD;
padding: 16rpx 58rpx;
border-radius: 8rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
}
.onecontentitemboxtow {
margin-left: 52rpx;
padding: 16rpx 58rpx;
border-radius: 8rpx;
border: 2rpx solid #2F87FD;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #2F87FD;
}
}
}
.positionfixed {
position: fixed;
background: #FFFFFF;
width: 100%;
bottom: 0;
left: 0;
padding: 15rpx;
.positionfixeditems::after {
position: absolute;
content: '';
height: 50rpx;
left: 50%;
border-right: 1rpx solid #999;
}
.positionfixeditem {
padding: 20rpx 0;
text-align: center;
width: 50%;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
.positionfixedtext {
margin-left: 10rpx;
}
}
}
}
</style>