工行这里学车报名流程h5
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.

524 lines
17 KiB

  1. <template>
  2. <view class="main">
  3. <view class="card">
  4. <u-form :model="form" ref="uForm" :label-width="'auto'">
  5. <u-form-item label="驾校名称" >
  6. <view class="tar">
  7. {{info.schoolName}}
  8. </view>
  9. </u-form-item>
  10. <u-form-item label="学驾车型" prop="classModel" required >
  11. <view @click="showDriveModels=true" class="select_row" >
  12. <u-input v-model="form.classModel" input-align="right" placeholder="请选择" disabled @click="showDriveModels=true" />
  13. <u-icon name="arrow-right" size="28" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  14. </view>
  15. </u-form-item>
  16. <u-form-item label="班型" prop="trainingClassLable" required >
  17. <view @click="clickTrainingClasss" class="select_row">
  18. <u-input v-model="form.trainingClassLable" disabled input-align="right" placeholder="请选择" @click="clickTrainingClasss"/>
  19. <u-icon name="arrow-right" size="28" color="#686B73" style="margin-left: 12rpx;"></u-icon>
  20. </view>
  21. </u-form-item>
  22. <!-- @click="showSchoolCoach=true" -->
  23. <u-form-item label="教练" prop="coachName" >
  24. <view class="select_row">
  25. <u-input v-model="$store.state.chooseCoachItem.coachName" disabled input-align="right" placeholder="请选择" @click="$goPage('/pages/learnDriveStep/chooseCoach/chooseCoach?trainingSchoolId='+ info.trainingSchoolId)" />
  26. <u-icon name="arrow-right" size="28" color="#686B73" style="margin-left: 12rpx;" @click="$goPage('/pages/learnDriveStep/chooseCoach/chooseCoach?trainingSchoolId='+ info.trainingSchoolId)"></u-icon>
  27. </view>
  28. </u-form-item>
  29. <u-form-item label="考场适应训练时长" prop="timeName">
  30. <view @click="showEnums=true" class="select_row">
  31. <view class="timePrice">85/小时</view>
  32. <u-input v-model="form.timeName" disabled input-align="right" placeholder="请选择" @click="showEnums=true"/>
  33. <u-icon name="arrow-right" size="28" color="#686B73" style="margin-left: 12rpx;"></u-icon>
  34. </view>
  35. </u-form-item>
  36. <u-form-item label="考场适应训练场地" prop="adaptabilityGround" required v-if="form.timeName!='不选择'">
  37. <view @click="showAdaptability=true" class="select_row">
  38. <u-input v-model="form.adaptabilityGround" disabled input-align="right" placeholder="请选择" @click="showAdaptability=true"/>
  39. <u-icon name="arrow-right" size="28" color="#686B73" style="margin-left: 12rpx;"></u-icon>
  40. </view>
  41. </u-form-item>
  42. <u-form-item label="学车费用" class="line" :border-bottom="false">
  43. <view class="tar red">
  44. {{ $u.utils.priceTo(totalPrice) }}
  45. </view>
  46. <!-- <u-input v-model="form.name" disabled input-align="right" placeholder="" /> -->
  47. </u-form-item>
  48. <u-form-item label="姓名">
  49. <view class="tar">{{form.realName}}</view>
  50. <!-- <u-input v-model="form.realName" disabled input-align="right" placeholder="" /> -->
  51. </u-form-item>
  52. <u-form-item label="性别">
  53. <view class="tar">{{form.sex==2?'女':'男'}}</view>
  54. </u-form-item>
  55. <u-form-item label="国籍" >
  56. <view class="tar">中国</view>
  57. </u-form-item>
  58. <u-form-item label="证件类型" >
  59. <view class="tar">身份证</view>
  60. </u-form-item>
  61. <u-form-item label="证件号码" class="line" :border-bottom="false">
  62. <u-input v-model="form.certificateCodeShow" disabled input-align="right" placeholder="" />
  63. </u-form-item>
  64. <u-form-item label="业务类型" required prop="businessTypeName" >
  65. <view @click="showBusinessType=true" class="select_row">
  66. <u-input v-model="form.businessTypeName" disabled input-align="right" placeholder="请选择" @click="showBusinessType=true"/>
  67. <u-icon name="arrow-right" size="28" color="#686B73" style="margin-left: 12rpx;"></u-icon>
  68. </view>
  69. <u-input v-model="form.name" disabled input-align="right" placeholder="" />
  70. </u-form-item>
  71. <u-form-item label="原驾驶证号" required v-if="form.businessTypeName=='增领'">
  72. <u-input v-model="form.certificateCodeShow" disabled input-align="right" placeholder="" disabled/>
  73. </u-form-item>
  74. <u-form-item label="驾驶证初领日期" required v-if="form.businessTypeName=='增领'">
  75. <view @click="showFirstLicenceTime=true" class="select_row">
  76. <u-input v-model="form.firstLicenceTime" disabled input-align="right" placeholder="请选择" @click="showFirstLicenceTime=true"/>
  77. <u-icon name="arrow-right" size="28" color="#686B73" style="margin-left: 12rpx;"></u-icon>
  78. </view>
  79. </u-form-item>
  80. <u-form-item label="原准驾车型" required v-if="form.businessTypeName=='增领'">
  81. <view @click="showOldDriveModel=true" class="select_row">
  82. <u-input v-model="form.oldDriveModel" disabled input-align="right" placeholder="请选择" @click="showOldDriveModel=true"/>
  83. <u-icon name="arrow-right" size="28" color="#686B73" style="margin-left: 12rpx;"></u-icon>
  84. </view>
  85. </u-form-item>
  86. </u-form>
  87. </view>
  88. <view class="checkCon">
  89. <u-checkbox-group>
  90. <u-checkbox v-model="checked" active-color="#1989FA" shape="circle">我承诺已完成且通过报考驾驶培训所需体检流程</u-checkbox>
  91. </u-checkbox-group>
  92. </view>
  93. <view class="btnBg">
  94. <oneBtn text="提交" @oneBtnClick="oneBtnClickFn"/>
  95. </view>
  96. <!-- 选择框 -->
  97. <!-- 车型 -->
  98. <u-picker mode="selector" v-model="showDriveModels" :range="selectorDriveModels" @confirm="confirmDriveModels"></u-picker>
  99. <!-- 班型 -->
  100. <u-picker mode="selector" v-model="showTrainingClasss" :range="selectorTrainingClasss" range-key="className" @confirm="confirmTrainingClasss"></u-picker>
  101. <!-- 教练 -->
  102. <u-picker mode="selector" v-model="showSchoolCoach" :range="selectorSchoolCoach" range-key="coachName" @confirm="confirmSchoolCoach"></u-picker>
  103. <!-- 适应训练时长 -->
  104. <u-picker mode="selector" v-model="showEnums" :range="selectorEnums" range-key="name" @confirm="confirmEnums"></u-picker>
  105. <!-- 适应训练考场 -->
  106. <u-picker mode="selector" v-model="showAdaptability" :range="selectorAdaptability" range-key="name" @confirm="confirmAdaptability"></u-picker>
  107. <!-- 业务类型 -->
  108. <u-picker mode="selector" v-model="showBusinessType" :range="businessTypeArr" range-key="name" @confirm="confirmBusinessType"></u-picker>
  109. <!-- 原驾驶证初领日期 -->
  110. <u-picker mode="time" v-model="showFirstLicenceTime" @confirm="confirmFirstLicenceTime" :params="paramsPicker"></u-picker>
  111. <!-- 原驾驶证学驾车型 -->
  112. <u-popup v-model="showOldDriveModel" mode="bottom">
  113. <view class="carBox">
  114. <view class="carh1">学驾车型</view>
  115. <view v-for="(item,index) in carTypeArr" :key="index" class="carLi">
  116. <view class="carType">{{item.lab}}</view>
  117. <view class="carName_row">
  118. <view class="carName" v-for="(item2,index2) in item.arr" :key="index2" @click="pickerCarClick(item2)" :class="{active: pickerCarArr.indexOf(item2) > -1}">{{item2}}</view>
  119. </view>
  120. </view>
  121. <view class="payBtn_row">
  122. <view class="payBtn border" @click="pickerCar()">重置</view>
  123. <view class="payBtn" @click="pickerCar(1)">完成</view>
  124. </view>
  125. </view>
  126. </u-popup>
  127. <!-- 确认订单弹出框 -->
  128. <u-popup v-model="showFormValidation" mode="bottom">
  129. <step3formValidation :info="form" :schoolName="info.schoolName" @oneBtnClick="oneBtnConfirm"/>
  130. </u-popup>
  131. </view>
  132. </template>
  133. <script>
  134. import { watch } from "vue";
  135. import learnDrive from '@/api/learnDrive.js'
  136. import step3formValidation from './step3formValidation.vue'
  137. export default {
  138. props: ['info', 'userInfo', 'trainingApplyId', 'fromClass'],
  139. components: {
  140. step3formValidation
  141. },
  142. data() {
  143. return {
  144. checked: true,
  145. showFormValidation: false,
  146. form: {
  147. address: '',
  148. classModel: '',//学驾车型
  149. businessType: '',
  150. certificateType: 1,
  151. businessTypeName: '',
  152. trainingClassId: '',
  153. trainingClassName: '',
  154. realName: '',
  155. certificateCode: '',
  156. sex: '',
  157. nationality: '中国',
  158. firstLicenceTime: '',
  159. oldDriveModel: ''
  160. },
  161. businessTypeArr: [
  162. {name: '初领', id: 0},
  163. {name: '增领', id: 1}
  164. ],
  165. showBusinessType: false,
  166. totalPrice: '',
  167. showDriveModels: false,
  168. selectorDriveModels: [],
  169. showTrainingClasss: false,
  170. selectorTrainingClasss: [],
  171. showSchoolCoach: false,
  172. selectorSchoolCoach: [],
  173. showEnums: false,
  174. selectorEnums: [],
  175. showAdaptability: false,
  176. selectorAdaptability: [],
  177. showFirstLicenceTime: false,
  178. showOldDriveModel:false,
  179. paramsPicker: {
  180. year: true,
  181. month: true,
  182. day: true,
  183. },
  184. carTypeArr: [
  185. {lab: '小车',arr: ['C1','C2','C3']},
  186. {lab: '货车',arr: ['A2','B2',]},
  187. {lab: '客车',arr: ['A1','B3','B1']},
  188. {lab: '摩托车',arr: ['D','E','F']},
  189. {lab: '其它',arr: ['C4','C5','C6']},
  190. ],
  191. pickerCarArr: [],
  192. }
  193. },
  194. watch: {
  195. "info.trainingSchoolId": {
  196. deep:true,// 开启深度监听
  197. immediate:true,
  198. handler(){
  199. console.log('info')
  200. console.log(this.info)
  201. this.queryDriveModelsFn()
  202. this.queryTrainingClasssFn()
  203. this.queryAdaptabilityGroundsFn()
  204. this.queryAdaptabilityEnumsFn()
  205. // 默认选择初领
  206. this.form.businessType = this.businessTypeArr[0].id
  207. this.form.businessTypeName = this.businessTypeArr[0].name
  208. // 如果是报名班型跳转过来的 classModel className trainingClassId totalPrice
  209. if(this.fromClass) {
  210. this.form.classModel = this.$store.state.classChooseItem.classModel
  211. this.form.trainingClassLable = this.$store.state.classChooseItem.className
  212. this.form.trainingClassId = this.$store.state.classChooseItem.trainingClassId
  213. this.totalPrice = this.$store.state.classChooseItem.totalPrice
  214. }
  215. }
  216. },
  217. userInfo: {
  218. deep:true,// 开启深度监听
  219. immediate:true,
  220. handler(val){
  221. if(!Object.keys(val).length) return
  222. this.form.realName = val.realName
  223. console.log('监听到的用户信息')
  224. console.log(val)
  225. let sexIdCard = val.idcard
  226. let sex = sexIdCard.substr(16,1) % 2 == 0 ? 2: 1
  227. this.form.sex = sex
  228. this.form.certificateCode = val.idcard
  229. this.form.driveLicence = val.idcard
  230. let certificateCode = val.idcard
  231. this.form.certificateCodeShow = certificateCode.substr(0,4) + '**********' + certificateCode.substr(14,certificateCode.split('').length)
  232. }
  233. }
  234. },
  235. methods: {
  236. // 确认提交表单还是继续修改
  237. async oneBtnConfirm(num) {
  238. if(num) {
  239. this.form.trainingSchoolId = this.info.trainingSchoolId
  240. this.form.trainingApplyId = this.trainingApplyId
  241. let CoachItem = this.$store.state.chooseCoachItem.coachId
  242. if(CoachItem.coachId) {
  243. this.form.coachId = CoachItem.coachId
  244. this.form.coachName = CoachItem.coachName
  245. }
  246. let obj = Object.assign({},this.form)
  247. if(!this.form.businessType) {
  248. // 如果是初领删除原驾驶证号,也就是身份证
  249. delete obj.driveLicence
  250. }
  251. delete obj.businessTypeName
  252. delete obj.certificateCodeShow
  253. console.log(obj)
  254. const [nulls, res] = await learnDrive.createTrainingApplyDetails(obj)
  255. this.$store.commit('upDateCoachItem', {})
  256. console.log('表单已提交')
  257. console.log(res)
  258. if(res.code==0) {
  259. this.showFormValidation = false
  260. this.$emit('showSignPopupFn')
  261. }
  262. }else {
  263. this.showFormValidation = false
  264. }
  265. },
  266. // 选择车型
  267. async confirmDriveModels(i) {
  268. let index = i[0]
  269. this.form.classModel = this.selectorDriveModels[index]
  270. this.form.trainingClassLable = ''
  271. await this.queryTrainingClasssFn()
  272. this.showTrainingClasss = true
  273. },
  274. // 选择班型
  275. confirmTrainingClasss(i) {
  276. let index = i[0]
  277. let item = this.selectorTrainingClasss[index]
  278. this.form.trainingClassId = item.trainingClassId
  279. this.form.trainingClassLable = item.className
  280. this.totalPrice = item.totalPrice
  281. },
  282. // 选择教练
  283. confirmSchoolCoach(i) {
  284. let index = i[0]
  285. let item = this.selectorSchoolCoach[index]
  286. this.form.coachId = item.coachId
  287. this.form.coachName = item.coachName
  288. },
  289. // 选择时长
  290. confirmEnums(i) {
  291. let index = i[0]
  292. let item = this.selectorEnums[index]
  293. console.log(item)
  294. this.form.timeName = item.name
  295. this.form.adaptability = item.code
  296. },
  297. // 选择考场
  298. confirmAdaptability(i) {
  299. let index = i[0]
  300. let item = this.selectorAdaptability[index]
  301. this.form.adaptabilityGround = item.name
  302. },
  303. // 选择业务类型
  304. confirmBusinessType(i) {
  305. let index = i[0]
  306. let item = this.businessTypeArr[index]
  307. this.form.businessType = item.id
  308. this.form.businessTypeName = item.name
  309. },
  310. // 选择原驾驶证初领日期
  311. confirmFirstLicenceTime(val) {
  312. let str = val.year+'-'+val.month+'-'+val.day
  313. this.form.firstLicenceTime = str
  314. console.log(val)
  315. },
  316. pickerCar(num) {
  317. if(num==1) {
  318. if(!this.pickerCarArr.length) return this.$u.toast('请选择学驾车型')
  319. this.form.oldDriveModel = this.pickerCarArr.join('')
  320. this.showOldDriveModel = false
  321. }else {
  322. this.pickerCarArr = []
  323. this.form.oldDriveModel = ''
  324. }
  325. },
  326. pickerCarClick(item) {
  327. let index = this.pickerCarArr.indexOf(item)
  328. if(index>-1) {
  329. this.pickerCarArr.splice(index, 1);
  330. }else {
  331. this.pickerCarArr.push(item)
  332. }
  333. },
  334. // 获取学驾车型
  335. async queryDriveModelsFn() {
  336. if(!this.info.trainingSchoolId) return
  337. const [nulls, res] = await learnDrive.queryDriveModels({trainingSchoolId: this.info.trainingSchoolId})
  338. this.selectorDriveModels = res.data
  339. console.log('学驾车型')
  340. console.log(res)
  341. },
  342. // 获取班型
  343. async queryTrainingClasssFn() {
  344. if(!this.info.trainingSchoolId) return
  345. let obj = {pageSize: 20,pageIndex: 1,trainingSchoolId: this.info.trainingSchoolId,}
  346. if(this.form.classModel) obj.classModel = this.form.classModel
  347. const [nulls, res] = await learnDrive.querySimpleTrainingClasssByModel(obj)
  348. this.selectorTrainingClasss = res.data
  349. console.log('获取班型')
  350. console.log(res)
  351. },
  352. // 获取适应性训练考场
  353. async queryAdaptabilityGroundsFn() {
  354. const [nulls, res] = await learnDrive.queryAdaptabilityGrounds({trainingSchoolId: this.info.trainingSchoolId})
  355. this.selectorAdaptability = res.data
  356. console.log('适应性训练考场')
  357. console.log(res)
  358. },
  359. // 获取学时
  360. async queryAdaptabilityEnumsFn() {
  361. const [nulls, res] = await learnDrive.queryAdaptabilityEnums()
  362. this.selectorEnums = res.data
  363. let item = res.data[3]
  364. this.form.timeName = item.name
  365. this.form.adaptability = item.code
  366. console.log('训练学时')
  367. console.log(res)
  368. },
  369. // 点击选择班型
  370. clickTrainingClasss() {
  371. // this.showDriveModels = true
  372. if(!this.form.classModel) return this.$u.toast('请先选择车型')
  373. this.showTrainingClasss = true
  374. this.queryTrainingClasssFn()
  375. },
  376. // 提交表单之前验证
  377. oneBtnClickFn() {
  378. if(!this.form.classModel) return this.$u.toast('请选择学驾车型')
  379. if(!this.form.trainingClassLable) return this.$u.toast('请选择学驾班型')
  380. if(!this.form.adaptabilityGround&&this.form.adaptability) return this.$u.toast('请选择考场适应训练时长场地')
  381. if(!this.form.businessTypeName) return this.$u.toast('请选择业务类型')
  382. if(!this.checked) return this.$u.toast('请勾选我同意承诺')
  383. this.showFormValidation = true
  384. }
  385. },
  386. }
  387. </script>
  388. <style lang="scss" scoped>
  389. .main {
  390. width: 100%;
  391. .card {
  392. background: #fff;
  393. padding: 0 30rpx;
  394. }
  395. }
  396. .checkCon {
  397. padding: 96rpx 30rpx 24rpx 30rpx;
  398. }
  399. .btnBg {
  400. width: 100%;
  401. height: 128rpx;
  402. padding: 16rpx 30rpx;
  403. background: #fff;
  404. .btn {
  405. width: 100%;
  406. height: 96rpx;
  407. background: linear-gradient(180deg, #3593FB 0%, #53D3E5 100%);
  408. border-radius: 48rpx;
  409. font-size: 36rpx;
  410. color: #fff;
  411. text-align: center;
  412. line-height: 96rpx;
  413. }
  414. }
  415. .select_row {
  416. display: flex;justify-content: flex-end;width: 100%;
  417. }
  418. .line {
  419. position: relative;
  420. &::before {
  421. content: '';
  422. height: 20rpx;
  423. width: 100vw;
  424. background-color: #f7f7f7;
  425. position: absolute;
  426. left: -30rpx;
  427. bottom: -20rpx;
  428. }
  429. }
  430. .tar {
  431. width: 100%;
  432. text-align: right;
  433. &.red {
  434. color: red;
  435. }
  436. }
  437. .timePrice {
  438. margin: 0 0 0 20rpx;
  439. color: red;
  440. }
  441. .payBtn_row {
  442. width: 100%;
  443. padding: 20rpx 46rpx;
  444. display: flex;
  445. justify-content: space-between;
  446. border-top: 1px solid #ededed;
  447. .payBtn {
  448. width: 48%;
  449. line-height: 96rpx;
  450. color: #fff;
  451. height: 96rpx;
  452. background: linear-gradient(180deg, #3593FB 0%, #53D3E5 100%);
  453. border-radius: 49rpx;
  454. text-align: center;
  455. &.border {
  456. border: 2rpx solid rgba(53, 147, 251, 1);
  457. color: #1989FA;
  458. background: #fff;
  459. }
  460. }
  461. }
  462. .carBox {
  463. width: 100%;
  464. .carh1 {
  465. font-size: 26rpx;
  466. font-weight: 700;
  467. text-align: center;
  468. padding: 30rpx 0 0 0;
  469. }
  470. .carLi {
  471. width: 100%;
  472. margin-bottom: 30rpx;
  473. padding: 0 32rpx;
  474. }
  475. .carType {
  476. font-size: 26rpx;
  477. font-weight: 500;
  478. line-height: 40rpx;
  479. padding: 28rpx 12rpx 12rpx 0;
  480. }
  481. .carName_row {
  482. display: flex;
  483. .carName {
  484. margin-right: 40rpx;
  485. width: 88rpx;
  486. height: 56rpx;
  487. background: #F6F7F8;
  488. border-radius: 28rpx;
  489. line-height: 56rpx;
  490. text-align: center;
  491. color: #686B73;
  492. &.active {
  493. background: #ECF7FE;
  494. border: 1px solid #3593FB;
  495. color: #1989FA;
  496. }
  497. }
  498. }
  499. }
  500. </style>