my.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. <template>
  2. <view class="my">
  3. <view class="login">
  4. <view class="head" v-if="isLogin">
  5. <view class="img">
  6. <image :src="info.cIcon" alt=""></image>
  7. </view>
  8. <view class="login_title">{{info.cNickName}}</view>
  9. </view>
  10. <view class="head" v-else>
  11. <view class="img" @click="login">
  12. <image
  13. src="https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132"
  14. alt=""></image>
  15. </view>
  16. <view class="login_title" @click="login">
  17. 去登录
  18. </view>
  19. </view>
  20. <view class="balance">
  21. <view class="money_box">
  22. <view class="title">
  23. 账户余额
  24. </view>
  25. <text>¥</text>
  26. {{dBalance}}
  27. </view>
  28. <view class="btn_box">
  29. <view class="btn" @click="goPay">
  30. 去充值
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="account">
  36. <view class="other">
  37. <view class="option" @click="gocollect">
  38. <view class="left">
  39. <image src="../../static/other/collect.png" mode=""></image>
  40. </view>
  41. <view class="right">
  42. <view class="top">
  43. 我的收藏
  44. </view>
  45. <view class="bottom">
  46. <text>
  47. {{collectNum}}
  48. </text>人
  49. </view>
  50. </view>
  51. </view>
  52. <view class="option" @click="goCoupon">
  53. <view class="left">
  54. <image src="../../static/other/coupon.png" mode=""></image>
  55. </view>
  56. <view class="right">
  57. <view class="top">
  58. 我的优惠券
  59. </view>
  60. <view class="bottom">
  61. <text>
  62. {{couponNum}}
  63. </text>张
  64. </view>
  65. </view>
  66. </view>
  67. <!-- <view class="option" @click="goCoupon">
  68. 我的优惠券
  69. <text>
  70. {{couponNum}}
  71. </text>张
  72. </view> -->
  73. </view>
  74. </view>
  75. <view class="feature">
  76. <view class="title">
  77. 通用功能
  78. </view>
  79. <view class="box">
  80. <view class="item" @click="goremamber">
  81. <image src="../../static/other/address.png" alt=""></image>
  82. <view>地址管理</view>
  83. </view>
  84. <view class="item" @click="goTeamwork">
  85. <image src="../../static/other/feedback.png" alt=""></image>
  86. <view>招商合作</view>
  87. </view>
  88. <!-- <view class="item" @click="goEngineer" v-if="check == 0 || check == 2 || check == -1"> -->
  89. <view class="item" @click="goEngineer">
  90. <image src="../../static/other/home.png" alt=""></image>
  91. <view>商户入驻</view>
  92. </view>
  93. <view class="item" @click="goEngineerCenter">
  94. <image src="../../static/other/personal.png" alt=""></image>
  95. <view>商户中心</view>
  96. </view>
  97. <view class="item" @click="goComplaint">
  98. <image src="../../static/other/complain.png" alt=""></image>
  99. <view>投诉举报</view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="popup">
  104. <u-mask :show="show" @click="show = false">
  105. <view class="refuse">
  106. <view class="title">
  107. 退回提示
  108. </view>
  109. <view class="content">
  110. {{reasonRefusal}}
  111. </view>
  112. <view class="btn_box" @click="show = false">
  113. <view class="btn">
  114. 取消
  115. </view>
  116. <view class="btn success" @click="update">
  117. 去修改
  118. </view>
  119. </view>
  120. </view>
  121. </u-mask>
  122. </view>
  123. </view>
  124. </template>
  125. <script>
  126. import {
  127. wxGetCode
  128. } from '../../api/my'
  129. import {
  130. getInfo,
  131. engineDetail,
  132. getCoupon,
  133. getwxQrCode,
  134. getCollect,
  135. logout
  136. } from '../../api/index.js'
  137. // import { wxLogin } from 'uni-login';
  138. export default {
  139. data() {
  140. return {
  141. show: false,
  142. info: [],
  143. check: -1,
  144. data: '',
  145. dBalance: 0,
  146. txShow: false,
  147. couponNum: 0, //优惠券数量
  148. isQrcodeShow: false,
  149. qrcodeImage: '',
  150. urlView: '',
  151. qqUrl: '',
  152. cnickName: '',
  153. wx_copenid: '', //微信返回openid
  154. token: '', //登录成功token
  155. isLogin: false,
  156. collectNum: 0,
  157. reasonRefusal: ''
  158. }
  159. },
  160. methods: {
  161. goTeamwork() {
  162. if (!this.isLogin) {
  163. uni.showToast({
  164. title: '请登录',
  165. icon: 'none'
  166. })
  167. return
  168. } else {
  169. uni.navigateTo({
  170. url: '../join/teamwork'
  171. })
  172. }
  173. },
  174. goComplaint() {
  175. if (!this.isLogin) {
  176. uni.showToast({
  177. title: '请登录',
  178. icon: 'none'
  179. })
  180. return
  181. } else {
  182. uni.navigateTo({
  183. url: '../join/feedback'
  184. })
  185. }
  186. },
  187. //获取收藏列表
  188. getcollectList() {
  189. var data = {
  190. cWxOpenId: uni.getStorageSync('wx_copenid')
  191. }
  192. getCollect(data).then(res => {
  193. if (res.data.code == 200) {
  194. this.collectNum = res.data.data.length
  195. // this.list = res.data.data
  196. }
  197. })
  198. },
  199. goWithdraw() {
  200. uni.navigateTo({
  201. url: './withdraw'
  202. })
  203. },
  204. goFeedBack() {
  205. },
  206. // },
  207. qrCodeShow() {
  208. this.isQrcodeShow = !this.isQrcodeShow
  209. },
  210. getwxQrCode() {
  211. var openId = {
  212. openId: uni.getStorageSync('wx_copenid')
  213. }
  214. getwxQrCode(openId).then(res => {
  215. let TICKET = res.data.ticket
  216. this.urlView = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' + TICKET
  217. })
  218. },
  219. //跳转至优惠券页
  220. goCoupon() {
  221. if (!this.isLogin) {
  222. uni.showToast({
  223. title: '请登录',
  224. icon: 'none'
  225. })
  226. return
  227. } else {
  228. uni.navigateTo({
  229. url: './coupon'
  230. })
  231. }
  232. },
  233. //跳转至商户中心页
  234. goEngineerCenter() {
  235. if (!this.isLogin) {
  236. uni.showToast({
  237. title: '请登录',
  238. icon: 'none'
  239. })
  240. return
  241. } else {
  242. uni.navigateTo({
  243. url: './engineerCenter'
  244. })
  245. }
  246. },
  247. //商户入驻
  248. goEngineer() {
  249. if (!this.isLogin) {
  250. uni.showToast({
  251. title: '请登录',
  252. icon: 'none'
  253. })
  254. return
  255. } else {
  256. if (this.check == 0 || this.check == 2 || this.check == 3) {
  257. uni.showToast({
  258. title: '正在审核中',
  259. icon: 'none'
  260. })
  261. return
  262. } else if (this.check == 1) {
  263. uni.showToast({
  264. title: '审核已通过',
  265. icon: 'none'
  266. })
  267. return
  268. } else {
  269. uni.navigateTo({
  270. url: '/pages/join/first_join'
  271. })
  272. }
  273. }
  274. },
  275. update() {
  276. uni.navigateTo({
  277. url: './indent?title=编辑资料'
  278. })
  279. },
  280. //跳转至充值
  281. goPay() {
  282. if (!this.isLogin) {
  283. uni.showToast({
  284. title: '请登录',
  285. icon: 'none'
  286. })
  287. return
  288. } else {
  289. uni.navigateTo({
  290. url: '../my/pay'
  291. })
  292. }
  293. },
  294. //跳转至我的收藏
  295. gocollect() {
  296. if (!this.isLogin) {
  297. uni.showToast({
  298. title: '请登录',
  299. icon: 'none'
  300. })
  301. return
  302. } else {
  303. uni.navigateTo({
  304. url: './collect'
  305. })
  306. }
  307. },
  308. login() {
  309. uni.navigateTo({
  310. url: '../login/wxLogin'
  311. })
  312. },
  313. goremamber() {
  314. if (!this.isLogin) {
  315. uni.showToast({
  316. title: '请登录',
  317. icon: 'none'
  318. })
  319. return
  320. } else {
  321. uni.navigateTo({
  322. url: './remember'
  323. })
  324. }
  325. },
  326. myCoupon() {
  327. var openId = {
  328. openid: uni.getStorageSync('wx_copenid')
  329. }
  330. getCoupon(openId).then(res => {
  331. if (res.data.data.length > 0) {
  332. this.couponNum = res.data.data.length
  333. } else {
  334. this.couponNum = 0
  335. }
  336. })
  337. },
  338. getinfo() {
  339. getInfo().then(res => {
  340. if (res.data.code == 200) {
  341. this.isLogin = true
  342. this.info = res.data.data,
  343. this.dBalance = res.data.data.dBalance.toFixed(2)
  344. } else {
  345. this.isLogin = true
  346. }
  347. // uni.setStorage({
  348. // key: 'wx_copenid',
  349. // data: res.data.data.cOpenid
  350. // })
  351. // this.check = res.data.data.role
  352. // if (res.data.data.role == 1) {
  353. // this.txShow = true
  354. // }
  355. })
  356. },
  357. getDetails() {
  358. var openid = {
  359. cOpenId: uni.getStorageSync('wx_copenid')
  360. }
  361. engineDetail(openid).then(res => {
  362. if (res.data.data) {
  363. this.check = res.data.data.nTong
  364. this.reasonRefusal = res.data.data.reasonRefusal
  365. this.data = res.data.data
  366. if (this.check == 1) {
  367. this.txShow = true
  368. }
  369. } else {
  370. this.check = -1
  371. }
  372. })
  373. },
  374. //退出登录
  375. logout() {
  376. uni.showModal({
  377. title: '确定退出登录吗',
  378. success: (res) => {
  379. if (res.confirm) {
  380. logout().then(res => {
  381. if (res.data.code == 200) {
  382. // this.getinfo()
  383. uni.removeStorageSync('access-token')
  384. this.$router.go(0)
  385. uni.showToast({
  386. title: '已退出登录',
  387. icon: 'none'
  388. })
  389. }
  390. })
  391. } else if (res.cancel) {
  392. return
  393. }
  394. }
  395. })
  396. }
  397. },
  398. onLoad() {
  399. this.wx_copenid = uni.getStorageSync('wx_copenid')
  400. uni.setStorageSync('access-token','eyJhbGciOiJIUzUxMiJ9.eyJ0ZjoiOiIwMTU2MTZiNS0xNjdmLTQ3YTEtODVmOC0xMWYxNzJiNzA5ZmUifQ._21anlHblpwT97QZ7t2c_aH3VD79CjnP4_LHjgXjF7-GqXVk1U9RtnZlGYAwhe91I_eqCB8ZWY1Gn3R5zk28jw')
  401. uni.setStorageSync('wx_copenid','o7Txd6poqpr0ZJUOsAudwJgoNutw')
  402. },
  403. onShow() {
  404. this.getinfo()
  405. this.myCoupon()
  406. this.getDetails()
  407. this.getcollectList()
  408. // this.getwxQrCode()
  409. }
  410. }
  411. </script>
  412. <style lang="scss" scoped>
  413. .my {
  414. background: #F7F8FA;
  415. width: 100vw;
  416. height: 100vh;
  417. position: relative;
  418. .popup {
  419. .refuse {
  420. width: 60%;
  421. height: 200px;
  422. background-color: #fff;
  423. border-radius: 10px;
  424. position: fixed;
  425. top: 50%;
  426. left: 50%;
  427. transform: translate(-50%, -50%);
  428. padding: 20px;
  429. box-sizing: border-box;
  430. display: flex;
  431. flex-direction: column;
  432. justify-content: space-between;
  433. align-items: center;
  434. .title {
  435. width: 100%;
  436. height: 10%;
  437. text-align: center;
  438. color: #808080;
  439. }
  440. .content {
  441. flex: 1;
  442. overflow-y: auto;
  443. margin-bottom: 10px;
  444. margin-top: 10px;
  445. }
  446. .btn_box {
  447. width: 100%;
  448. height: 10%;
  449. display: flex;
  450. justify-content: space-around;
  451. font-size: 24rpx;
  452. .btn {
  453. width: 30%;
  454. height: 25px;
  455. background-color: #c8c9cc;
  456. text-align: center;
  457. line-height: 25px;
  458. border-radius: 5px;
  459. }
  460. .success {
  461. background: linear-gradient(to right, #35c99d, #27aea7);
  462. color: #fff;
  463. }
  464. }
  465. }
  466. }
  467. }
  468. .title {
  469. width: 100%;
  470. padding-bottom: 20rpx;
  471. .titles {
  472. text-align: center;
  473. font-size: 36rpx;
  474. font-family: Georgia, 'Times New Roman', Times, serif;
  475. font-weight: bold;
  476. padding-top: 10rpx;
  477. }
  478. .back {
  479. position: absolute;
  480. left: 30rpx;
  481. width: 80rpx;
  482. height: 35rpx;
  483. image {
  484. width: 18rpx;
  485. height: 100%;
  486. }
  487. }
  488. }
  489. .login {
  490. width: 100%;
  491. height: 484rpx;
  492. box-sizing: border-box;
  493. // background-image: url(../../static/other/bgi.png);
  494. background-image: url(../../static/other/bgimg.png);
  495. background-repeat: no-repeat;
  496. background-size: 100% 100%;
  497. position: relative;
  498. .head {
  499. display: flex;
  500. flex-direction: column;
  501. justify-content: center;
  502. align-items: center;
  503. padding-top: 52rpx;
  504. .img {
  505. width: 160rpx;
  506. height: 160rpx;
  507. border-radius: 100px;
  508. overflow: hidden;
  509. margin-bottom: 20rpx;
  510. image {
  511. width: 100%;
  512. height: 100%;
  513. }
  514. }
  515. .login_title {
  516. font-weight: 700;
  517. margin-left: 20rpx;
  518. }
  519. }
  520. .balance {
  521. width: 670rpx;
  522. height: 188rpx;
  523. position: absolute;
  524. bottom: -32rpx;
  525. left: 50%;
  526. transform: translateX(-50%);
  527. background: linear-gradient(292deg, #3A3532 0%, #222021 100%);
  528. border-radius: 24px 24px 24px 24px;
  529. display: flex;
  530. align-items: center;
  531. justify-content: space-between;
  532. padding: 48rpx;
  533. box-sizing: border-box;
  534. font-size: 48rpx;
  535. color: #FFE6CE;
  536. .money_box {
  537. color: #FFE6CE;
  538. .title {
  539. padding: 0;
  540. font-size: 24rpx;
  541. margin-bottom: 16rpx;
  542. }
  543. text {
  544. font-size: 28rpx;
  545. }
  546. }
  547. .btn_box {
  548. display: flex;
  549. align-items: center;
  550. .btn {
  551. color: #000;
  552. width: 148rpx;
  553. height: 72rpx;
  554. font-size: 28rpx;
  555. background: linear-gradient(to bottom, #ead3ba, #ddbe96);
  556. display: flex;
  557. justify-content: center;
  558. align-items: center;
  559. border-radius: 20px;
  560. // margin-left: 200rpx;
  561. }
  562. }
  563. }
  564. image {
  565. width: 108rpx;
  566. height: 108rpx;
  567. }
  568. .text {
  569. flex: 1;
  570. font-size: 36rpx;
  571. color: #1A1A1A;
  572. font-family: monospace;
  573. font-weight: bold;
  574. margin-left: 40rpx;
  575. }
  576. .login_out {
  577. // margin-left: 100;
  578. width: 50rpx;
  579. height: 50rpx;
  580. image {
  581. width: 100%;
  582. height: 100%;
  583. }
  584. }
  585. }
  586. .my_list {
  587. // position: fixed;
  588. bottom: 0;
  589. width: calc(100% - 60rpx);
  590. height: 60vh;
  591. border-top-left-radius: 30rpx;
  592. border-top-right-radius: 30rpx;
  593. padding: 0 30rpx;
  594. padding-top: 50rpx;
  595. display: flex;
  596. justify-content: space-around;
  597. .item {
  598. height: 100rpx;
  599. line-height: 100rpx;
  600. position: relative;
  601. text-align: center;
  602. image {
  603. width: 80rpx;
  604. height: 80rpx;
  605. }
  606. view {
  607. font-size: 26rpx;
  608. color: #707678;
  609. height: 30rpx;
  610. line-height: 30rpx;
  611. }
  612. }
  613. }
  614. .account {
  615. width: 100%;
  616. display: flex;
  617. flex-direction: column;
  618. justify-content: center;
  619. align-items: center;
  620. margin: 62rpx auto;
  621. .other {
  622. width: 100%;
  623. padding: 0px 40rpx;
  624. // border-radius: 20rpx 20rpx 0px 0px;
  625. box-sizing: border-box;
  626. display: flex;
  627. align-items: center;
  628. justify-content: space-between;
  629. // padding: 10rpx 0px 10rpx 0px;
  630. // background-color: #fff;
  631. .option {
  632. width: 319rpx;
  633. height: 136rpx;
  634. background: #FFFFFF;
  635. border-radius: 20rpx 20rpx 20rpx 20rpx;
  636. display: flex;
  637. align-items: center;
  638. font-weight: 700;
  639. padding: 24rpx 32rpx;
  640. box-sizing: border-box;
  641. .left {
  642. image {
  643. width: 88rpx;
  644. height: 88rpx;
  645. }
  646. }
  647. .right {
  648. margin-left: 24rpx;
  649. .top {
  650. font-size: 28rpx;
  651. color: #2F3437;
  652. margin-bottom: 10rpx;
  653. }
  654. .bottom {
  655. font-size: 24rpx;
  656. color: #5E686E;
  657. text {
  658. font-size: 26rpx;
  659. color: #03C8BE;
  660. }
  661. }
  662. }
  663. }
  664. }
  665. .money {
  666. font-size: 40rpx;
  667. }
  668. .btn {
  669. color: #eddbc5;
  670. }
  671. }
  672. .feature {
  673. width: 670rpx;
  674. padding: 32rpx;
  675. background-color: #fff;
  676. border-radius: 10px;
  677. box-sizing: border-box;
  678. margin: 30rpx auto;
  679. .title {
  680. font-weight: 700;
  681. font-size: 28rpx;
  682. color: #2F3437;
  683. }
  684. .box {
  685. display: flex;
  686. flex-wrap: wrap;
  687. .item {
  688. width: 25%;
  689. margin: 20rpx 0px;
  690. display: flex;
  691. flex-direction: column;
  692. align-items: center;
  693. font-size: 24rpx;
  694. color: #2F3437;
  695. image {
  696. width: 60rpx;
  697. height: 60rpx;
  698. margin-bottom: 8rpx;
  699. }
  700. }
  701. }
  702. }
  703. .qr_code {
  704. width: 100vw;
  705. height: 100vh;
  706. background-color: rgba(0, 0, 0, 0.8);
  707. z-index: 999999;
  708. position: absolute;
  709. top: 0;
  710. left: 0;
  711. display: flex;
  712. justify-content: center;
  713. align-items: center;
  714. .img_box {
  715. background-color: #fff;
  716. // height: 800rpx;
  717. border-radius: 20rpx;
  718. overflow: hidden;
  719. image {
  720. width: 400rpx;
  721. height: 400rpx;
  722. }
  723. }
  724. }
  725. </style>