indexTwo.vue 16 KB

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