indexTwo.vue 14 KB

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