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

643 lines
18 KiB

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