driverIdentity.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  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>
  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. }
  105. },
  106. computed: {
  107. ...mapState(['hasLogin', 'userInfo'])
  108. },
  109. methods: {
  110. // phoneinput(e) {
  111. // if (e.detail.value.length == 11) {
  112. // this.codestatus = true
  113. // }
  114. // },
  115. jumpUrl() {
  116. if (this.id[0] == "" || this.id[0] == null) {
  117. this.$api.msg('请上传身份证正面!')
  118. return
  119. }
  120. if (this.id[1] == "" || this.id[1] == null) {
  121. this.$api.msg('请上传身份证反面!')
  122. return
  123. }
  124. if (!this.DriverViewInfo.driverName) {
  125. this.$api.msg('姓名不能为空')
  126. return
  127. }
  128. if (!this.DriverViewInfo.numberCard) {
  129. this.$api.msg('身份证号不能为空')
  130. return
  131. }
  132. if (!this.DriverViewInfo.driverPhone) {
  133. this.$api.msg('手机号不能为空')
  134. return
  135. }
  136. if (!this.DriverViewInfo.residentCityProvincial) {
  137. this.$api.msg('常住城市不能为空')
  138. return
  139. }
  140. this.amendprice()
  141. if(this.verification == false){
  142. return
  143. }
  144. console.log(this.verification)
  145. this.DriverViewInfo.cardAddressUrl = this.id.toString()
  146. var model = JSON.stringify(this.DriverViewInfo);
  147. uni.navigateTo({
  148. url: `/pageD/identity/driverIdentityTwo?DriverViewInfo=` + model,
  149. })
  150. },
  151. amendprice() {
  152. var that = this
  153. this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  154. phone: this.DriverViewInfo.driverPhone,
  155. verifyCode: this.verifyCode
  156. }).then(res => {
  157. if (res.data.code == 200) {
  158. } else {
  159. that.verification = false
  160. console.log(that.verification,"1")
  161. uni.showToast({
  162. title: res.data.message,
  163. icon: 'none',
  164. duration: 2000
  165. })
  166. return false
  167. }
  168. })
  169. .catch(res => {
  170. that.verification = false
  171. console.log(that.verification,"2")
  172. uni.showToast({
  173. title: res.data.message,
  174. icon: 'none',
  175. duration: 2000
  176. })
  177. return false
  178. });
  179. },
  180. getcode() {
  181. var that = this
  182. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(that.DriverViewInfo.driverPhone)) {
  183. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  184. phone: that.DriverViewInfo.driverPhone
  185. }).then(res => {
  186. if (res.data.code == 200) {
  187. that.sendDisabled = true
  188. let sec = 60
  189. let interval = setInterval(() => {
  190. sec--;
  191. that.sendText = sec + 's后重发'
  192. if (sec <= 0) {
  193. that.sendDisabled = false
  194. that.sendText = "获取验证码"
  195. clearInterval(interval)
  196. }
  197. }, 1000)
  198. } else {
  199. uni.showToast({
  200. title: res.data.message,
  201. icon: 'none',
  202. duration: 2000
  203. })
  204. return
  205. }
  206. })
  207. .catch(res => {
  208. uni.showToast({
  209. title: res.data.message,
  210. icon: 'none',
  211. duration: 2000
  212. })
  213. return
  214. });
  215. } else {
  216. uni.showToast({
  217. title: '请输入正确的手机号',
  218. icon: 'none',
  219. duration: 2000
  220. })
  221. }
  222. },
  223. ModelChange(e) {
  224. this.ModelIndex = e.detail.value
  225. this.Model = this.ModelType[this.ModelIndex];
  226. this.driverCarInfoList.carModel = this.ModelType[this.ModelIndex];
  227. },
  228. carLongChange(e) {
  229. this.carLongIndex = e.detail.value
  230. this.carLong = this.carLongType[this.carLongIndex];
  231. },
  232. idUp() {
  233. var that = this
  234. wx.chooseImage({
  235. success: function(res) {
  236. wx.uploadFile({
  237. url: 'https://www.zthymaoyi.com/upload/admin',
  238. filePath: res.tempFilePaths[0],
  239. name: 'file',
  240. success(res) {
  241. var data = res.data
  242. var strToObj = JSON.parse(data)
  243. that.id[0] = strToObj.url
  244. that.id1 = strToObj.url
  245. that.certificates = false
  246. that.personImgs.personImg = that.id[0]
  247. that.$api.doRequest('get', '/driverViewInfo/personShibie', that.personImgs).then(res => {
  248. that.$set(that.DriverViewInfo,'driverName',res.data.data.recPerson)
  249. that.$set(that.DriverViewInfo,'numberCard',res.data.data.recPersonNo)
  250. }).catch(res => {
  251. uni.showToast({
  252. title: res.data.message,
  253. icon: 'none',
  254. duration: 2000
  255. })
  256. })
  257. }
  258. })
  259. }
  260. })
  261. },
  262. idLow() {
  263. var that = this
  264. wx.chooseImage({
  265. success: function(res) {
  266. wx.uploadFile({
  267. url: 'https://www.zthymaoyi.com/upload/admin',
  268. filePath: res.tempFilePaths[0],
  269. name: 'file',
  270. success(res) {
  271. var data = res.data
  272. var strToObj = JSON.parse(data)
  273. that.id[1] = strToObj.url
  274. that.id2 = strToObj.url
  275. that.certificatesTwo = false
  276. }
  277. })
  278. }
  279. })
  280. },
  281. commit() {
  282. this.DriverViewInfo.addressUrl = this.addressUrl.toString()
  283. this.DriverViewInfo.driverCarInfoList = [this.driverCarInfoList]
  284. this.DriverViewInfo.driverPayeeInfoList = [this.driverPayeeInfoList]
  285. this.DriverViewInfo.commonId = this.userInfo.id
  286. this.DriverViewInfo.cardAddressUrl = this.id.toString()
  287. this.DriverViewInfo.pcFlag = 0
  288. this.DriverViewInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  289. this.$api.doRequest('post', '/driverViewInfo/api/addInfo', this.DriverViewInfo).then(res => {}).catch(
  290. res => {
  291. uni.showToast({
  292. title: res.data.message,
  293. icon: 'none',
  294. duration: 2000
  295. })
  296. })
  297. },
  298. }
  299. }
  300. </script>
  301. <style scoped>
  302. .center {
  303. padding: 10px 20px;
  304. background-color: #F5F6FA;
  305. }
  306. .labels {
  307. font-size: 16px;
  308. font-weight: 400;
  309. }
  310. .c-row {
  311. display: -webkit-box;
  312. display: -webkit-flex;
  313. display: flex;
  314. -webkit-box-align: center;
  315. -webkit-align-items: center;
  316. align-items: center;
  317. padding: 20rpx 30rpx;
  318. position: relative;
  319. }
  320. .con-list {
  321. -webkit-box-flex: 1;
  322. -webkit-flex: 1;
  323. flex: 1;
  324. display: -webkit-box;
  325. display: -webkit-flex;
  326. display: flex;
  327. -webkit-box-orient: vertical;
  328. -webkit-box-direction: normal;
  329. -webkit-flex-direction: column;
  330. flex-direction: column;
  331. color: #AFB3BF;
  332. line-height: 40rpx;
  333. text-align: right;
  334. padding-right: 20rpx;
  335. font-size: 14px;
  336. }
  337. .getcode {
  338. font-size: 14px;
  339. position: absolute;
  340. top: 50%;
  341. transform: translateY(-50%);
  342. color: #AFB3BF;
  343. background: #F5F6F9;
  344. height: 30px;
  345. line-height: 30px;
  346. }
  347. .getcode.active {
  348. border: none;
  349. }
  350. .uni-navigator {
  351. display: inline-block;
  352. color: #22C572;
  353. }
  354. .getcode.active {
  355. background: #22C572;
  356. color: #fff;
  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: #303133;
  384. line-height: 40rpx;
  385. text-align: right;
  386. padding-right: 20rpx;
  387. font-size: 14px;
  388. }
  389. .verificationCode {
  390. margin-top: 20px;
  391. background: #F5F6F9;
  392. color: #AFB3BF;
  393. }
  394. .verificationCode:after {
  395. border: none;
  396. }
  397. .verificationCode.active {
  398. background: #22C572;
  399. color: #fff;
  400. }
  401. .getcode {
  402. font-size: 14px;
  403. position: absolute;
  404. /* right:0; */
  405. top: 50%;
  406. transform: translateY(-50%);
  407. color: #AFB3BF;
  408. background: #F5F6F9;
  409. height: 30px;
  410. line-height: 30px;
  411. }
  412. .getcode:after {
  413. border: none;
  414. }
  415. .getcode.active {
  416. background: #22C572;
  417. color: #fff;
  418. }
  419. .picture {
  420. width: 100%;
  421. height: 220px;
  422. text-align: center;
  423. margin-top: 10px;
  424. }
  425. .tit {
  426. font-size: 14px;
  427. }
  428. .labels {
  429. margin: 5px 10px;
  430. }
  431. .information {
  432. margin-top: 10px;
  433. background-color: #FFFFFF;
  434. border-radius: 20px;
  435. }
  436. .btn {
  437. margin-top: 10px;
  438. background-color: #FFFFFF;
  439. border-radius: 25px;
  440. border: none;
  441. }
  442. /* //清除 */
  443. .eliminate {
  444. width: 20px;
  445. height: 20px;
  446. float: right;
  447. }
  448. /* 下一步 */
  449. .btn {
  450. margin-top: 10px;
  451. background-color: #FFFFFF;
  452. border-radius: 25px;
  453. border: none;
  454. }
  455. .btns {
  456. background-color: #22C572;
  457. }
  458. .words{
  459. font-size: 18px;
  460. font-weight: 600;
  461. color: #617E8B;
  462. }
  463. .floats{
  464. position: relative;
  465. top: -150px;
  466. text-align: center;
  467. }
  468. </style>