zyejMAll-mobile/sheep/components/s-groupon-block/s-groupon-block.vue

261 lines
6.1 KiB
Vue
Raw Normal View History

2024-08-07 10:31:42 +08:00
<!-- 装修组件 - 拼团 -->
<template>
2024-09-30 19:00:13 +08:00
<view class="new-class">
<!-- 标题栏 -->
<view class="menu-list-wrap">
<uni-list :border="true">
<uni-list-item showArrow clickable
@tap="sheep.$router.go('/pages/activity/groupon/list')">
<template v-slot:header>
2024-10-08 20:11:54 +08:00
<view>
<view class="wh">
<img class="new-text1"
src="https://zysc.fjptzykj.com:3000/shangcheng/2f2be070c60ceb9466af937ff9dd8917ad2ee02f774dbac48fbb9e73bfc688d0.png" />
<span class="new-text">拼团活动</span>
<view style="color: rgb(187, 187, 187);font-size:15px;" class="title-text ss-flex ss-row-center ss-col-center ss-m-l-20">
92人拼团成功
</view>
2024-09-30 19:00:13 +08:00
</view>
2024-10-08 20:11:54 +08:00
2024-09-30 19:00:13 +08:00
</view>
</template>
<template v-slot:footer>
2024-10-16 18:09:51 +08:00
<view style="color: rgb(187, 187, 187);font-size:13px;" class="notice-text ss-flex ss-row-center ss-col-center">
2024-09-30 19:00:13 +08:00
查看更多
</view>
</template>
</uni-list-item>
</uni-list>
</view>
2024-09-27 18:36:26 +08:00
<!-- <view v-if="layoutType === 'threeCol'" class="goods-sm-box ss-flex ss-flex-wrap"
:style="[{ margin: '-' + data.space + 'rpx' }]">
<view v-for="product in productList" :key="product.id" class="goods-card-box" :style="[
2024-08-07 10:31:42 +08:00
{
padding: data.space + 'rpx',
},
2024-09-27 18:36:26 +08:00
]">
<s-goods-column class="goods-card" size="sm" :goodsFields="data.fields" :tagStyle="tagStyle"
:data="product" :titleColor="data.fields.name?.color" :topRadius="data.borderRadiusTop"
:bottomRadius="data.borderRadiusBottom" @click="
2024-08-07 10:31:42 +08:00
sheep.$router.go('/pages/goods/groupon', {
id: props.data.activityId,
})
2024-09-27 18:36:26 +08:00
"></s-goods-column>
</view>
</view> -->
<!-- 样式2 一行一个 图片左 文案右 -->
<!-- <view class="goods-box" v-if="layoutType === 'oneCol'">
<view class="goods-list" v-for="(product, index) in productList" :key="index"
:style="[{ marginBottom: space + 'px' }]">
<s-goods-column class="goods-card" size="lg" :goodsFields="data.fields" :tagStyle="tagStyle"
:data="product" :titleColor="data.fields.name?.color"
:subTitleColor="data.fields.introduction?.color" :topRadius="data.borderRadiusTop"
:bottomRadius="data.borderRadiusBottom" @click="
2024-08-07 10:31:42 +08:00
sheep.$router.go('/pages/goods/groupon', {
id: props.data.activityId,
})
2024-09-27 18:36:26 +08:00
">
<template v-slot:cart>
<button class="ss-reset-button cart-btn" :style="[buyStyle]">
{{ btnBuy?.type === 'text' ? btnBuy.text : '' }}
</button>
</template>
</s-goods-column>
</view>
</view> -->
2024-09-30 19:00:13 +08:00
2024-10-14 19:12:22 +08:00
<view v-if="'threeCol' === 'threeCol'" class="goods-sm-box ss-flex ss-flex-wrap new-ll"
2024-09-27 18:36:26 +08:00
:style="[{ margin: '-' + data.space + 'rpx' }]">
<!-- productList -->
2024-09-30 19:00:13 +08:00
<view v-for="product in productList" :key="product.id" class="goods-card-box" :style="[
2024-09-27 18:36:26 +08:00
{
padding: data.space + 'rpx',
},
]">
<s-goods-column btn='pt' class="goods-card" size="sm" :goodsFields="data.fields" :tagStyle="tagStyle"
2024-09-27 18:36:26 +08:00
:data="product" :titleColor="data.fields.name?.color" :topRadius="data.borderRadiusTop"
:bottomRadius="data.borderRadiusBottom" @click="
sheep.$router.go('/pages/goods/groupon', {
2024-09-30 19:00:13 +08:00
id: product.activityId,
2024-09-27 18:36:26 +08:00
})
"></s-goods-column>
</view>
</view>
2024-09-30 19:00:13 +08:00
2024-09-27 18:36:26 +08:00
</view>
2024-08-07 10:31:42 +08:00
</template>
<script setup>
2024-09-27 18:36:26 +08:00
/**
* 拼团
*/
import {
computed,
onMounted,
ref
} from 'vue';
import sheep from '@/sheep';
import SpuApi from '@/sheep/api/product/spu';
import CombinationApi from '@/sheep/api/promotion/combination';
2024-08-07 10:31:42 +08:00
2024-09-27 18:36:26 +08:00
// 接收参数
const props = defineProps({
data: {
type: Object,
default () {},
},
styles: {
type: Object,
default () {},
},
});
2024-08-07 10:31:42 +08:00
2024-09-27 18:36:26 +08:00
let {
layoutType,
tagStyle,
btnBuy,
space
} = props.data;
let {
marginLeft,
marginRight
} = props.styles;
2024-08-07 10:31:42 +08:00
2024-09-27 18:36:26 +08:00
// 购买按钮样式
const buyStyle = computed(() => {
let btnBuy = props.data.btnBuy;
if (btnBuy?.type === 'text') {
return {
background: `linear-gradient(to right, ${btnBuy.bgBeginColor}, ${btnBuy.bgEndColor})`,
};
}
2024-08-07 10:31:42 +08:00
2024-09-27 18:36:26 +08:00
if (btnBuy?.type === 'img') {
return {
width: '54rpx',
height: '54rpx',
background: `url(${sheep.$url.cdn(btnBuy.imgUrl)}) no-repeat`,
backgroundSize: '100% 100%',
};
}
});
2024-08-07 10:31:42 +08:00
2024-09-27 18:36:26 +08:00
const productList = ref([]);
onMounted(async () => {
// todo@owen 与Yudao结构不一致待重构
const {
data: activity
} = await CombinationApi.getCombinationActivity(props.data.activityId);
2024-09-30 19:00:13 +08:00
const ss = await SpuApi.getSpulist();
console.log(ss, "getSpuListByIds")
productList.value = ss.data;
2024-09-27 18:36:26 +08:00
});
2024-08-07 10:31:42 +08:00
</script>
2024-09-30 19:00:13 +08:00
<style lang="scss">
:deep(.uni-list--border-bottom){
height:0 !important;
}
:deep(.container--right){
padding-left: 5px !important;
}
.ss-col-center{
.list-icon {
position: relative;
width: 93px;
height: 40px;
padding-right: 10px;
&::after{
position:absolute;
content:'';
top:50%;
right:0;
width:1px;
height:57%;
border-right:1px solid #ababab;
transform: translateY(-50%);
}
}
}
.notice-text {}
2024-08-07 10:31:42 +08:00
2024-09-30 19:00:13 +08:00
.menu-list-wrap {
::v-deep .uni-list {
background-color: transparent;
}
}
</style>
2024-08-07 10:31:42 +08:00
<style lang="scss" scoped>
2024-09-27 18:36:26 +08:00
.goods-list {
position: relative;
.cart-btn {
position: absolute;
bottom: 10rpx;
right: 20rpx;
z-index: 11;
height: 50rpx;
line-height: 50rpx;
padding: 0 20rpx;
border-radius: 25rpx;
font-size: 24rpx;
color: #fff;
}
}
.goods-list {
&:nth-last-of-type(1) {
margin-bottom: 0 !important;
}
}
.goods-sm-box {
margin: 0 auto;
box-sizing: border-box;
2024-10-11 16:07:43 +08:00
padding: 0 10px;
2024-09-27 18:36:26 +08:00
.goods-card-box {
flex-shrink: 0;
overflow: hidden;
width: 33.3%;
box-sizing: border-box;
}
}
2024-09-30 19:00:13 +08:00
.new-class {
background: white;
2024-10-14 19:12:22 +08:00
border-radius: 13px;
2024-09-30 19:00:13 +08:00
}
:deep(.sm-goods-card) {
background: transparent;
}
2024-10-08 20:11:54 +08:00
.wh {
display: flex;
align-items: center;
.new-text1{
width:30px;
height:30px;
}
.new-text{
position: relative;
font-weight: 700;
padding-right: 10px;
&::after {
position: absolute;
content: "";
top: 50%;
right: 0;
width: 1px;
height: 57%;
border-right: 1px solid #ababab;
transform: translateY(-50%);
}
}
}
2024-09-27 18:36:26 +08:00
</style>