出库对接
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
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user