driverIdentity.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <view class="center">
  3. <view>
  4. <view style="margin: 0 auto;height: 240px;" v-if="id1 != ''" @click="idUp">
  5. <image v-bind:src="id1" class="picture"></image>
  6. <view class="floats" v-if="certificates == true">
  7. <image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;">
  8. </image>
  9. <view class="words">
  10. 上传身份证头像页
  11. </view>
  12. </view>
  13. </view>
  14. <view style="margin: 0 auto;height: 240px;" v-if="id2 != ''" @click="idLow">
  15. <image v-bind:src="id2" class="picture"></image>
  16. <view class="floats" v-if="certificatesTwo == true">
  17. <image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;">
  18. </image>
  19. <view class="words">
  20. 上传身份证国徽页
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="information">
  26. <view class="c-row b-b">
  27. <text class="tit">姓名</text>
  28. <view class="con-list">
  29. <input placeholder="请填写姓名" name="input" v-model="DriverViewInfo.driverName"></input>
  30. </view>
  31. </view>
  32. <view class="c-row b-b">
  33. <text class="tit">身份证号</text>
  34. <view class="con-list">
  35. <input placeholder="请填写身份证号" name="input" v-model="DriverViewInfo.numberCard"></input>
  36. </view>
  37. </view>
  38. <view class="c-row b-b">
  39. <text class="tit">手机号</text>
  40. <view class="con-list">
  41. <input placeholder="请填写手机号" maxlength = "11" name="input" v-model="DriverViewInfo.driverPhone"></input>
  42. </view>
  43. </view>
  44. <view style='width:100%;border-bottom:1px solid #E8E9ED;position:relative;padding:10px;' class="flex">
  45. <button :class='codestatus&&!sendDisabled?"active":""' @click='getcode'
  46. class='getcode'>{{sendText}}</button>
  47. <view style='width:70%;position:relative;margin-left: 200px;'>
  48. <view class="con-list">
  49. <!-- style='width:70%;position:relative;margin-left: 200px;' -->
  50. <input v-model='verifyCode' maxlength = "6" placeholder="请输入验证码" type="text">
  51. </view>
  52. </view>
  53. </view>
  54. <view class="c-row ">
  55. <text class="tit">常驻城市</text>
  56. <view class="con-list">
  57. <!-- <input placeholder="请填写常驻城市" name="input" v-model="DriverViewInfo.residentCityProvincial"></input> -->
  58. <view @click='regionchange'>{{region}}</view>
  59. <u-picker :params='params' @confirm='regionpicker' mode="region" v-model="show"></u-picker>
  60. </view>
  61. </view>
  62. </view>
  63. <button class="btns btn" @click="jumpUrl">下一步</button>
  64. </view>
  65. </template>
  66. <script>
  67. import {
  68. mapState
  69. } from 'vuex';
  70. export default {
  71. data() {
  72. return {
  73. goods: {},
  74. ModelIndex: '高栏',
  75. Model: '',
  76. ModelType: ["高栏", "集装箱", "自卸车"],
  77. carLong: '',
  78. carLongType: ['13', '9.6', '8.2', '8.7', '11.7', '12.5', '13.7', '15', '16', '17.5'],
  79. id: [],
  80. id1: "../../static/img/authentication/identityup(2).png",
  81. id2: "../../static/img/authentication/identitylow(2).png",
  82. travels: "",
  83. drives: "",
  84. practices: "",
  85. operates: "",
  86. sendText: '获取验证码',
  87. sendDisabled: false,
  88. ModelIndex: '高栏',
  89. Model: '',
  90. ModelType: ["高栏", "集装箱", "自卸车"],
  91. carLong: '',
  92. carLongIndex: 0,
  93. carLongType: ['13', '9.6', '8.2', '8.7', '11.7', '12.5', '13.7', '15', '16', '17.5'],
  94. driverCarInfoList: {},
  95. driverPayeeInfoList: {},
  96. DriverViewInfo: {
  97. },
  98. verifyCode: "",
  99. codestatus: false,
  100. customerPhone: '',
  101. addressUrl: [],
  102. personImgs:{},
  103. certificatesTwo:true,
  104. certificates:true,
  105. verification:true,
  106. region:"请选择常驻城市",
  107. show:false,
  108. params: {
  109. province: true,
  110. city: true,
  111. },
  112. }
  113. },
  114. computed: {
  115. ...mapState(['hasLogin', 'userInfo'])
  116. },
  117. methods: {
  118. // phoneinput(e) {
  119. // if (e.detail.value.length == 11) {
  120. // this.codestatus = true
  121. // }
  122. // },
  123. regionchange() {
  124. this.show = true
  125. },
  126. regionpicker(e) {
  127. // this.deptList.outputPrivate = e.province.label
  128. // this.deptList.outputCity = e.city.label
  129. this.region = e.province.label + '-' + e.city.label
  130. this.DriverViewInfo.residentCityProvincial = e.province.label + e.city.label
  131. },
  132. jumpUrl() {
  133. if (this.id[0] == "" || this.id[0] == null) {
  134. this.$api.msg('请上传身份证正面!')
  135. return
  136. }
  137. if (this.id[1] == "" || this.id[1] == null) {
  138. this.$api.msg('请上传身份证反面!')
  139. return
  140. }
  141. if (!this.DriverViewInfo.driverName) {
  142. this.$api.msg('姓名不能为空')
  143. return
  144. }
  145. if (this.DriverViewInfo.driverName.length < 2 || this.DriverViewInfo.driverName.length > 10) {
  146. this.$api.msg('姓名输入错误')
  147. return
  148. }
  149. if (!this.DriverViewInfo.numberCard) {
  150. this.$api.msg('身份证号不能为空')
  151. return
  152. }
  153. if (this.DriverViewInfo.numberCard.length != 18) {
  154. this.$api.msg('身份证号输入错误')
  155. return
  156. }
  157. if (!this.DriverViewInfo.driverPhone) {
  158. this.$api.msg('手机号不能为空')
  159. return
  160. }
  161. debugger
  162. if (this.DriverViewInfo.driverPhone.length != 11) {
  163. this.$api.msg('手机号输入错误')
  164. return
  165. }
  166. if(!this.verifyCode){
  167. this.$api.msg('验证码不能为空')
  168. return
  169. }
  170. if(this.verifyCode.length != 6){
  171. this.$api.msg('验证码输入错误')
  172. return
  173. }
  174. if (!this.DriverViewInfo.residentCityProvincial) {
  175. this.$api.msg('常住城市不能为空')
  176. return
  177. }
  178. this.amendprice()
  179. },
  180. async amendprice() {
  181. var that = this
  182. this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  183. phone: this.DriverViewInfo.driverPhone,
  184. verifyCode: this.verifyCode
  185. }).then(res => {
  186. if (res.data.code == 200) {
  187. that.DriverViewInfo.cardAddressUrl = that.id.toString()
  188. var model = JSON.stringify(that.DriverViewInfo);
  189. uni.navigateTo({
  190. url: `/pageD/identity/driverIdentityTwo?DriverViewInfo=` + model,
  191. })
  192. } else {
  193. uni.showToast({
  194. title: res.data.message,
  195. icon: 'none',
  196. duration: 2000
  197. })
  198. }
  199. })
  200. .catch(res => {
  201. uni.showToast({
  202. title: res.data.message,
  203. icon: 'none',
  204. duration: 2000
  205. })
  206. });
  207. },
  208. getcode() {
  209. var that = this
  210. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(that.DriverViewInfo.driverPhone)) {
  211. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  212. phone: that.DriverViewInfo.driverPhone
  213. }).then(res => {
  214. if (res.data.code == 200) {
  215. that.sendDisabled = true
  216. let sec = 60
  217. let interval = setInterval(() => {
  218. sec--;
  219. that.sendText = sec + 's后重发'
  220. if (sec <= 0) {
  221. that.sendDisabled = false
  222. that.sendText = "获取验证码"
  223. clearInterval(interval)
  224. }
  225. }, 1000)
  226. } else {
  227. uni.showToast({
  228. title: res.data.message,
  229. icon: 'none',
  230. duration: 2000
  231. })
  232. return
  233. }
  234. })
  235. .catch(res => {
  236. uni.showToast({
  237. title: res.data.message,
  238. icon: 'none',
  239. duration: 2000
  240. })
  241. return
  242. });
  243. } else {
  244. uni.showToast({
  245. title: '请输入正确的手机号',
  246. icon: 'none',
  247. duration: 2000
  248. })
  249. }
  250. },
  251. ModelChange(e) {
  252. this.ModelIndex = e.detail.value
  253. this.Model = this.ModelType[this.ModelIndex];
  254. this.driverCarInfoList.carModel = this.ModelType[this.ModelIndex];
  255. },
  256. carLongChange(e) {
  257. this.carLongIndex = e.detail.value
  258. this.carLong = this.carLongType[this.carLongIndex];
  259. },
  260. idUp() {
  261. var that = this
  262. wx.chooseImage({
  263. success: function(res) {
  264. wx.uploadFile({
  265. url: 'https://www.zthymaoyi.com/upload/admin',
  266. filePath: res.tempFilePaths[0],
  267. name: 'file',
  268. success(res) {
  269. var data = res.data
  270. var strToObj = JSON.parse(data)
  271. that.id[0] = strToObj.url
  272. that.id1 = strToObj.url
  273. that.certificates = false
  274. that.personImgs.personImg = that.id[0]
  275. that.$api.doRequest('get', '/driverViewInfo/personShibie', that.personImgs).then(res => {
  276. if(res.data.data.recPerson != null){
  277. if(res.data.data.recPerson != ""){
  278. that.$set(that.DriverViewInfo,'driverName',res.data.data.recPerson)
  279. }
  280. }
  281. if(res.data.data.recPersonNo != null){
  282. if(res.data.data.recPersonNo != ""){
  283. that.$set(that.DriverViewInfo,'numberCard',res.data.data.recPersonNo)
  284. }
  285. }
  286. }).catch(res => {
  287. uni.showToast({
  288. title: res.data.message,
  289. icon: 'none',
  290. duration: 2000
  291. })
  292. })
  293. }
  294. })
  295. }
  296. })
  297. },
  298. idLow() {
  299. var that = this
  300. wx.chooseImage({
  301. success: function(res) {
  302. wx.uploadFile({
  303. url: 'https://www.zthymaoyi.com/upload/admin',
  304. filePath: res.tempFilePaths[0],
  305. name: 'file',
  306. success(res) {
  307. var data = res.data
  308. var strToObj = JSON.parse(data)
  309. that.id[1] = strToObj.url
  310. that.id2 = strToObj.url
  311. that.certificatesTwo = false
  312. that.personImgs.personImg = that.id[1]
  313. that.$api.doRequest('get', '/driverViewInfo/personShibie', that.personImgs).then(res => {
  314. if(res.data.data.recPerson != null){
  315. if(res.data.data.recPerson != ""){
  316. that.$set(that.DriverViewInfo,'driverName',res.data.data.recPerson)
  317. }
  318. }
  319. if(res.data.data.recPersonNo != null){
  320. if(res.data.data.recPersonNo != ""){
  321. that.$set(that.DriverViewInfo,'numberCard',res.data.data.recPersonNo)
  322. }
  323. }
  324. }).catch(res => {
  325. uni.showToast({
  326. title: res.data.message,
  327. icon: 'none',
  328. duration: 2000
  329. })
  330. })
  331. }
  332. })
  333. }
  334. })
  335. },
  336. commit() {
  337. this.DriverViewInfo.addressUrl = this.addressUrl.toString()
  338. this.DriverViewInfo.driverCarInfoList = [this.driverCarInfoList]
  339. this.DriverViewInfo.driverPayeeInfoList = [this.driverPayeeInfoList]
  340. this.DriverViewInfo.commonId = this.userInfo.id
  341. this.DriverViewInfo.cardAddressUrl = this.id.toString()
  342. this.DriverViewInfo.pcFlag = 0
  343. this.DriverViewInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  344. this.$api.doRequest('post', '/driverViewInfo/api/addInfo', this.DriverViewInfo).then(res => {}).catch(
  345. res => {
  346. uni.showToast({
  347. title: res.data.message,
  348. icon: 'none',
  349. duration: 2000
  350. })
  351. })
  352. },
  353. }
  354. }
  355. </script>
  356. <style scoped>
  357. .center {
  358. padding: 10px 20px;
  359. background-color: #F5F6FA;
  360. }
  361. .labels {
  362. font-size: 16px;
  363. font-weight: 400;
  364. }
  365. .c-row {
  366. display: -webkit-box;
  367. display: -webkit-flex;
  368. display: flex;
  369. -webkit-box-align: center;
  370. -webkit-align-items: center;
  371. align-items: center;
  372. padding: 20rpx 30rpx;
  373. position: relative;
  374. }
  375. .con-list {
  376. -webkit-box-flex: 1;
  377. -webkit-flex: 1;
  378. flex: 1;
  379. display: -webkit-box;
  380. display: -webkit-flex;
  381. display: flex;
  382. -webkit-box-orient: vertical;
  383. -webkit-box-direction: normal;
  384. -webkit-flex-direction: column;
  385. flex-direction: column;
  386. color: #AFB3BF;
  387. line-height: 40rpx;
  388. text-align: right;
  389. padding-right: 20rpx;
  390. font-size: 14px;
  391. }
  392. .getcode {
  393. font-size: 14px;
  394. position: absolute;
  395. top: 50%;
  396. transform: translateY(-50%);
  397. color: #AFB3BF;
  398. background: #F5F6F9;
  399. height: 30px;
  400. line-height: 30px;
  401. }
  402. .getcode.active {
  403. border: none;
  404. }
  405. .uni-navigator {
  406. display: inline-block;
  407. color: #22C572;
  408. }
  409. .getcode.active {
  410. background: #22C572;
  411. color: #fff;
  412. }
  413. .labels {
  414. font-size: 16px;
  415. font-weight: 400;
  416. }
  417. .c-row {
  418. display: -webkit-box;
  419. display: -webkit-flex;
  420. display: flex;
  421. -webkit-box-align: center;
  422. -webkit-align-items: center;
  423. align-items: center;
  424. padding: 20rpx 30rpx;
  425. position: relative;
  426. }
  427. .con-list {
  428. -webkit-box-flex: 1;
  429. -webkit-flex: 1;
  430. flex: 1;
  431. display: -webkit-box;
  432. display: -webkit-flex;
  433. display: flex;
  434. -webkit-box-orient: vertical;
  435. -webkit-box-direction: normal;
  436. -webkit-flex-direction: column;
  437. flex-direction: column;
  438. color: #303133;
  439. line-height: 40rpx;
  440. text-align: right;
  441. padding-right: 20rpx;
  442. font-size: 14px;
  443. }
  444. .verificationCode {
  445. margin-top: 20px;
  446. background: #F5F6F9;
  447. color: #AFB3BF;
  448. }
  449. .verificationCode:after {
  450. border: none;
  451. }
  452. .verificationCode.active {
  453. background: #22C572;
  454. color: #fff;
  455. }
  456. .getcode {
  457. font-size: 14px;
  458. position: absolute;
  459. /* right:0; */
  460. top: 50%;
  461. transform: translateY(-50%);
  462. color: #AFB3BF;
  463. background: #F5F6F9;
  464. height: 30px;
  465. line-height: 30px;
  466. }
  467. .getcode:after {
  468. border: none;
  469. }
  470. .getcode.active {
  471. background: #22C572;
  472. color: #fff;
  473. }
  474. .picture {
  475. width: 100%;
  476. height: 220px;
  477. text-align: center;
  478. margin-top: 10px;
  479. }
  480. .tit {
  481. font-size: 14px;
  482. }
  483. .labels {
  484. margin: 5px 10px;
  485. }
  486. .information {
  487. margin-top: 10px;
  488. background-color: #FFFFFF;
  489. border-radius: 20px;
  490. }
  491. .btn {
  492. margin-top: 10px;
  493. background-color: #FFFFFF;
  494. border-radius: 25px;
  495. border: none;
  496. }
  497. /* //清除 */
  498. .eliminate {
  499. width: 20px;
  500. height: 20px;
  501. float: right;
  502. }
  503. /* 下一步 */
  504. .btn {
  505. margin-top: 10px;
  506. background-color: #FFFFFF;
  507. border-radius: 25px;
  508. border: none;
  509. }
  510. .btns {
  511. background-color: #22C572;
  512. }
  513. .words{
  514. font-size: 18px;
  515. font-weight: 600;
  516. color: #617E8B;
  517. }
  518. .floats{
  519. position: relative;
  520. top: -150px;
  521. text-align: center;
  522. }
  523. </style>