feat: 新增库存盘点功能
- 新增库存盘点任务列表页与明细页(pages/warehouse/inventoryCount*.vue) - 注册盘点页面路由(pages.json) - 新增 stock.check 接口组:list/detail/report/finish/submit/cancel - 首页与快捷操作菜单新增「库存盘点」入口跳转 - 商品查询页库存改为可用数量+锁定数量计算展示
This commit is contained in:
parent
6b3262019f
commit
d518be2c36
@ -427,6 +427,51 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
/** 库存盘点 ↓ */
|
||||
check: {
|
||||
// 盘点任务列表:按当前用户仓库限定范围,支持 status/store_id/keyword 筛选与分页
|
||||
list: {
|
||||
path: "stock.check.list",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
// 盘点任务明细:返回主表 check + 全部明细 rows(含账面/实盘/差异数量)
|
||||
detail: {
|
||||
path: "stock.check.detail",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
// 盘点作业上报:单条明细实盘数量(quantity>=0 整数)
|
||||
report: {
|
||||
path: "stock.check.report",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
// 完成盘点作业:主表置 completed
|
||||
finish: {
|
||||
path: "stock.check.finish",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
// 提交审核:created/rejected → submitted
|
||||
submit: {
|
||||
path: "stock.check.submit",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
// 取消盘点任务:created/submitted/rejected → cancelled
|
||||
cancel: {
|
||||
path: "stock.check.cancel",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
}
|
||||
},
|
||||
pick: {
|
||||
query: {
|
||||
path: "pick.query",
|
||||
|
||||
14
pages.json
14
pages.json
@ -124,6 +124,20 @@
|
||||
"titleNView": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/warehouse/inventoryCount",
|
||||
"style" :
|
||||
{
|
||||
"titleNView": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/warehouse/inventoryCountDetail",
|
||||
"style" :
|
||||
{
|
||||
"titleNView": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/403",
|
||||
"style" :
|
||||
|
||||
@ -322,6 +322,7 @@
|
||||
const isBlockRegistration = menuName === '拦截登记';
|
||||
const isPickingRecord = menuName === '拣货记录' || (menuName.includes('拣货') && menuName.includes('记录'));
|
||||
const isTransferRecord = menuName === '移库记录' || (menuName.includes('移库') && menuName.includes('记录'));
|
||||
const isInventoryCount = menuName === '库存盘点' || (menuName.includes('库存') && menuName.includes('盘点')) || menuName.includes('盘点');
|
||||
const rawPath = item?.component || item?.path || '';
|
||||
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
||||
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
|
||||
@ -342,6 +343,10 @@
|
||||
this.$tools.routerTo('/pages/warehouse/inventoryTransfer');
|
||||
return;
|
||||
}
|
||||
if (isInventoryCount) {
|
||||
this.$tools.routerTo('/pages/warehouse/inventoryCount');
|
||||
return;
|
||||
}
|
||||
const targetPath = isGoodsQuery
|
||||
? '/pages/work/product/query'
|
||||
: (isOrderPicking
|
||||
|
||||
@ -1362,6 +1362,7 @@
|
||||
const isBlockRegistration = menuName === '拦截登记';
|
||||
const isPickingRecord = menuName === '拣货记录' || (menuName.includes('拣货') && menuName.includes('记录'));
|
||||
const isTransferRecord = menuName === '移库记录' || (menuName.includes('移库') && menuName.includes('记录'));
|
||||
const isInventoryCount = menuName === '库存盘点' || (menuName.includes('库存') && menuName.includes('盘点')) || menuName.includes('盘点');
|
||||
const rawPath = item?.component || item?.path || '';
|
||||
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
||||
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
|
||||
@ -1386,6 +1387,10 @@
|
||||
this.$tools.routerTo('/pages/warehouse/inventoryTransfer');
|
||||
return;
|
||||
}
|
||||
if (isInventoryCount) {
|
||||
this.$tools.routerTo('/pages/warehouse/inventoryCount');
|
||||
return;
|
||||
}
|
||||
const targetPath = isGoodsQuery
|
||||
? '/pages/work/product/query'
|
||||
: (isOrderPicking
|
||||
|
||||
723
pages/warehouse/inventoryCount.vue
Normal file
723
pages/warehouse/inventoryCount.vue
Normal file
@ -0,0 +1,723 @@
|
||||
<template>
|
||||
<view class="inventory-count-page">
|
||||
<view class="normar_container">
|
||||
<page-nav title="库存盘点"></page-nav>
|
||||
|
||||
<!-- 搜索区 -->
|
||||
<view class="search-panel">
|
||||
<view class="search-input-wrap">
|
||||
<u-search
|
||||
v-model="keyword"
|
||||
placeholder="请输入/扫描盘点单号或标题"
|
||||
:bg-color="'#f5f5f5'"
|
||||
shape="round"
|
||||
:show-action="false"
|
||||
@search="handleSearch"
|
||||
@clear="handleClear"
|
||||
></u-search>
|
||||
<view class="search-actions">
|
||||
<view class="scan-btn" @click="handleCameraScan">
|
||||
<u-icon name="scan" size="38rpx" color="#2979ff"></u-icon>
|
||||
</view>
|
||||
<view class="search-divider"></view>
|
||||
<view class="search-btn" @click="handleSearch">
|
||||
<text class="search-btn__text">搜索</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view class="filter-scroll" scroll-x :show-scrollbar="false">
|
||||
<view class="filter-group">
|
||||
<view
|
||||
v-for="opt in statusOptions"
|
||||
:key="opt.value"
|
||||
class="filter-group__item"
|
||||
:class="{ 'filter-group__item--active': statusFilter === opt.value }"
|
||||
@click="handleStatusChange(opt.value)"
|
||||
>
|
||||
<text class="filter-group__item-text">{{ opt.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 列表区 -->
|
||||
<scroll-view class="detail-scroll" scroll-y>
|
||||
<view v-if="recordList.length === 0" class="empty-state">
|
||||
<u-icon name="list" size="86" color="#c0c4cc"></u-icon>
|
||||
<text class="empty-text">{{ loading ? '加载中...' : '暂无盘点任务' }}</text>
|
||||
<text class="empty-hint">{{ keyword ? '请检查关键字后重试' : '请在上方输入关键字查询' }}</text>
|
||||
</view>
|
||||
<view v-else class="record-list">
|
||||
<view
|
||||
v-for="(item, index) in recordList"
|
||||
:key="item.id || index"
|
||||
class="record-card"
|
||||
:class="{ 'record-card--stripe': index % 2 === 1 }"
|
||||
@click="handleRecordClick(item)"
|
||||
>
|
||||
<view class="record-card__row">
|
||||
<text class="record-card__label">盘点单号</text>
|
||||
<text class="record-card__value record-card__value--strong">{{ item.checkNo || '--' }}</text>
|
||||
</view>
|
||||
<view v-if="item.title" class="record-card__row">
|
||||
<text class="record-card__label">标题</text>
|
||||
<text class="record-card__value">{{ item.title }}</text>
|
||||
</view>
|
||||
<view class="record-card__row">
|
||||
<text class="record-card__label">盘点类型</text>
|
||||
<text class="record-card__value">{{ item.typeText || '--' }}</text>
|
||||
</view>
|
||||
<view class="record-card__row">
|
||||
<text class="record-card__label">状态</text>
|
||||
<text class="record-card__value" :class="item.statusClass">{{ item.statusText || '--' }}</text>
|
||||
</view>
|
||||
<view v-if="item.progressText" class="record-card__row">
|
||||
<text class="record-card__label">进度</text>
|
||||
<text class="record-card__value">{{ item.progressText }}</text>
|
||||
</view>
|
||||
<view class="record-card__row">
|
||||
<text class="record-card__label">创建人</text>
|
||||
<text class="record-card__value">{{ item.operator || '--' }}</text>
|
||||
</view>
|
||||
<view class="record-card__row record-card__row--last">
|
||||
<text class="record-card__label">创建时间</text>
|
||||
<text class="record-card__value">{{ item.timeText || '--' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="safe-area-bottom"></view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 分页 -->
|
||||
<view class="pagination-wrap">
|
||||
<pagination
|
||||
:pageNum.sync="currentPage"
|
||||
:pageSize="pageSize"
|
||||
:total="paginationTotal"
|
||||
:showTotal="true"
|
||||
:prevText="'上一页'"
|
||||
:nextText="'下一页'"
|
||||
:showFirstLast="true"
|
||||
:firstText="'首页'"
|
||||
:lastText="'末页'"
|
||||
@change="handlePageChange"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
keyword: '',
|
||||
statusFilter: '',
|
||||
statusOptions: [
|
||||
{ label: '全部', value: '' },
|
||||
{ label: '待盘点', value: 'approved' },
|
||||
{ label: '盘点中', value: 'checking' },
|
||||
{ label: '已完成', value: 'completed' },
|
||||
{ label: '已取消', value: 'cancelled' }
|
||||
],
|
||||
pageSize: 20,
|
||||
currentPage: 1,
|
||||
paginationTotal: 0,
|
||||
recordList: [],
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
onLoad(options = {}) {
|
||||
// 支持通过 ?keyword=xxx 预填关键字并自动查询
|
||||
const preset = String(options.keyword || '').trim();
|
||||
if (preset) {
|
||||
this.keyword = preset;
|
||||
this.$nextTick(() => this.loadRecordList(1));
|
||||
} else {
|
||||
this.loadRecordList(1);
|
||||
}
|
||||
this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
|
||||
this.safeDispatchBroadcast('start');
|
||||
},
|
||||
onShow() {
|
||||
this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
|
||||
this.safeDispatchBroadcast('resume');
|
||||
this.scheduleBroadcastSelfHeal();
|
||||
},
|
||||
onHide() {
|
||||
this.safeDispatchBroadcast('pause');
|
||||
},
|
||||
onUnload() {
|
||||
if (this._broadcastHealTimer) {
|
||||
clearTimeout(this._broadcastHealTimer);
|
||||
this._broadcastHealTimer = null;
|
||||
}
|
||||
this.safeDispatchBroadcast('stop');
|
||||
},
|
||||
methods: {
|
||||
// ===== 广播/扫码基础设施 =====
|
||||
safeDispatchBroadcast(action, payload) {
|
||||
try {
|
||||
const task = this.$store.dispatch(`broadcast/${action}`, payload);
|
||||
if (task && typeof task.catch === 'function') {
|
||||
task.catch(error => console.warn(`[inventoryCount] broadcast/${action} 调用失败:`, error));
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(`[inventoryCount] broadcast/${action} 调用异常:`, error);
|
||||
}
|
||||
},
|
||||
scheduleBroadcastSelfHeal() {
|
||||
if (this._broadcastHealTimer) {
|
||||
clearTimeout(this._broadcastHealTimer);
|
||||
}
|
||||
this._broadcastHealTimer = setTimeout(() => {
|
||||
// 兼容跳转时序竞态:旧页 onHide 的 pause(=stop) 可能晚于本页 onShow 执行,导致广播被误停
|
||||
this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
|
||||
this.safeDispatchBroadcast('start');
|
||||
}, 1200);
|
||||
},
|
||||
normalizeScanResult(scanResult) {
|
||||
if (!scanResult) return '';
|
||||
if (typeof scanResult === 'string') return scanResult.trim();
|
||||
if (typeof scanResult.result === 'string') return scanResult.result.trim();
|
||||
if (Array.isArray(scanResult.result)) {
|
||||
const first = scanResult.result.find(item => item);
|
||||
if (typeof first === 'string') return first.trim();
|
||||
if (first && typeof first.data === 'string') return first.data.trim();
|
||||
}
|
||||
if (typeof scanResult.data === 'string') return scanResult.data.trim();
|
||||
return '';
|
||||
},
|
||||
handleBroadcastResult(result) {
|
||||
const code = this.normalizeScanResult(result);
|
||||
if (!code) return;
|
||||
this.keyword = code;
|
||||
this.loadRecordList(1);
|
||||
},
|
||||
handleCameraScan() {
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
scanType: ['qrCode', 'barCode', 'datamatrix', 'pdf417'],
|
||||
success: (res) => {
|
||||
const code = this.normalizeScanResult(res);
|
||||
if (!code) return;
|
||||
this.keyword = code;
|
||||
this.loadRecordList(1);
|
||||
},
|
||||
fail: () => {}
|
||||
});
|
||||
},
|
||||
// ===== 查询 =====
|
||||
handleSearch() {
|
||||
this.loadRecordList(1);
|
||||
},
|
||||
handleClear() {
|
||||
this.keyword = '';
|
||||
this.loadRecordList(1);
|
||||
},
|
||||
handleStatusChange(value) {
|
||||
if (this.statusFilter === value) return;
|
||||
this.statusFilter = value;
|
||||
this.recordList = [];
|
||||
this.paginationTotal = 0;
|
||||
this.loadRecordList(1);
|
||||
},
|
||||
handlePageChange(page) {
|
||||
const targetPage = Math.max(1, Number(page || 1));
|
||||
if (targetPage === this.currentPage) return;
|
||||
this.currentPage = targetPage;
|
||||
this.loadRecordList(targetPage);
|
||||
},
|
||||
handleRecordClick(item) {
|
||||
if (!item || !item.id) return;
|
||||
this.$tools.routerTo(`/pages/warehouse/inventoryCountDetail?id=${encodeURIComponent(item.id)}`);
|
||||
},
|
||||
buildRecordParams(page = this.currentPage) {
|
||||
const targetPage = Math.max(1, Number(page || 1));
|
||||
const pageSize = Math.max(1, Number(this.pageSize || 20));
|
||||
const params = {
|
||||
pagination: {
|
||||
page: targetPage,
|
||||
pageSize
|
||||
}
|
||||
};
|
||||
const where = {};
|
||||
const keyword = String(this.keyword || '').trim();
|
||||
if (keyword) {
|
||||
where.keyword = keyword;
|
||||
}
|
||||
if (this.statusFilter) {
|
||||
where.status = this.statusFilter;
|
||||
}
|
||||
if (Object.keys(where).length) {
|
||||
params.where = where;
|
||||
}
|
||||
return params;
|
||||
},
|
||||
extractRecordPayload(response) {
|
||||
const candidates = [
|
||||
response?.data?.data,
|
||||
response?.data,
|
||||
response?.result,
|
||||
response
|
||||
];
|
||||
for (let i = 0; i < candidates.length; i += 1) {
|
||||
const current = candidates[i];
|
||||
if (current && typeof current === 'object' && !Array.isArray(current)) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
},
|
||||
extractRecordList(payload, response) {
|
||||
const candidates = [
|
||||
payload?.list,
|
||||
payload?.rows,
|
||||
payload?.items,
|
||||
payload?.records,
|
||||
payload?.data?.list,
|
||||
response?.data?.list,
|
||||
response?.data?.data?.list,
|
||||
response?.list
|
||||
];
|
||||
for (let i = 0; i < candidates.length; i += 1) {
|
||||
if (Array.isArray(candidates[i])) return candidates[i];
|
||||
}
|
||||
return [];
|
||||
},
|
||||
resolveRecordTotal(payload, response, list) {
|
||||
const pagination = (payload && typeof payload === 'object') ? (payload.pagination || {}) : {};
|
||||
const candidates = [
|
||||
pagination?.total,
|
||||
pagination?.count,
|
||||
payload?.pagination?.total,
|
||||
payload?.total,
|
||||
payload?.count,
|
||||
payload?.totalCount,
|
||||
response?.data?.pagination?.total,
|
||||
response?.data?.total,
|
||||
response?.total,
|
||||
Array.isArray(list) ? list.length : 0
|
||||
];
|
||||
for (let i = 0; i < candidates.length; i += 1) {
|
||||
const value = Number(candidates[i]);
|
||||
if (Number.isFinite(value) && value >= 0) return value;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
firstValue(source, keys) {
|
||||
for (let i = 0; i < keys.length; i += 1) {
|
||||
const value = source[keys[i]];
|
||||
if (value !== null && value !== undefined && String(value).trim() !== '') {
|
||||
return String(value).trim();
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
formatDateTime(value) {
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
const date = new Date(String(value).trim());
|
||||
if (Number.isNaN(date.getTime())) return String(value).trim();
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hour = String(date.getHours()).padStart(2, '0');
|
||||
const minute = String(date.getMinutes()).padStart(2, '0');
|
||||
const second = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
|
||||
},
|
||||
statusText(status) {
|
||||
const map = {
|
||||
created: '待提交',
|
||||
submitted: '待审核',
|
||||
rejected: '已驳回',
|
||||
approved: '待盘点',
|
||||
checking: '盘点中',
|
||||
completed: '已完成',
|
||||
cancelled: '已取消'
|
||||
};
|
||||
const key = String(status || '').trim().toLowerCase();
|
||||
return map[key] || (status ? String(status) : '--');
|
||||
},
|
||||
statusClass(status) {
|
||||
const key = String(status || '').trim().toLowerCase();
|
||||
if (key === 'completed') {
|
||||
return 'record-card__value--success';
|
||||
}
|
||||
if (key === 'checking') {
|
||||
return 'record-card__value--warning';
|
||||
}
|
||||
if (key === 'rejected') {
|
||||
return 'record-card__value--danger';
|
||||
}
|
||||
if (key === 'cancelled') {
|
||||
return 'record-card__value--muted';
|
||||
}
|
||||
if (key === 'approved') {
|
||||
return 'record-card__value--strong';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
typeText(type) {
|
||||
const map = {
|
||||
all: '全盘',
|
||||
full: '全盘',
|
||||
open: '明盘',
|
||||
store: '按货主',
|
||||
part: '抽盘',
|
||||
partial: '抽盘',
|
||||
dynamic: '动销盘',
|
||||
cycle: '循环盘'
|
||||
};
|
||||
const key = String(type || '').trim().toLowerCase();
|
||||
return map[key] || (type ? String(type) : '--');
|
||||
},
|
||||
modeText(mode) {
|
||||
const map = {
|
||||
all: '全盘',
|
||||
full: '全盘',
|
||||
open: '明盘',
|
||||
store: '按货主',
|
||||
by_store: '按货主',
|
||||
owner: '按货主',
|
||||
by_owner: '按货主',
|
||||
space: '按库位',
|
||||
by_space: '按库位',
|
||||
location: '按库位',
|
||||
item: '按商品',
|
||||
by_item: '按商品',
|
||||
product: '按商品'
|
||||
};
|
||||
const key = String(mode || '').trim().toLowerCase();
|
||||
return map[key] || (mode ? String(mode) : '');
|
||||
},
|
||||
composeType(type, mode) {
|
||||
const t = this.typeText(type);
|
||||
const m = this.modeText(mode);
|
||||
if (t === '--') return m || '--';
|
||||
return m ? `${t},${m}` : t;
|
||||
},
|
||||
normalizeRecordList(list) {
|
||||
if (!Array.isArray(list)) return [];
|
||||
return list
|
||||
.map((item, index) => {
|
||||
const source = item && typeof item === 'object' ? item : {};
|
||||
const checkNo = this.firstValue(source, [
|
||||
'check_no', 'checkNo', 'bill_no', 'billNo', 'code', 'no'
|
||||
]);
|
||||
const title = this.firstValue(source, ['title', 'name']);
|
||||
const typeValue = this.firstValue(source, ['check_type', 'checkType', 'type']);
|
||||
const modeValue = this.firstValue(source, ['mode', 'check_mode', 'checkMode']);
|
||||
const operator = this.firstValue(source, [
|
||||
'creator_name', 'creatorName', 'operator_name', 'operatorName',
|
||||
'create_user', 'createUser', 'creator', 'created_by', 'createdBy'
|
||||
]);
|
||||
const timeValue = this.firstValue(source, [
|
||||
'created_at', 'createdAt', 'create_time', 'createTime'
|
||||
]);
|
||||
const status = this.firstValue(source, ['status', 'check_status', 'checkStatus', 'state']);
|
||||
const totalItems = this.firstValue(source, ['total_items', 'totalItems']);
|
||||
const checkedItems = this.firstValue(source, ['checked_items', 'checkedItems']);
|
||||
let progressText = '';
|
||||
if (totalItems !== '') {
|
||||
progressText = checkedItems !== '' ? `${checkedItems}/${totalItems}` : `0/${totalItems}`;
|
||||
}
|
||||
const id = this.firstValue(source, ['id', 'check_id', 'checkId', 'task_id', 'taskId'])
|
||||
|| `${this.currentPage}-${index + 1}`;
|
||||
return {
|
||||
id,
|
||||
checkNo,
|
||||
title,
|
||||
typeText: this.composeType(typeValue, modeValue),
|
||||
operator,
|
||||
progressText,
|
||||
status,
|
||||
statusText: this.statusText(status),
|
||||
statusClass: this.statusClass(status),
|
||||
timeText: this.formatDateTime(timeValue)
|
||||
};
|
||||
})
|
||||
.filter(item => !!(item.checkNo || item.title || item.operator));
|
||||
},
|
||||
async loadRecordList(page = this.currentPage) {
|
||||
const targetPage = Math.max(1, Number(page || 1));
|
||||
this.loading = true;
|
||||
try {
|
||||
const response = await this.$http('check.list', this.buildRecordParams(targetPage));
|
||||
const payload = this.extractRecordPayload(response);
|
||||
const list = this.extractRecordList(payload, response);
|
||||
this.recordList = this.normalizeRecordList(list);
|
||||
this.paginationTotal = this.resolveRecordTotal(payload, response, list);
|
||||
const pageInfo = (payload && typeof payload === 'object') ? (payload.pagination || {}) : {};
|
||||
const pageNo = Number(pageInfo?.page ?? payload?.page ?? targetPage);
|
||||
this.currentPage = Number.isFinite(pageNo) && pageNo > 0 ? pageNo : targetPage;
|
||||
const pageSize = Number(pageInfo?.pageSize ?? pageInfo?.page_size ?? this.pageSize);
|
||||
this.pageSize = Number.isFinite(pageSize) && pageSize > 0 ? pageSize : this.pageSize;
|
||||
} catch (error) {
|
||||
console.error('[inventoryCount] 盘点任务加载失败:', error);
|
||||
this.recordList = [];
|
||||
this.paginationTotal = 0;
|
||||
uni.showToast({ title: '盘点任务加载失败', icon: 'none' });
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.inventory-count-page {
|
||||
height: 100vh;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
.normar_container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 搜索区 */
|
||||
.search-panel {
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #f2f2f2;
|
||||
padding: 16rpx;
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.search-input-wrap {
|
||||
position: relative;
|
||||
|
||||
::v-deep .u-search {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::v-deep .u-search__content {
|
||||
padding-right: 200rpx;
|
||||
}
|
||||
|
||||
::v-deep .u-search__content__close {
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.search-actions {
|
||||
position: absolute;
|
||||
right: 24rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
height: 68rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.scan-btn {
|
||||
height: 68rpx;
|
||||
padding: 0 8rpx 0 4rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&:active {
|
||||
opacity: 0.88;
|
||||
}
|
||||
}
|
||||
|
||||
.search-divider {
|
||||
width: 1rpx;
|
||||
height: 28rpx;
|
||||
background: #dcdfe6;
|
||||
margin: 0 16rpx 0 10rpx;
|
||||
}
|
||||
|
||||
.search-btn {
|
||||
height: 68rpx;
|
||||
padding: 0 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
|
||||
&__text {
|
||||
font-size: 34rpx;
|
||||
font-weight: 500;
|
||||
color: #2979ff;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.88;
|
||||
}
|
||||
}
|
||||
|
||||
/* 状态筛选行(横向滚动) */
|
||||
.filter-row {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.filter-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.filter-group {
|
||||
display: inline-flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.filter-group__item {
|
||||
flex: none;
|
||||
height: 56rpx;
|
||||
padding: 0 24rpx;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f5f7fa;
|
||||
border: 1rpx solid #ebeef5;
|
||||
border-radius: 28rpx;
|
||||
}
|
||||
|
||||
.filter-group__item + .filter-group__item {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.filter-group__item--active {
|
||||
background: #2979ff;
|
||||
border-color: #2979ff;
|
||||
box-shadow: 0 4rpx 12rpx rgba(41, 121, 255, 0.28);
|
||||
}
|
||||
|
||||
.filter-group__item-text {
|
||||
font-size: 30rpx;
|
||||
color: #303133;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.filter-group__item--active .filter-group__item-text {
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 列表区 */
|
||||
.detail-scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto;
|
||||
padding: 20rpx 0 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 160rpx 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
margin-top: 24rpx;
|
||||
font-size: 36rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.empty-hint {
|
||||
margin-top: 12rpx;
|
||||
font-size: 30rpx;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
.record-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 12rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.record-card {
|
||||
background: #ffffff;
|
||||
border: 2rpx solid #ebedf2;
|
||||
border-radius: 20rpx;
|
||||
padding: 4rpx 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 6rpx 20rpx rgba(31, 45, 61, 0.06);
|
||||
}
|
||||
|
||||
.record-card--stripe {
|
||||
background: #dde9fb;
|
||||
border-color: #dfe7f5;
|
||||
}
|
||||
|
||||
.record-card--stripe .record-card__label {
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.record-card__row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #f0f2f5;
|
||||
}
|
||||
|
||||
.record-card__row--last {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.record-card__label {
|
||||
flex-shrink: 0;
|
||||
width: 160rpx;
|
||||
font-size: 36rpx;
|
||||
color: #8a9099;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.record-card__value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 40rpx;
|
||||
color: #303133;
|
||||
line-height: 1.5;
|
||||
word-break: break-all;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.record-card__value--strong {
|
||||
font-weight: 600;
|
||||
color: #2979ff;
|
||||
}
|
||||
|
||||
.record-card__value--success {
|
||||
font-weight: 600;
|
||||
color: #18a058;
|
||||
}
|
||||
|
||||
.record-card__value--warning {
|
||||
font-weight: 600;
|
||||
color: #ff9800;
|
||||
}
|
||||
|
||||
.record-card__value--danger {
|
||||
font-weight: 600;
|
||||
color: #e64340;
|
||||
}
|
||||
|
||||
.record-card__value--muted {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
.safe-area-bottom {
|
||||
height: calc(20rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
/* 分页 */
|
||||
.pagination-wrap {
|
||||
flex-shrink: 0;
|
||||
padding: 12rpx 12rpx 0;
|
||||
background: #ffffff;
|
||||
border-top: 1rpx solid #f2f2f2;
|
||||
}
|
||||
</style>
|
||||
1053
pages/warehouse/inventoryCountDetail.vue
Normal file
1053
pages/warehouse/inventoryCountDetail.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -1688,6 +1688,15 @@
|
||||
return '--';
|
||||
}
|
||||
|
||||
// 库存 = 可用数量 + 锁定数量
|
||||
const locked = this.getStorageLockedQuantity(item);
|
||||
const available = this.getStorageAvailableQuantity(item, locked);
|
||||
|
||||
if (available !== null || locked !== null) {
|
||||
return (available === null ? 0 : available) + (locked === null ? 0 : locked);
|
||||
}
|
||||
|
||||
// 都拿不到时退回原始库存字段
|
||||
return this.getValueOrDash(
|
||||
item.quantity
|
||||
?? item.actual_quantity
|
||||
@ -1696,6 +1705,57 @@
|
||||
?? item.qty
|
||||
);
|
||||
},
|
||||
getStorageLockedQuantity(item) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.toNumberOrNull(
|
||||
item.locked_quantity
|
||||
?? item.lock_quantity
|
||||
?? item.frozen_quantity
|
||||
?? item.freeze_quantity
|
||||
);
|
||||
},
|
||||
getStorageAvailableQuantity(item, locked = null) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const available = this.toNumberOrNull(
|
||||
item.available_quantity
|
||||
?? item.movable_quantity
|
||||
?? item.moveable_quantity
|
||||
?? item.can_move_quantity
|
||||
?? item.free_quantity
|
||||
?? item.usable_quantity
|
||||
);
|
||||
if (available !== null) {
|
||||
return available;
|
||||
}
|
||||
|
||||
// 没有可用数量字段时,用 库存 - 锁定 反推可用数量
|
||||
const quantity = this.toNumberOrNull(
|
||||
item.quantity
|
||||
?? item.actual_quantity
|
||||
?? item.stock
|
||||
?? item.total_quantity
|
||||
?? item.qty
|
||||
);
|
||||
if (quantity !== null && locked !== null) {
|
||||
return quantity - locked;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
toNumberOrNull(value) {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const num = Number(value);
|
||||
return Number.isNaN(num) ? null : num;
|
||||
},
|
||||
getStorageAvailableText(item) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return '--';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user