洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
3.9 KiB

  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="预约详情"></topNavbar>
  4. <!-- 详情 -->
  5. <view class="pad">
  6. <view class="card">
  7. <imitate v-if="type==1" :info="info"/>
  8. <opera v-else-if="type==2" :info="info" ref="operaRef"/>
  9. <examin v-else-if="type==3" :info="info"/>
  10. </view>
  11. <view class="btnCon" v-if="type!=2">
  12. <view class="btnBg" @click.stop="$goPage('/pages/carEntry/evaluate/evaluate')" v-if="info.writtenoffStatus==2">去评价</view>
  13. <view class="btnBorder" @click="canceClick" v-if="info.recordStatus==0">取消预约</view>
  14. <view class="btnBorder" v-if="info.payStatus==1">申请退款</view>
  15. </view>
  16. <view class="btnCon" v-else>
  17. <view class="btnBg" @click.stop="$goPage('/pages/carEntry/evaluate/evaluate')" v-if="info.loginStatus==2">去评价</view>
  18. <view class="btnBorder" @click="canceClick" v-if="info.loginStatus==0">取消预约</view>
  19. </view>
  20. </view>
  21. <u-popup :show="show" mode="center" :round="20" >
  22. <cancelReservation @popupBtnClick="popupBtnClick"/>
  23. </u-popup>
  24. </view>
  25. </template>
  26. <script>
  27. import imitate from './imitate'
  28. import opera from './opera'
  29. import examin from './examin'
  30. import { examSimulationGet, cancelSimulation, simulationDetail, cancelSimulationDevice, masterDetail, masterCancelBooking } from "@/config/api.js"
  31. export default {
  32. components: { imitate, opera, examin},
  33. data() {
  34. return {
  35. type: 1,
  36. show: false,
  37. id: '',
  38. info: ''
  39. }
  40. },
  41. onLoad(options) {
  42. this.type = options.type
  43. this.id = options.id
  44. if(this.type==3) {
  45. this.examSimulationGetFn()
  46. }else if(this.type==1) {
  47. this.simulationDetailFn()
  48. }else {
  49. this.masterDetailFn()
  50. }
  51. },
  52. methods: {
  53. // 获得考场模拟详情
  54. async examSimulationGetFn() {
  55. const {data: res} = await examSimulationGet({id: this.id})
  56. this.info = res
  57. },
  58. // 获得实操拟详情
  59. async masterDetailFn() {
  60. const {data: res} = await masterDetail({id: this.id})
  61. res.bookingDetailRespVOS = res.bookingDetailRespVOS.sort((a,b)=>{
  62. return parseInt(a.classTime.slice(0,2)) - parseInt(b.classTime.slice(0,2))
  63. })
  64. this.info = res
  65. },
  66. // 获得模拟预约详情
  67. async simulationDetailFn(item) {
  68. const {data: res} = await simulationDetail({id: this.id})
  69. this.info = res
  70. },
  71. // 取消考场模拟预约
  72. async cancelSimulationFn() {
  73. const res = await cancelSimulation({id: this.id})
  74. console.log('没来到这里?')
  75. // console.log(res)
  76. // if(res.code==0) {
  77. this.$u.toast('取消成功')
  78. this.examSimulationGetFn()
  79. // }
  80. },
  81. // 取消模拟预约
  82. async cancelSimulationDeviceFn() {
  83. const {data: res} = await cancelSimulationDevice({id: this.id})
  84. this.$u.toast('取消成功')
  85. this.simulationDetailFn()
  86. },
  87. // 取消实操预约
  88. async masterCancelBookingFn() {
  89. let ids = this.$refs.operaRef.ids
  90. const {data: res} = await masterCancelBooking(ids.join())
  91. this.$refs.operaRef.ids = []
  92. this.$u.toast('取消成功')
  93. this.masterDetailFn()
  94. },
  95. // 取消预约事件
  96. popupBtnClick(val) {
  97. if(val==1) {
  98. if(this.type==1) {
  99. this.cancelSimulationDeviceFn()
  100. }else if(this.type==3) {
  101. this.cancelSimulationFn()
  102. }else {
  103. this.masterCancelBookingFn()
  104. }
  105. }
  106. this.show = false
  107. console.log(val)
  108. },
  109. canceClick() {
  110. if(this.type==2) {
  111. let ids = this.$refs.operaRef.ids
  112. if(!ids.length) return this.$u.toast('请选择取消时间段')
  113. }
  114. this.show=true
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .card {
  121. padding: 0 24rpx;
  122. }
  123. .btnCon {
  124. display: flex;
  125. flex-direction: column;
  126. align-items: center;
  127. justify-content: center;
  128. margin-top: 76rpx;
  129. .btnBg {
  130. width: 212rpx;
  131. margin-bottom: 40rpx;
  132. }
  133. .btnBorder {
  134. width: 396rpx;
  135. border: 2rpx solid #E8E9EC;
  136. background-color: #fff;
  137. color: #ADADAD;
  138. margin-bottom: 40rpx;
  139. }
  140. }
  141. </style>