Files
xdd-uniapp-new/pkg_product/views/famousHot.vue
T

197 lines
4.7 KiB
Vue

<template>
<view class="famous-hot" v-if="story">
<view class="bg-box" :style="{'backgroundImage':`url(${webUrl}/20230314095400713928.png)`}">
<image class="banner" :src="story.image" mode="scaleToFill"/>
<view class="story-box flex flex-col ai-center">
<image class="story-title" :src="webUrl+'/20230313105024432472.png'" mode="scaleToFill"/>
<view class="story-content">
<view v-html="story.content"></view>
</view>
</view>
</view>
<view class="list" :style="{'backgroundImage':`url(${webUrl}/20230311091305879166.png)`}">
<image class="title" :src="webUrl+'/20230220023931078168.png'" mode="scaleToFill"/>
<view class="item flex" :style="{'backgroundImage':`url(${webUrl}/20230224102624521679.png)`}"
v-for="(item,index) in products" :key="index" @click="goGoods(item.id)">
<image class="cover flex-0" style="margin-right: 20rpx" :src="item.image"
mode="scaleToFill" v-if="index%2===0"/>
<view class="info-box flex flex-col jc-between">
<view>
<view class="name more-t">{{ item.storeName }}</view>
<!-- <view class="unit">100g/</view>-->
<view class="flex ai-center" style="margin-top: 12rpx" v-if="item.tags.length">
<view class="label flex jc-center ai-center" v-for="tag in item.tags">{{ tag }}</view>
</view>
</view>
<view class="flex jc-between ai-center">
<view class="price">{{ item.price }}</view>
<image class="btn-go" :src="webUrl+'/20230407104241118683.png'" mode="scaleToFill"/>
</view>
</view>
<image class="cover flex-0" style="margin-left: 20rpx" :src="item.image"
mode="scaleToFill" v-if="index%2===1"/>
</view>
</view>
</view>
</template>
<script>
import {getStoryDetail} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'FamousHot',
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
products: [],
id: null,
story: null,
pageKeyId: ''
}
},
onLoad(option) {
const id = option.id
this.id = option.id
this.pageKeyId = `countyFamousContent_id_${id}`
getStoryDetail(this.id).then(({data}) => {
this.story = data
this.products = data.products
})
},
methods: {
goGoods(id) {
uni.navigateTo({
url: `/pages/shop/GoodsCon/index?id=${id}&from=famous`
})
}
}
}
</script>
<style scoped lang="less">
.famous-hot {
image {
vertical-align: middle;
}
.bg-box {
padding-bottom: 42rpx;
background-size: 750rpx auto;
background-repeat: repeat-y;
}
.banner {
width: 686rpx;
height: 440rpx;
margin: 20rpx 32rpx 0;
border-radius: 16rpx;
}
.story-box {
position: relative;
width: 686rpx;
box-sizing: border-box;
margin: 52rpx 32rpx 0;
border: 2rpx solid #4C7D8B;
border-radius: 10rpx;
background: rgba(255,255,255,.6);
.story-title {
width: 270rpx;
height: 62rpx;
margin-top: -18rpx;
}
.story-content {
margin-top: 12rpx;
padding: 0 24rpx 24rpx;
color: #666666;
font-size: 28rpx;
line-height: 40rpx;
}
}
.list {
position: relative;
padding: 40rpx 0;
background-size: 750rpx auto;
background-repeat: repeat-y;
.title {
position: relative;
left: 50%;
transform: translateX(-50%);
width: 458rpx;
height: 94rpx;
margin-bottom: 32rpx;
}
.item {
width: 686rpx;
height: 284rpx;
background-size: 686rpx 284rpx;
margin: 0 32rpx 24rpx;
padding: 44rpx 38rpx 42rpx 44rpx;
box-sizing: border-box;
.cover {
width: 200rpx;
height: 200rpx;
border-radius: 8rpx;
}
.info-box {
.name {
width: 384rpx;
color: #435151;
font-size: 28rpx;
line-height: 40rpx;
font-weight: bold;
}
.unit {
margin-top: 12rpx;
color: #333;
font-size: 24rpx;
line-height: 36rpx;
}
.label {
height: 44rpx;
box-sizing: border-box;
margin-right: 8rpx;
padding: 0 18rpx;
border-radius: 22rpx;
background: #B1211F;
color: #FFFFFF;
font-size: 26rpx;
}
.label:last-child {
margin-right: 0;
}
.price {
color: #DA0000;
font-size: 36rpx;
line-height: 52rpx;
font-weight: bold;
}
.btn-go {
width: 140rpx;
height: 48rpx;
}
}
}
}
}
</style>