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

636 lines
18 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 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: '',
  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. if(this.vuex_userInfo.photoPath&&this.form.cardType=='1') this.form.photoPath = this.vuex_userInfo.photoPath
  347. this.form.sex = this.vuex_userInfo.sex
  348. },
  349. // 查班型
  350. async schoolClassFn() {
  351. const {data: res} = await schoolClass({pageNo: 1,pageSize: 100, schoolId: this.form.schoolId})
  352. this.columnsClassModel = [res.list]
  353. console.log(this.columnsClassModel)
  354. },
  355. cityShowFn() {
  356. this.showCity = true
  357. this.$nextTick(()=>{
  358. let picker = this.$refs.uPicker
  359. picker.setColumnValues(1, this.cityArr2[0])
  360. picker.setColumnValues(2, this.cityArr3[0][0])
  361. })
  362. // picker = this.$refs.uPicker
  363. },
  364. changeHandler(e) {
  365. const {
  366. indexs,
  367. columnIndex,
  368. value,
  369. values, // values为当前变化列的数组内容
  370. index,
  371. // 微信小程序无法将picker实例传出来,只能通过ref操作
  372. picker = this.$refs.uPicker
  373. } = e
  374. // 当第一列值发生变化时,变化第二列(后一列)对应的选项
  375. if (columnIndex === 0) {
  376. // picker为选择器this实例,变化第二列对应的选项
  377. picker.setColumnValues(1, this.cityArr2[index])
  378. picker.setColumnValues(2, this.cityArr3[index][0])
  379. }
  380. if (columnIndex === 1) {
  381. let index3 = indexs[0]
  382. // picker为选择器this实例,变化第二列对应的选项
  383. picker.setColumnValues(2, (this.cityArr3[index3])[index])
  384. }
  385. console.log(indexs[0])
  386. // console.log(this.cityArr3[index3])
  387. // console.log(value)
  388. // console.log(values)
  389. // console.log(columnIndex)
  390. },
  391. // 回调参数为包含columnIndex、value、values
  392. confirmCity(e) {
  393. console.log('confirm', e)
  394. this.form.fromArea = e.value.map((item)=>{
  395. return item.name
  396. }).join(',').replace(/,/g, '-')
  397. this.showCity = false
  398. },
  399. // 获取地区
  400. async areaTreeFn() {
  401. // this.cityArr2.push(this.traverse(item.children))
  402. const {data: res} = await areaTree()
  403. this.cityArr = res.map(item=>{
  404. let obj = {
  405. id: item.id,
  406. name: item.name
  407. }
  408. return obj
  409. })
  410. this.cityArr2 = res.map(item2=>{
  411. let arr2 = item2.children
  412. return arr2.map(val=>{
  413. let obj = {
  414. id: val.id,
  415. name: val.name
  416. }
  417. return obj
  418. })
  419. })
  420. this.cityArr3 = res.map(item2=>{
  421. let arr2 = item2.children
  422. return arr2.map(val=>{
  423. return val.children.map(val3=>{
  424. let obj = {
  425. id: val3.id,
  426. name: val3.name
  427. }
  428. return obj
  429. })
  430. })
  431. })
  432. },
  433. traverse(arr, result=[]) {
  434. for (var i = 0; i < arr.length; i++) {
  435. let item = arr[i]
  436. let obj = {
  437. id: item.id,
  438. name: item.name
  439. }
  440. result.push(obj)
  441. if(item.children.length) {
  442. this.traverse(item.children, result)
  443. }
  444. }
  445. return result;
  446. },
  447. // 选择驾校
  448. chooseSchool(item) {
  449. this.form.school = item.name
  450. this.form.schoolId = item.id
  451. this.columnsCar = [item.businessScope.split(',')]
  452. this.form.classModel = ''
  453. this.form.schoolClassId = ''
  454. this.form.trainType = ''
  455. this.form.coach = ''
  456. this.form.coachId = ''
  457. this.form.totalAmount = ''
  458. this.showSchool = false
  459. this.schoolClassFn()
  460. },
  461. // 选择班型
  462. confirmClassModel(val) {
  463. let item = val.value[0]
  464. console.log(item)
  465. this.showClassModel = false
  466. this.form.classModel = item.name
  467. this.form.schoolClassId = item.id
  468. this.form.totalAmount = item.totalAmount
  469. },
  470. // 选择车型
  471. confirmCar(val) {
  472. let item = val.value[0]
  473. console.log(item)
  474. this.showCar = false
  475. this.form.trainType = item
  476. },
  477. showCarClick() {
  478. if(!this.form.school) return this.$u.toast('请先选择驾校')
  479. this.showCar = true
  480. },
  481. // 跳转到选择教练
  482. goCoach() {
  483. if(!this.form.schoolId) return this.$u.toast('请先选择驾校')
  484. this.$goPage('/pages/indexEntry/enroll/registInfo/chooseCoach/chooseCoach?schoolId=' + this.form.schoolId)
  485. },
  486. // 选择原驾驶证初领日期
  487. confirmFirstLicenceTime(val) {
  488. console.log(val)
  489. this.form.firstDriveDate = uni.$u.timeFormat(val.value, 'yyyy-mm-dd');
  490. this.showFirstLicenceTime = false
  491. },
  492. // 选择原准驾车型
  493. pickerOldDrive(val) {
  494. this.form.oldTrainType = val
  495. this.showOldDriveModel = false
  496. console.log(val)
  497. },
  498. // 选择已过科目
  499. confirmSubjectPass(val) {
  500. let item = val.value[0]
  501. this.form.finishSubject = item.label
  502. this.showSubjectPass = false
  503. },
  504. // 选择已过科目
  505. confirmTreat(val) {
  506. let item = val.value[0]
  507. this.form.waitSubject = item.label
  508. this.showSubjectTreat = false
  509. },
  510. // 扫码
  511. scanCodeFn() {
  512. let _this = this
  513. uni.scanCode({
  514. success: function(res) {
  515. console.log('条码类型:' + res.scanType);
  516. console.log('条码内容:' + res.result);
  517. let obj = JSON.parse(res.result)
  518. obj.nickname = decodeURIComponent(obj.nickname)
  519. obj.schoolName = decodeURIComponent(obj.schoolName)
  520. _this.form.school = obj.schoolName
  521. _this.form.schoolId = obj.schoolId
  522. _this.form.coach = obj.nickname
  523. _this.form.coachId = obj.id
  524. console.log(obj)
  525. }
  526. });
  527. },
  528. async getSchoolDetailFn() {
  529. const {data: res} = await getSchoolDetail({id: this.form.schoolId})
  530. this.columnsCar = [res.businessScope.split(',')]
  531. console.log('驾校id')
  532. console.log(res.id)
  533. this.schoolClassFn()
  534. },
  535. changeVal(val) {
  536. console.log(val)
  537. },
  538. // 点击确认
  539. confirmClick() {
  540. this.showPopup = true
  541. },
  542. async comfigClick(val) {
  543. console.log(val)
  544. this.showPopup = false
  545. const {data: res} = await applyOnline(this.form)
  546. // 报名成功
  547. console.log(res)
  548. await this.$store.dispatch('getUserInfo')
  549. if(val) {
  550. this.$goPage('/pages/indexEntry/enroll/signContract/signContract?schoolId='+this.form.schoolId)
  551. }
  552. }
  553. }
  554. }
  555. </script>
  556. <style lang="scss" scoped>
  557. .pad {
  558. padding-bottom: 66rpx;
  559. }
  560. .card {
  561. padding: 10rpx 40rpx 10rpx 32rpx;
  562. margin-bottom: 20rpx;
  563. .row {
  564. height: 88rpx;
  565. display: flex;
  566. align-items: center;
  567. width: 100%;
  568. .lab {
  569. width: 152rpx;
  570. line-height: 88rpx;
  571. white-space: nowrap;
  572. &.long {
  573. width: 230rpx;
  574. }
  575. }
  576. .scan {
  577. margin-left: auto;
  578. width: 40rpx;
  579. height: 38rpx;
  580. image {
  581. display: block;
  582. width: 100%;
  583. height: 100%;
  584. }
  585. }
  586. .rightCon {
  587. flex: 1;
  588. width: 0;
  589. display: flex;
  590. .val {
  591. flex: 1;
  592. width: 0;
  593. input {
  594. font-size: 28rpx;
  595. }
  596. &.blue {
  597. color: $themC;
  598. }
  599. &.red {
  600. color: #FF6A2A;
  601. }
  602. }
  603. .icon {
  604. width: 30rpx;
  605. height: 30rpx;
  606. u-icon {
  607. }
  608. }
  609. }
  610. }
  611. }
  612. .btnBg {
  613. width: 396rpx;
  614. margin: 100rpx auto 0 auto;
  615. }
  616. </style>