myPurse.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="MyPurseView">
  3. <view class=" font-weight-bold Purse">我的钱包</view>
  4. <view class="totalItemBox">
  5. <view class="item">
  6. <p>{{ accountInfo.price || '0.00' }}</p>
  7. <view @click="go('/pages_category_page2/userModule/memberAccount')" style="margin-top: 15rpx;font-size: 26rpx;color: #979797;">账户余额 ></view>
  8. <!-- <view style="font-size: 24upx;color: #999999;">去提现 ></view> -->
  9. </view>
  10. <view class="item">
  11. <p>{{ accountInfo.userVoucher || '0.00' }}</p>
  12. <view @click="go('/pages_category_page2/userModule/memberAccount')" style="margin-top: 15rpx;font-size: 26rpx;color: #979797;">代金券 ></view>
  13. </view>
  14. <view class="item">
  15. <p>{{ memberData.credit || '0.00' }}</p>
  16. <view @click="go('/pages_category_page1/integral/index')" style="margin-top: 15rpx;font-size: 26rpx;color: #979797;">积分 ></view>
  17. <!-- <view style="font-size: 24upx;color: #999999;">去提现 ></view> -->
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import { getDistributorApi } from '@/api/user'
  24. const NET = require('@/utils/request')
  25. const API = require('@/config/api')
  26. export default {
  27. name: 'myPurse',
  28. data() {
  29. return {
  30. accountInfo: {},
  31. memberData: {}
  32. };
  33. },
  34. created() {
  35. getDistributorApi({}).then((res) => { // 获取余额和带金卷数量
  36. this.accountInfo = res.data
  37. // console.log(this.accountInfo)
  38. }).catch((e) => {
  39. console.log(e)
  40. })
  41. if(uni.getStorageSync('storage_userInfo')){ // 获取余额和带金卷数量获取积分数量
  42. this.memberData = uni.getStorageSync('storage_userInfo')
  43. }else {
  44. NET.request(API.GetUser, {}, 'GET').then((res) => {
  45. this.memberData = res.data
  46. uni.setStorageSync('storage_userInfo', this.memberData)
  47. }).catch((res) => {
  48. console.error(res)
  49. })
  50. }
  51. },
  52. methods: {
  53. go(url) {
  54. uni.navigateTo({
  55. url
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss">
  62. .Purse {
  63. font-size: 30rpx;
  64. }
  65. .MyPurseView {
  66. box-sizing: border-box;
  67. padding: 21rpx 25rpx 30rpx 25rpx;
  68. margin-bottom: 30rpx;
  69. margin-top: 33rpx;
  70. width: 100%;
  71. border-radius: 20rpx;
  72. background: #FFFFFF;
  73. .totalItemBox {
  74. padding: 0 70rpx;
  75. display: flex;
  76. justify-content: space-between;
  77. .item {
  78. display: flex;
  79. flex-direction: column;
  80. align-items: center;
  81. text-align: center;
  82. >p:nth-of-type(1) {
  83. margin-top: 18rpx;
  84. font-weight: 900;
  85. font-size: 36rpx;
  86. }
  87. }
  88. }
  89. }
  90. </style>