出库对接
This commit is contained in:
@@ -1,64 +1,65 @@
|
||||
<!-- 唯一码发放页面 - 唯一码发放、唯一码编辑、入库单快速生成唯一码 -->
|
||||
<template>
|
||||
<view class="content">
|
||||
<navigation :title="title" :back-url="backUrl"></navigation>
|
||||
|
||||
<navigation :title="title" :back-url="backUrl"></navigation>
|
||||
<view class="contentBox">
|
||||
<view class="remarkLine">
|
||||
<span>备注:</span>
|
||||
<uni-easyinput type="text" v-model="formData.remark" :inputBorder="false" placeholder="请输入备注" />
|
||||
</view>
|
||||
|
||||
<!-- 物料列表 - 添加物料 -->
|
||||
<material-list ref="materialRef" :formData="formData" :remark="formData.remark" isEdit="1" :backStr="backStr"
|
||||
<material-list ref="materialRef" :formData="formData" :remark="formData.remark" isEdit="1"
|
||||
:pathParams="pathParams" />
|
||||
<button class="bottom-btn" type="primary" @click="handleSubmit">提交</button>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { onLoad } 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';
|
||||
const OPERATE_CONFIG = {
|
||||
// 唯一码创建
|
||||
issueUniqueCode: {
|
||||
title: '唯一码发放',
|
||||
back: 'pages/warehousing/index'
|
||||
},
|
||||
//唯一码编辑
|
||||
issueUniqueCode_edit: {
|
||||
title: '',
|
||||
back: '/pages/warehousing/uniqueCode/myUniqueCode'
|
||||
},
|
||||
//入库单入库
|
||||
stockIn_inbound: {
|
||||
title: '快速生成唯一码',
|
||||
back: '/pages/warehousing/stockIn/components/inbound'
|
||||
},
|
||||
}
|
||||
// ref:标题
|
||||
const title = ref('入库单开单')
|
||||
const backUrl = ref('pages/warehousing/index')
|
||||
const title = ref('')
|
||||
const backUrl = ref('')
|
||||
// 数据:路径参数
|
||||
const pathParams = ref('')
|
||||
// 数据:物料、备注
|
||||
const formData = ref({ remark: '', material: [] })
|
||||
// ref:绑定物料列表
|
||||
const materialRef = ref([])
|
||||
const backStr = computed(() => pathParams.value.back == 'inbound' ? `issueUniqueCode_inbound` : 'issueUniqueCode')
|
||||
// 接收路径参数 - 修改标题- 携带code、id、materialId
|
||||
onLoad((options) => {
|
||||
const query = objectToQuery(options)
|
||||
pathParams.value = options
|
||||
const config = options.type ? OPERATE_CONFIG[options.type] : OPERATE_CONFIG.issueUniqueCode
|
||||
|
||||
title.value = config.title ? config.title : options.title
|
||||
backUrl.value = config.back + query
|
||||
|
||||
})
|
||||
onShow(() => {
|
||||
// 唯一码发放、唯一码编辑、入库单快速生成唯一码
|
||||
const query = objectToQuery(pathParams.value)
|
||||
if (pathParams.value.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'
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// 快速生成唯一码时 已选择的物料列表初始为空 点击添加物料 去选择
|
||||
if (pathParams.value.back != 'inbound') {
|
||||
if (pathParams.value.type != 'inbound') {
|
||||
getMaterialList();
|
||||
}
|
||||
|
||||
@@ -67,12 +68,12 @@ onMounted(() => {
|
||||
const handleSubmit = () => {
|
||||
// 物料最新编辑数据
|
||||
const material = materialRef.value.getMaterialList()?.[0]
|
||||
|
||||
const query = objectToQuery(pathParams.value)
|
||||
const params = {
|
||||
remark: formData.value.remark,
|
||||
material: { ...material.material, unitId: '23' }
|
||||
}
|
||||
if (pathParams.value.back == `issueUniqueCode_inbound`) {
|
||||
if (pathParams.value.type == `issueUniqueCode_inbound`) {
|
||||
params.billNo = pathParams.value.billNo
|
||||
}
|
||||
if (pathParams.value.id) {
|
||||
@@ -87,7 +88,7 @@ const handleSubmit = () => {
|
||||
icon: 'success',
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: `/pages/warehousing/uniqueCode/myUniqueCode/detail?id=${pathParams.value.id}&title=${pathParams.value.title}`,
|
||||
url: OPERATE_CONFIG.issueUniqueCode_edit.back + query
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,17 +101,15 @@ const handleSubmit = () => {
|
||||
mask: true,
|
||||
icon: 'success',
|
||||
})
|
||||
if (_.includes(pathParams.value?.back, 'inbound')) {
|
||||
// /pages/warehousing/uniqueCode/myUniqueCode/detail?id=38&code=600038
|
||||
if (_.includes(pathParams.value?.type, 'inbound')) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/warehousing/stockIn/components/inbound?billNo=${pathParams.value.billNo}`,
|
||||
url: OPERATE_CONFIG.stockIn_inbound.back + query
|
||||
});
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: "/pages/warehousing/index"
|
||||
url: OPERATE_CONFIG.issueUniqueCode.back
|
||||
})
|
||||
}
|
||||
// /pages/warehousing/stockIn/components/inbound?billNo=WR1775032495153
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<!-- 物料选择 -->
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="topSearch" v-if="!backUrl.includes('inbound')">
|
||||
<view class="contentBox">
|
||||
<view class="topSearch" v-if="!isInbound">
|
||||
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false"
|
||||
@iconClick="getMaterialList" placeholder="请输入搜索内容" />
|
||||
</view>
|
||||
|
||||
<!-- 物料列表 -->
|
||||
<z-paging ref="pagingRef" class="containerBox" v-model="materialList" @query="getMaterialList"
|
||||
v-if="!backUrl.includes('inbound')">
|
||||
v-if="!isInbound">
|
||||
<uni-list>
|
||||
<uni-list-item v-for="item in materialList" :key="item.id" clickable class="material-card"
|
||||
@click="onMaterial(item)">
|
||||
@@ -33,7 +33,7 @@
|
||||
</uni-list>
|
||||
</z-paging>
|
||||
|
||||
<view v-if="backUrl.includes('inbound')">
|
||||
<view v-if="isInbound">
|
||||
<uni-list>
|
||||
<uni-list-item v-for="item in materialList" :key="item.id" clickable class="material-card"
|
||||
@click="onMaterial(item)">
|
||||
@@ -66,7 +66,28 @@ import { getTypeParentNames, } from '../until';
|
||||
import { objectToQuery } from '../../../until';
|
||||
import { getMaterial } from '@/api/uniqueCode'
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
|
||||
const OPERATE_CONFIG = {
|
||||
// 唯一码创建
|
||||
issueUniqueCode: {
|
||||
back: '/pages/warehousing/uniqueCode/issueUniqueCode/index'
|
||||
},
|
||||
//唯一码编辑
|
||||
issueUniqueCode_edit: {
|
||||
back: '/pages/warehousing/uniqueCode/issueUniqueCode/index'
|
||||
},
|
||||
//入库单开单
|
||||
stockIn: {
|
||||
back: '/pages/warehousing/stockIn/create'
|
||||
},
|
||||
//入库单入库
|
||||
stockIn_inbound: {
|
||||
back: '/pages/warehousing/uniqueCode/issueUniqueCode/index'
|
||||
},
|
||||
//入库单编辑
|
||||
stockIn_detail: {
|
||||
back: '/pages/warehousing/stockIn/create'
|
||||
},
|
||||
}
|
||||
// ref:下拉加载
|
||||
const pagingRef = ref(null)
|
||||
// 数据:查询参数
|
||||
@@ -77,9 +98,9 @@ const queryParams = ref({
|
||||
const materialList = ref([])
|
||||
// 数据:路径参数
|
||||
const pathParams = ref('')
|
||||
|
||||
// 数据:返回路径标识 stockIn 入库单开单 stockInDetail入库单编辑 issueUniqueCode唯一码 issueUniqueCode_inbound入库生成唯一码
|
||||
const backUrl = computed(() => pathParams?.value?.back)
|
||||
// 数据:返回路径标识
|
||||
const keyType = computed(() => pathParams?.value?.type)
|
||||
const isInbound = computed(() => _.includes(pathParams?.value?.type, 'inbound'))
|
||||
// 方法:获取列表
|
||||
const getMaterialList = () => {
|
||||
getMaterial(queryParams.value).then(res => {
|
||||
@@ -94,10 +115,7 @@ const getMaterialList = () => {
|
||||
// 方法:获取列表 - 入库生成唯一码
|
||||
const getMaterialListInbound = () => {
|
||||
const list = uni.getStorageSync('app_material_select_list')
|
||||
console.log('list',list);
|
||||
materialList.value=list
|
||||
|
||||
|
||||
materialList.value = list
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
@@ -118,76 +136,39 @@ const getStorageMaterial = (val) => {
|
||||
}
|
||||
return [{ ...val, quantity: 1 }]
|
||||
}
|
||||
// 方法:返回路径
|
||||
const toBack = (back) => {
|
||||
const path = objectToQuery({ ...pathParams.value })
|
||||
let url = ''
|
||||
switch (back) {
|
||||
case 'stockIn':
|
||||
// 入库单开单添加物料进入
|
||||
url = `/pages/warehousing/stockIn/create`
|
||||
break
|
||||
case 'issueUniqueCode':
|
||||
case 'issueUniqueCode_inbound':
|
||||
// 唯一码发放/入库生成唯一码
|
||||
url = `/pages/warehousing/uniqueCode/issueUniqueCode/index`
|
||||
break
|
||||
case 'stockInDetail':
|
||||
//我的入库单/入库单入库
|
||||
url = `/pages/warehousing/stockIn/components/detail`
|
||||
break
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `${url}${path}`
|
||||
})
|
||||
}
|
||||
// 方法:选择物料
|
||||
const onMaterial = (val) => {
|
||||
let materialChecked = uni.getStorageSync('app_material');
|
||||
const path = objectToQuery(pathParams.value)
|
||||
if (!Array.isArray(materialChecked)) {
|
||||
materialChecked = [];
|
||||
}
|
||||
|
||||
console.log(materialChecked, 'materialChecked==>');
|
||||
|
||||
const item = _.find(materialChecked, (i) => i.materialId ? i.materialId === val.id : i.id === val.id)
|
||||
console.log(item, 'item==>');
|
||||
|
||||
const idx = _.findIndex(materialChecked, (i) => i.materialId ? i.materialId === val.id : i.id === val.id)
|
||||
console.log(idx, 'idx==>', idx != -1 && item?.isDelete == '0', backUrl.value);
|
||||
|
||||
if (idx != -1 && item?.isDelete == '0') { // isDelete为0表示未删除 1为已删除数据不在对比范围内
|
||||
console.log(backUrl.value == 'stockIn', '11111111111111111111111111');
|
||||
|
||||
if (backUrl.value == 'stockIn') {
|
||||
console.log(111111111111);
|
||||
|
||||
if (keyType.value === 'stockIn') {
|
||||
uni.showToast({
|
||||
title: '该物料已添加,请勿重复添加!',
|
||||
mask: true,
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
//! 现在仅允许添加一条物料打印一个唯一码 但保留可添加多个
|
||||
// uni.showToast({
|
||||
// title: '该物料已添加,请勿重复添加!',
|
||||
// mask: true,
|
||||
// icon: 'none',
|
||||
// })
|
||||
toBack(backUrl.value)
|
||||
} else {
|
||||
console.log('执行到这里');
|
||||
|
||||
} else {
|
||||
if (val) {
|
||||
if (backUrl.value == 'stockIn') {
|
||||
if (keyType.value == 'stockIn') {
|
||||
materialChecked = [...materialChecked, { ...val, quantity: 1, isDelete: '0' }];
|
||||
} else {
|
||||
materialChecked = getStorageMaterial(val)
|
||||
}
|
||||
uni.setStorageSync('app_material', materialChecked);
|
||||
}
|
||||
toBack(backUrl.value)
|
||||
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: OPERATE_CONFIG?.[keyType.value].back + path
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -136,7 +136,7 @@ const toTraceability = () => {
|
||||
// 修改:唯一码的物料信息 - 携带title和唯一码id
|
||||
const toEdit = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/warehousing/uniqueCode/issueUniqueCode/index?title=${pathParams.value.code}&id=${pathParams.value.id}`,
|
||||
url: `/pages/warehousing/uniqueCode/issueUniqueCode/index?title=${pathParams.value.code}&id=${pathParams.value.id}type=issueUniqueCode_edit`,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!-- 唯一码 -->
|
||||
<template>
|
||||
<view class="content">
|
||||
<navigation title="唯一码" back-url="pages/warehousing/index"></navigation>
|
||||
<navigation title="唯一码" back-url="pages/warehousing/index"></navigation>
|
||||
<view class="contentBox">
|
||||
<view class="topSearch">
|
||||
<uni-easyinput type="text" v-model="queryParams.code" prefixIcon="search" :inputBorder="false"
|
||||
@iconClick="getMaterialList" placeholder="请输入关键词搜索" />
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 唯一码列表 -->
|
||||
@@ -61,11 +61,11 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { getStatusName, getDetail } from '../until';
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import { getUniqueCodeList, delUniqueCode, detailUniqueCode } from '@/api/uniqueCode'
|
||||
import QrCodeModal from './QrCodeModal.vue';
|
||||
import { getStatusName, getDetail } from '../until';
|
||||
import Navigation from '../../../components/Navigation.vue';
|
||||
import { getUniqueCodeList, delUniqueCode, detailUniqueCode } from '@/api/uniqueCode'
|
||||
|
||||
const queryParams = ref({
|
||||
code: ''
|
||||
@@ -144,10 +144,10 @@ const getDetailInfo = (row) => {
|
||||
<style scoped lang="scss">
|
||||
.topSearch {
|
||||
position: fixed;
|
||||
top: var(--nav-height); /* 关键:自动在导航栏下方 */
|
||||
top: var(--nav-height);
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 99; /* 比导航栏小 */
|
||||
z-index: 99;
|
||||
padding: 8rpx 16rpx;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
@@ -155,8 +155,7 @@ const getDetailInfo = (row) => {
|
||||
}
|
||||
|
||||
.containerBox {
|
||||
// padding: 0 12rpx;
|
||||
padding-top: 90px !important; /* 撑开:导航栏+搜索框高度 */
|
||||
padding-top: 100px !important;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
@@ -13,7 +13,7 @@ const statusMenu = [
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: "已打印",
|
||||
label: "入库单开单",
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
@@ -21,11 +21,15 @@ const statusMenu = [
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: "已出库,",
|
||||
label: "出库单开单",
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: "已配送,",
|
||||
value: 4,
|
||||
label: "已出库",
|
||||
},
|
||||
{
|
||||
value: 9,
|
||||
label: "已作废",
|
||||
},
|
||||
];
|
||||
export const getStatusName = (val) => {
|
||||
|
||||
Reference in New Issue
Block a user