indexTwo.vue 14 KB

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