<template>
|
<van-popup
|
v-model:show="props.show"
|
position="bottom"
|
round
|
:style="{ height: '50%' }">
|
<div class="title">
|
<div class="close" @click="close"><van-icon name="arrow-down" size="30" color="#ffffff" /></div>
|
</div>
|
<div class="content">
|
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
<van-list
|
v-model:loading="loading"
|
:finished="finished"
|
finished-text="没有更多了~"
|
@load="onLoad">
|
<div class="content_list">
|
<div class="content_list_item" v-for="(item, i) in list" :key="i" @click="jump(item, i)">
|
<div class="wl">
|
<div class="content_list_item_name">入库货位:{{item.unionName}} | {{item.code}}</div>
|
</div>
|
</div>
|
</div>
|
</van-list>
|
</van-pull-refresh>
|
</div>
|
</van-popup>
|
</template>
|
|
<script lang="ts" setup>
|
import { defineProps, defineEmits, onMounted, ref, reactive, watch } from 'vue'
|
import { getListByWarehouseId } from '@/apis/WorkOrderAPI'
|
import { model } from '@/interface'
|
import { judgmentPlatform } from "@/utils/utils"
|
|
// 搜索数据接口
|
interface form extends model {
|
total: number,
|
smodelLabel: string,
|
categoryId: string
|
}
|
|
const form = reactive<form>({
|
capacity: 50,
|
page: 0,
|
total: 0,
|
smodelLabel: '',
|
categoryId: ''
|
})
|
|
// 列表数据
|
const list: any = ref([]);
|
const loading = ref(false);
|
const finished = ref(false);
|
const refreshing = ref(false)
|
let isOne = ref<boolean>(true)
|
let isOpen = ref<boolean>(true)
|
|
const test = () => {
|
form.smodelLabel = ''
|
}
|
|
const clickTag = (tag: string): void => {
|
form.categoryId = tag
|
list.value = []
|
finished.value = false
|
form.page = 0
|
form.total = 0
|
onLoad()
|
}
|
|
// 搜索框
|
const searchInput = (data: any) => {
|
console.log(data)
|
form.page = 0
|
finished.value = false
|
list.value = []
|
form.smodelLabel = data
|
onLoad()
|
}
|
|
// 搜索提交
|
const submit = (): void => {
|
form.page = 0
|
finished.value = false
|
list.value = []
|
onLoad()
|
}
|
|
// 返回上一页带参数
|
const jump = (item: any, i: number): void => {
|
// list.value.splice(i, 1)
|
emit('value', item, list.value.length)
|
}
|
|
// 获取工单列表数据
|
const onLoad = async () => {
|
if (!finished.value) {
|
loading.value = true;
|
form.page = form.page + 1
|
getListByWarehouseId({
|
wareHouseId: props.warehouseId
|
}).then(res => {
|
if (refreshing.value) {
|
list.value = []
|
refreshing.value = false;
|
}
|
loading.value = false;
|
finished.value = true;
|
if (res.code === 200 && res.data && res.data.length !== 0) {
|
list.value.push(...res.data)
|
}
|
}).catch((err: any) => {
|
loading.value = false;
|
finished.value = true;
|
if (refreshing.value) {
|
list.value = []
|
refreshing.value = false;
|
}
|
})
|
}
|
}
|
|
// 下拉刷新优化页面
|
const onRefresh = () => {
|
finished.value = false;
|
form.page = 0
|
loading.value = true;
|
onLoad()
|
}
|
|
let status = ref<boolean>(false)
|
|
const props = defineProps({
|
show: { // 是否显示
|
type: Boolean,
|
required: true
|
},
|
warehouseId: { // 仓库编码
|
type: String,
|
required: false
|
}
|
})
|
|
const emit = defineEmits(['close', 'value'])
|
|
// 关闭回调
|
const close = () => {
|
emit('close')
|
}
|
|
watch(() => props.show, (news) => {
|
if (!news) {
|
test()
|
} else {
|
if (!isOpen.value) {
|
list.value = []
|
finished.value = false;
|
form.page = 0
|
loading.value = true;
|
onLoad()
|
}
|
isOpen.value = false
|
}
|
})
|
|
onMounted(() => {
|
status.value = judgmentPlatform()
|
})
|
</script>
|
|
<style lang="scss" scoped>
|
.title {
|
position: fixed;
|
right: 50px;
|
bottom: 100px;
|
z-index: 9;
|
.close {
|
width: 80px;
|
height: 80px;
|
border-radius: 50%;
|
background: #999999;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
}
|
.content {
|
.content_code {
|
position: fixed;
|
right: 30px;
|
bottom: 100px;
|
img {
|
width: 138px;
|
height: 138px;
|
}
|
}
|
.content_top {
|
top: 0 !important;
|
}
|
.content_search {
|
padding: 30px;
|
background: white;
|
position: sticky;
|
top: 88px;
|
z-index: 9;
|
.content_search_x {
|
height: 24px;
|
}
|
}
|
.content_total {
|
padding: 24px 30px;
|
background: #F7F7F7;
|
font-size: 24px;
|
font-weight: 400;
|
color: #666666;
|
}
|
.content_list {
|
width: 100%;
|
height: 100%;
|
display: flex;
|
flex-direction: column;
|
.content_list_item {
|
padding: 30px;
|
display: flex;
|
flex-direction: column;
|
border-bottom: 1px solid #ececec;
|
.wl {
|
display: flex;
|
align-items: center;
|
.content_list_item_status {
|
font-size: 28px;
|
margin-right: 10px;
|
}
|
.content_list_item_name {
|
font-size: 30px;
|
font-weight: 500;
|
color: #111111;
|
}
|
}
|
.sx {
|
margin-top: 15px;
|
span {
|
font-size: 26px;
|
font-weight: 400;
|
color: #444444;
|
}
|
}
|
.zl {
|
margin-top: 15px;
|
span {
|
font-size: 24px;
|
font-weight: 400;
|
color: #666666;
|
}
|
}
|
}
|
}
|
}
|
</style>
|