洛阳学员端
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.

200 lines
5.1 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar :title="title"></topNavbar>
  4. <view class="pad" style="padding-bottom: 60rpx;">
  5. <step1 @openPopup="openPopup" :FormData="FormData" @updatedForm="updatedForm"></step1>
  6. <!-- <step2 v-if="currentStep==2" @changeStep="changeStep" :FormData="FormData" ref="step2Ref" @updatedForm="updatedForm"></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, },
  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. },
  90. methods: {
  91. updatedForm(val) {
  92. console.log('更新了?')
  93. console.log(val)
  94. this.FormData = val
  95. },
  96. // changeStep(num) {
  97. // this.currentStep = num
  98. // },
  99. openPopup() {
  100. this.FormData.classDate = this.FormData.courseArr[0].classDate
  101. this.FormData.showSiteName = [...new Set(this.FormData.courseArr.map(item=>item.siteName))]
  102. this.FormData.showCarName = [...new Set(this.FormData.courseArr.map(item=>item.carNumber))]
  103. let classTime = [...new Set(this.FormData.courseArr.map(item=>{ return item.classTime.slice(0,2)}))]
  104. if(classTime.length>1) {
  105. let minTime = Math.min(...classTime)
  106. let maxTime = Math.max(...classTime)
  107. this.FormData.classTime = (minTime*1>9?minTime: '0'+minTime + '-') + (maxTime*1>9?maxTime: '0'+maxTime)
  108. }else {
  109. this.FormData.classTime = this.FormData.courseArr[0].classTime
  110. }
  111. this.show = true
  112. },
  113. async masterCreateFn() {
  114. this.show = false
  115. let obj = {
  116. "studentId": this.FormData.studentId,
  117. "coachId": this.FormData.coachId,
  118. "classDate": this.FormData.classDate,
  119. "selectScheduleClass": this.FormData.courseArr.map(item=>item.id),
  120. subject: this.subject
  121. // classId: [this.FormData.courseIds]
  122. }
  123. const {data: res} = await masterCreate(obj)
  124. if(res) {
  125. this.$u.toast('预约成功')
  126. setTimeout(()=>{
  127. this.$goPage('/pages/mineEntry/myAppointment/myAppointment?currentTab=2')
  128. },1500)
  129. }
  130. console.log(res)
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. .popupCon {
  137. padding: 30rpx 50rpx;
  138. .h2 {
  139. font-weight: 600;
  140. color: #333333;
  141. line-height: 70rpx;
  142. font-size: 36rpx;
  143. text-align: center;
  144. margin-bottom: 20rpx;
  145. }
  146. .content {
  147. padding-bottom: 20rpx;
  148. .row {
  149. padding: 22rpx 0;
  150. display: flex;
  151. font-size: 28rpx;
  152. // align-items: center;
  153. .lab {
  154. width: 180rpx;
  155. color: #686B73;
  156. }
  157. .val {
  158. flex: 1;
  159. font-weight: 500;
  160. }
  161. }
  162. }
  163. }
  164. .btn_row {
  165. display: flex;
  166. justify-content: space-between;
  167. padding-bottom: 30rpx;
  168. .btn {
  169. width: 47%;
  170. height: 72rpx;
  171. background: #1989FA;
  172. border-radius: 8rpx;
  173. font-size: 28rpx;
  174. color: #fff;
  175. text-align: center;
  176. line-height: 72rpx;
  177. &.border {
  178. background: rgba(25, 137, 250, 0.1);
  179. border: 2rpx solid $themC;
  180. color: $themC;
  181. }
  182. }
  183. }
  184. </style>