186 lines
4.2 KiB
Vue
186 lines
4.2 KiB
Vue
|
|
<template>
|
||
|
|
<div style="background: #BA262A;padding-bottom: 1rpx;">
|
||
|
|
<div class="imgs">
|
||
|
|
<image src="https://ct-upimg.yx090.com/ju8hn6/shop/image/2022/06/15/MoMFY1zkFu5fykGvjmrU6hRFAEufjxdRxMiRM3Hd.png?x-oss-process=image/format,webp" :webp="true" mode="widthFix" />
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<div class="title">人气爆品 口碑推荐</div>
|
||
|
|
<div class="box" v-for="(item, index) in hot" :key="index" @click="hanlejump(item.id)">
|
||
|
|
<div class="top" v-if="index == 0">
|
||
|
|
<image src="https://ct-upimg.yx090.com/ju8hn6/shop/image/2022/06/15/pIUXxlbHScMtNzIY3JBUeZ24aUyEpRgUL7LvS63R.png" />
|
||
|
|
</div>
|
||
|
|
<div class="top" v-if="index == 1">
|
||
|
|
<image src="https://ct-upimg.yx090.com/ju8hn6/shop/image/2022/06/15/tgO5hRzXcYYmswSb1N2M8JWKcWPMxhkfdVsDXd95.png" />
|
||
|
|
</div>
|
||
|
|
<div class="top" v-if="index == 2">
|
||
|
|
<image src="https://ct-upimg.yx090.com/ju8hn6/shop/image/2022/06/15/I9Pz4UKUUwHvu9xHCMGPboZuE6OhjhsqfcYXF3kk.png" />
|
||
|
|
</div>
|
||
|
|
<div class="img">
|
||
|
|
<image :src="item.face_img + '?x-oss-process=image/format,webp'" :webp="true" mode="aspectFill" />
|
||
|
|
</div>
|
||
|
|
<div class="head">
|
||
|
|
<div class="h1">{{item.title}}</div>
|
||
|
|
<div class="num"><span class="iconfont icon-fire"></span>已售{{item.sales}}件</div>
|
||
|
|
<div style="display: flex;justify-content: space-between; align-items: center;">
|
||
|
|
<div class="num1">
|
||
|
|
<text class="icon">¥</text>
|
||
|
|
<text v-if="item.price > 0">{{item.price}}</text>
|
||
|
|
<block v-else>
|
||
|
|
<text v-if="item.max_price === item.min_price">{{item.min_price}}</text>
|
||
|
|
<text v-else>{{item.min_price * 1}}~{{item.max_price}}</text>
|
||
|
|
</block>
|
||
|
|
</div>
|
||
|
|
<view class="buttom"><span class="iconfont icon-bag"></span> 去抢购</view>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import { ref, reactive, toRefs } from 'vue'
|
||
|
|
import { get, post } from '@/api/request.js'
|
||
|
|
export default {
|
||
|
|
setup() {
|
||
|
|
const data = reactive({
|
||
|
|
hot: [],
|
||
|
|
page: 1,
|
||
|
|
last_page: 0,
|
||
|
|
id: '',
|
||
|
|
sale_id: '',
|
||
|
|
company_id: '',
|
||
|
|
Color: ''
|
||
|
|
})
|
||
|
|
|
||
|
|
const hanlejump = (id) => {
|
||
|
|
uni.navigateTo({
|
||
|
|
url: '/pages/productDetails/index?id=' + id
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
const gethot = async () => {
|
||
|
|
uni.showLoading({
|
||
|
|
title: '加载中...'
|
||
|
|
})
|
||
|
|
await get('/api/app/special/goods/hot', { page: data.page, pageSize: 20 }).then((res) => {
|
||
|
|
data.hot = data.hot.concat(res.data)
|
||
|
|
data.last_page = res.meta.last_page
|
||
|
|
uni.hideLoading()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
return {
|
||
|
|
...toRefs(data),
|
||
|
|
gethot,
|
||
|
|
hanlejump
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onReachBottom() {
|
||
|
|
if (this.page < this.last_page) {
|
||
|
|
this.page++
|
||
|
|
this.gethot()
|
||
|
|
}
|
||
|
|
},
|
||
|
|
async onLoad(options) {
|
||
|
|
// await this.$onLaunched
|
||
|
|
this.gethot()
|
||
|
|
this.Color = uni.getStorageSync('theme_color')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style lang="scss" scoped>
|
||
|
|
.box {
|
||
|
|
position: relative;
|
||
|
|
display: flex;
|
||
|
|
justify-content: space-between;
|
||
|
|
background: #fff;
|
||
|
|
padding: 10rpx;
|
||
|
|
box-sizing: border-box;
|
||
|
|
border: 10rpx solid #dd7eab;
|
||
|
|
margin: 0 20rpx;
|
||
|
|
margin-bottom: 20rpx;
|
||
|
|
border-radius: 15rpx;
|
||
|
|
.top {
|
||
|
|
position: absolute;
|
||
|
|
top: 0;
|
||
|
|
left: 3%;
|
||
|
|
width: 75rpx;
|
||
|
|
height: 96rpx;
|
||
|
|
z-index: 2;
|
||
|
|
image {
|
||
|
|
width: 100%;
|
||
|
|
height: 100%;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
.img {
|
||
|
|
width: 30%;
|
||
|
|
image {
|
||
|
|
width: 200rpx;
|
||
|
|
height: 200rpx;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
.head {
|
||
|
|
width: 65%;
|
||
|
|
display: flex;
|
||
|
|
flex-direction: column;
|
||
|
|
justify-content: space-between;
|
||
|
|
.h1 {
|
||
|
|
font-size: 32rpx;
|
||
|
|
word-break: break-all;
|
||
|
|
text-overflow: ellipsis;
|
||
|
|
display: -webkit-box;
|
||
|
|
-webkit-box-orient: vertical;
|
||
|
|
-webkit-line-clamp: 2;
|
||
|
|
overflow: hidden;
|
||
|
|
}
|
||
|
|
.num {
|
||
|
|
font-size: 24rpx;
|
||
|
|
color: #9c9c9c;
|
||
|
|
margin: 20rpx 0;
|
||
|
|
}
|
||
|
|
.num1 {
|
||
|
|
font-size: 30rpx;
|
||
|
|
color: v-bind('Color');
|
||
|
|
margin: 20rpx 0;
|
||
|
|
}
|
||
|
|
.buttom {
|
||
|
|
font-size: 26rpx;
|
||
|
|
width: 150rpx;
|
||
|
|
height: 60rpx;
|
||
|
|
background: v-bind('Color');
|
||
|
|
border-radius: 30rpx;
|
||
|
|
color: #fff;
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
justify-content: center;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
.title {
|
||
|
|
padding: 50rpx 0;
|
||
|
|
color: #fdf2d3;
|
||
|
|
font-size: 32rpx;
|
||
|
|
text-align: center;
|
||
|
|
}
|
||
|
|
|
||
|
|
.imgs {
|
||
|
|
width: 100%;
|
||
|
|
image{
|
||
|
|
width: 100%;
|
||
|
|
vertical-align: bottom;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
.icon-fire{
|
||
|
|
color: v-bind('Color');
|
||
|
|
}
|
||
|
|
.icon-bag{
|
||
|
|
color: #fff;
|
||
|
|
}
|
||
|
|
</style>
|