Files
hazardousWaste_app/pages/components/SearchList.vue

172 lines
4.9 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-03 08:38:34 +08:00
<view class="content">
<!-- 搜索框 -->
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">
<uni-list-item v-for="item in list" :key="item.id" clickable @click="onDetail(item)">
<template v-slot:body>
<view style="display: flex; flex-direction: column; width: 100%;">
<view class="line title">
<p> {{ typeName }}编号{{ item.billNo }}</p>
2026-04-03 08:38:34 +08:00
<span :style="getColor(item?.billType)">
{{ getBillType(item?.billType, item?.status) }}
</span>
</view>
<p class="line content">{{ typeName }}类型
<span>{{ getOrderType(item.status) }}</span>
2026-04-03 08:38:34 +08:00
</p>
<p class="line content">库位
<span>{{ item.areaName }}</span>
2026-04-03 08:38:34 +08:00
</p>
<p class="line content">开单时间
<span>{{ item.createTime }}</span>
</p>
</view>
</template>
</uni-list-item>
</uni-list>
</z-paging>
</view>
</template>
<script setup>
2026-04-03 08:38:34 +08:00
import _, { includes } from 'lodash';
import { computed, toRefs, ref } from 'vue';
import { onShow } from "@dcloudio/uni-app";
import { stockList } from '../../api/stockIn';
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-03 08:38:34 +08:00
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 = () => {
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) => {
if (_.includes(type.value, 'stockIn')) {
uni.navigateTo({
url: `/pages/warehousing/stockIn/components/detail?billNo=${val.billNo}&type=${type.value}`,
});
}
}
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)
})
}else{
2026-04-03 08:38:34 +08:00
}
}
</script>
<style scoped lang="scss">
/* 搜索框:放在导航栏下面,不覆盖 */
2026-04-03 08:38:34 +08:00
.topSearch {
position: fixed;
top: var(--nav-height);
/* 关键:自动在导航栏下方 */
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;
}
.containerBox {
padding-top: 90px !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;
}
.uni-list {
background-color: #F8F8FF;
}
.uni-list-item {
margin-bottom: 4rpx;
}
.line {
display: flex;
align-items: center;
padding: 12rpx 20rpx;
}
.title {
justify-content: space-between;
font-weight: 600;
font-size: 13px;
}
.content {
font-weight: 500;
font-size: 13px;
color: #696969;
}
}
</style>