driverIdentity.vue 13 KB

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