完善入库跳转以及出库创建页面

This commit is contained in:
zx
2026-04-07 10:55:39 +08:00
parent ce6d5e5d6e
commit b16dd22d70
16 changed files with 514 additions and 166 deletions

View File

@@ -4,8 +4,8 @@
<view class="remarkLine">
<text>物料列表</text>
<uv-button type="primary" v-if="isEdit == 1" :plain="true" size="small" text="添加物料"
@click="toMaterial"></uv-button>
<uv-button type="primary" v-if="isAddMaterial" :plain="true"
size="small" text="添加物料" @click="toMaterial"></uv-button>
<view v-if="isEdit == 5" class="flex align-center justify-between">
<span class="f-12 mr-16 grey" style="font-size: 12px;" v-if="num > 0">
剩余<span style="color: red;">
@@ -99,7 +99,7 @@
</template>
<script setup>
import { computed, onMounted, ref, toRefs } from 'vue';
import { assign, findIndex } from 'lodash';
import { assign, findIndex ,includes} from 'lodash';
import { getStockQuantity, objectToQuery } from '../until';
import { getTypeParentNames } from '../warehousing/uniqueCode/until';
import { onLoad, onShow } from "@dcloudio/uni-app";
@@ -113,15 +113,14 @@ const props = defineProps({
})
const { formData, isEdit, backStr, pathParams, extendData } = toRefs(props)
console.log(extendData, 'extendData==>');
//是否为编辑状态
const edit = computed(() => {
if (`${isEdit.value}` === '1') return '1';
else if (`${isEdit.value}` === '4') return '4';
else return false;
})
// 显示添加物料按钮 isEdit编辑、
const isAddMaterial = computed(() => isEdit == 1 && pathParams.back != 'issueUniqueCode_inbound' && !includes(backStr.value,'stockOut'))
// 删除:数据
const delItem = ref(null)
// 删除:开关

View File

@@ -3,73 +3,117 @@
<view class="nav-placeholder" :style="{ height: navHeight + 'px' }"></view>
<view class="navbar" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="left" @click="goBack">
<uni-icons type="left" size="18" />
</view>
<!-- 中间标题 -->
<!-- 标题 -->
<view class="title">{{ title }}</view>
<!-- 右侧父组件传入插槽 -->
<!-- 右侧插槽 -->
<view class="right">
<slot name="right"></slot>
</view>
</view>
<view class="content">
</view>
<view class="content"></view>
</template>
<script setup>
import { ref, onMounted, toRefs } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app';
import { onLoad } from '@dcloudio/uni-app'
import { getTabBarList } from '../until'
import { find, findIndex } from 'lodash'
const props = defineProps({
title: { type: String, default: '' },
backUrl: { type: String, default: '' },
title: {
type: String,
default: ''
},
backUrl: {
type: String,
default: ''
},
showBack: {
type: Boolean,
default: true
}
})
const { backUrl, title, showBack } = toRefs(props)
// 状态栏 + 导航栏高度
const statusBarHeight = ref(0)
const navHeight = ref(0)
const back = ref('')
const { backUrl, title } = toRefs(props)
onMounted(() => {
const res = uni.getSystemInfoSync()
statusBarHeight.value = res.statusBarHeight
navHeight.value = res.statusBarHeight + 44
})
// 接收id 且修改标题
onLoad(() => {
const pages = getCurrentPages()
if (pages.length >= 2) {
const prevPage = pages?.[pages.length - 2]
back.value = backUrl.value ? backUrl.value : prevPage.route
console.log(back.value, prevPage, pages, ' back.value');
// 返回目标路由
const backTarget = ref('')
const isTabBar = ref('')
// 获取系统信息
onMounted(() => {
try {
const res = uni.getSystemInfoSync()
statusBarHeight.value = res.statusBarHeight || 0
// 标准导航栏高度 44px + 状态栏 = 总高度
navHeight.value = statusBarHeight.value + 44
} catch (e) {
console.warn('获取系统信息失败', e)
}
})
//页面加载时获取上一页路由
onLoad(() => {
const tabList = getTabBarList()
const isTabBarNav = findIndex(tabList, (i) => i.pagePath == backUrl.value) != -1
isTabBar.value = isTabBarNav
if (backUrl.value) {
backTarget.value = backUrl.value
return
}
try {
const pages = getCurrentPages()
if (pages && pages.length >= 2) {
const prevPage = pages[pages.length - 2]
backTarget.value = prevPage.route || ''
}
} catch (e) {
console.warn('获取页面栈失败', e)
}
})
// 返回
const goBack = () => {
console.log(back.value, back.value);
if (back.value) {
uni.navigateTo({
url: `/${back.value}`,
});
// 返回逻辑
const goBack = () => {
if (!showBack.value) return;
if (backTarget.value) {
const url = backTarget.value.startsWith('/') ? backTarget.value : `/${backTarget.value}`;
if (isTabBar.value) uni.switchTab({ url: url })
else uni.navigateTo({ url: url })
} else {
// 无目标路由 正常返回
uni.navigateBack()
}
}
</script>
<style scoped lang="scss">
/* 导航栏占位:撑开页面内容,不被遮挡 */
.nav-placeholder {
width: 100%;
}
/* 导航栏主体fixed 固定在顶部 */
.navbar {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 70px;
// 高度由 状态栏 + 44px 决定,不要写死 70px
height: 44px;
background: #fff;
display: flex;
align-items: center;
@@ -77,21 +121,24 @@ const goBack = () => {
padding: 0 20rpx;
box-sizing: border-box;
z-index: 999;
// margin-bottom: 8px;
}
.left {
display: flex;
align-items: center;
}
.back-txt {
margin-left: 6rpx;
justify-content: center;
width: 40rpx;
height: 100%;
}
.title {
font-size: 14px;
font-size: 16rpx;
font-weight: bold;
color: #333;
max-width: 400rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.right {
@@ -101,7 +148,8 @@ const goBack = () => {
justify-content: flex-end;
}
.nav-placeholder {
.content {
width: 100%;
box-sizing: border-box;
}
</style>

View File

@@ -1,26 +1,31 @@
<!-- 查询列表 - 使用我的出库单/我的入库单 -->
<template>
<!-- 我的入库单/我的出库单/入库单入库/出库单出库-->
<navigation :title="title" back-url="pages/warehousing/index"></navigation>
<view class="content">
<!-- 搜索框 -->
<view class="topSearch">
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false"
@iconClick="getList" placeholder="请输入搜索内容" />
<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 @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>
<p> {{ typeName }}编号{{ item.billNo }}</p>
<span :style="getColor(item?.billType)">
{{ getBillType(item?.billType, item?.status) }}
</span>
</view>
<p class="line content">{{ typeName + '类型' }}
<span> {{ getOrderType(item.status) }}</span>
<p class="line content">{{ typeName }}类型
<span>{{ getOrderType(item.status) }}</span>
</p>
<p class="line content">库位
<span> {{ item.areaName }}</span>
<span>{{ item.areaName }}</span>
</p>
<p class="line content">开单时间
<span>{{ item.createTime }}</span>
@@ -32,16 +37,17 @@
</z-paging>
</view>
</template>
<script setup>
<script setup>
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';
const props = defineProps({
// 查询列表类型 stockIn:入库 stockIn-putAway入库单入库 stockOut出库
// 查询列表类型 stockIn:我的入库 stockIn-putAway入库单入库 stockOut我的出库单 stockOut-outbound出库单出库
type: {
type: String,
default: '',
@@ -53,23 +59,23 @@ const props = defineProps({
default: {},
required: true
},
})
const { type, query } = toRefs(props)
const pagingRef = ref(null)
// 数据:列表
const list = ref([])
const typeName = computed(() => includes(type.value, 'stockIn') ? '入库单' : '出库单')
const getOrderType = () => {
if (includes(type.value, 'stockIn')) {
return '入库单入库'
} else {
return '出库单出库'
}
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: ''
})
@@ -78,58 +84,53 @@ onShow(() => {
pagingRef.value?.reload?.()
})
// 点击:查看详情
const onDetail = (val) => {
if (_.includes(type.value, 'stockIn')) {
// pages/stockIn/detail
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 => {
stockList({ ...queryParams.value, ...query.value }).then(res => {
res.rows.forEach(e => {
e.showMore = false;
});
pagingRef.value.complete(res.rows)
}).catch(res => {
}).catch(() => {
pagingRef.value.complete(false)
})
} else if (type.value == 'stockOut') {
}else{
}
}
</script>
<style scoped lang="scss">
/* 搜索框:放在导航栏下面,不覆盖 */
.topSearch {
position: fixed;
top: 0;
top: var(--nav-height);
/* 关键:自动在导航栏下方 */
left: 0;
right: 0;
z-index: 999;
padding: 4rpx;
z-index: 99;
/* 比导航栏小 */
padding: 8rpx 16rpx;
background-color: #fff;
border-bottom: 1px solid #eee;
box-sizing: border-box;
}
.containerBox {
padding-top: 44px;
padding-top: 90px !important;
/* 撑开:导航栏+搜索框高度 */
width: 100%;
height: 100%;
box-sizing: border-box;
.zp-l-text-rpx {
font-size: 12px;
}
}
::v-deep .listBox {
@@ -150,20 +151,13 @@ const getList = (pageNo, pageSize) => {
margin-bottom: 4rpx;
}
.uni-list-item__container {
padding: 0;
}
.line {
display: flex;
// justify-content: space-between;
align-items: center;
// border-bottom: 1px solid #eee;
padding: 12rpx 20rpx;
}
.title {
display: flex;
justify-content: space-between;
font-weight: 600;
font-size: 13px;
@@ -172,15 +166,7 @@ const getList = (pageNo, pageSize) => {
.content {
font-weight: 500;
font-size: 13px;
}
.empty {
color: #D3D3D3;
}
span {
color: #696969;
}
}
</style>