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

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

@@ -1,6 +1,6 @@
<template>
<!-- 自定义导航栏 -->
<navigation :title="pathParams.billNo">
<navigation :title="pathParams.billNo" :back-url="backUrl">
<template #right>
<view class="right-btn flex align-center justify-center ">
<uv-image @click="onPrinter" src="../../../../static/printer.png" width="20px" height="20px"
@@ -9,7 +9,7 @@
style="margin-top:10rpx" />
</view>
</template>
</Navigation>
</navigation>
<!-- 详情信息 -->
<detail-info type="stockIn" :detailInfo="detailInfo" />
@@ -28,6 +28,8 @@ import { objectToQuery, getBillType } from '../../../until';
import { stockInDetail, inboundBillVoid } from '../../../../api/stockIn';
import DetailInfo from '../../../components/DetailInfo.vue';
import Navigation from '../../../components/Navigation.vue';
// ref:返回路径
const backUrl = ref('')
// 数据:路径参数
const pathParams = ref('')
@@ -83,8 +85,9 @@ const setDetailInfoToStorage = (type) => {
// 按钮:入库单入库
const toPutAway = () => {
setDetailInfoToStorage('1')
const query = objectToQuery(pathParams.value)
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' })
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
getDetailInfo()
})

View File

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

View File

@@ -1,5 +1,6 @@
<template>
<view class="page">
<navigation :title="title" :back-url="backUrl"></navigation>
<!-- 仓库信息 - 仓库存储区 -->
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" :pathParams="pathParams" />
<!-- 物料列表 - 添加物料 -->
@@ -22,7 +23,8 @@ 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('')
@@ -31,6 +33,10 @@ 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仓库信息绑定
@@ -70,7 +76,7 @@ const scanCode = () => {
success: (res) => {
scanResult.value = res.result;
if (res.result) {
getMaterialUnique({ code: res.result }).then((response) => {
getMaterialUnique({ code: res.result }).then((response) => {
console.log('物料内容:', response);
if (`${response.code}` === '200') {
const material = uni.getStorageSync('app_material');
@@ -89,7 +95,7 @@ const scanCode = () => {
icon: 'none',
})
} else {
let _material = [...materialInfo, { ...response.data[0],uniqueCode:res.result }]
let _material = [...materialInfo, { ...response.data[0], uniqueCode: res.result }]
console.log('新的物料数组', _material);
formData.value.material = _material
uni.setStorageSync('app_material', formData.value.material)
@@ -169,8 +175,12 @@ onLoad((options) => {
})
// 修改标题若有billNo传入 修改标题
onShow(() => {
const query = objectToQuery(pathParams.value)
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>

View File

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

View File

@@ -1,6 +1,8 @@
<!-- 唯一码发放页面 -->
<!-- 唯一码发放页面 - 唯一码发放唯一码编辑入库单快速生成唯一码 -->
<template>
<view class="content">
<navigation :title="title" :back-url="backUrl"></navigation>
<view class="remarkLine">
<span>备注</span>
<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 { addUniqueCode, editUniqueCode } from '@/api/uniqueCode';
import MaterialList from '../../../components/MaterialList.vue';
import Navigation from '../../../components/Navigation.vue';
import { objectToQuery } from '../../../until';
import { computed } from 'vue';
import _ from 'lodash';
import { includes } from 'lodash';
// ref标题
const title = ref('入库单开单')
const backUrl = ref('pages/warehousing/index')
// 数据:路径参数
const pathParams = ref('')
// 数据:物料、备注
@@ -33,11 +40,19 @@ onLoad((options) => {
})
onShow(() => {
// 唯一码发放、唯一码编辑、入库单快速生成唯一码
const query = objectToQuery(pathParams.value)
if (pathParams.value.title) {
uni.setNavigationBarTitle({ title: pathParams.value.title })
}
if (pathParams.value.back == 'inbound') {
uni.setNavigationBarTitle({ title: '快速生成唯一码' })
// 唯一码编辑 /pages/warehousing/uniqueCode/myUniqueCode/detail?id=64&code=600064
title.value = pathParams.value.title
backUrl.value = `/pages/warehousing/uniqueCode/myUniqueCode${query}`
} 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>
<!-- 自定义导航栏 -->
<navigation :title="pathParams.code ? pathParams.code : '唯一码发放'">
<navigation :title="title" :back-url="backUrl">
<template #right>
<view class="right-btn flex align-center justify-center ">
<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 MaterialList from '../../../components/MaterialList.vue'
import Navigation from '../../../components/Navigation.vue'
const backUrl = ref('')
const title = ref('')
const modalRef = ref()
// 路径参数
const pathParams = ref('')
@@ -146,12 +147,19 @@ onLoad((options) => {
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
return
}
pathParams.value = options
getDetailInfo()
})
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>
@@ -180,5 +188,4 @@ onShow(() => {
}
}
</style>

View File

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