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/news/recycling/index.vue

228 lines
5.1 KiB

10 months ago
<template>
<view class="recycling">
<view class="recycling-navbar">
<u-navbar title="上门回收" :border-bottom="false" :background="isScroll?background:background1"></u-navbar>
</view>
<view class="recycling-hd"></view>
10 months ago
<view class="recycling-notice">
10 months ago
<image :src="$picUrl+'/static/news/icon-volume.png'"></image>
10 months ago
<view class="notice">
<u-notice-bar mode="horizontal" :volume-icon="false" bg-color="#fff" color="#212121" :list="list"></u-notice-bar>
</view>
</view>
<view class="recycling-bd">
10 months ago
<scroll-view scroll-x class="tab">
<view class="item" v-for="(a,i) in list1" :class="tabIndex==i?'item-on':''" @click="tabItem(i,a)">
<image :src="a.image_url"></image>
{{a.name}}
10 months ago
</view>
10 months ago
</scroll-view>
10 months ago
<view class="list">
<view class="item" v-for="(a,i) in list2" :key="i" @click="openPage(a)">
<image :src="a.recovery_image"></image>
10 months ago
<view class="info">
<view class="title">{{a.recovery_name}}</view>
<view class="desc">{{a.recovery_category}}</view>
10 months ago
<view class="price">
<view class="btn">免支付预约</view>
<view class="num">已售{{a.sold}}+ 好评{{a.comment_rate}}%</view>
10 months ago
</view>
</view>
</view>
</view>
10 months ago
</view>
</view>
</template>
10 months ago
<script>
10 months ago
import * as newFunApi from '@/api/newFun'
// import img from "@/static/news/recycling-bg.png"
export default {
data() {
10 months ago
return {
isScroll: true,
10 months ago
tabIndex: 0,
background: {
background: 'transparent',
10 months ago
},
background1: {
background: '#fff',
},
10 months ago
server_name: "",
list: ['欢迎来到这里!'],
10 months ago
list1: [],
10 months ago
list2: [],
}
10 months ago
},
10 months ago
onLoad(o) {
this.tabIndex = o.index?o.index:0
this.getList();
},
10 months ago
onPageScroll(e){
if(e.scrollTop <= 44){
this.isScroll = true;
}else{
this.isScroll = false;
}
10 months ago
},
10 months ago
methods: {
10 months ago
/**
* 获取列表
*/
async getList() {
let {status, message, data} = await newFunApi.recoveryCategoryList({});
10 months ago
if(status == 200){
this.list1 = data.list
this.getGoodsList();
}
},
/**
* 获取商品列表
*/
async getGoodsList() {
let {status, message, data} = await newFunApi.recoveryRecoveryList({
server_name: this.server_name,
10 months ago
category_id: this.list1.length > 0?this.list1[this.tabIndex].category_id:""
});
if(status == 200){
this.list2 = data.list
}
},
openPage(a) {
uni.setStorageSync("getInfo",a)
10 months ago
uni.navigateTo({
url: "/pages/news/recycling/detail?type=2&id="+a.recovery_id
10 months ago
})
10 months ago
},
tabItem(index){
10 months ago
this.tabIndex = index;
10 months ago
this.getGoodsList();
}
}
}
</script>
<style lang="scss" scoped>
.recycling{
background: url(https://www.royaum.com.cn/static/news/recycling-bg.png) center top no-repeat;
background-size: 100% auto;
&-hd{
height: 305rpx;
10 months ago
}
&-notice{
background-color: #fff;
display: flex;
align-items: center;
padding: 0 30rpx;
image{
width: 50rpx;
height: 50rpx;
display: block;
}
.notice{
width: 500rpx;
flex: 1;
}
10 months ago
}
10 months ago
&-bd{
padding: 30rpx 0 30rpx 36rpx;
overflow: hidden;
background-color: #fff;
.tab{
width: 100%;
10 months ago
white-space: nowrap;
10 months ago
.item{
10 months ago
width: 165rpx;
display: inline-block;
10 months ago
text-align: center;
font-size: 24rpx;
font-weight: 500;
color: #4F4F4F;
position: relative;
padding-bottom: 30rpx;
image{
width: 60rpx;
height: 60rpx;
display: block;
margin: 0 auto;
margin-bottom: 12rpx;
}
&-on{
color: #FF4949;
&::after{
content: "";
width: 50rpx;
height: 6rpx;
background: #FF4949;
border-radius: 6rpx;
position: absolute;
left: 50%;
bottom: 10rpx;
z-index: 1;
margin-left: -25rpx;
}
}
}
}
.list{
width: 100%;
overflow: hidden;
.item{
padding: 28rpx 0;
overflow: hidden;
display: flex;
border-top: 1px solid #F2F2F2;
&:first-child{
border-top-color: #fff;
}
image{
width: 234rpx;
height: 222rpx;
border-radius: 12rpx;
margin-right: 20rpx;
}
.info{
10 months ago
width: 440rpx;
10 months ago
white-space: nowrap;
.title{
overflow: hidden;
font-size: 28rpx;
text-overflow: ellipsis;
font-weight: 600;
color: #2C2C2C;
}
.desc{
overflow: hidden;
font-size: 28rpx;
text-overflow: ellipsis;
margin-top: 10rpx;
color: #888888;
10 months ago
height: 110rpx;
}
.price{
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24rpx;
font-weight: 400;
color: #888888;
.btn{
width: 134rpx;
line-height: 44rpx;
text-align: center;
background: #FFFFFF;
border-radius: 8rpx;
border: 1px solid #FF4949;
font-size: 24rpx;
font-weight: 400;
color: #FF4949;
}
10 months ago
}
10 months ago
10 months ago
}
}
}
}
10 months ago
}
</style>