indexThree.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <view class="center">
  3. <view v-for="(item , index) in drivers" :Key="index" class="forList">
  4. <view class='flex' @click="navToDetailPage(item)">
  5. <view class="logo">
  6. {{item.logo}}
  7. </view>
  8. <view class="company">{{item.driverName}}</view>
  9. <view class="status" v-if="item.cover == '1'">
  10. 已覆盖
  11. </view>
  12. <view v-else>
  13. <view class="status" v-if="item.authenticationStatus == '已认证'">
  14. <image src="../../static/img/authentication/cert-personal@3x.png"
  15. style="width: 16px;height: 16px;top:3px;"></image>
  16. {{item.authenticationStatus}}
  17. </view>
  18. <view class="status1" v-if="item.authenticationStatus == '审核中'">
  19. {{item.authenticationStatus}}
  20. </view>
  21. <view class="status2" v-if="item.authenticationStatus == '未通过'">
  22. {{item.authenticationStatus}}
  23. </view>
  24. <view class="status3" v-if="item.authenticationStatus == '已覆盖'">
  25. {{item.authenticationStatus}}
  26. </view>
  27. </view>
  28. </view>
  29. <view class="geren">{{item.driverPhone}}</view>
  30. <view class="flex options">
  31. <!-- <view class="yuan">
  32. <image src="../../static/img/authentication/selected(2).png"
  33. style="width: 16px;height: 16px;top: 3px;">设为默认</image>
  34. </view> -->
  35. <view class='but' v-if="item.authenticationStatus == '已覆盖'||item.authenticationStatus == '已认证'"
  36. @click="open(item)">更换手机号</view>
  37. <view class='but' v-if="item.authenticationStatus != '审核中'" @click="companyEdit(item)">修改</view>
  38. <view class='but' @click="deleteSJ(item)">删除</view>
  39. </view>
  40. <view v-if='pricestatus' class='shade'>
  41. <view class='shade-content'>
  42. <view class="titel">
  43. 更换手机号
  44. </view>
  45. <view class="cancel" @click='pricestatus=false'>×</view>
  46. <view class='shade-content-item'>
  47. <input v-model='price' placeholder="请输入手机号" maxlength="11" type="number" class="tainput">
  48. </view>
  49. <view class="bottom-btn">
  50. <!--<view style='width:50%;display:inline-block;' @click='pricestatus=false'>取消</view>
  51. <view style='width:50%;display:inline-block;' @click='amendprice'>确定</view> -->
  52. <view class="determine" @click="getcode">
  53. 获取验证码
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 填写验证码 -->
  59. <view v-if='pricestatusTwo' class='shade'>
  60. <view class='shade-content'>
  61. <view class="titel">
  62. 填写验证码
  63. </view>
  64. <text style="color:#AFB3BF;font-size: 14px;">验证码已发送至+86 {{price}}</text>
  65. <view class="cancel" @click='pricestatusTwo=false,pricestatus=false'>×</view>
  66. <view class='shade-content-item flex'>
  67. <input v-model='verifyCode' placeholder="填写验证码" type="number" class="tainput1" maxlength="6">
  68. <text style="color:#AFB3BF;font-size: 14px;" @click="resend()">{{sendText}}</text>
  69. </view>
  70. <view>
  71. <view class="flex">
  72. <text class="btns1 btn1" @click='pricestatusTwo=false'>取消</text>
  73. <view class="btns1 btn2" @click='amendprice(item)'>确定</view>
  74. </view>
  75. <!-- <view class="determine">
  76. 获取验证码
  77. </view> -->
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view v-if="drivers.length==0">
  83. <button class="btn btns" @click="Add">新增</button>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. import {
  89. mapState
  90. } from 'vuex';
  91. export default {
  92. name: "buy",
  93. data() {
  94. return {
  95. businessman: {},
  96. identityAuthenticationInfo: {},
  97. drivers: {},
  98. pricestatus: false,
  99. pricestatusTwo: false,
  100. price: "",
  101. verifyCode: "",
  102. sendText: "60s后重发",
  103. id: "",
  104. }
  105. },
  106. computed: {
  107. ...mapState(['hasLogin', 'userInfo'])
  108. },
  109. onShow() {
  110. this.getList()
  111. },
  112. onPullDownRefresh() {
  113. this.getList()
  114. setTimeout(function() {
  115. uni.stopPullDownRefresh();
  116. }, 1000);
  117. },
  118. methods: {
  119. resend() {
  120. price
  121. if (this.sendText == "获取验证码") {
  122. this.getcode()
  123. }
  124. },
  125. open(item) {
  126. this.id = item.id
  127. this.pricestatus = !this.pricestatus
  128. },
  129. Add() {
  130. uni.navigateTo({
  131. url: `/pageD/identity/driverIdentity`
  132. })
  133. },
  134. getList() {
  135. this.identityAuthenticationInfo.commonId = this.userInfo.id
  136. this.$api.doRequest('get', '/driverViewInfo/selectDriverInfoPage', {
  137. pageSize: 10,
  138. currentPage: 1,
  139. commonId: this.userInfo.id,
  140. pcFlag: 0
  141. }, 'application/json;charset=UTF-8').then(res => {
  142. console.log(res.data.data.records)
  143. for (var i = 0; i < res.data.data.records.length; i++) {
  144. res.data.data.records[i].logo = res.data.data.records[i].driverName.substr(0, 1)
  145. }
  146. this.drivers = res.data.data.records
  147. })
  148. .catch(res => {
  149. if (res.errmsg) {
  150. uni.showToast({
  151. title: res.errmsg,
  152. icon: 'none',
  153. duration: 2000
  154. })
  155. } else {
  156. uni.showToast({
  157. title: "系统异常,请联系管理员",
  158. icon: 'none',
  159. duration: 2000
  160. })
  161. }
  162. });
  163. },
  164. amendprice(item) {
  165. var that = this
  166. that.identityAuthenticationInfo.driverPhone = that.price
  167. this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  168. phone: this.price,
  169. verifyCode: this.verifyCode
  170. }).then(res => {
  171. if (res.data.code == 200) {
  172. that.$api.doRequest('get', '/driverViewInfo/selectPhone', that.identityAuthenticationInfo)
  173. .then(res => {
  174. if (res.data.code == '11018') {
  175. uni.showModal({
  176. title: '提示',
  177. content: '该手机号已认证过司机,再次认证将覆盖之前的认证信息,是否确定认证?',
  178. success: function(res) {
  179. if (res.confirm) {
  180. that.identityAuthenticationInfo.id = item.id
  181. that.$api.doRequest('post',
  182. '/driverViewInfo/api/modifyPhone', that
  183. .identityAuthenticationInfo).then(
  184. res => {
  185. uni.showToast({
  186. title: '提交成功',
  187. icon: 'none',
  188. duration: 2000
  189. })
  190. uni.navigateTo({
  191. url: `/pages/attestation/indexThree`,
  192. })
  193. }).catch(res => {
  194. uni.showToast({
  195. title: res.data.message,
  196. icon: 'none',
  197. duration: 2000
  198. })
  199. })
  200. } else if (res.cancel) {
  201. uni.showToast({
  202. title: '提交失败',
  203. icon: 'none',
  204. duration: 2000
  205. })
  206. }
  207. }
  208. });
  209. } else if (res.data.code == 200) {
  210. that.identityAuthenticationInfo.id = item.id
  211. that.$api.doRequest('post', '/driverViewInfo/api/modifyPhone', that
  212. .identityAuthenticationInfo).then(
  213. res => {
  214. uni.showToast({
  215. title: '提交成功',
  216. icon: 'none',
  217. duration: 2000
  218. })
  219. uni.navigateTo({
  220. url: `/pages/attestation/indexThree`,
  221. })
  222. }).catch(res => {
  223. uni.showToast({
  224. title: res.data.message,
  225. icon: 'none',
  226. duration: 2000
  227. })
  228. })
  229. }
  230. }).catch(res => {
  231. uni.showToast({
  232. title: res.data.message,
  233. icon: 'none',
  234. duration: 2000
  235. })
  236. })
  237. }
  238. })
  239. },
  240. getcode() {
  241. if (!this.price) {
  242. uni.showToast({
  243. title: '请填写手机号!',
  244. icon: 'none',
  245. duration: 2000
  246. })
  247. return
  248. }
  249. if (this.price.length != 11) {
  250. uni.showToast({
  251. title: '请正确填写手机号!',
  252. icon: 'none',
  253. duration: 2000
  254. })
  255. return
  256. }
  257. this.pricestatusTwo = true
  258. var that = this
  259. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.price)) {
  260. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  261. phone: this.price
  262. }).then(res => {
  263. if (res.data.code == 200) {
  264. that.sendDisabled = true
  265. let sec = 60
  266. let interval = setInterval(() => {
  267. sec--;
  268. that.sendText = sec + 's后重发'
  269. if (sec <= 0) {
  270. that.sendDisabled = false
  271. that.sendText = "获取验证码"
  272. clearInterval(interval)
  273. }
  274. }, 1000)
  275. } else {
  276. uni.showToast({
  277. title: res.data.message,
  278. icon: 'none',
  279. duration: 2000
  280. })
  281. }
  282. })
  283. .catch(res => {
  284. uni.showToast({
  285. title: res.data.message,
  286. icon: 'none',
  287. duration: 2000
  288. })
  289. });
  290. } else {
  291. uni.showToast({
  292. title: '请输入正确的手机号',
  293. icon: 'none',
  294. duration: 2000
  295. })
  296. }
  297. },
  298. navToDetailPage(item) {
  299. uni.navigateTo({
  300. url: `/pageD/identity/driverIdentityLook?id=${item.id}`
  301. })
  302. },
  303. deleteSJ(item) {
  304. this.deletes = {}
  305. this.deletes.id = item.id
  306. uni.showModal({
  307. content: '身份信息删除后不可恢复,是否确定删除?',
  308. showCancel: true,
  309. confirmText: '确定',
  310. success: (e) => {
  311. if (e.confirm) {
  312. this.$api.doRequest('post', '/driverViewInfo/api/deleteDriver', this.deletes,
  313. 'application/json;charset=UTF-8').then(res => {
  314. if (res.data.code == 200) {
  315. this.$api.msg('删除成功!')
  316. this.getList()
  317. return
  318. }
  319. })
  320. .catch(res => {
  321. if (res.errmsg) {
  322. uni.showToast({
  323. title: res.errmsg,
  324. icon: 'none',
  325. duration: 2000
  326. })
  327. } else {
  328. uni.showToast({
  329. title: "系统异常,请联系管理员",
  330. icon: 'none',
  331. duration: 2000
  332. })
  333. }
  334. });
  335. }
  336. },
  337. fail: () => {},
  338. complete: () => {}
  339. })
  340. },
  341. companyEdit(item) {
  342. uni.navigateTo({
  343. url: `/pageD/identity/driverIdentityEdit?id=${item.id}`
  344. })
  345. },
  346. }
  347. }
  348. </script>
  349. <style>
  350. .center {
  351. padding: 10px 20px;
  352. background-color: #F5F6FA;
  353. }
  354. .title {
  355. font-size: 22px;
  356. font-weight: 900;
  357. /* margin-top: 30px; */
  358. top: 50px;
  359. left: 24px;
  360. position: relative;
  361. }
  362. .company {
  363. font-size: 16px;
  364. font-weight: 600;
  365. margin-top: 10px;
  366. display: inline-block;
  367. margin-left: 10px;
  368. }
  369. .geren {
  370. color: #AFB3BF;
  371. font-size: 14px;
  372. margin-top: -10px;
  373. margin-left: 45px;
  374. margin-bottom: 20px;
  375. }
  376. .infos {
  377. width: 100%;
  378. display: inline-table;
  379. }
  380. .info {
  381. line-height: 20px;
  382. }
  383. /* .but {
  384. border: 1px solid #CDCDCD;
  385. border-radius: 10px;
  386. } */
  387. .homePage {
  388. width: 101%;
  389. height: 200px;
  390. margin: 20px auto;
  391. }
  392. .logo {
  393. width: 35px;
  394. height: 35px;
  395. background-color: #FEECE6;
  396. color: #FE6430;
  397. font-weight: 600;
  398. font-size: 16px;
  399. text-align: center;
  400. line-height: 35px;
  401. padding: 0 3px;
  402. border-radius: 6px;
  403. display: inline-block;
  404. margin-top: 10px;
  405. }
  406. .forList {
  407. background: #FFFFFF;
  408. margin-top: 10px;
  409. padding: 10px 10px;
  410. border-radius: 16px;
  411. }
  412. .status {
  413. position: absolute;
  414. margin-top: 10px;
  415. right: 36px;
  416. color: #22C572;
  417. }
  418. .status1 {
  419. position: absolute;
  420. margin-top: 10px;
  421. right: 36px;
  422. color: #FE6430;
  423. }
  424. .status2 {
  425. position: absolute;
  426. margin-top: 10px;
  427. right: 36px;
  428. color: #FB1E1E;
  429. }
  430. .status3 {
  431. position: absolute;
  432. margin-top: 10px;
  433. right: 36px;
  434. color: #AFB3BF;
  435. }
  436. .btn {
  437. margin-top: 10px;
  438. background-color: #FFFFFF;
  439. border-radius: 25px;
  440. border: none;
  441. }
  442. .btns {
  443. background-color: #22C572;
  444. color: white;
  445. }
  446. .but {
  447. border: 1px solid #CDCDCD;
  448. border-radius: 20px;
  449. padding: 15rpx 30rpx;
  450. text-align: center;
  451. margin-left: 20px;
  452. font-size: 14px;
  453. font-weight: 500;
  454. }
  455. .yuan {
  456. margin-top: 6px;
  457. font-size: 14px;
  458. font-weight: 500;
  459. }
  460. .shade-content {
  461. background: #fff;
  462. position: absolute;
  463. top: 50%;
  464. left: 50%;
  465. transform: translateX(-50%) translateY(-50%);
  466. z-index: 999999;
  467. text-align: center;
  468. border-radius: 20px;
  469. }
  470. .shade-content-item {
  471. width: 277px;
  472. text-align: center;
  473. height: 160rpx;
  474. padding: 35px 10px;
  475. }
  476. .shade {
  477. position: fixed;
  478. top: 0;
  479. left: 0;
  480. width: 100%;
  481. background: rgba(0, 0, 0, 0.1);
  482. height: 100%;
  483. z-index: 2;
  484. }
  485. .titel {
  486. font-size: 18px;
  487. font-weight: 600;
  488. margin-top: 20px;
  489. }
  490. .bottom-btn {
  491. display: flex;
  492. justify-content: center;
  493. margin-bottom: 50rpx;
  494. }
  495. .determine {
  496. width: 50%;
  497. background-color: #22C572;
  498. color: #FFFFFF;
  499. border-radius: 10px;
  500. padding: 15rpx 18rpx;
  501. }
  502. .tainput {
  503. width: 90%;
  504. padding-bottom: 15rpx;
  505. margin: 0 auto;
  506. text-align: left;
  507. border-bottom: 1px solid #AFB3BF;
  508. border-radius: 3px;
  509. }
  510. .cancel {
  511. width: 20px;
  512. height: 20px;
  513. font-size: 20px;
  514. color: #8890B1;
  515. float: right;
  516. margin-right: 20px;
  517. margin-top: -25px;
  518. }
  519. .btns1 {
  520. width: 50%;
  521. font-size: 18px;
  522. line-height: 50px;
  523. text-align: center;
  524. border-top: 1px solid #EEEEEE;
  525. margin-top: -26px;
  526. }
  527. .btn1 {
  528. border-right: 1px solid #EEEEEE;
  529. color: #AFB3BF;
  530. }
  531. .btn2 {
  532. color: #22C572;
  533. }
  534. .tainput1 {
  535. width: 70%;
  536. padding-left: 10px;
  537. margin: 0 auto;
  538. text-align: left;
  539. border-radius: 3px;
  540. }
  541. .options {
  542. justify-content: flex-end;
  543. }
  544. </style>