indexTwo.vue 17 KB

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