combination.vue 6.5 KB

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