indexTwo.vue 14 KB

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