indexTwo.vue 17 KB

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