完善入库跳转以及出库创建页面
This commit is contained in:
31
pages.json
31
pages.json
@@ -107,11 +107,11 @@
|
||||
// ========== 入库单模块 ==========
|
||||
{
|
||||
"path": "pages/warehousing/stockIn/create",
|
||||
"style": { "navigationBarTitleText": "入库单开单" }
|
||||
"style": { "navigationBarTitleText": "入库单开单" , "navigationStyle": "custom"}
|
||||
},
|
||||
{
|
||||
"path": "pages/warehousing/stockIn/my",
|
||||
"style": { "navigationBarTitleText": "我的入库单" }
|
||||
"style": { "navigationBarTitleText": "我的入库单", "navigationStyle": "custom" }
|
||||
},
|
||||
{
|
||||
"path": "pages/warehousing/stockIn/components/detail",
|
||||
@@ -128,21 +128,20 @@
|
||||
{
|
||||
"path": "pages/warehousing/stockIn/components/inbound",
|
||||
"style": { "navigationBarTitleText": "入库" }
|
||||
}
|
||||
|
||||
},
|
||||
// ========== 出库单模块 ==========
|
||||
// {
|
||||
// "path": "pages/stockOut/create",
|
||||
// "style": { "navigationBarTitleText": "出库单开单" }
|
||||
// },
|
||||
// {
|
||||
// "path": "pages/stockOut/my",
|
||||
// "style": { "navigationBarTitleText": "我的出库单" }
|
||||
// },
|
||||
// {
|
||||
// "path": "pages/stockOut/warehousing",
|
||||
// "style": { "navigationBarTitleText": "出库单出库" }
|
||||
// }
|
||||
{
|
||||
"path": "pages/warehousing/stockOut/create",
|
||||
"style": { "navigationBarTitleText": "出库单开单" }
|
||||
},
|
||||
{
|
||||
"path": "pages/warehousing/stockOut/my",
|
||||
"style": { "navigationBarTitleText": "我的出库单" }
|
||||
},
|
||||
{
|
||||
"path": "pages/warehousing/stockOut/outbound",
|
||||
"style": { "navigationBarTitleText": "出库单出库" }
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
<view class="remarkLine">
|
||||
<text>物料列表</text>
|
||||
<uv-button type="primary" v-if="isEdit == 1" :plain="true" size="small" text="添加物料"
|
||||
@click="toMaterial"></uv-button>
|
||||
<uv-button type="primary" v-if="isAddMaterial" :plain="true"
|
||||
size="small" text="添加物料" @click="toMaterial"></uv-button>
|
||||
<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 style="color: red;">
|
||||
@@ -99,7 +99,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, onMounted, ref, toRefs } from 'vue';
|
||||
import { assign, findIndex } from 'lodash';
|
||||
import { assign, findIndex ,includes} from 'lodash';
|
||||
import { getStockQuantity, objectToQuery } from '../until';
|
||||
import { getTypeParentNames } from '../warehousing/uniqueCode/until';
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app";
|
||||
@@ -113,15 +113,14 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const { formData, isEdit, backStr, pathParams, extendData } = toRefs(props)
|
||||
console.log(extendData, 'extendData==>');
|
||||
|
||||
//是否为编辑状态
|
||||
const edit = computed(() => {
|
||||
if (`${isEdit.value}` === '1') return '1';
|
||||
else if (`${isEdit.value}` === '4') return '4';
|
||||
else return false;
|
||||
})
|
||||
|
||||
// 显示添加物料按钮 isEdit编辑、
|
||||
const isAddMaterial = computed(() => isEdit == 1 && pathParams.back != 'issueUniqueCode_inbound' && !includes(backStr.value,'stockOut'))
|
||||
// 删除:数据
|
||||
const delItem = ref(null)
|
||||
// 删除:开关
|
||||
|
||||
@@ -3,73 +3,117 @@
|
||||
<view class="nav-placeholder" :style="{ height: navHeight + 'px' }"></view>
|
||||
|
||||
<view class="navbar" :style="{ paddingTop: statusBarHeight + 'px' }">
|
||||
|
||||
<view class="left" @click="goBack">
|
||||
<uni-icons type="left" size="18" />
|
||||
</view>
|
||||
|
||||
<!-- 中间标题 -->
|
||||
<!-- 标题 -->
|
||||
<view class="title">{{ title }}</view>
|
||||
|
||||
<!-- 右侧:父组件传入插槽 -->
|
||||
<!-- 右侧插槽 -->
|
||||
<view class="right">
|
||||
<slot name="right"></slot>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
</view>
|
||||
<view class="content"></view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
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({
|
||||
title: { type: String, default: '' },
|
||||
backUrl: { type: String, default: '' },
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
backUrl: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
showBack: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
|
||||
const { backUrl, title, showBack } = toRefs(props)
|
||||
|
||||
// 状态栏 + 导航栏高度
|
||||
const statusBarHeight = 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({
|
||||
url: `/${back.value}`,
|
||||
});
|
||||
// 返回逻辑
|
||||
const goBack = () => {
|
||||
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 {
|
||||
// 无目标路由 正常返回
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 导航栏占位:撑开页面内容,不被遮挡 */
|
||||
.nav-placeholder {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 导航栏主体:fixed 固定在顶部 */
|
||||
.navbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
// 高度由 状态栏 + 44px 决定,不要写死 70px
|
||||
height: 44px;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -77,21 +121,24 @@ const goBack = () => {
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
z-index: 999;
|
||||
// margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.back-txt {
|
||||
margin-left: 6rpx;
|
||||
justify-content: center;
|
||||
width: 40rpx;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
font-size: 16rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
max-width: 400rpx;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.right {
|
||||
@@ -101,7 +148,8 @@ const goBack = () => {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.nav-placeholder {
|
||||
.content {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -1,26 +1,31 @@
|
||||
<!-- 查询列表 - 使用我的出库单/我的入库单 -->
|
||||
<template>
|
||||
<!-- 我的入库单/我的出库单/入库单入库/出库单出库-->
|
||||
<navigation :title="title" back-url="pages/warehousing/index"></navigation>
|
||||
|
||||
<view class="content">
|
||||
<!-- 搜索框 -->
|
||||
<view class="topSearch">
|
||||
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false"
|
||||
@iconClick="getList" placeholder="请输入搜索内容" />
|
||||
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :input-border="false"
|
||||
@icon-click="getList" placeholder="请输入搜索内容" />
|
||||
</view>
|
||||
|
||||
<!-- 列表 -->
|
||||
<z-paging ref="pagingRef" class="containerBox" v-model="list" @query="getList">
|
||||
<uni-list class="listBox">
|
||||
<uni-list-item v-for="item in list" :key="item.id" clickable @click="onDetail(item)">
|
||||
<template v-slot:body>
|
||||
<view style="display: flex; flex-direction: column; width: 100%;">
|
||||
<view class="line title">
|
||||
<p> {{ typeName + '编号' }}:{{ item.billNo }}</p>
|
||||
<p> {{ typeName }}编号:{{ item.billNo }}</p>
|
||||
<span :style="getColor(item?.billType)">
|
||||
{{ getBillType(item?.billType, item?.status) }}
|
||||
</span>
|
||||
</view>
|
||||
<p class="line content">{{ typeName + '类型' }}:
|
||||
<span> {{ getOrderType(item.status) }}</span>
|
||||
<p class="line content">{{ typeName }}类型:
|
||||
<span>{{ getOrderType(item.status) }}</span>
|
||||
</p>
|
||||
<p class="line content">库位:
|
||||
<span> {{ item.areaName }}</span>
|
||||
<span>{{ item.areaName }}</span>
|
||||
</p>
|
||||
<p class="line content">开单时间:
|
||||
<span>{{ item.createTime }}</span>
|
||||
@@ -32,16 +37,17 @@
|
||||
</z-paging>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
|
||||
<script setup>
|
||||
import _, { includes } from 'lodash';
|
||||
import { computed, toRefs, ref } from 'vue';
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import { stockList } from '../../api/stockIn';
|
||||
import { getBillType, getColor } from '../until';
|
||||
import Navigation from '../components/Navigation.vue';
|
||||
|
||||
const props = defineProps({
|
||||
// 查询列表类型 stockIn:入库 stockIn-putAway:入库单入库 stockOut:出库
|
||||
// 查询列表类型 stockIn:我的入库单 stockIn-putAway:入库单入库 stockOut:我的出库单 stockOut-outbound出库单出库
|
||||
type: {
|
||||
type: String,
|
||||
default: '',
|
||||
@@ -53,23 +59,23 @@ const props = defineProps({
|
||||
default: {},
|
||||
required: true
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
const { type, query } = toRefs(props)
|
||||
const pagingRef = ref(null)
|
||||
|
||||
// 数据:列表
|
||||
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({
|
||||
keyword: ''
|
||||
})
|
||||
@@ -78,58 +84,53 @@ onShow(() => {
|
||||
pagingRef.value?.reload?.()
|
||||
})
|
||||
|
||||
// 点击:查看详情
|
||||
const onDetail = (val) => {
|
||||
if (_.includes(type.value, 'stockIn')) {
|
||||
// pages/stockIn/detail
|
||||
uni.navigateTo({
|
||||
url: `/pages/warehousing/stockIn/components/detail?billNo=${val.billNo}&type=${type.value}`,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
// 数据:获取列表
|
||||
|
||||
const getList = (pageNo, pageSize) => {
|
||||
queryParams.value.pageNum = pageNo
|
||||
if (_.includes(type.value, 'stockIn')) {
|
||||
stockList({ ...queryParams?.value, ...query?.value }).then(res => {
|
||||
stockList({ ...queryParams.value, ...query.value }).then(res => {
|
||||
res.rows.forEach(e => {
|
||||
e.showMore = false;
|
||||
});
|
||||
pagingRef.value.complete(res.rows)
|
||||
}).catch(res => {
|
||||
}).catch(() => {
|
||||
pagingRef.value.complete(false)
|
||||
})
|
||||
} else if (type.value == 'stockOut') {
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 搜索框:放在导航栏下面,不覆盖 */
|
||||
.topSearch {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
top: var(--nav-height);
|
||||
/* 关键:自动在导航栏下方 */
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 999;
|
||||
padding: 4rpx;
|
||||
z-index: 99;
|
||||
/* 比导航栏小 */
|
||||
padding: 8rpx 16rpx;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.containerBox {
|
||||
padding-top: 44px;
|
||||
padding-top: 90px !important;
|
||||
/* 撑开:导航栏+搜索框高度 */
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.zp-l-text-rpx {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .listBox {
|
||||
@@ -150,20 +151,13 @@ const getList = (pageNo, pageSize) => {
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.uni-list-item__container {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.line {
|
||||
display: flex;
|
||||
// justify-content: space-between;
|
||||
align-items: center;
|
||||
// border-bottom: 1px solid #eee;
|
||||
padding: 12rpx 20rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
@@ -172,15 +166,7 @@ const getList = (pageNo, pageSize) => {
|
||||
.content {
|
||||
font-weight: 500;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
color: #D3D3D3;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #696969;
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -121,3 +121,11 @@ export const objectToQuery = (params) => {
|
||||
|
||||
return "?" + query;
|
||||
};
|
||||
// 获取配置的导航路由
|
||||
export const getTabBarList = () => {
|
||||
// 1. 从 uni-app 全局配置中读取 tabBar
|
||||
const tabBarConfig = __uniConfig.tabBar || {}
|
||||
// 2. 获取 list 数组
|
||||
const tabList = tabBarConfig.list || []
|
||||
return tabList
|
||||
}
|
||||
@@ -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()
|
||||
})
|
||||
|
||||
@@ -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()
|
||||
})
|
||||
|
||||
@@ -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:仓库信息绑定
|
||||
@@ -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>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<template>
|
||||
<!-- 我的入库单 -->
|
||||
<search-list type="stockIn" :onDetail="onDetail" />
|
||||
</template>
|
||||
<script setup>
|
||||
|
||||
231
pages/warehousing/StockOut/create.vue
Normal file
231
pages/warehousing/StockOut/create.vue
Normal 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>
|
||||
8
pages/warehousing/StockOut/my.vue
Normal file
8
pages/warehousing/StockOut/my.vue
Normal file
@@ -0,0 +1,8 @@
|
||||
<template>
|
||||
<!-- 我的出库单 -->
|
||||
<search-list type="stockOut" :onDetail="onDetail" />
|
||||
</template>
|
||||
<script setup>
|
||||
import SearchList from '../../components/SearchList.vue';
|
||||
|
||||
</script>
|
||||
10
pages/warehousing/StockOut/outbound.vue
Normal file
10
pages/warehousing/StockOut/outbound.vue
Normal 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>
|
||||
@@ -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({
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user