袁伟杰:V2.0.003 采购入库扫码

This commit is contained in:
yuan
2026-05-14 16:48:09 +08:00
parent 7f84bbca79
commit 7859af83b2
24 changed files with 3479 additions and 62 deletions

View File

@@ -13,18 +13,18 @@
</view>
<!-- 快捷筛选标签 -->
<view class="flex items-center overflow-hidden rounded-12rpx bg-white mx-24rpx mb-16rpx shadow-sm">
<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="flex-1 py-20rpx text-center text-26rpx relative"
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 w-1/2 h-4rpx rounded-2rpx bg-[#1890ff]"
class="absolute bottom-0 left-1/4 h-4rpx w-1/2 rounded-2rpx bg-[#1890ff]"
/>
</view>
</view>
@@ -58,7 +58,7 @@
<!-- 产品 -->
<view class="mb-8rpx flex items-center justify-between text-26rpx text-[#666]">
<text class="text-[#999]">产品</text>
<text class="ml-16rpx line-clamp-1 text-right" style="max-width: 400rpx;">{{ item.productNames || '-' }}</text>
<text class="line-clamp-1 ml-16rpx text-right" style="max-width: 400rpx;">{{ item.productNames || '-' }}</text>
</view>
<!-- 出库时间 -->
<view class="mb-8rpx flex items-center justify-between text-26rpx text-[#666]">
@@ -71,19 +71,33 @@
<text>{{ item.creatorName || '-' }}</text>
</view>
<!-- 数量金额区域 -->
<view class="flex items-center justify-around mt-12rpx pt-16rpx border-t border-[#f0f0f0]">
<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="text-22rpx text-[#999] mt-4rpx">数量</view>
<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="text-22rpx text-[#999] mt-4rpx">金额</view>
<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:stock-out:query']) && item.status !== 20"
size="small" type="primary" plain @click="handleTaskScan(item)"
>
去扫码
</wd-button>
<wd-button
v-if="hasAccessByCodes(['erp:stock-out:update']) && item.status !== 20"
size="small" type="primary" plain @click="handleEdit(item)"
@@ -135,11 +149,15 @@
<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>
<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-label">
审核状态
</view>
<view class="yd-search-form-radio-group">
<view
v-for="opt in statusOptions"
@@ -153,8 +171,12 @@
</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>
<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>
@@ -213,29 +235,34 @@ const statusOptions = [
/** 搜索条件 placeholder */
const searchPlaceholder = computed(() => {
const conditions: string[] = []
if (searchForm.no) conditions.push(`单号:${searchForm.no}`)
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}`)
if (statusLabel && statusLabel !== '全部')
conditions.push(`状态:${statusLabel}`)
}
return conditions.length > 0 ? conditions.join(' | ') : '搜索出库单'
})
/** 格式化数量 */
function formatCount(count?: number) {
if (count === undefined || count === null) return '-'
if (count === undefined || count === null)
return '-'
return count.toFixed(2)
}
/** 格式化金额 */
function formatPrice(price?: number) {
if (price === undefined || price === null) return '-'
if (price === undefined || price === null)
return '-'
return `¥${price.toFixed(2)}`
}
/** 格式化日期 */
function formatDate(dateStr?: string) {
if (!dateStr) return '-'
if (!dateStr)
return '-'
return dateStr.substring(0, 10)
}
@@ -257,7 +284,8 @@ async function getList() {
loadMoreState.value = 'loading'
try {
const params = { ...queryParams.value }
if (searchForm.no) params.no = searchForm.no
if (searchForm.no)
params.no = searchForm.no
const data = await getStockOutPage(params)
list.value = [...list.value, ...data.list]
total.value = data.total
@@ -292,7 +320,8 @@ function handleReset() {
/** 加载更多 */
function loadMore() {
if (loadMoreState.value === 'finished') return
if (loadMoreState.value === 'finished')
return
queryParams.value.pageNo++
getList()
}
@@ -307,6 +336,11 @@ function handleEdit(item: StockOut) {
uni.navigateTo({ url: `/pages-erp/stock-out/form/index?id=${item.id}` })
}
/** 去扫码执行 */
function handleTaskScan(item: StockOut) {
uni.navigateTo({ url: `/pages-erp/stock-out/task-scan/index?id=${item.id}` })
}
/** 详情 */
function handleDetail(item: StockOut) {
uni.navigateTo({ url: `/pages-erp/stock-out/detail/index?id=${item.id}` })
@@ -318,7 +352,8 @@ function handleApprove(id: number) {
title: '提示',
content: '确定要审批该出库单吗?',
success: async (res) => {
if (!res.confirm) return
if (!res.confirm)
return
try {
await updateStockOutStatus(id, 20)
toast.success('审批成功')
@@ -336,7 +371,8 @@ function handleReverseApprove(id: number) {
title: '提示',
content: '确定要反审批该出库单吗?',
success: async (res) => {
if (!res.confirm) return
if (!res.confirm)
return
try {
await updateStockOutStatus(id, 10)
toast.success('反审批成功')
@@ -354,7 +390,8 @@ function handleDelete(id: number) {
title: '提示',
content: '确定要删除该出库单吗?',
success: async (res) => {
if (!res.confirm) return
if (!res.confirm)
return
try {
await deleteStockOut([id])
toast.success('删除成功')