You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
442 lines
10 KiB
442 lines
10 KiB
<template>
|
|
<view class="newpeople" :id="`newpeople${styleIndex}`">
|
|
<view class="newpeople-navbar">
|
|
<u-navbar :title="title" title-color="#fff" back-icon-color="#fff" :border-bottom="false"
|
|
:background="background"></u-navbar>
|
|
</view>
|
|
<view class="newpeople-hd">
|
|
<view class="rule" @click="openRule()">规则</view>
|
|
</view>
|
|
<view class="newpeople-gift">
|
|
<view class="a">
|
|
<image :src="$picUrl+'/static/news/newPeople-bg1.png'"></image>
|
|
</view>
|
|
<scroll-view scroll-x class="b">
|
|
<view class="item" v-for="(item,index) in couList" :key="i">
|
|
<image :src="$picUrl+'/static/news/newPeople-bg2.png'"></image>
|
|
<view class="p" v-if="item.coupon_type==10">¥<text>{{item.reduce_price}}</text></view>
|
|
<view class="p" v-if="item.coupon_type==20">¥<text>{{item.discount}}</text>折</view>
|
|
<view class="l">满{{item.min_price}}可用</view>
|
|
<view class="btn" v-if="!item.is_receive" @click="getUseCoupons(item)">立即领取</view>
|
|
<view class="btn" v-else>已领取</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
<view class="newpeople-bd" :isLoading="isLoading">
|
|
<view class="a">
|
|
<u-tabs :list="menuList" bg-color="#fafafa" inactive-color="#3C3C3C" active-color="#FF3C43"
|
|
:is-scroll="true" font-size="30" v-model="current" @change="onChosed"></u-tabs>
|
|
</view>
|
|
<view scroll-x class="b" style="display: flex;flex-wrap: wrap;justify-content:space-between">
|
|
<!-- <u-waterfall v-model="goodList" ref="uWaterfall1"> -->
|
|
<!-- <template v-slot:left="{leftList}"> -->
|
|
<view class="item" v-for="(item, index) in goodList" :key="index"
|
|
@click="goDetail(item.goods_id)">
|
|
<image :src="item.goods_image" mode="widthFix"></image>
|
|
<view class="title">
|
|
<text>自营</text>{{item.goods_name}}
|
|
</view>
|
|
<view class="price">
|
|
<view class="n">¥<text
|
|
style="margin-right: 6rpx;">{{item.goods_price_min?Number(item.goods_price_min):'0.00'}}</text>新人价
|
|
</view>
|
|
<view class="o">¥{{item.line_price_min?Number(item.line_price_min):'0.00'}}</view>
|
|
</view>
|
|
</view>
|
|
<!-- </template> -->
|
|
<!-- <template v-slot:right="{rightList}">
|
|
<view class="item" v-for="(item, index) in rightList" :key="index"
|
|
@click="goDetail(item.goods_id)">
|
|
<image :src="item.goods_image" mode="widthFix"></image>
|
|
<view class="title">
|
|
<text>自营</text>{{item.goods_name}}
|
|
</view>
|
|
<view class="price">
|
|
<view class="n">¥<text
|
|
style="margin-right: 6rpx;">{{item.goods_price_min?Number(item.goods_price_min):'0.00'}}</text>新人价
|
|
</view>
|
|
<view class="o">¥{{item.line_price_min?Number(item.line_price_min):'0.00'}}</view>
|
|
</view>
|
|
</view>
|
|
</template> -->
|
|
<!-- </u-waterfall> -->
|
|
</view>
|
|
<u-empty text="暂无数据显示哦~" v-if="goodList.length==0" mode="list" style="width: 100%"></u-empty>
|
|
</view>
|
|
<view class="newpeople-fd" @click="openPage()">
|
|
<image :src="$picUrl+'/static/toTop.png?=1'"></image>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import * as Api from '@/api/activity'
|
|
export default {
|
|
data() {
|
|
return {
|
|
title: "新人首单礼",
|
|
current: 0,
|
|
isLoading: true,
|
|
background: {
|
|
background: 'url(https://www.royaum.com.cn/static/news/newPeople-bg.png) center top no-repeat',
|
|
backgroundSize: '500% auto',
|
|
|
|
},
|
|
goodList: [],
|
|
menuList: [],
|
|
couList: []
|
|
}
|
|
},
|
|
computed: {
|
|
styleIndex() {
|
|
const index = uni.getStorageSync('styleIndex') || '';
|
|
return index;
|
|
},
|
|
},
|
|
watch: {
|
|
styleIndex: {
|
|
immediate: true,
|
|
handler() {
|
|
this.background.background = `url(https://www.royaum.com.cn/static/news/newPeople${this.styleIndex}-bg.png) center top no-repeat`;
|
|
},
|
|
},
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow(options) {
|
|
this.getCoupons()
|
|
this.getListCharts()
|
|
},
|
|
methods: {
|
|
// 立即领取
|
|
async getUseCoupons(item) {
|
|
let {
|
|
status,
|
|
message,
|
|
data
|
|
} = await Api.receive({
|
|
couponId: item.coupon_id
|
|
});
|
|
if (status == 200) {
|
|
uni.showToast({
|
|
title: "领取成功"
|
|
})
|
|
this.getCoupons()
|
|
}
|
|
},
|
|
// 获取新人礼包劵
|
|
async getCoupons() {
|
|
let {
|
|
status,
|
|
message,
|
|
data
|
|
} = await Api.couponList();
|
|
if (status == 200) {
|
|
this.couList = data.list || []
|
|
}
|
|
},
|
|
// 根据分类查数据
|
|
getListgoodData(categoryId) {
|
|
let app = this;
|
|
this.LeftList = [];
|
|
this.RightList = []
|
|
let pamars = {
|
|
categoryId: categoryId,
|
|
}
|
|
Api.chartsGoodsList(pamars)
|
|
.then(result => {
|
|
if (result.data.data.length > 0) {
|
|
for (let i = 0; i < result.data.data.length; i++) {
|
|
result.data.data[i].goods_price_min = Number(result.data.data[i].goods_price_min);
|
|
result.data.data[i].line_price_min = Number(result.data.data[i].line_price_min)
|
|
}
|
|
app.goodList = result.data.data || [];
|
|
}
|
|
})
|
|
.finally(() => app.isLoading = false)
|
|
},
|
|
onChosed(index) {
|
|
let app = this;
|
|
app.current = index;
|
|
app.goodList = []
|
|
// app.$refs.uWaterfall1.clear();
|
|
app.getListgoodData(index != 0 ? app.menuList[index].category_id : '')
|
|
},
|
|
openPage() {
|
|
uni.pageScrollTo({
|
|
scrollTop: 0
|
|
})
|
|
},
|
|
// 分类
|
|
async getListCharts() {
|
|
let app = this
|
|
let {
|
|
status,
|
|
message,
|
|
data
|
|
} = await Api.charts({
|
|
|
|
});
|
|
if (status == 200) {
|
|
let obj = {
|
|
name: '精选好物'
|
|
}
|
|
this.couList = data.list;
|
|
data.unshift(obj);
|
|
app.menuList = data;
|
|
app.getListgoodData()
|
|
}
|
|
},
|
|
goDetail(goods_id) {
|
|
uni.navigateTo({
|
|
url: '/pages/goods/detail?goodsId=' + goods_id
|
|
})
|
|
},
|
|
openRule() {
|
|
uni.navigateTo({
|
|
url: '/pages/activity/presaleRule?type=4'
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@import './newPeopleStyle.scss';
|
|
::v-deep .u-empty {
|
|
padding: 100rpx 0;
|
|
}
|
|
.newpeople {
|
|
background: url(https://www.royaum.com.cn/static/news/newPeople-bg.png) center 132rpx no-repeat;
|
|
background-size: 100% auto;
|
|
overflow: hidden;
|
|
|
|
&-hd {
|
|
height: 376rpx;
|
|
|
|
.rule {
|
|
right: 0;
|
|
top: 204rpx;
|
|
z-index: 2;
|
|
width: 100rpx;
|
|
height: 60rpx;
|
|
background-color: rgba(0, 0, 0, 0.3);
|
|
font-size: 24rpx;
|
|
font-weight: 400;
|
|
color: #FFFFFF;
|
|
line-height: 60rpx;
|
|
text-align: center;
|
|
position: absolute;
|
|
border-radius: 50rpx 0 0 50rpx;
|
|
}
|
|
}
|
|
|
|
&-gift {
|
|
width: 100%;
|
|
overflow: hidden;
|
|
margin-top: 20rpx;
|
|
|
|
.a {
|
|
width: 100%;
|
|
|
|
image {
|
|
width: 380rpx;
|
|
height: 58rpx;
|
|
margin-left: 60rpx;
|
|
margin-top: 20rpx;
|
|
}
|
|
}
|
|
|
|
.b {
|
|
padding: 20rpx;
|
|
overflow: hidden;
|
|
|
|
white-space: nowrap;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
.item {
|
|
width: 210rpx;
|
|
height: 240rpx;
|
|
position: relative;
|
|
margin-left: 30rpx;
|
|
display: inline-block;
|
|
text-align: center;
|
|
|
|
&:first-child {
|
|
margin-left: 0;
|
|
}
|
|
|
|
image {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.p {
|
|
width: 100%;
|
|
font-size: 42rpx;
|
|
color: #FF343B;
|
|
height: 80rpx;
|
|
position: absolute;
|
|
left: 0;
|
|
top: 50rpx;
|
|
z-index: 2;
|
|
|
|
text {
|
|
font-size: 40rpx;
|
|
}
|
|
}
|
|
|
|
.l {
|
|
width: 100%;
|
|
font-size: 24rpx;
|
|
font-weight: 500;
|
|
color: #8C4D00;
|
|
height: 50rpx;
|
|
position: absolute;
|
|
left: 0;
|
|
top: 120rpx;
|
|
z-index: 2;
|
|
|
|
text {
|
|
font-size: 52rpx;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
width: 100%;
|
|
font-size: 24rpx;
|
|
font-weight: 500;
|
|
color: #8C4D00;
|
|
height: 50rpx;
|
|
position: absolute;
|
|
left: 0;
|
|
bottom: 2rpx;
|
|
z-index: 2;
|
|
|
|
text {
|
|
font-size: 52rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
&-bd {
|
|
padding: 0 22rpx;
|
|
overflow: hidden;
|
|
|
|
.a {
|
|
padding: 10rpx 0;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.b {
|
|
overflow: hidden;
|
|
|
|
.item {
|
|
width: 346rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 8rpx;
|
|
opacity: 1;
|
|
border: 1px solid #ECECEC;
|
|
padding: 10rpx 15rpx 25rpx 15rpx;
|
|
box-sizing: border-box;
|
|
margin-bottom: 20rpx;
|
|
|
|
&:nth-child(2n+1) {
|
|
margin-left: 0;
|
|
}
|
|
|
|
image {
|
|
width: 275rpx;
|
|
height: 275rpx !important;
|
|
display: block;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.title {
|
|
padding: 10rpx 0;
|
|
font-size: 24rpx;
|
|
font-family: PingFang SC, PingFang SC;
|
|
font-weight: 400;
|
|
color: #1E1E1E;
|
|
display: -webkit-box;
|
|
-webkit-box-orient: vertical;
|
|
overflow: hidden;
|
|
-webkit-line-clamp: 2;
|
|
height: 90rpx;
|
|
line-height: 45rpx;
|
|
|
|
text {
|
|
background-color: #F34A40;
|
|
font-size: 24rpx;
|
|
padding: 0 10rpx;
|
|
height: 40rpx;
|
|
line-height: 40rpx;
|
|
text-align: center;
|
|
border-radius: 4rpx;
|
|
font-weight: 400;
|
|
color: #FFFFFF;
|
|
margin-right: 5rpx;
|
|
display: inline-block;
|
|
}
|
|
}
|
|
|
|
.price {
|
|
display: flex;
|
|
align-items: center;
|
|
white-space: nowrap;
|
|
|
|
.n {
|
|
display: flex;
|
|
align-items: baseline;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
color: #F21A1C;
|
|
|
|
text {
|
|
font-size: 29rpx;
|
|
}
|
|
}
|
|
|
|
.o {
|
|
font-size: 12px;
|
|
color: #949494;
|
|
text-decoration: line-through;
|
|
}
|
|
}
|
|
|
|
.desc {
|
|
font-size: 10px;
|
|
font-weight: 400;
|
|
color: #949494;
|
|
white-space: nowrap;
|
|
margin-top: 10rpx;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
&-fd {
|
|
position: fixed;
|
|
bottom: 120rpx;
|
|
right: 16rpx;
|
|
width: 99rpx;
|
|
height: 99rpx;
|
|
border-radius: 50%;
|
|
opacity: 1;
|
|
z-index: 999;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
image {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
|