driverIdentityEdit.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <template>
  2. <view class="center">
  3. <view>
  4. <view class="labels">司机信息</view>
  5. <view>
  6. <button type="default" @click="idUp">上传身份证正面</button>
  7. <view style="width: 100px;margin: 0 auto;" v-if="id != ''">
  8. <image v-bind:src = "id1" style="width: 100px;height: 100px;"></image>
  9. </view>
  10. <button type="default" @click="idLow">上传身份证反面</button>
  11. <view style="width: 100px;margin: 0 auto;" v-if="id2 != ''">
  12. <image v-bind:src = "id2" style="width: 100px;height: 100px;"></image>
  13. </view>
  14. </view>
  15. <view class="c-row b-b">
  16. <text class="tit">姓名</text>
  17. <view class="con-list">
  18. <input placeholder="请填写姓名" name="input" v-model="DriverViewInfo.driverName"></input>
  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="DriverViewInfo.numberCard"></input>
  25. </view>
  26. </view>
  27. <view class="c-row b-b">
  28. <text class="tit">手机号</text>
  29. <view class="con-list">
  30. <input placeholder="请填写手机号" name="input" v-model="DriverViewInfo.driverPhone"></input>
  31. </view>
  32. </view>
  33. <view style='width:100%;border-bottom:1px solid #E8E9ED;position:relative;padding:10px;' class="flex">
  34. <button :class='codestatus&&!sendDisabled?"active":""' @click='getcode'
  35. class='getcode'>{{sendText}}</button>
  36. <view style='width:70%;position:relative;margin-left: 200px;'>
  37. <view class="con-list">
  38. <!-- style='width:70%;position:relative;margin-left: 200px;' -->
  39. <input v-model='verifyCode' placeholder="请输入验证码" type="text">
  40. </view>
  41. </view>
  42. </view>
  43. <view class="c-row b-b">
  44. <text class="tit">常驻城市</text>
  45. <view class="con-list">
  46. <input placeholder="请填写常驻城市" name="input" v-model="DriverViewInfo.residentCityProvincial"></input>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="margin-top">
  51. <view class="labels">货车信息</view>
  52. <view class="labels"> 车辆 -?</view>
  53. <view class="c-row b-b">
  54. <text class="tit">车牌号</text>
  55. <view class="con-list">
  56. <input placeholder="请填写车牌号" name="input" v-model="driverCarInfoList[0].carNumber"></input>
  57. </view>
  58. </view>
  59. <view class="c-row b-b">
  60. <text class="tit">车型</text>
  61. <!-- <view class="con-list"> -->
  62. <picker @change="ModelChange" :value="ModelIndex" :range="ModelType" class="con-list">
  63. <view class="picker ">
  64. {{ModelIndex>-1?ModelType[ModelIndex]:'请选择车型'}}
  65. </view>
  66. </picker>
  67. <!-- </view> -->
  68. </view>
  69. <view class="c-row b-b">
  70. <text class="tit">不含车头车长(米)</text>
  71. <!-- <view class="con-list"> -->
  72. <picker @change="carLongChange" :value="carLongIndex" :range="carLongType" class="con-list">
  73. <view class="picker">
  74. {{carLongIndex>-1?carLongType[carLongIndex]:'请选择车长'}}
  75. </view>
  76. </picker>
  77. <!-- </view> -->
  78. </view>
  79. <view class="c-row b-b">
  80. <text class="tit">载重(吨)</text>
  81. <view class="con-list">
  82. <input placeholder="请填写载重(吨)" name="input" v-model="driverCarInfoList[0].carLoad"></input>
  83. </view>
  84. </view>
  85. <view class="c-row b-b">
  86. <text class="tit">出厂年份</text>
  87. <view class="con-list">
  88. <input placeholder="请填写出厂年份" name="input" v-model="driverCarInfoList[0].yearManufacture"></input>
  89. </view>
  90. </view>
  91. <button type="default">添加车辆</button>
  92. </view>
  93. <view class="margin-top">
  94. <view class="labels">账户信息</view>
  95. <view class="labels"> 账户 -?</view>
  96. <view class="c-row b-b">
  97. <text class="tit">账户类型</text>
  98. <view class="con-list">
  99. <input placeholder="请填写账户类型" name="input" v-model="driverPayeeInfoList[0].accountType"></input>
  100. </view>
  101. </view>
  102. <view class="c-row b-b">
  103. <text class="tit">银行卡照片(可选)</text>
  104. <view class="con-list">
  105. <input placeholder="请上传照片" name="input" v-model="driverPayeeInfoList[0].payeeAddressUrl"></input>
  106. </view>
  107. </view>
  108. <view class="c-row b-b">
  109. <text class="tit">银行卡号</text>
  110. <view class="con-list">
  111. <input placeholder="请输入银行卡号" name="input" v-model="driverPayeeInfoList[0].bankCard"></input>
  112. </view>
  113. </view>
  114. <view class="c-row b-b">
  115. <text class="tit">开户行</text>
  116. <view class="con-list">
  117. <input placeholder="请输入开户行" name="input" v-model="driverPayeeInfoList[0].bankDeposit"></input>
  118. </view>
  119. </view>
  120. <view class="c-row b-b">
  121. <text class="tit">开户支行</text>
  122. <view class="con-list">
  123. <input placeholder="请输入开户支行" name="input" v-model="driverPayeeInfoList[0].bankDepositBranch"></input>
  124. </view>
  125. </view>
  126. <view class="c-row b-b">
  127. <text class="tit">收款人姓名</text>
  128. <view class="con-list">
  129. <input placeholder="请输入收款人姓名" name="input" v-model="driverPayeeInfoList[0].payeeName"></input>
  130. </view>
  131. </view>
  132. <view class="c-row b-b">
  133. <text class="tit">收款人身份证号</text>
  134. <view class="con-list">
  135. <input placeholder="请输入收款人身份证号" name="input" v-model="driverPayeeInfoList[0].payeeNumberCard"></input>
  136. </view>
  137. </view>
  138. <button type="default">添加账号</button>
  139. </view>
  140. <view class="margin-top">
  141. <view class="labels">上传附件</view>
  142. <button type="default" @click="travel">行驶证</button>
  143. <view style="width: 100px;margin: 0 auto;" v-if="travels != ''">
  144. <image v-bind:src = "travels" style="width: 100px;height: 100px;"></image>
  145. </view>
  146. <button type="default" @click="drive">驾驶证</button>
  147. <view style="width: 100px;margin: 0 auto;" v-if="drives != ''">
  148. <image v-bind:src = "drives" style="width: 100px;height: 100px;"></image>
  149. </view>
  150. <button type="default" @click="operate">道路运营证</button>
  151. <view style="width: 100px;margin: 0 auto;" v-if="operates != ''">
  152. <image v-bind:src = "operates" style="width: 100px;height: 100px;"></image>
  153. </view>
  154. <button type="default" @click="practice">从业资格证</button>
  155. <view style="width: 100px;margin: 0 auto;" v-if="practices != ''">
  156. <image v-bind:src = "practices" style="width: 100px;height: 100px;"></image>
  157. </view>
  158. </view>
  159. <view class="padding flex flex-direction">
  160. <button class="cu-btn bg-red margin-tb-sm lg" @click="commitEdit">修改</button>
  161. </view>
  162. </view>
  163. </view>
  164. </template>
  165. <script>
  166. import {
  167. mapState
  168. } from 'vuex';
  169. export default {
  170. data() {
  171. return {
  172. goods:{},
  173. ModelIndex:'高栏',
  174. Model:'',
  175. ModelType:["高栏","集装箱","自卸车"],
  176. carLong:'',
  177. carLongType:['13','9.6','8.2','8.7','11.7','12.5','13.7','15','16','17.5'],
  178. id:[],
  179. id1:"",
  180. id2:"",
  181. travels:"",
  182. drives:"",
  183. practices:"",
  184. operates:"",
  185. // bank1:"",
  186. // bank2:"",
  187. // bankid:[],
  188. sendText: '获取验证码',
  189. sendDisabled: false,
  190. sendText: '获取验证码',
  191. ModelIndex: '高栏',
  192. Model: '',
  193. ModelType: ["高栏", "集装箱", "自卸车"],
  194. carLong: '',
  195. carLongIndex:0,
  196. carLongType: ['13', '9.6', '8.2', '8.7', '11.7', '12.5', '13.7', '15', '16', '17.5'],
  197. driverCarInfoList: [],
  198. driverPayeeInfoList: [],
  199. DriverViewInfo: {
  200. driverCarInfoList: [],
  201. driverPayeeInfoList: [],
  202. },
  203. verifyCode:"",
  204. codestatus:false,
  205. customerPhone: '',
  206. addressUrl:[],
  207. }
  208. },
  209. computed: {
  210. ...mapState(['hasLogin','userInfo'])
  211. },
  212. onLoad(option){
  213. this.getList(option.id)
  214. },
  215. methods: {
  216. // phoneinput(e) {
  217. // if (e.detail.value.length == 11) {
  218. // this.codestatus = true
  219. // }
  220. // },
  221. getList(ids) {
  222. this.$api.doRequest('get', '/driverViewInfo/getDriver', {
  223. id: ids
  224. }, 'application/json;charset=UTF-8').then(res => {
  225. console.log("成功连接")
  226. this.procurementPlanInfos = res.data.data
  227. this.DriverViewInfo = res.data.data
  228. this.driverCarInfoList = this.DriverViewInfo.driverCarInfoList
  229. this.driverPayeeInfoList = this.DriverViewInfo.driverPayeeInfoList
  230. this.addressUrl =this.DriverViewInfo.addressUrl.split(",")
  231. console.log(this.driverPayeeInfoList,"dsfds")
  232. this.drivers = res.data.data
  233. if (this.drivers.cardAddressUrl != "") {
  234. this.id = this.drivers.cardAddressUrl.split(","),
  235. this.id1 = this.id[0]
  236. this.id2 = this.id[1]
  237. }
  238. if (this.drivers.addressUrl != "") {
  239. this.address = this.drivers.addressUrl.split(","),
  240. this.travels = this.address[0]
  241. this.drives = this.address[1]
  242. this.practices = this.address[2]
  243. this.operates = this.address[3]
  244. }
  245. })
  246. .catch(res => {
  247. uni.showToast({
  248. title: res.errmsg,
  249. icon: 'none',
  250. duration: 2000
  251. })
  252. });
  253. },
  254. commitEdit() {
  255. console.log(this.addressUrl,"数组")
  256. this.DriverViewInfo.addressUrl = this.addressUrl.toString()
  257. console.log(this.DriverViewInfo.addressUrl,"字符串")
  258. this.DriverViewInfo.driverCarInfoList = this.driverCarInfoList
  259. this.DriverViewInfo.driverPayeeInfoList = this.driverPayeeInfoList
  260. this.DriverViewInfo.commonId = this.userInfo.id
  261. this.DriverViewInfo.cardAddressUrl = this.id.toString()
  262. this.DriverViewInfo.pcFlag = 0
  263. this.DriverViewInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  264. console.log(this.DriverViewInfo,"司机对象")
  265. this.$api.doRequest('post', '/driverViewInfo/api/editInfo', this.DriverViewInfo).then(res => {
  266. }).catch(res => {
  267. uni.showToast({
  268. title: res.data.message,
  269. icon: 'none',
  270. duration: 2000
  271. })
  272. })
  273. },
  274. idUp(){
  275. var that = this
  276. wx.chooseImage({
  277. success: function(res) {
  278. wx.uploadFile({
  279. url: 'https://www.zthymaoyi.com/upload/admin',
  280. filePath: res.tempFilePaths[0],
  281. name: 'file',
  282. success(res) {
  283. var data = res.data
  284. var strToObj = JSON.parse(data)
  285. that.id[0] = strToObj.url
  286. that.id1 = strToObj.url
  287. }
  288. })
  289. }
  290. })
  291. },
  292. idLow(){
  293. var that = this
  294. wx.chooseImage({
  295. success: function(res) {
  296. wx.uploadFile({
  297. url: 'https://www.zthymaoyi.com/upload/admin',
  298. filePath: res.tempFilePaths[0],
  299. name: 'file',
  300. success(res) {
  301. var data = res.data
  302. var strToObj = JSON.parse(data)
  303. that.id[1] = strToObj.url
  304. that.id2 = strToObj.url
  305. }
  306. })
  307. }
  308. })
  309. },
  310. travel(){
  311. var that = this
  312. wx.chooseImage({
  313. success: function(res) {
  314. wx.uploadFile({
  315. url: 'https://www.zthymaoyi.com/upload/admin',
  316. filePath: res.tempFilePaths[0],
  317. name: 'file',
  318. success(res) {
  319. var data = res.data
  320. var strToObj = JSON.parse(data)
  321. that.travels = strToObj.url
  322. that.addressUrl[0] = strToObj.url
  323. console.log(that.addressUrl)
  324. }
  325. })
  326. }
  327. })
  328. },
  329. drive(){
  330. var that = this
  331. wx.chooseImage({
  332. success: function(res) {
  333. wx.uploadFile({
  334. url: 'https://www.zthymaoyi.com/upload/admin',
  335. filePath: res.tempFilePaths[0],
  336. name: 'file',
  337. success(res) {
  338. var data = res.data
  339. var strToObj = JSON.parse(data)
  340. that.drives = strToObj.url
  341. that.addressUrl[1] = strToObj.url
  342. console.log(that.addressUrl)
  343. }
  344. })
  345. }
  346. })
  347. },
  348. operate(){
  349. var that = this
  350. wx.chooseImage({
  351. success: function(res) {
  352. wx.uploadFile({
  353. url: 'https://www.zthymaoyi.com/upload/admin',
  354. filePath: res.tempFilePaths[0],
  355. name: 'file',
  356. success(res) {
  357. var data = res.data
  358. var strToObj = JSON.parse(data)
  359. that.operates = strToObj.url
  360. that.addressUrl[2] = strToObj.url
  361. console.log(that.addressUrl)
  362. }
  363. })
  364. }
  365. })
  366. },
  367. practice(){
  368. var that = this
  369. wx.chooseImage({
  370. success: function(res) {
  371. wx.uploadFile({
  372. url: 'https://www.zthymaoyi.com/upload/admin',
  373. filePath: res.tempFilePaths[0],
  374. name: 'file',
  375. success(res) {
  376. var data = res.data
  377. var strToObj = JSON.parse(data)
  378. that.practices = strToObj.url
  379. that.addressUrl[3] = strToObj.url
  380. console.log(that.addressUrl)
  381. }
  382. })
  383. }
  384. })
  385. },
  386. getcode() {
  387. var that = this
  388. console.log(that.DriverViewInfo.driverPhone)
  389. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(that.DriverViewInfo.driverPhone)) {
  390. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  391. customerPhone: that.DriverViewInfo.driverPhone
  392. }).then(res => {
  393. if (res.data.code == 200) {
  394. that.sendDisabled = true
  395. let sec = 60
  396. let interval = setInterval(() => {
  397. sec--;
  398. that.sendText = sec + 's后重发'
  399. if (sec <= 0) {
  400. that.sendDisabled = false
  401. that.sendText = "获取验证码"
  402. clearInterval(interval)
  403. }
  404. }, 1000)
  405. } else {
  406. uni.showToast({
  407. title: res.data.message,
  408. icon: 'none',
  409. duration: 2000
  410. })
  411. }
  412. })
  413. .catch(res => {
  414. uni.showToast({
  415. title: res.data.message,
  416. icon: 'none',
  417. duration: 2000
  418. })
  419. });
  420. } else {
  421. uni.showToast({
  422. title: '请输入正确的手机号',
  423. icon: 'none',
  424. duration: 2000
  425. })
  426. }
  427. },
  428. ModelChange(e) {
  429. this.ModelIndex = e.detail.value
  430. this.Model = this.ModelType[this.ModelIndex];
  431. this.driverCarInfoList.carModel = this.ModelType[this.ModelIndex];
  432. },
  433. carLongChange(e) {
  434. this.carLongIndex = e.detail.value
  435. this.carLong = this.carLongType[this.carLongIndex];
  436. },
  437. }
  438. }
  439. </script>
  440. <style>
  441. .center {
  442. padding: 10px 20px;
  443. }
  444. .labels{
  445. font-size: 16px;
  446. font-weight: 400;
  447. }
  448. .c-row {
  449. display: -webkit-box;
  450. display: -webkit-flex;
  451. display: flex;
  452. -webkit-box-align: center;
  453. -webkit-align-items: center;
  454. align-items: center;
  455. padding: 20rpx 30rpx;
  456. position: relative;
  457. }
  458. .con-list {
  459. -webkit-box-flex: 1;
  460. -webkit-flex: 1;
  461. flex: 1;
  462. display: -webkit-box;
  463. display: -webkit-flex;
  464. display: flex;
  465. -webkit-box-orient: vertical;
  466. -webkit-box-direction: normal;
  467. -webkit-flex-direction: column;
  468. flex-direction: column;
  469. color: #303133;
  470. line-height: 40rpx;
  471. text-align: right;
  472. padding-right: 20rpx;
  473. font-size: 14px;
  474. }
  475. .getcode {
  476. font-size: 14px;
  477. position: absolute;
  478. top: 50%;
  479. transform: translateY(-50%);
  480. color: #AFB3BF;
  481. background: #F5F6F9;
  482. height: 30px;
  483. line-height: 30px;
  484. }
  485. .getcode.active {
  486. border: none;
  487. }
  488. .uni-navigator{
  489. display:inline-block;
  490. color:#22C572;
  491. }
  492. .getcode.active {
  493. background: #22C572;
  494. color: #fff;
  495. }
  496. .labels {
  497. font-size: 16px;
  498. font-weight: 400;
  499. }
  500. .c-row {
  501. display: -webkit-box;
  502. display: -webkit-flex;
  503. display: flex;
  504. -webkit-box-align: center;
  505. -webkit-align-items: center;
  506. align-items: center;
  507. padding: 20rpx 30rpx;
  508. position: relative;
  509. }
  510. .con-list {
  511. -webkit-box-flex: 1;
  512. -webkit-flex: 1;
  513. flex: 1;
  514. display: -webkit-box;
  515. display: -webkit-flex;
  516. display: flex;
  517. -webkit-box-orient: vertical;
  518. -webkit-box-direction: normal;
  519. -webkit-flex-direction: column;
  520. flex-direction: column;
  521. color: #303133;
  522. line-height: 40rpx;
  523. text-align: right;
  524. padding-right: 20rpx;
  525. font-size: 14px;
  526. }
  527. .verificationCode {
  528. margin-top: 20px;
  529. background: #F5F6F9;
  530. color: #AFB3BF;
  531. }
  532. .verificationCode:after {
  533. border: none;
  534. }
  535. .verificationCode.active {
  536. background: #22C572;
  537. color: #fff;
  538. }
  539. .getcode {
  540. font-size: 14px;
  541. position: absolute;
  542. /* right:0; */
  543. top: 50%;
  544. transform: translateY(-50%);
  545. color: #AFB3BF;
  546. background: #F5F6F9;
  547. height: 30px;
  548. line-height: 30px;
  549. }
  550. .getcode:after {
  551. border: none;
  552. }
  553. .getcode.active {
  554. background: #22C572;
  555. color: #fff;
  556. }
  557. </style>