indexTwo.vue 16 KB

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