driverIdentityTwo.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <template>
  2. <view class="center">
  3. <!-- 车辆信息 -->
  4. <view class="information">
  5. <view class="c-row">
  6. <text class="tit">货车信息</text>
  7. <view class="con-list">
  8. <image v-bind:src="opencar" class="open" opencarboolean @click="opencarclick"></image>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="informations" v-if="opencarboolean == true" v-for="(item , index) in driverCarInfoList"
  13. :Key="index">
  14. <view class="c-row ">
  15. <text class="tit">车辆 -{{index+1}}</text>
  16. <view class="con-list">
  17. <image src="../../static/img/jiaoyi/shanchu@2x.png" class="eliminate" @click="carDel(index)">
  18. </image>
  19. </view>
  20. </view>
  21. <view class="c-row b-b">
  22. <text class="tit">车牌号</text>
  23. <view class="con-list">
  24. <input placeholder="请填写车牌号" name="input" v-model="item.carNumber"></input>
  25. </view>
  26. </view>
  27. <view class="c-row b-b">
  28. <text class="tit">车型</text>
  29. <picker @change="ModelChange($event,index)" :value="ModelIndex" :range="ModelType" class="con-list">
  30. <view class="picker " v-model="item.carModel">
  31. {{carModelType[index] != null?carModelType[index]:'请选择车型'}}
  32. </view>
  33. </picker>
  34. </view>
  35. <view class="c-row b-b">
  36. <text class="tit">不含车头车长(米)</text>
  37. <picker v-if="carchength" @change="carLongChange($event,index)" :value="carLongIndex"
  38. :range="carLongType" class="con-list">
  39. <view class="picker" v-model="item.carLength">
  40. {{carLengtharr[index] != null?carLengtharr[index]:'请选择车长'}}
  41. </view>
  42. </picker>
  43. <view v-else class="con-list">
  44. <input placeholder="请填写车长(米)" name="input" v-model="item.carLength"></input>
  45. </view>
  46. <button v-if="carchength" class='cu-btn bg-green shadow' @click="changeCarChength">填写</button>
  47. <button v-else class='cu-btn bg-green shadow' @click="changeCarChength">选择</button>
  48. </view>
  49. <view class="c-row b-b">
  50. <text class="tit">载重(吨)</text>
  51. <view class="con-list">
  52. <input placeholder="请填写载重(吨)" name="input" v-model="item.carLoad"></input>
  53. </view>
  54. </view>
  55. <view class="c-row ">
  56. <text class="tit">出厂年份</text>
  57. <view class="con-list">
  58. <view @click='yearchange'>{{year[index] == null?"请选择出厂年份":year[index]}}</view>
  59. <u-picker :params='params' @confirm='yearpicker($event,index)' v-model="show" mode="time" :start-year="startData" :end-year="endData">
  60. </u-picker>
  61. </view>
  62. </view>
  63. </view>
  64. <button class="btn" v-if="opencarboolean == true" @click="carAdd">
  65. <image src="../../static/img/jiaoyi/ic_fabu@3x.png" class="add" style="top: 8px;"></image>
  66. <texe>添加车辆</texe>
  67. </button>
  68. <!-- 账户信息 -->
  69. <view class="information">
  70. <view class="c-row">
  71. <text class="tit">账户信息</text>
  72. <view class="con-list">
  73. <image v-bind:src="openuser" class="open" openuserboolean @click="openuserclick"></image>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="informations" v-if="openuserboolean == true" v-for="(items , index) in driverPayeeInfoList"
  78. :Key="index">
  79. <view class="c-row ">
  80. <text class="tit">账户 -{{index+1}}</text>
  81. <view class="con-list">
  82. <image src="../../static/img/jiaoyi/shanchu@2x.png" class="eliminate" @click="userDel(index)">
  83. </image>
  84. </view>
  85. </view>
  86. <view class="c-row b-b">
  87. <text class="tit">账户类型</text>
  88. <picker @change="accountChange($event,index)" :value="accountarr[index]" :range="accountType"
  89. class="con-list">
  90. <view class="picker" v-model="items.accountType">
  91. {{accountarr[index] != null ? accountarr[index]:'个人账户'}}
  92. </view>
  93. </picker>
  94. </view>
  95. <view class="c-row b-b">
  96. <text class="tit">银行卡照片(可选)</text>
  97. <view class="con-list">
  98. <view v-if="bankimg[index] == null" @click="bankimgs(index)">请上传照片</view>
  99. <view v-if="bankimg[index] != null" @click="bankimgs(index)">
  100. <image v-bind:src="bankimg[index]" style="width: 40px; height: 40px;"></image>
  101. </view>
  102. </view>
  103. </view>
  104. <view class="c-row b-b">
  105. <text class="tit">银行卡号</text>
  106. <view class="con-list">
  107. <input placeholder="请输入银行卡号" name="input" v-model="items.bankCard"></input>
  108. </view>
  109. </view>
  110. <view class="c-row b-b">
  111. <text class="tit">开户行</text>
  112. <view class="con-list">
  113. <input placeholder="请输入开户行" name="input" v-model="items.bankDeposit"></input>
  114. </view>
  115. </view>
  116. <view class="c-row b-b">
  117. <text class="tit">开户支行</text>
  118. <picker v-if="subBranch" @change="bankChange($event,index)" :value="bankarr[index]" :range="bankType[index]"
  119. class="con-list">
  120. <view class="con-list">
  121. {{bankarr[index] != null?bankarr[index]:'请选择开户支行'}}
  122. </view>
  123. </picker>
  124. <view v-else class="con-list">
  125. <input placeholder="请填写开户支行" name="input" v-model="items.bankDepositBranch"></input>
  126. </view>
  127. <button v-if="subBranch" class='cu-btn bg-green shadow' @click="subBranchChength">填写</button>
  128. <button v-else class='cu-btn bg-green shadow' @click="subBranchChength">识别</button>
  129. </view>
  130. <view class="c-row b-b" v-if="items.accountType == '个人账户'">
  131. <text class="tit">收款人姓名</text>
  132. <view class="con-list">
  133. <input placeholder="请输入收款人姓名" name="input" v-model="items.payeeName"></input>
  134. </view>
  135. </view>
  136. <view class="c-row " v-if="items.accountType == '个人账户'">
  137. <text class="tit">收款人身份证号</text>
  138. <view class="con-list">
  139. <input placeholder="请输入收款人身份证号" name="input" v-model="items.payeeNumberCard"></input>
  140. </view>
  141. </view>
  142. <view class="c-row " v-if="items.accountType == '企业账户'">
  143. <text class="tit">企业名称</text>
  144. <view class="con-list">
  145. <input placeholder="请输入企业名称" name="input" v-model="items.compName"></input>
  146. </view>
  147. </view>
  148. </view>
  149. <button class="btn" v-if="openuserboolean == true && this.driverPayeeInfoList.length < 10" @click="userAdd()" >
  150. <image src="../../static/img/jiaoyi/ic_fabu@3x.png" class="add" style="top: 8px;"></image>
  151. <text style="margin-top: -2px;">添加账户</text>
  152. </button>
  153. <button class="btns btn" @click="jumpUrl">下一步</button>
  154. </view>
  155. </view>
  156. </template>
  157. <script>
  158. import {
  159. mapState
  160. } from 'vuex';
  161. export default {
  162. data() {
  163. return {
  164. opencar: "../../static/img/authentication/down2@3x.png",
  165. openuser: "../../static/img/authentication/down2@3x.png",
  166. opencarboolean: false,
  167. openuserboolean: false,
  168. driverCarInfoList: [{
  169. carNumber: '',
  170. carModel: "高栏",
  171. carLength: "13",
  172. carLoad: "",
  173. yearManufacture: "",
  174. }],
  175. driverPayeeInfoList: [{
  176. accountType: "个人账户",
  177. accountIndex: '0',
  178. binkindex: 0,
  179. cardAddressUrl: "",
  180. bankCard: "",
  181. bankDeposit: "",
  182. bankDepositBranch: "",
  183. payeeName: "",
  184. payeeNumberCard:"",
  185. }],
  186. ModelIndex: 0,
  187. Model: '',
  188. ModelType: ["高栏", "集装箱", "自卸车"],
  189. carLong: '',
  190. carLongIndex: 0,
  191. carLongType: ['13', '9.6', '8.2', '8.7', '11.7', '12.5', '13.7', '15', '16', '17.5'],
  192. DriverViewInfo: {},
  193. bankimg: [],
  194. bankImgs1: {},
  195. bankIndex: -1,
  196. bankType: [],
  197. accountType: ["个人账户", "企业账户"],
  198. accountarr: [],
  199. bankarr: [],
  200. show: false,
  201. carchength: true,
  202. subBranch:true,
  203. params: {
  204. year: true,
  205. },
  206. year: [],
  207. default_time:'',
  208. carModelType: [],
  209. carLengtharr: [],
  210. }
  211. },
  212. computed:{
  213. startData(){
  214. var data = new Date()
  215. return data.getFullYear() - 30
  216. },
  217. endData(){
  218. var data = new Date()
  219. return data.getFullYear()
  220. }
  221. },
  222. onLoad(options) {
  223. this.DriverViewInfo = JSON.parse(options.DriverViewInfo)
  224. this.driverPayeeInfoList[0].payeeName = this.DriverViewInfo.driverName
  225. this.driverPayeeInfoList[0].payeeNumberCard = this.DriverViewInfo.numberCard
  226. },
  227. methods: {
  228. subBranchChength(){
  229. this.subBranch = !this.subBranch
  230. },
  231. changeCarChength() {
  232. this.carchength = !this.carchength
  233. },
  234. yearchange() {
  235. this.show = true
  236. },
  237. yearpicker(e, index) {
  238. this.year[index] = e.year
  239. this.driverCarInfoList[index].yearManufacture = e.year
  240. },
  241. accountChange(e, index) {
  242. this.driverPayeeInfoList[index].accountIndex = e.detail.value
  243. this.driverPayeeInfoList[index].accountType = this.accountType[this.driverPayeeInfoList[index]
  244. .accountIndex];
  245. this.accountarr[index] = this.accountType[e.detail.value];
  246. },
  247. bankimgs(items) {
  248. var that = this
  249. wx.chooseImage({
  250. success: function(res) {
  251. wx.uploadFile({
  252. url: 'https://www.zthymaoyi.com/upload/admin',
  253. filePath: res.tempFilePaths[0],
  254. name: 'file',
  255. success(res) {
  256. var data = res.data
  257. var strToObj = JSON.parse(data)
  258. // that.id[0] = strToObj.url
  259. that.bankimg[items] = strToObj.url
  260. that.bankImgs1.bankImg = strToObj.url
  261. that.driverPayeeInfoList[items].cardAddressUrl = strToObj.url
  262. that.$api.doRequest('get', '/driverViewInfo/bankShibie', that
  263. .bankImgs1).then(res => {
  264. that.$set(that.driverPayeeInfoList[items], 'bankCard', res
  265. .data.data.bankNo)
  266. that.$set(that.driverPayeeInfoList[items], 'bankDeposit',
  267. res.data.data.bankName)
  268. that.bankType[items] = res.data.data.bankNameZhihang
  269. }).catch(res => {
  270. uni.showToast({
  271. title: res.data.message,
  272. icon: 'none',
  273. duration: 2000
  274. })
  275. })
  276. }
  277. })
  278. }
  279. })
  280. },
  281. jumpUrl() {
  282. for (var i = 0; i < this.driverCarInfoList.length; i++) {
  283. if (!this.driverCarInfoList[i].carNumber) {
  284. this.$api.msg('车牌号不能为空')
  285. return
  286. }
  287. if (this.driverCarInfoList[i].carNumber.toString().length != 7) {
  288. this.$api.msg('车牌号输入错误')
  289. return
  290. }
  291. if (!this.driverCarInfoList[i].carModel) {
  292. this.$api.msg('车型不能为空')
  293. return
  294. }
  295. if (!this.driverCarInfoList[i].carLength) {
  296. this.$api.msg('车长不能为空')
  297. return
  298. }
  299. if (this.driverCarInfoList[i].carLength > 50) {
  300. this.$api.msg('车长输入错误')
  301. return
  302. }
  303. if (this.driverCarInfoList[i].carLength.indexOf('.') != -1) {
  304. if (this.driverCarInfoList[i].carLength.split('.')[1].length > 1) {
  305. this.$api.msg('车长输入错误')
  306. return
  307. }
  308. }
  309. if (!this.driverCarInfoList[i].carLoad) {
  310. this.$api.msg('载重不能为空')
  311. return
  312. }
  313. if (this.driverCarInfoList[i].carLoad > 50) {
  314. this.$api.msg('载重输入错误')
  315. return
  316. }
  317. if (this.driverCarInfoList[i].carLoad.indexOf('.') != -1) {
  318. if (this.driverCarInfoList[i].carLoad.split('.')[1].length > 1) {
  319. this.$api.msg('载重输入错误')
  320. return
  321. }
  322. }
  323. if (!this.driverCarInfoList[i].yearManufacture) {
  324. this.$api.msg('出厂年份不能为空')
  325. return
  326. }
  327. }
  328. for (var i = 0; i < this.driverPayeeInfoList.length; i++) {
  329. if (!this.driverPayeeInfoList[i].accountType) {
  330. this.$api.msg('账户类型不能为空')
  331. return
  332. }
  333. // if (!this.driverCarInfoList[i].cardAddressUrl) {
  334. // this.$api.msg('银行卡照片不能为空')
  335. // }
  336. if (!this.driverPayeeInfoList[i].bankCard) {
  337. this.$api.msg('银行卡号不能为空')
  338. return
  339. }
  340. if (this.driverPayeeInfoList[i].bankCard.length < 16 || this.driverPayeeInfoList[i].bankCard.length >
  341. 19) {
  342. this.$api.msg('银行卡号输入错误')
  343. return
  344. }
  345. if (!this.driverPayeeInfoList[i].bankDeposit) {
  346. this.$api.msg('开户行不能为空')
  347. return
  348. }
  349. if (this.driverPayeeInfoList[i].bankDeposit.length < 4 || this.driverPayeeInfoList[i].bankDeposit
  350. .length > 15) {
  351. this.$api.msg('开户行输入错误')
  352. return
  353. }
  354. if (!this.driverPayeeInfoList[i].bankDepositBranch) {
  355. this.$api.msg('开户支行不能为空')
  356. return
  357. }
  358. if (this.driverPayeeInfoList[i].bankDepositBranch.length < 4 || this.driverPayeeInfoList[i]
  359. .bankDepositBranch.length > 30) {
  360. this.$api.msg('开户支行输入错误')
  361. return
  362. }
  363. if (!this.driverPayeeInfoList[i].payeeName) {
  364. this.$api.msg('收款人姓名不能为空')
  365. return
  366. }
  367. if (this.driverPayeeInfoList[i].payeeName.length < 2 || this.driverPayeeInfoList[i].payeeName.length >
  368. 10) {
  369. this.$api.msg('收款人姓名输入错误')
  370. return
  371. }
  372. if (!this.driverPayeeInfoList[i].payeeNumberCard) {
  373. this.$api.msg('收款人身份证号不能为空')
  374. return
  375. }
  376. if (this.driverPayeeInfoList[i].payeeNumberCard.length != 18) {
  377. this.$api.msg('收款人身份证号输入错误')
  378. return
  379. }
  380. }
  381. this.DriverViewInfo.driverCarInfoList = this.driverCarInfoList
  382. this.DriverViewInfo.driverPayeeInfoList = this.driverPayeeInfoList
  383. this.DriverViewInfo.driverPayeeInfoList.payeeAddressUrl = this.bankimg
  384. var model = JSON.stringify(this.DriverViewInfo);
  385. uni.navigateTo({
  386. url: `/pageD/identity/driverIdentityThree?DriverViewInfo=` + model
  387. })
  388. },
  389. carAdd() {
  390. this.driverCarInfoList.push({
  391. carNumber: '',
  392. carModel: "",
  393. carLength: "",
  394. carLoad: "",
  395. yearManufacture: "",
  396. })
  397. },
  398. userAdd() {
  399. this.driverPayeeInfoList.push({
  400. accountType: "个人账户",
  401. accountIndex: '0',
  402. binkindex: 0,
  403. cardAddressUrl: "",
  404. bankCard: "",
  405. bankDeposit: "",
  406. bankDepositBranch: "",
  407. payeeName: this.DriverViewInfo.driverName,
  408. payeeNumberCard: this.DriverViewInfo.numberCard,
  409. })
  410. },
  411. carDel(index) {
  412. if (this.driverCarInfoList.length > 1) {
  413. this.driverCarInfoList.splice(index, 1)
  414. }
  415. },
  416. userDel(index) {
  417. if (this.driverPayeeInfoList.length > 1) {
  418. this.driverPayeeInfoList.splice(index, 1)
  419. }
  420. },
  421. ModelChange(e, index) {
  422. this.ModelIndex = e.detail.value
  423. this.driverCarInfoList[index].carModel = this.ModelType[this.ModelIndex];
  424. this.carModelType[index] = this.ModelType[this.ModelIndex];
  425. },
  426. bankChange(e, index) {
  427. this.driverPayeeInfoList[index].binkindex = e.detail.value
  428. this.$set(this.bankarr, index, this.bankType[index][this.driverPayeeInfoList[index].binkindex])
  429. this.driverPayeeInfoList[index].bankDepositBranch = this.bankType[index][e.detail.value];
  430. },
  431. carLongChange(e, index) {
  432. this.carLongIndex = e.detail.value
  433. this.carLong = this.carLongType[this.carLongIndex];
  434. this.driverCarInfoList[index].carLength = this.carLongType[this.carLongIndex];
  435. this.carLengtharr[index] = this.carLongType[this.carLongIndex];
  436. },
  437. opencarclick() {
  438. if (this.opencarboolean == false) {
  439. this.opencarboolean = true;
  440. this.opencar = "../../static/img/authentication/up2%20(3).png"
  441. } else if (this.opencarboolean == true) {
  442. this.opencarboolean = false;
  443. this.opencar = "../../static/img/authentication/down2@3x.png"
  444. }
  445. },
  446. openuserclick() {
  447. if (this.openuserboolean == false) {
  448. this.openuserboolean = true;
  449. this.openuser = "../../static/img/authentication/up2%20(3).png"
  450. } else if (this.openuserboolean == true) {
  451. this.openuserboolean = false;
  452. this.openuser = "../../static/img/authentication/down2@3x.png"
  453. }
  454. }
  455. }
  456. }
  457. </script>
  458. <style scoped>
  459. .center {
  460. padding: 10px 20px;
  461. background-color: #F5F6FA;
  462. }
  463. .c-row {
  464. display: -webkit-box;
  465. display: -webkit-flex;
  466. display: flex;
  467. -webkit-box-align: center;
  468. -webkit-align-items: center;
  469. align-items: center;
  470. padding: 20rpx 30rpx;
  471. position: relative;
  472. line-height: 36px;
  473. }
  474. .con-list {
  475. -webkit-box-flex: 1;
  476. -webkit-flex: 1;
  477. flex: 1;
  478. display: -webkit-box;
  479. display: -webkit-flex;
  480. display: flex;
  481. -webkit-box-orient: vertical;
  482. -webkit-box-direction: normal;
  483. -webkit-flex-direction: column;
  484. flex-direction: column;
  485. color: #AFB3BF;
  486. line-height: 40rpx;
  487. text-align: right;
  488. padding-right: 20rpx;
  489. font-size: 14px;
  490. }
  491. .open {
  492. width: 30px;
  493. height: 20px;
  494. position: absolute;
  495. right: 20px;
  496. margin-top: -10px;
  497. }
  498. .information {
  499. margin-top: 10px;
  500. width: 100%;
  501. height: 56px;
  502. background-color: #FFFFFF;
  503. border-radius: 16px;
  504. }
  505. .informations {
  506. margin-top: 10px;
  507. background-color: #FFFFFF;
  508. border-radius: 20px;
  509. }
  510. .btn {
  511. margin-top: 10px;
  512. background-color: #FFFFFF;
  513. border-radius: 25px;
  514. border: none;
  515. }
  516. .btns {
  517. background-color: #22C572;
  518. }
  519. .add {
  520. width: 26px;
  521. height: 26px;
  522. /* background-image: url(../../static/img/jiaoyi/ic_fabu@3x.png); */
  523. }
  524. /* 清除 */
  525. .eliminate {
  526. width: 20px;
  527. height: 20px;
  528. float: right;
  529. }
  530. .bankImg {
  531. width: 20px;
  532. height: 20px;
  533. }
  534. </style>