promotionList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <!-- 促销列表 -->
  3. <view class="index-product-wrapper" :class="iSshowH?'on':''" :style="'margin-top:'+mbConfig*2+'rpx;'" v-show="!isSortType">
  4. <view class="nav-bd" :style="{justifyContent:titleConfig===0?'flex-start':titleConfig===1?'space-around':'flex-end'}">
  5. <view class="item" v-for="(item,index) in explosiveMoney" :index="index" @click="ProductNavTab(item.link.activeVal,index)">
  6. <view class="txt" :style="{ 'color': index==ProductNavindex ? themeColor : '' }">{{item.chiild[0].val}}</view>
  7. <view class="label" :style="{ 'background': index==ProductNavindex ? themeColor : '','color': index==ProductNavindex ? '#fff' : '' }">{{item.chiild[1].val}}</view>
  8. </view>
  9. </view>
  10. <view class="list-box animated" :class='tempArr.length > 0?"fadeIn on":""'>
  11. <view class="item" v-for="(item,index) in tempArr" :key="index" @click="goDetail(item)">
  12. <view class="pictrue">
  13. <span class="pictrue_log pictrue_log_class" :style="'background-color:'+labelColor" v-if="item.activity && item.activity.type === '1'">秒杀</span>
  14. <span class="pictrue_log pictrue_log_class" :style="'background-color:'+labelColor" v-if="item.activity && item.activity.type === '2'">砍价</span>
  15. <span class="pictrue_log pictrue_log_class" :style="'background-color:'+labelColor" v-if="item.activity && item.activity.type === '3'">拼团</span>
  16. <image :src="item.image" mode="aspectFill"></image>
  17. </view>
  18. <view class="text-info">
  19. <view class="title line1" v-if="titleShow">{{item.store_name}}</view>
  20. <!-- #ifdef H5 || APP-PLUS -->
  21. <slot name="center" :item="item"></slot>
  22. <!-- #endif -->
  23. <!-- #ifdef MP -->
  24. <slot name="center{{index}}"></slot>
  25. <!-- #endif -->
  26. <view class="old-price" v-if="opriceShow"><text>¥</text>{{item.ot_price}}</view>
  27. <view class="price" :style="{color:fontColor}">
  28. <view v-if="priceShow">
  29. <text>¥</text>{{item.price}}
  30. </view>
  31. <view class="txt" :style="'border:1px solid '+labelColor+';color:'+labelColor" :class="priceShow?'':'on'" v-if="item.checkCoupon && couponShow">券</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. name: 'promotionList',
  41. props: {
  42. dataConfig: {
  43. type: Object,
  44. default: () => {}
  45. },
  46. tempArr: {
  47. type: Array,
  48. default: []
  49. },
  50. iSshowH: {
  51. type: Boolean,
  52. default: false
  53. },
  54. isSortType:{
  55. type: String | Number,
  56. default:0
  57. }
  58. },
  59. data() {
  60. return {
  61. ProductNavindex: 0,
  62. explosiveMoney: this.dataConfig.tabConfig.list,
  63. numConfig: this.dataConfig.numConfig.val,
  64. // imgStyle: this.dataConfig.imgStyle.type,
  65. mbConfig: this.dataConfig.mbConfig.val,
  66. themeColor: this.dataConfig.themeColor.color[0].item,
  67. titleShow: this.dataConfig.titleShow.val, //标题是否显示
  68. opriceShow: this.dataConfig.opriceShow.val, //原价是否显示
  69. priceShow: this.dataConfig.priceShow.val, //价格是否显示
  70. couponShow: this.dataConfig.couponShow.val,//优惠券标签是否显示
  71. titleConfig: this.dataConfig.titleConfig.type, //标题位置
  72. fontColor: this.dataConfig.fontColor.color?this.dataConfig.fontColor.color[0].item:'',
  73. labelColor: this.dataConfig.labelColor.color?this.dataConfig.labelColor.color[0].item:''
  74. };
  75. },
  76. created() {
  77. },
  78. methods: {
  79. // 首发新品切换
  80. ProductNavTab(type, index) {
  81. this.ProductNavindex = index;
  82. this.$emit('changeTab', type);
  83. },
  84. goDetail(item){
  85. this.$emit('detail',item);
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. .index-product-wrapper {
  92. margin: 30rpx 20rpx 0 20rpx;
  93. &.on {
  94. min-height: 1500rpx;
  95. }
  96. .nav-bd {
  97. display: flex;
  98. align-items: center;
  99. margin-top: 30rpx;
  100. .item {
  101. display: flex;
  102. flex-direction: column;
  103. align-items: center;
  104. justify-content: center;
  105. width: 25%;
  106. &.on{
  107. border-radius: 0;
  108. }
  109. .txt {
  110. font-size: 32rpx;
  111. color: #282828;
  112. }
  113. .label {
  114. display: flex;
  115. align-items: center;
  116. justify-content: center;
  117. width: 124rpx;
  118. height: 32rpx;
  119. margin-top: 5rpx;
  120. font-size: 24rpx;
  121. color: #999;
  122. border-radius: 16rpx;
  123. }
  124. }
  125. }
  126. .list-box {
  127. display: flex;
  128. flex-wrap: wrap;
  129. justify-content: space-between;
  130. margin-top: 30rpx;
  131. .item {
  132. width: 345rpx;
  133. margin-bottom: 20rpx;
  134. background-color: #fff;
  135. border-radius: 20rpx;
  136. overflow: hidden;
  137. position: relative;
  138. .pictrue_log {
  139. width: 92rpx;
  140. height: 44rpx;
  141. font-size: 26rpx;
  142. line-height: 44rpx;
  143. }
  144. image {
  145. width: 100%;
  146. height: 346rpx;
  147. display: block;
  148. }
  149. .text-info {
  150. padding: 10rpx 20rpx 15rpx;
  151. .title {
  152. color: #222222;
  153. }
  154. .old-price {
  155. margin-top: 4rpx;
  156. font-size: 26rpx;
  157. color: #AAAAAA;
  158. text-decoration: line-through;
  159. text {
  160. margin-right: 2px;
  161. font-size: 20rpx;
  162. }
  163. }
  164. .price {
  165. display: flex;
  166. align-items: flex-end;
  167. font-size: 36rpx;
  168. font-weight: 550;
  169. text {
  170. padding-bottom: 4rpx;
  171. font-size: 26rpx;
  172. font-weight: normal;
  173. }
  174. .txt {
  175. display: flex;
  176. align-items: center;
  177. justify-content: center;
  178. width: 28rpx;
  179. height: 28rpx;
  180. margin-left: 15rpx;
  181. margin-bottom: 10rpx;
  182. border-radius: 4rpx;
  183. font-size: 20rpx;
  184. font-weight: normal;
  185. &.on{
  186. margin-left: 0;
  187. }
  188. }
  189. }
  190. }
  191. }
  192. &.on {
  193. display: flex;
  194. }
  195. }
  196. }
  197. </style>