driverIdentityTwo.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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. accountTypeFlag: "1",
  178. accountIndex: '0',
  179. binkindex: 0,
  180. cardAddressUrl: "",
  181. bankCard: "",
  182. bankDeposit: "",
  183. bankDepositBranch: "",
  184. payeeName: "",
  185. payeeNumberCard:"",
  186. }],
  187. ModelIndex: 0,
  188. Model: '',
  189. ModelType: ["高栏", "集装箱", "自卸车"],
  190. carLong: '',
  191. carLongIndex: 0,
  192. carLongType: ['13', '9.6', '8.2', '8.7', '11.7', '12.5', '13.7', '15', '16', '17.5'],
  193. DriverViewInfo: {},
  194. bankimg: [],
  195. bankImgs1: {},
  196. bankIndex: -1,
  197. bankType: [],
  198. accountType: ["个人账户", "企业账户"],
  199. accountarr: [],
  200. bankarr: [],
  201. show: false,
  202. carchength: true,
  203. subBranch:true,
  204. params: {
  205. year: true,
  206. },
  207. year: [],
  208. default_time:'',
  209. carModelType: [],
  210. carLengtharr: [],
  211. }
  212. },
  213. computed:{
  214. startData(){
  215. var data = new Date()
  216. return data.getFullYear() - 30
  217. },
  218. endData(){
  219. var data = new Date()
  220. return data.getFullYear()
  221. }
  222. },
  223. onLoad(options) {
  224. this.DriverViewInfo = JSON.parse(options.DriverViewInfo)
  225. this.driverPayeeInfoList[0].payeeName = this.DriverViewInfo.driverName
  226. this.driverPayeeInfoList[0].payeeNumberCard = this.DriverViewInfo.numberCard
  227. },
  228. methods: {
  229. subBranchChength(){
  230. this.subBranch = !this.subBranch
  231. },
  232. changeCarChength() {
  233. this.carchength = !this.carchength
  234. },
  235. yearchange() {
  236. this.show = true
  237. },
  238. yearpicker(e, index) {
  239. this.year[index] = e.year
  240. this.driverCarInfoList[index].yearManufacture = e.year
  241. },
  242. accountChange(e, index) {
  243. this.driverPayeeInfoList[index].accountIndex = e.detail.value
  244. this.driverPayeeInfoList[index].accountType = this.accountType[this.driverPayeeInfoList[index]
  245. .accountIndex];
  246. this.driverPayeeInfoList[index].accountTypeFlag= e.detail.value+1;
  247. this.accountarr[index] = this.accountType[e.detail.value];
  248. },
  249. bankimgs(items) {
  250. var that = this
  251. wx.chooseImage({
  252. success: function(res) {
  253. wx.uploadFile({
  254. url: 'https://www.zthymaoyi.com/upload/admin',
  255. filePath: res.tempFilePaths[0],
  256. name: 'file',
  257. success(res) {
  258. var data = res.data
  259. var strToObj = JSON.parse(data)
  260. // that.id[0] = strToObj.url
  261. that.bankimg[items] = strToObj.url
  262. that.bankImgs1.bankImg = strToObj.url
  263. that.driverPayeeInfoList[items].cardAddressUrl = strToObj.url
  264. that.$api.doRequest('get', '/driverViewInfo/bankShibie', that
  265. .bankImgs1).then(res => {
  266. that.$set(that.driverPayeeInfoList[items], 'bankCard', res
  267. .data.data.bankNo)
  268. that.$set(that.driverPayeeInfoList[items], 'bankDeposit',
  269. res.data.data.bankName)
  270. that.bankType[items] = res.data.data.bankNameZhihang
  271. }).catch(res => {
  272. uni.showToast({
  273. title: res.data.message,
  274. icon: 'none',
  275. duration: 2000
  276. })
  277. })
  278. }
  279. })
  280. }
  281. })
  282. },
  283. jumpUrl() {
  284. for (var i = 0; i < this.driverCarInfoList.length; i++) {
  285. if (!this.driverCarInfoList[i].carNumber) {
  286. this.$api.msg('车牌号不能为空')
  287. return
  288. }
  289. if (this.driverCarInfoList[i].carNumber.toString().length != 7) {
  290. this.$api.msg('车牌号输入错误')
  291. return
  292. }
  293. if (!this.driverCarInfoList[i].carModel) {
  294. this.$api.msg('车型不能为空')
  295. return
  296. }
  297. if (!this.driverCarInfoList[i].carLength) {
  298. this.$api.msg('车长不能为空')
  299. return
  300. }
  301. if (this.driverCarInfoList[i].carLength > 50) {
  302. this.$api.msg('车长输入错误')
  303. return
  304. }
  305. if (this.driverCarInfoList[i].carLength.indexOf('.') != -1) {
  306. if (this.driverCarInfoList[i].carLength.split('.')[1].length > 1) {
  307. this.$api.msg('车长输入错误')
  308. return
  309. }
  310. }
  311. if (!this.driverCarInfoList[i].carLoad) {
  312. this.$api.msg('载重不能为空')
  313. return
  314. }
  315. if (this.driverCarInfoList[i].carLoad > 50) {
  316. this.$api.msg('载重输入错误')
  317. return
  318. }
  319. if (this.driverCarInfoList[i].carLoad.indexOf('.') != -1) {
  320. if (this.driverCarInfoList[i].carLoad.split('.')[1].length > 1) {
  321. this.$api.msg('载重输入错误')
  322. return
  323. }
  324. }
  325. if (!this.driverCarInfoList[i].yearManufacture) {
  326. this.$api.msg('出厂年份不能为空')
  327. return
  328. }
  329. }
  330. for (var i = 0; i < this.driverPayeeInfoList.length; i++) {
  331. if (!this.driverPayeeInfoList[i].accountType) {
  332. this.$api.msg('账户类型不能为空')
  333. return
  334. }
  335. // if (!this.driverCarInfoList[i].cardAddressUrl) {
  336. // this.$api.msg('银行卡照片不能为空')
  337. // }
  338. if (!this.driverPayeeInfoList[i].bankCard) {
  339. this.$api.msg('银行卡号不能为空')
  340. return
  341. }
  342. if (this.driverPayeeInfoList[i].bankCard.length < 16 || this.driverPayeeInfoList[i].bankCard.length >
  343. 19) {
  344. this.$api.msg('银行卡号输入错误')
  345. return
  346. }
  347. if (!this.driverPayeeInfoList[i].bankDeposit) {
  348. this.$api.msg('开户行不能为空')
  349. return
  350. }
  351. if (this.driverPayeeInfoList[i].bankDeposit.length < 4 || this.driverPayeeInfoList[i].bankDeposit
  352. .length > 15) {
  353. this.$api.msg('开户行输入错误')
  354. return
  355. }
  356. if (!this.driverPayeeInfoList[i].bankDepositBranch) {
  357. this.$api.msg('开户支行不能为空')
  358. return
  359. }
  360. if (this.driverPayeeInfoList[i].bankDepositBranch.length < 4 || this.driverPayeeInfoList[i]
  361. .bankDepositBranch.length > 30) {
  362. this.$api.msg('开户支行输入错误')
  363. return
  364. }
  365. if(this.driverPayeeInfoList[i].accountTypeFlag==1){
  366. if (!this.driverPayeeInfoList[i].payeeName) {
  367. this.$api.msg('收款人姓名不能为空')
  368. return
  369. }
  370. if (this.driverPayeeInfoList[i].payeeName.length < 2 || this.driverPayeeInfoList[i].payeeName.length >
  371. 10) {
  372. this.$api.msg('收款人姓名输入错误')
  373. return
  374. }
  375. if (!this.driverPayeeInfoList[i].payeeNumberCard) {
  376. this.$api.msg('收款人身份证号不能为空')
  377. return
  378. }
  379. if (this.driverPayeeInfoList[i].payeeNumberCard.length != 18) {
  380. this.$api.msg('收款人身份证号输入错误')
  381. return
  382. }
  383. }
  384. }
  385. this.DriverViewInfo.driverCarInfoList = this.driverCarInfoList
  386. this.DriverViewInfo.driverPayeeInfoList = this.driverPayeeInfoList
  387. this.DriverViewInfo.driverPayeeInfoList.payeeAddressUrl = this.bankimg
  388. var model = JSON.stringify(this.DriverViewInfo);
  389. uni.navigateTo({
  390. url: `/pageD/identity/driverIdentityThree?DriverViewInfo=` + model
  391. })
  392. },
  393. carAdd() {
  394. this.driverCarInfoList.push({
  395. carNumber: '',
  396. carModel: "",
  397. carLength: "",
  398. carLoad: "",
  399. yearManufacture: "",
  400. })
  401. },
  402. userAdd() {
  403. this.driverPayeeInfoList.push({
  404. accountType: "个人账户",
  405. accountIndex: '0',
  406. binkindex: 0,
  407. cardAddressUrl: "",
  408. bankCard: "",
  409. bankDeposit: "",
  410. bankDepositBranch: "",
  411. payeeName: this.DriverViewInfo.driverName,
  412. payeeNumberCard: this.DriverViewInfo.numberCard,
  413. })
  414. },
  415. carDel(index) {
  416. if (this.driverCarInfoList.length > 1) {
  417. this.driverCarInfoList.splice(index, 1)
  418. }
  419. },
  420. userDel(index) {
  421. if (this.driverPayeeInfoList.length > 1) {
  422. this.driverPayeeInfoList.splice(index, 1)
  423. }
  424. },
  425. ModelChange(e, index) {
  426. this.ModelIndex = e.detail.value
  427. this.driverCarInfoList[index].carModel = this.ModelType[this.ModelIndex];
  428. this.carModelType[index] = this.ModelType[this.ModelIndex];
  429. },
  430. bankChange(e, index) {
  431. this.driverPayeeInfoList[index].binkindex = e.detail.value
  432. this.$set(this.bankarr, index, this.bankType[index][this.driverPayeeInfoList[index].binkindex])
  433. this.driverPayeeInfoList[index].bankDepositBranch = this.bankType[index][e.detail.value];
  434. },
  435. carLongChange(e, index) {
  436. this.carLongIndex = e.detail.value
  437. this.carLong = this.carLongType[this.carLongIndex];
  438. this.driverCarInfoList[index].carLength = this.carLongType[this.carLongIndex];
  439. this.carLengtharr[index] = this.carLongType[this.carLongIndex];
  440. },
  441. opencarclick() {
  442. if (this.opencarboolean == false) {
  443. this.opencarboolean = true;
  444. this.opencar = "../../static/img/authentication/up2%20(3).png"
  445. } else if (this.opencarboolean == true) {
  446. this.opencarboolean = false;
  447. this.opencar = "../../static/img/authentication/down2@3x.png"
  448. }
  449. },
  450. openuserclick() {
  451. if (this.openuserboolean == false) {
  452. this.openuserboolean = true;
  453. this.openuser = "../../static/img/authentication/up2%20(3).png"
  454. } else if (this.openuserboolean == true) {
  455. this.openuserboolean = false;
  456. this.openuser = "../../static/img/authentication/down2@3x.png"
  457. }
  458. }
  459. }
  460. }
  461. </script>
  462. <style scoped>
  463. .center {
  464. padding: 10px 20px;
  465. background-color: #F5F6FA;
  466. }
  467. .c-row {
  468. display: -webkit-box;
  469. display: -webkit-flex;
  470. display: flex;
  471. -webkit-box-align: center;
  472. -webkit-align-items: center;
  473. align-items: center;
  474. padding: 20rpx 30rpx;
  475. position: relative;
  476. line-height: 36px;
  477. }
  478. .con-list {
  479. -webkit-box-flex: 1;
  480. -webkit-flex: 1;
  481. flex: 1;
  482. display: -webkit-box;
  483. display: -webkit-flex;
  484. display: flex;
  485. -webkit-box-orient: vertical;
  486. -webkit-box-direction: normal;
  487. -webkit-flex-direction: column;
  488. flex-direction: column;
  489. color: #AFB3BF;
  490. line-height: 40rpx;
  491. text-align: right;
  492. padding-right: 20rpx;
  493. font-size: 14px;
  494. }
  495. .open {
  496. width: 30px;
  497. height: 20px;
  498. position: absolute;
  499. right: 20px;
  500. margin-top: -10px;
  501. }
  502. .information {
  503. margin-top: 10px;
  504. width: 100%;
  505. height: 56px;
  506. background-color: #FFFFFF;
  507. border-radius: 16px;
  508. }
  509. .informations {
  510. margin-top: 10px;
  511. background-color: #FFFFFF;
  512. border-radius: 20px;
  513. }
  514. .btn {
  515. margin-top: 10px;
  516. background-color: #FFFFFF;
  517. border-radius: 25px;
  518. border: none;
  519. }
  520. .btns {
  521. background-color: #22C572;
  522. }
  523. .add {
  524. width: 26px;
  525. height: 26px;
  526. /* background-image: url(../../static/img/jiaoyi/ic_fabu@3x.png); */
  527. }
  528. /* 清除 */
  529. .eliminate {
  530. width: 20px;
  531. height: 20px;
  532. float: right;
  533. }
  534. .bankImg {
  535. width: 20px;
  536. height: 20px;
  537. }
  538. </style>