s-wallet-card.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <!-- 装修用户组件:用户资产 -->
  2. <template>
  3. <view class="ss-wallet-menu-wrap ss-flex ss-col-center" :style="[bgStyle, { marginLeft: `${data.space}px` }]">
  4. <view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
  5. @tap="sheep.$router.go('/pages/user/wallet/money')">
  6. <view class="value-box ss-flex ss-col-bottom">
  7. <view class="value-text ss-line-1">{{ fen2yuan(userWallet.balance) || '0.00' }}</view>
  8. <view class="unit-text ss-m-l-6">元</view>
  9. </view>
  10. <view class="menu-title ss-m-t-28">账户余额</view>
  11. </view>
  12. <view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
  13. @tap="sheep.$router.go('/pages/user/wallet/score')">
  14. <view class="value-box ss-flex ss-col-bottom">
  15. <view class="value-text">{{ userInfo.point || 0 }}</view>
  16. <view class="unit-text ss-m-l-6">个</view>
  17. </view>
  18. <view class="menu-title ss-m-t-28">积分</view>
  19. </view>
  20. <view class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center" @tap="
  21. sheep.$router.go('/pages/coupon/list', {
  22. type: 'geted',
  23. })
  24. ">
  25. <view class="value-box ss-flex ss-col-bottom">
  26. <view class="value-text">{{ numData.unusedCouponCount }}</view>
  27. <view class="unit-text ss-m-l-6">张</view>
  28. </view>
  29. <view class="menu-title ss-m-t-28">优惠券</view>
  30. </view>
  31. <view class="menu-item ss-flex-col ss-row-center ss-col-center menu-wallet"
  32. @tap="sheep.$router.go('/pages/user/wallet/money')">
  33. <image class="item-icon" :src="sheep.$url.static('/static/img/shop/user/wallet_icon.png')" mode="aspectFit" />
  34. <view class="menu-title ss-m-t-30">我的钱包</view>
  35. </view>
  36. </view>
  37. </template>
  38. <script setup>
  39. /**
  40. * 装修组件 - 订单菜单组
  41. */
  42. import { computed } from 'vue';
  43. import sheep from '@/sheep';
  44. import { fen2yuan } from '../../hooks/useGoods';
  45. // 接收参数
  46. const props = defineProps({
  47. // 装修数据
  48. data: {
  49. type: Object,
  50. default: () => ({}),
  51. },
  52. // 装修样式
  53. styles: {
  54. type: Object,
  55. default: () => ({}),
  56. },
  57. });
  58. // 设置背景样式
  59. const bgStyle = computed(() => {
  60. // 直接从 props.styles 解构
  61. const { bgType, bgImg, bgColor } = props.styles;
  62. // 根据 bgType 返回相应的样式
  63. return {
  64. background: bgType === 'img'
  65. ? `url(${bgImg}) no-repeat top center / 100% 100%`
  66. : bgColor
  67. };
  68. });
  69. const userWallet = computed(() => sheep.$store('user').userWallet);
  70. const userInfo = computed(() => sheep.$store('user').userInfo);
  71. const numData = computed(() => sheep.$store('user').numData);
  72. </script>
  73. <style lang="scss" scoped>
  74. .ss-wallet-menu-wrap {
  75. .menu-wallet {
  76. width: 144rpx;
  77. }
  78. .menu-item {
  79. height: 160rpx;
  80. .menu-title {
  81. font-size: 24rpx;
  82. line-height: 24rpx;
  83. color: #333333;
  84. }
  85. .item-icon {
  86. width: 44rpx;
  87. height: 44rpx;
  88. }
  89. .value-box {
  90. height: 50rpx;
  91. text-align: center;
  92. .value-text {
  93. font-size: 28rpx;
  94. color: #000000;
  95. line-height: 28rpx;
  96. vertical-align: text-bottom;
  97. font-family: OPPOSANS;
  98. }
  99. .unit-text {
  100. font-size: 24rpx;
  101. color: #343434;
  102. line-height: 24rpx;
  103. }
  104. }
  105. }
  106. }
  107. </style>