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

635 lines
18 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="pageBg">
  3. <!-- <topNavbar title="报名信息确认"></topNavbar> -->
  4. <view class="pad">
  5. <view class="card">
  6. <view class="row">
  7. <view class="lab">扫描教练二维码</view>
  8. <view class="rightCon">
  9. <view class="scan" @click="scanCodeFn">
  10. <image src="@/static/images/carIcon/sanIcon.png"></image>
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="card">
  16. <view class="row" >
  17. <view class="lab">选择驾校</view>
  18. <view class="rightCon">
  19. <view class="row" @click="showSchool=true">
  20. <view class="val">
  21. <mySelect :value="form.school"/>
  22. </view>
  23. <view class="arrow">
  24. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="row">
  30. <view class="lab">选择车型</view>
  31. <view class="rightCon">
  32. <view class="row" @click="showCarClick">
  33. <view class="val">
  34. <mySelect :value="form.trainType"/>
  35. </view>
  36. <view class="arrow">
  37. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="row">
  43. <view class="lab">选择班型</view>
  44. <view class="rightCon">
  45. <view class="row" @click="showClassModel=true">
  46. <view class="val">
  47. <mySelect :value="form.classModel"/>
  48. </view>
  49. <view class="arrow">
  50. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="row">
  56. <view class="lab">选择教练</view>
  57. <view class="rightCon" @click="goCoach">
  58. <view class="row" >
  59. <view class="val">
  60. <mySelect :value="form.coach"/>
  61. </view>
  62. <view class="arrow">
  63. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="card">
  70. <view class="row">
  71. <view class="lab">业务类型</view>
  72. <view class="rightCon">
  73. <u-radio-group
  74. v-model="form.businessType"
  75. >
  76. <u-radio
  77. :customStyle="{marginRight: '24rpx'}"
  78. v-for="(item, index) in radiolist1"
  79. :key="index"
  80. :label="item.name"
  81. :name="item.id"
  82. >
  83. </u-radio>
  84. </u-radio-group>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="card" v-if="form.businessType==1">
  89. <view class="row">
  90. <view class="lab long">原驾驶证号</view>
  91. <view class="rightCon">
  92. <view class="row">
  93. <view class="val">{{ form.certificateCodeShow }}</view>
  94. </view>
  95. </view>
  96. </view>
  97. <view class="row">
  98. <view class="lab long">驾驶证初领日期</view>
  99. <view class="rightCon">
  100. <view class="row" @click="showFirstLicenceTime=true" >
  101. <view class="val">
  102. <mySelect :value="form.firstDriveDate"/>
  103. </view>
  104. <view class="arrow">
  105. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <view class="row">
  111. <view class="lab long">原准驾车型</view>
  112. <view class="rightCon">
  113. <view class="row" @click="showOldDriveModel=true" >
  114. <view class="val">
  115. <mySelect :value="form.oldTrainType"/>
  116. </view>
  117. <view class="arrow">
  118. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <view class="card">
  125. <view class="row">
  126. <view class="lab">是否异地转入</view>
  127. <view class="rightCon" style="margin-left: 40rpx;">
  128. <u-radio-group
  129. v-model="form.transfer"
  130. @change="changeVal"
  131. >
  132. <u-radio
  133. :customStyle="{marginRight: '24rpx'}"
  134. v-for="(item, index) in radiolist2"
  135. :key="item.id"
  136. :label="item.name"
  137. :name="item.id"
  138. >
  139. </u-radio>
  140. </u-radio-group>
  141. </view>
  142. </view>
  143. </view>
  144. <view class="card" v-if="form.transfer==1">
  145. <view class="row" @click="cityShowFn">
  146. <view class="lab">来源城市</view>
  147. <view class="rightCon">
  148. <view class="row">
  149. <view class="val">
  150. <mySelect :value="form.fromArea"/>
  151. </view>
  152. <view class="arrow">
  153. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  154. </view>
  155. </view>
  156. </view>
  157. </view>
  158. <view class="row">
  159. <view class="lab ">已过科目</view>
  160. <view class="rightCon">
  161. <view class="row" @click="showSubjectPass=true">
  162. <view class="val">
  163. <mySelect :value="form.finishSubject"/>
  164. </view>
  165. <view class="arrow">
  166. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. <view class="row">
  172. <view class="lab">待学科目</view>
  173. <view class="rightCon">
  174. <view class="row" @click="showSubjectTreat=true">
  175. <view class="val">
  176. <mySelect :value="form.waitSubject"/>
  177. </view>
  178. <view class="arrow">
  179. <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
  180. </view>
  181. </view>
  182. </view>
  183. </view>
  184. </view>
  185. <view class="card">
  186. <view class="row">
  187. <view class="lab">学费</view>
  188. <view class="rightCon">
  189. <view class="row">
  190. <view class="val blue">{{ $u.utils.priceTo(form.totalAmount) }}</view>
  191. </view>
  192. </view>
  193. </view>
  194. </view>
  195. <view class="btnBg" @click="confirmClick">确认</view>
  196. </view>
  197. <u-popup :show="showPopup" mode="center" :round="8" >
  198. <comfigPopup @comfigClick="comfigClick" :info="form"/>
  199. </u-popup>
  200. <u-popup :show="showSchool" mode="bottom" :round="8" @close="showSchool=false">
  201. <searchSchool @chooseSchool="chooseSchool"/>
  202. </u-popup>
  203. <!-- 选择班型 -->
  204. <u-picker :show="showClassModel" :columns="columnsClassModel" keyName="name" @confirm="confirmClassModel" @cancel="showClassModel=false"></u-picker>
  205. <!-- 选择车型 -->
  206. <u-picker :show="showCar" :columns="columnsCar" keyName="label" @confirm="confirmCar" :closeOnClickOverlay="true" @cancel="showCar=false"></u-picker>
  207. <!-- 原驾驶证初领日期 -->
  208. <u-datetime-picker :show="showFirstLicenceTime" mode="date" @confirm="confirmFirstLicenceTime"></u-datetime-picker>
  209. <!-- 原驾驶证学驾车型 -->
  210. <u-popup :show="showOldDriveModel" mode="bottom" :round="8" @close="showOldDriveModel=false">
  211. <oldDrive @pickerOldDrive="pickerOldDrive"/>
  212. </u-popup>
  213. <!-- 已过科目 -->
  214. <u-picker :show="showSubjectPass" :columns="columnsSubject" keyName="label" @confirm="confirmSubjectPass" @cancel="showSubjectPass=false"></u-picker>
  215. <!-- 待学科目 -->
  216. <u-picker :show="showSubjectTreat" :columns="columnsSubject" keyName="label" @confirm="confirmTreat" @cancel="showSubjectTreat=false"></u-picker>
  217. <!-- 城市 -->
  218. <u-picker :show="showCity" ref="uPicker" :columns="[cityArr]" @confirm="confirmCity" @change="changeHandler" keyName="name"></u-picker>
  219. </view>
  220. </template>
  221. <script>
  222. import comfigPopup from './comp/comfigPopup'
  223. import searchSchool from './comp/searchSchool'
  224. import oldDrive from './comp/oldDrive'
  225. import { areaTree, applyOnline, schoolClass, getSchoolDetail } from '@/config/api.js'
  226. export default {
  227. components: { comfigPopup, searchSchool, oldDrive },
  228. data() {
  229. return {
  230. showCity: false,
  231. showPopup: false,
  232. showClassModel: false,
  233. showCar: false,
  234. showFirstLicenceTime: false,
  235. showOldDriveModel: false,
  236. showSubjectPass: false,
  237. showSubjectTreat: false,
  238. columnsClassModel: [],//班型
  239. columnsSubject: [
  240. [
  241. {label: '科目一', id: 1},
  242. {label: '科目二', id: 2},
  243. {label: '科目三', id: 3},
  244. ]
  245. ],
  246. columnsCar: [],
  247. form: {
  248. school: '',
  249. classModel: '',
  250. car: '',
  251. coach: '',
  252. cardType: 1,
  253. idcard: '',
  254. trainType: '',//车型
  255. nationality: '中国',
  256. certificateCodeShow: '原驾驶证号xxx',
  257. driveLicence: '',//原驾驶证号 给后端的
  258. firstDriveDate: '',//原驾驶证初领日期
  259. sex: 2,
  260. phone: '',
  261. applyType: 1,
  262. name: '',
  263. oldTrainType: '',//原准驾车型
  264. finishSubject: '',//已过科目
  265. waitSubject: '',//待学科目
  266. photoPath: '',
  267. address: '',
  268. totalAmount: 0,
  269. transfer: 2, //是否异地
  270. businessType: 0,
  271. fromArea: '',//异地城市
  272. },
  273. showSchool: false,
  274. radiolist1: [ {name: '初领', id: 0}, {name: '增驾', id: 1}],//0:初领,1:增驾,
  275. radiolist2: [ {name: '是', id: 1}, {name: '否', id: 2}],
  276. radiolist3: [ {name: '全款', id: 1}, {name: '预付款', id: 2}],
  277. cityArr: [],
  278. cityArr2: [],
  279. cityArr3: []
  280. }
  281. },
  282. onLoad(options) {
  283. if(options.realNameNo) {
  284. this.realNameNo = options.realNameNo
  285. }
  286. this.initUserInfo()
  287. // 监听上一个页面的选择教练
  288. uni.$on('upDateCoachItem',(item)=>{
  289. console.log(item)
  290. this.form.coach = item.name
  291. this.form.coachId = item.id
  292. })
  293. this.areaTreeFn()
  294. // 如果是选择了驾校班型来报名的
  295. let schoolClass = this.$store.state.school.schoolClass
  296. if(schoolClass.id) {
  297. console.log(schoolClass)
  298. this.form.classModel = schoolClass.name
  299. this.form.school = schoolClass.schoolName
  300. this.form.schoolId = schoolClass.schoolId
  301. this.form.trainType = schoolClass.carType
  302. this.form.schoolClassId = schoolClass.id
  303. this.form.totalAmount= schoolClass.totalAmount
  304. }
  305. // 如果是选择了驾校教练来报名的/扫二维码
  306. let schoolCoach = this.$store.state.school.schoolCoach
  307. if(schoolCoach.id) {
  308. console.log('schoolCoach')
  309. console.log(schoolCoach)
  310. this.form.coach = schoolCoach.name
  311. this.form.coachId = schoolCoach.id
  312. this.form.school = schoolCoach.schoolName
  313. this.form.schoolId = schoolCoach.schoolId
  314. this.form.trainType = schoolCoach.teachCarType.slice(0,2)
  315. }
  316. if(this.form.schoolId) {
  317. this.getSchoolDetailFn()
  318. }
  319. },
  320. onPullDownRefresh() {
  321. this.initUserInfo()
  322. },
  323. methods: {
  324. async initUserInfo() {
  325. // 如果不是实名
  326. // if(!this.realNameNo) {
  327. // await this.$store.dispatch('getUserInfo')
  328. // }
  329. console.log(this.vuex_userInfo)
  330. this.form.userId = this.userId
  331. this.form.accountId = this.vuex_userInfo.accountId
  332. this.form.address = this.vuex_userInfo.address
  333. this.form.name = this.vuex_userInfo.name
  334. this.form.idcard = this.vuex_userInfo.idcard
  335. this.form.phone = this.vuex_userInfo.phone
  336. this.form.nationality = this.vuex_userInfo.nationality || '中国'
  337. this.form.cardType = this.vuex_userInfo.cardType || '1'
  338. this.form.sex = this.vuex_userInfo.sex
  339. if(this.vuex_userInfo.photoPath&&this.form.cardType!='1') this.form.photoPath = this.vuex_userInfo.photoPath
  340. },
  341. // 查班型
  342. async schoolClassFn() {
  343. const {data: res} = await schoolClass({pageNo: 1,pageSize: 100, schoolId: this.form.schoolId})
  344. this.columnsClassModel = [res.list]
  345. console.log(this.columnsClassModel)
  346. },
  347. cityShowFn() {
  348. this.showCity = true
  349. this.$nextTick(()=>{
  350. let picker = this.$refs.uPicker
  351. picker.setColumnValues(1, this.cityArr2[0])
  352. picker.setColumnValues(2, this.cityArr3[0][0])
  353. })
  354. // picker = this.$refs.uPicker
  355. },
  356. changeHandler(e) {
  357. const {
  358. indexs,
  359. columnIndex,
  360. value,
  361. values, // values为当前变化列的数组内容
  362. index,
  363. // 微信小程序无法将picker实例传出来,只能通过ref操作
  364. picker = this.$refs.uPicker
  365. } = e
  366. // 当第一列值发生变化时,变化第二列(后一列)对应的选项
  367. if (columnIndex === 0) {
  368. // picker为选择器this实例,变化第二列对应的选项
  369. picker.setColumnValues(1, this.cityArr2[index])
  370. picker.setColumnValues(2, this.cityArr3[index][0])
  371. }
  372. if (columnIndex === 1) {
  373. let index3 = indexs[0]
  374. // picker为选择器this实例,变化第二列对应的选项
  375. picker.setColumnValues(2, (this.cityArr3[index3])[index])
  376. }
  377. console.log(indexs[0])
  378. // console.log(this.cityArr3[index3])
  379. // console.log(value)
  380. // console.log(values)
  381. // console.log(columnIndex)
  382. },
  383. // 回调参数为包含columnIndex、value、values
  384. confirmCity(e) {
  385. console.log('confirm', e)
  386. this.form.fromArea = e.value.map((item)=>{
  387. return item.name
  388. }).join(',').replace(/,/g, '-')
  389. this.showCity = false
  390. },
  391. // 获取地区
  392. async areaTreeFn() {
  393. // this.cityArr2.push(this.traverse(item.children))
  394. const {data: res} = await areaTree()
  395. this.cityArr = res.map(item=>{
  396. let obj = {
  397. id: item.id,
  398. name: item.name
  399. }
  400. return obj
  401. })
  402. this.cityArr2 = res.map(item2=>{
  403. let arr2 = item2.children
  404. return arr2.map(val=>{
  405. let obj = {
  406. id: val.id,
  407. name: val.name
  408. }
  409. return obj
  410. })
  411. })
  412. this.cityArr3 = res.map(item2=>{
  413. let arr2 = item2.children
  414. return arr2.map(val=>{
  415. return val.children.map(val3=>{
  416. let obj = {
  417. id: val3.id,
  418. name: val3.name
  419. }
  420. return obj
  421. })
  422. })
  423. })
  424. },
  425. traverse(arr, result=[]) {
  426. for (var i = 0; i < arr.length; i++) {
  427. let item = arr[i]
  428. let obj = {
  429. id: item.id,
  430. name: item.name
  431. }
  432. result.push(obj)
  433. if(item.children.length) {
  434. this.traverse(item.children, result)
  435. }
  436. }
  437. return result;
  438. },
  439. // 选择驾校
  440. chooseSchool(item) {
  441. this.form.school = item.name
  442. this.form.schoolId = item.id
  443. this.columnsCar = [item.businessScope.split(',')]
  444. this.form.classModel = ''
  445. this.form.schoolClassId = ''
  446. this.form.trainType = ''
  447. this.form.coach = ''
  448. this.form.coachId = ''
  449. this.form.totalAmount = ''
  450. this.showSchool = false
  451. this.schoolClassFn()
  452. },
  453. // 选择班型
  454. confirmClassModel(val) {
  455. let item = val.value[0]
  456. console.log(item)
  457. this.showClassModel = false
  458. this.form.classModel = item.name
  459. this.form.schoolClassId = item.id
  460. this.form.totalAmount = item.totalAmount
  461. },
  462. // 选择车型
  463. confirmCar(val) {
  464. let item = val.value[0]
  465. console.log(item)
  466. this.showCar = false
  467. this.form.trainType = item
  468. this.form.coach = ''
  469. this.form.coachId = ''
  470. },
  471. showCarClick() {
  472. if(!this.form.school) return this.$u.toast('请先选择驾校')
  473. this.showCar = true
  474. },
  475. // 跳转到选择教练
  476. goCoach() {
  477. if(!this.form.schoolId) return this.$u.toast('请先选择驾校')
  478. if(!this.form.trainType) return this.$u.toast('请先选择车型')
  479. this.$goPage('/pages/indexEntry/enroll/registInfo/chooseCoach/chooseCoach?schoolId=' + this.form.schoolId+ '&trainType='+ this.form.trainType)
  480. },
  481. // 选择原驾驶证初领日期
  482. confirmFirstLicenceTime(val) {
  483. console.log(val)
  484. this.form.firstDriveDate = uni.$u.timeFormat(val.value, 'yyyy-mm-dd');
  485. this.showFirstLicenceTime = false
  486. },
  487. // 选择原准驾车型
  488. pickerOldDrive(val) {
  489. this.form.oldTrainType = val
  490. this.showOldDriveModel = false
  491. console.log(val)
  492. },
  493. // 选择已过科目
  494. confirmSubjectPass(val) {
  495. let item = val.value[0]
  496. this.form.finishSubject = item.label
  497. this.showSubjectPass = false
  498. },
  499. // 选择已过科目
  500. confirmTreat(val) {
  501. let item = val.value[0]
  502. this.form.waitSubject = item.label
  503. this.showSubjectTreat = false
  504. },
  505. // 扫码
  506. scanCodeFn() {
  507. let _this = this
  508. uni.scanCode({
  509. success: function(res) {
  510. console.log('条码类型:' + res.scanType);
  511. console.log('条码内容:' + res.result);
  512. let obj = JSON.parse(res.result)
  513. obj.nickname = decodeURIComponent(obj.nickname)
  514. obj.schoolName = decodeURIComponent(obj.schoolName)
  515. _this.form.school = obj.schoolName
  516. _this.form.schoolId = obj.schoolId
  517. _this.form.coach = obj.nickname
  518. _this.form.coachId = obj.id
  519. console.log(obj)
  520. }
  521. });
  522. },
  523. async getSchoolDetailFn() {
  524. const {data: res} = await getSchoolDetail({id: this.form.schoolId})
  525. this.columnsCar = [res.businessScope.split(',')]
  526. console.log('驾校id')
  527. console.log(res.id)
  528. this.schoolClassFn()
  529. },
  530. changeVal(val) {
  531. console.log(val)
  532. },
  533. // 点击确认
  534. confirmClick() {
  535. if(!this.form.schoolId) return this.$u.toast('请选择驾校')
  536. if(!this.form.trainType) return this.$u.toast('请选择车型')
  537. if(!this.form.schoolClassId) return this.$u.toast('请选择班型')
  538. this.showPopup = true
  539. },
  540. async comfigClick(val) {
  541. console.log(val)
  542. this.showPopup = false
  543. if(!val) return false
  544. const {data: res} = await applyOnline(this.form)
  545. // 报名成功
  546. console.log(res)
  547. await this.$store.dispatch('getUserInfo')
  548. if(val) {
  549. this.$goPage('/pages/indexEntry/enroll/signContract/signContract?schoolId='+this.form.schoolId)
  550. }
  551. }
  552. }
  553. }
  554. </script>
  555. <style lang="scss" scoped>
  556. .pad {
  557. padding-bottom: 66rpx;
  558. }
  559. .card {
  560. padding: 10rpx 40rpx 10rpx 32rpx;
  561. margin-bottom: 20rpx;
  562. .row {
  563. height: 88rpx;
  564. display: flex;
  565. align-items: center;
  566. width: 100%;
  567. .lab {
  568. width: 152rpx;
  569. line-height: 88rpx;
  570. white-space: nowrap;
  571. &.long {
  572. width: 230rpx;
  573. }
  574. }
  575. .scan {
  576. margin-left: auto;
  577. width: 40rpx;
  578. height: 38rpx;
  579. image {
  580. display: block;
  581. width: 100%;
  582. height: 100%;
  583. }
  584. }
  585. .rightCon {
  586. flex: 1;
  587. width: 0;
  588. display: flex;
  589. .val {
  590. flex: 1;
  591. width: 0;
  592. input {
  593. font-size: 28rpx;
  594. }
  595. &.blue {
  596. color: $themC;
  597. }
  598. &.red {
  599. color: #FF6A2A;
  600. }
  601. }
  602. .icon {
  603. width: 30rpx;
  604. height: 30rpx;
  605. u-icon {
  606. }
  607. }
  608. }
  609. }
  610. }
  611. .btnBg {
  612. width: 396rpx;
  613. margin: 100rpx auto 0 auto;
  614. }
  615. </style>