shop_item.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="shop-item" @click="handleClick">
  3. <!-- 店铺头部信息 -->
  4. <view class="shop-header">
  5. <view class="shop-avatar">
  6. <image :src="item.logo" mode="aspectFill" />
  7. </view>
  8. <view class="shop-info">
  9. <view class="shop-name">{{ item.name }}</view>
  10. <view class="shop-visits">
  11. <image
  12. class="img"
  13. src="/static/seller/address.png"
  14. model="fixwidth"
  15. ></image>
  16. <text>{{ item.distance }}km</text>
  17. </view>
  18. </view>
  19. <view class="shop-arrow">
  20. <!-- <up-rate
  21. readonly
  22. :count="5"
  23. size="16"
  24. active-color="var(--red)"
  25. v-model="item.score"
  26. ></up-rate> -->
  27. <view class="purchase—box">
  28. <text class="num">{{ item.sale }}</text>
  29. <trans _t="人购买" />
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 商品横向滚动列表 -->
  34. <view class="products-scroll">
  35. <up-scroll-list class="scroll-container" :indicator="false">
  36. <view class="products-list">
  37. <view
  38. v-for="product in item.goods"
  39. :key="product.id"
  40. class="product-item"
  41. @click.stop="handleProductClick(product)"
  42. >
  43. <view class="product-image">
  44. <image :src="product.picurl" mode="aspectFill" />
  45. </view>
  46. <view class="product-info">
  47. <view class="product-desc">{{ product.goodsName }}</view>
  48. <view class="product-price">¥{{ product.price }}</view>
  49. </view>
  50. </view>
  51. </view>
  52. </up-scroll-list>
  53. </view>
  54. </view>
  55. </template>
  56. <script setup>
  57. import { defineProps, defineEmits } from "vue";
  58. const props = defineProps({
  59. item: {
  60. type: Object,
  61. required: true,
  62. },
  63. });
  64. const emit = defineEmits(["click", "productClick"]);
  65. const handleClick = () => {
  66. emit("click", props.item);
  67. };
  68. const handleProductClick = (product) => {
  69. emit("productClick", product);
  70. };
  71. </script>
  72. <style lang="less" scoped>
  73. @import url("@/style.less");
  74. .shop-item {
  75. width: 100%;
  76. background: var(--light);
  77. margin-bottom: 24rpx;
  78. padding: 14rpx 30rpx;
  79. box-sizing: border-box;
  80. .shop-header {
  81. display: flex;
  82. align-items: center;
  83. margin-bottom: 30rpx;
  84. .shop-avatar {
  85. width: 66rpx;
  86. height: 66rpx;
  87. border-radius: 50%;
  88. overflow: hidden;
  89. margin-right: 10rpx;
  90. image {
  91. width: 100%;
  92. height: 100%;
  93. }
  94. }
  95. .shop-info {
  96. flex: 1;
  97. .shop-name {
  98. font-size: 28rpx;
  99. font-weight: bold;
  100. color: var(--black);
  101. margin-bottom: 8rpx;
  102. }
  103. .shop-visits {
  104. display: flex;
  105. font-size: 24rpx;
  106. color: var(--text-01);
  107. line-height: 24rpx;
  108. .img {
  109. width: 18rpx;
  110. height: 24rpx;
  111. margin-right: 8rpx;
  112. }
  113. }
  114. }
  115. .shop-arrow {
  116. .purchase—box {
  117. height: 36rpx;
  118. line-height: 30rpx;
  119. border-radius: 0 10rpx 0 10rpx;
  120. border: var(--danger-bor);
  121. padding: 0 18rpx;
  122. font-size: 20rpx;
  123. color: var(--red);
  124. .num {
  125. font-size: 22rpx;
  126. font-weight: 700;
  127. }
  128. }
  129. .icon-right {
  130. color: var(--text-01);
  131. font-size: 24rpx;
  132. }
  133. }
  134. }
  135. .products-scroll {
  136. width: 100%;
  137. overflow-x: auto;
  138. .scroll-container {
  139. display: flex;
  140. flex-direction: row;
  141. }
  142. .products-list {
  143. display: flex;
  144. gap: 20rpx;
  145. }
  146. .product-item {
  147. width: 200rpx;
  148. .product-image {
  149. width: 100%;
  150. height: 180rpx;
  151. position: relative;
  152. image {
  153. width: 100%;
  154. height: 100%;
  155. border-radius: 16rpx;
  156. }
  157. }
  158. .product-info {
  159. padding: 14rpx 0;
  160. .product-price {
  161. font-size: 24rpx;
  162. font-weight: bold;
  163. color: var(--red);
  164. }
  165. .product-desc {
  166. font-size: 20rpx;
  167. color: var(--text-01);
  168. line-height: 1.4;
  169. .ellipsis(1);
  170. margin-bottom: 8rpx;
  171. }
  172. }
  173. }
  174. }
  175. }
  176. </style>