学员端小程序
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.

183 lines
4.0 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="step3">
  3. <view class="card">
  4. <view class="list">
  5. <view class="listItem" v-for="(item,index) in list" :key="index" :class="{active: FormData.deviceNum==item.seq}" @click="chooseDevice(item)">
  6. {{ item.seq }}</view>
  7. </view>
  8. </view>
  9. <view class="btn_row" style="margin-top: 108rpx;">
  10. <view class="border btn" @click="changeStep(2)">返回上一步</view>
  11. <view class="btn" @click="confirmClick">确认</view>
  12. </view>
  13. <u-popup :show="show" mode="center" :round="8">
  14. <view class="popupCon">
  15. <view class="h2">再次确认预约信息</view>
  16. <view class="content">
  17. <view class="row">
  18. <view class="lab">预约类型</view>
  19. <view class="val">模拟器训练预约</view>
  20. </view>
  21. <view class="row">
  22. <view class="lab">预约时间</view>
  23. <view class="val">{{FormData.classDate}} {{ FormData.classTime}}</view>
  24. </view>
  25. <view class="row">
  26. <view class="lab">模拟驾驶馆</view>
  27. <view class="val">{{FormData.pointName}}</view>
  28. </view>
  29. <view class="row">
  30. <view class="lab">预约模拟器</view>
  31. <view class="val">{{ FormData.deviceNum}}</view>
  32. </view>
  33. </view>
  34. <view class="btn_row">
  35. <view class="border btn" @click="show = false">返回修改</view>
  36. <view class="btn" @click="simulationCreateFn">确认</view>
  37. </view>
  38. </view>
  39. </u-popup>
  40. </view>
  41. </template>
  42. <script>
  43. import { simulationDevices, simulationCreate } from '@/config/api.js'
  44. export default {
  45. props: ['FormData'],
  46. data() {
  47. return {
  48. list: [],
  49. show: false
  50. }
  51. },
  52. created() {
  53. this.simulationDevicesFn()
  54. },
  55. methods: {
  56. changeStep(val) {
  57. this.$emit('changeStep', val)
  58. },
  59. async simulationDevicesFn() {
  60. let arr = this.FormData.classTime.split('-')
  61. let obj = { "pointId": this.FormData.pointId, "classDate": this.FormData.classDate, "beginTime": arr[0], "endTime": arr[1]}
  62. const {data: res} = await simulationDevices(obj)
  63. this.list = res
  64. },
  65. chooseDevice(item) {
  66. this.FormData.deviceNum = item.seq
  67. // this.FormData.deviceName = item.seq
  68. },
  69. confirmClick(item) {
  70. if(!this.FormData.deviceNum) return this.$u.toast('请选择模拟器')
  71. this.show = true
  72. },
  73. // 创建预约
  74. async simulationCreateFn() {
  75. let obj = {
  76. "studentId": this.FormData.studentId,
  77. "classId": this.FormData.courseIds,
  78. "deviceNum": this.FormData.deviceNum
  79. }
  80. const res = await simulationCreate(obj)
  81. if(res.code==0) {
  82. this.show = false
  83. this.$u.toast('预约成功')
  84. setTimeout(()=>{
  85. this.$goPage('/pages/mineEntry/myAppointment/myAppointment?currentTab=1')
  86. },1500)
  87. }
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .card {
  94. padding: 28rpx 24rpx;
  95. }
  96. .list {
  97. display: flex;
  98. flex-wrap: wrap;
  99. display: flex;
  100. justify-content: space-between;
  101. .listItem {
  102. width: 32.4%;
  103. height: 120rpx;
  104. background: #F8F8F8;
  105. border-radius: 12rpx;
  106. font-weight: 500;
  107. text-align: center;
  108. line-height: 120rpx;
  109. &.active {
  110. width: 200rpx;
  111. height: 120rpx;
  112. background: rgba(25, 137, 250, 0.1);
  113. border-radius: 12rpx;
  114. border: 2rpx solid $themC;
  115. color: $themC;
  116. }
  117. }
  118. }
  119. .popupCon {
  120. padding: 30rpx 50rpx;
  121. .h2 {
  122. font-weight: 600;
  123. color: #333333;
  124. line-height: 70rpx;
  125. font-size: 36rpx;
  126. text-align: center;
  127. }
  128. .content {
  129. padding-bottom: 20rpx;
  130. .row {
  131. padding: 22rpx 0;
  132. display: flex;
  133. font-size: 28rpx;
  134. align-items: center;
  135. .lab {
  136. width: 180rpx;
  137. color: #686B73;
  138. }
  139. .val {
  140. flex: 1;
  141. font-weight: 500;
  142. }
  143. }
  144. }
  145. }
  146. .btn_row {
  147. display: flex;
  148. justify-content: space-between;
  149. .btn {
  150. width: 47%;
  151. height: 72rpx;
  152. background: #1989FA;
  153. border-radius: 8rpx;
  154. font-size: 28rpx;
  155. color: #fff;
  156. text-align: center;
  157. line-height: 72rpx;
  158. &.border {
  159. background: rgba(25, 137, 250, 0.1);
  160. border: 2rpx solid $themC;
  161. color: $themC;
  162. }
  163. }
  164. }
  165. </style>