98 lines
1.8 KiB
Vue
98 lines
1.8 KiB
Vue
<template>
|
|
<view class="rf-floor-index">
|
|
<view class="f-header">
|
|
<view class="line"></view>
|
|
<text class="name">为您推荐</text>
|
|
<view class="line"></view>
|
|
</view>
|
|
<rf-sku-product-list :bottom="bottom" :list="guessYouLikeList"></rf-sku-product-list>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
/**
|
|
*@des 商品推荐
|
|
*@author 237524947@qq.com
|
|
*@blog https://gitee.com/zscat/mallplus/wikis/pages/preview?sort_id=1703736&doc_id=326093
|
|
*@date 2020/01/08 11:28:39
|
|
*/
|
|
import { guessYouLikeList } from '@/api/product';
|
|
import rfSkuProductList from '@/components/rf-sku-product-list';
|
|
export default {
|
|
name: 'rfRecommend',
|
|
components: { rfSkuProductList },
|
|
props: {
|
|
list: {
|
|
type: Array,
|
|
default() {
|
|
return [{}, {}];
|
|
}
|
|
},
|
|
bottom: {
|
|
type: Number,
|
|
default: 0
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
guessYouLikeList: []
|
|
};
|
|
},
|
|
filters: {
|
|
filterTotalSales (val) {
|
|
if (val > 10000) {
|
|
val = `${(val / 10000).toFixed(2)}w`;
|
|
}
|
|
return val;
|
|
}
|
|
},
|
|
mounted() {
|
|
this.initData();
|
|
},
|
|
methods: {
|
|
initData() {
|
|
console.log('123',this.list)
|
|
if (this.list.length === 0) {
|
|
console.log('444')
|
|
this.getGuessYouLikeList();
|
|
} else {
|
|
this.guessYouLikeList = this.list;
|
|
}
|
|
},
|
|
async getGuessYouLikeList() {
|
|
await this.$http.get(`${guessYouLikeList}`,{num:6}).then(r => {
|
|
this.guessYouLikeList = r;
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped lang="scss">
|
|
.rf-floor-index {
|
|
.rf-product-list {
|
|
margin-top: 0;
|
|
}
|
|
.banner {
|
|
width: 92%;
|
|
margin: 20upx 4% 0;
|
|
image {
|
|
width: 100%;
|
|
height: 25vw;
|
|
border-radius: 20upx;
|
|
box-shadow: 0upx 5upx 25upx rgba(0, 0, 0, 0.05);
|
|
}
|
|
}
|
|
.f-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 40upx 20% 20upx;
|
|
.line {
|
|
border-bottom: 1upx solid rgba(0, 0, 0, 0.15); // 边框
|
|
width: 120upx;
|
|
}
|
|
.name {
|
|
}
|
|
}
|
|
}
|
|
</style>
|