|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<uni-card :is-shadow="false" :border="false" padding="0" is-full>
|
|
|
|
<view class="filter">
|
|
|
|
<uni-search-bar class="search" radius="5" placeholder="请输入产品名称" v-model="keyword" clearButton="auto" cancelButton="none" />
|
|
|
|
<sl-filter class="sl-filter" :independence="true" :menuList="menuList" @result="result"></sl-filter>
|
|
|
|
</view>
|
|
|
|
</uni-card>
|
|
|
|
|
|
|
|
<ul class="tab">
|
|
|
|
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<ul class="list">
|
|
|
|
<li v-for="item in list">
|
|
|
|
<view class="pro-name">
|
|
|
|
<!-- <image v-if="item.id != 13" class="icon" :src="require('../../static/image/product/' + item.id + '.png)" mode="widthFix"></image> -->
|
|
|
|
<image class="icon" src="../../static/image/course1.png" mode="widthFix"></image>
|
|
|
|
{{ item.productName }}
|
|
|
|
</view>
|
|
|
|
<view class="info">
|
|
|
|
<view class="line">
|
|
|
|
<text class="name">产品简介:</text>
|
|
|
|
<text class="val">{{ item.briefIntroduction }}</text>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<text class="name">产品类型:</text>
|
|
|
|
<text class="val">{{ tabs.find(e => e.id === item.productType).name }}</text>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<text class="name">市场单价:</text>
|
|
|
|
<text class="val">{{ item.marketPrice }}元/年</text>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<text class="name">结算方式:</text>
|
|
|
|
<text class="val">{{ item.settlementMethod ? '比例分成' : '结算单价' }}</text>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<text class="name">供应厂商:</text>
|
|
|
|
<text class="val">{{ item.supplier }}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<uni-load-more :status="status" />
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { AppletsDataProductList } from '@/apis/modules/product.js'
|
|
|
|
import slFilter from '@/components/sl-filter/sl-filter.vue'
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
menuList: [
|
|
|
|
{
|
|
|
|
'title': '排序',
|
|
|
|
'detailTitle': '请选择排序(按上架时间)',
|
|
|
|
'key': 'sort',
|
|
|
|
'isSort': true,
|
|
|
|
'isMutiple': false,
|
|
|
|
'detailList': [
|
|
|
|
{
|
|
|
|
'title': '顺序',
|
|
|
|
'value': 'asc'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'title': '倒序',
|
|
|
|
'value': 'desc'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
curTab: '',
|
|
|
|
tabs: [
|
|
|
|
{
|
|
|
|
name: '全部',
|
|
|
|
id: ''
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '实训课程',
|
|
|
|
id: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '理论课程',
|
|
|
|
id: 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '数据产品',
|
|
|
|
id: 2
|
|
|
|
}
|
|
|
|
],
|
|
|
|
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据
|
|
|
|
status: 'more', // 上拉加载状态 more|loading|noMore
|
|
|
|
searchTimer: null,
|
|
|
|
sort: '',
|
|
|
|
keyword: '',
|
|
|
|
list: [],
|
|
|
|
page: 1,
|
|
|
|
pageSize: 10
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
slFilter
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
keyword () {
|
|
|
|
clearTimeout(this.searchTimer)
|
|
|
|
this.searchTimer = setTimeout(() => {
|
|
|
|
this.initList()
|
|
|
|
}, 500)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 下拉刷新
|
|
|
|
onPullDownRefresh() {
|
|
|
|
this.initList()
|
|
|
|
setTimeout(() => {
|
|
|
|
uni.stopPullDownRefresh()
|
|
|
|
}, 1500)
|
|
|
|
},
|
|
|
|
// 上拉加载
|
|
|
|
onReachBottom() {
|
|
|
|
if (this.reachBottom >= 0) {
|
|
|
|
this.reachBottom = 1
|
|
|
|
this.status = 'loading'
|
|
|
|
this.getList()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
this.initList()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getList() {
|
|
|
|
AppletsDataProductList({
|
|
|
|
sort: this.sort,
|
|
|
|
keywords: this.keyword,
|
|
|
|
productType: this.curTab,
|
|
|
|
pageNum: this.page,
|
|
|
|
pageSize: this.pageSize
|
|
|
|
}).then(({ data }) => {
|
|
|
|
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值
|
|
|
|
this.list = this.reachBottom > 0 ? [...this.list, ...data.records] : data.records
|
|
|
|
this.page++ // 每次获取了数据后page+1
|
|
|
|
const noMore = this.list.length === data.total // 是否加载完所有数据
|
|
|
|
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore
|
|
|
|
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1
|
|
|
|
}).catch(e => {})
|
|
|
|
},
|
|
|
|
initList() {
|
|
|
|
this.page = 1
|
|
|
|
this.reachBottom = 0
|
|
|
|
this.getList()
|
|
|
|
},
|
|
|
|
// 筛选确定回调
|
|
|
|
result(val) {
|
|
|
|
this.sort = val.sort
|
|
|
|
this.initList()
|
|
|
|
},
|
|
|
|
// tab切换
|
|
|
|
tabChange(tab) {
|
|
|
|
this.curTab = tab.id
|
|
|
|
this.initList()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.filter {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
.search {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
.sl-filter {
|
|
|
|
width: 30%;
|
|
|
|
margin-left: 10%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.list {
|
|
|
|
li {
|
|
|
|
padding: 0 24rpx;
|
|
|
|
margin: 16rpx 24rpx;
|
|
|
|
background-color: #fff;
|
|
|
|
border-radius: 16rpx;
|
|
|
|
}
|
|
|
|
.pro-name {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 18rpx 0;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #333;
|
|
|
|
border-bottom: 1px solid #E6E8ED;
|
|
|
|
.icon {
|
|
|
|
width: 52rpx;
|
|
|
|
margin-right: 20rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.info {
|
|
|
|
padding: 12rpx 0;
|
|
|
|
}
|
|
|
|
.line {
|
|
|
|
display: flex;
|
|
|
|
padding: 12rpx 0;
|
|
|
|
}
|
|
|
|
.name {
|
|
|
|
margin-right: 10rpx;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
.val {
|
|
|
|
max-width: 70%;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|