bargain.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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:'+themeColor+';'"><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" class="more-box" hover-class="none">
  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. };
  67. },
  68. created() {},
  69. mounted() {
  70. this.getBargainList();
  71. },
  72. methods: {
  73. // 砍价列表
  74. getBargainList() {
  75. let limit = this.$config.LIMIT;
  76. getBargainList({
  77. page: 1,
  78. limit: this.numConfig>=limit?limit:this.numConfig
  79. }).then(res => {
  80. this.bargList = res.data
  81. })
  82. },
  83. bargDetail(item){
  84. this.$emit('changeBarg', item);
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss">
  90. .barg-scroll {
  91. white-space: nowrap;
  92. display: flex;
  93. }
  94. .barg {
  95. padding-bottom: 32rpx;
  96. padding-left: 20rpx;
  97. background:linear-gradient(180deg,rgba(253,219,178,1) 0%,rgba(253,239,198,1) 100%);
  98. background-size: 100% 100%;
  99. box-sizing: border-box;
  100. .title {
  101. display: flex;
  102. align-items: center;
  103. justify-content: center;
  104. padding-top: 42rpx;
  105. font-size: 38rpx;
  106. color: #FF6000;
  107. font-weight: bold;
  108. image {
  109. width: 463rpx;
  110. height: 39rpx;
  111. }
  112. }
  113. .barg-swiper {
  114. margin-top: 43rpx;
  115. padding-right: 20rpx;
  116. .wrapper {
  117. display: flex;
  118. }
  119. .list-box {
  120. flex-shrink: 0;
  121. width: 210rpx;
  122. background-color: #fff;
  123. border-radius: 16rpx;
  124. overflow: hidden;
  125. margin-right: 20rpx;
  126. image {
  127. width: 100%;
  128. height: 210rpx;
  129. }
  130. .info-txt {
  131. width: 100%;
  132. display: flex;
  133. flex-direction: column;
  134. align-items: center;
  135. justify-content: center;
  136. padding-top: 4rpx;
  137. padding-bottom: 18rpx;
  138. .price {
  139. font-weight: 700;
  140. color: $theme-color;
  141. font-size: 28rpx;
  142. text{
  143. font-size: 18rpx;
  144. }
  145. }
  146. .txt {
  147. display: flex;
  148. align-items: center;
  149. justify-content: center;
  150. width: 136rpx;
  151. height: 33rpx;
  152. margin-top: 10rpx;
  153. border-radius: 17px;
  154. font-size: 18rpx;
  155. color: #fff;
  156. }
  157. }
  158. }
  159. .more-box {
  160. flex-shrink: 0;
  161. display: flex;
  162. flex-direction: column;
  163. align-items: center;
  164. justify-content: center;
  165. width: 80rpx;
  166. background-color: #fff;
  167. border-radius: 16rpx;
  168. image {
  169. width: 24rpx;
  170. height: 24rpx;
  171. margin-top: 10rpx;
  172. }
  173. .txt {
  174. display: block;
  175. writing-mode: vertical-lr;
  176. font-size: 26rpx;
  177. line-height: 1.2;
  178. }
  179. }
  180. }
  181. }
  182. </style>