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

201 lines
5.2 KiB

1 year ago
10 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
11 months ago
10 months ago
11 months ago
11 months ago
10 months ago
10 months ago
11 months ago
10 months ago
11 months ago
11 months ago
10 months ago
10 months ago
11 months ago
10 months ago
10 months ago
10 months ago
11 months ago
10 months ago
10 months ago
10 months ago
11 months ago
1 year ago
11 months ago
1 year ago
10 months ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar :title="title"></topNavbar>
  4. <view class="pad" style="padding-bottom: 60rpx;">
  5. <step1 v-if="currentStep==1" @openPopup="openPopup" :FormData="FormData" @showStep2="showStep2" @updatedForm="updatedForm"></step1>
  6. <step2 v-if="currentStep==2" @changeStep="changeStep" :FormData="FormData" ref="step2Ref"></step2>
  7. </view>
  8. <u-popup :show="show" mode="center" :round="8">
  9. <view class="popupCon">
  10. <view class="h2">再次确认预约信息</view>
  11. <view class="content">
  12. <view class="row">
  13. <view class="lab">预约类型</view>
  14. <view class="val">实操训练预约</view>
  15. </view>
  16. <view class="row">
  17. <view class="lab">预约科目</view>
  18. <view class="val">{{FormData.subject==2?'科目二': '科目三'}}</view>
  19. </view>
  20. <view class="row">
  21. <view class="lab">预约场地</view>
  22. <view class="">
  23. <view class="val" v-for="item in FormData.showSiteName" :key="item.id">{{item}}</view>
  24. </view>
  25. </view>
  26. <view class="row">
  27. <view class="lab">预约车辆</view>
  28. <view class="">
  29. <view class="val" v-for="item in FormData.showCarName" :key="item">{{ item }}</view>
  30. </view>
  31. </view>
  32. <view class="row">
  33. <view class="lab">预约时间</view>
  34. <view class="val" >{{ FormData.classDate}} {{FormData.classTime}}</view>
  35. </view>
  36. </view>
  37. <view class="btn_row">
  38. <view class="border btn" @click="show = false">返回修改</view>
  39. <view class="btn" @click="masterCreateFn">确认</view>
  40. </view>
  41. </view>
  42. </u-popup>
  43. </view>
  44. </template>
  45. <script>
  46. import step1 from './comp/step1'
  47. import step2 from './comp/step2'
  48. import { masterCreate } from '@/config/api.js'
  49. export default {
  50. components: { step1, step2,},
  51. data() {
  52. return {
  53. currentStep: 1,
  54. title: '实操训练预约',
  55. FormData: {
  56. carId: '',
  57. subject: 2,
  58. classDate: '',
  59. classTime: '',
  60. licnum: '',
  61. trainType: 'C1',
  62. coachId: '',
  63. coachName: '',
  64. carNumber: '',//车牌号
  65. siteName: '',//场地名称
  66. siteAddress: '',//场地地址
  67. photoPath: '',
  68. courseArr: [],
  69. showSiteName: [],//去重后的场地
  70. showCarName: [],//去重后的车
  71. },
  72. show: false
  73. }
  74. },
  75. onLoad(options) {
  76. this.subject = options.subject
  77. if(this.subject==2) {
  78. this.title = '实操训练科目二预约'
  79. }else if(this.subject==3) {
  80. this.title = '实操训练科目三预约'
  81. }
  82. if(options.subject) this.FormData.subject = options.subject
  83. this.FormData.trainType = this.vuex_userInfo.trainType
  84. this.FormData.studentId = this.vuex_userInfo.id
  85. this.FormData.coachId = this.vuex_userInfo.coachId
  86. this.FormData.coachName = this.vuex_userInfo.coachName
  87. },
  88. onReachBottom() {
  89. if(this.currentStep==2) {
  90. this.$refs.step2Ref.addCoachPage()
  91. }
  92. },
  93. methods: {
  94. updatedForm(val) {
  95. this.FormData = val
  96. },
  97. changeStep(num) {
  98. this.currentStep = num
  99. },
  100. openPopup() {
  101. this.FormData.classDate = this.FormData.courseArr[0].classDate
  102. this.FormData.showSiteName = [...new Set(this.FormData.courseArr.map(item=>item.siteName))]
  103. this.FormData.showCarName = [...new Set(this.FormData.courseArr.map(item=>item.carNumber))]
  104. let classTime = [...new Set(this.FormData.courseArr.map(item=>{ return item.classTime.slice(0,2)}))]
  105. if(classTime.length>1) {
  106. let minTime = Math.min(...classTime)
  107. let maxTime = Math.max(...classTime)
  108. this.FormData.classTime = (minTime*1>9?minTime: '0'+minTime + '-') + (maxTime*1>9?maxTime: '0'+maxTime)
  109. }else {
  110. this.FormData.classTime = this.FormData.courseArr[0].classTime
  111. }
  112. this.show = true
  113. },
  114. showStep2() {
  115. this.currentStep = 2
  116. },
  117. async masterCreateFn() {
  118. this.show = false
  119. let obj = {
  120. "studentId": this.FormData.studentId,
  121. "coachId": this.FormData.coachId,
  122. "classDate": this.FormData.classDate,
  123. "selectScheduleClass": this.FormData.courseArr.map(item=>item.id),
  124. // classId: [this.FormData.courseIds]
  125. }
  126. const {data: res} = await masterCreate(obj)
  127. if(res) {
  128. this.$u.toast('预约成功')
  129. setTimeout(()=>{
  130. this.$goPage('/pages/mineEntry/myAppointment/myAppointment?currentTab=2')
  131. },1500)
  132. }
  133. console.log(res)
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. .popupCon {
  140. padding: 30rpx 50rpx;
  141. .h2 {
  142. font-weight: 600;
  143. color: #333333;
  144. line-height: 70rpx;
  145. font-size: 36rpx;
  146. text-align: center;
  147. margin-bottom: 20rpx;
  148. }
  149. .content {
  150. padding-bottom: 20rpx;
  151. .row {
  152. padding: 22rpx 0;
  153. display: flex;
  154. font-size: 28rpx;
  155. // align-items: center;
  156. .lab {
  157. width: 180rpx;
  158. color: #686B73;
  159. }
  160. .val {
  161. flex: 1;
  162. font-weight: 500;
  163. }
  164. }
  165. }
  166. }
  167. .btn_row {
  168. display: flex;
  169. justify-content: space-between;
  170. padding-bottom: 30rpx;
  171. .btn {
  172. width: 47%;
  173. height: 72rpx;
  174. background: #1989FA;
  175. border-radius: 8rpx;
  176. font-size: 28rpx;
  177. color: #fff;
  178. text-align: center;
  179. line-height: 72rpx;
  180. &.border {
  181. background: rgba(25, 137, 250, 0.1);
  182. border: 2rpx solid $themC;
  183. color: $themC;
  184. }
  185. }
  186. }
  187. </style>