index.vue 4.6 KB

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