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

634 lines
18 KiB

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