Files
hazardousWaste_app/pages/components/SearchList.vue

182 lines
5.3 KiB
Vue
Raw Normal View History

2026-04-03 08:38:34 +08:00
<template>
<!-- 我的入库单/我的出库单/入库单入库/出库单出库-->
<navigation :title="title" back-url="pages/warehousing/index"></navigation>
2026-04-14 08:46:29 +08:00
<view class="contentBox">
<!-- 搜索框 -->
2026-04-03 08:38:34 +08:00
<view class="topSearch">
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :input-border="false"
@icon-click="getList" placeholder="请输入搜索内容" />
2026-04-03 08:38:34 +08:00
</view>
<!-- 列表 -->
2026-04-03 08:38:34 +08:00
<z-paging ref="pagingRef" class="containerBox" v-model="list" @query="getList">
<uni-list class="listBox">
2026-04-23 14:35:54 +08:00
<uni-list-item v-for="item in list" :key="item.id" clickable @tap="onDetail(item)">
2026-04-03 08:38:34 +08:00
<template v-slot:body>
<view style="display: flex; flex-direction: column; width: 100%;">
<view class="line title">
<p> {{ typeName }}编号{{ item.billNo }}</p>
2026-04-23 14:35:54 +08:00
<text :style="getColor(item?.billType)">
2026-04-14 08:46:29 +08:00
{{ getBillType(item?.billType, item?.status, flag) }}
2026-04-23 14:35:54 +08:00
</text>
2026-04-03 08:38:34 +08:00
</view>
<p class="line content">{{ typeName }}类型
2026-04-23 14:35:54 +08:00
<text>{{ getOrderType(item.status) }}</text>
2026-04-03 08:38:34 +08:00
</p>
<p class="line content">库位
2026-04-23 14:35:54 +08:00
<text v-if="item.warehouseName">{{ item.warehouseName }}/</text>
<text v-if="item.areaName"> {{ item.areaName }}</text>
2026-04-03 08:38:34 +08:00
</p>
<p class="line content">开单时间
2026-04-23 14:35:54 +08:00
<text>{{ item.createTime }}</text>
2026-04-03 08:38:34 +08:00
</p>
</view>
</template>
</uni-list-item>
</uni-list>
</z-paging>
</view>
</template>
<script setup>
2026-04-14 08:46:29 +08:00
import _ from 'lodash';
2026-04-03 08:38:34 +08:00
import { computed, toRefs, ref } from 'vue';
import { onShow } from "@dcloudio/uni-app";
2026-04-14 08:46:29 +08:00
import { stockList } from '@/api/stockIn';
import { stockOutList } from '@/api/stockOut';
2026-04-03 08:38:34 +08:00
import { getBillType, getColor } from '../until';
import Navigation from '../components/Navigation.vue';
2026-04-03 08:38:34 +08:00
const props = defineProps({
// 查询列表类型 stockIn:我的入库单 stockIn-putAway入库单入库 stockOut我的出库单 stockOut-outbound出库单出库
2026-04-03 08:38:34 +08:00
type: {
type: String,
default: '',
required: true
},
// 查询条件
query: {
type: Object,
default: {},
required: true
},
})
2026-04-03 08:38:34 +08:00
const { type, query } = toRefs(props)
const pagingRef = ref(null)
const list = ref([])
2026-04-14 08:46:29 +08:00
const flag = computed(() => _.includes(type.value, 'stockIn') ? 0 : 1)
const typeName = computed(() => _.includes(type.value, 'stockIn') ? '入库单' : '出库单')
const title = computed(() => {
if (type.value == 'stockIn') return '我的入库单'
else if (type.value == 'stockIn-putAway') return '入库单入库'
else if (type.value == 'stockOut') return '我的出库单'
else return '出库单出库'
})
2026-04-03 08:38:34 +08:00
const getOrderType = () => {
2026-04-14 08:46:29 +08:00
return _.includes(type.value, 'stockIn') ? '入库单入库' : '出库单出库'
2026-04-03 08:38:34 +08:00
}
2026-04-03 08:38:34 +08:00
const queryParams = ref({
keyword: ''
})
onShow(() => {
pagingRef.value?.reload?.()
})
const onDetail = (val) => {
2026-04-14 08:46:29 +08:00
uni.navigateTo({
url: `/pages/warehousing/stockIn/components/detail?billNo=${val.billNo}&type=${type.value}`,
});
2026-04-03 08:38:34 +08:00
}
2026-04-03 08:38:34 +08:00
const getList = (pageNo, pageSize) => {
queryParams.value.pageNum = pageNo
if (_.includes(type.value, 'stockIn')) {
stockList({ ...queryParams.value, ...query.value }).then(res => {
2026-04-03 08:38:34 +08:00
res.rows.forEach(e => {
e.showMore = false;
});
pagingRef.value.complete(res.rows)
}).catch(() => {
2026-04-03 08:38:34 +08:00
pagingRef.value.complete(false)
})
2026-04-14 08:46:29 +08:00
} else {
stockOutList({ ...queryParams.value, ...query.value }).then(res => {
res.rows.forEach(e => {
e.showMore = false;
});
pagingRef.value.complete(res.rows)
}).catch(() => {
pagingRef.value.complete(false)
})
2026-04-03 08:38:34 +08:00
}
}
</script>
<style scoped lang="scss">
/* 搜索框:放在导航栏下面,不覆盖 */
2026-04-03 08:38:34 +08:00
.topSearch {
position: fixed;
2026-04-14 08:46:29 +08:00
top: 65rpx;
2026-04-03 08:38:34 +08:00
left: 0;
right: 0;
z-index: 99;
padding: 8rpx 16rpx;
2026-04-03 08:38:34 +08:00
background-color: #fff;
border-bottom: 1px solid #eee;
box-sizing: border-box;
2026-04-14 08:46:29 +08:00
2026-04-03 08:38:34 +08:00
}
.containerBox {
2026-04-14 08:46:29 +08:00
padding-top: 125rpx !important;
2026-04-03 08:38:34 +08:00
width: 100%;
height: 100%;
box-sizing: border-box;
}
::v-deep .listBox {
width: 100%;
height: 100%;
box-sizing: border-box;
background-color: #F8F8FF;
.zp-l-text-rpx {
font-size: 12px;
}
2026-04-14 08:46:29 +08:00
.uni-list--border-bottom {
padding: 8px 12px 8px 15px;
}
2026-04-03 08:38:34 +08:00
.uni-list {
background-color: #F8F8FF;
}
.uni-list-item {
margin-bottom: 4rpx;
}
.line {
display: flex;
align-items: center;
2026-04-14 08:46:29 +08:00
padding: 8px 0;
2026-04-03 08:38:34 +08:00
}
.title {
justify-content: space-between;
font-weight: 600;
font-size: 13px;
}
.content {
font-weight: 500;
font-size: 13px;
color: #696969;
}
}
</style>