user.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="container">
  3. <view class="user-header">
  4. <view class="user-info" @click="handleUserInfoClick">
  5. <u-avatar size="80" :src="avatar"></u-avatar>
  6. <text class="nick-name">{{ nickName }}</text>
  7. </view>
  8. </view>
  9. <u-gap height="10" bgColor="#f3f3f3"></u-gap>
  10. <view>
  11. <view class="order-header">
  12. <text class="order-title">我的订单</text>
  13. <view class="see-all">
  14. <text>查看全部</text>
  15. <u-icon name="arrow-right"></u-icon>
  16. </view>
  17. </view>
  18. <view class="order-status-box">
  19. <u-grid :border="false" :col="orderStatusList.length"
  20. ><u-grid-item v-for="(item, index) in orderStatusList" :key="index">
  21. <u-icon :name="item.icon" :size="32"></u-icon>
  22. <text class="grid-title">{{ item.title }}</text>
  23. </u-grid-item>
  24. </u-grid>
  25. </view>
  26. </view>
  27. <u-gap height="10" bgColor="#f3f3f3"></u-gap>
  28. <view class="stat-box">
  29. <u-grid :border="false" col="3"
  30. ><u-grid-item v-for="(item, index) in statList" :key="index">
  31. <text class="grid-value">{{ item.value }}</text>
  32. <text class="grid-title">{{ item.title }}</text>
  33. </u-grid-item>
  34. </u-grid>
  35. </view>
  36. <u-gap height="10" bgColor="#f3f3f3"></u-gap>
  37. <u-cell-group class="fun-list">
  38. <u-cell class="fun-item" :border="false" icon="gift" title="分销中心" isLink></u-cell>
  39. <u-cell class="fun-item" :border="false" icon="tags" title="领券中心" isLink></u-cell>
  40. <u-cell class="fun-item" :border="false" icon="coupon" title="我的优惠券" isLink></u-cell>
  41. <u-cell class="fun-item" :border="false" icon="map" title="收获地址" isLink></u-cell>
  42. </u-cell-group>
  43. <u-button class="logout-btn" type="error" color="#ea322b" text="确定"></u-button>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. avatar: '',
  51. nickName: '点击登录',
  52. orderStatusList: [
  53. { icon: 'rmb-circle', title: '待支付' },
  54. { icon: 'car', title: '代发货' },
  55. { icon: 'order', title: '待收货' },
  56. { icon: 'integral', title: '已完成' }
  57. ],
  58. statList: [
  59. { value: '2', title: '我的收藏' },
  60. { value: '3', title: '我的消息' },
  61. { value: '3', title: '我的足迹' }
  62. ]
  63. }
  64. },
  65. onLoad() {},
  66. methods: {
  67. handleUserInfoClick() {
  68. // TODO 判断是否已经登录逻辑
  69. if (!uni.getStorageSync('token')) {
  70. uni.$u.route('/pages/login/login')
  71. } else {
  72. uni.$u.route('/pages/profile/profile')
  73. }
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .user-header {
  80. @include flex-center(column);
  81. height: 280rpx;
  82. .user-info {
  83. @include flex-center(column);
  84. .nick-name {
  85. margin-top: 20rpx;
  86. font-size: 32rpx;
  87. font-weight: 700;
  88. }
  89. }
  90. }
  91. .order-header {
  92. @include flex-space-between;
  93. padding: 20rpx 30rpx;
  94. border-bottom: $custom-border-style;
  95. .order-title {
  96. color: #333333;
  97. font-size: 34rpx;
  98. }
  99. .see-all {
  100. height: 40rpx;
  101. @include flex-right;
  102. color: #666666;
  103. font-size: 26rpx;
  104. }
  105. }
  106. .order-status-box {
  107. padding: 40rpx 0;
  108. }
  109. .stat-box {
  110. padding: 20rpx 0;
  111. }
  112. .grid-title {
  113. line-height: 50rpx;
  114. font-size: 26rpx;
  115. }
  116. .grid-value {
  117. line-height: 50rpx;
  118. font-size: 36rpx;
  119. font-weight: 700;
  120. color: #2b85e4;
  121. }
  122. .fun-list {
  123. .fun-item {
  124. padding-top: 10rpx;
  125. padding-bottom: 10rpx;
  126. border-bottom: $custom-border-style;
  127. }
  128. }
  129. .logout-btn {
  130. margin-top: 60rpx;
  131. width: 300rpx;
  132. }
  133. </style>