combination.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view v-show="!isSortType">
  3. <view class="group-wrapper" :class="conStyle?'borderRadius20':''" :style="'background:'+bgColor+';margin:0 '+prConfig*2+'rpx;margin-top:'+ mbConfig*2 +'rpx;'" v-if="combinationList.length>0">
  4. <view class="hd">
  5. <view class="left">
  6. <image :src="imgUrl" mode=""v-if="imgUrl" class="icon"></image>
  7. <image src="/static/images/group02.gif" class="icon" v-else></image>
  8. <view class="name">{{$t(`拼团活动`)}}</view>
  9. <!-- <image src="/static/images/group01.png" class="title"></image> -->
  10. <view class="person">
  11. <view class="avatar-box">
  12. <block v-for="(item,index) in pinkInfo.avatars" :key="index">
  13. <image :src="item" mode=""></image>
  14. </block>
  15. </view>
  16. <view class="num" v-if="pinkInfo.pink_count>0">{{pinkInfo.pink_count}} {{$t(`人拼团成功.`)}}</view>
  17. </view>
  18. </view>
  19. <navigator class="more" url="/pages/activity/goods_combination/index" hover-class="none">{{$t(`更多`)}} <text class="iconfont icon-jiantou"></text></navigator>
  20. </view>
  21. <view class="group-scroll">
  22. <scroll-view scroll-x="true" style="white-space: nowrap; display: flex" show-scrollbar="false">
  23. <navigator class="group-item" :style="'margin-right:'+ lrConfig*2 +'rpx;'" v-for="(item,index) in combinationList" :key="index"
  24. :url="'/pages/activity/goods_combination_details/index?id='+item.id" hover-class="none">
  25. <image :src="item.image" mode="aspectFill"></image>
  26. <view class="people" v-if="joinShow">{{item.people}}{{$t(`人团`)}}</view>
  27. <view class="info">
  28. <view class="name line1" v-if="titleShow">{{item.title}}</view>
  29. <view class="price-box">
  30. <!-- <text v-if="pinkShow" class="tips" :style="'background-color:'+txtColor+';color:'+themeColor+';'">{{$t(`拼团价`)}}</text> -->
  31. <text v-if="priceShow" class="price" :style="'color:'+themeColor+';'"><text>{{$t(`¥`)}}</text>{{item.price}}</text>
  32. </view>
  33. </view>
  34. <view v-if="bntShow" class="bom-btn" :style="'background-color:'+themeColor+';'">{{$t(`参与拼团`)}}</view>
  35. </navigator>
  36. </scroll-view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. pink
  44. } from '@/api/api.js';
  45. import {
  46. getCombinationList
  47. } from '@/api/activity.js';
  48. export default {
  49. name: 'combination',
  50. props: {
  51. dataConfig: {
  52. type: Object,
  53. default: () => {}
  54. },
  55. isSortType:{
  56. type: String | Number,
  57. default:0
  58. }
  59. },
  60. data() {
  61. return {
  62. pinkInfo: '',
  63. combinationList: [],
  64. numConfig:this.dataConfig.numConfig.val,
  65. txtColor:this.dataConfig.txtColor.color[0].item,
  66. themeColor:this.dataConfig.themeColor.color[0].item,
  67. mbConfig:this.dataConfig.mbConfig.val,
  68. lrConfig:this.dataConfig.lrConfig.val,
  69. imgUrl:this.dataConfig.imgConfig.url,
  70. priceShow:this.dataConfig.priceShow.val,//是否显示价格
  71. bntShow:this.dataConfig.bntShow.val,//是否显示按钮
  72. titleShow:this.dataConfig.titleShow.val,//是否显示标题
  73. pinkShow:this.dataConfig.pinkShow.val,//是否显示拼团标签
  74. joinShow:this.dataConfig.joinShow.val,//是否显示参团标签
  75. prConfig:this.dataConfig.prConfig.val,
  76. bgColor:this.dataConfig.bgColor.color[0].item,
  77. conStyle:this.dataConfig.conStyle.type
  78. };
  79. },
  80. created() {
  81. },
  82. mounted() {
  83. this.pink();
  84. this.getCombinationList();
  85. },
  86. methods: {
  87. // 拼团列表
  88. getCombinationList: function() {
  89. let that = this;
  90. let limit = that.$config.LIMIT;
  91. let data = {
  92. page: 1,
  93. limit: that.numConfig>=limit?limit:that.numConfig
  94. };
  95. getCombinationList(data).then(function(res) {
  96. that.combinationList = res.data;
  97. }).catch((res) => {
  98. return that.$util.Tips({
  99. title: res
  100. });
  101. })
  102. },
  103. // 拼团数据(拼团人数头部图片)
  104. pink: function() {
  105. pink().then(res => {
  106. this.pinkInfo = res.data
  107. })
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. .group-wrapper {
  114. padding: 20rpx 20rpx 26rpx 20rpx;
  115. background: #fff;
  116. .hd {
  117. display: flex;
  118. align-items: center;
  119. justify-content: space-between;
  120. .left {
  121. display: flex;
  122. align-items: center;
  123. .name{
  124. font-size: 32rpx;
  125. font-weight: 600;
  126. }
  127. .icon {
  128. width: 36rpx;
  129. height: 36rpx;
  130. margin-right: 12rpx;
  131. }
  132. .title {
  133. width: 134rpx;
  134. height: 33rpx;
  135. }
  136. .person {
  137. display: flex;
  138. align-items: center;
  139. margin-left: 40rpx;
  140. .avatar-box {
  141. display: flex;
  142. align-items: center;
  143. image {
  144. width: 30rpx;
  145. height: 30rpx;
  146. border-radius: 50%;
  147. margin-right: -10rpx;
  148. }
  149. }
  150. .num {
  151. margin-left: 18rpx;
  152. font-size: 26rpx;
  153. color: #999999;
  154. }
  155. }
  156. }
  157. .more {
  158. font-size: 26rpx;
  159. color: #999;
  160. .iconfont {
  161. margin-left: 6rpx;
  162. font-size: 25rpx;
  163. }
  164. }
  165. }
  166. .group-scroll {
  167. width: 100%;
  168. margin-top: 25rpx;
  169. .group-item {
  170. display: inline-block;
  171. width: 220rpx;
  172. box-shadow: 0px 2px 6px 2px rgba(0, 0, 0, 0.03);
  173. border-radius: 16rpx;
  174. position: relative;
  175. background-color: #fff;
  176. .people {
  177. position: absolute;
  178. width: 140rpx;
  179. height: 32rpx;
  180. background: rgba(0, 0, 0, 0.1);
  181. box-shadow: 2rpx 2rpx 8rpx 0 rgba(0, 0, 0, 0.06);
  182. border-radius: 16rpx;
  183. top: 12rpx;
  184. left: 12rpx;
  185. font-size: 20rpx;
  186. color: #fff;
  187. text-align: center;
  188. line-height: 32rpx;
  189. }
  190. image {
  191. width: 100%;
  192. height: 220rpx;
  193. border-radius: 16rpx 16rpx 0 0;
  194. }
  195. .info {
  196. padding: 2rpx 12rpx 10rpx 12rpx;
  197. .name {
  198. font-size: 24rpx;
  199. }
  200. .price-box {
  201. display: flex;
  202. align-items: center;
  203. margin-top: 6rpx;
  204. .tips {
  205. display: flex;
  206. align-items: center;
  207. justify-content: center;
  208. width: 76rpx;
  209. height: 30rpx;
  210. margin-right: 6rpx;
  211. border-radius: 2px;
  212. font-size: 18rpx;
  213. }
  214. .price {
  215. font-size: 28rpx;
  216. font-weight: 700;
  217. text {
  218. font-size: 18rpx;
  219. }
  220. }
  221. }
  222. }
  223. .bom-btn {
  224. display: flex;
  225. align-items: center;
  226. justify-content: center;
  227. width: 100%;
  228. height: 48rpx;
  229. border-radius: 0px 0px 16rpx 16rpx;
  230. color: #fff;
  231. font-size: 24rpx;
  232. }
  233. }
  234. }
  235. }
  236. </style>