indexTwo.vue 16 KB

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