<template>
|
<view class="bargain-container" :data-theme='theme()' :class="theme() || ''">
|
|
|
<!--内容-->
|
<view class="bargain-list" v-if="!loading">
|
<scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" lower-threshold="50" @scrolltolower="scrolltolowerFunc">
|
|
<!-- 搜索框 -->
|
<view class="d-b-c" id="searchBox">
|
<view class="index-search t-c flex-1" style="height: 70rpx; line-height: 70rpx; margin: 10rpx;">
|
<span class="icon iconfont icon-sousuo"></span>
|
<input type="text" v-model="keyword" class="flex-1 ml10 f30 gray3" value="" placeholder-class="f24 gray6"
|
placeholder="搜索标题" confirm-type="search" @confirm="gotoSearch()"/>
|
</view>
|
</view>
|
|
<view v-if="category_list.length>0" style="position: relative;">
|
<view class="scroll_box">
|
<scroll-view class="scroll" scroll-x="true" upper-threshode="50">
|
<view :class="category_id == 0?'scroll-view-item_H active':'scroll-view-item_H'" @click="changeCategory(0)">全部</view>
|
<view :class="category_id == '-1'?'scroll-view-item_H active':'scroll-view-item_H'" @click="changeCategory('-1')">推荐</view>
|
<view v-for="(item,index) in category_list" :key="index" :class="category_id==item.category_id?'scroll-view-item_H active':'scroll-view-item_H'" @click="changeCategory(item.category_id)">{{item.name}}</view>
|
</scroll-view>
|
</view>
|
</view>
|
|
<!--列表-->
|
<!-- <view class="list d-s-c f-w">
|
<view class="item d-stretch" v-for="(item, index) in listData" :key="index" >
|
<view class="product-info d-b-c d-c" @click="gotoDetail(item)">
|
<view style="border-bottom: 1px solid #ccc; width: 100%; display: flex; justify-content: flex-start; align-items: center; padding-bottom: 5rpx;">
|
<image style="width:100rpx;height: 100rpx; border-radius: 50%; margin-right: 10rpx;" :src="item.user.avatarUrl" mode="widthFix"></image>
|
<view>
|
{{ item.user.nickName }}
|
<view v-if="item.grade" style="width:50rpx;height: 50rpx;"><image style="width:50rpx;height: 50rpx;" :src="item.grade.img"></image></view>
|
</view>
|
|
</view>
|
<view class="product-title f26 gray3">
|
{{ item.name }}
|
</view>
|
<view class="people-num price d-b-c">
|
<text class="red f26">¥{{item.price}}</text>
|
<text class="gray9 f26">{{ item.category.name }}</text>
|
</view>
|
<view class="people-num price d-b-c">
|
<text class="gray9 f26">{{ item.create_time }}</text>
|
</view>
|
</view>
|
</view>
|
</view> -->
|
|
<view class="list d-s-c f-w">
|
<view class="item d-stretch" v-for="(item, index) in listData" :key="index" >
|
<view class="product-info d-s-c">
|
<view class="img" @click="gotoDetail(item)"><image :src="item.image" mode="widthFix"></image></view>
|
|
<view class="content">
|
<view class="product-title f26 gray3">
|
<view @click="gotoDetail(item)"><text class="category">{{ item.category.name }}</text>{{ item.name }}</view>
|
<view class="chat" @click="jump(item)">咨询</view>
|
</view>
|
<view class="product_content" @click="gotoDetail(item)">
|
{{ item.product_content }}
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<!-- 没有记录 -->
|
<view class="none-data-box" v-if="listData.length==0 && !loading">
|
<image src="/static/none.png" mode="widthFix"></image>
|
<text>暂无数据</text>
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
|
</view>
|
</template>
|
|
<script>
|
export default {
|
components: {
|
},
|
data() {
|
return {
|
/*手机高度*/
|
phoneHeight: 0,
|
/*可滚动视图区域高度*/
|
scrollviewHigh: 0,
|
/*列表*/
|
listData: [],
|
/*最后一页码数*/
|
last_page: 0,
|
/*当前页面*/
|
page: 1,
|
/*每页条数*/
|
list_rows: 10,
|
/*有没有更多*/
|
no_more: false,
|
/*是否正在加载*/
|
loading: true,
|
keyword:'',
|
category_id:'',
|
product_type:0,
|
category_list:[],
|
is_check:0,
|
};
|
},
|
computed: {
|
/*加载中状态*/
|
loadingType() {
|
if (this.loading) {
|
return 1;
|
} else {
|
if (this.listData.length != 0 && this.no_more) {
|
return 2;
|
} else {
|
return 0;
|
}
|
}
|
}
|
},
|
onLoad(e) {
|
if(e.product_type){
|
this.product_type = e.product_type;
|
}
|
},
|
onShow() {
|
/*获取列表*/
|
this.getlist();
|
},
|
mounted() {
|
this.init();
|
|
},
|
onReachBottom() {},
|
methods: {
|
initData(){
|
let self=this;
|
self.page = 1;
|
self.listData = [];
|
self.no_more=false;
|
},
|
/*初始化*/
|
init() {
|
let _this = this;
|
uni.getSystemInfo({
|
success(res) {
|
_this.scrollviewHigh = res.windowHeight;
|
}
|
});
|
},
|
/*可滚动视图区域到底触发*/
|
scrolltolowerFunc() {
|
let self = this;
|
if (self.no_more) {
|
return;
|
}
|
self.page++;
|
if (self.page <= self.last_page) {
|
self.getlist();
|
} else {
|
self.no_more = true;
|
}
|
},
|
|
changeCategory(e) {
|
let self = this;
|
self.category_id = e;
|
self.listData = [];
|
self.page = 1;
|
self.no_more = false;
|
self.loading = true;
|
self.getlist();
|
},
|
|
jump(item) {
|
let self = this;
|
let you_user_id = item.user_id;
|
let nickname = item.user.nickName;
|
let avatarurl =item.user.avatarUrl;
|
this.gotoPage('/pages3/release/chat/chat?you_user_id='+you_user_id+'&nickname='+nickname+'&avatarurl='+avatarurl);
|
},
|
|
|
/*搜索*/
|
gotoSearch() {
|
let self=this;
|
self.page = 1;
|
self.listData = [];
|
self.getlist();
|
},
|
|
/*获取列表*/
|
getlist() {
|
let self = this;
|
uni.showLoading({
|
title: '加载中'
|
});
|
self.loading = true;
|
self._get(
|
'plus.release.project/index', {
|
page: self.page,
|
list_rows: self.list_rows,
|
keyword:self.keyword,
|
category_id:self.category_id,
|
product_type:self.product_type,
|
},
|
function(res) {
|
self.loading = false;
|
self.category_list = res.data.category_list;
|
self.is_check = res.data.is_check;
|
self.listData = res.data.list.data;
|
self.last_page = res.data.list.last_page;
|
if (res.data.list.last_page <= 1) {
|
self.no_more = true;
|
} else {
|
self.no_more = false;
|
}
|
uni.hideLoading();
|
}
|
);
|
},
|
|
|
/*跳转详情*/
|
gotoDetail(e) {
|
if(this.is_check == 1){
|
let url = 'pages3/release/project/detail?project_id=' + e.project_id
|
this.gotoPage(url);
|
}else{
|
uni.showToast({
|
title: '请开通查看权限'
|
});
|
}
|
|
},
|
}
|
};
|
</script>
|
|
<style lang="scss">
|
page {
|
background: #f2f2f2;
|
}
|
|
.bargain-container .inner-tab {
|
background: #ffffff;
|
}
|
|
.bargain-container .inner-tab .tab-list {
|
height: 100rpx;
|
display: flex;
|
justify-content: flex-start;
|
align-items: center;
|
background: #FFFFFF;
|
}
|
|
.bargain-container .inner-tab .item {
|
height: 100rpx;
|
line-height: 100rpx;
|
white-space: nowrap;
|
padding: 0 30rpx;
|
font-size: 30rpx;
|
color: #333333;
|
}
|
|
.bargain-container .inner-tab .item.active,
|
.bargain-container .inner-tab .item .arrow.active .iconfont {
|
background: #FFFFFF;
|
font-size: 32rpx;
|
color: #F6220C;
|
position: relative;
|
}
|
|
.bargain-container .inner-tab .item.active::after {
|
content: '';
|
width: 60%;
|
height: 4rpx;
|
background: #F6220C;
|
border-radius: 2rpx;
|
position: absolute;
|
bottom: 17rpx;
|
left: 0;
|
right: 0;
|
margin: auto;
|
}
|
|
.bargain-container .inner-tab .box {
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
flex-direction: row;
|
}
|
|
.bargain-container .inner-tab .arrows {
|
margin-left: 10rpx;
|
line-height: 0;
|
}
|
|
.bargain-container .inner-tab .iconfont {
|
line-height: 24rpx;
|
font-size: 24rpx;
|
}
|
|
.bargain-container .inner-tab .arrow,
|
.bargain-container .inner-tab .svg-icon {
|
width: 20rpx;
|
height: 20rpx;
|
}
|
|
.bargain-container .banner-image {
|
width: 100%;
|
box-sizing: border-box;
|
}
|
|
.bargain-container .banner-image image {
|
width: 750rpx;
|
height: 365rpx;
|
}
|
|
.bargain-container .ad-datetime::v-deep text {
|
color: #333333;
|
font-size: 28rpx;
|
}
|
|
.bargain-container .ad-datetime::v-deep .box {
|
padding: 4rpx;
|
border-radius: 4rpx;
|
background: #F6220C;
|
color: #ffffff;
|
}
|
|
.bargain-list .list {
|
padding: 20rpx;
|
}
|
|
.bargain-list .list .item {
|
width: 100%;
|
padding: 20rpx;
|
margin-bottom: 20rpx;
|
box-sizing: border-box;
|
border-radius: 16rpx;
|
background: #ffffff;
|
}
|
|
.bargain-list .product-cover {
|
padding: 4rpx;
|
}
|
|
.bargain-list .product-cover image {
|
width: 120rpx;
|
height: 120rpx;
|
border-radius: 12rpx;
|
}
|
|
.bargain-list .product-info {
|
flex: 1;
|
//padding-left: 20rpx;
|
overflow: hidden;
|
align-items: normal;
|
}
|
|
.bargain-list .product-cover .people-num {
|
position: absolute;
|
right: 0;
|
bottom: 0;
|
left: 0;
|
height: 50rpx;
|
padding: 0 20rpx;
|
line-height: 50rpx;
|
font-size: 24rpx;
|
box-sizing: border-box;
|
background: rgba(0, 0, 0, 0.6);
|
}
|
|
.bargain-list .ad-datetime .box {
|
padding: 4rpx;
|
border-radius: 4rpx;
|
background: #000000;
|
color: #ffffff;
|
}
|
|
.bargain-list .product-title {
|
width: 100%;
|
height: 40rpx;
|
line-height: 40rpx;
|
font-size: 32rpx;
|
color: #333333;
|
}
|
|
.bargain-list .people-num {
|
width: 100%;
|
}
|
|
.bargain-list .already-sale {
|
padding: 4rpx 0;
|
color: #999;
|
font-size: 24rpx;
|
}
|
|
.bargain-list .price {
|
width: 100%;
|
color: $dominant-color;
|
font-size: 24rpx;
|
}
|
|
.bargain-list .price .num {
|
padding: 0 4rpx;
|
}
|
|
.bargain-list .slider-box .slider {
|
margin-top: 10rpx;
|
height: 10rpx;
|
background: #cccccc;
|
border-radius: 5rpx;
|
}
|
|
.bargain-list .slider-box .slider-inner {
|
height: 10rpx;
|
background: #e2231a;
|
border-radius: 5rpx;
|
}
|
|
.bargain-list .right-btn button {
|
height: 60rpx;
|
line-height: 60rpx;
|
border-radius: 30rpx;
|
background: #8D60FF;
|
color: #ffffff;
|
font-size: 32rpx;
|
}
|
.add_add {
|
position: fixed;
|
bottom: 20rpx;
|
left: 5%;
|
width: 90%;
|
height: 80rpx;
|
line-height: 80rpx;
|
border-radius: 80rpx;
|
/* background: #ff5704; */
|
@include background_color('background_color');
|
color: #fff;
|
font-size: 30rpx;
|
display: flex;
|
justify-content: center;
|
margin: 0 auto;
|
}
|
|
.scroll_box{
|
height:80rpx;
|
border-bottom: 1px solid #ccc;
|
}
|
.scroll{
|
width: 100%;
|
overflow: hidden;
|
background: #fff;
|
white-space: nowrap;
|
position: absolute;
|
left: 0px;
|
top:0px;
|
z-index: 999;
|
font-size: 30rpx;
|
}
|
.scroll-view-item_H{
|
height:80rpx;
|
line-height: 80rpx;
|
padding-left: 30rpx;
|
display: inline-block;
|
}
|
.scroll-view-item_H.active{
|
color: red;
|
}
|
.img{
|
width:160rpx;
|
height:160rpx;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
}
|
.img img{ max-width: 100%;}
|
.product-title{
|
width: 100%;
|
display: flex;
|
justify-content: space-between;
|
overflow: hidden;
|
}
|
.content{
|
width:100%;
|
padding:5px;
|
}
|
.product-title .category{
|
margin-right: 10rpx;
|
padding: 2rpx 18rpx;
|
background: red;
|
color: #fff;
|
font-size: 24rpx;
|
}
|
|
.product-title .chat{
|
width:70rpx;
|
border: 1rpx solid red;
|
color: red;
|
font-size: 24rpx;
|
margin-left: 10rpx;
|
text-align: center;
|
}
|
.product_content{
|
margin-top:10px;
|
height:80rpx;
|
line-height: 40rpx;
|
font-size: 26rpx;
|
color:#ccc;
|
overflow: hidden;
|
}
|
</style>
|