YNUtdPlatform/pages/HealthExaminationApp/myAppointment/myAppointment.vue

283 lines
7.4 KiB
Vue
Raw Normal View History

2024-09-02 15:08:09 +08:00
<template>
2024-09-05 15:05:17 +08:00
<div>
<u-navbar title="我的预约" @leftClick="leftClick" placeholder></u-navbar>
<div class="content">
<div class="item-wrapper">
<div class="item" @click="show = true">
<div v-if="!makeStatus">请选择体检状态</div>
<div v-else>{{ makeStatus }}</div>
<div><u-icon name="arrow-right"></u-icon></div>
</div>
<div class="btn">
<u-button type="primary" text="查询" @click="handleQuery"></u-button>
</div>
2024-09-04 18:29:27 +08:00
</div>
2024-09-19 11:32:22 +08:00
<u-picker :show="show" :columns="columns" keyName="label" @cancel="show = false" @confirm="handleSearch"></u-picker>
2024-09-04 15:18:01 +08:00
2024-09-05 15:05:17 +08:00
<div class="tip">提示向左滑动取消预约</div>
2024-09-04 18:29:27 +08:00
2024-09-05 15:05:17 +08:00
<u-swipe-action class="swipe-wrapper">
<u-swipe-action-item
class="swipe-item"
:options="options"
v-for="(item, index) in makeList"
:key="index"
:disabled="item.ifCancel != 2"
@click="handleDelete(item)"
>
<div class="swipe-action" @click="handleOption(item)">
<div class="item-icon">
<u-icon
v-if="item.ifCancel == 1 || item.ifCancel == 4"
name="/static/images-tijian/isCanceled.png"
size="120"
></u-icon>
<u-icon v-else-if="item.ifCancel == 2" name="/static/images-tijian/readyExam.png" size="120"></u-icon>
<u-icon v-else name="/static/images-tijian/isExamed.png" size="120"></u-icon>
</div>
<div class="item-cont">
<div class="hospital-name">{{ item.hospitalName }}</div>
<div class="combName">
<div>{{ item.combName }}</div>
<div style="color: red">{{ item.setMealPrice || '0.0' }}</div>
</div>
<div>预约时间{{ item.phyAppontTime }}</div>
2024-09-04 18:29:27 +08:00
</div>
</div>
2024-09-05 15:05:17 +08:00
</u-swipe-action-item>
</u-swipe-action>
</div>
2024-09-04 18:29:27 +08:00
</div>
2024-09-02 15:08:09 +08:00
</template>
<script>
2024-09-04 18:29:27 +08:00
import config from '@/config'
2024-09-06 17:35:31 +08:00
import Crypoto from '@/utils/aescbc'
2024-09-04 18:29:27 +08:00
export default {
data() {
return {
token: '',
show: false,
2024-09-05 15:05:17 +08:00
columns: [
[
2024-09-19 15:28:28 +08:00
{ label: '全部', value: '' },
2024-09-05 15:05:17 +08:00
{ label: '已取消', value: 1 },
{ label: '待体检', value: 2 },
{ label: '已体检', value: 3 }
]
],
2024-09-04 18:29:27 +08:00
// 体检状态
makeStatus: '',
2024-09-19 15:28:28 +08:00
makeStatusValue: '',
2024-09-04 18:29:27 +08:00
// 列表
makeList: [],
2024-09-05 15:05:17 +08:00
// 全部列表
allList: [],
// 已取消列表
canceledList: [],
// 待体检列表
readyList: [],
// 已体检
examList: [],
2024-09-04 18:29:27 +08:00
isDisabled: false,
options: [
{
2024-09-05 15:05:17 +08:00
text: '取消',
2024-09-04 18:29:27 +08:00
style: {
backgroundColor: '#f56c6c'
}
}
]
}
},
created() {
this.token = uni.getStorageSync('tjToken')
},
mounted() {
this.getList()
},
methods: {
handleSearch(e) {
console.log('🚀 ~ handleSearch ~ e:', e)
2024-09-05 15:05:17 +08:00
this.makeStatus = e.value[0].label
this.makeStatusValue = e.value[0].value
2024-09-04 18:29:27 +08:00
this.show = false
},
2024-09-05 15:05:17 +08:00
handleQuery(){
2024-09-19 15:28:28 +08:00
this.getList()
2024-09-05 15:05:17 +08:00
},
2024-09-04 18:29:27 +08:00
// 获取列表 getpersonappointInfo
getList() {
2024-09-19 15:28:28 +08:00
const params = {
token: this.token,
ifCancel: this.makeStatusValue
}
console.log('🚀 ~ 列表 ~ params:', params)
2024-09-04 18:29:27 +08:00
uni.request({
url: config.tjBaseUrl + '/app/getpersonappointInfo',
method: 'post',
2024-09-19 15:28:28 +08:00
data: params,
2024-09-04 18:29:27 +08:00
header: {
'Content-Type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
res = res.data
console.log('🚀 ~ 列表 ~ res:', res)
2024-09-19 13:22:19 +08:00
if (res.res == 1 && res.obj != 'isnull') {
2024-09-19 15:28:28 +08:00
this.makeList = res.obj
} else if (res.res == 1 && res.obj == 'isnull') {
this.makeList = []
} else {
uni.showToast({
title: '系统异常,请联系管理员',
icon: 'none'
})
2024-09-04 18:29:27 +08:00
}
},
fail: err => {
console.log('🚀 ~ 列表 ~ err:', err)
2024-09-19 15:28:28 +08:00
uni.showToast({
title: '系统异常,请联系管理员',
icon: 'none'
})
2024-09-04 18:29:27 +08:00
}
})
},
2024-09-05 15:05:17 +08:00
// 操作-删除 cancelpoint
handleDelete(item) {
2024-09-06 17:35:31 +08:00
const cry = new Crypoto()
2024-09-05 15:05:17 +08:00
console.log('🚀 ~ handleDelete ~ item:', item)
const params = {
2024-09-06 17:35:31 +08:00
cancelId: cry.encrypt(item.id),
2024-09-05 15:05:17 +08:00
mealType: item.setMealType,
token: this.token
}
// 弹框确认
uni.showModal({
title: '提示',
content: '确认取消预约吗?',
success: res => {
console.log('🚀 ~ handleDelete ~ res:', res)
if (res.confirm) {
uni.request({
url: config.tjBaseUrl + '/app/cancelpoint',
method: 'post',
data: params,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
res = res.data
console.log('🚀 ~ 取消预约 ~ res:', res)
if (res.res == 1) {
if (item.setMealType == '2') {
uni.removeStorageSync('appoint')
} else if (item.setMealType == '3') {
uni.removeStorageSync('jobAppoint')
}
// 刷新 - 重定向
uni.redirectTo({
url: '/pages/HealthExaminationApp/myAppointment/myAppointment'
})
}
},
fail: err => {
console.log('🚀 ~ 列表 ~ err:', err)
}
})
}
},
fail: err => {
console.log('🚀 ~ handleDelete ~ err:', err)
}
})
},
//
handleOption(item) {
console.log('🚀 ~ handleOption ~ item:', item)
const params = {
id: item.id,
combName: item.combName
}
console.log('🚀 ~ handleOption ~ params:', params)
uni.navigateTo({
url: '/pages/HealthExaminationApp/myAppointment/healthExamDetails?params=' + JSON.stringify(params)
})
},
leftClick() {
uni.reLaunch({
url: '/pages/HealthExaminationApp/index/index'
})
}
2024-09-04 18:29:27 +08:00
}
}
2024-09-02 15:08:09 +08:00
</script>
<style lang="scss" scoped>
2024-09-04 18:29:27 +08:00
.content {
padding: 10px;
}
.item-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
.item {
padding: 0 15px;
width: calc(100vw - 100px);
height: 50px;
display: flex;
justify-content: space-between;
align-items: center;
background: #f5f5f5;
border-radius: 50px;
font-size: 14px;
margin-right: 10px;
}
.btn {
width: 50px;
}
}
.tip {
margin-left: 10px;
margin-bottom: 20px;
color: #999;
font-size: 15px;
}
.swipe-item {
border-radius: 5px;
margin: 10px 0;
.swipe-action {
padding: 10px;
border-radius: 5px;
word-break: break-all;
.item-icon {
//定位 移到左上角
position: absolute;
top: -42px;
left: -36px;
}
.item-cont {
margin-left: 50px;
.hospital-name {
font-size: 15px;
font-weight: bold;
line-height: 1.5;
}
2024-09-02 15:08:09 +08:00
2024-09-04 18:29:27 +08:00
.combName {
display: flex;
justify-content: space-between;
}
}
}
}
</style>