Files
hazardousWaste_app/pages/components/SearchList.vue

182 lines
5.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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