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

244 lines
5.1 KiB

<template>
<view class="newsshop" :style="{backgroundImage:'url('+shopItem.index_icon+')'}">
<view class="newsshop-navbar">
<u-navbar :title="shopItem.title" back-icon-color="#fff" :border-bottom="false" title-color="#fff"
:background="background"></u-navbar>
</view>
<view class="newsshop-hd">
</view>
<view class="newsshop-bd" v-if="shopList.length>0" v-for="(item,index) in shopList" :key="i">
<view class="newsshop-sale">
<view class="a">
<image :src="item.col_pic"></image>
</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>
<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?Number(i.goods_price_min):''}}</text></view>
</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>
</view>
</view>
</view>
</view>
<u-empty text="暂无活动数据显示哦~" v-else mode="list"></u-empty>
</view>
</template>
<script>
import * as Api from '@/api/activity'
export default {
data() {
return {
current: 0,
shopItem: '',
shopList: [],
type: 2,
}
},
onLoad(op) {
this.type = op.type ? op.type : 2
if (this.type == 2) {
this.getInfo()
}
if (this.type == 1) {
this.getShopList(op.activeid)
}
},
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;
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 => {
if (active_id) {
result.data.col.forEach(item => {
item.sliceIndex = 6;
});
this.shopList = result.data.col.length > 0 ? result.data.col : [];
} else {
this.shopList = []
}
})
.finally()
},
}
}
</script>
<style lang="scss" scoped>
::v-deep .u-navbar-fixed {
background: none !important;
}
::v-deep .u-empty {
padding: 150rpx 0;
}
.newsshop {
width: 100%;
overflow: hidden;
min-height: 100vh;
background-size: 100% auto;
&-hd {
height: 380rpx;
}
&-bd {
// background-color: #f34a40;
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;
margin: 0 auto;
margin-top: 30rpx;
.a {
width: 100%;
height: 93rpx;
image {
width: 100%;
height: 100%;
}
}
.info {
width: 100%;
padding: 30rpx 10rpx;
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;
&:first-child {
margin-top: 0;
}
}
.b {
width: 100%;
white-space: nowrap;
.item {
display: inline-block;
overflow: hidden;
margin: 20rpx 7rpx 0 7rpx;
&: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;
}
.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;
font-weight: 600;
}
}
}
}
}
}
}
}
</style>