my.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="my">
  3. <view class="header">
  4. <van-image width="100" round height="100" src="https://img.yzcdn.cn/vant/cat.jpeg" />
  5. <view class="name">
  6. 小郑
  7. </view>
  8. </view>
  9. <!-- 分割线 -->
  10. <van-divider customStyle="border:7px solid #eee" />
  11. <!-- 我的订单 -->
  12. <view class="list">
  13. <view class="order">我的订单</view>
  14. <view class="all" @click="goList">查看全部</view>
  15. </view>
  16. <!-- 分割线 -->
  17. <van-divider customStyle="border:3px solid #eee" />
  18. <!-- 发货状态 -->
  19. <van-grid :border="false">
  20. <van-grid-item icon="cashier-o" text="待支付" :badge="myOrder.unPay" />
  21. <van-grid-item icon="logistics" text="待发货" :badge="myOrder.payed" />
  22. <van-grid-item icon="records-o" text="代签收" :badge="myOrder.consignment" />
  23. <van-grid-item icon="completed-o" text="待完成" :badge="myOrder.success" />
  24. </van-grid>
  25. <!-- 分割线 -->
  26. <van-divider customStyle="border:5px solid #eee" />
  27. <!-- 个人记录 -->
  28. <van-grid column-num="3" :border="false">
  29. <van-grid-item use-slot>
  30. 2<br />我的收藏
  31. </van-grid-item>
  32. <van-grid-item use-slot>
  33. 2<br />我的消息
  34. </van-grid-item>
  35. <van-grid-item use-slot>
  36. 2<br />我的足迹
  37. </van-grid-item>
  38. </van-grid>
  39. <!-- 分割线 -->
  40. <van-divider customStyle="border:5px solid #eee" />
  41. <!-- 列表信息 -->
  42. <van-cell title="分销中心" is-link :border="false" icon="cart-o" />
  43. <van-cell title="领卷中心" is-link :border="false" icon="coupon-o" />
  44. <van-cell title="我的优惠券" is-link :border="false" icon="label-o" />
  45. <van-cell title="收货地址" is-link :border="false" icon="location-o" @click="goAdd" />
  46. <!-- 退出登陆 -->
  47. <div class="footer">
  48. <van-button type="danger" @click="loginOut">退出登陆</van-button>
  49. </div>
  50. </view>
  51. </template>
  52. <script>
  53. import {
  54. orderCount
  55. } from '@/api/order.js';
  56. export default {
  57. data() {
  58. return {
  59. myOrder: {}
  60. }
  61. },
  62. onShow() {
  63. this.init();
  64. },
  65. methods: {
  66. async init() {
  67. this.myOrder = await orderCount();
  68. console.log(this.myOrder, 'order')
  69. },
  70. goList() {
  71. uni.navigateTo({
  72. url: "/pages/list/list"
  73. })
  74. },
  75. goAdd() {
  76. uni.navigateTo({
  77. url:"/pages/address/address"
  78. })
  79. },
  80. loginOut() {
  81. uni.clearStorageSync();
  82. uni.redirectTo({
  83. url:"/pages/login/login"
  84. })
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss">
  90. .header {
  91. width: 100%;
  92. height: 190rpx;
  93. display: flex;
  94. flex-direction: column;
  95. align-items: center;
  96. justify-self: center;
  97. padding: 100rpx 0;
  98. }
  99. .list {
  100. height: 50rpx;
  101. display: flex;
  102. justify-content: space-between;
  103. padding: 0 15rpx;
  104. font-size: 38rpx;
  105. .all {
  106. font-size: 32rpx;
  107. color: #ccc;
  108. }
  109. }
  110. .footer {
  111. height: 240rpx;
  112. display: flex;
  113. align-items: center;
  114. justify-content: center;
  115. }
  116. </style>