index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. <image :src="item.recommend_image" mode="aspectFill" v-if="item.recommend_image"></image>
  10. <image :src="item.image" mode="aspectFill" v-else></image>
  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. export default {
  56. name: 'd_goodList',
  57. props: {
  58. dataConfig: {
  59. type: Object,
  60. default: () => {}
  61. },
  62. tempArr:{
  63. type: Array,
  64. default: () => []
  65. },
  66. isLogin:{
  67. type: Boolean,
  68. default:false
  69. }
  70. },
  71. data() {
  72. return {
  73. };
  74. },
  75. created() {},
  76. mounted() {},
  77. methods: {
  78. goDetail(item){
  79. this.$emit('detail',item);
  80. },
  81. goCartDuo(item){
  82. this.$emit('gocartduo',item);
  83. },
  84. goCartDan(item,index){
  85. this.$emit('gocartdan',item,index);
  86. },
  87. CartNumDes(index,item){
  88. this.$emit('ChangeCartNumDan', false,index,item);
  89. },
  90. CartNumAdd(index,item){
  91. if(item.is_limit && item.cart_num>=item.limit_num){
  92. this.$util.Tips({
  93. title: "购买最多不能超过"+item.limit_num
  94. });
  95. }else{
  96. this.$emit('ChangeCartNumDan', true,index,item);
  97. }
  98. }
  99. }
  100. };
  101. </script>
  102. <style lang="scss">
  103. .goodsList{
  104. padding: 0 30rpx;
  105. .item{
  106. width: 100%;
  107. box-sizing: border-box;
  108. margin-bottom: 63rpx;
  109. .pictrue{
  110. width: 100%;
  111. height: 290rpx;
  112. border-radius: 16rpx;
  113. position: relative;
  114. image{
  115. width: 100%;
  116. height: 100%;
  117. border-radius: 16rpx;
  118. }
  119. }
  120. .text{
  121. font-size:30rpx;
  122. font-family:PingFang SC;
  123. font-weight:bold;
  124. color: #282828;
  125. margin: 20rpx 0;
  126. }
  127. .bottom{
  128. .sales{
  129. font-size: 22rpx;
  130. color: #8E8E8E;
  131. .money{
  132. font-size: 42rpx;
  133. font-weight: bold;
  134. margin-right: 16rpx;
  135. text{
  136. font-size: 28rpx;
  137. }
  138. }
  139. }
  140. .cart{
  141. height: 56rpx;
  142. .pictrue{
  143. color: var(--view-theme);
  144. font-size:46rpx;
  145. width: 50rpx;
  146. height: 50rpx;
  147. text-align: center;
  148. line-height: 50rpx;
  149. }
  150. .num{
  151. font-size: 30rpx;
  152. color: #282828;
  153. font-weight: bold;
  154. width: 80rpx;
  155. text-align: center;
  156. }
  157. }
  158. .bnt{
  159. padding: 0 30rpx;
  160. height: 55rpx;
  161. background:var(--view-theme);
  162. border-radius:42rpx;
  163. font-size: 26rpx;
  164. color: #fff;
  165. position: relative;
  166. &.end{
  167. background:rgba(203,203,203,1);
  168. }
  169. .num{
  170. min-width: 14rpx;
  171. background-color: #fff;
  172. color: var(--view-theme);
  173. border-radius: 15px;
  174. position: absolute;
  175. right: -14rpx;
  176. top: -15rpx;
  177. font-size: 20rpx;
  178. padding: 0 10rpx;
  179. border: 1px solid var(--view-theme);
  180. }
  181. }
  182. }
  183. }
  184. }
  185. </style>