driverIdentity.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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="请填写手机号" 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' 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. if (!this.DriverViewInfo.residentCityProvincial) {
  162. this.$api.msg('常住城市不能为空')
  163. return
  164. }
  165. if(this.amendprice() == false){
  166. this.$api.msg('验证码输入有误!')
  167. return
  168. }
  169. this.DriverViewInfo.cardAddressUrl = this.id.toString()
  170. var model = JSON.stringify(this.DriverViewInfo);
  171. uni.navigateTo({
  172. url: `/pageD/identity/driverIdentityTwo?DriverViewInfo=` + model,
  173. })
  174. },
  175. async amendprice() {
  176. var that = this
  177. this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  178. phone: this.DriverViewInfo.driverPhone,
  179. verifyCode: this.verifyCode
  180. }).then(res => {
  181. if (res.data.code == 200) {
  182. } else {
  183. that.verification = false
  184. console.log(that.verification,"1")
  185. uni.showToast({
  186. title: res.data.message,
  187. icon: 'none',
  188. duration: 2000
  189. })
  190. return false
  191. }
  192. })
  193. .catch(res => {
  194. that.verification = false
  195. console.log(that.verification,"2")
  196. uni.showToast({
  197. title: res.data.message,
  198. icon: 'none',
  199. duration: 2000
  200. })
  201. return false
  202. });
  203. },
  204. getcode() {
  205. var that = this
  206. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(that.DriverViewInfo.driverPhone)) {
  207. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  208. phone: that.DriverViewInfo.driverPhone
  209. }).then(res => {
  210. if (res.data.code == 200) {
  211. that.sendDisabled = true
  212. let sec = 60
  213. let interval = setInterval(() => {
  214. sec--;
  215. that.sendText = sec + 's后重发'
  216. if (sec <= 0) {
  217. that.sendDisabled = false
  218. that.sendText = "获取验证码"
  219. clearInterval(interval)
  220. }
  221. }, 1000)
  222. } else {
  223. uni.showToast({
  224. title: res.data.message,
  225. icon: 'none',
  226. duration: 2000
  227. })
  228. return
  229. }
  230. })
  231. .catch(res => {
  232. uni.showToast({
  233. title: res.data.message,
  234. icon: 'none',
  235. duration: 2000
  236. })
  237. return
  238. });
  239. } else {
  240. uni.showToast({
  241. title: '请输入正确的手机号',
  242. icon: 'none',
  243. duration: 2000
  244. })
  245. }
  246. },
  247. ModelChange(e) {
  248. this.ModelIndex = e.detail.value
  249. this.Model = this.ModelType[this.ModelIndex];
  250. this.driverCarInfoList.carModel = this.ModelType[this.ModelIndex];
  251. },
  252. carLongChange(e) {
  253. this.carLongIndex = e.detail.value
  254. this.carLong = this.carLongType[this.carLongIndex];
  255. },
  256. idUp() {
  257. var that = this
  258. wx.chooseImage({
  259. success: function(res) {
  260. wx.uploadFile({
  261. url: 'https://www.zthymaoyi.com/upload/admin',
  262. filePath: res.tempFilePaths[0],
  263. name: 'file',
  264. success(res) {
  265. var data = res.data
  266. var strToObj = JSON.parse(data)
  267. that.id[0] = strToObj.url
  268. that.id1 = strToObj.url
  269. that.certificates = false
  270. that.personImgs.personImg = that.id[0]
  271. that.$api.doRequest('get', '/driverViewInfo/personShibie', that.personImgs).then(res => {
  272. if(res.data.data.recPerson != null){
  273. if(res.data.data.recPerson != ""){
  274. that.$set(that.DriverViewInfo,'driverName',res.data.data.recPerson)
  275. }
  276. }
  277. if(res.data.data.recPersonNo != null){
  278. if(res.data.data.recPersonNo != ""){
  279. that.$set(that.DriverViewInfo,'numberCard',res.data.data.recPersonNo)
  280. }
  281. }
  282. }).catch(res => {
  283. uni.showToast({
  284. title: res.data.message,
  285. icon: 'none',
  286. duration: 2000
  287. })
  288. })
  289. }
  290. })
  291. }
  292. })
  293. },
  294. idLow() {
  295. var that = this
  296. wx.chooseImage({
  297. success: function(res) {
  298. wx.uploadFile({
  299. url: 'https://www.zthymaoyi.com/upload/admin',
  300. filePath: res.tempFilePaths[0],
  301. name: 'file',
  302. success(res) {
  303. var data = res.data
  304. var strToObj = JSON.parse(data)
  305. that.id[1] = strToObj.url
  306. that.id2 = strToObj.url
  307. that.certificatesTwo = false
  308. that.personImgs.personImg = that.id[1]
  309. that.$api.doRequest('get', '/driverViewInfo/personShibie', that.personImgs).then(res => {
  310. if(res.data.data.recPerson != null){
  311. if(res.data.data.recPerson != ""){
  312. that.$set(that.DriverViewInfo,'driverName',res.data.data.recPerson)
  313. }
  314. }
  315. if(res.data.data.recPersonNo != null){
  316. if(res.data.data.recPersonNo != ""){
  317. that.$set(that.DriverViewInfo,'numberCard',res.data.data.recPersonNo)
  318. }
  319. }
  320. }).catch(res => {
  321. uni.showToast({
  322. title: res.data.message,
  323. icon: 'none',
  324. duration: 2000
  325. })
  326. })
  327. }
  328. })
  329. }
  330. })
  331. },
  332. commit() {
  333. this.DriverViewInfo.addressUrl = this.addressUrl.toString()
  334. this.DriverViewInfo.driverCarInfoList = [this.driverCarInfoList]
  335. this.DriverViewInfo.driverPayeeInfoList = [this.driverPayeeInfoList]
  336. this.DriverViewInfo.commonId = this.userInfo.id
  337. this.DriverViewInfo.cardAddressUrl = this.id.toString()
  338. this.DriverViewInfo.pcFlag = 0
  339. this.DriverViewInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  340. this.$api.doRequest('post', '/driverViewInfo/api/addInfo', this.DriverViewInfo).then(res => {}).catch(
  341. res => {
  342. uni.showToast({
  343. title: res.data.message,
  344. icon: 'none',
  345. duration: 2000
  346. })
  347. })
  348. },
  349. }
  350. }
  351. </script>
  352. <style scoped>
  353. .center {
  354. padding: 10px 20px;
  355. background-color: #F5F6FA;
  356. }
  357. .labels {
  358. font-size: 16px;
  359. font-weight: 400;
  360. }
  361. .c-row {
  362. display: -webkit-box;
  363. display: -webkit-flex;
  364. display: flex;
  365. -webkit-box-align: center;
  366. -webkit-align-items: center;
  367. align-items: center;
  368. padding: 20rpx 30rpx;
  369. position: relative;
  370. }
  371. .con-list {
  372. -webkit-box-flex: 1;
  373. -webkit-flex: 1;
  374. flex: 1;
  375. display: -webkit-box;
  376. display: -webkit-flex;
  377. display: flex;
  378. -webkit-box-orient: vertical;
  379. -webkit-box-direction: normal;
  380. -webkit-flex-direction: column;
  381. flex-direction: column;
  382. color: #AFB3BF;
  383. line-height: 40rpx;
  384. text-align: right;
  385. padding-right: 20rpx;
  386. font-size: 14px;
  387. }
  388. .getcode {
  389. font-size: 14px;
  390. position: absolute;
  391. top: 50%;
  392. transform: translateY(-50%);
  393. color: #AFB3BF;
  394. background: #F5F6F9;
  395. height: 30px;
  396. line-height: 30px;
  397. }
  398. .getcode.active {
  399. border: none;
  400. }
  401. .uni-navigator {
  402. display: inline-block;
  403. color: #22C572;
  404. }
  405. .getcode.active {
  406. background: #22C572;
  407. color: #fff;
  408. }
  409. .labels {
  410. font-size: 16px;
  411. font-weight: 400;
  412. }
  413. .c-row {
  414. display: -webkit-box;
  415. display: -webkit-flex;
  416. display: flex;
  417. -webkit-box-align: center;
  418. -webkit-align-items: center;
  419. align-items: center;
  420. padding: 20rpx 30rpx;
  421. position: relative;
  422. }
  423. .con-list {
  424. -webkit-box-flex: 1;
  425. -webkit-flex: 1;
  426. flex: 1;
  427. display: -webkit-box;
  428. display: -webkit-flex;
  429. display: flex;
  430. -webkit-box-orient: vertical;
  431. -webkit-box-direction: normal;
  432. -webkit-flex-direction: column;
  433. flex-direction: column;
  434. color: #303133;
  435. line-height: 40rpx;
  436. text-align: right;
  437. padding-right: 20rpx;
  438. font-size: 14px;
  439. }
  440. .verificationCode {
  441. margin-top: 20px;
  442. background: #F5F6F9;
  443. color: #AFB3BF;
  444. }
  445. .verificationCode:after {
  446. border: none;
  447. }
  448. .verificationCode.active {
  449. background: #22C572;
  450. color: #fff;
  451. }
  452. .getcode {
  453. font-size: 14px;
  454. position: absolute;
  455. /* right:0; */
  456. top: 50%;
  457. transform: translateY(-50%);
  458. color: #AFB3BF;
  459. background: #F5F6F9;
  460. height: 30px;
  461. line-height: 30px;
  462. }
  463. .getcode:after {
  464. border: none;
  465. }
  466. .getcode.active {
  467. background: #22C572;
  468. color: #fff;
  469. }
  470. .picture {
  471. width: 100%;
  472. height: 220px;
  473. text-align: center;
  474. margin-top: 10px;
  475. }
  476. .tit {
  477. font-size: 14px;
  478. }
  479. .labels {
  480. margin: 5px 10px;
  481. }
  482. .information {
  483. margin-top: 10px;
  484. background-color: #FFFFFF;
  485. border-radius: 20px;
  486. }
  487. .btn {
  488. margin-top: 10px;
  489. background-color: #FFFFFF;
  490. border-radius: 25px;
  491. border: none;
  492. }
  493. /* //清除 */
  494. .eliminate {
  495. width: 20px;
  496. height: 20px;
  497. float: right;
  498. }
  499. /* 下一步 */
  500. .btn {
  501. margin-top: 10px;
  502. background-color: #FFFFFF;
  503. border-radius: 25px;
  504. border: none;
  505. }
  506. .btns {
  507. background-color: #22C572;
  508. }
  509. .words{
  510. font-size: 18px;
  511. font-weight: 600;
  512. color: #617E8B;
  513. }
  514. .floats{
  515. position: relative;
  516. top: -150px;
  517. text-align: center;
  518. }
  519. </style>