index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="recommend">
  3. <view class="title acea-row row-center-wrapper">
  4. <text class="iconfont icon-zhuangshixian"></text>
  5. <text class="name">热门推荐</text>
  6. <text class="iconfont icon-zhuangshixian lefticon"></text>
  7. </view>
  8. <view class="recommendList acea-row row-between-wrapper">
  9. <view
  10. class="item"
  11. v-for="(item, index) in hostProduct"
  12. :key="index"
  13. hover-class="none"
  14. @tap="goDetail(item)"
  15. >
  16. <view class="pictrue">
  17. <image :src="item.image"></image>
  18. </view>
  19. <view class="name line1">{{ item.storeName }}</view>
  20. <!-- <view class='money font-color'>¥<text class='num'>{{item.price}}</text></view> -->
  21. <view class="bottom-row">
  22. <text class="price">工费: {{ item.price }}/克</text>
  23. <text class="sales">已售{{ item.sales || 0 }}件</text>
  24. <!-- <view class="txt">券</view> -->
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup>
  31. import { useAppStore } from "@/stores/app.js";
  32. import { goShopDetail } from "@/libs/order.js";
  33. const appStore = useAppStore();
  34. const uid = appStore.uidComputed;
  35. const props = defineProps({
  36. hostProduct: {
  37. type: Array,
  38. default: () => [],
  39. },
  40. });
  41. const goDetail = async (item) => {
  42. try {
  43. await goShopDetail(item, uid.value);
  44. uni.navigateTo({
  45. url: `/pages/goods_details/index?id=${item.id}`,
  46. });
  47. } catch (err) {
  48. console.error("Navigation error:", err);
  49. }
  50. };
  51. </script>
  52. <style scoped lang="scss">
  53. .recommend {
  54. background-color: #fff;
  55. .title {
  56. height: 135rpx;
  57. line-height: 135rpx;
  58. font-size: 28rpx;
  59. color: #282828;
  60. .name {
  61. margin: 0 28rpx;
  62. }
  63. .iconfont {
  64. font-size: 170rpx;
  65. color: #454545;
  66. }
  67. .iconfont.lefticon {
  68. transform: rotate(180deg);
  69. }
  70. }
  71. .recommendList {
  72. padding: 0 30rpx;
  73. /* #ifdef H5 */
  74. padding-bottom: 50rpx;
  75. /* #endif */
  76. .item {
  77. width: 335rpx;
  78. margin-bottom: 30rpx;
  79. .pictrue {
  80. position: relative;
  81. width: 100%;
  82. height: 335rpx;
  83. image {
  84. width: 100%;
  85. height: 100%;
  86. border-radius: 14rpx;
  87. }
  88. }
  89. .name {
  90. font-size: 28rpx;
  91. color: #282828;
  92. margin-top: 20rpx;
  93. }
  94. .money {
  95. font-size: 20rpx;
  96. margin-top: 8rpx;
  97. font-weight: 600;
  98. .num {
  99. font-size: 28rpx;
  100. }
  101. }
  102. .price {
  103. color: $theme-color;
  104. font-weight: bold;
  105. }
  106. }
  107. }
  108. .bottom-row {
  109. // color: $theme-color;
  110. display: flex;
  111. justify-content: space-between;
  112. align-items: center;
  113. font-size: 28rpx;
  114. margin: 10rpx 0 0;
  115. .price {
  116. padding-bottom: 4rpx;
  117. font-weight: 800;
  118. color: #f16327 !important;
  119. }
  120. .sales {
  121. color: #b4b4b4;
  122. font-size: 22rpx;
  123. }
  124. }
  125. }
  126. </style>