index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-09-22 14:38:38
  6. * @Description: file content
  7. * @FilePath: \labsop小程序\pages\schedule\myAppoint\index.vue
  8. -->
  9. <template>
  10. <div class="panel-wrap">
  11. <van-empty v-if="appointList.length == 0" mode="list" description="暂无待审核预约"></van-empty>
  12. <van-list v-else v-model:loading="listloading" class="data-list" :finished="finished" finished-text="没有更多了" @load="onLoad">
  13. <div class="inst-item mb40" v-for="(v, index) in appointList" :key="index">
  14. <div class="flex mb20">
  15. <div class="equ-tit">
  16. <span class="fontSize14 bold">设备名称:</span>
  17. </div>
  18. <div>
  19. <span class="fontSize14">{{ v.instName }}</span>
  20. </div>
  21. </div>
  22. <div class="flex mb20">
  23. <div class="equ-tit">
  24. <span class="fontSize14 bold">设备型号:</span>
  25. </div>
  26. <div>
  27. <span class="fontSize14">{{ v.instNameEn }}</span>
  28. </div>
  29. </div>
  30. <div class="flex mb20" v-if="v.projectName">
  31. <div class="equ-tit">
  32. <span class="fontSize14 bold">课题组:</span>
  33. </div>
  34. <div>
  35. <span class="fontSize14">{{ v.projectName }}</span>
  36. </div>
  37. </div>
  38. <div class="flex mb20" v-if="v.serviceName">
  39. <div class="equ-tit">
  40. <span class="fontSize14 bold">服务:</span>
  41. </div>
  42. <div>
  43. <span class="fontSize14">{{ v.serviceName }}</span>
  44. </div>
  45. </div>
  46. <div class="flex mb20">
  47. <div class="equ-tit">
  48. <span class="fontSize14 bold">所在位置:</span>
  49. </div>
  50. <div>
  51. <span class="fontSize14">{{ v.placeAddress + '(' + v.laboratoryName + ')' }}</span>
  52. </div>
  53. </div>
  54. <div class="flex flex-between">
  55. <div class="flex">
  56. <div class="equ-tit">
  57. <span class="fontSize14 bold">开始时间:</span>
  58. </div>
  59. <div>
  60. <span class="fontSize14">{{ v.startTime }}</span>
  61. </div>
  62. </div>
  63. <div>
  64. <span class="fontSize14 bold primary-color" @click="handleCancelAppoint(v)">取消预约</span>
  65. </div>
  66. </div>
  67. </div>
  68. </van-list>
  69. </div>
  70. </template>
  71. <script>
  72. import { useMyAppointApi } from '/@/api/appoint'
  73. const myAppointApi = useMyAppointApi()
  74. import instAppointApi from '/@/api/instr/instAppoint'
  75. import to from 'await-to-js'
  76. import { showConfirmDialog, showNotify } from 'vant'
  77. export default {
  78. data() {
  79. return {
  80. instStatus: {
  81. 10: '正常',
  82. 20: '故障',
  83. 30: '报废'
  84. },
  85. appointList: [],
  86. current: 1,
  87. queryForm: {
  88. pageNum: 1,
  89. pageSize: 10
  90. },
  91. total: 0,
  92. listloading: false,
  93. finished: false
  94. }
  95. },
  96. mounted() {
  97. this.queryForm.pageNum = 1
  98. this.getInstList()
  99. },
  100. methods: {
  101. onLoad() {
  102. this.queryForm.pageNum++
  103. this.getInstList()
  104. },
  105. handleCancelAppoint(row) {
  106. showConfirmDialog({
  107. title: '提示',
  108. message: '确认取消预约?'
  109. })
  110. .then((e) => {
  111. this.cancelAppoint(row.id)
  112. })
  113. .catch(() => {
  114. console.log('ssss')
  115. })
  116. },
  117. async cancelAppoint(id) {
  118. const params = { id }
  119. const [err, res] = await to(instAppointApi.userCancelAppoint(params))
  120. this.modalVisible = false
  121. if (err) return
  122. if (res?.code === 200) {
  123. this.queryForm.pageNum = 1
  124. this.appointList = []
  125. this.getInstList()
  126. showNotify({ type: 'success', message: '取消成功' })
  127. }
  128. },
  129. // 查询列表
  130. async getInstList() {
  131. this.listloading = true
  132. const [err, res] = await to(myAppointApi.myAppoint(this.queryForm))
  133. this.listloading = false
  134. if (err) return
  135. if (res?.code === 200) {
  136. this.appointList = this.queryForm.pageNum == 1 ? [...(res?.data?.list || [])] : [...this.appointList, ...(res?.data?.list || [])]
  137. this.total = res?.data?.total
  138. if (this.queryForm.pageNum * this.queryForm.pageSize >= res.data.total) {
  139. this.finished = true
  140. }
  141. }
  142. }
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped>
  147. * {
  148. box-sizing: border-box;
  149. }
  150. .panel-wrap {
  151. height: 100%;
  152. .data-list {
  153. height: 100%;
  154. padding: 20px;
  155. overflow: auto;
  156. .inst-item {
  157. border-radius: 10px;
  158. padding: 15px;
  159. box-shadow: -2px 0px 9px rgba(0, 0, 0, 0.12);
  160. margin-bottom: 20px;
  161. .equ-tit {
  162. width: 74px;
  163. }
  164. }
  165. }
  166. }
  167. </style>