学员端小程序
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.

660 lines
18 KiB

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