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

196 lines
4.2 KiB

11 months 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
11 months ago
1 year ago
11 months 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. watch: {
  56. FormData: {
  57. handler(newVal) {
  58. if(newVal) {
  59. this.$emit('updatedForm', newVal)
  60. }
  61. },
  62. deep: true
  63. }
  64. },
  65. methods: {
  66. changeStep(val) {
  67. this.$emit('changeStep', val)
  68. },
  69. async simulationDevicesFn() {
  70. let arr = this.FormData.classTime.split('-')
  71. let obj = { "pointId": this.FormData.pointId, "classDate": this.FormData.classDate, "beginTime": arr[0], "endTime": arr[1]}
  72. const {data: res} = await simulationDevices(obj)
  73. this.list = res
  74. },
  75. chooseDevice(item) {
  76. this.FormData.deviceNum = item.seq
  77. this.$emit('updatedForm', this.FormData)
  78. // this.$set(this.FormData, 'deviceNum', )
  79. console.log(this.FormData.deviceNum)
  80. // this.FormData.deviceName = item.seq
  81. },
  82. confirmClick(item) {
  83. if(!this.FormData.deviceNum) return this.$u.toast('请选择模拟器')
  84. this.show = true
  85. },
  86. // 创建预约
  87. async simulationCreateFn() {
  88. let obj = {
  89. "studentId": this.FormData.studentId,
  90. "classId": this.FormData.courseIds,
  91. "deviceNum": this.FormData.deviceNum
  92. }
  93. const res = await simulationCreate(obj)
  94. if(res.code==0) {
  95. this.show = false
  96. this.$u.toast('预约成功')
  97. setTimeout(()=>{
  98. this.$goPage('/pages/mineEntry/myAppointment/myAppointment?currentTab=1')
  99. },1500)
  100. }
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .card {
  107. padding: 28rpx 24rpx;
  108. }
  109. .list {
  110. display: flex;
  111. flex-wrap: wrap;
  112. display: flex;
  113. justify-content: space-between;
  114. .listItem {
  115. width: 32.4%;
  116. height: 120rpx;
  117. background: #F8F8F8;
  118. border-radius: 12rpx;
  119. font-weight: 500;
  120. text-align: center;
  121. line-height: 120rpx;
  122. &.active {
  123. width: 200rpx;
  124. height: 120rpx;
  125. background: rgba(25, 137, 250, 0.1);
  126. border-radius: 12rpx;
  127. border: 2rpx solid $themC;
  128. color: $themC;
  129. }
  130. }
  131. }
  132. .popupCon {
  133. padding: 30rpx 50rpx;
  134. .h2 {
  135. font-weight: 600;
  136. color: #333333;
  137. line-height: 70rpx;
  138. font-size: 36rpx;
  139. text-align: center;
  140. }
  141. .content {
  142. padding-bottom: 20rpx;
  143. .row {
  144. padding: 22rpx 0;
  145. display: flex;
  146. font-size: 28rpx;
  147. align-items: center;
  148. .lab {
  149. width: 180rpx;
  150. color: #686B73;
  151. }
  152. .val {
  153. flex: 1;
  154. font-weight: 500;
  155. }
  156. }
  157. }
  158. }
  159. .btn_row {
  160. display: flex;
  161. justify-content: space-between;
  162. .btn {
  163. width: 47%;
  164. height: 72rpx;
  165. background: #1989FA;
  166. border-radius: 8rpx;
  167. font-size: 28rpx;
  168. color: #fff;
  169. text-align: center;
  170. line-height: 72rpx;
  171. &.border {
  172. background: rgba(25, 137, 250, 0.1);
  173. border: 2rpx solid $themC;
  174. color: $themC;
  175. }
  176. }
  177. }
  178. </style>