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

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

@@ -107,11 +107,11 @@
// ========== 入库单模块 ========== // ========== 入库单模块 ==========
{ {
"path": "pages/warehousing/stockIn/create", "path": "pages/warehousing/stockIn/create",
"style": { "navigationBarTitleText": "入库单开单" } "style": { "navigationBarTitleText": "入库单开单" , "navigationStyle": "custom"}
}, },
{ {
"path": "pages/warehousing/stockIn/my", "path": "pages/warehousing/stockIn/my",
"style": { "navigationBarTitleText": "我的入库单" } "style": { "navigationBarTitleText": "我的入库单", "navigationStyle": "custom" }
}, },
{ {
"path": "pages/warehousing/stockIn/components/detail", "path": "pages/warehousing/stockIn/components/detail",
@@ -128,21 +128,20 @@
{ {
"path": "pages/warehousing/stockIn/components/inbound", "path": "pages/warehousing/stockIn/components/inbound",
"style": { "navigationBarTitleText": "入库" } "style": { "navigationBarTitleText": "入库" }
} },
// ========== 出库单模块 ========== // ========== 出库单模块 ==========
// { {
// "path": "pages/stockOut/create", "path": "pages/warehousing/stockOut/create",
// "style": { "navigationBarTitleText": "出库单开单" } "style": { "navigationBarTitleText": "出库单开单" }
// }, },
// { {
// "path": "pages/stockOut/my", "path": "pages/warehousing/stockOut/my",
// "style": { "navigationBarTitleText": "我的出库单" } "style": { "navigationBarTitleText": "我的出库单" }
// }, },
// { {
// "path": "pages/stockOut/warehousing", "path": "pages/warehousing/stockOut/outbound",
// "style": { "navigationBarTitleText": "出库单出库" } "style": { "navigationBarTitleText": "出库单出库" }
// } }
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",

View File

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

View File

@@ -3,73 +3,117 @@
<view class="nav-placeholder" :style="{ height: navHeight + 'px' }"></view> <view class="nav-placeholder" :style="{ height: navHeight + 'px' }"></view>
<view class="navbar" :style="{ paddingTop: statusBarHeight + 'px' }"> <view class="navbar" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="left" @click="goBack"> <view class="left" @click="goBack">
<uni-icons type="left" size="18" /> <uni-icons type="left" size="18" />
</view> </view>
<!-- 中间标题 --> <!-- 标题 -->
<view class="title">{{ title }}</view> <view class="title">{{ title }}</view>
<!-- 右侧父组件传入插槽 --> <!-- 右侧插槽 -->
<view class="right"> <view class="right">
<slot name="right"></slot> <slot name="right"></slot>
</view> </view>
</view> </view>
<view class="content"> <view class="content"></view>
</view>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, toRefs } from 'vue' 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({ const props = defineProps({
title: { type: String, default: '' }, title: {
backUrl: { type: String, default: '' }, type: String,
default: ''
},
backUrl: {
type: String,
default: ''
},
showBack: {
type: Boolean,
default: true
}
}) })
const { backUrl, title, showBack } = toRefs(props)
// 状态栏 + 导航栏高度
const statusBarHeight = ref(0) const statusBarHeight = ref(0)
const navHeight = 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({ const goBack = () => {
url: `/${back.value}`, 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 { } else {
// 无目标路由 正常返回
uni.navigateBack() uni.navigateBack()
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/* 导航栏占位:撑开页面内容,不被遮挡 */
.nav-placeholder {
width: 100%;
}
/* 导航栏主体fixed 固定在顶部 */
.navbar { .navbar {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 70px; // 高度由 状态栏 + 44px 决定,不要写死 70px
height: 44px;
background: #fff; background: #fff;
display: flex; display: flex;
align-items: center; align-items: center;
@@ -77,21 +121,24 @@ const goBack = () => {
padding: 0 20rpx; padding: 0 20rpx;
box-sizing: border-box; box-sizing: border-box;
z-index: 999; z-index: 999;
// margin-bottom: 8px;
} }
.left { .left {
display: flex; display: flex;
align-items: center; align-items: center;
} justify-content: center;
width: 40rpx;
.back-txt { height: 100%;
margin-left: 6rpx;
} }
.title { .title {
font-size: 14px; font-size: 16rpx;
font-weight: bold; font-weight: bold;
color: #333;
max-width: 400rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
.right { .right {
@@ -101,7 +148,8 @@ const goBack = () => {
justify-content: flex-end; justify-content: flex-end;
} }
.nav-placeholder { .content {
width: 100%; width: 100%;
box-sizing: border-box;
} }
</style> </style>

View File

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

View File

@@ -121,3 +121,11 @@ export const objectToQuery = (params) => {
return "?" + query; return "?" + query;
}; };
// 获取配置的导航路由
export const getTabBarList = () => {
// 1. 从 uni-app 全局配置中读取 tabBar
const tabBarConfig = __uniConfig.tabBar || {}
// 2. 获取 list 数组
const tabList = tabBarConfig.list || []
return tabList
}

View File

@@ -1,6 +1,6 @@
<template> <template>
<!-- 自定义导航栏 --> <!-- 自定义导航栏 -->
<navigation :title="pathParams.billNo"> <navigation :title="pathParams.billNo" :back-url="backUrl">
<template #right> <template #right>
<view class="right-btn flex align-center justify-center "> <view class="right-btn flex align-center justify-center ">
<uv-image @click="onPrinter" src="../../../../static/printer.png" width="20px" height="20px" <uv-image @click="onPrinter" src="../../../../static/printer.png" width="20px" height="20px"
@@ -9,7 +9,7 @@
style="margin-top:10rpx" /> style="margin-top:10rpx" />
</view> </view>
</template> </template>
</Navigation> </navigation>
<!-- 详情信息 --> <!-- 详情信息 -->
<detail-info type="stockIn" :detailInfo="detailInfo" /> <detail-info type="stockIn" :detailInfo="detailInfo" />
@@ -28,6 +28,8 @@ import { objectToQuery, getBillType } from '../../../until';
import { stockInDetail, inboundBillVoid } from '../../../../api/stockIn'; import { stockInDetail, inboundBillVoid } from '../../../../api/stockIn';
import DetailInfo from '../../../components/DetailInfo.vue'; import DetailInfo from '../../../components/DetailInfo.vue';
import Navigation from '../../../components/Navigation.vue'; import Navigation from '../../../components/Navigation.vue';
// ref:返回路径
const backUrl = ref('')
// 数据:路径参数 // 数据:路径参数
const pathParams = ref('') const pathParams = ref('')
@@ -83,8 +85,9 @@ const setDetailInfoToStorage = (type) => {
// 按钮:入库单入库 // 按钮:入库单入库
const toPutAway = () => { const toPutAway = () => {
setDetailInfoToStorage('1') setDetailInfoToStorage('1')
const query = objectToQuery(pathParams.value)
uni.navigateTo({ uni.navigateTo({
url: `/pages/warehousing/stockIn/components/inbound?billNo=${pathParams.value.billNo}` url: `/pages/warehousing/stockIn/components/inbound${query}`
}); });
} }
// 编辑 // 编辑
@@ -103,6 +106,11 @@ onLoad((options) => {
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' }) uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
return return
} }
if (options.type == 'stockIn') {
backUrl.value = '/pages/warehousing/stockIn/my'
} else if (options.type == 'stockIn-putAway') {
backUrl.value = '/pages/warehousing/stockIn/putaway'
}
pathParams.value = options pathParams.value = options
getDetailInfo() getDetailInfo()
}) })

View File

@@ -1,6 +1,8 @@
<!--点击入库单入库后的入库页面 --> <!--点击入库单入库后的入库页面 -->
<template> <template>
<view class="page"> <view class="page">
<navigation title="入库" :back-url="backUrl"></navigation>
<!-- 仓库信息 - 仓库存储区 --> <!-- 仓库信息 - 仓库存储区 -->
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" :pathParams="pathParams" /> <warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" :pathParams="pathParams" />
<!-- 物料列表 - 添加物料 --> <!-- 物料列表 - 添加物料 -->
@@ -17,12 +19,14 @@
import _ from 'lodash'; import _ from 'lodash';
import { ref } from 'vue'; import { ref } from 'vue';
import { onLoad, onShow } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import { inboundFinish, stockInDetail,inboundBillVoid } from '@/api/stockIn'; import { inboundFinish, stockInDetail } from '@/api/stockIn';
import MaterialList from '../../../components/MaterialList.vue'; import MaterialList from '../../../components/MaterialList.vue';
import WarehousingInfo from '../../../components/WarehousingInfo.vue'; import WarehousingInfo from '../../../components/WarehousingInfo.vue';
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import Navigation from '../../../components/Navigation.vue';
import {objectToQuery} from '../../../until';
const backUrl = ref('')
// 数据:路径参数 // 数据:路径参数
const pathParams = ref('') const pathParams = ref('')
// 标志:是否为编辑 // 标志:是否为编辑
@@ -103,7 +107,7 @@ const submitForm = () => {
// stockIn // stockIn
// /pages/warehousing/stockIn/components/detail // /pages/warehousing/stockIn/components/detail
uni.navigateTo({ uni.navigateTo({
url: `/pages/warehousing/stockIn/components/detail?billNo=${pathParams.value.billNo}&type=stockIn` url: backUrl.value
}); });
console.log(res, '入库单入库'); console.log(res, '入库单入库');
}) })
@@ -117,16 +121,15 @@ onLoad((options) => {
return return
} }
pathParams.value = options pathParams.value = options
// stockIn-putAway
// stockIn
const query = objectToQuery(pathParams.value)
backUrl.value = `/pages/warehousing/stockIn/components/detail${query}`
getDetailInfo() getDetailInfo()
flag.value = options.type flag.value = options.type
isEdit.value = _.includes(options?.type, 'stockIn') isEdit.value = _.includes(options?.type, 'stockIn')
}) })
// 修改标题若有billNo传入 修改标题
onShow(() => {
if (pathParams.value.billNo) {
uni.setNavigationBarTitle({ title: pathParams.value.billNo })
}
})
onMounted(() => { onMounted(() => {
getMaterialList() getMaterialList()
}) })

View File

@@ -1,5 +1,6 @@
<template> <template>
<view class="page"> <view class="page">
<navigation :title="title" :back-url="backUrl"></navigation>
<!-- 仓库信息 - 仓库存储区 --> <!-- 仓库信息 - 仓库存储区 -->
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" :pathParams="pathParams" /> <warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" :pathParams="pathParams" />
<!-- 物料列表 - 添加物料 --> <!-- 物料列表 - 添加物料 -->
@@ -22,7 +23,8 @@ import { addStockIn, stockInUpdate } from '@/api/stockIn';
import { getMaterialUnique } from '@/api/uniqueCode'; import { getMaterialUnique } from '@/api/uniqueCode';
import MaterialList from '../../components/MaterialList.vue'; import MaterialList from '../../components/MaterialList.vue';
import WarehousingInfo from '../../components/WarehousingInfo.vue'; import WarehousingInfo from '../../components/WarehousingInfo.vue';
import Navigation from '../../components/Navigation.vue';
import { includes } from 'lodash';
// 数据:路径参数 // 数据:路径参数
const pathParams = ref('') const pathParams = ref('')
@@ -31,6 +33,10 @@ const isEdit = ref('')
// 标志:区分页面 进入页面的状态 null新建 stockIn:入库编辑 stockIn-putAway入库单入库编辑 // 标志:区分页面 进入页面的状态 null新建 stockIn:入库编辑 stockIn-putAway入库单入库编辑
const flag = ref('') const flag = ref('')
// ref标题
const title = ref('入库单开单')
const backUrl = ref('pages/warehousing/index')
// ref物料绑定 // ref物料绑定
const materialRef = ref([]) const materialRef = ref([])
// ref仓库信息绑定 // ref仓库信息绑定
@@ -70,7 +76,7 @@ const scanCode = () => {
success: (res) => { success: (res) => {
scanResult.value = res.result; scanResult.value = res.result;
if (res.result) { if (res.result) {
getMaterialUnique({ code: res.result }).then((response) => { getMaterialUnique({ code: res.result }).then((response) => {
console.log('物料内容:', response); console.log('物料内容:', response);
if (`${response.code}` === '200') { if (`${response.code}` === '200') {
const material = uni.getStorageSync('app_material'); const material = uni.getStorageSync('app_material');
@@ -89,7 +95,7 @@ const scanCode = () => {
icon: 'none', icon: 'none',
}) })
} else { } else {
let _material = [...materialInfo, { ...response.data[0],uniqueCode:res.result }] let _material = [...materialInfo, { ...response.data[0], uniqueCode: res.result }]
console.log('新的物料数组', _material); console.log('新的物料数组', _material);
formData.value.material = _material formData.value.material = _material
uni.setStorageSync('app_material', formData.value.material) uni.setStorageSync('app_material', formData.value.material)
@@ -169,8 +175,12 @@ onLoad((options) => {
}) })
// 修改标题若有billNo传入 修改标题 // 修改标题若有billNo传入 修改标题
onShow(() => { onShow(() => {
const query = objectToQuery(pathParams.value)
if (pathParams.value.billNo) { if (pathParams.value.billNo) {
uni.setNavigationBarTitle({ title: pathParams.value.billNo }) title.value = pathParams.value.billNo
}
if ( includes(pathParams.value.type,'stockIn') ) {
backUrl.value = `/pages/warehousing/stockIn/components/detail${query}`
} }
}) })
</script> </script>

View File

@@ -1,4 +1,5 @@
<template> <template>
<!-- 我的入库单 -->
<search-list type="stockIn" :onDetail="onDetail" /> <search-list type="stockIn" :onDetail="onDetail" />
</template> </template>
<script setup> <script setup>

View File

@@ -0,0 +1,231 @@
<template>
<view class="page">
<navigation :title="title" :back-url="backUrl"></navigation>
<!-- 仓库信息 - 仓库存储区 -->
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" :pathParams="pathParams" />
<!-- 物料列表 - 添加物料 -->
<material-list ref="materialRef" :formData="formData" isEdit="1" backStr="stockOut" :pathParams="pathParams" />
<!-- 底部操作栏 -->
<view class="bottom">
<uv-button @click="scanCode">扫码添加</uv-button>
<uv-button type="primary" @click="submitForm">提交</uv-button>
</view>
</view>
</template>
<script setup>
import _ from 'lodash';
import { ref } from 'vue';
import { objectToQuery } from '../../until';
import { onLoad, onShow } from "@dcloudio/uni-app";
import { addStockIn, stockInUpdate } from '@/api/stockIn';
import { getMaterialUnique } from '@/api/uniqueCode';
import MaterialList from '../../components/MaterialList.vue';
import WarehousingInfo from '../../components/WarehousingInfo.vue';
import Navigation from '../../components/Navigation.vue';
import { includes } from 'lodash';
// 数据:路径参数
const pathParams = ref('')
// 标志:是否为编辑
const isEdit = ref('')
// 标志:区分页面 进入页面的状态 null新建 stockIn:入库编辑 stockIn-putAway入库单入库编辑
const flag = ref('')
// ref标题
const title = ref('入库单开单')
const backUrl = ref('pages/warehousing/index')
// ref物料绑定
const materialRef = ref([])
// ref仓库信息绑定
const warehousingInfoRef = ref([])
// 数据:物料列表
const formData = ref([{ remark: '', material: [] }])
// 数据:仓库信息
const warehouseInfo = ref({ warehousing: {}, storageArea: {}, remark: '' })
// 数据:获取缓存信息
const getMaterialList = () => {
// 获取仓库信息
const warehouse = uni.getStorageSync('app_warehousing');
warehouseInfo.value.warehousing = warehouse
// 获取存储区信息
const storageArea = uni.getStorageSync('app_storageArea');
warehouseInfo.value.storageArea = storageArea
// 获取物料信息
const material = uni.getStorageSync('app_material');
formData.value.material = material
// 获取入库单备注
const billRemark = uni.getStorageSync('app_billRemark');
warehouseInfo.value.remark = billRemark
}
getMaterialList();
const scanResult = ref('')
// 扫码添加
const scanCode = () => {
// 先校验是否支持扫码
uni.scanCode({
scanType: ['qrCode', 'barCode'], // 支持二维码 + 条形码
success: (res) => {
scanResult.value = res.result;
if (res.result) {
getMaterialUnique({ code: res.result }).then((response) => {
console.log('物料内容:', response);
if (`${response.code}` === '200') {
const material = uni.getStorageSync('app_material');
// 处理物料信息 合并
const materialInfo = _.filter(material, { isDelete: '0' });
console.log('materialInfo', materialInfo);
const materialId = response.data?.[0]?.materialId;
console.log('materialId', materialId);
const idx = _.findIndex(materialInfo, (i) => i.materialId ? i.materialId == materialId : i.id == materialId);
console.log('已选中是否有重复数据', idx);
if (idx != -1) {
uni.showToast({
title: '该物料已添加,请勿重复添加!',
mask: true,
icon: 'none',
})
} else {
let _material = [...materialInfo, { ...response.data[0], uniqueCode: res.result }]
console.log('新的物料数组', _material);
formData.value.material = _material
uni.setStorageSync('app_material', formData.value.material)
}
} else {
console.log(response.code, 'response.code');
}
})
}
},
fail: () => {
uni.showToast({ title: '扫码失败', icon: 'none' });
}
});
};
// 提交表单
const submitForm = () => {
const info = warehousingInfoRef.value.getWarehousingInfo()
const materialInfo = materialRef.value.getMaterialList()
if (!info.warehousing?.[0].deptCode) {
uni.showToast({
title: '请填写仓库信息',
mask: true,
icon: 'error',
})
return
}
if (!info.storageArea?.[0].deptName) {
uni.showToast({
title: '请填写存储区信息',
mask: true,
icon: 'error',
})
return
}
let params = {
warehouseCode: info.warehousing?.[0].deptCode || info.warehousing?.[0].deptId,
warehouseName: info.warehousing?.[0].deptName,
areaCode: info.storageArea?.[0].deptCode || info.storageArea?.[0].deptId,
areaName: info.storageArea?.[0].deptName,
remark: info.remark,
billRemark: info.remark,
itemList: _.map(materialInfo, (i) => ({ ...i.material }))
}
console.log(params, isEdit, !isEdit, info, materialInfo, '入参params');
// 新建
if (!isEdit.value) {
addStockIn(params).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '入库单创建成功',
mask: true,
icon: 'success',
})
uni.navigateTo({
url: `/pages/warehousing/stockIn/my`,
});
}
})
} else if (isEdit.value) {
// 编辑
params.billNo = pathParams.value?.billNo
params.billId = pathParams.value?.billId
const query = objectToQuery(pathParams.value)
stockInUpdate(params).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '入库单编辑成功',
mask: true,
icon: 'success',
})
let url = `/pages/warehousing/stockIn/components/detail${query}`
uni.navigateTo({
url: url,
});
}
})
}
}
// 数据:路径参数
onLoad((options) => {
console.log(options, 'options', _.includes(options?.type, 'stockIn'));
pathParams.value = options
flag.value = options.type
isEdit.value = _.includes(options?.type, 'stockIn')
})
// 修改标题若有billNo传入 修改标题
onShow(() => {
const query = objectToQuery(pathParams.value)
if (pathParams.value.billNo) {
title.value = pathParams.value.billNo
}
if (includes(pathParams.value.type, 'stockOut')) {
backUrl.value = `/pages/warehousing/stockIn/components/detail${query}`
}
})
</script>
<style lang="scss" scoped>
.page {
background: #f5f5f5;
min-height: 100vh;
}
/* 底部按钮 */
::v-deep .bottom {
position: fixed;
bottom: 0;
height: 60rpx;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
.uv-button-wrapper {
width: 50%;
border-radius: 0;
}
.uv-button--info {
background-color: #07c160;
color: #fff;
}
}
</style>

View File

@@ -0,0 +1,8 @@
<template>
<!-- 我的出库单 -->
<search-list type="stockOut" :onDetail="onDetail" />
</template>
<script setup>
import SearchList from '../../components/SearchList.vue';
</script>

View File

@@ -0,0 +1,10 @@
<!-- putAway出库单入库 -->
<template>
<search-list type="stockOut-outbound" :onDetail="onDetail" :query="{ billType: '0' }" />
</template>
<script setup>
import SearchList from '../../components/SearchList.vue';
</script>

View File

@@ -13,7 +13,7 @@
<script setup> <script setup>
import { onShow } from '@dcloudio/uni-app'; import { onShow } from '@dcloudio/uni-app';
import {removeStorage} from '../until'; import { removeStorage } from '../until';
const menuList = [ const menuList = [
{ {
id: 'inventory', id: 'inventory',
@@ -169,6 +169,10 @@ const menuList = [
title: '出库单开单', title: '出库单开单',
click: () => { click: () => {
console.log('出库单开单') console.log('出库单开单')
removeStorage()
uni.navigateTo({
url: '/pages/warehousing/stockOut/create'
});
} }
}, },
{ {
@@ -177,6 +181,10 @@ const menuList = [
title: '我的出库单', title: '我的出库单',
click: () => { click: () => {
console.log('我的出库单') console.log('我的出库单')
removeStorage()
uni.navigateTo({
url: '/pages/warehousing/stockOut/my'
});
} }
}, },
{ {
@@ -185,6 +193,10 @@ const menuList = [
title: '出库单出库', title: '出库单出库',
click: () => { click: () => {
console.log('出库单出库') console.log('出库单出库')
removeStorage()
uni.navigateTo({
url: '/pages/warehousing/stockOut/outbound'
});
} }
}, },
@@ -228,28 +240,28 @@ const menuList = [
}, },
] ]
}, },
// { {
// id: 'transportCheckIn', id: 'transportCheckIn',
// title: '运输打卡', title: '运输打卡',
// menuItem: [ menuItem: [
// { {
// id: "transportCheckIn_transportCheckIn", id: "transportCheckIn_transportCheckIn",
// icon: '../../static/transportCheckIn/transportCheckIn.png', icon: '../../static/transportCheckIn/transportCheckIn.png',
// title: '运输打卡', title: '运输打卡',
// click: () => { click: () => {
// console.log('运输打卡') console.log('运输打卡')
// } }
// }, },
// { {
// id: "transportCheckIn_myTransportCheckIn", id: "transportCheckIn_myTransportCheckIn",
// icon: '../../static/transportCheckIn/myTransportCheckIn.png', icon: '../../static/transportCheckIn/myTransportCheckIn.png',
// title: '我的运输打卡', title: '我的运输打卡',
// click: () => { click: () => {
// console.log('我的运输打卡') console.log('我的运输打卡')
// } }
// }, },
// ] ]
// }, },
] ]
onShow(() => { onShow(() => {
uni.removeStorage({ uni.removeStorage({

View File

@@ -1,6 +1,8 @@
<!-- 唯一码发放页面 --> <!-- 唯一码发放页面 - 唯一码发放唯一码编辑入库单快速生成唯一码 -->
<template> <template>
<view class="content"> <view class="content">
<navigation :title="title" :back-url="backUrl"></navigation>
<view class="remarkLine"> <view class="remarkLine">
<span>备注</span> <span>备注</span>
<uni-easyinput type="text" v-model="formData.remark" :inputBorder="false" placeholder="请输入备注" /> <uni-easyinput type="text" v-model="formData.remark" :inputBorder="false" placeholder="请输入备注" />
@@ -17,9 +19,14 @@ import { ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app'; import { onLoad, onShow } from '@dcloudio/uni-app';
import { addUniqueCode, editUniqueCode } from '@/api/uniqueCode'; import { addUniqueCode, editUniqueCode } from '@/api/uniqueCode';
import MaterialList from '../../../components/MaterialList.vue'; import MaterialList from '../../../components/MaterialList.vue';
import Navigation from '../../../components/Navigation.vue';
import { objectToQuery } from '../../../until';
import { computed } from 'vue'; import { computed } from 'vue';
import _ from 'lodash'; import _ from 'lodash';
import { includes } from 'lodash';
// ref标题
const title = ref('入库单开单')
const backUrl = ref('pages/warehousing/index')
// 数据:路径参数 // 数据:路径参数
const pathParams = ref('') const pathParams = ref('')
// 数据:物料、备注 // 数据:物料、备注
@@ -33,11 +40,19 @@ onLoad((options) => {
}) })
onShow(() => { onShow(() => {
// 唯一码发放、唯一码编辑、入库单快速生成唯一码
const query = objectToQuery(pathParams.value)
if (pathParams.value.title) { if (pathParams.value.title) {
uni.setNavigationBarTitle({ title: pathParams.value.title }) // 唯一码编辑 /pages/warehousing/uniqueCode/myUniqueCode/detail?id=64&code=600064
} title.value = pathParams.value.title
if (pathParams.value.back == 'inbound') { backUrl.value = `/pages/warehousing/uniqueCode/myUniqueCode${query}`
uni.setNavigationBarTitle({ title: '快速生成唯一码' }) } else if (includes(pathParams.value.back, 'inbound')) {
// 入库单快速生成唯一码 /pages/warehousing/uniqueCode/issueUniqueCode/index?billNo=WR1775527275119&back=inbound
title.value = '快速生成唯一码'
backUrl.value = `/pages/warehousing/stockIn/components/inbound${query}`
} else {
title.value = '唯一码发放'
backUrl.value = 'pages/warehousing/index'
} }
}) })

View File

@@ -1,7 +1,7 @@
<!-- 唯一码详情 --> <!-- 唯一码详情 -->
<template> <template>
<!-- 自定义导航栏 --> <!-- 自定义导航栏 -->
<navigation :title="pathParams.code ? pathParams.code : '唯一码发放'"> <navigation :title="title" :back-url="backUrl">
<template #right> <template #right>
<view class="right-btn flex align-center justify-center "> <view class="right-btn flex align-center justify-center ">
<uv-image @click="toEdit" src="../../../../static/edit.png" class="ml-24" width="20px" height="20px" <uv-image @click="toEdit" src="../../../../static/edit.png" class="ml-24" width="20px" height="20px"
@@ -71,7 +71,8 @@ import { getStatusName, getDetail } from '../until';
import QrCodeModal from './QrCodeModal.vue'; import QrCodeModal from './QrCodeModal.vue';
import MaterialList from '../../../components/MaterialList.vue' import MaterialList from '../../../components/MaterialList.vue'
import Navigation from '../../../components/Navigation.vue' import Navigation from '../../../components/Navigation.vue'
const backUrl = ref('')
const title = ref('')
const modalRef = ref() const modalRef = ref()
// 路径参数 // 路径参数
const pathParams = ref('') const pathParams = ref('')
@@ -146,12 +147,19 @@ onLoad((options) => {
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' }) uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
return return
} }
pathParams.value = options pathParams.value = options
getDetailInfo() getDetailInfo()
}) })
onShow(() => { onShow(() => {
uni.setNavigationBarTitle({ title: pathParams.value.code }) if (pathParams.value.code || pathParams.value.title) {
backUrl.value = '/pages/warehousing/uniqueCode/myUniqueCode/index'
title.value = pathParams.value.title || pathParams.value.code
} else {
backUrl.value = '/pages/warehousing/index'
title.value = '唯一码发放'
}
}) })
</script> </script>
@@ -180,5 +188,4 @@ onShow(() => {
} }
} }
</style> </style>

View File

@@ -1,9 +1,11 @@
<!-- 唯一码 --> <!-- 唯一码 -->
<template> <template>
<view class="content"> <view class="content">
<navigation title="唯一码" back-url="pages/warehousing/index"></navigation>
<view class="topSearch"> <view class="topSearch">
<uni-easyinput type="text" v-model="queryParams.code" prefixIcon="search" :inputBorder="false" <uni-easyinput type="text" v-model="queryParams.code" prefixIcon="search" :inputBorder="false"
@iconClick="getMaterialList" placeholder="请输入关键词搜索" /> @iconClick="getMaterialList" placeholder="请输入关键词搜索" />
</view> </view>
<!-- 唯一码列表 --> <!-- 唯一码列表 -->
@@ -63,6 +65,7 @@ import { getStatusName, getDetail } from '../until';
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import { getUniqueCodeList, delUniqueCode, detailUniqueCode } from '@/api/uniqueCode' import { getUniqueCodeList, delUniqueCode, detailUniqueCode } from '@/api/uniqueCode'
import QrCodeModal from './QrCodeModal.vue'; import QrCodeModal from './QrCodeModal.vue';
import Navigation from '../../../components/Navigation.vue';
const queryParams = ref({ const queryParams = ref({
code: '' code: ''
@@ -141,11 +144,11 @@ const getDetailInfo = (row) => {
<style scoped lang="scss"> <style scoped lang="scss">
.topSearch { .topSearch {
position: fixed; position: fixed;
top: 0; top: var(--nav-height); /* 关键:自动在导航栏下方 */
left: 0; left: 0;
right: 0; right: 0;
z-index: 999; z-index: 99; /* 比导航栏小 */
padding: 10px; padding: 8rpx 16rpx;
background-color: #fff; background-color: #fff;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
box-sizing: border-box; box-sizing: border-box;
@@ -153,7 +156,7 @@ const getDetailInfo = (row) => {
.containerBox { .containerBox {
// padding: 0 12rpx; // padding: 0 12rpx;
padding-top: 60px; padding-top: 90px !important; /* 撑开:导航栏+搜索框高度 */
width: 100%; width: 100%;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;