parent
ec94248e27
commit
4431b11f36
7 changed files with 388 additions and 113 deletions
@ -0,0 +1,201 @@ |
||||
<template> |
||||
<view> |
||||
<view class="page"> |
||||
<view class="search-wrap"> |
||||
<uni-search-bar class="search" radius="30" placeholder="请输入幼儿园名称、订单编号" v-model="keyword" clearButton="auto" cancelButton="none" @confirm="initList" /> |
||||
<view> |
||||
<uni-icons type="notification" size="20"></uni-icons> |
||||
</view> |
||||
</view> |
||||
<ul class="tab"> |
||||
<li v-for="(item, i) in tabs" :class="{active: curTab === item.id}" @click="tabChange(item.id)">{{ item.name }}</li> |
||||
</ul> |
||||
|
||||
<template v-if="list.length"> |
||||
<view class="list"> |
||||
<view class="item" v-for="item in list" @click="toDetail(item)"> |
||||
<!-- <view class="metas"> |
||||
<view class="serial">编号:{{ item.orderNumber }}</view> |
||||
<view class="date">提交时间:{{ item.createTime }}</view> |
||||
</view> --> |
||||
<view class="pro-name"> |
||||
<image class="icon" :src="item.logoUrl ? item.logoUrl : 'https://occupationlab.com/images/preschoolEdu/preSchool-icon.png'"></image> |
||||
{{ item.companyName }} |
||||
</view> |
||||
<view class="info"> |
||||
<view class="texts"> |
||||
<view class="meta">采购内容:{{ item.oriPrice || 0 }}</view> |
||||
<view class="meta">数量:{{ item.totalStocks || 0 }}</view> |
||||
<view class="meta">编号:{{ item.orderNumber }}</view> |
||||
<view class="meta">提交时间:{{ item.createTime }}</view> |
||||
</view> |
||||
<view class="type">组织采购</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<uni-load-more :status="status" /> |
||||
</template> |
||||
<empty v-else text="暂无线索"></empty> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { page } from '@/apis/modules/order.js' |
||||
import Goods from '@/config/goods.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
Goods, |
||||
keyword: '', |
||||
curTab: '', |
||||
tabs: [ |
||||
{ |
||||
id: '', |
||||
name: '全部' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '组织' |
||||
}, |
||||
{ |
||||
id: 1, |
||||
name: '个人' |
||||
}, |
||||
], |
||||
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
||||
status: 'more', // 上拉加载状态 more|loading|noMore |
||||
searchTimer: null, |
||||
keyword: '', |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
} |
||||
}, |
||||
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() { |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
page({ |
||||
current: this.page, |
||||
orderType: this.curTab, |
||||
queryCriteria: this.keyword |
||||
}).then(({ data }) => { |
||||
uni.hideLoading() |
||||
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值 |
||||
const list = data.records |
||||
this.list = this.reachBottom > 0 ? [...this.list, ...list] : list |
||||
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 => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
initList() { |
||||
this.page = 1 |
||||
this.reachBottom = 0 |
||||
this.getList() |
||||
}, |
||||
// tab切换 |
||||
tabChange(id) { |
||||
this.curTab = id |
||||
this.initList() |
||||
}, |
||||
// 跳转详情 |
||||
toDetail(item) { |
||||
this.$util.to(`../procureDetail/procureDetail?id=${item.orderNumber}`) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
padding-bottom: 90px; |
||||
} |
||||
.list { |
||||
padding: 20rpx; |
||||
.item { |
||||
padding: 20rpx; |
||||
margin-bottom: 20rpx; |
||||
// border-bottom: 1px solid #f1f1f1; |
||||
background-color: #fff; |
||||
border-radius: 4px; |
||||
} |
||||
.metas { |
||||
// display: flex; |
||||
justify-content: space-between; |
||||
margin-bottom: 20rpx; |
||||
} |
||||
.serial { |
||||
margin-bottom: 10rpx; |
||||
font-size: 24rpx; |
||||
color: #333; |
||||
} |
||||
.date { |
||||
font-size: 24rpx; |
||||
color: #8e8e8e; |
||||
} |
||||
.info { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
} |
||||
.pro-name { |
||||
display: flex; |
||||
align-items: center; |
||||
padding: 18rpx 0; |
||||
margin-bottom: 10rpx; |
||||
font-size: 32rpx; |
||||
font-weight: 600; |
||||
color: #333; |
||||
border-bottom: 1px solid #E6E8ED; |
||||
.icon { |
||||
width: 66rpx; |
||||
min-width: 66rpx; |
||||
height: 66rpx; |
||||
margin-right: 20rpx; |
||||
border-radius: 4px; |
||||
} |
||||
} |
||||
.meta { |
||||
margin: 10rpx 0; |
||||
font-size: 24rpx; |
||||
color: #999; |
||||
} |
||||
.type { |
||||
font-size: 24rpx; |
||||
color: #1fc133; |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue