indexTwo.vue 13 KB

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