combination.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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">拼团活动</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:'+themeColor+';'"><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. };
  86. },
  87. created() {
  88. },
  89. mounted() {
  90. this.pink();
  91. this.getCombinationList();
  92. },
  93. methods: {
  94. // 拼团列表
  95. getCombinationList: function() {
  96. let that = this;
  97. let limit = that.$config.LIMIT;
  98. let data = {
  99. page: 1,
  100. limit: that.numConfig>=limit?limit:that.numConfig
  101. };
  102. getCombinationList(data).then(function(res) {
  103. that.combinationList = res.data;
  104. }).catch((res) => {
  105. return that.$util.Tips({
  106. title: res
  107. });
  108. })
  109. },
  110. // 拼团数据(拼团人数头部图片)
  111. pink: function() {
  112. pink().then(res => {
  113. this.pinkInfo = res.data
  114. })
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss">
  120. .scroll {
  121. white-space: nowrap;
  122. display: flex;
  123. }
  124. .group-wrapper {
  125. padding: 20rpx 20rpx 26rpx 20rpx;
  126. background: #fff;
  127. .hd {
  128. display: flex;
  129. align-items: center;
  130. justify-content: space-between;
  131. .left {
  132. display: flex;
  133. align-items: center;
  134. .name{
  135. font-size: 32rpx;
  136. font-weight: 600;
  137. }
  138. .icon {
  139. width: 36rpx;
  140. height: 36rpx;
  141. margin-right: 12rpx;
  142. }
  143. .title {
  144. width: 134rpx;
  145. height: 33rpx;
  146. }
  147. .person {
  148. display: flex;
  149. align-items: center;
  150. margin-left: 40rpx;
  151. .avatar-box {
  152. display: flex;
  153. align-items: center;
  154. image {
  155. width: 30rpx;
  156. height: 30rpx;
  157. border-radius: 50%;
  158. margin-right: -10rpx;
  159. }
  160. }
  161. .num {
  162. margin-left: 18rpx;
  163. font-size: 26rpx;
  164. color: #999999;
  165. }
  166. }
  167. }
  168. .more {
  169. font-size: 26rpx;
  170. color: #999;
  171. .iconfont {
  172. margin-left: 6rpx;
  173. font-size: 25rpx;
  174. }
  175. }
  176. }
  177. .group-scroll {
  178. width: 100%;
  179. margin-top: 25rpx;
  180. .group-item {
  181. display: inline-block;
  182. width: 220rpx;
  183. box-shadow: 0px 2px 6px 2px rgba(0, 0, 0, 0.03);
  184. border-radius: 16rpx;
  185. position: relative;
  186. background-color: #fff;
  187. .people {
  188. position: absolute;
  189. width: 140rpx;
  190. height: 32rpx;
  191. background: rgba(0, 0, 0, 0.3);
  192. box-shadow: 2rpx 2rpx 8rpx 0 rgba(0, 0, 0, 0.06);
  193. border-radius: 16rpx;
  194. top: 12rpx;
  195. left: 12rpx;
  196. font-size: 20rpx;
  197. color: #fff;
  198. text-align: center;
  199. line-height: 32rpx;
  200. }
  201. image {
  202. width: 100%;
  203. height: 220rpx;
  204. border-radius: 16rpx 16rpx 0 0;
  205. }
  206. .info {
  207. padding: 2rpx 12rpx 10rpx 12rpx;
  208. .name {
  209. font-size: 24rpx;
  210. }
  211. .price-box {
  212. display: flex;
  213. align-items: center;
  214. margin-top: 6rpx;
  215. .tips {
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. width: 76rpx;
  220. height: 30rpx;
  221. margin-right: 6rpx;
  222. border-radius: 2px;
  223. font-size: 18rpx;
  224. }
  225. .price {
  226. font-size: 28rpx;
  227. font-weight: 700;
  228. text {
  229. font-size: 18rpx;
  230. }
  231. }
  232. }
  233. }
  234. .bom-btn {
  235. display: flex;
  236. align-items: center;
  237. justify-content: center;
  238. width: 100%;
  239. height: 48rpx;
  240. border-radius: 0px 0px 16rpx 16rpx;
  241. color: #fff;
  242. font-size: 24rpx;
  243. }
  244. }
  245. }
  246. }
  247. </style>