xinelu-applet-ui/pagesC/Myappointment/Myappointment.vue

151 lines
3.7 KiB
Vue
Raw Normal View History

2023-10-07 11:08:50 +08:00
<template>
<view class="app">
<u-tabs :list="tabslist" :is-scroll="false" :current="tabscurrent" @change="tabschange" :show-bar='false'
active-color='#26A888'></u-tabs>
2023-11-09 16:46:53 +08:00
<u-empty v-if="appointmentlist==0" text="暂无"></u-empty>
2023-10-17 11:11:52 +08:00
<view class="record" v-for="(item,index) in appointmentlist" :key="index" v-else>
<view class="top">
<span>{{item.formName}}</span>
2023-11-10 15:44:09 +08:00
<span v-if="item.bookingStatus=='1'">已完成 </span>
<span v-if="item.approvalStatus=='1'&&item.bookingStatus=='0'">已同意</span>
<span v-if="item.bookingStatus=='0' &&item.approvalStatus=='2'">已拒绝</span>
<span v-if="item.bookingStatus=='0' &&item.approvalStatus=='0'">待审批</span>
2023-10-17 11:11:52 +08:00
<span v-if="item.bookingStatus=='2'">已取消</span>
</view>
<view class="recorddata">
<view class="recorditem">
{{item.packageName}}
2023-10-07 11:08:50 +08:00
</view>
2023-10-17 11:11:52 +08:00
<!-- <view class="recorditem"
v-if="item.bookingStatus=='0'||item.bookingStatus=='1'||item.bookingStatus=='2'">
申请时间{{item.applyTime}}
</view> -->
<view class="recorditem" v-if="item.bookingStatus=='1'&&item.completeTime">
完成时间{{item.completeTime}}
2023-10-07 11:08:50 +08:00
</view>
2023-10-17 11:11:52 +08:00
<view class="recorditem">
预约时间{{item.bookingTime}}
2023-10-07 11:08:50 +08:00
</view>
2023-10-17 11:11:52 +08:00
<view class="recorditem" v-if="item.bookingStatus=='2'">
取消时间{{item.cancelTime}}
2023-10-07 11:08:50 +08:00
</view>
2023-10-17 11:11:52 +08:00
</view>
<view class="evaluate" @tap="evaluatetime(item)" v-if="item.bookingStatus=='0'&&item.approvalStatus=='0'">
<view class="evaluatedata">
取消预约
2023-10-07 11:08:50 +08:00
</view>
</view>
2023-10-17 11:11:52 +08:00
<u-toast ref="uToast" />
</view>
2023-10-07 11:08:50 +08:00
</view>
</template>
<script>
2023-10-17 11:11:52 +08:00
import {
list,
cancel
} from '@/api/pagesC/myappointment/myappointment.js'
2023-10-07 11:08:50 +08:00
export default {
data() {
return {
2023-11-10 15:44:09 +08:00
name: '',
2023-10-07 11:08:50 +08:00
tabslist: [{
name: '全部',
2023-10-17 11:11:52 +08:00
completed: '',
2023-10-07 11:08:50 +08:00
}, {
2023-10-17 11:11:52 +08:00
name: '已完成',
completed: '2',
2023-10-07 11:08:50 +08:00
}, {
2023-10-17 11:11:52 +08:00
name: '未完成',
completed: '1',
2023-10-07 11:08:50 +08:00
}, ],
tabscurrent: 0,
2023-11-10 15:44:09 +08:00
listtotal: 0,
2023-10-17 11:11:52 +08:00
query: {
pageNum: 1,
pageSize: 10,
identity: '',
completed: '',
},
appointmentlist: [],
2023-10-07 11:08:50 +08:00
}
},
2023-11-10 15:44:09 +08:00
mounted() {
2023-11-09 16:46:53 +08:00
const value = uni.getStorageSync('userinfo');
this.query.identity = value.cardNo
2023-10-17 11:11:52 +08:00
this.info();
},
2023-11-10 15:44:09 +08:00
onReachBottom() { //下滑加载
if (this.appointmentlist.length >= this.listtotal) {} else {
this.query.pageNum++
list(this.query).then(res => {
this.appointmentlist = res.rows
})
}
},
onPullDownRefresh() { //下拉刷新
this.info();
// this.query.pageNum++
this.query.pageNum = 1;
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
2023-10-07 11:08:50 +08:00
methods: {
2023-10-17 11:11:52 +08:00
info() {
list(this.query).then(res => {
this.appointmentlist = res.rows
2023-11-10 15:44:09 +08:00
this.listtotal = res.total
2023-10-17 11:11:52 +08:00
})
},
evaluatetime(item) {
2023-11-10 15:44:09 +08:00
uni.showModal({
title: '提示',
content: '确定取消预约吗',
cancelText: "取消", // 取消按钮的文字
confirmText: "确认", // 确认按钮文字
success: (res) => {
console.log(res, '78')
if (res.confirm) {
cancel(item.bookingNo).then(res => {
if (res.code == 200) {
uni.showModal({
title: '提示',
content: '取消预约成功',
})
this.info();
} else if (res.code == 500) {
uni.showModal({
title: '提示',
content: res.msg,
})
}
})
}
2023-10-17 11:11:52 +08:00
}
})
},
2023-10-07 11:08:50 +08:00
//点击tabs
tabschange(index) {
2023-10-17 11:11:52 +08:00
this.tabscurrent = index
if (index == '1') {
this.query.completed = '1'
this.info();
} else if (index == '2') {
this.query.completed = '2'
this.info();
} else if (index == '0') {
this.query.completed = ''
this.info();
}
2023-10-07 11:08:50 +08:00
},
}
}
</script>
<style lang="scss">
@import './Myappointment.scss'
2023-10-17 11:11:52 +08:00
</style>