driverIdentity.vue 13 KB

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