幼教产品B2B生态平台小程序端
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.

198 lines
4.4 KiB

11 months ago
<template>
<view>
<view class="page">
11 months ago
<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>
11 months ago
<template v-if="list.length">
<view class="list">
<view class="item" v-for="item in list" @click="toDetail(item)">
11 months ago
<!-- <view class="metas">
11 months ago
<view class="serial">编号{{ item.orderNumber }}</view>
11 months ago
<view class="date">提交时间{{ item.createTime }}</view>
</view> -->
11 months ago
<view class="pro-name">
11 months ago
<image class="icon" :src="item.logo ? item.logo : Common.shopIcon"></image>
{{ item.purchasingPerson }}
11 months ago
</view>
<view class="info">
<view class="texts">
11 months ago
<view class="meta">采购内容{{ item.content || '' }}</view>
<view class="meta">数量{{ item.num || 0 }}</view>
<view class="meta">编号{{ item.orderNumber }}</view>
<view class="meta">提交时间{{ item.createTime }}</view>
11 months ago
</view>
11 months ago
<view class="type">{{ item.orderType === 1 ? '个人采购' : '组织采购' }}</view>
11 months ago
</view>
</view>
</view>
<uni-load-more :status="status" />
</template>
11 months ago
<empty v-else text="暂无采购信息"></empty>
11 months ago
</view>
</view>
</template>
<script>
import { myOrder } from '@/apis/modules/order.js'
11 months ago
import Common from '@/config/common'
11 months ago
export default {
data() {
return {
11 months ago
Common,
11 months ago
keyword: '',
11 months ago
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: '加载中'
})
myOrder({
status: this.curTab,
page: this.page
}).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) {
11 months ago
this.$util.to(`../procureDetail/procureDetail?id=${item.orderNumber}`)
11 months ago
},
}
}
</script>
<style scoped lang="scss">
.page {
padding-bottom: 90px;
}
.list {
padding: 20rpx;
.item {
padding: 20rpx;
margin-bottom: 20rpx;
11 months ago
// border-bottom: 1px solid #f1f1f1;
11 months ago
background-color: #fff;
11 months ago
border-radius: 4px;
11 months ago
}
.metas {
11 months ago
// display: flex;
11 months ago
justify-content: space-between;
margin-bottom: 20rpx;
}
.serial {
11 months ago
margin-bottom: 10rpx;
11 months ago
font-size: 24rpx;
color: #333;
}
.date {
font-size: 24rpx;
11 months ago
color: #8e8e8e;
11 months ago
}
.info {
display: flex;
justify-content: space-between;
align-items: center;
}
.pro-name {
display: flex;
align-items: center;
padding: 18rpx 0;
11 months ago
margin-bottom: 10rpx;
11 months ago
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>