| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <!--
- * @Author: liuzhenlin 461480418@qq.ocm
- * @Date: 2023-01-12 11:57:48
- * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-09-22 14:38:38
- * @Description: file content
- * @FilePath: \labsop小程序\pages\schedule\myAppoint\index.vue
- -->
- <template>
- <div class="panel-wrap">
- <van-empty v-if="appointList.length == 0" mode="list" description="暂无待审核预约"></van-empty>
- <van-list v-else v-model:loading="listloading" class="data-list" :finished="finished" finished-text="没有更多了" @load="onLoad">
- <div class="inst-item mb40" v-for="(v, index) in appointList" :key="index">
- <div class="flex mb20">
- <div class="equ-tit">
- <span class="fontSize14 bold">设备名称:</span>
- </div>
- <div>
- <span class="fontSize14">{{ v.instName }}</span>
- </div>
- </div>
- <div class="flex mb20">
- <div class="equ-tit">
- <span class="fontSize14 bold">设备型号:</span>
- </div>
- <div>
- <span class="fontSize14">{{ v.instNameEn }}</span>
- </div>
- </div>
- <div class="flex mb20" v-if="v.projectName">
- <div class="equ-tit">
- <span class="fontSize14 bold">课题组:</span>
- </div>
- <div>
- <span class="fontSize14">{{ v.projectName }}</span>
- </div>
- </div>
- <div class="flex mb20" v-if="v.serviceName">
- <div class="equ-tit">
- <span class="fontSize14 bold">服务:</span>
- </div>
- <div>
- <span class="fontSize14">{{ v.serviceName }}</span>
- </div>
- </div>
- <div class="flex mb20">
- <div class="equ-tit">
- <span class="fontSize14 bold">所在位置:</span>
- </div>
- <div>
- <span class="fontSize14">{{ v.placeAddress + '(' + v.laboratoryName + ')' }}</span>
- </div>
- </div>
- <div class="flex flex-between">
- <div class="flex">
- <div class="equ-tit">
- <span class="fontSize14 bold">开始时间:</span>
- </div>
- <div>
- <span class="fontSize14">{{ v.startTime }}</span>
- </div>
- </div>
- <div>
- <span class="fontSize14 bold primary-color" @click="handleCancelAppoint(v)">取消预约</span>
- </div>
- </div>
- </div>
- </van-list>
- </div>
- </template>
- <script>
- import { useMyAppointApi } from '/@/api/appoint'
- const myAppointApi = useMyAppointApi()
- import instAppointApi from '/@/api/instr/instAppoint'
- import to from 'await-to-js'
- import { showConfirmDialog, showNotify } from 'vant'
- export default {
- data() {
- return {
- instStatus: {
- 10: '正常',
- 20: '故障',
- 30: '报废'
- },
- appointList: [],
- current: 1,
- queryForm: {
- pageNum: 1,
- pageSize: 10
- },
- total: 0,
- listloading: false,
- finished: false
- }
- },
- mounted() {
- this.queryForm.pageNum = 1
- this.getInstList()
- },
- methods: {
- onLoad() {
- this.queryForm.pageNum++
- this.getInstList()
- },
- handleCancelAppoint(row) {
- showConfirmDialog({
- title: '提示',
- message: '确认取消预约?'
- })
- .then((e) => {
- this.cancelAppoint(row.id)
- })
- .catch(() => {
- console.log('ssss')
- })
- },
- async cancelAppoint(id) {
- const params = { id }
- const [err, res] = await to(instAppointApi.userCancelAppoint(params))
- this.modalVisible = false
- if (err) return
- if (res?.code === 200) {
- this.queryForm.pageNum = 1
- this.appointList = []
- this.getInstList()
- showNotify({ type: 'success', message: '取消成功' })
- }
- },
- // 查询列表
- async getInstList() {
- this.listloading = true
- const [err, res] = await to(myAppointApi.myAppoint(this.queryForm))
- this.listloading = false
- if (err) return
- if (res?.code === 200) {
- this.appointList = this.queryForm.pageNum == 1 ? [...(res?.data?.list || [])] : [...this.appointList, ...(res?.data?.list || [])]
- this.total = res?.data?.total
- if (this.queryForm.pageNum * this.queryForm.pageSize >= res.data.total) {
- this.finished = true
- }
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- * {
- box-sizing: border-box;
- }
- .panel-wrap {
- height: 100%;
- .data-list {
- height: 100%;
- padding: 20px;
- overflow: auto;
- .inst-item {
- border-radius: 10px;
- padding: 15px;
- box-shadow: -2px 0px 9px rgba(0, 0, 0, 0.12);
- margin-bottom: 20px;
- .equ-tit {
- width: 74px;
- }
- }
- }
- }
- </style>
|