shop_uniapp/components/mall-news/mall-news.vue
2024-08-10 09:14:12 +08:00

136 lines
3.3 KiB
Vue

<template>
<view class="home-seckill bg-white">
<view class="seckill-hd flex row-between">
<view class="white xxl bold">商城快讯</view>
</view>
<view v-if="list" class="goods-seckill">
<view class="item bg-white flex" v-for="(item, index) in list" :key="index">
<view class="goods-info m-l-20 flex-1">
<router-link :to="{path: '/bundle_b/pages/mall_news/detail', query: {id: item.id}}" v-if="item.mall_type == 0">
<view class="goods-name line-2 bold lg">{{item.title}}</view>
<view class="goods-name line-2 m-t-10">{{item.desc}}</view>
<view v-if="item.files != ''" style="width: 80%;">
<view v-if="item.type == 0">
<scroll-view style="white-space: nowrap;" :scroll-x="true">
<view class="flex">
<u-image class="thumb" v-for="(v, i) in item.files" :key="i" width="240rpx" height="240rpx" :border-radius="10" :src="v.src"></u-image>
</view>
</scroll-view>
</view>
<view v-if="item.type == 1">
<video :src="item.files[0].src" class="thumb-video"></video>
</view>
</view>
</router-link>
<view v-if="item.mall_type == 1">
<view class="goods-name line-2 bold lg">{{item.title}}</view>
<view class="goods-name line-2 m-t-10">{{item.desc}}</view>
<view v-if="item.shop != ''" style="width: 60%;">
<scroll-view :scroll-x="true">
<view class="flex" >
<view v-for="(v, i) in item.shop" :key="i" style="width: 240rpx;height: 240rpx;margin-right: 20rpx;margin-top: 20rpx;">
<router-link :to="{path: '/bundle_b/pages/mall_news/detail', query: {id: v[0].mall_news_shop_id, mall_type: 1}}">
<u-image class="thumb" width="240rpx" height="240rpx" :border-radius="10" :src="v[0].image"></u-image>
</router-link>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
</view>
<router-link :to="'/bundle_b/pages/mall_news/index'">
<view class="xs flex row-center more">查看更多 <u-icon name="arrow-right"></u-icon>
</view>
</router-link>
</view>
</template>
<script>
export default {
name: "mall-news",
props: {
list: {
type: Array,
default: () => ([])
}
},
data() {
return {
};
},
methods: {
preview(current, files) {
let f = files.map((item) => {
return item.src
})
this.$nextTick(() => {
uni.previewImage({
current,
urls: f
});
})
}
}
}
</script>
<style lang="scss">
.home-seckill {
border-radius: 14rpx;
overflow: hidden;
.seckill-hd {
padding: 0 20rpx;
height: 100rpx;
background: url(https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/bg_seckill.png) no-repeat;
background-size: 100%;
}
.time-item {
display: inline-flex;
width: 160rpx;
height: 100%;
&.active {
.time {
color: $-color-primary;
}
.state {
color: $-color-white;
background-color: $-color-primary;
}
}
.state {
padding: 0 10rpx;
}
}
.goods-seckill .item {
padding: 20rpx;
.border-btn {
border: 1px solid $-color-primary;
color: $-color-primary;
}
}
.more {
height: 80rpx;
border-top: $-solid-border;
}
.thumb {
margin-right: 20rpx;
margin-top: 20rpx;
}
.thumb-video {
width: 100%;
margin-top: 20rpx;
}
}
</style>