indexTwo.vue 14 KB

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