s-order-card.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <!-- 装修用户组件:用户订单 -->
  2. <template>
  3. <view class="ss-order-menu-wrap ss-flex ss-col-center" :style="[style, { marginLeft: `${data.space}px` }]">
  4. <view
  5. class="menu-item ss-flex-1 ss-flex-col ss-row-center ss-col-center"
  6. v-for="item in orderMap"
  7. :key="item.title"
  8. @tap="sheep.$router.go(item.path, { type: item.value })"
  9. >
  10. <uni-badge
  11. class="uni-badge-left-margin"
  12. :text="numData.orderCount[item.count]"
  13. absolute="rightTop"
  14. size="small"
  15. >
  16. <image class="item-icon" :src="sheep.$url.static(item.icon)" mode="aspectFit" />
  17. </uni-badge>
  18. <view class="menu-title ss-m-t-28">{{ item.title }}</view>
  19. </view>
  20. </view>
  21. </template>
  22. <script setup>
  23. /**
  24. * 装修组件 - 订单菜单组
  25. */
  26. import sheep from '@/sheep';
  27. import { computed } from 'vue';
  28. const orderMap = [
  29. {
  30. title: '待付款',
  31. value: '1',
  32. icon: '/static/img/shop/order/no_pay.png',
  33. path: '/pages/order/list',
  34. type: 'unpaid',
  35. count: 'unpaidCount',
  36. },
  37. {
  38. title: '待收货',
  39. value: '3',
  40. icon: '/static/img/shop/order/no_take.png',
  41. path: '/pages/order/list',
  42. type: 'noget',
  43. count: 'deliveredCount',
  44. },
  45. {
  46. title: '待评价',
  47. value: '4',
  48. icon: '/static/img/shop/order/no_comment.png',
  49. path: '/pages/order/list',
  50. type: 'nocomment',
  51. count: 'uncommentedCount',
  52. },
  53. {
  54. title: '售后单',
  55. value: '0',
  56. icon: '/static/img/shop/order/change_order.png',
  57. path: '/pages/order/aftersale/list',
  58. type: 'aftersale',
  59. count: 'afterSaleCount',
  60. },
  61. {
  62. title: '全部订单',
  63. value: '0',
  64. icon: '/static/img/shop/order/all_order.png',
  65. path: '/pages/order/list',
  66. },
  67. ];
  68. // 接收参数
  69. const props = defineProps({
  70. // 装修数据
  71. data: {
  72. type: Object,
  73. default: () => ({}),
  74. },
  75. // 装修样式
  76. styles: {
  77. type: Object,
  78. default: () => ({}),
  79. },
  80. });
  81. // 设置角标
  82. const numData = computed(() => sheep.$store('user').numData);
  83. // 设置背景样式
  84. const style = computed(() => {
  85. // 直接从 props.styles 解构
  86. const { bgType, bgImg, bgColor } = props.styles;
  87. // 根据 bgType 返回相应的样式
  88. return {
  89. background: bgType === 'img'
  90. ? `url(${bgImg}) no-repeat top center / 100% 100%`
  91. : bgColor
  92. };
  93. });
  94. </script>
  95. <style lang="scss" scoped>
  96. .ss-order-menu-wrap {
  97. .menu-item {
  98. height: 160rpx;
  99. position: relative;
  100. z-index: 10;
  101. .menu-title {
  102. font-size: 24rpx;
  103. line-height: 24rpx;
  104. color: #333333;
  105. }
  106. .item-icon {
  107. width: 44rpx;
  108. height: 44rpx;
  109. }
  110. .num-icon {
  111. position: absolute;
  112. right: 18rpx;
  113. top: 18rpx;
  114. // width: 40rpx;
  115. padding: 0 8rpx;
  116. height: 26rpx;
  117. background: #ff4d4f;
  118. border-radius: 13rpx;
  119. color: #fefefe;
  120. display: flex;
  121. align-items: center;
  122. .num {
  123. font-size: 24rpx;
  124. transform: scale(0.8);
  125. }
  126. }
  127. }
  128. }
  129. </style>