<template>
|
<view class='recommend'>
|
<view class='title acea-row row-center-wrapper'>
|
<text class='iconfont icon-zhuangshixian'></text>
|
<text class='name'>热门推荐</text>
|
<text class='iconfont icon-zhuangshixian lefticon'></text>
|
</view>
|
<view class='recommendList cf'>
|
<view class="list_column cfl">
|
<block v-for="(item,index) in hostProduct" :key="gindex">
|
<GoodBlock v-if="index%2==0" :pageName="pageName" :moduleName="'热门推荐'" :careBeanRate="careBeanRate" :size="'big'" :goodsInfo="item"></GoodBlock>
|
</block>
|
</view>
|
<view class="list_column cfr">
|
<block v-for="(item,index) in hostProduct" :key="gindex">
|
<GoodBlock v-if="index%2==1" :pageName="pageName" :moduleName="'热门推荐'" :careBeanRate="careBeanRate" :size="'big'" :goodsInfo="item"></GoodBlock>
|
</block>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import GoodBlock from "@/pages/goods_block/index.vue";
|
import {mapGetters} from "vuex";
|
import { goShopDetail } from '@/libs/order.js'
|
export default {
|
computed: mapGetters(['uid']),
|
props: {
|
pageName:{
|
type: String,
|
default: function() {
|
return '';
|
}
|
},
|
moduleName:{
|
type: String,
|
default: function() {
|
return '';
|
}
|
},
|
hostProduct: {
|
type: Array,
|
default: function() {
|
return [];
|
}
|
}
|
},
|
components: {
|
GoodBlock
|
},
|
data() {
|
return {
|
careBeanRate:0
|
};
|
},
|
mounted(){
|
let that=this;
|
if (!that.$store.getters.careBeanRate) {
|
console.log('has not get careBeanRate')
|
uni.$once('updateCareBeanRate', () => {
|
that.$nextTick(()=>{
|
that.$set(that,'careBeanRate',that.$store.getters.careBeanRate)
|
console.log('get updateCareBeanRate',that.$store.getters.careBeanRate,that.careBeanRate)
|
})
|
});
|
} else {
|
that.$nextTick(()=>{
|
that.$set(that,'careBeanRate',that.$store.getters.careBeanRate)
|
console.log('has updateCareBeanRate',that.careBeanRate)
|
})
|
}
|
},
|
methods: {
|
goDetail(item){
|
goShopDetail(item,this.uid).then(res=>{
|
uni.navigateTo({
|
url:`/pages/goods_details/index?id=${item.id}`
|
})
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
// .recommend {
|
// background-color: #fff;
|
// }
|
|
.recommend .title {
|
height: 135rpx;
|
line-height: 135rpx;
|
font-size: 28rpx;
|
color: #282828;
|
}
|
|
.recommend .title .name {
|
margin: 0 28rpx;
|
}
|
|
.recommend .title .iconfont {
|
font-size: 170rpx;
|
color: #454545;
|
}
|
|
.recommend .title .iconfont.lefticon {
|
}
|
|
.recommend .recommendList {
|
width: 690rpx;
|
margin: 0 auto;
|
}
|
</style>
|