user.vue 3.7 KB

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