shop_item.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="shop-item" @click="toShopDetail">
  3. <view class="shop-avatar">
  4. <image :src="item.avatar" class="avatar-img" />
  5. <view class="shop-status" :class="item.status">
  6. {{ item.status === "online" ? "营业中" : "休息中" }}
  7. </view>
  8. </view>
  9. <view class="shop-info">
  10. <view class="shop-name">{{ item.name }}</view>
  11. <view class="shop-desc">{{ item.description }}</view>
  12. <view class="shop-stats">
  13. <view class="stat-item">
  14. <text class="stat-label">评分:</text>
  15. <text class="stat-value">{{ item.rating }}</text>
  16. </view>
  17. <view class="stat-item">
  18. <text class="stat-label">销量:</text>
  19. <text class="stat-value">{{ item.sales }}</text>
  20. </view>
  21. <view class="stat-item">
  22. <text class="stat-label">距离:</text>
  23. <text class="stat-value">{{ item.distance }}</text>
  24. </view>
  25. </view>
  26. <view class="shop-tags">
  27. <text class="tag" v-for="tag in item.tags" :key="tag">
  28. {{ tag }}
  29. </text>
  30. </view>
  31. </view>
  32. <view class="shop-arrow">
  33. <i class="icon-font icon-arrow-right"></i>
  34. </view>
  35. </view>
  36. </template>
  37. <script setup>
  38. const props = defineProps({
  39. item: {
  40. type: Object,
  41. default: () => ({}),
  42. },
  43. });
  44. const emit = defineEmits(["click"]);
  45. const toShopDetail = () => {
  46. emit("click", props.item);
  47. };
  48. </script>
  49. <style lang="less" scoped>
  50. @import url("@/style.less");
  51. .shop-item {
  52. display: flex;
  53. align-items: center;
  54. background: var(--light);
  55. border-radius: 20rpx;
  56. padding: 24rpx;
  57. margin-bottom: 20rpx;
  58. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  59. .shop-avatar {
  60. position: relative;
  61. margin-right: 24rpx;
  62. .avatar-img {
  63. width: 120rpx;
  64. height: 120rpx;
  65. border-radius: 20rpx;
  66. }
  67. .shop-status {
  68. position: absolute;
  69. bottom: -8rpx;
  70. left: 50%;
  71. transform: translateX(-50%);
  72. font-size: 20rpx;
  73. padding: 4rpx 12rpx;
  74. border-radius: 20rpx;
  75. color: var(--light);
  76. &.online {
  77. background: var(--success);
  78. }
  79. &.offline {
  80. background: var(--text-01);
  81. }
  82. }
  83. }
  84. .shop-info {
  85. flex: 1;
  86. display: flex;
  87. flex-direction: column;
  88. .shop-name {
  89. font-size: 32rpx;
  90. font-weight: bold;
  91. color: var(--black);
  92. margin-bottom: 8rpx;
  93. }
  94. .shop-desc {
  95. font-size: 24rpx;
  96. color: var(--text-01);
  97. margin-bottom: 16rpx;
  98. display: -webkit-box;
  99. -webkit-line-clamp: 1;
  100. line-clamp: 1;
  101. -webkit-box-orient: vertical;
  102. overflow: hidden;
  103. }
  104. .shop-stats {
  105. display: flex;
  106. gap: 24rpx;
  107. margin-bottom: 12rpx;
  108. .stat-item {
  109. display: flex;
  110. align-items: center;
  111. .stat-label {
  112. font-size: 22rpx;
  113. color: var(--text-01);
  114. margin-right: 4rpx;
  115. }
  116. .stat-value {
  117. font-size: 22rpx;
  118. color: var(--black);
  119. font-weight: bold;
  120. }
  121. }
  122. }
  123. .shop-tags {
  124. display: flex;
  125. gap: 8rpx;
  126. flex-wrap: wrap;
  127. .tag {
  128. font-size: 20rpx;
  129. color: var(--primary);
  130. background: rgba(255, 107, 107, 0.1);
  131. padding: 4rpx 12rpx;
  132. border-radius: 12rpx;
  133. }
  134. }
  135. }
  136. .shop-arrow {
  137. margin-left: 16rpx;
  138. .icon-arrow-right {
  139. font-size: 24rpx;
  140. color: var(--text-01);
  141. }
  142. }
  143. }
  144. </style>