index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="goodsList">
  3. <view class="item" v-for="(item,index) in tempArr" :key='index' @click="goDetail(item)">
  4. <view class="pictrue">
  5. <span class="pictrue_log pictrue_log_class" v-if="item.activity && item.activity.type === '1'">{{$t(`秒杀`)}}</span>
  6. <span class="pictrue_log pictrue_log_class" v-if="item.activity && item.activity.type === '2'">{{$t(`砍价`)}}</span>
  7. <span class="pictrue_log pictrue_log_class" v-if="item.activity && item.activity.type === '3'">{{$t(`拼团`)}}</span>
  8. <image :src="item.recommend_image" mode="" v-if="item.recommend_image"></image>
  9. <image :src="item.image" mode="" v-else></image>
  10. </view>
  11. <view class="text line2">{{item.store_name}}</view>
  12. <view class="bottom acea-row row-between-wrapper">
  13. <view class="sales acea-row row-middle">
  14. <view class="money font-color"><text>{{$t(`¥`)}}</text>{{item.price}}</view>
  15. <view>{{$t(`已售`)}}{{item.sales}}</view>
  16. </view>
  17. <view v-if="item.stock>0">
  18. <view class="bnt"
  19. v-if="(item.activity && (item.activity.type === '1' || item.activity.type === '2' || item.activity.type === '3') || item.is_virtual) || !item.cart_button">
  20. {{$t(`立即购买`)}}</view>
  21. <view v-else>
  22. <!-- 多规格 -->
  23. <view class="bnt" @click.stop="goCartDuo(item)" v-if="item.spec_type">
  24. {{$t(`加入购物车`)}}
  25. <view class="num" v-if="isLogin && item.cart_num">{{item.cart_num}}</view>
  26. </view>
  27. <!-- 单规格 -->
  28. <view class="bnt" v-if="!item.spec_type && !item.cart_num" @click.stop="goCartDan(item,index)">
  29. {{$t(`加入购物车`)}}</view>
  30. <view class="cart acea-row row-middle" v-if="!item.spec_type && item.cart_num">
  31. <view class="pictrue iconfont icon-jianhao" @click.stop="CartNumDes(index,item)"></view>
  32. <view class="num">{{item.cart_num}}</view>
  33. <view class="pictrue iconfont icon-jiahao" @click.stop="CartNumAdd(index,item)"></view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="bnt end" v-else>{{$t(`已售罄`)}}</view>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. name: 'd_goodList',
  45. props: {
  46. dataConfig: {
  47. type: Object,
  48. default: () => {}
  49. },
  50. tempArr: {
  51. type: Array,
  52. default: []
  53. },
  54. isLogin: {
  55. type: Boolean,
  56. default: false
  57. }
  58. },
  59. data() {
  60. return {
  61. addIng: false
  62. };
  63. },
  64. created() {},
  65. mounted() {},
  66. methods: {
  67. goDetail(item) {
  68. this.$emit('detail', item);
  69. },
  70. goCartDuo(item) {
  71. this.$emit('gocartduo', item);
  72. },
  73. goCartDan(item, index) {
  74. this.$emit('gocartdan', item, index);
  75. },
  76. CartNumDes(index, item) {
  77. if (this.addIng) return
  78. this.addIng = true
  79. this.$emit('ChangeCartNumDan', false, index, item);
  80. },
  81. CartNumAdd(index, item) {
  82. if (this.addIng) return
  83. this.addIng = true
  84. this.$emit('ChangeCartNumDan', true, index, item);
  85. }
  86. }
  87. };
  88. </script>
  89. <style lang="scss">
  90. .goodsList {
  91. padding: 0 30rpx;
  92. .item {
  93. width: 100%;
  94. box-sizing: border-box;
  95. margin-bottom: 63rpx;
  96. .pictrue {
  97. width: 100%;
  98. height: 290rpx;
  99. border-radius: 16rpx;
  100. position: relative;
  101. image {
  102. width: 100%;
  103. height: 100%;
  104. border-radius: 10rpx;
  105. }
  106. }
  107. .text {
  108. font-size: 30rpx;
  109. font-family: PingFang SC;
  110. font-weight: bold;
  111. color: #282828;
  112. margin: 20rpx 0;
  113. }
  114. .bottom {
  115. .sales {
  116. font-size: 22rpx;
  117. color: #8E8E8E;
  118. .money {
  119. font-size: 42rpx;
  120. font-weight: bold;
  121. margin-right: 18rpx;
  122. text {
  123. font-size: 28rpx;
  124. }
  125. }
  126. }
  127. .cart {
  128. height: 56rpx;
  129. .pictrue {
  130. color: var(--view-theme);
  131. font-size: 46rpx;
  132. width: 50rpx;
  133. height: 50rpx;
  134. text-align: center;
  135. line-height: 50rpx;
  136. }
  137. .num {
  138. font-size: 30rpx;
  139. color: #282828;
  140. font-weight: bold;
  141. width: 80rpx;
  142. text-align: center;
  143. }
  144. }
  145. .bnt {
  146. padding: 0 30rpx;
  147. height: 56rpx;
  148. line-height: 56rpx;
  149. background: var(--view-theme);
  150. border-radius: 42rpx;
  151. font-size: 26rpx;
  152. color: #fff;
  153. position: relative;
  154. &.end {
  155. background: rgba(203, 203, 203, 1);
  156. }
  157. .num {
  158. background-color: var(--view-priceColor);
  159. min-width: 12rpx;
  160. color: #fff;
  161. border-radius: 15px;
  162. position: absolute;
  163. right: -14rpx;
  164. top: -15rpx;
  165. font-size: 22rpx;
  166. padding: 0 10rpx;
  167. height: 34rpx;
  168. line-height: 34rpx;
  169. }
  170. }
  171. }
  172. }
  173. }
  174. </style>