HyShopItem.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!-- eslint-disable vue/no-mutating-props -->
  2. <template>
  3. <view class="shop-item-wrapper" @click="navigateToDetails(item)">
  4. <view class="item-left-wrap">
  5. <image :src="item.content?.image" mode="aspectFill" />
  6. </view>
  7. <view class="item-right-wrap">
  8. <view class="top">
  9. <view class="title u-line-1">{{ item.title }}</view>
  10. <view class="rate-box">
  11. <uni-rate allow-half :value="item.content?.rate || 0" disabled color="#ddd" disabledColor="#ff5702" activeColor="#ff5702" size="20" />
  12. <text class="rate-text">{{ (Number(item.content?.rate) || 0).toFixed(1) }}</text>
  13. </view>
  14. <view class="price" v-if="price">¥{{ item.content?.price }}/人</view>
  15. </view>
  16. <view class="bottom">
  17. <view class="tag-item" v-for="(tag, index) in item.content?.tags" :key="index">{{ tag }}</view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script lang="ts" setup>
  23. const props = defineProps({
  24. price: {
  25. type: Boolean,
  26. default: false
  27. },
  28. item: {
  29. type: Object,
  30. default: () => ({})
  31. }
  32. })
  33. const navigateToDetails = (item: any) => {
  34. if (props.price) {
  35. uni.navigateTo({
  36. url: '/base/shop/details?id=' + item.id
  37. })
  38. } else {
  39. uni.navigateTo({
  40. url: '/base/shop/detailsShop?id=' + item.id
  41. })
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. .shop-item-wrapper {
  47. width: 100%;
  48. box-sizing: border-box;
  49. padding: 30rpx;
  50. background-color: #fff;
  51. border-radius: 14rpx;
  52. display: flex;
  53. margin-bottom: 32rpx;
  54. .item-left-wrap {
  55. width: 188rpx;
  56. height: 188rpx;
  57. background-color: #f6f7fb;
  58. border-radius: 14rpx;
  59. margin-right: 28rpx;
  60. image {
  61. width: 188rpx;
  62. height: 199rpx;
  63. border-radius: 14rpx;
  64. }
  65. }
  66. .item-right-wrap {
  67. display: flex;
  68. flex-direction: column;
  69. justify-content: space-between;
  70. .top {
  71. .title {
  72. font-size: 28rpx;
  73. color: #333;
  74. font-weight: 500;
  75. width: 400rpx;
  76. margin-bottom: 10rpx;
  77. }
  78. .rate-box {
  79. display: flex;
  80. align-items: flex-end;
  81. .rate-text {
  82. margin-left: 14rpx;
  83. }
  84. }
  85. .price {
  86. font-size: 25rpx;
  87. color: #ff5704;
  88. margin-top: 4rpx;
  89. }
  90. }
  91. .bottom {
  92. display: flex;
  93. align-items: center;
  94. .tag-item {
  95. font-size: 26rpx;
  96. color: #999;
  97. margin-right: 22rpx;
  98. }
  99. }
  100. }
  101. }
  102. </style>