2024-11-18 09:05:38 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<!-- 新购验收 -->
|
|
|
|
|
|
<view class="accept page-common">
|
|
|
|
|
|
<view class="complete-btn">
|
|
|
|
|
|
<view class="btn" @click="changeTab(1)">
|
|
|
|
|
|
<span>已完成</span>
|
|
|
|
|
|
<div v-if="active == 1" class="bt-line"></div>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="btn" style="margin-left: 120rpx" @click="changeTab(2)">
|
|
|
|
|
|
<span>未完成</span>
|
|
|
|
|
|
<div v-if="active == 2" class="bt-line"></div>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<uni-row :gutter="24" class="search-form">
|
2024-12-10 10:36:55 +08:00
|
|
|
|
<uni-col :span="18">
|
2024-11-18 09:05:38 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<uni-datetime-picker
|
2024-12-10 10:36:55 +08:00
|
|
|
|
v-model="dateArray"
|
|
|
|
|
|
type="daterange"
|
2024-11-18 09:05:38 +08:00
|
|
|
|
@maskClick="maskClick"
|
2024-12-10 10:36:55 +08:00
|
|
|
|
@change="onChangeDate"
|
|
|
|
|
|
placeholder="选择日期范围"
|
|
|
|
|
|
/>
|
2024-11-18 09:05:38 +08:00
|
|
|
|
</view>
|
2024-12-10 10:36:55 +08:00
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24" class="search-form">
|
|
|
|
|
|
<uni-col :span="18">
|
2024-11-18 09:05:38 +08:00
|
|
|
|
<view>
|
2024-12-10 10:36:55 +08:00
|
|
|
|
<uni-easyinput placeholder="请输入内容" v-model="queryParams.keyWord"/>
|
2024-11-18 09:05:38 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</uni-col>
|
2024-12-10 10:36:55 +08:00
|
|
|
|
<uni-col :span="6">
|
|
|
|
|
|
<view class="search" @click="getTableList(true)">搜索</view>
|
2024-11-18 09:05:38 +08:00
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
2024-12-10 10:36:55 +08:00
|
|
|
|
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
|
|
|
|
|
|
<div class="table-list-item" v-for="(item, index) in tableList" :key="index" @click="handleItem(item)">
|
|
|
|
|
|
<div class="title">
|
|
|
|
|
|
<span style="font-size: 15px; font-weight: 800">新购验收</span>
|
|
|
|
|
|
<span :style="{ color: active == 1 ? '#3784fb' : '#ff4d4f' }">{{active == 1 ? '已完成' : '未完成'}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="line"></div>
|
|
|
|
|
|
<uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">到货时间:</uni-col>
|
|
|
|
|
|
<uni-col :span="18"
|
|
|
|
|
|
><div class="cont">{{ item.arrivalTime }}</div></uni-col
|
|
|
|
|
|
>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">采购单号:</uni-col>
|
|
|
|
|
|
<uni-col :span="18"
|
|
|
|
|
|
><div class="cont">{{ item.code }}</div></uni-col
|
|
|
|
|
|
>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">采购物资:</uni-col>
|
|
|
|
|
|
<uni-col :span="18"
|
|
|
|
|
|
><div class="cont">{{ item.purchaseMaTypeName }}</div></uni-col
|
|
|
|
|
|
>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">到货数量:</uni-col>
|
|
|
|
|
|
<uni-col :span="18"
|
|
|
|
|
|
><div class="cont">{{ item.purchaseMaNumber }}</div></uni-col
|
|
|
|
|
|
>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<!-- <uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">验收数量:</uni-col>
|
|
|
|
|
|
<uni-col :span="18"><div class="cont"></div></uni-col>
|
|
|
|
|
|
</uni-row> -->
|
2024-11-18 09:05:38 +08:00
|
|
|
|
</div>
|
2024-12-10 10:36:55 +08:00
|
|
|
|
<div class="loading-text">
|
|
|
|
|
|
{{ finish ? '没有更多数据了~' : '正在加载...' }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</scroll-view>
|
2024-11-18 09:05:38 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-12-10 10:36:55 +08:00
|
|
|
|
import { ref, computed } from 'vue'
|
2024-11-19 10:32:24 +08:00
|
|
|
|
import { getPurchaseList } from '../../../services/purchase.js'
|
2024-11-18 16:52:12 +08:00
|
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
2024-12-10 10:36:55 +08:00
|
|
|
|
import { debounce } from 'lodash-es'
|
2024-11-18 09:05:38 +08:00
|
|
|
|
const active = ref(1)
|
2024-11-18 16:52:12 +08:00
|
|
|
|
const tableList = ref([])
|
2024-12-10 10:36:55 +08:00
|
|
|
|
const total = ref(0) //数据总量
|
2024-11-19 10:32:24 +08:00
|
|
|
|
const statusList = ref(['3', '13', '4', '14', '19'])
|
2024-12-10 10:36:55 +08:00
|
|
|
|
// 查询参数
|
|
|
|
|
|
const queryParams = ref({
|
|
|
|
|
|
startTime: '', // 开始时间
|
|
|
|
|
|
endTime: '', // 结束时间
|
|
|
|
|
|
keyWord: '', // 关键字
|
|
|
|
|
|
pageNum:1,
|
|
|
|
|
|
pageSize:5,
|
|
|
|
|
|
})
|
|
|
|
|
|
// 获取列表数据
|
|
|
|
|
|
const getTableList = async (isTap = false) => {
|
|
|
|
|
|
let obj = {
|
|
|
|
|
|
"statusList":statusList.value,...queryParams.value
|
2024-11-18 16:52:12 +08:00
|
|
|
|
}
|
2024-12-10 10:36:55 +08:00
|
|
|
|
const { data: res } = await getPurchaseList(obj)
|
|
|
|
|
|
console.log('res列表数据', res)
|
|
|
|
|
|
total.value = res.total
|
|
|
|
|
|
if (isTap) {
|
|
|
|
|
|
tableList.value = res.rows
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (res.rows.length == 0) {
|
|
|
|
|
|
tableList.value = []
|
|
|
|
|
|
} else {
|
|
|
|
|
|
tableList.value.push(...res.rows)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-18 16:52:12 +08:00
|
|
|
|
}
|
2024-12-10 10:36:55 +08:00
|
|
|
|
// 滚动触底事件
|
|
|
|
|
|
const onScrollTolower = debounce(() => {
|
|
|
|
|
|
console.log('触底事件')
|
|
|
|
|
|
if (total.value > tableList.value.length) {
|
|
|
|
|
|
queryParams.value.pageNum++
|
|
|
|
|
|
getTableList()
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 500)
|
|
|
|
|
|
// 判断数据是否加载完毕
|
|
|
|
|
|
const finish = computed(() => {
|
|
|
|
|
|
if (total.value === tableList.value.length) return true
|
|
|
|
|
|
})
|
2024-11-18 09:05:38 +08:00
|
|
|
|
|
|
|
|
|
|
const changeTab = (index) => {
|
|
|
|
|
|
active.value = index
|
2024-11-19 10:32:24 +08:00
|
|
|
|
if (index == 1) {
|
|
|
|
|
|
statusList.value = ['3', '13', '4', '14', '19']
|
2024-12-10 10:36:55 +08:00
|
|
|
|
getTableList(true)
|
2024-11-19 10:32:24 +08:00
|
|
|
|
} else if (index == 2) {
|
|
|
|
|
|
statusList.value = ['2', '12']
|
2024-12-10 10:36:55 +08:00
|
|
|
|
getTableList(true)
|
2024-11-19 10:32:24 +08:00
|
|
|
|
}
|
2024-11-18 09:05:38 +08:00
|
|
|
|
}
|
2024-12-10 10:36:55 +08:00
|
|
|
|
// 日期 change 事件
|
|
|
|
|
|
const onChangeDate = (val) => {
|
|
|
|
|
|
const [val_1, val_2] = val
|
|
|
|
|
|
queryParams.value.startTime = val_1
|
|
|
|
|
|
queryParams.value.endTime = val_2
|
|
|
|
|
|
}
|
|
|
|
|
|
//日期选择
|
2024-11-18 09:05:38 +08:00
|
|
|
|
const maskClick = () => {}
|
|
|
|
|
|
const handleItem = (item) => {
|
|
|
|
|
|
console.log('🚀 ~ handleItem ~ item:', item)
|
2024-11-18 18:26:53 +08:00
|
|
|
|
uni.navigateTo({ url: `/pages/new-purchase/accept/acceptDetails?id=${item.id}&taskId=${item.taskId}` })
|
2024-11-18 09:05:38 +08:00
|
|
|
|
}
|
2024-11-19 10:32:24 +08:00
|
|
|
|
onLoad((options) => {
|
2024-12-10 10:36:55 +08:00
|
|
|
|
getTableList(true)
|
2024-11-18 16:52:12 +08:00
|
|
|
|
})
|
2024-11-18 09:05:38 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.accept {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
|
.complete-btn {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
|
.btn {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
|
}
|
|
|
|
|
|
.bt-line {
|
|
|
|
|
|
width: 80rpx;
|
|
|
|
|
|
height: 4rpx;
|
|
|
|
|
|
background-color: #3784fb;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.search-form {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
box-sizing: content-box;
|
2024-12-10 10:36:55 +08:00
|
|
|
|
margin-bottom: 10rpx;
|
2024-11-18 09:05:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.search {
|
2024-12-10 10:36:55 +08:00
|
|
|
|
height: 60rpx;
|
2024-11-18 09:05:38 +08:00
|
|
|
|
background-color: #3784fb;
|
|
|
|
|
|
text-align: center;
|
2024-12-10 10:36:55 +08:00
|
|
|
|
line-height: 60rpx;
|
2024-11-18 09:05:38 +08:00
|
|
|
|
color: #fff;
|
2024-12-10 10:36:55 +08:00
|
|
|
|
border-radius: 10rpx;
|
2024-11-18 09:05:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-12-10 10:36:55 +08:00
|
|
|
|
.scroll-container {
|
|
|
|
|
|
.table-list-item {
|
|
|
|
|
|
margin: 20rpx 0;
|
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
min-height: 300rpx;
|
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
|
.title {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.cont {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
line-height: 1.9;
|
|
|
|
|
|
}
|
|
|
|
|
|
.line {
|
|
|
|
|
|
margin: 20rpx 0;
|
|
|
|
|
|
height: 1px;
|
|
|
|
|
|
background-color: #e8e8e8;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 加载提示文字
|
|
|
|
|
|
.loading-text {
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
padding: 20rpx 0;
|
2024-11-18 09:05:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|