index.vue 5.2 KB

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