driverIdentity.vue 13 KB

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