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.
yanzong_qianduan/pages/activity/newPeople.vue

363 lines
7.2 KiB

10 months ago
<template>
<view class="newpeople">
<view class="newpeople-navbar">
<u-navbar title="" back-icon-color="#fff" :border-bottom="false" :background="background"></u-navbar>
</view>
<view class="newpeople-hd"></view>
<view class="newpeople-gift">
<view class="a">
<image src="@/static/news/newPeople-bg1.png"></image>
</view>
<scroll-view scroll-x class="b">
10 months ago
<view class="item" v-for="(item,index) in couList" :key="i">
10 months ago
<image src="@/static/news/newPeople-bg2.png"></image>
10 months ago
<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>
10 months ago
<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>
10 months ago
</view>
</scroll-view>
</view>
<view class="newpeople-bd" :isLoading="isLoading">
10 months ago
<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>
10 months ago
</view>
<view scroll-x class="b">
<view class="item" v-for="(item,index) in goodList" :key="i" @click="goDetail(item.goods_id)">
<image :src="item.goods_image"></image>
10 months ago
<view class="title">
<text>自营</text>{{item.goods_name}}
10 months ago
</view>
<view class="price">
<view class="n"><text>{{item.goods_price_min}}</text>到手价</view>
<view class="o">{{item.goods_price_min}}</view>
10 months ago
</view>
<view class="desc">
{{item.goods_sales}}+条评论 {{item.remaizhishu}}%好评率
10 months ago
</view>
</view>
</view>
</view>
<view class="newpeople-fd" @click="openPage()">
10 months ago
<image src="@/static/news/top.png"></image>
</view>
</view>
</template>
<script>
import * as Api from '@/api/activity'
10 months ago
export default {
data() {
return {
current: 1,
isLoading: true,
10 months ago
background: {
background: 'url(https://www.saas.njrenzhou.com/static/news/newPeople-bg.png) center top no-repeat',
10 months ago
backgroundSize: '100%',
10 months ago
},
10 months ago
goodList: [],
menuList: [],
couList: []
10 months ago
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow(options) {
10 months ago
this.getCoupons()
this.getListCharts()
},
10 months ago
methods: {
10 months ago
// 立即领取
async getUseCoupons(item){
let {
status,
message,
data
} = await Api.receive({couponId:item.coupon_id});
if (status == 200) {
uni.showToast({
title: "领取成功"
})
10 months ago
this.getCoupons()
}
},
// 获取新人礼包劵
async getCoupons() {
let {
status,
message,
data
} = await Api.couponList();
if (status == 200) {
this.couList = data.list
}
},
// 根据分类查数据
getListgoodData(categoryId) {
let app = this;
let pamars = {
store_id: 10001,
categoryId: categoryId,
}
Api.chartsGoodsList(pamars)
.then(result => {
app.goodList = result.data.data;
})
.finally(() => app.isLoading = false)
},
onChosed(index) {
let app = this;
app.current = index;
10 months ago
app.getListgoodData(index != 0 ? app.menuList[index].category_id : '')
},
openPage(){
uni.pageScrollTo({
scrollTop: 0
})
},
// 分类
10 months ago
async getListCharts() {
let app = this
10 months ago
let {
status,
message,
data
} = await Api.charts({
store_id: 10001
10 months ago
});
if (status == 200) {
let obj = {
name: '精选好物'
}
this.couList = data.list;
data.unshift(obj);
app.menuList = data;
app.getListgoodData()
}
},
10 months ago
goDetail(goods_id) {
uni.navigateTo({
10 months ago
url: '/pages/goods/detail?goodsId=' + goods_id
})
},
10 months ago
}
}
</script>
<style lang="scss" scoped>
.newpeople {
background: url(https://www.saas.njrenzhou.com/static/news/newPeople-bg.png) center top no-repeat;
background-size: 100% auto;
10 months ago
overflow: hidden;
10 months ago
&-hd {
height: 200rpx;
10 months ago
}
&-gift {
width: 100%;
border-radius: 10rpx 10rpx 0 0;
background-color: #fff;
10 months ago
overflow: hidden;
.a {
width: 100%;
image {
width: 380rpx;
height: 58rpx;
margin-left: 60rpx;
margin-top: 20rpx;
10 months ago
}
}
.b {
padding: 20rpx;
overflow: hidden;
white-space: nowrap;
.item {
width: 210rpx;
height: 266rpx;
position: relative;
margin-left: 30rpx;
display: inline-block;
text-align: center;
&:first-child {
margin-left: 0;
10 months ago
}
image {
width: 100%;
height: 100%;
10 months ago
}
.p {
width: 100%;
font-size: 42rpx;
color: #FF343B;
height: 80rpx;
position: absolute;
left: 0;
top: 50rpx;
z-index: 2;
text {
font-size: 52rpx;
}
}
.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;
}
10 months ago
}
}
}
}
&-bd {
padding: 0 20rpx;
10 months ago
overflow: hidden;
.a {
padding: 10rpx 0;
overflow: hidden;
}
.b {
overflow: hidden;
.item {
10 months ago
width: 340rpx;
height: 436rpx;
background: #FFFFFF;
border-radius: 8rpx;
opacity: 1;
border: 1px solid #ECECEC;
padding: 10rpx 15rpx;
box-sizing: border-box;
float: left;
margin-left: 30rpx;
margin-bottom: 30rpx;
&:nth-child(2n+1) {
10 months ago
margin-left: 0;
}
image {
10 months ago
width: 275rpx;
height: 275rpx;
display: block;
margin: 0 auto;
}
.title {
10 months ago
padding: 10rpx 0;
line-height: 40rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #1E1E1E;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
text {
10 months ago
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 {
10 months ago
display: flex;
align-items: center;
white-space: nowrap;
.n {
10 months ago
display: flex;
align-items: baseline;
font-size: 11px;
font-weight: 500;
color: #F21A1C;
text {
10 months ago
font-size: 29rpx;
}
}
.o {
10 months ago
font-size: 12px;
color: #949494;
text-decoration: line-through;
}
}
.desc {
10 months ago
font-size: 10px;
font-weight: 400;
color: #949494;
white-space: nowrap;
margin-top: 10rpx;
}
}
}
10 months ago
}
&-fd {
width: 132rpx;
height: 166rpx;
position: fixed;
right: 10rpx;
bottom: 10%;
z-index: 99;
image {
width: 100%;
height: 100%;
}
10 months ago
}
}
</style>