index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <!-- 热门推荐 -->
  3. <view class='recommend' :style="colorStyle">
  4. <view class='title acea-row row-center-wrapper'>
  5. <text class='iconfont icon-zhuangshixian'></text>
  6. <text class='name'>热门推荐</text>
  7. <text class='iconfont icon-zhuangshixian lefticon'></text>
  8. </view>
  9. <view class='recommendList acea-row row-between-wrapper'>
  10. <view class='item' v-for="(item,index) in hostProduct" :key="index" hover-class='none' @tap="goDetail(item)">
  11. <view class='pictrue'>
  12. <image :src='item.image' mode="aspectFill"></image>
  13. <span class="pictrue_log_big pictrue_log_class" v-if="item.activity && item.activity.type === '1'">秒杀</span>
  14. <span class="pictrue_log_big pictrue_log_class" v-if="item.activity && item.activity.type === '2'">砍价</span>
  15. <span class="pictrue_log_big pictrue_log_class" v-if="item.activity && item.activity.type === '3'">拼团</span>
  16. <view class="activityFrame" v-if="item.activity_frame.image" :style="'background-image: url('+item.activity_frame.image+');'"></view>
  17. </view>
  18. <view class='name line1'>{{item.store_name}}</view>
  19. <!-- #ifdef H5 || APP-PLUS -->
  20. <slot name="center" :item="item"></slot>
  21. <!-- #endif -->
  22. <!-- #ifdef MP -->
  23. <slot name="center{{index}}"></slot>
  24. <!-- #endif -->
  25. <view class='money font-color'>¥<text class='num'>{{item.price}}</text></view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {mapGetters} from "vuex";
  32. import { goShopDetail } from '@/libs/order.js'
  33. import colors from "@/mixins/color";
  34. export default {
  35. computed: mapGetters(['uid']),
  36. props: {
  37. hostProduct: {
  38. type: Array,
  39. default: function() {
  40. return [];
  41. }
  42. }
  43. },
  44. mixins: [colors],
  45. data() {
  46. return {
  47. };
  48. },
  49. methods: {
  50. goDetail(item){
  51. goShopDetail(item,this.uid).then(res=>{
  52. uni.navigateTo({
  53. url:`/pages/goods_details/index?id=${item.id}`
  54. })
  55. })
  56. }
  57. }
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .activityFrame{
  62. border-radius: 20rpx;
  63. }
  64. .recommend {
  65. background-color: #fff;
  66. }
  67. .recommend .title {
  68. height: 135rpx;
  69. font-size: 28rpx;
  70. color: #282828;
  71. }
  72. .recommend .title .name {
  73. margin: 0 28rpx;
  74. }
  75. .recommend .title .iconfont {
  76. font-size: 170rpx;
  77. color: #454545;
  78. }
  79. .recommend .title .iconfont.lefticon {
  80. transform: rotate(180deg);
  81. }
  82. .recommend .recommendList {
  83. padding: 0 30rpx;
  84. }
  85. .recommend .recommendList .item {
  86. width: 335rpx;
  87. margin-bottom: 30rpx;
  88. }
  89. .recommend .recommendList .item .pictrue {
  90. position: relative;
  91. width: 100%;
  92. height: 335rpx;
  93. }
  94. .recommend .recommendList .item .pictrue image {
  95. width: 100%;
  96. height: 100%;
  97. border-radius: 20rpx;
  98. }
  99. .recommend .recommendList .item .name {
  100. font-size: 28rpx;
  101. color: #282828;
  102. margin-top: 20rpx;
  103. }
  104. .recommend .recommendList .item .money {
  105. font-size: 20rpx;
  106. margin-top: 8rpx;
  107. }
  108. .recommend .recommendList .item .money .num {
  109. font-size: 28rpx;
  110. }
  111. </style>