bargain.vue 4.5 KB

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