index.vue 5.4 KB

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