1
0

my.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view class="my">
  3. <!-- 用户名和头像 -->
  4. <view class="user_name">
  5. <van-image class="picture" round width="5rem" height="5rem" src="https://img01.yzcdn.cn/vant/cat.jpeg" />
  6. <view class="name">
  7. <text>小郑</text>
  8. </view>
  9. </view>
  10. <!-- 分割线 -->
  11. <van-divider hairline customStyle="border:5px solid #eee;" />
  12. <!-- 导航菜单 -->
  13. <view class="nav">
  14. <view class="left">我的订单</view>
  15. <view class="right" @click="goOrder">查看全部</view>
  16. </view>
  17. <!-- 分割线 -->
  18. <van-divider hairline customStyle="border:2px solid #eee;" />
  19. <!-- 货物状态 -->
  20. <van-grid @click.native="goOrder" :border='false'>
  21. <van-grid-item icon="balance-pay" :badge="myOrder.unPay" text="待支付" />
  22. <van-grid-item icon="logistics" :badge="myOrder.payed" text="待发货" />
  23. <van-grid-item icon="records-o" :badge="myOrder.consignment" text="代签收" />
  24. <van-grid-item icon="sign" :badge="myOrder.success" text="已完成" />
  25. </van-grid>
  26. <!-- 分割线 -->
  27. <van-divider hairline customStyle="border:3px solid #eee;" />
  28. <!-- 商城信息 -->
  29. <van-grid class="user-details" column-num="3" :border="false" style="height: 5rem;">
  30. <van-grid-item use-slot>
  31. 2<br/>我的收藏
  32. </van-grid-item>
  33. <van-grid-item use-slot>
  34. 2<br/>我的消息
  35. </van-grid-item>
  36. <van-grid-item use-slot>
  37. 2<br/>我的足迹
  38. </van-grid-item>
  39. </van-grid>
  40. <!-- 分割线 -->
  41. <van-divider hairline customStyle="border:3px solid #eee;" />
  42. <!-- 其他操作 -->
  43. <van-cell-group>
  44. <van-cell title-style="cell-title" title="分销中心" icon="cart-o" is-link />
  45. <van-cell title-style="cell-title" title="领券中心" icon="coupon-o" is-link />
  46. <van-cell title-style="cell-title" title="我的优惠券" icon="label-o" is-link />
  47. <van-cell title-style="cell-title" title="收货地址" icon="location-o" @click="goAddress" is-link />
  48. </van-cell-group>
  49. <!-- 登出按钮 -->
  50. <view class="btn">
  51. <van-button type="danger" class="loginOut" @click="loginOut">退出登录</van-button>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import {orderCount} from '../../api/my.js';
  57. export default {
  58. data() {
  59. return {
  60. myOrder:{}
  61. }
  62. },
  63. onShow() {
  64. orderCount().then(res => {
  65. this.myOrder = res;
  66. })
  67. },
  68. methods: {
  69. goOrder() {
  70. uni.navigateTo({
  71. url:"/pages/list/list"
  72. })
  73. },
  74. goAddress() {
  75. uni.navigateTo({
  76. url:"/pages/address/address"
  77. })
  78. },
  79. loginOut() {
  80. uni.removeStorageSync('token');
  81. uni.redirectTo({
  82. url:"/pages/login/login"
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. .user_name {
  90. height: 400rpx;
  91. display: flex;
  92. align-items: center;
  93. flex-direction: column;
  94. .picture {
  95. padding-top: 130rpx;
  96. }
  97. .name {
  98. padding-top: 25rpx;
  99. }
  100. }
  101. .nav {
  102. height: 40rpx;
  103. display: flex;
  104. justify-content: space-between;
  105. padding: 0 18rpx;
  106. font-size: 34rpx;
  107. .left {
  108. font-size: 40rpx;
  109. }
  110. .right {
  111. color: #ccc;
  112. }
  113. }
  114. .btn {
  115. width: 100%;
  116. height: 300rpx;
  117. display: flex;
  118. align-items: center;
  119. justify-content: center;
  120. }
  121. </style>