indexTwo.vue 15 KB

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