2026-04-03 08:38:34 +08:00
|
|
|
|
<!--点击入库单入库后的入库页面 -->
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<view class="page">
|
2026-04-07 10:55:39 +08:00
|
|
|
|
<navigation title="入库" :back-url="backUrl"></navigation>
|
2026-04-03 08:38:34 +08:00
|
|
|
|
<!-- 仓库信息 - 仓库、存储区 -->
|
2026-04-14 08:46:29 +08:00
|
|
|
|
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo"
|
|
|
|
|
|
:pathParams="{ ...pathParams, back: 'stockIn' }" />
|
2026-04-03 08:38:34 +08:00
|
|
|
|
<!-- 物料列表 - 添加物料 -->
|
2026-04-14 08:46:29 +08:00
|
|
|
|
<material-list ref="materialRef" :formData="formData" isEdit="5" :pathParams="pathParams":extendData="{ selectMaterialList }" />
|
2026-04-03 08:38:34 +08:00
|
|
|
|
<!-- 底部操作栏 -->
|
|
|
|
|
|
<view class="bottom">
|
2026-04-23 14:35:54 +08:00
|
|
|
|
<uv-button type="primary" @tap="submitForm">入库</uv-button>
|
2026-04-03 08:38:34 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import _ from 'lodash';
|
2026-04-14 08:46:29 +08:00
|
|
|
|
import { ref, onMounted } from 'vue';
|
2026-04-07 10:55:39 +08:00
|
|
|
|
import { onLoad } from "@dcloudio/uni-app";
|
2026-04-14 08:46:29 +08:00
|
|
|
|
import { objectToQuery } from '../../../until';
|
2026-04-07 10:55:39 +08:00
|
|
|
|
import { inboundFinish, stockInDetail } from '@/api/stockIn';
|
2026-04-14 08:46:29 +08:00
|
|
|
|
import Navigation from '../../../components/Navigation.vue';
|
2026-04-03 08:38:34 +08:00
|
|
|
|
import MaterialList from '../../../components/MaterialList.vue';
|
|
|
|
|
|
import WarehousingInfo from '../../../components/WarehousingInfo.vue';
|
2026-04-14 08:46:29 +08:00
|
|
|
|
|
|
|
|
|
|
// stockIn-putAway:入库单入库编辑
|
2026-04-07 10:55:39 +08:00
|
|
|
|
const backUrl = ref('')
|
2026-04-03 08:38:34 +08:00
|
|
|
|
// 数据:路径参数
|
|
|
|
|
|
const pathParams = ref('')
|
|
|
|
|
|
// ref:物料绑定
|
|
|
|
|
|
const materialRef = ref([])
|
|
|
|
|
|
// ref:仓库信息绑定
|
|
|
|
|
|
const warehousingInfoRef = ref([])
|
2026-04-14 08:46:29 +08:00
|
|
|
|
// ref:选中的物料
|
2026-04-03 08:38:34 +08:00
|
|
|
|
const selectMaterialList = 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
|
|
|
|
|
|
// 获取物料信息 - 有uniqueCode
|
|
|
|
|
|
const material = uni.getStorageSync('app_material');
|
|
|
|
|
|
formData.value.material = material
|
|
|
|
|
|
// 获取物料信息 - 无uniqueCode
|
|
|
|
|
|
const selectMaterial = uni.getStorageSync('app_material_select_list');
|
|
|
|
|
|
selectMaterialList.value = selectMaterial
|
|
|
|
|
|
// 获取入库单备注
|
|
|
|
|
|
const billRemark = uni.getStorageSync('app_billRemark');
|
|
|
|
|
|
warehouseInfo.value.remark = billRemark
|
|
|
|
|
|
console.log('获取缓存', material, selectMaterial);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 方法:获取详情 - 更新物料得值 获取唯一码后回来
|
|
|
|
|
|
const getDetailInfo = () => {
|
|
|
|
|
|
stockInDetail({ billNo: pathParams.value.billNo }).then((res) => {
|
|
|
|
|
|
setDetailInfoToStorage(res.data?.itemList)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// 方法:存入缓存 - 更新物料得值 获取唯一码后回来
|
|
|
|
|
|
const setDetailInfoToStorage = (val) => {
|
|
|
|
|
|
// 过滤出有uniqueCode得值
|
|
|
|
|
|
const material = _.filter(val, (i) => i?.uniqueCode && i.status == '0')
|
|
|
|
|
|
const materialSelectList = _.filter(val, (i) => !i?.uniqueCode && i.status == '0')
|
|
|
|
|
|
uni.setStorageSync('app_material', material)
|
|
|
|
|
|
uni.setStorageSync('app_material_select_list', materialSelectList)
|
|
|
|
|
|
getMaterialList()
|
|
|
|
|
|
}
|
|
|
|
|
|
// 入库:提交表单
|
|
|
|
|
|
const submitForm = () => {
|
|
|
|
|
|
const info = warehousingInfoRef.value.getWarehousingInfo()
|
|
|
|
|
|
const materialInfo = materialRef.value.getMaterialList()
|
|
|
|
|
|
// 过滤出已删除的物料
|
|
|
|
|
|
const _materialInfo = _.filter(materialInfo, { isDelete: '0' })
|
|
|
|
|
|
let params = {
|
|
|
|
|
|
billType: '1',//0入库申请 1入库成功 2出库申请 3出库成功 4入库单已作废 5出库单已作废
|
|
|
|
|
|
billNo: pathParams.value.billNo,
|
|
|
|
|
|
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 }))
|
|
|
|
|
|
}
|
2026-04-14 08:46:29 +08:00
|
|
|
|
try {
|
|
|
|
|
|
inboundFinish(params).then((res) => {
|
|
|
|
|
|
uni.navigateTo({ url: backUrl.value });
|
|
|
|
|
|
})
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.log('入库单入库失败==》', err);
|
|
|
|
|
|
}
|
2026-04-03 08:38:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
// 数据:路径参数
|
|
|
|
|
|
onLoad((options) => {
|
|
|
|
|
|
if (!options.billNo) {
|
|
|
|
|
|
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
pathParams.value = options
|
2026-04-07 10:55:39 +08:00
|
|
|
|
const query = objectToQuery(pathParams.value)
|
|
|
|
|
|
backUrl.value = `/pages/warehousing/stockIn/components/detail${query}`
|
2026-04-03 08:38:34 +08:00
|
|
|
|
getDetailInfo()
|
2026-04-14 08:46:29 +08:00
|
|
|
|
|
2026-04-03 08:38:34 +08:00
|
|
|
|
})
|
2026-04-07 10:55:39 +08:00
|
|
|
|
|
2026-04-03 08:38:34 +08:00
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
getMaterialList()
|
|
|
|
|
|
})
|
|
|
|
|
|
</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: 100%;
|
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|