幼教产品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.2 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)">
<view class="metas">
11 months ago
<view class="serial">编号{{ item.orderNumber }}</view>
11 months ago
<view class="date">提交时间</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>
<view class="type">组织采购</view>
</view>
</view>
</view>
<uni-load-more :status="status" />
</template>
<empty v-else text="暂无线索"></empty>
</view>
</view>
</template>
<script>
import { myOrder } from '@/apis/modules/order.js'
import Goods from '@/config/goods.js'
export default {
data() {
return {
Goods,
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 {
margin-top: 20rpx;
padding: 20rpx;
.item {
padding: 20rpx;
margin-bottom: 20rpx;
background-color: #fff;
}
.metas {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
}
.serial {
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>