indexTwo.vue 16 KB

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