fix: 李红攀:V2.0.061采购入库、销售出库添加扫码功能

This commit is contained in:
2026-05-25 09:27:16 +08:00
parent 2169fec9c1
commit a1217e36b5
20 changed files with 3075 additions and 2 deletions

View File

@@ -1 +0,0 @@
npx lint-staged --allow-empty

View File

@@ -0,0 +1,14 @@
import { http } from '@/http/http'
/** 按库位码查询的结果 */
export interface LocationByCodeVO {
warehouseId: number
warehouseName: string
locationCode: string
enableLocation?: boolean
}
/** 按库位码查询库位信息 */
export function getLocationByCode(locationCode: string) {
return http.get<LocationByCodeVO>('/erp/location/get-by-code', { locationCode })
}

View File

@@ -0,0 +1,42 @@
import { http } from '@/http/http'
/** 采购入库扫码记录 */
export interface PurchaseInScanRecord {
id?: number
purchaseInId: number
productId?: number
productName?: string
productSpec?: string
productBarCode?: string
productUnit?: string
warehouseId?: number
warehouseName?: string
locationCode?: string
batchNo?: string
scanCount?: number
scanTime?: string
operatorId?: number
operatorName?: string
remark?: string
createTime?: string
}
/** 创建扫码记录 */
export function createPurchaseInScanRecord(data: PurchaseInScanRecord) {
return http.post<number>('/erp/purchase-in-scan-record/create', data)
}
/** 批量创建扫码记录 */
export function createPurchaseInScanRecordBatch(data: PurchaseInScanRecord[]) {
return http.post<number>('/erp/purchase-in-scan-record/create-batch', data)
}
/** 删除扫码记录 */
export function deletePurchaseInScanRecord(id: number) {
return http.delete<boolean>(`/erp/purchase-in-scan-record/delete?id=${id}`)
}
/** 获取入库单的所有扫码记录 */
export function getPurchaseInScanRecordList(purchaseInId: number) {
return http.get<PurchaseInScanRecord[]>(`/erp/purchase-in-scan-record/list?purchaseInId=${purchaseInId}`)
}

View File

@@ -0,0 +1,42 @@
import { http } from '@/http/http'
/** 销售出库扫码记录 */
export interface SaleOutScanRecord {
id?: number
saleOutId: number
productId?: number
productName?: string
productSpec?: string
productBarCode?: string
productUnit?: string
warehouseId?: number
warehouseName?: string
locationCode?: string
batchNo?: string
scanCount?: number
scanTime?: string
operatorId?: number
operatorName?: string
remark?: string
createTime?: string
}
/** 创建扫码记录 */
export function createSaleOutScanRecord(data: SaleOutScanRecord) {
return http.post<number>('/erp/sale-out-scan-record/create', data)
}
/** 批量创建扫码记录 */
export function createSaleOutScanRecordBatch(data: SaleOutScanRecord[]) {
return http.post<number[]>('/erp/sale-out-scan-record/create-batch', data)
}
/** 删除扫码记录 */
export function deleteSaleOutScanRecord(id: number) {
return http.delete<boolean>(`/erp/sale-out-scan-record/delete?id=${id}`)
}
/** 获取出库单的所有扫码记录 */
export function getSaleOutScanRecordList(saleOutId: number) {
return http.get<SaleOutScanRecord[]>(`/erp/sale-out-scan-record/list?saleOutId=${saleOutId}`)
}

View File

@@ -0,0 +1,91 @@
import type { PageParam, PageResult } from '@/http/types'
import { http } from '@/http/http'
/** 销售出库项 */
export interface SaleOutItem {
id?: number
outId?: number
orderItemId?: number
productId?: number
productName?: string
productBarCode?: string
productSpec?: string
productUnitName?: string
warehouseId?: number
warehouseName?: string
locationCode?: string
batchNo?: string
count?: number
productPrice?: number
taxPercent?: number
taxPrice?: number
totalPrice?: number
remark?: string
productUnitId?: number
stockUnitPrice?: number
stockValue?: number
grossProfit?: number
}
/** 销售出库信息 */
export interface SaleOut {
id?: number
no?: string
status?: number
customerId?: number
customerName?: string
accountId?: number
accountName?: string
saleUserId?: number
saleUserName?: string
outTime?: string
orderId?: number
orderNo?: string
deliveryNoticeId?: number
deliveryNoticeNo?: string
totalCount?: number
totalPrice?: number
receiptPrice?: number
totalProductPrice?: number
totalTaxPrice?: number
discountPercent?: number
discountPrice?: number
otherPrice?: number
fileUrl?: string
remark?: string
creator?: string
creatorName?: string
createTime?: string
items?: SaleOutItem[]
productNames?: string
}
/** 获取销售出库分页列表 */
export function getSaleOutPage(params: PageParam) {
return http.get<PageResult<SaleOut>>('/erp/sale-out/page', params)
}
/** 获取销售出库详情 */
export function getSaleOut(id: number) {
return http.get<SaleOut>(`/erp/sale-out/get?id=${id}`)
}
/** 创建销售出库 */
export function createSaleOut(data: SaleOut) {
return http.post<number>('/erp/sale-out/create', data)
}
/** 更新销售出库 */
export function updateSaleOut(data: SaleOut) {
return http.put<boolean>('/erp/sale-out/update', data)
}
/** 更新销售出库状态 */
export function updateSaleOutStatus(id: number, status: number) {
return http.put<boolean>(`/erp/sale-out/update-status?id=${id}&status=${status}`)
}
/** 删除销售出库 */
export function deleteSaleOut(ids: number[]) {
return http.delete<boolean>(`/erp/sale-out/delete?ids=${ids.join(',')}`)
}

View File

@@ -13,6 +13,9 @@ export interface Warehouse {
truckagePrice?: number truckagePrice?: number
status?: number status?: number
defaultStatus?: boolean defaultStatus?: boolean
enableLocation?: boolean
roomNoMax?: number
locationCapacity?: number
createTime?: number createTime?: number
} }

View File

@@ -376,7 +376,7 @@ const formData = ref<PurchaseIn>({
no: undefined, no: undefined,
supplierId: undefined, supplierId: undefined,
accountId: undefined, accountId: undefined,
inTime: undefined, inTime: new Date().getTime(),
orderId: undefined, orderId: undefined,
orderNo: undefined, orderNo: undefined,
discountPercent: 0, discountPercent: 0,

View File

@@ -126,6 +126,12 @@
> >
修改 修改
</wd-button> </wd-button>
<wd-button
v-if="hasAccessByCodes(['erp:purchase-in:query'])"
size="small" type="warning" plain @click="handleScanIn(item)"
>
扫码入库
</wd-button>
<wd-button <wd-button
v-if="hasAccessByCodes(['erp:purchase-in:submit-approval']) && item.status === 10 && !item.hasApprovalRecords" v-if="hasAccessByCodes(['erp:purchase-in:submit-approval']) && item.status === 10 && !item.hasApprovalRecords"
size="small" type="success" plain @click="handleSubmitApproval(item)" size="small" type="success" plain @click="handleSubmitApproval(item)"
@@ -597,6 +603,13 @@ function handleEdit(item: PurchaseIn) {
}) })
} }
/** 扫码入库 */
function handleScanIn(item: PurchaseIn) {
uni.navigateTo({
url: `/pages-erp/purchase-in/scan-in/index?id=${item.id}&no=${encodeURIComponent(item.no || '')}`,
})
}
/** 打开审核弹窗 */ /** 打开审核弹窗 */
function handleAudit(item: PurchaseIn) { function handleAudit(item: PurchaseIn) {
auditForm.id = item.id auditForm.id = item.id

View File

@@ -0,0 +1,131 @@
<template>
<view class="recent-scan-list">
<view v-if="records.length === 0" class="recent-scan-list__empty">
暂无扫码记录开始扫码入库
</view>
<view
v-for="(record, index) in records"
:key="record.id || index"
class="scan-card"
:class="{ 'scan-card--latest': latestIndex === index }"
>
<view class="scan-card__header">
<text class="scan-card__name">{{ record.productName || '-' }}</text>
<text class="scan-card__delete" @tap="emit('delete', index)">删除</text>
</view>
<view class="scan-card__meta">
<text>条码{{ record.productBarCode || '-' }}</text>
<text>规格{{ record.productSpec || '-' }}</text>
</view>
<view class="scan-card__meta">
<text>仓库{{ record.warehouseName || '-' }}</text>
<text>单位{{ record.productUnit || '-' }}</text>
</view>
<view class="scan-card__meta">
<text>库位{{ record.locationCode || '-' }}</text>
<text>批次{{ record.batchNo || '-' }}</text>
</view>
<view class="scan-card__footer">
<text class="scan-card__time">{{ formatTime(record.scanTime) }}</text>
<text class="scan-card__count">{{ record.scanCount }}</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import type { ScanRecord } from '../index.vue'
defineProps<{
records: ScanRecord[]
latestIndex?: number
}>()
const emit = defineEmits<{
(event: 'delete', index: number): void
(event: 'clear'): void
}>()
function formatTime(time?: string) {
if (!time) return '-'
const date = new Date(time)
return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`
}
</script>
<style lang="scss" scoped>
.recent-scan-list {
&__empty {
padding: 48rpx;
border-radius: 16rpx;
background: #fff;
color: #86909c;
text-align: center;
font-size: 26rpx;
}
}
.scan-card {
margin-bottom: 16rpx;
padding: 24rpx;
border: 2rpx solid transparent;
border-radius: 16rpx;
background: #fff;
&--latest {
border-color: #1677ff;
box-shadow: 0 8rpx 20rpx rgba(22, 119, 255, 0.12);
}
&__header,
&__meta,
&__footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
}
&__header {
margin-bottom: 10rpx;
}
&__name {
color: #1f2329;
font-size: 28rpx;
font-weight: 600;
}
&__delete {
flex-shrink: 0;
color: #f53f3f;
font-size: 24rpx;
}
&__meta {
margin-top: 6rpx;
color: #4e5969;
font-size: 22rpx;
flex-wrap: wrap;
}
&__footer {
margin-top: 10rpx;
padding-top: 10rpx;
border-top: 2rpx solid #f2f3f5;
}
&__time {
color: #86909c;
font-size: 22rpx;
}
&__count {
color: #1677ff;
font-size: 28rpx;
font-weight: 700;
}
}
</style>

View File

@@ -0,0 +1,69 @@
<template>
<view class="scan-context-bar">
<view class="scan-context-bar__main">
<view class="scan-context-bar__order">
<text class="scan-context-bar__label">入库单</text>
<text class="scan-context-bar__value">{{ purchaseInNo || '未关联入库单' }}</text>
</view>
<view class="scan-context-bar__stats">
<text>记录 {{ recordCount }} </text>
<text>累计 {{ scannedCount }} </text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
defineProps<{
purchaseInId?: number
purchaseInNo?: string
scannedCount: number
recordCount: number
}>()
</script>
<style lang="scss" scoped>
.scan-context-bar {
padding: 20rpx 24rpx;
border-radius: 16rpx;
background: #fff;
margin-bottom: 16rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
&__main {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
}
&__order {
display: flex;
align-items: center;
gap: 12rpx;
min-width: 0;
flex: 1;
}
&__label {
flex-shrink: 0;
color: #86909c;
font-size: 24rpx;
}
&__value {
color: #1f2329;
font-size: 28rpx;
font-weight: 600;
}
&__stats {
display: flex;
gap: 20rpx;
flex-shrink: 0;
color: #1677ff;
font-size: 24rpx;
font-weight: 600;
}
}
</style>

View File

@@ -0,0 +1,43 @@
<template>
<view v-if="message" class="feedback-bar" :class="`feedback-bar--${tone}`">
{{ message }}
</view>
</template>
<script setup lang="ts">
withDefaults(
defineProps<{
tone?: 'success' | 'error' | 'idle'
message?: string
}>(),
{
tone: 'idle',
message: '',
},
)
</script>
<style lang="scss" scoped>
.feedback-bar {
min-height: 76rpx;
padding: 18rpx 24rpx;
border-radius: 14rpx;
font-size: 24rpx;
line-height: 40rpx;
&--idle {
background: #f2f3f5;
color: #4e5969;
}
&--success {
background: #f6ffed;
color: #389e0d;
}
&--error {
background: #fff2f0;
color: #cf1322;
}
}
</style>

View File

@@ -0,0 +1,929 @@
<template>
<view class="yd-page-container scan-page">
<wd-navbar
title="扫码入库"
left-arrow
placeholder
safe-area-inset-top
fixed
@click-left="handleBack"
/>
<view class="scan-page__content">
<!-- 顶部上下文条 -->
<ScanContextBar
:purchase-in-id="purchaseInId"
:purchase-in-no="purchaseInNo"
:scanned-count="scannedTotalCount"
:record-count="records.length"
/>
<!-- 扫码工作台 -->
<view class="scan-workbench">
<!-- 当前扫码上下文提示 -->
<view class="scan-panel">
<!-- 步骤指示器库位优先 -->
<view class="scan-step-indicator">
<view class="scan-step-indicator__item" :class="{ 'active': step === 'idle', 'done': step !== 'idle' }">
<view class="scan-step-indicator__dot">1</view>
<text>扫库位</text>
</view>
<view class="scan-step-indicator__line" :class="{ 'done': step !== 'idle' }" />
<view class="scan-step-indicator__item" :class="{ 'active': step === 'location_scanned', 'done': step === 'product_scanned' }">
<view class="scan-step-indicator__dot">2</view>
<text>扫产品</text>
</view>
<view class="scan-step-indicator__line" :class="{ 'done': step === 'product_scanned' }" />
<view class="scan-step-indicator__item" :class="{ 'active': step === 'product_scanned' }">
<view class="scan-step-indicator__dot">3</view>
<text>确认</text>
</view>
</view>
<!-- 当前作业提示 -->
<view class="scan-current-hint">
<text v-if="step === 'idle'">请扫描库位条码</text>
<text v-else-if="step === 'location_scanned'">请扫描产品条码</text>
<text v-else-if="step === 'product_scanned'">扫码完成请确认入库</text>
</view>
<!-- 库位扫码区 -->
<view class="scan-row" :class="{ 'scan-row--dim': step !== 'idle' }">
<input
v-model="locationCode"
class="scan-field"
:class="{ 'scan-field--active': step === 'idle' }"
placeholder="扫描库位条码"
confirm-type="next"
:focus="locationInputFocus"
:cursor-spacing="20"
:adjust-position="true"
:hold-keyboard="true"
@blur="handleLocationBlur"
@confirm="handleLocationScan"
>
<button class="scan-camera-btn" :disabled="scanLoading" @tap="handleCameraScan('location')">
</button>
</view>
<!-- 库位预览扫库位码后显示 -->
<view class="scan-location-preview" v-if="locationInfo">
<view class="scan-location-preview__row">
<text class="scan-location-preview__label">仓库</text>
<text class="scan-location-preview__value">{{ locationInfo.warehouseName }}</text>
</view>
<view class="scan-location-preview__row">
<text class="scan-location-preview__label">库位</text>
<text class="scan-location-preview__value scan-location-preview__value--code">
{{ locationInfo.locationCode }}
</text>
<text class="scan-location-preview__badge" :class="locationInfo.enableLocation ? 'badge--green' : 'badge--gray'">
{{ locationInfo.enableLocation ? '库位管理' : '无库位管理' }}
</text>
</view>
</view>
<!-- 产品扫码区 -->
<view class="scan-row" :class="{ 'scan-row--dim': step === 'idle' || step === 'product_scanned' }">
<input
v-model="productBarCode"
class="scan-field"
:class="{ 'scan-field--active': step === 'location_scanned' }"
placeholder="扫描产品条码"
confirm-type="done"
:focus="productInputFocus"
:cursor-spacing="20"
:adjust-position="true"
:hold-keyboard="true"
@blur="handleProductBlur"
@confirm="handleProductScan"
>
<button class="scan-camera-btn" :disabled="scanLoading" @tap="handleCameraScan('product')">
</button>
</view>
<!-- 产品预览扫产品码后显示 -->
<view class="scan-product-preview" v-if="productPreview">
<view class="scan-product-preview__row">
<text class="scan-product-preview__label">产品</text>
<text class="scan-product-preview__value scan-product-preview__value--name">
{{ productPreview.name }}
</text>
</view>
<view class="scan-product-preview__row">
<text class="scan-product-preview__label">规格</text>
<text class="scan-product-preview__value">{{ productPreview.standard || '-' }}</text>
</view>
<view class="scan-product-preview__row">
<text class="scan-product-preview__label">条码</text>
<text class="scan-product-preview__value">{{ productPreview.barCode || '-' }}</text>
</view>
</view>
<!-- 批次号扫产品后显示 -->
<view class="scan-row" v-if="step === 'product_scanned'">
<input
v-model="batchNo"
class="scan-field"
placeholder="批次号(可选)"
confirm-type="done"
>
</view>
<!-- 确认入库按钮 -->
<button
v-if="step === 'product_scanned'"
class="scan-confirm-btn"
:disabled="!canConfirm || scanLoading"
@tap="handleConfirm"
>
{{ scanLoading ? '处理中...' : '确认入库' }}
</button>
<ScanFeedbackBar :tone="feedbackTone" :message="feedbackMessage" />
</view>
<!-- 扫码记录列表 -->
<view class="scan-panel scan-panel--list">
<view class="scan-panel__header">
<view class="scan-panel__title">
扫码记录
</view>
<view class="scan-panel__meta">
{{ records.length }}
</view>
</view>
<RecentScanList
:records="records"
:latest-index="latestRecordIndex"
@delete="handleDeleteRecord"
/>
</view>
<!-- 提交栏 -->
<view class="scan-footer">
<button class="scan-footer__clear" @tap="handleClearAll">
清空记录
</button>
<button class="scan-footer__submit" :loading="submitting" @tap="handleSubmit">
保存入库记录
</button>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import type { ProductByBarCode } from '@/api/erp/product'
import type { LocationByCodeVO } from '@/api/erp/location'
import { computed, nextTick, onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni'
import { getProductByBarCode } from '@/api/erp/product'
import { getLocationByCode } from '@/api/erp/location'
import { getPurchaseIn } from '@/api/erp/purchase-in'
import { createPurchaseInScanRecord, deletePurchaseInScanRecord, getPurchaseInScanRecordList } from '@/api/erp/purchase-in-scan-record'
import ScanFeedbackBar from '@/pages-erp/purchase-in/scan-in/components/scan-feedback-bar.vue'
import RecentScanList from '@/pages-erp/purchase-in/scan-in/components/recent-scan-list.vue'
import ScanContextBar from '@/pages-erp/purchase-in/scan-in/components/scan-context-bar.vue'
import { navigateBackPlus } from '@/utils'
import { normalizeCameraScanResult, normalizeScanCode } from '@/utils/scan'
definePage({
style: {
navigationBarTitleText: '',
navigationStyle: 'custom',
},
})
/** 扫码入库记录 */
export interface ScanRecord {
id?: number
purchaseInId: number
productId?: number
productName?: string
productSpec?: string
productBarCode?: string
productUnit?: string
warehouseId?: number
warehouseName?: string
locationCode?: string
batchNo?: string
scanCount: number
scanTime?: string
operatorId?: number
operatorName?: string
}
type Step = 'idle' | 'location_scanned' | 'product_scanned'
/** 页面参数id=入库单ID, no=入库单号 */
const props = defineProps<{
id?: number
no?: string
}>()
const toast = useToast()
// 页面参数
const purchaseInId = ref<number>()
const purchaseInNo = ref<string>()
// 扫码步骤
const step = ref<Step>('idle')
// 扫码数据
const locationCode = ref('')
const locationInfo = ref<LocationByCodeVO | null>(null)
const productBarCode = ref('')
const productPreview = ref<ProductByBarCode | null>(null)
const batchNo = ref('')
// 状态
const scanLoading = ref(false)
const submitting = ref(false)
const records = ref<ScanRecord[]>([])
const feedbackTone = ref<'success' | 'error' | 'idle'>('idle')
const feedbackMessage = ref('')
// 输入框焦点控制
const locationInputFocus = ref(false)
const productInputFocus = ref(false)
// 计算属性
const canConfirm = computed(() => {
return locationInfo.value?.warehouseId && productPreview.value?.id && scanLoading.value === false
})
const scannedTotalCount = computed(() =>
records.value.reduce((sum, r) => sum + Number(r.scanCount || 0), 0),
)
const latestRecordIndex = computed(() => {
if (records.value.length === 0) return undefined
return records.value.length - 1
})
/** 返回上一页 */
function handleBack() {
navigateBackPlus('/pages-erp/purchase-in/index')
}
/** 初始化页面 */
onMounted(async () => {
if (props.id) purchaseInId.value = props.id
if (props.no) purchaseInNo.value = decodeURIComponent(props.no)
if (purchaseInId.value) {
try {
const data = await getPurchaseIn(purchaseInId.value)
purchaseInNo.value = data.no
} catch {
// 忽略
}
await loadRecords()
}
// PDA 扫码枪需要输入框自动获得焦点,延迟确保页面完全渲染
await nextTick()
setTimeout(() => {
focusLocationInput()
}, 500)
})
/** 重置到初始状态 */
function resetToIdle() {
clearScanInputs()
locationInfo.value = null
productPreview.value = null
step.value = 'idle'
// 延迟清空错误 + 聚焦光标,让用户先看到错误提示
setTimeout(() => {
clearFeedback()
focusLocationInput()
}, 800)
}
/** 聚焦库位码输入框 */
function focusLocationInput() {
productInputFocus.value = false
locationInputFocus.value = false
nextTick(() => {
locationInputFocus.value = true
})
}
/** 库位输入框失焦处理 - 如果当前步骤是 idle自动重新聚焦 */
function handleLocationBlur() {
if (step.value === 'idle' && !scanLoading.value) {
setTimeout(() => {
if (step.value === 'idle') {
focusLocationInput()
}
}, 100)
}
}
/** 产品输入框失焦处理 - 如果当前步骤是 location_scanned自动重新聚焦 */
function handleProductBlur() {
if (step.value === 'location_scanned' && !scanLoading.value) {
setTimeout(() => {
if (step.value === 'location_scanned') {
focusProductInput()
}
}, 100)
}
}
/** 加载已有扫码记录 */
async function loadRecords() {
if (!purchaseInId.value) return
try {
const data = await getPurchaseInScanRecordList(purchaseInId.value)
records.value = data || []
} catch {
records.value = []
}
}
/**
* 扫库位码:自动反查仓库信息
*/
async function handleLocationScan() {
const code = normalizeScanCode(locationCode.value)
if (!code) {
setErrorFeedback('请先扫描库位条码')
return
}
scanLoading.value = true
try {
try {
locationInfo.value = await getLocationByCode(code)
} catch {
setErrorFeedback(`库位码 ${code} 不存在`)
resetToIdle()
return
}
if (!locationInfo.value?.warehouseId) {
setErrorFeedback(`库位码 ${code} 未找到对应仓库`)
resetToIdle()
return
}
locationCode.value = code
step.value = 'location_scanned'
productBarCode.value = ''
productPreview.value = null
batchNo.value = ''
clearFeedback()
// 聚焦产品输入框,等待扫码枪输入
focusProductInput()
} finally {
scanLoading.value = false
}
}
/** 聚焦产品码输入框 */
function focusProductInput() {
locationInputFocus.value = false
productInputFocus.value = false
nextTick(() => {
productInputFocus.value = true
})
}
/**
* 扫产品码:自动反查产品信息
*/
async function handleProductScan() {
const code = normalizeScanCode(productBarCode.value)
if (!code) {
setErrorFeedback('请先扫描产品条码')
return
}
if (!locationInfo.value) {
setErrorFeedback('请先扫描库位条码')
step.value = 'idle'
return
}
scanLoading.value = true
try {
try {
productPreview.value = await getProductByBarCode(code)
} catch {
setErrorFeedback(`条码 ${code} 未匹配到产品`)
resetToIdle()
return
}
if (!productPreview.value?.id) {
setErrorFeedback(`条码 ${code} 未匹配到产品`)
resetToIdle()
return
}
productBarCode.value = code
step.value = 'product_scanned'
clearFeedback()
} finally {
scanLoading.value = false
}
}
/**
* 确认入库
*/
async function handleConfirm() {
if (!canConfirm.value) return
scanLoading.value = true
try {
const record: ScanRecord = {
purchaseInId: purchaseInId.value || 0,
productId: productPreview.value!.id,
productName: productPreview.value!.name,
productSpec: productPreview.value!.standard,
productBarCode: productPreview.value!.barCode,
productUnit: productPreview.value!.unitName,
warehouseId: locationInfo.value!.warehouseId,
warehouseName: locationInfo.value!.warehouseName,
locationCode: locationInfo.value!.locationCode,
batchNo: batchNo.value.trim() || undefined,
scanCount: 1,
scanTime: new Date().toISOString(),
}
// 提交到后端
try {
const newId = await createPurchaseInScanRecord(record)
record.id = newId
} catch {
record.id = Date.now()
}
// 追加到列表
records.value.push(record)
// 重置,准备下一次扫码
const productName = productPreview.value!.name
const locationCodeText = locationInfo.value!.locationCode
clearScanInputs()
step.value = 'idle'
setSuccessFeedback(`${productName}${locationCodeText} 入库成功`)
await nextTick()
// 聚焦库位输入框,等待扫码枪输入
focusLocationInput()
} finally {
scanLoading.value = false
}
}
/** 相机扫码 */
function handleCameraScan(target: 'location' | 'product') {
if (scanLoading.value) return
// #ifdef APP-PLUS
// Android 运行时权限检查
plus.android.requestPermissions(
['android.permission.CAMERA'],
function(result) {
const granted = result.granted
if (granted && granted.length > 0) {
doScan(target)
} else {
toast.error('请在设置中开启相机权限')
uni.openSetting()
}
},
function() {
toast.error('相机权限获取失败')
},
)
// #endif
// #ifndef APP-PLUS
doScan(target)
// #endif
}
function doScan(target: 'location' | 'product') {
uni.scanCode({
onlyFromCamera: true,
success: async (result) => {
const code = normalizeCameraScanResult(result)
if (!code) return
if (target === 'location') {
locationCode.value = code
await handleLocationScan()
} else {
productBarCode.value = code
await handleProductScan()
}
},
fail: (error) => {
if (String(error?.errMsg || '').includes('cancel')) return
toast.error('相机扫码失败,请重试')
},
})
}
/** 删除单条记录 */
async function handleDeleteRecord(index: number) {
const record = records.value[index]
if (!record) return
if (record.id && record.id > 0 && record.id < 1000000000000) {
try {
await deletePurchaseInScanRecord(record.id)
} catch {
toast.error('删除失败')
return
}
}
records.value.splice(index, 1)
}
/** 清空所有记录 */
function handleClearAll() {
if (records.value.length === 0) return
uni.showModal({
title: '确认清空',
content: '确定要清空所有扫码记录吗?',
success: async (res) => {
if (!res.confirm) return
const toDelete = records.value.filter(r => r.id && r.id > 0 && r.id < 1000000000000)
for (const r of toDelete) {
try { await deletePurchaseInScanRecord(r.id!) } catch { /* ignore */ }
}
records.value = []
clearFeedback()
},
})
}
/** 保存入库记录 */
async function handleSubmit() {
if (records.value.length === 0) {
toast.warning('暂无扫码记录')
return
}
if (!purchaseInId.value) {
toast.warning('缺少采购入库单ID')
return
}
submitting.value = true
try {
toast.success(`已保存 ${records.value.length} 条入库记录`)
records.value = []
await loadRecords()
} finally {
submitting.value = false
}
}
/** 清空本次扫码输入 */
function clearScanInputs() {
locationCode.value = ''
locationInfo.value = null
productBarCode.value = ''
productPreview.value = null
batchNo.value = ''
}
function setSuccessFeedback(message: string) {
feedbackTone.value = 'success'
feedbackMessage.value = message
}
function setErrorFeedback(message: string) {
feedbackTone.value = 'error'
feedbackMessage.value = message
}
function clearFeedback() {
feedbackTone.value = 'idle'
feedbackMessage.value = ''
}
</script>
<style lang="scss" scoped>
.scan-page {
background: #f4f6f8;
min-height: 100vh;
&__content {
padding: 24rpx;
padding-top: calc(24rpx + env(safe-area-inset-top) + 88rpx);
box-sizing: border-box;
}
}
.scan-workbench {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.scan-panel {
padding: 24rpx;
border-radius: 18rpx;
background: #fff;
&--list {
padding-bottom: 8rpx;
}
&__header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
margin-bottom: 16rpx;
}
&__title {
color: #1f2329;
font-size: 28rpx;
font-weight: 600;
}
&__meta {
color: #86909c;
font-size: 22rpx;
}
}
// 步骤指示器
.scan-step-indicator {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 24rpx;
&__item {
display: flex;
flex-direction: column;
align-items: center;
gap: 8rpx;
text {
font-size: 22rpx;
color: #86909c;
}
&.active text {
color: #1677ff;
font-weight: 600;
}
&.done text {
color: #52c41a;
}
}
&__dot {
width: 48rpx;
height: 48rpx;
line-height: 48rpx;
border-radius: 50%;
background: #f2f3f5;
color: #86909c;
font-size: 24rpx;
font-weight: 600;
text-align: center;
}
&__item.active &__dot {
background: #1677ff;
color: #fff;
}
&__item.done &__dot {
background: #52c41a;
color: #fff;
}
&__line {
flex: 1;
height: 2rpx;
background: #e5e6eb;
margin: 0 12rpx;
margin-bottom: 28rpx;
max-width: 80rpx;
&.done {
background: #52c41a;
}
}
}
// 当前作业提示
.scan-current-hint {
text-align: center;
font-size: 30rpx;
font-weight: 600;
color: #1f2329;
margin-bottom: 20rpx;
}
// 输入行
.scan-row {
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 16rpx;
transition: opacity 0.2s;
&--dim {
opacity: 0.4;
pointer-events: none;
}
.scan-field {
flex: 1;
}
}
.scan-field {
height: 88rpx;
padding: 0 24rpx;
line-height: 88rpx;
border: 2rpx solid #e5e6eb;
border-radius: 14rpx;
background: #f7f8fa;
color: #1f2329;
box-sizing: border-box;
font-size: 28rpx;
&--active {
border-color: #1677ff;
background: #fff;
box-shadow: 0 0 0 4rpx rgba(22, 119, 255, 0.1);
}
}
.scan-camera-btn {
width: 88rpx;
height: 88rpx;
line-height: 88rpx;
border-radius: 14rpx;
background: #1677ff;
color: #fff;
font-size: 26rpx;
font-weight: 600;
padding: 0;
border: none;
flex-shrink: 0;
&:active { opacity: 0.85; }
&[disabled] { background: #d9d9d9; }
}
// 库位预览(优先显示)
.scan-location-preview {
margin-bottom: 16rpx;
padding: 20rpx;
border-radius: 14rpx;
background: #f6fff0;
border: 2rpx solid #b7eb8f;
&__row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6rpx 0;
}
&__label {
color: #4e5969;
font-size: 24rpx;
flex-shrink: 0;
}
&__value {
color: #1f2329;
font-size: 24rpx;
font-weight: 600;
margin-right: 12rpx;
&--code {
color: #52c41a;
font-size: 28rpx;
font-weight: 700;
}
}
&__badge {
padding: 4rpx 12rpx;
border-radius: 8rpx;
font-size: 20rpx;
font-weight: 600;
flex-shrink: 0;
&.badge--green {
background: #f6ffed;
color: #52c41a;
border: 1rpx solid #b7eb8f;
}
&.badge--gray {
background: #f7f8fa;
color: #86909c;
border: 1rpx solid #e5e6eb;
}
}
}
// 产品预览
.scan-product-preview {
margin-bottom: 16rpx;
padding: 20rpx;
border-radius: 14rpx;
background: #f0f5ff;
border: 2rpx solid #adc6ff;
&__row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6rpx 0;
}
&__label {
color: #4e5969;
font-size: 24rpx;
flex-shrink: 0;
}
&__value {
color: #1f2329;
font-size: 24rpx;
text-align: right;
&--name {
font-size: 28rpx;
font-weight: 600;
}
}
}
// 确认按钮
.scan-confirm-btn {
height: 96rpx;
line-height: 96rpx;
border-radius: 16rpx;
background: #1677ff;
color: #fff;
font-size: 32rpx;
font-weight: 700;
margin-top: 8rpx;
&[disabled] {
background: #d9d9d9;
color: #fff;
}
}
// 底部栏
.scan-footer {
position: sticky;
bottom: 0;
display: flex;
gap: 16rpx;
padding: 20rpx 0 calc(20rpx + env(safe-area-inset-bottom));
background: #f4f6f8;
&__clear {
flex: 1;
height: 88rpx;
line-height: 88rpx;
border-radius: 16rpx;
background: #fff;
color: #4e5969;
font-size: 28rpx;
border: 2rpx solid #e5e6eb;
}
&__submit {
flex: 2;
height: 88rpx;
line-height: 88rpx;
border-radius: 16rpx;
background: #1677ff;
color: #fff;
font-size: 28rpx;
font-weight: 600;
}
}
</style>

View File

@@ -0,0 +1,57 @@
<template>
<view class="yd-page-container">
<wd-navbar
title="销售出库详情"
left-arrow
placeholder
safe-area-inset-top
fixed
@click-left="handleBack"
/>
<view class="p-24rpx">
<wd-cell-group title="出库单信息">
<wd-cell title="单号" :value="detail?.no || '-'" />
<wd-cell title="客户" :value="detail?.customerName || '-'" />
<wd-cell title="订单号" :value="detail?.orderNo || '-'" />
<wd-cell title="总数量" :value="formatCount(detail?.totalCount)" />
<wd-cell title="总金额" :value="formatPrice(detail?.totalPrice)" />
<wd-cell title="状态">
<wd-tag :type="detail?.status === 20 ? 'success' : 'warning'">
{{ detail?.status === 20 ? '已审核' : '未审核' }}
</wd-tag>
</wd-cell>
</wd-cell-group>
</view>
</view>
</template>
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { getSaleOut } from '@/api/erp/sale-out'
import { getNavbarHeight, navigateBackPlus } from '@/utils'
const props = defineProps<{ id?: number }>()
const detail = ref<any>(null)
function formatCount(count?: number) {
return count !== undefined && count !== null ? count.toFixed(2) : '-'
}
function formatPrice(price?: number) {
return price !== undefined && price !== null ? `¥${price.toFixed(2)}` : '-'
}
function handleBack() {
navigateBackPlus()
}
onMounted(async () => {
if (props.id) {
detail.value = await getSaleOut(props.id)
}
})
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,26 @@
<template>
<view class="yd-page-container">
<wd-navbar
title="新建销售出库"
left-arrow
placeholder
safe-area-inset-top
fixed
@click-left="handleBack"
/>
<view class="p-24rpx">
<wd-notice-bar text="新建销售出库功能开发中,请使用其他方式创建" />
</view>
</view>
</template>
<script setup lang="ts">
import { navigateBackPlus } from '@/utils'
function handleBack() {
navigateBackPlus()
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,408 @@
<template>
<view class="yd-page-container">
<!-- 顶部导航栏 -->
<wd-navbar
title="销售出库"
left-arrow placeholder safe-area-inset-top fixed
@click-left="handleBack"
/>
<!-- 搜索组件 -->
<view @click="searchVisible = true">
<wd-search :placeholder="searchPlaceholder" hide-cancel disabled />
</view>
<!-- 快捷筛选标签 -->
<view class="mx-24rpx mb-16rpx flex items-center overflow-hidden rounded-12rpx bg-white shadow-sm">
<view
v-for="tab in statusTabs"
:key="tab.value"
class="relative flex-1 py-20rpx text-center text-26rpx"
:class="queryParams.status === tab.value ? 'text-[#1890ff] font-semibold' : 'text-[#666]'"
@click="onTabChange(tab.value)"
>
{{ tab.label }}
<view
v-if="queryParams.status === tab.value"
class="absolute bottom-0 left-1/4 h-4rpx w-1/2 rounded-2rpx bg-[#1890ff]"
/>
</view>
</view>
<!-- 出库单列表 -->
<view class="px-24rpx">
<view
v-for="item in list"
:key="item.id"
class="mb-20rpx overflow-hidden rounded-12rpx bg-white shadow-sm"
@click="handleDetail(item)"
>
<view class="p-24rpx">
<!-- 头部单号 + 状态 -->
<view class="mb-16rpx flex items-center justify-between">
<view class="text-28rpx text-[#333] font-semibold">
{{ item.no || '-' }}
</view>
<view
class="rounded-8rpx px-16rpx py-4rpx text-24rpx"
:class="item.status === 20 ? 'bg-[#f6ffed] text-[#52c41a]' : 'bg-[#fff7e6] text-[#fa8c16]'"
>
{{ item.status === 20 ? '已审核' : '未审核' }}
</view>
</view>
<!-- 客户 -->
<view class="mb-8rpx flex items-center justify-between text-26rpx text-[#666]">
<text class="text-[#999]">客户</text>
<text>{{ item.customerName || '-' }}</text>
</view>
<!-- 订单号 -->
<view v-if="item.orderNo" class="mb-8rpx flex items-center justify-between text-26rpx text-[#666]">
<text class="text-[#999]">订单</text>
<text>{{ item.orderNo }}</text>
</view>
<!-- 产品 -->
<view class="mb-8rpx flex items-center justify-between text-26rpx text-[#666]">
<text class="text-[#999]">产品</text>
<text class="line-clamp-1 ml-16rpx text-right" style="max-width: 400rpx;">{{ item.productNames || '-' }}</text>
</view>
<!-- 数量金额区域 -->
<view class="mt-12rpx flex items-center justify-around border-t border-[#f0f0f0] pt-16rpx">
<view class="text-center">
<view class="text-32rpx text-[#333] font-semibold">
{{ formatCount(item.totalCount) }}
</view>
<view class="mt-4rpx text-22rpx text-[#999]">
数量
</view>
</view>
<view class="text-center">
<view class="text-32rpx text-[#f5222d] font-semibold">
{{ formatPrice(item.totalPrice) }}
</view>
<view class="mt-4rpx text-22rpx text-[#999]">
金额
</view>
</view>
</view>
</view>
<!-- 操作按钮 -->
<view class="flex flex-wrap gap-12rpx px-24rpx pb-20rpx" @click.stop>
<wd-button
v-if="hasAccessByCodes(['erp:sale-out:query'])"
size="small" type="warning" plain @click="handleScanOut(item)"
>
扫码出库
</wd-button>
<wd-button
v-if="hasAccessByCodes(['erp:sale-out:update']) && item.status !== 20"
size="small" type="primary" plain @click="handleEdit(item)"
>
编辑
</wd-button>
<wd-button
v-if="hasAccessByCodes(['erp:sale-out:update-status']) && item.status === 10"
size="small" type="success" plain @click="handleApprove(item.id!)"
>
审批
</wd-button>
<wd-button
v-if="hasAccessByCodes(['erp:sale-out:update-status']) && item.status === 20"
size="small" type="warning" plain @click="handleReverseApprove(item.id!)"
>
反审批
</wd-button>
<wd-button
v-if="hasAccessByCodes(['erp:sale-out:delete']) && item.status !== 20"
size="small" type="error" plain @click="handleDelete(item.id!)"
>
删除
</wd-button>
</view>
</view>
<!-- 加载更多 -->
<view v-if="loadMoreState !== 'loading' && list.length === 0" class="py-100rpx text-center">
<wd-status-tip image="content" tip="暂无销售出库单数据" />
</view>
<wd-loadmore
v-if="list.length > 0"
:state="loadMoreState"
@reload="loadMore"
/>
</view>
<!-- 搜索弹窗 -->
<wd-popup v-model="searchVisible" position="top" @close="searchVisible = false">
<view class="yd-search-form-container" :style="{ paddingTop: `${getNavbarHeight()}px` }">
<view class="yd-search-form-item">
<view class="yd-search-form-label">
出库单号
</view>
<wd-input v-model="searchForm.no" placeholder="请输入出库单号" clearable />
</view>
<view class="yd-search-form-item">
<view class="yd-search-form-label">
审核状态
</view>
<view class="yd-search-form-radio-group">
<view
v-for="opt in statusOptions"
:key="opt.value"
class="yd-search-form-radio"
:class="{ 'yd-search-form-radio--active': searchForm.status === opt.value }"
@click="searchForm.status = opt.value"
>
{{ opt.label }}
</view>
</view>
</view>
<view class="yd-search-form-actions">
<wd-button class="flex-1" plain @click="handleReset">
重置
</wd-button>
<wd-button class="flex-1" type="primary" @click="handleSearch">
搜索
</wd-button>
</view>
</view>
</wd-popup>
</view>
</template>
<script lang="ts" setup>
import type { SaleOut } from '@/api/erp/sale-out'
import type { LoadMoreState } from '@/http/types'
import { onReachBottom } from '@dcloudio/uni-app'
import { computed, onMounted, reactive, ref } from 'vue'
import { useToast } from 'wot-design-uni'
import { deleteSaleOut, getSaleOutPage, updateSaleOutStatus } from '@/api/erp/sale-out'
import { useAccess } from '@/hooks/useAccess'
import { formatDate as formatDateValue } from '@/utils/date'
import { getNavbarHeight, navigateBackPlus } from '@/utils'
definePage({
style: {
navigationBarTitleText: '',
navigationStyle: 'custom',
},
})
const { hasAccessByCodes } = useAccess()
const toast = useToast()
const total = ref(0)
const list = ref<SaleOut[]>([])
const loadMoreState = ref<LoadMoreState>('loading')
const queryParams = ref<Record<string, any>>({
pageNo: 1,
pageSize: 10,
status: undefined,
})
// 搜索相关
const searchVisible = ref(false)
const searchForm = reactive({
no: undefined as string | undefined,
status: undefined as number | undefined,
})
/** 状态标签 */
const statusTabs = [
{ value: undefined, label: '全部' },
{ value: 10, label: '未审核' },
{ value: 20, label: '已审核' },
]
/** 状态选项 */
const statusOptions = [
{ value: undefined, label: '全部' },
{ value: 10, label: '未审核' },
{ value: 20, label: '已审核' },
]
/** 搜索条件 placeholder */
const searchPlaceholder = computed(() => {
const conditions: string[] = []
if (searchForm.no)
conditions.push(`单号:${searchForm.no}`)
if (searchForm.status !== undefined) {
const statusLabel = statusOptions.find(o => o.value === searchForm.status)?.label
if (statusLabel && statusLabel !== '全部')
conditions.push(`状态:${statusLabel}`)
}
return conditions.length > 0 ? conditions.join(' | ') : '搜索销售出库单'
})
/** 格式化数量 */
function formatCount(count?: number) {
if (count === undefined || count === null)
return '-'
return count.toFixed(2)
}
/** 格式化金额 */
function formatPrice(price?: number) {
if (price === undefined || price === null)
return '-'
return `¥${price.toFixed(2)}`
}
/** 格式化日期 */
function formatDate(dateStr?: string | number | Date) {
return formatDateValue(dateStr) || '-'
}
/** 返回上一页 */
function handleBack() {
navigateBackPlus()
}
/** 切换状态标签 */
function onTabChange(status: number | undefined) {
queryParams.value.status = status
list.value = []
queryParams.value.pageNo = 1
getList()
}
/** 查询出库单列表 */
async function getList() {
loadMoreState.value = 'loading'
try {
const params = { ...queryParams.value }
if (searchForm.no)
params.no = searchForm.no
const data = await getSaleOutPage(params)
list.value = [...list.value, ...data.list]
total.value = data.total
loadMoreState.value = list.value.length >= total.value ? 'finished' : 'loading'
} catch {
queryParams.value.pageNo = queryParams.value.pageNo > 1 ? queryParams.value.pageNo - 1 : 1
loadMoreState.value = 'error'
}
}
/** 搜索 */
function handleSearch() {
searchVisible.value = false
queryParams.value = {
pageNo: 1,
pageSize: queryParams.value.pageSize,
status: searchForm.status,
}
list.value = []
getList()
}
/** 重置 */
function handleReset() {
searchForm.no = undefined
searchForm.status = undefined
searchVisible.value = false
queryParams.value = { pageNo: 1, pageSize: 10, status: undefined }
list.value = []
getList()
}
/** 加载更多 */
function loadMore() {
if (loadMoreState.value === 'finished')
return
queryParams.value.pageNo++
getList()
}
/** 编辑 */
function handleEdit(item: SaleOut) {
// TODO: 跳转到编辑页
uni.navigateTo({ url: `/pages-erp/sale-out/form/index?id=${item.id}` })
}
/** 扫码出库 */
function handleScanOut(item: SaleOut) {
uni.navigateTo({
url: `/pages-erp/sale-out/scan-out/index?id=${item.id}&no=${encodeURIComponent(item.no || '')}`,
})
}
/** 详情 */
function handleDetail(item: SaleOut) {
uni.navigateTo({ url: `/pages-erp/sale-out/detail/index?id=${item.id}` })
}
/** 审批 */
function handleApprove(id: number) {
uni.showModal({
title: '提示',
content: '确定要审批该出库单吗?',
success: async (res) => {
if (!res.confirm)
return
try {
await updateSaleOutStatus(id, 20)
toast.success('审批成功')
refreshList()
} catch {
// error handled by http
}
},
})
}
/** 反审批 */
function handleReverseApprove(id: number) {
uni.showModal({
title: '提示',
content: '确定要反审批该出库单吗?',
success: async (res) => {
if (!res.confirm)
return
try {
await updateSaleOutStatus(id, 10)
toast.success('反审批成功')
refreshList()
} catch {
// error handled by http
}
},
})
}
/** 删除 */
function handleDelete(id: number) {
uni.showModal({
title: '提示',
content: '确定要删除该出库单吗?',
success: async (res) => {
if (!res.confirm)
return
try {
await deleteSaleOut([id])
toast.success('删除成功')
refreshList()
} catch {
// error handled by http
}
},
})
}
/** 刷新列表 */
function refreshList() {
list.value = []
queryParams.value.pageNo = 1
getList()
}
/** 触底加载更多 */
onReachBottom(() => {
loadMore()
})
/** 初始化 */
onMounted(() => {
getList()
})
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,136 @@
<template>
<view class="recent-scan-list">
<view v-if="records.length === 0" class="recent-scan-list__empty">
暂无扫码记录
</view>
<view
v-for="(record, index) in records"
:key="record.id || index"
class="recent-scan-item"
:class="{ 'recent-scan-item--new': index === latestIndex }"
>
<view class="recent-scan-item__main">
<view class="recent-scan-item__info">
<text class="recent-scan-item__name">{{ record.productName || '-' }}</text>
<text class="recent-scan-item__spec">{{ record.productSpec || '-' }}</text>
</view>
<view class="recent-scan-item__meta">
<text class="recent-scan-item__location">{{ record.locationCode || '-' }}</text>
<text class="recent-scan-item__count">x{{ record.scanCount || 1 }}</text>
</view>
</view>
<view class="recent-scan-item__time">
<text>{{ formatTime(record.scanTime) }}</text>
<text class="recent-scan-item__delete" @tap.stop="$emit('delete', index)">删除</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
defineProps<{
records: any[]
latestIndex?: number
}>()
defineEmits<{
(event: 'delete', index: number): void
}>()
function formatTime(timeStr?: string) {
if (!timeStr) return ''
try {
const d = new Date(timeStr)
return `${d.getHours().toString().padStart(2, '0')}:${d.getMinutes().toString().padStart(2, '0')}:${d.getSeconds().toString().padStart(2, '0')}`
} catch {
return ''
}
}
</script>
<style lang="scss" scoped>
.recent-scan-list {
&__empty {
text-align: center;
color: #86909c;
font-size: 24rpx;
padding: 24rpx 0;
}
}
.recent-scan-item {
padding: 16rpx 0;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
&--new {
background: #f6ffed;
margin: 0 -24rpx;
padding: 16rpx 24rpx;
border-radius: 12rpx;
border-bottom: none;
}
&__main {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12rpx;
margin-bottom: 8rpx;
}
&__info {
display: flex;
flex-direction: column;
gap: 4rpx;
min-width: 0;
flex: 1;
}
&__name {
font-size: 26rpx;
font-weight: 600;
color: #1f2329;
}
&__spec {
font-size: 22rpx;
color: #86909c;
}
&__meta {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 4rpx;
}
&__location {
font-size: 24rpx;
color: #52c41a;
font-weight: 600;
}
&__count {
font-size: 24rpx;
color: #f5222d;
font-weight: 600;
}
&__time {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 20rpx;
color: #86909c;
}
&__delete {
color: #f5222d;
padding: 4rpx 8rpx;
}
}
</style>

View File

@@ -0,0 +1,69 @@
<template>
<view class="scan-context-bar">
<view class="scan-context-bar__main">
<view class="scan-context-bar__order">
<text class="scan-context-bar__label">出库单</text>
<text class="scan-context-bar__value">{{ saleOutNo || '未关联出库单' }}</text>
</view>
<view class="scan-context-bar__stats">
<text>记录 {{ recordCount }} </text>
<text>累计 {{ scannedCount }} </text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
defineProps<{
saleOutId?: number
saleOutNo?: string
scannedCount: number
recordCount: number
}>()
</script>
<style lang="scss" scoped>
.scan-context-bar {
padding: 20rpx 24rpx;
border-radius: 16rpx;
background: #fff;
margin-bottom: 16rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
&__main {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
}
&__order {
display: flex;
align-items: center;
gap: 12rpx;
min-width: 0;
flex: 1;
}
&__label {
flex-shrink: 0;
color: #86909c;
font-size: 24rpx;
}
&__value {
color: #1f2329;
font-size: 28rpx;
font-weight: 600;
}
&__stats {
display: flex;
gap: 20rpx;
flex-shrink: 0;
color: #1677ff;
font-size: 24rpx;
font-weight: 600;
}
}
</style>

View File

@@ -0,0 +1,43 @@
<template>
<view v-if="message" class="feedback-bar" :class="`feedback-bar--${tone}`">
{{ message }}
</view>
</template>
<script setup lang="ts">
withDefaults(
defineProps<{
tone?: 'success' | 'error' | 'idle'
message?: string
}>(),
{
tone: 'idle',
message: '',
},
)
</script>
<style lang="scss" scoped>
.feedback-bar {
min-height: 76rpx;
padding: 18rpx 24rpx;
border-radius: 14rpx;
font-size: 24rpx;
line-height: 40rpx;
&--idle {
background: #f2f3f5;
color: #4e5969;
}
&--success {
background: #f6ffed;
color: #389e0d;
}
&--error {
background: #fff2f0;
color: #cf1322;
}
}
</style>

View File

@@ -0,0 +1,928 @@
<template>
<view class="yd-page-container scan-page">
<wd-navbar
title="扫码出库"
left-arrow
placeholder
safe-area-inset-top
fixed
@click-left="handleBack"
/>
<view class="scan-page__content">
<!-- 顶部上下文条 -->
<ScanContextBar
:sale-out-id="saleOutId"
:sale-out-no="saleOutNo"
:scanned-count="scannedTotalCount"
:record-count="records.length"
/>
<!-- 扫码工作台 -->
<view class="scan-workbench">
<!-- 当前扫码上下文提示 -->
<view class="scan-panel">
<!-- 步骤指示器库位优先 -->
<view class="scan-step-indicator">
<view class="scan-step-indicator__item" :class="{ 'active': step === 'idle', 'done': step !== 'idle' }">
<view class="scan-step-indicator__dot">1</view>
<text>扫库位</text>
</view>
<view class="scan-step-indicator__line" :class="{ 'done': step !== 'idle' }" />
<view class="scan-step-indicator__item" :class="{ 'active': step === 'location_scanned', 'done': step === 'product_scanned' }">
<view class="scan-step-indicator__dot">2</view>
<text>扫产品</text>
</view>
<view class="scan-step-indicator__line" :class="{ 'done': step === 'product_scanned' }" />
<view class="scan-step-indicator__item" :class="{ 'active': step === 'product_scanned' }">
<view class="scan-step-indicator__dot">3</view>
<text>确认</text>
</view>
</view>
<!-- 当前作业提示 -->
<view class="scan-current-hint">
<text v-if="step === 'idle'">请扫描库位条码</text>
<text v-else-if="step === 'location_scanned'">请扫描产品条码</text>
<text v-else-if="step === 'product_scanned'">扫码完成请确认出库</text>
</view>
<!-- 库位扫码区 -->
<view class="scan-row" :class="{ 'scan-row--dim': step !== 'idle' }">
<input
v-model="locationCode"
class="scan-field"
:class="{ 'scan-field--active': step === 'idle' }"
placeholder="扫描库位条码"
confirm-type="next"
:focus="locationInputFocus"
:cursor-spacing="20"
:adjust-position="true"
:hold-keyboard="true"
@blur="handleLocationBlur"
@confirm="handleLocationScan"
>
<button class="scan-camera-btn" :disabled="scanLoading" @tap="handleCameraScan('location')">
</button>
</view>
<!-- 库位预览扫库位码后显示 -->
<view class="scan-location-preview" v-if="locationInfo">
<view class="scan-location-preview__row">
<text class="scan-location-preview__label">仓库</text>
<text class="scan-location-preview__value">{{ locationInfo.warehouseName }}</text>
</view>
<view class="scan-location-preview__row">
<text class="scan-location-preview__label">库位</text>
<text class="scan-location-preview__value scan-location-preview__value--code">
{{ locationInfo.locationCode }}
</text>
<text class="scan-location-preview__badge" :class="locationInfo.enableLocation ? 'badge--green' : 'badge--gray'">
{{ locationInfo.enableLocation ? '库位管理' : '无库位管理' }}
</text>
</view>
</view>
<!-- 产品扫码区 -->
<view class="scan-row" :class="{ 'scan-row--dim': step === 'idle' || step === 'product_scanned' }">
<input
v-model="productBarCode"
class="scan-field"
:class="{ 'scan-field--active': step === 'location_scanned' }"
placeholder="扫描产品条码"
confirm-type="done"
:focus="productInputFocus"
:cursor-spacing="20"
:adjust-position="true"
:hold-keyboard="true"
@blur="handleProductBlur"
@confirm="handleProductScan"
>
<button class="scan-camera-btn" :disabled="scanLoading" @tap="handleCameraScan('product')">
</button>
</view>
<!-- 产品预览扫产品码后显示 -->
<view class="scan-product-preview" v-if="productPreview">
<view class="scan-product-preview__row">
<text class="scan-product-preview__label">产品</text>
<text class="scan-product-preview__value scan-product-preview__value--name">
{{ productPreview.name }}
</text>
</view>
<view class="scan-product-preview__row">
<text class="scan-product-preview__label">规格</text>
<text class="scan-product-preview__value">{{ productPreview.standard || '-' }}</text>
</view>
<view class="scan-product-preview__row">
<text class="scan-product-preview__label">条码</text>
<text class="scan-product-preview__value">{{ productPreview.barCode || '-' }}</text>
</view>
</view>
<!-- 批次号扫产品后显示 -->
<view class="scan-row" v-if="step === 'product_scanned'">
<input
v-model="batchNo"
class="scan-field"
placeholder="批次号(可选)"
confirm-type="done"
>
</view>
<!-- 确认出库按钮 -->
<button
v-if="step === 'product_scanned'"
class="scan-confirm-btn"
:disabled="!canConfirm || scanLoading"
@tap="handleConfirm"
>
{{ scanLoading ? '处理中...' : '确认出库' }}
</button>
<ScanFeedbackBar :tone="feedbackTone" :message="feedbackMessage" />
</view>
<!-- 扫码记录列表 -->
<view class="scan-panel scan-panel--list">
<view class="scan-panel__header">
<view class="scan-panel__title">
扫码记录
</view>
<view class="scan-panel__meta">
{{ records.length }}
</view>
</view>
<RecentScanList
:records="records"
:latest-index="latestRecordIndex"
@delete="handleDeleteRecord"
/>
</view>
<!-- 提交栏 -->
<view class="scan-footer">
<button class="scan-footer__clear" @tap="handleClearAll">
清空记录
</button>
<button class="scan-footer__submit" :loading="submitting" @tap="handleSubmit">
保存出库记录
</button>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import type { ProductByBarCode } from '@/api/erp/product'
import type { LocationByCodeVO } from '@/api/erp/location'
import { computed, nextTick, onMounted, ref } from 'vue'
import { useToast } from 'wot-design-uni'
import { getProductByBarCode } from '@/api/erp/product'
import { getLocationByCode } from '@/api/erp/location'
import { getSaleOut } from '@/api/erp/sale-out'
import { createSaleOutScanRecord, deleteSaleOutScanRecord, getSaleOutScanRecordList } from '@/api/erp/sale-out-scan-record'
import ScanFeedbackBar from '@/pages-erp/sale-out/scan-out/components/scan-feedback-bar.vue'
import RecentScanList from '@/pages-erp/sale-out/scan-out/components/recent-scan-list.vue'
import ScanContextBar from '@/pages-erp/sale-out/scan-out/components/scan-context-bar.vue'
import { navigateBackPlus } from '@/utils'
import { normalizeCameraScanResult, normalizeScanCode } from '@/utils/scan'
definePage({
style: {
navigationBarTitleText: '',
navigationStyle: 'custom',
},
})
/** 扫码出库记录 */
export interface ScanRecord {
id?: number
saleOutId: number
productId?: number
productName?: string
productSpec?: string
productBarCode?: string
productUnit?: string
warehouseId?: number
warehouseName?: string
locationCode?: string
batchNo?: string
scanCount: number
scanTime?: string
operatorId?: number
operatorName?: string
}
type Step = 'idle' | 'location_scanned' | 'product_scanned'
/** 页面参数id=出库单ID, no=出库单号 */
const props = defineProps<{
id?: number
no?: string
}>()
const toast = useToast()
// 页面参数
const saleOutId = ref<number>()
const saleOutNo = ref<string>()
// 扫码步骤
const step = ref<Step>('idle')
// 扫码数据
const locationCode = ref('')
const locationInfo = ref<LocationByCodeVO | null>(null)
const productBarCode = ref('')
const productPreview = ref<ProductByBarCode | null>(null)
const batchNo = ref('')
// 状态
const scanLoading = ref(false)
const submitting = ref(false)
const records = ref<ScanRecord[]>([])
const feedbackTone = ref<'success' | 'error' | 'idle'>('idle')
const feedbackMessage = ref('')
// 输入框焦点控制
const locationInputFocus = ref(false)
const productInputFocus = ref(false)
// 计算属性
const canConfirm = computed(() => {
return locationInfo.value?.warehouseId && productPreview.value?.id && scanLoading.value === false
})
const scannedTotalCount = computed(() =>
records.value.reduce((sum, r) => sum + Number(r.scanCount || 0), 0),
)
const latestRecordIndex = computed(() => {
if (records.value.length === 0) return undefined
return records.value.length - 1
})
/** 返回上一页 */
function handleBack() {
navigateBackPlus('/pages-erp/sale-out/index')
}
/** 初始化页面 */
onMounted(async () => {
if (props.id) saleOutId.value = props.id
if (props.no) saleOutNo.value = decodeURIComponent(props.no)
if (saleOutId.value) {
try {
const data = await getSaleOut(saleOutId.value)
saleOutNo.value = data.no
} catch {
// 忽略
}
await loadRecords()
}
// PDA 扫码枪需要输入框自动获得焦点,延迟确保页面完全渲染
await nextTick()
setTimeout(() => {
focusLocationInput()
}, 500)
})
/** 重置到初始状态 */
function resetToIdle() {
clearScanInputs()
locationInfo.value = null
productPreview.value = null
step.value = 'idle'
// 延迟清空错误 + 聚焦光标,让用户先看到错误提示
setTimeout(() => {
clearFeedback()
focusLocationInput()
}, 800)
}
/** 聚焦库位码输入框 */
function focusLocationInput() {
productInputFocus.value = false
locationInputFocus.value = false
nextTick(() => {
locationInputFocus.value = true
})
}
/** 库位输入框失焦处理 - 如果当前步骤是 idle自动重新聚焦 */
function handleLocationBlur() {
if (step.value === 'idle' && !scanLoading.value) {
setTimeout(() => {
if (step.value === 'idle') {
focusLocationInput()
}
}, 100)
}
}
/** 产品输入框失焦处理 - 如果当前步骤是 location_scanned自动重新聚焦 */
function handleProductBlur() {
if (step.value === 'location_scanned' && !scanLoading.value) {
setTimeout(() => {
if (step.value === 'location_scanned') {
focusProductInput()
}
}, 100)
}
}
/** 加载已有扫码记录 */
async function loadRecords() {
if (!saleOutId.value) return
try {
const data = await getSaleOutScanRecordList(saleOutId.value)
records.value = data || []
} catch {
records.value = []
}
}
/**
* 扫库位码:自动反查仓库信息
*/
async function handleLocationScan() {
const code = normalizeScanCode(locationCode.value)
if (!code) {
setErrorFeedback('请先扫描库位条码')
return
}
scanLoading.value = true
try {
try {
locationInfo.value = await getLocationByCode(code)
} catch {
setErrorFeedback(`库位码 ${code} 不存在`)
resetToIdle()
return
}
if (!locationInfo.value?.warehouseId) {
setErrorFeedback(`库位码 ${code} 未找到对应仓库`)
resetToIdle()
return
}
locationCode.value = code
step.value = 'location_scanned'
productBarCode.value = ''
productPreview.value = null
batchNo.value = ''
clearFeedback()
// 聚焦产品输入框,等待扫码枪输入
focusProductInput()
} finally {
scanLoading.value = false
}
}
/** 聚焦产品码输入框 */
function focusProductInput() {
locationInputFocus.value = false
productInputFocus.value = false
nextTick(() => {
productInputFocus.value = true
})
}
/**
* 扫产品码:自动反查产品信息
*/
async function handleProductScan() {
const code = normalizeScanCode(productBarCode.value)
if (!code) {
setErrorFeedback('请先扫描产品条码')
return
}
if (!locationInfo.value) {
setErrorFeedback('请先扫描库位条码')
step.value = 'idle'
return
}
scanLoading.value = true
try {
try {
productPreview.value = await getProductByBarCode(code)
} catch {
setErrorFeedback(`条码 ${code} 未匹配到产品`)
resetToIdle()
return
}
if (!productPreview.value?.id) {
setErrorFeedback(`条码 ${code} 未匹配到产品`)
resetToIdle()
return
}
productBarCode.value = code
step.value = 'product_scanned'
clearFeedback()
} finally {
scanLoading.value = false
}
}
/**
* 确认出库
*/
async function handleConfirm() {
if (!canConfirm.value) return
scanLoading.value = true
try {
const record: ScanRecord = {
saleOutId: saleOutId.value || 0,
productId: productPreview.value!.id,
productName: productPreview.value!.name,
productSpec: productPreview.value!.standard,
productBarCode: productPreview.value!.barCode,
productUnit: productPreview.value!.unitName,
warehouseId: locationInfo.value!.warehouseId,
warehouseName: locationInfo.value!.warehouseName,
locationCode: locationInfo.value!.locationCode,
batchNo: batchNo.value.trim() || undefined,
scanCount: 1,
scanTime: new Date().toISOString(),
}
// 提交到后端
try {
const newId = await createSaleOutScanRecord(record)
record.id = newId
} catch {
record.id = Date.now()
}
// 追加到列表
records.value.push(record)
// 重置,准备下一次扫码
const productName = productPreview.value!.name
const locationCodeText = locationInfo.value!.locationCode
clearScanInputs()
step.value = 'idle'
setSuccessFeedback(`${productName}${locationCodeText} 出库成功`)
await nextTick()
// 聚焦库位输入框,等待扫码枪输入
focusLocationInput()
} finally {
scanLoading.value = false
}
}
/** 相机扫码 */
function handleCameraScan(target: 'location' | 'product') {
if (scanLoading.value) return
// #ifdef APP-PLUS
plus.android.requestPermissions(
['android.permission.CAMERA'],
function(result) {
const granted = result.granted
if (granted && granted.length > 0) {
doScan(target)
} else {
toast.error('请在设置中开启相机权限')
uni.openSetting()
}
},
function() {
toast.error('相机权限获取失败')
},
)
// #endif
// #ifndef APP-PLUS
doScan(target)
// #endif
}
function doScan(target: 'location' | 'product') {
uni.scanCode({
onlyFromCamera: true,
success: async (result) => {
const code = normalizeCameraScanResult(result)
if (!code) return
if (target === 'location') {
locationCode.value = code
await handleLocationScan()
} else {
productBarCode.value = code
await handleProductScan()
}
},
fail: (error) => {
if (String(error?.errMsg || '').includes('cancel')) return
toast.error('相机扫码失败,请重试')
},
})
}
/** 删除单条记录 */
async function handleDeleteRecord(index: number) {
const record = records.value[index]
if (!record) return
if (record.id && record.id > 0 && record.id < 1000000000000) {
try {
await deleteSaleOutScanRecord(record.id)
} catch {
toast.error('删除失败')
return
}
}
records.value.splice(index, 1)
}
/** 清空所有记录 */
function handleClearAll() {
if (records.value.length === 0) return
uni.showModal({
title: '确认清空',
content: '确定要清空所有扫码记录吗?',
success: async (res) => {
if (!res.confirm) return
const toDelete = records.value.filter(r => r.id && r.id > 0 && r.id < 1000000000000)
for (const r of toDelete) {
try { await deleteSaleOutScanRecord(r.id!) } catch { /* ignore */ }
}
records.value = []
clearFeedback()
},
})
}
/** 保存出库记录 */
async function handleSubmit() {
if (records.value.length === 0) {
toast.warning('暂无扫码记录')
return
}
if (!saleOutId.value) {
toast.warning('缺少销售出库单ID')
return
}
submitting.value = true
try {
toast.success(`已保存 ${records.value.length} 条出库记录`)
records.value = []
await loadRecords()
} finally {
submitting.value = false
}
}
/** 清空本次扫码输入 */
function clearScanInputs() {
locationCode.value = ''
locationInfo.value = null
productBarCode.value = ''
productPreview.value = null
batchNo.value = ''
}
function setSuccessFeedback(message: string) {
feedbackTone.value = 'success'
feedbackMessage.value = message
}
function setErrorFeedback(message: string) {
feedbackTone.value = 'error'
feedbackMessage.value = message
}
function clearFeedback() {
feedbackTone.value = 'idle'
feedbackMessage.value = ''
}
</script>
<style lang="scss" scoped>
.scan-page {
background: #f4f6f8;
min-height: 100vh;
&__content {
padding: 24rpx;
padding-top: calc(24rpx + env(safe-area-inset-top) + 88rpx);
box-sizing: border-box;
}
}
.scan-workbench {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.scan-panel {
padding: 24rpx;
border-radius: 18rpx;
background: #fff;
&--list {
padding-bottom: 8rpx;
}
&__header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
margin-bottom: 16rpx;
}
&__title {
color: #1f2329;
font-size: 28rpx;
font-weight: 600;
}
&__meta {
color: #86909c;
font-size: 22rpx;
}
}
// 步骤指示器
.scan-step-indicator {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 24rpx;
&__item {
display: flex;
flex-direction: column;
align-items: center;
gap: 8rpx;
text {
font-size: 22rpx;
color: #86909c;
}
&.active text {
color: #1677ff;
font-weight: 600;
}
&.done text {
color: #52c41a;
}
}
&__dot {
width: 48rpx;
height: 48rpx;
line-height: 48rpx;
border-radius: 50%;
background: #f2f3f5;
color: #86909c;
font-size: 24rpx;
font-weight: 600;
text-align: center;
}
&__item.active &__dot {
background: #1677ff;
color: #fff;
}
&__item.done &__dot {
background: #52c41a;
color: #fff;
}
&__line {
flex: 1;
height: 2rpx;
background: #e5e6eb;
margin: 0 12rpx;
margin-bottom: 28rpx;
max-width: 80rpx;
&.done {
background: #52c41a;
}
}
}
// 当前作业提示
.scan-current-hint {
text-align: center;
font-size: 30rpx;
font-weight: 600;
color: #1f2329;
margin-bottom: 20rpx;
}
// 输入行
.scan-row {
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 16rpx;
transition: opacity 0.2s;
&--dim {
opacity: 0.4;
pointer-events: none;
}
.scan-field {
flex: 1;
}
}
.scan-field {
height: 88rpx;
padding: 0 24rpx;
line-height: 88rpx;
border: 2rpx solid #e5e6eb;
border-radius: 14rpx;
background: #f7f8fa;
color: #1f2329;
box-sizing: border-box;
font-size: 28rpx;
&--active {
border-color: #1677ff;
background: #fff;
box-shadow: 0 0 0 4rpx rgba(22, 119, 255, 0.1);
}
}
.scan-camera-btn {
width: 88rpx;
height: 88rpx;
line-height: 88rpx;
border-radius: 14rpx;
background: #1677ff;
color: #fff;
font-size: 26rpx;
font-weight: 600;
padding: 0;
border: none;
flex-shrink: 0;
&:active { opacity: 0.85; }
&[disabled] { background: #d9d9d9; }
}
// 库位预览
.scan-location-preview {
margin-bottom: 16rpx;
padding: 20rpx;
border-radius: 14rpx;
background: #f6fff0;
border: 2rpx solid #b7eb8f;
&__row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6rpx 0;
}
&__label {
color: #4e5969;
font-size: 24rpx;
flex-shrink: 0;
}
&__value {
color: #1f2329;
font-size: 24rpx;
font-weight: 600;
margin-right: 12rpx;
&--code {
color: #52c41a;
font-size: 28rpx;
font-weight: 700;
}
}
&__badge {
padding: 4rpx 12rpx;
border-radius: 8rpx;
font-size: 20rpx;
font-weight: 600;
flex-shrink: 0;
&.badge--green {
background: #f6ffed;
color: #52c41a;
border: 1rpx solid #b7eb8f;
}
&.badge--gray {
background: #f7f8fa;
color: #86909c;
border: 1rpx solid #e5e6eb;
}
}
}
// 产品预览
.scan-product-preview {
margin-bottom: 16rpx;
padding: 20rpx;
border-radius: 14rpx;
background: #f0f5ff;
border: 2rpx solid #adc6ff;
&__row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6rpx 0;
}
&__label {
color: #4e5969;
font-size: 24rpx;
flex-shrink: 0;
}
&__value {
color: #1f2329;
font-size: 24rpx;
text-align: right;
&--name {
font-size: 28rpx;
font-weight: 600;
}
}
}
// 确认按钮
.scan-confirm-btn {
height: 96rpx;
line-height: 96rpx;
border-radius: 16rpx;
background: #1677ff;
color: #fff;
font-size: 32rpx;
font-weight: 700;
margin-top: 8rpx;
&[disabled] {
background: #d9d9d9;
color: #fff;
}
}
// 底部栏
.scan-footer {
position: sticky;
bottom: 0;
display: flex;
gap: 16rpx;
padding: 20rpx 0 calc(20rpx + env(safe-area-inset-bottom));
background: #f4f6f8;
&__clear {
flex: 1;
height: 88rpx;
line-height: 88rpx;
border-radius: 16rpx;
background: #fff;
color: #4e5969;
font-size: 28rpx;
border: 2rpx solid #e5e6eb;
}
&__submit {
flex: 2;
height: 88rpx;
line-height: 88rpx;
border-radius: 16rpx;
background: #1677ff;
color: #fff;
font-size: 28rpx;
font-weight: 600;
}
}
</style>

View File

@@ -54,6 +54,14 @@ const menuGroupsData: MenuGroup[] = [
iconColor: '#52c41a', iconColor: '#52c41a',
permission: 'erp:purchase-in:query', permission: 'erp:purchase-in:query',
}, },
{
key: 'purchaseInScan',
name: '扫码入库',
icon: 'scan',
url: '/pages-erp/purchase-in/scan-in/index',
iconColor: '#13c2c2',
permission: 'erp:purchase-in:query',
},
{ {
key: 'purchaseReturn', key: 'purchaseReturn',
name: '采购退货', name: '采购退货',
@@ -110,6 +118,28 @@ const menuGroupsData: MenuGroup[] = [
// }, // },
// ], // ],
// }, // },
{
key: 'sale',
name: '销售管理',
menus: [
{
key: 'saleOut',
name: '销售出库',
icon: 'arrow-right',
url: '/pages-erp/sale-out/index',
iconColor: '#f5222d',
permission: 'erp:sale-out:query',
},
{
key: 'saleOutScan',
name: '扫码出库',
icon: 'scan',
url: '/pages-erp/sale-out/scan-out/index',
iconColor: '#cf1322',
permission: 'erp:sale-out:query',
},
],
},
{ {
key: 'stock', key: 'stock',
name: '库存管理', name: '库存管理',