combination.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <!-- 拼团活动 -->
  3. <view>
  4. <view :style="[boxStyle]" v-if="combinationList.length">
  5. <view :style="[boxContentStyle]">
  6. <!-- 拼团头部 -->
  7. <view class="w-full h-96 px-24 flex-between-center bg-cover" :style="[headerStyle]">
  8. <view class="flex-y-center">
  9. <text class="fs-32 lh-44rpx fw-500" v-if="titleConfig">{{titleTxtConfig}}</text>
  10. <image :src="titleImg" class="w-140 h-32" v-else></image>
  11. <text class="fs-28 text--w111-ccc px-16" :style="[dividerColor]">|</text>
  12. <view class="avatar-group flex-y-center">
  13. <image v-for="(item,index) in pinkInfo.avatars" :key="index"
  14. :src="item" mode="" class="w-36 h-36 rd-50-p111-"></image>
  15. </view>
  16. <text class="fs-26 text--w111-999 lh-36rpx ml-22" :style="[tipsColor]">{{pinkInfo.pink_count}}人拼团成功</text>
  17. </view>
  18. <view class="flex-y-center fs-24 text--w111-999" :style="[headerBntColor]" @tap="goPage('/pages/activity/goods_combination/index')">
  19. <text>{{rightBntTxt}}</text>
  20. <text class="iconfont icon-ic_rightarrow fs-24"></text>
  21. </view>
  22. </view>
  23. <!-- 拼团列表 -->
  24. <!-- 单列 -->
  25. <view class="pt-32 pr-20 pb-32 pl-20 bg--w111-fff" :style="[contentBox]" v-if="goodStyleConfig == 0">
  26. <view class="w-full flex justify-between item"
  27. v-for="(item,index) in combinationList" :key="index"
  28. @tap="goDetail(item)">
  29. <easy-loadimage
  30. :image-src="item.image"
  31. width="240rpx"
  32. height="240rpx"
  33. :borderRadius="imgStyle"></easy-loadimage>
  34. <view class="flex-1 flex-col justify-between pl-20 h-240">
  35. <view class="w-full">
  36. <view class="w-full fs-28 h-80 lh-40rpx line2" :style="[productStyle]"
  37. v-if="checkboxInfo.includes(0)">{{item.title}}</view>
  38. <view class="flex mt-14" v-if="checkboxInfo.includes(1)">
  39. <view class="flex fs-20 rd-8rpx" :style="[labelBg]">
  40. <text class="tuan-num text--w111-fff flex-center">{{item.people}}人团</text>
  41. <text class="complete flex-center" :style="[pinkNumStyle]">已拼{{item.pink_count}}份</text>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="flex justify-between items-end">
  46. <view class="flex-col">
  47. <baseMoney
  48. :money="item.price"
  49. symbolSize="24"
  50. integerSize="36"
  51. decimalSize="36"
  52. weight
  53. :color="priceColor"
  54. preFix="拼团价"
  55. preFixSize="24"
  56. :textColor="priceColor"
  57. v-if="checkboxInfo.includes(2)"></baseMoney>
  58. <text class="text-line fs-28 text--w111-999 pt-14 Regular"
  59. v-if="checkboxInfo.includes(3)"
  60. :style="[otPriceColor]">¥{{item.ot_price}}</text>
  61. </view>
  62. <view class='w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff'
  63. v-if="!showBtn" :style="[btnBgColor]">去拼团</view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 两列 -->
  69. <view class="grid-column-2 grid-gap-22rpx pt-32 pr-20 pb-32 pl-20" v-if="goodStyleConfig == 1">
  70. <view v-for="(item,index) in combinationList" :key="index"
  71. @tap="goDetail(item)">
  72. <easy-loadimage
  73. :image-src="item.image"
  74. width="100%"
  75. height="324rpx"
  76. :borderRadius="imgStyle"></easy-loadimage>
  77. <view class="w-full mt-16 flex-y-center"
  78. :style="[productStyle]"
  79. v-if="checkboxInfo.includes(0)">
  80. <view class="flex fs-20 rd-4rpx" :style="[labelBg]">
  81. <text class="complete flex-center rd-4rpx" :style="[pinkNumStyle]">{{item.people}}人团</text>
  82. </view>
  83. <view class="w-234 line1 fs-28 lh-40rpx pl-10">{{item.title}}</view>
  84. </view>
  85. <view class="flex justify-between items-end mt-10">
  86. <view class="flex-col">
  87. <baseMoney
  88. :money="item.price"
  89. symbolSize="24"
  90. integerSize="36"
  91. decimalSize="36"
  92. weight
  93. :color="priceColor"
  94. v-if="checkboxInfo.includes(2)"></baseMoney>
  95. <text class="text-line fs-28 text--w111-999 pt-14 Regular"
  96. v-if="checkboxInfo.includes(3)" :style="[otPriceColor]">¥{{item.ot_price}}</text>
  97. </view>
  98. <view class='w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg--w111-E93323'
  99. v-if="!showBtn" :style="[btnBgColor]">去拼团</view>
  100. </view>
  101. </view>
  102. </view>
  103. <!-- 三列 -->
  104. <view class="grid-column-3 grid-gap-18rpx pt-32 pr-20 pb-32 pl-20" v-if="goodStyleConfig == 2">
  105. <view class="relative" v-for="(item,index) in combinationList" :key="index"
  106. @tap="goDetail(item)">
  107. <view class="abs-tag z-20" :style="[labelBg]">
  108. <text class="circle-tag flex-center fs-22" :style="[pinkNumStyle]">{{item.people}}人团</text>
  109. </view>
  110. <easy-loadimage
  111. :image-src="item.image"
  112. width="100%"
  113. height="212rpx"
  114. :borderRadius="imgStyle"></easy-loadimage>
  115. <view class="w-full line1 mt-16 fs-26" :style="[productStyle]"
  116. v-if="checkboxInfo.includes(0)">{{item.title}}</view>
  117. <view class="flex items-baseline">
  118. <baseMoney :money="item.price"
  119. symbolSize="24"
  120. integerSize="36"
  121. decimalSize="36"
  122. weight
  123. :color="priceColor"
  124. v-if="checkboxInfo.includes(2)"></baseMoney>
  125. </view>
  126. <view class="text-line fs-24 text--w111-999 Regular lh-32rpx"
  127. :style="[otPriceColor]" v-if="checkboxInfo.includes(3)">¥{{item.ot_price}}</view>
  128. </view>
  129. </view>
  130. <!-- 滑动 -->
  131. <scroll-view scroll-x="true" show-scrollbar="false"
  132. class="white-nowrap vertical-middle w-full pt-32 pb-32"
  133. v-if="goodStyleConfig == 3">
  134. <view class="inline-block ml-20 relative"
  135. v-for="(item,index) in combinationList" :key="index"
  136. @tap="goDetail(item)">
  137. <view class="abs-tag z-20" :style="[labelBg]">
  138. <text class="circle-tag flex-center fs-22" :style="[pinkNumStyle]">{{item.people}}人团</text>
  139. </view>
  140. <easy-loadimage
  141. :image-src="item.image"
  142. width="224rpx"
  143. height="224rpx"
  144. :borderRadius="imgStyle"></easy-loadimage>
  145. <view class="w-222 line1 mt-16 fs-26" :style="[productStyle]"
  146. v-if="checkboxInfo.includes(0)">{{item.title}}</view>
  147. <baseMoney :money="item.price"
  148. symbolSize="24"
  149. integerSize="36"
  150. decimalSize="36"
  151. weight
  152. :color="priceColor"
  153. v-if="checkboxInfo.includes(2)"></baseMoney>
  154. </view>
  155. </scroll-view>
  156. </view>
  157. </view>
  158. </view>
  159. </template>
  160. <script>
  161. import { openPinkSubscribe } from '@/utils/SubscribeMessage.js';
  162. import {pink} from '@/api/api.js';
  163. import {getCombinationList} from '@/api/activity.js';
  164. export default {
  165. name: 'combination',
  166. props: {
  167. dataConfig: {
  168. type: Object,
  169. default: () => {}
  170. },
  171. isSortType:{
  172. type: String | Number,
  173. default:0
  174. }
  175. },
  176. data() {
  177. return {
  178. pinkInfo: '',
  179. combinationList: [],
  180. };
  181. },
  182. computed:{
  183. boxStyle(){
  184. return {
  185. padding: `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.prConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
  186. marginTop: `${this.dataConfig.mbConfig.val * 2}rpx`,
  187. background: this.dataConfig.bottomBgColor.color[0].item,
  188. }
  189. },
  190. boxContentStyle() {
  191. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  192. if (this.dataConfig.fillet.type) {
  193. borderRadius =
  194. `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx`;
  195. }
  196. return {
  197. borderRadius,
  198. background: `linear-gradient(90deg, ${this.dataConfig.moduleColor.color[0].item} 0%, ${this.dataConfig.moduleColor.color[1].item} 100%)`,
  199. };
  200. },
  201. contentBox(){
  202. let br = `${this.dataConfig.fillet.val * 2}rpx`,
  203. borderRadius= '',
  204. imgBgUrl = this.dataConfig.imgBgConfig.url;
  205. if (this.dataConfig.fillet.type){
  206. borderRadius = `0 0 ${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx`
  207. }else{
  208. borderRadius = `0 0 ${br} ${br}`
  209. }
  210. return {
  211. borderRadius,
  212. }
  213. },
  214. /*商品模板*/
  215. goodStyleConfig(){
  216. return this.dataConfig.goodStyleConfig.tabVal
  217. },
  218. styleConfig(){
  219. return this.dataConfig.styleConfig.tabVal
  220. },
  221. headerStyle(){
  222. let br = `${this.dataConfig.fillet.val * 2}rpx`,
  223. borderRadius= '',
  224. imgBgUrl = this.dataConfig.imgBgConfig.url;
  225. if (this.dataConfig.fillet.type){
  226. borderRadius = `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx 0 0`
  227. }else{
  228. borderRadius = `${br} ${br} 0 0`
  229. }
  230. return {
  231. backgroundImage: this.styleConfig ? 'url(' + imgBgUrl + ')' : `linear-gradient(90deg,${this.dataConfig.headerBgColor.color[0].item} 0%,${this.dataConfig.headerBgColor.color[0].item} 100%)`,
  232. borderRadius,
  233. }
  234. },
  235. /*标题是文本还是图片*/
  236. titleConfig(){
  237. return this.dataConfig.titleConfig.tabVal
  238. },
  239. /*标题文本*/
  240. titleTxtConfig(){
  241. return this.dataConfig.titleTxtConfig.value
  242. },
  243. /*标题图片*/
  244. titleImg(){
  245. return this.styleConfig ? this.titleUrl : this.titleColorUrl
  246. },
  247. titleColorUrl(){
  248. return this.dataConfig.imgColorConfig.url
  249. },
  250. titleUrl(){
  251. return this.dataConfig.imgConfig.url
  252. },
  253. /*标题提示文字*/
  254. tipsColor(){
  255. return {
  256. color: this.styleConfig ? this.dataConfig.tipsColor.color[0].item : this.dataConfig.tipsColor2.color[0].item
  257. }
  258. },
  259. /*分割线颜色*/
  260. dividerColor(){
  261. return {
  262. color: this.dataConfig.dividerColor.color[0].item
  263. }
  264. },
  265. /*头部按钮文本*/
  266. rightBntTxt(){
  267. return this.dataConfig.rightBntConfig.value
  268. },
  269. /*头部按钮样式*/
  270. headerBntColor(){
  271. return {
  272. color: this.styleConfig ? this.dataConfig.headerBntColor.color[0].item : this.dataConfig.headerBntColor2.color[0].item,
  273. fontSize: `${this.dataConfig.bntNumber.val * 2}rpx`
  274. }
  275. },
  276. /*商品图片圆角样式*/
  277. imgStyle(){
  278. let borderRadius = `${this.dataConfig.filletImg.val * 2}rpx`;
  279. if (this.dataConfig.filletImg.type) {
  280. borderRadius =
  281. `${this.dataConfig.filletImg.valList[0].val * 2}rpx ${this.dataConfig.filletImg.valList[1].val * 2}rpx ${this.dataConfig.filletImg.valList[2].val * 2}rpx ${this.dataConfig.filletImg.valList[3].val * 2}rpx`;
  282. }
  283. return borderRadius
  284. },
  285. /*商品名称样式*/
  286. productStyle(){
  287. return {
  288. color: this.dataConfig.goodsNameColor.color[0].item,
  289. fontWeight: this.dataConfig.goodsName.tabVal ? 'normal' : '500'
  290. }
  291. },
  292. /* 展示信息 */
  293. checkboxInfo(){
  294. return this.dataConfig.checkboxInfo.type
  295. },
  296. pinkNumStyle(){
  297. return {
  298. color: this.dataConfig.toneConfig.tabVal ? this.dataConfig.labelColor.color[0].item : 'var(--view-theme)',
  299. // background: this.dataConfig.toneConfig.tabVal ? this.dataConfig.labelColor.color[0].item : 'var(--view-theme)'
  300. }
  301. },
  302. labelBg(){
  303. return {
  304. background: this.dataConfig.toneConfig.tabVal ? this.dataConfig.labelColor.color[0].item : 'var(--view-theme)'
  305. }
  306. },
  307. /* 价格颜色 */
  308. priceColor(){
  309. return this.dataConfig.toneConfig.tabVal ? this.dataConfig.pinkPriceColor.color[0].item : 'var(--view-theme)'
  310. },
  311. /* 原价颜色 */
  312. otPriceColor(){
  313. return this.dataConfig.goodsPriceColor.color[0].item
  314. },
  315. showBtn(){
  316. return this.dataConfig.pinkConfig.tabVal
  317. },
  318. /* 按钮颜色 */
  319. btnBgColor(){
  320. return {
  321. background: this.dataConfig.toneConfig.tabVal ? `linear-gradient(90deg,${this.dataConfig.goodsBntColor.color[1].item} 0%,${this.dataConfig.goodsBntColor.color[0].item} 100%)`: 'linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%)'
  322. }
  323. },
  324. /*商品数量*/
  325. numberConfig(){
  326. return this.dataConfig.numberConfig.val
  327. }
  328. },
  329. mounted() {
  330. this.pink();
  331. this.getCombinationList();
  332. },
  333. methods: {
  334. goPage(url){
  335. uni.navigateTo({
  336. url
  337. })
  338. },
  339. goDetail(item){
  340. // #ifndef MP
  341. uni.navigateTo({
  342. url:`/pages/activity/goods_details/index?id=${item.id}&type=3`
  343. })
  344. // #endif
  345. // #ifdef MP
  346. openPinkSubscribe().then(res=>{
  347. uni.navigateTo({
  348. url:`/pages/activity/goods_details/index?id=${item.id}&type=3`
  349. })
  350. })
  351. // #endif
  352. },
  353. // 拼团列表
  354. getCombinationList: function() {
  355. let that = this;
  356. let limit = that.$config.LIMIT;
  357. let data = {
  358. page: 1,
  359. limit: this.numberConfig>=limit?limit:this.numberConfig
  360. };
  361. getCombinationList(data).then(res=> {
  362. that.combinationList = res.data;
  363. }).catch((res) => {
  364. return that.$util.Tips({
  365. title: res
  366. });
  367. })
  368. },
  369. // 拼团数据(拼团人数头部图片)
  370. pink: function() {
  371. pink().then(res => {
  372. this.pinkInfo = res.data
  373. })
  374. }
  375. }
  376. }
  377. </script>
  378. <style lang="scss">
  379. .Regular{
  380. font-family: 'Regular';
  381. }
  382. .bg-cover{
  383. background-size: cover;
  384. }
  385. .item ~ .item{
  386. margin-top: 32rpx;
  387. }
  388. .inline-flex{
  389. display: inline-flex
  390. }
  391. .tuan-num{
  392. display: inline-flex;
  393. justify-content: center;
  394. align-items: center;
  395. padding: 0 8rpx;
  396. height: 32rpx;
  397. border-radius: 8rpx 0 0 8rpx;
  398. }
  399. .complete{
  400. display: inline-flex;
  401. justify-content: center;
  402. align-items: center;
  403. padding: 0 8rpx;
  404. height: 32rpx;
  405. border-radius: 0 8rpx 8rpx 0;
  406. background:rgba(255,255,255,0.9);
  407. }
  408. .rd-4rpx{
  409. border-radius: 4rpx !important;
  410. }
  411. .avatar-group image{
  412. margin-right: -10rpx;
  413. }
  414. .abs-tag{
  415. position: absolute;
  416. left: 10rpx;
  417. top: 10rpx;
  418. width: 84rpx;
  419. height: 30rpx;
  420. border-radius: 20rpx;
  421. }
  422. .circle-tag{
  423. width: 84rpx;
  424. height: 30rpx;
  425. border-radius: 20rpx;
  426. background:rgba(255,255,255,0.9);
  427. }
  428. </style>