bargain.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <!-- 砍价列表 -->
  3. <view v-show="!isSortType" :style="{padding:'0 '+prConfig*2+'rpx'}">
  4. <view class="barg" :class="bgStyle===0?'':'borderRadius15'" :style="'background: linear-gradient(180deg, '+ bgColor[0].item +' 0%, '+ bgColor[1].item +' 100%);margin-top:' + mbCongfig*2 +'rpx;'" v-if="bargList.length>0">
  5. <view class="title" :style="'color:'+titleColor+';'">
  6. 砍价专区·BARGAINING
  7. <!-- <image src="/static/images/barg001.png" mode=""></image> -->
  8. </view>
  9. <view class="barg-swiper">
  10. <scroll-view scroll-x="true" class="barg-scroll" show-scrollbar="true">
  11. <view class="wrapper">
  12. <block v-for="(item,index) in bargList" :key="index">
  13. <view class='list-box' :style="'margin-right:'+productGap*2+'rpx;'" @click="bargDetail(item)">
  14. <image :src="item.image" mode="aspectFill" class="slide-image"></image>
  15. <view class="info-txt" v-if="priceShow||bntShow">
  16. <view v-if="priceShow" class="price" :style="'color:'+fontColor+';'"><text>¥</text>{{item.price}}</view>
  17. <!-- #ifdef H5 || APP-PLUS -->
  18. <slot name="center" :item="item"></slot>
  19. <!-- #endif -->
  20. <!-- #ifdef MP -->
  21. <slot name="center{{index}}"></slot>
  22. <!-- #endif -->
  23. <view v-if="bntShow" class="txt" :style="'background-color:'+ themeColor +';'">立即砍价</view>
  24. </view>
  25. </view>
  26. </block>
  27. <navigator url="/pages/activity/goods_bargain/index" hover-class="none" class="more-box">
  28. <view class="txt">查看更多</view>
  29. <image src="/static/images/mores.png"></image>
  30. </navigator>
  31. </view>
  32. </scroll-view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. getBargainList
  40. } from '@/api/activity.js';
  41. export default {
  42. name: 'bargain',
  43. props: {
  44. dataConfig: {
  45. type: Object,
  46. default: () => {}
  47. },
  48. isSortType:{
  49. type: String | Number,
  50. default:0
  51. }
  52. },
  53. data() {
  54. return {
  55. bargList: [],
  56. numConfig: this.dataConfig.numConfig.val,//显示砍价列表数量
  57. themeColor: this.dataConfig.themeColor.color[0].item,//主题颜色
  58. titleColor: this.dataConfig.titleColor.color[0].item,//标题颜色
  59. bgColor: this.dataConfig.bgColor.color,//背景颜色
  60. mbCongfig: this.dataConfig.mbCongfig.val,
  61. productGap: this.dataConfig.productGap.val,
  62. priceShow: this.dataConfig.priceShow.val, //是否显示价格
  63. bntShow: this.dataConfig.bntShow.val, //是否显示按钮
  64. bgStyle: this.dataConfig.bgStyle.val,//设置背景样式
  65. prConfig: this.dataConfig.prConfig.val,//设置背景边距
  66. fontColor:this.dataConfig.fontColor.color[0].item,
  67. };
  68. },
  69. created() {},
  70. mounted() {
  71. this.getBargainList();
  72. },
  73. methods: {
  74. // 砍价列表
  75. getBargainList() {
  76. let limit = this.$config.LIMIT;
  77. getBargainList({
  78. page: 1,
  79. limit: this.numConfig>=limit?limit:this.numConfig
  80. }).then(res => {
  81. this.bargList = res.data
  82. })
  83. },
  84. bargDetail(item){
  85. this.$emit('changeBarg', item);
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. .barg-scroll {
  92. white-space: nowrap;
  93. display: flex;
  94. }
  95. .barg {
  96. padding-bottom: 32rpx;
  97. padding-left: 20rpx;
  98. background:linear-gradient(180deg,rgba(253,219,178,1) 0%,rgba(253,239,198,1) 100%);
  99. background-size: 100% 100%;
  100. box-sizing: border-box;
  101. .title {
  102. display: flex;
  103. align-items: center;
  104. justify-content: center;
  105. padding-top: 42rpx;
  106. font-size: 38rpx;
  107. color: #FF6000;
  108. font-weight: bold;
  109. image {
  110. width: 463rpx;
  111. height: 39rpx;
  112. }
  113. }
  114. .barg-swiper {
  115. margin-top: 43rpx;
  116. padding-right: 20rpx;
  117. .wrapper {
  118. display: flex;
  119. }
  120. .list-box {
  121. flex-shrink: 0;
  122. width: 210rpx;
  123. background-color: #fff;
  124. border-radius: 16rpx;
  125. overflow: hidden;
  126. margin-right: 20rpx;
  127. image {
  128. width: 100%;
  129. height: 210rpx;
  130. }
  131. .info-txt {
  132. width: 100%;
  133. display: flex;
  134. flex-direction: column;
  135. align-items: center;
  136. justify-content: center;
  137. padding-top: 4rpx;
  138. padding-bottom: 18rpx;
  139. .price {
  140. font-weight: 700;
  141. color: $theme-color;
  142. font-size: 28rpx;
  143. text{
  144. font-size: 18rpx;
  145. }
  146. }
  147. .txt {
  148. display: flex;
  149. align-items: center;
  150. justify-content: center;
  151. width: 136rpx;
  152. height: 33rpx;
  153. margin-top: 10rpx;
  154. border-radius: 17px;
  155. font-size: 18rpx;
  156. color: #fff;
  157. }
  158. }
  159. }
  160. .more-box {
  161. flex-shrink: 0;
  162. display: flex;
  163. flex-direction: column;
  164. align-items: center;
  165. justify-content: center;
  166. width: 80rpx;
  167. background-color: #fff;
  168. border-radius: 16rpx;
  169. image {
  170. width: 24rpx;
  171. height: 24rpx;
  172. margin-top: 10rpx;
  173. }
  174. .txt {
  175. display: block;
  176. writing-mode: vertical-lr;
  177. font-size: 26rpx;
  178. line-height: 1.2;
  179. }
  180. }
  181. }
  182. }
  183. </style>