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/newsshop.vue

246 lines
5.2 KiB

10 months ago
<template>
9 months ago
<view class="newsshop" :style="{backgroundImage:'url('+shopItem.index_icon+')'}">
10 months ago
<view class="newsshop-navbar">
<u-navbar :title="shopItem.title" back-icon-color="#fff" :border-bottom="false" title-color="#fff"
10 months ago
:background="background"></u-navbar>
10 months ago
</view>
<view class="newsshop-hd">
</view>
<view class="newsshop-bd" v-if="shopList.length>0" v-for="(item,index) in shopList" :key="i">
10 months ago
<view class="newsshop-sale">
<view class="a">
<image :src="item.col_pic"></image>
10 months ago
</view>
<view class="info">
<view class="li b">
<view class="item" v-for="(i,index) in item.goods_list.slice(0, item.sliceIndex)" :key="index"
@click="goDetails(i.goods_id)">
<image class="pic" :src="i.goods_image"></image>
<view class="title">{{i.goods_name}}</view>
10 months ago
<view class="price">
<image class="icon" src="https://www.royaum.com.cn/static/news/newshop-05.png">
</image>
<view class="p"><text>{{i.goods_price_min}}</text></view>
10 months ago
</view>
</view>
</view>
<view class="c" @click="toggleList(index)" v-if="item.goods_list.length>5">点击查看更多<u-icon
style="margin-left: 20rpx;" name="arrow-down">
</u-icon>
10 months ago
</view>
10 months ago
</view>
10 months ago
</view>
</view>
9 months ago
<u-empty text="暂无活动数据显示哦~" v-else mode="list"></u-empty>
10 months ago
</view>
</template>
10 months ago
<script>
10 months ago
import * as Api from '@/api/activity'
export default {
data() {
10 months ago
return {
current: 0,
shopItem: '',
9 months ago
shopList: [],
type: 2,
10 months ago
}
},
9 months ago
onLoad(op) {
this.type = op.type ? op.type : 2
if (this.type == 2) {
this.getInfo()
}
if (this.type == 1) {
this.getShopList(op.activeid)
}
},
10 months ago
methods: {
goDetails(goodsId) {
uni.navigateTo({
url: '/pages/goods/detail?goodsId=' + goodsId
})
},
toggleList(index) {
let len = this.shopList[index].goods_list.length
if (this.shopList.sliceIndex >= len) {
this.$toast('已展示全部数据')
} else {
this.shopList[index].sliceIndex += 6;
}
},
// 获取新牌商品详情
getInfo() {
const app = this;
9 months ago
Api.info({
type: 'other-item'
})
.then(result => {
this.shopItem = result.data;
this.getShopList(result.data.id)
})
.finally()
},
// 获取新牌商品
getShopList(active_id) {
const app = this;
let pamars = {
active_id: active_id,
}
Api.detail(pamars)
.then(result => {
9 months ago
if (active_id) {
result.data.col.forEach(item => {
item.sliceIndex = 6;
item.goods_list.forEach(item1 => {
item1.goods_price_min = Number(item1.goods_price_min);
});
9 months ago
});
9 months ago
this.shopList = result.data.col.length > 0 ? result.data.col : [];
} else {
this.shopList = []
}
})
.finally()
},
10 months ago
}
10 months ago
}
10 months ago
</script>
<style lang="scss" scoped>
::v-deep .u-navbar-fixed {
background: none !important;
}
10 months ago
.newsshop {
width: 100%;
10 months ago
overflow: hidden;
10 months ago
min-height: 100vh;
background-size: 100% auto;
&-hd {
height: 380rpx;
}
10 months ago
&-bd {
9 months ago
// background-color: #f34a40;
10 months ago
padding-bottom: 30rpx;
overflow: hidden;
.c {
width: 656rpx;
height: 83rpx;
background: #FFE7E3;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
font-weight: 500;
color: #F34A40;
margin: 0 auto;
margin-top: 30rpx;
}
}
&-sale {
width: 710rpx;
10 months ago
margin: 0 auto;
margin-top: 30rpx;
10 months ago
.a {
10 months ago
width: 100%;
10 months ago
height: 93rpx;
image {
width: 100%;
height: 100%;
}
}
.info {
width: 100%;
padding: 30rpx 10rpx;
10 months ago
box-sizing: border-box;
background-color: #fff;
border-radius: 0 0 10rpx 10rpx;
.li {
margin-top: 20rpx;
display: flex;
align-items: center;
flex-wrap: wrap;
10 months ago
&:first-child {
margin-top: 0;
}
}
.b {
width: 100%;
white-space: nowrap;
.item {
display: inline-block;
overflow: hidden;
margin: 20rpx 7rpx 0 7rpx;
10 months ago
&:first-child {
margin-left: 0;
}
.pic {
width: 218rpx;
height: 218rpx;
}
.title {
text-align: center;
font-size: 28rpx;
font-weight: 400;
color: #3F3F3F;
line-height: 50rpx;
white-space: nowrap;
text-overflow: ellipsis;
white-space: nowrap;
-webkit-line-clamp: 1;
max-width: 200rpx;
10 months ago
}
.price {
width: 215rpx;
height: 55rpx;
position: relative;
.icon {
width: 100%;
height: 100%;
}
.p {
width: 100%;
height: 100%;
position: absolute;
left: 0;
line-height: 55rpx;
top: 0;
z-index: 2;
font-size: 28rpx;
color: #DE041C;
padding-left: 5rpx;
text {
font-size: 30rpx;
10 months ago
font-weight: 600;
}
}
}
}
}
10 months ago
}
}
10 months ago
}
</style>