feat(inventory-count): 盘点模块 UI 优化与已盘/差异口径修正

- 已盘判定改为「状态=checked 或有作业记录 或实盘>0」,实盘=0 视为未盘
- 差异统一按「实盘-账面」计算,不信任后端 diff_quantity;未盘项不显示差异
- 新增 isCheckedLocation,库位明细与已盘库位数只统计真正已盘的库位,过滤任务占位项
- 商品副标题条形码提前到规格之前
- 空库位登记弹窗键盘适配:弹窗自身随键盘上移,不整页上推;聚焦延时与 @open 再聚焦
- 全模块字号加大、层级重排:任务卡片/宫格/库位明细/商品卡/汇总面板
- 库位明细负边距斑马纹铺满整行;任务卡片移除 stripe
- 状态筛选由横向滚动改为等宽分布铺满整行
- 库位宫格 space 视图重排:商品数与状态同行、已盘进度独占一行
- 汇总面板货主字段上移,最近上报靠右,实盘数量黑色
- 收货页样式微调
This commit is contained in:
zm2000 2026-10-09 18:22:39 +08:00
parent 48e2438416
commit 2119e9dfc9
16 changed files with 909 additions and 263 deletions

View File

@ -2,14 +2,7 @@
<u-popup :show="show" mode="bottom" :closeable="true" border-radius="20" @close="$emit('close')">
<view class="actions-popup">
<view class="actions-popup-title">{{ title }}</view>
<view class="actions-popup-body">
<view
v-if="canMarkEmpty"
class="actions-popup-btn actions-popup-btn--cancel"
@click="$emit('mark-empty')"
>
<text class="actions-popup-btn__text actions-popup-btn__text--cancel">{{ submitting ? '处理中...' : '标记空库位' }}</text>
</view>
<view v-if="canCancel || canSubmit" class="actions-popup-body">
<view
v-if="canCancel"
class="actions-popup-btn actions-popup-btn--cancel"
@ -24,16 +17,25 @@
>
<text class="actions-popup-btn__text actions-popup-btn__text--submit">{{ submitting ? '提交中...' : '提交审核' }}</text>
</view>
<view
v-if="canFinish"
class="actions-popup-btn actions-popup-btn--complete"
@click="$emit('finish')"
>
<text class="actions-popup-btn__text actions-popup-btn__text--complete">{{ submitting ? '提交中...' : '完成盘点' }}</text>
</view>
</view>
<view class="actions-popup-footer">
<view class="actions-popup-close-btn" @click="$emit('close')">关闭</view>
<view
v-if="canMarkEmpty"
class="actions-popup-apply-btn actions-popup-apply-btn--mark-empty"
:class="{ 'actions-popup-apply-btn--disabled': submitting }"
@click="$emit('mark-empty')"
>
<text class="actions-popup-apply-btn__text actions-popup-apply-btn__text--mark-empty">{{ submitting ? '处理中...' : '标记空库位' }}</text>
</view>
<view
v-else-if="canFinish"
class="actions-popup-apply-btn"
:class="{ 'actions-popup-apply-btn--disabled': submitting }"
@click="$emit('finish')"
>
<text class="actions-popup-apply-btn__text">{{ submitting ? '提交中...' : '完成盘点' }}</text>
</view>
</view>
</view>
</u-popup>
@ -124,11 +126,6 @@ export default {
border: 2rpx solid #cfe1ff;
}
.actions-popup-btn--complete {
background: #2979ff;
border: 2rpx solid #2979ff;
}
.actions-popup-btn__text {
font-size: 34rpx;
font-weight: 500;
@ -143,21 +140,64 @@ export default {
color: #2979ff;
}
.actions-popup-btn__text--complete {
color: #ffffff;
}
.actions-popup-footer {
display: flex;
justify-content: center;
align-items: center;
}
.actions-popup-close-btn {
padding: 16rpx 48rpx;
flex: 1;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
color: #909399;
border: 1rpx solid #dcdfe6;
border-radius: 10rpx;
border: 2rpx solid #dcdfe6;
border-radius: 16rpx;
background: #f5f5f5;
&:active {
opacity: 0.88;
}
}
.actions-popup-apply-btn {
flex: 1;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 34rpx;
color: #ffffff;
background: #2979ff;
border: 2rpx solid #2979ff;
border-radius: 16rpx;
/* 老真机不依赖 flex gap,用相邻兄弟 margin 留间隔 */
margin-left: 20rpx;
&:active {
opacity: 0.9;
}
&--disabled {
opacity: 0.6;
pointer-events: none;
}
}
.actions-popup-apply-btn__text {
font-weight: 500;
line-height: 1;
}
/* 标记空库位:保留原来的浅红警示底色 */
.actions-popup-apply-btn--mark-empty {
background: #fff1f0;
border-color: #ffccc7;
}
.actions-popup-apply-btn__text--mark-empty {
color: #f56c6c;
}
</style>

View File

@ -126,7 +126,7 @@ export default {
.goods-card__title {
flex: 1;
min-width: 0;
font-size: 32rpx;
font-size: 38rpx;
font-weight: 600;
color: #303133;
line-height: 1.3;
@ -138,7 +138,7 @@ export default {
.goods-card__flag {
flex-shrink: 0;
margin-left: 16rpx;
font-size: 26rpx;
font-size: 36rpx;
line-height: 1.2;
}
@ -152,11 +152,10 @@ export default {
.goods-card__subtitle {
margin-top: 6rpx;
font-size: 24rpx;
color: #8a9099;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 34rpx;
color: #606266;
line-height: 1.4;
word-break: break-all;
}
.goods-card__metrics {
@ -168,12 +167,13 @@ export default {
.goods-card__metric {
margin-right: 20rpx;
font-size: 24rpx;
color: #606266;
font-size: 34rpx;
color: #303133;
}
.goods-card__diff {
font-size: 24rpx;
margin-right: 20rpx;
font-size: 34rpx;
font-weight: 600;
}

View File

@ -21,7 +21,7 @@
</view>
</view>
</view>
<scroll-view class="filter-scroll" scroll-x :show-scrollbar="false">
<view class="filter-row">
<view class="filter-group">
<view
v-for="opt in statusOptions"
@ -33,7 +33,7 @@
<text class="filter-group__item-text">{{ opt.label }}</text>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
@ -140,23 +140,23 @@ export default {
}
}
/* 状态筛选行(横向滚动) */
.filter-scroll {
width: 100%;
white-space: nowrap;
}
.filter-group {
display: inline-flex;
flex-wrap: nowrap;
/* 状态筛选行(等宽分布,铺满整行) */
.filter-row {
margin-top: 16rpx;
display: flex;
align-items: center;
}
.filter-group {
flex: 1;
display: flex;
}
.filter-group__item {
flex: none;
flex: 1;
height: 56rpx;
padding: 0 24rpx;
display: inline-flex;
padding: 0 12rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f5f7fa;

View File

@ -1,6 +1,6 @@
<template>
<view v-if="row" class="loc-detail">
<view class="loc-detail__head">
<view v-if="row.title || row.subtitle || row.empty || row.statusText" class="loc-detail__head">
<view class="loc-detail__title-wrap">
<text class="loc-detail__title">{{ row.title || '--' }}</text>
<text v-if="row.subtitle" class="loc-detail__subtitle">{{ row.subtitle }}</text>
@ -12,7 +12,12 @@
</view>
<view v-if="row.meta && row.meta.length" class="loc-detail__meta">
<text v-for="item in row.meta" :key="item.label" class="loc-detail__meta-item">{{ item.label }}:{{ item.value }}</text>
<text
v-for="item in row.meta"
:key="item.label"
class="loc-detail__meta-item"
:class="{ 'loc-detail__meta-item--right': item.label === '最近上报' }"
>{{ item.label }}:{{ item.value }}</text>
</view>
<view class="loc-detail__section">
@ -28,14 +33,14 @@
<view v-else class="loc-detail__list">
<u-swipe-action :key="listKey">
<u-swipe-action-item
v-for="child in row.children"
v-for="(child, childIndex) in row.children"
:key="child.key"
:name="child.key"
:options="swipeOptions"
:disabled="!canDelete(child)"
@click="handleSwipeClick(child)"
>
<view class="loc-detail__row">
<view class="loc-detail__row" :class="{ 'loc-detail__row--zebra': childIndex % 2 === 1 }">
<view
v-if="child.images && child.images.length"
class="loc-detail__row-thumb"
@ -67,7 +72,7 @@
class="loc-detail__row-amount"
:class="{ 'loc-detail__row-amount--stock': child.amounts.hasSystemStock }"
>账面 {{ child.amounts.systemText }}</text>
<text class="loc-detail__row-amount">实盘 {{ child.amounts.checkedText }}</text>
<text class="loc-detail__row-amount loc-detail__row-amount--checked">实盘 {{ child.amounts.checkedText }}</text>
<text v-if="child.amounts.diffText" class="loc-detail__row-diff" :class="diffClass(child.amounts)">
{{ child.amounts.diffText }}
</text>
@ -250,6 +255,12 @@ export default {
color: #909399;
}
/* 最近上报靠右 */
.loc-detail__meta-item--right {
margin-left: auto;
margin-right: 0;
}
.loc-detail__section {
margin-top: 16rpx;
border-top: 1rpx solid #f0f2f5;
@ -262,14 +273,14 @@ export default {
}
.loc-detail__section-title {
font-size: 30rpx;
font-size: 34rpx;
font-weight: 600;
color: #303133;
}
.loc-detail__section-count {
margin-left: 12rpx;
font-size: 26rpx;
margin-left: auto;
font-size: 30rpx;
color: #909399;
}
@ -290,23 +301,19 @@ export default {
}
.loc-detail__empty-text {
font-size: 30rpx;
font-size: 34rpx;
color: #c0c4cc;
}
.loc-detail__list {
margin-top: 4rpx;
/* 左滑时内容向左滑出、被容器裁剪到卡片左内边距边缘(看起来贴死左边):
给滑动容器留一点左间距。
注意必须加在 .u-swipe-action-item 上——__right 是 absolute; right:0,
对它写 margin-left 不会生效(只有非绝对定位的 __content 会跟着一起位移)。 */
::v-deep .u-swipe-action-item {
margin-left: 12rpx;
}
/* 负外边距抵消卡片 28rpx 左右内边距,让斑马纹左右铺满整行 */
margin-left: -28rpx;
margin-right: -28rpx;
}
.loc-detail__row {
padding: 16rpx 0;
padding: 24rpx 28rpx;
background: #ffffff;
border-bottom: 1rpx solid #f5f6f8;
display: flex;
@ -318,6 +325,11 @@ export default {
}
}
/* 斑马纹:白底 + 浅蓝底交替(参考商品查询库存斑马纹) */
.loc-detail__row--zebra {
background: #dde9fb;
}
/* 记录照片缩略图(有图才渲染) */
.loc-detail__row-thumb {
position: relative;
@ -369,7 +381,7 @@ export default {
}
.loc-detail__row-title {
font-size: 32rpx;
font-size: 36rpx;
color: #303133;
line-height: 1.4;
word-break: break-all;
@ -377,7 +389,7 @@ export default {
.loc-detail__row-sub {
margin-top: 4rpx;
font-size: 26rpx;
font-size: 30rpx;
color: #909399;
word-break: break-all;
}
@ -392,8 +404,13 @@ export default {
.loc-detail__row-amount {
margin-right: 20rpx;
font-size: 26rpx;
color: #909399;
font-size: 36rpx;
color: #606266;
}
/* 实盘数量:黑色 */
.loc-detail__row-amount--checked {
color: #303133;
}
/* 该库位账面有货:加粗深色,方便一眼找到账面库位 */
@ -403,7 +420,7 @@ export default {
}
.loc-detail__row-diff {
font-size: 26rpx;
font-size: 36rpx;
font-weight: 600;
}
@ -430,7 +447,7 @@ export default {
.loc-detail__row-tag {
padding: 6rpx 14rpx;
border-radius: 8rpx;
font-size: 24rpx;
font-size: 28rpx;
line-height: 1;
color: #909399;
background: #f5f7fa;
@ -438,7 +455,7 @@ export default {
.loc-detail__row-qty {
margin-top: 6rpx;
font-size: 28rpx;
color: #000000;
font-size: 38rpx;
color: #2979ff;
}
</style>

View File

@ -14,13 +14,13 @@
>
<view class="loc-grid__inner" :class="cellClass(row)">
<template v-if="isSpace">
<!-- space:库位独占一行 + 状态独占一行 + 商品数与已盘未盘同一行 -->
<!-- space:库位独占一行 + 商品数与状态同一行(商品数居左、状态/未盘居右) + 已盘未盘进度居左 -->
<text class="loc-grid__code loc-grid__code--stack">{{ row.gridText || row.title || '--' }}</text>
<text class="loc-grid__flag loc-grid__flag--stack" :class="flagClass(row)">{{ flagText(row) }}</text>
<view class="loc-grid__foot">
<view class="loc-grid__status">
<text class="loc-grid__sub">{{ row.gridCountText }}</text>
<text class="loc-grid__count">{{ countText(row) }}</text>
<text class="loc-grid__flag" :class="flagClass(row)">{{ flagText(row) }}</text>
</view>
<text class="loc-grid__progress">{{ countText(row) }}</text>
</template>
<template v-else>
<view class="loc-grid__main">
@ -41,7 +41,7 @@
/**
* 库位宫格列表(2 列,每页 20 个 → 2 列 10 行,随页面滚动)
* mode=location:行=任务库位,点击格子进入库位明细页;格子单行(左库位名 / 右状态+数量)
* mode=space:行=库位(商品任务按库位聚合),三行:库位名 / 状态 / 商品数+已盘未盘
* mode=space:行=库位(商品任务按库位聚合),三行:库位名 / 商品数+状态 / 已盘未盘进度
* 行数据来自 countModel.normalizeWorkRows(rows, view, mode)
* 格子显示完整库位名(缺失时回退库位编码)
*/
@ -156,7 +156,7 @@ export default {
}
.loc-grid__inner--done {
background: #e8f7ee;
background: #c8eed7;
border-color: #b7e4c7;
}
@ -177,21 +177,21 @@ export default {
white-space: nowrap;
}
/* 状态独占一行 */
.loc-grid__flag--stack {
margin-top: 6rpx;
}
/* 商品项 + 已盘未盘同一行 */
.loc-grid__foot {
/* 商品数 + 状态同一行(商品数居左、状态/未盘居右) */
.loc-grid__status {
margin-top: 6rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.loc-grid__foot .loc-grid__count {
margin-top: 0;
/* 已盘/未盘进度独占一行(居左) */
.loc-grid__progress {
margin-top: 6rpx;
font-size: 28rpx;
line-height: 1;
text-align: left;
color: #606266;
}
.loc-grid__main {
@ -217,7 +217,7 @@ export default {
}
.loc-grid__code {
font-size: 30rpx;
font-size: 36rpx;
font-weight: 600;
color: #303133;
line-height: 1.2;
@ -225,14 +225,13 @@ export default {
}
.loc-grid__sub {
margin-top: 6rpx;
font-size: 22rpx;
font-size: 28rpx;
line-height: 1.1;
color: #909399;
color: #606266;
}
.loc-grid__flag {
font-size: 26rpx;
font-size: 34rpx;
line-height: 1;
color: #909399;
}
@ -247,7 +246,7 @@ export default {
.loc-grid__count {
margin-top: 4rpx;
font-size: 20rpx;
font-size: 28rpx;
line-height: 1;
color: #909399;
}

View File

@ -1,7 +1,6 @@
<template>
<view
class="record-card"
:class="{ 'record-card--stripe': stripe }"
@click="$emit('click', item)"
>
<!-- 第一行:标题 -->
@ -41,10 +40,6 @@ export default {
item: {
type: Object,
default: () => ({})
},
stripe: {
type: Boolean,
default: false
}
}
};
@ -60,11 +55,6 @@ export default {
box-shadow: 0 6rpx 20rpx rgba(31, 45, 61, 0.06);
}
.record-card--stripe {
background: #dde9fb;
border-color: #dfe7f5;
}
/* 第一行:标题 */
.record-card__title-row {
display: flex;
@ -74,15 +64,12 @@ export default {
.record-card__title {
flex: 1;
min-width: 0;
/* 原 38rpx 的 80%,缩小后仍能装下更多字数 */
font-size: 30rpx;
font-size: 36rpx;
font-weight: 600;
color: #303133;
line-height: 1.4;
/* 超长直接省略号 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
/* 超长自动换行显示多行 */
word-break: break-all;
}
/* 第二行:单号 + 盘点类型 */
@ -96,8 +83,8 @@ export default {
.record-card__no {
flex: 1;
min-width: 0;
font-size: 30rpx;
color: #8a9099;
font-size: 34rpx;
color: #606266;
line-height: 1.4;
letter-spacing: 0.5rpx;
word-break: break-all;
@ -165,13 +152,13 @@ export default {
}
.record-card__progress {
font-size: 32rpx;
font-size: 36rpx;
color: #606266;
line-height: 1.6;
}
.record-card__status {
font-size: 32rpx;
font-size: 36rpx;
font-weight: 600;
color: #2979ff;
line-height: 1.6;

View File

@ -1,5 +1,5 @@
<template>
<u-popup :show="show" mode="bottom" round="20" :closeable="true" :safeAreaInsetBottom="true" @close="handleClose">
<u-popup :show="show" mode="bottom" round="20" :closeable="true" :safeAreaInsetBottom="true" :customStyle="popupKeyboardStyle" @open="handleOpen" @close="handleClose">
<view class="space-entry">
<view class="space-entry__header">
<text class="space-entry__title">登记实盘数量</text>
@ -50,6 +50,7 @@
placeholder="请输入数量"
placeholder-style="color: #c0c4cc;"
:focus="quantityFocus"
:adjust-position="false"
confirm-type="done"
@confirm="handleConfirm"
/>
@ -102,7 +103,8 @@ export default {
quantity: '',
loading: false,
searched: false,
quantityFocus: false
quantityFocus: false,
keyboardHeight: 0
};
},
computed: {
@ -114,6 +116,10 @@ export default {
},
canConfirm() {
return !!this.selectedKey && String(this.quantity).trim() !== '';
},
// 键盘弹出时只上移弹窗自身,不推整页(paddingBottom 会与 max-height 冲突导致底部溢出)
popupKeyboardStyle() {
return this.keyboardHeight ? { transform: `translateY(-${this.keyboardHeight}px)` } : {};
}
},
watch: {
@ -124,7 +130,49 @@ export default {
}
}
},
created() {
this.initKeyboardHeightListener();
},
beforeDestroy() {
this.destroyKeyboardHeightListener();
},
methods: {
initKeyboardHeightListener() {
// H5 端:监听 visualViewport 高度变化,差值即键盘高度(仅垫高弹窗,不整页上推)
// #ifdef H5
if (typeof window !== 'undefined' && window.visualViewport) {
this._baseViewportHeight = window.visualViewport.height;
this._onViewportResize = () => {
const vh = window.visualViewport ? window.visualViewport.height : window.innerHeight;
const diff = this._baseViewportHeight - vh;
this.keyboardHeight = diff > 0 ? Math.round(diff) : 0;
};
window.visualViewport.addEventListener('resize', this._onViewportResize);
}
// #endif
// #ifndef H5
this._keyboardHeightCb = (res) => {
this.keyboardHeight = (res && res.height) || 0;
};
if (typeof uni.onKeyboardHeightChange === 'function') {
uni.onKeyboardHeightChange(this._keyboardHeightCb);
}
// #endif
},
destroyKeyboardHeightListener() {
// #ifdef H5
if (typeof window !== 'undefined' && window.visualViewport && this._onViewportResize) {
window.visualViewport.removeEventListener('resize', this._onViewportResize);
this._onViewportResize = null;
}
// #endif
// #ifndef H5
if (this._keyboardHeightCb && typeof uni.offKeyboardHeightChange === 'function') {
uni.offKeyboardHeightChange(this._keyboardHeightCb);
this._keyboardHeightCb = null;
}
// #endif
},
handleClose() {
this.$emit('close');
},
@ -181,9 +229,18 @@ export default {
focusQuantity() {
this.quantityFocus = false;
this.$nextTick(() => {
this.quantityFocus = true;
// 延时确保输入框渲染完成、弹窗动画结束,软键盘能稳定弹出
setTimeout(() => {
this.quantityFocus = true;
}, 100);
});
},
/** 弹窗上滑动画结束后:扫码自动选中库位时,再自动聚焦一次保证软键盘弹出 */
handleOpen() {
if (this.selectedKey) {
this.focusQuantity();
}
},
handleConfirm() {
if (this.submitting) return;
if (!this.selectedKey) {
@ -218,19 +275,24 @@ export default {
}
.space-entry__header {
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 60rpx;
}
.space-entry__title {
font-size: 36rpx;
flex-shrink: 0;
font-size: 38rpx;
font-weight: 600;
color: #303133;
}
.space-entry__subtitle {
margin-top: 8rpx;
font-size: 26rpx;
margin-left: 20rpx;
font-size: 32rpx;
color: #909399;
text-align: right;
}
.space-entry__search {
@ -276,7 +338,7 @@ export default {
}
.space-item__title {
font-size: 32rpx;
font-size: 40rpx;
color: #303133;
line-height: 1.4;
word-break: break-all;
@ -314,7 +376,7 @@ export default {
.space-entry__label {
flex-shrink: 0;
margin-right: 20rpx;
font-size: 30rpx;
font-size: 40rpx;
color: #606266;
}
@ -324,7 +386,7 @@ export default {
height: 76rpx;
padding: 0 24rpx;
box-sizing: border-box;
font-size: 32rpx;
font-size: 42rpx;
color: #303133;
background: #f5f5f5;
border-radius: 12rpx;
@ -348,7 +410,7 @@ export default {
}
.space-entry__btn-text {
font-size: 32rpx;
font-size: 36rpx;
color: #ffffff;
}
</style>

View File

@ -10,6 +10,10 @@
<text class="summary-panel__label">标题</text>
<text class="summary-panel__value">{{ info.title || '--' }}</text>
</view>
<view class="summary-panel__row">
<text class="summary-panel__label">货主</text>
<text class="summary-panel__value">{{ storeText }}</text>
</view>
<view class="summary-panel__row">
<text class="summary-panel__label">盘点类型</text>
<text class="summary-panel__value">{{ info.typeText || '--' }}</text>
@ -22,10 +26,6 @@
<text class="summary-panel__label">状态</text>
<text class="summary-panel__value" :class="info.statusClass">{{ info.statusText || '--' }}</text>
</view>
<view class="summary-panel__row">
<text class="summary-panel__label">货主</text>
<text class="summary-panel__value">{{ storeText }}</text>
</view>
<view class="summary-panel__row">
<text class="summary-panel__label">创建人</text>
<text class="summary-panel__value">{{ info.creatorName || '--' }}</text>
@ -112,7 +112,7 @@ export default {
.summary-panel__group {
margin: 24rpx 0 6rpx;
font-size: 26rpx;
font-size: 30rpx;
font-weight: 600;
color: #2979ff;
@ -134,7 +134,7 @@ export default {
.summary-panel__label {
flex-shrink: 0;
width: 160rpx;
font-size: 32rpx;
font-size: 36rpx;
color: #8a9099;
line-height: 1.5;
}
@ -142,7 +142,7 @@ export default {
.summary-panel__value {
flex: 1;
min-width: 0;
font-size: 34rpx;
font-size: 38rpx;
color: #303133;
line-height: 1.5;
word-break: break-all;

View File

@ -192,7 +192,7 @@ export default {
margin-left: 16rpx;
padding: 6rpx 14rpx;
border-radius: 8rpx;
font-size: 24rpx;
font-size: 36rpx;
line-height: 1;
color: #909399;
background: #f5f7fa;
@ -308,7 +308,7 @@ export default {
flex: 1;
min-width: 0;
height: 100%;
font-size: 36rpx;
font-size: 40rpx;
color: #303133;
}
@ -359,7 +359,7 @@ export default {
}
.work-child__title {
font-size: 32rpx;
font-size: 36rpx;
color: #303133;
line-height: 1.4;
word-break: break-all;
@ -367,7 +367,7 @@ export default {
.work-child__subtitle {
margin-top: 4rpx;
font-size: 26rpx;
font-size: 34rpx;
color: #909399;
word-break: break-all;
}
@ -381,7 +381,7 @@ export default {
.work-child__amount {
margin-left: 16rpx;
font-size: 28rpx;
font-size: 36rpx;
color: #606266;
}

View File

@ -515,6 +515,15 @@ function toBool(value) {
return key === '1' || key === 'true';
}
/** 库位明细是否已盘:有记录ID(record_ids)、盘点人或上报时间之一即视为已盘 */
function isCheckedLocation(loc) {
if (!loc || typeof loc !== 'object') return false;
const ids = Array.isArray(loc.record_ids) ? loc.record_ids.filter(id => id !== null && id !== undefined && id !== '') : [];
return ids.length > 0
|| !!firstValue(loc, ['checked_at', 'checkedAt'])
|| !!firstValue(loc, ['checker_name', 'checkerName']);
}
/** 宫格格子里显示的短库位号(取末两段,如 E07-01-02-01 → 02-01) */
export function shortLocationLabel(code) {
const text = String(code || '').trim();
@ -534,8 +543,13 @@ function buildWorkAmount(systemQuantity, checkedQuantity, diffQuantity, open) {
if (!open) return null;
const sys = toNumberOrNull(systemQuantity);
const chk = toNumberOrNull(checkedQuantity);
let diff = toNumberOrNull(diffQuantity);
if (diff === null && sys !== null && chk !== null) diff = chk - sys;
// 差异统一以「实盘 - 账面」为准,避免后端 diff_quantity 与账面/实盘不一致(如未盘项返回 0)
let diff = null;
if (sys !== null && chk !== null) {
diff = chk - sys;
} else {
diff = toNumberOrNull(diffQuantity);
}
// diffTone 供各组件映射自己的样式类(gain/loss/match),diffClass 保持旧口径兼容
const diffTone = diff === null ? '' : (diff > 0 ? 'gain' : (diff < 0 ? 'loss' : 'match'));
return {
@ -684,7 +698,7 @@ function normalizeGoodsWorkRow(item, index, open) {
unit: null
};
});
const reported = checkedRaw !== undefined && checkedRaw !== null && checkedRaw !== '';
const checkedNumber = toNumberOrNull(checkedRaw);
// 行级商品主图(goods 视图行级 images 仍为商品主图)
const imageList = Array.isArray(source.images) ? source.images.filter(Boolean) : [];
// 作业记录条数(locations[].record_ids 汇总)——已盘判断与概况展示用
@ -692,18 +706,26 @@ function normalizeGoodsWorkRow(item, index, open) {
const ids = row && Array.isArray(row.record_ids) ? row.record_ids.length : 0;
return sum + ids;
}, 0);
const done = reported || recordCount > 0;
// 已盘判定:状态=checked 或有作业记录,或实盘数量>0;checked_quantity=0 视为未盘
const status = String(source.status || '').trim().toLowerCase();
const done = status === 'checked' || recordCount > 0 || (checkedNumber !== null && checkedNumber > 0);
const reported = done;
return {
key: `goods-${detailId || index + 1}`,
view: 'goods',
detailId: detailId ? String(detailId) : '',
stockId: firstValue(source, ['stock_id', 'stockId']) === undefined || firstValue(source, ['stock_id', 'stockId']) === null ? '' : String(firstValue(source, ['stock_id', 'stockId'])),
title: firstValue(source, ['item_name', 'itemName']) || '--',
subtitle: joinText([firstValue(source, ['spec']), firstValue(source, ['barcode']), storeNameValue(source)]),
subtitle: joinText([firstValue(source, ['barcode']), firstValue(source, ['spec']), storeNameValue(source)]),
statusText: done ? '已盘' : '未盘',
statusClass: done ? 'work-card__tag--done' : 'work-card__tag--todo',
meta: children.length ? [] : [{ label: '库位', value: '暂无作业记录' }],
amount: buildWorkAmount(source.system_quantity !== undefined ? source.system_quantity : source.systemQuantity, checkedRaw, source.diff_quantity !== undefined ? source.diff_quantity : source.diffQuantity, open),
amount: buildWorkAmount(
source.system_quantity !== undefined ? source.system_quantity : source.systemQuantity,
done ? checkedRaw : null,
done ? (source.diff_quantity !== undefined ? source.diff_quantity : source.diffQuantity) : null,
open
),
quantityText: '',
children,
unit: buildWorkUnit(detailId, '', checkedRaw, reported, firstValue(source, ['stock_id', 'stockId'])),
@ -716,8 +738,8 @@ function normalizeGoodsWorkRow(item, index, open) {
storeName: storeNameValue(source),
checked: done,
recordCount,
locationCount: rawLocations.length,
locationCodes: rawLocations.map(row => firstValue(row || {}, ['location_code', 'locationCode'])).filter(Boolean)
locationCount: rawLocations.filter(isCheckedLocation).length,
locationCodes: rawLocations.filter(isCheckedLocation).map(row => firstValue(row || {}, ['location_code', 'locationCode'])).filter(Boolean)
};
}
@ -924,10 +946,12 @@ export function normalizeGoodsDetailInfo(row, mode) {
const checkers = Array.isArray(checkersRaw) ? checkersRaw.filter(Boolean).join('、') : String(checkersRaw || '');
// 库位明细(每库位一行:账面 / 实盘 / 盈亏),顺便汇总记录条数与最近上报时间
// 未盘点库位只是任务范围占位(record_ids 空且无盘点人/上报时间),不作为「盘点记录」展示
const rawLocations = Array.isArray(source.locations) ? source.locations : [];
const checkedLocations = rawLocations.filter(isCheckedLocation);
let recordCount = 0;
let lastCheckedAt = '';
const locations = rawLocations.map((item, index) => {
const locations = checkedLocations.map((item, index) => {
const loc = item && typeof item === 'object' ? item : {};
const locationCode = firstValue(loc, ['location_code', 'locationCode']) || '';
const locationName = firstValue(loc, ['location_name', 'locationName']) || '';

View File

@ -34,7 +34,6 @@
v-for="(item, index) in recordList"
:key="item.id || index"
:item="item"
:stripe="index % 2 === 1"
@click="handleRecordClick(item)"
/>
</view>

View File

@ -140,6 +140,60 @@
@cancel="handleCancel"
@submit="handleSubmit"
/>
<!-- 完成盘点确认弹窗(自定义样式) -->
<u-popup
:show="showFinishConfirm"
mode="center"
:closeable="true"
:closeOnClickOverlay="false"
border-radius="20"
@close="cancelFinish"
>
<view class="finish-confirm-popup">
<view class="finish-confirm-popup__title">完成盘点</view>
<view class="finish-confirm-popup__body">
<text class="finish-confirm-popup__text">确认全部明细已盘点并完成该盘点任务?</text>
</view>
<view class="finish-confirm-popup__actions">
<view class="finish-confirm-popup__btn finish-confirm-popup__btn--cancel" @click="cancelFinish">再想想</view>
<view
class="finish-confirm-popup__btn finish-confirm-popup__btn--confirm"
:class="{ 'finish-confirm-popup__btn--disabled': submitting }"
@click="confirmFinish"
>
<text>{{ submitting ? '提交中...' : '完成' }}</text>
</view>
</view>
</view>
</u-popup>
<!-- 标记空库位确认弹窗(作业列表行级,自定义样式) -->
<u-popup
:show="showMarkEmptyConfirm"
mode="center"
:closeable="true"
:closeOnClickOverlay="false"
border-radius="20"
@close="cancelMarkEmpty"
>
<view class="mark-empty-confirm-popup">
<view class="mark-empty-confirm-popup__title">标记空库位</view>
<view class="mark-empty-confirm-popup__body">
<text class="mark-empty-confirm-popup__text">{{ markEmptyText }}</text>
</view>
<view class="mark-empty-confirm-popup__actions">
<view class="mark-empty-confirm-popup__btn mark-empty-confirm-popup__btn--cancel" @click="cancelMarkEmpty">取消</view>
<view
class="mark-empty-confirm-popup__btn mark-empty-confirm-popup__btn--confirm"
:class="{ 'mark-empty-confirm-popup__btn--disabled': submitting }"
@click="confirmMarkEmpty"
>
<text>{{ submitting ? '处理中...' : '确认标记' }}</text>
</view>
</view>
</view>
</u-popup>
</view>
</template>
@ -190,6 +244,9 @@ export default {
refreshing: false,
submitting: false,
showActionsPopup: false,
showFinishConfirm: false,
showMarkEmptyConfirm: false,
markEmptyTarget: null,
showDetailPicker: false,
showRecordAdd: false,
recordAddTarget: { detailId: '', location: '' },
@ -226,6 +283,13 @@ export default {
hasActions() {
return this.canFinish || this.canCancel || this.canSubmit;
},
// 作业列表行级「标记空库位」确认文案
markEmptyText() {
const row = this.markEmptyTarget;
if (!row) return '';
const loc = row.location || row.title || '';
return `确认库位「${loc}」为空?该库位已有的商品记录会被清除。`;
},
// 盘点作业 tab(index=1)
isWorkTab() {
return this.currentTab === 1;
@ -652,21 +716,24 @@ export default {
},
handleMarkEmpty(row) {
if (!row || !row.detailId) return;
uni.showModal({
title: '标记空库位',
content: `确认库位「${row.location || row.title}」为空?该库位已有的商品记录会被清除。`,
confirmText: '确认',
cancelText: '取消',
success: async (res) => {
if (!res.confirm) return;
const ok = await this.submitReport({
detailId: row.detailId,
location: row.location,
isEmpty: true
}, '已标记空库位');
this.speakMessage(ok ? '已标记空库位' : '标记失败', { force: true, minInterval: 0 });
}
});
this.markEmptyTarget = row;
this.showMarkEmptyConfirm = true;
},
cancelMarkEmpty() {
this.showMarkEmptyConfirm = false;
this.markEmptyTarget = null;
},
async confirmMarkEmpty() {
this.showMarkEmptyConfirm = false;
const row = this.markEmptyTarget;
this.markEmptyTarget = null;
if (!row || !row.detailId) return;
const ok = await this.submitReport({
detailId: row.detailId,
location: row.location,
isEmpty: true
}, '已标记空库位');
this.speakMessage(ok ? '已标记空库位' : '标记失败', { force: true, minInterval: 0 });
},
/** 统一上报入口(check.report):数量录入 / 添加商品记录 / 空库位标记 */
async submitReport(payload, successText, options = {}) {
@ -817,50 +884,49 @@ export default {
console.warn('[inventoryCountDetail] 语音播报异常:', error);
}
},
async handleFinish() {
handleFinish() {
this.showActionsPopup = false;
if (this.submitting || !this.taskId) return;
uni.showModal({
title: '完成盘点',
content: '确认全部明细已盘点并完成该盘点任务?',
confirmText: '完成',
cancelText: '再想想',
success: async (res) => {
if (!res.confirm) return;
this.submitting = true;
try {
const response = await this.$http('check.finish', { id: Number(this.taskId) });
if (response?.flag === 'failure') {
this.speakMessage('盘点失败', { force: true, minInterval: 0 });
uni.showToast({ title: response.message || '完成失败', icon: 'none' });
return;
}
const profit = Number(response?.profit_total) || 0;
const loss = Number(response?.loss_total) || 0;
let title = '盘点完成';
if (profit || loss) {
title = `盘点完成 盘盈${profit} 盘亏${loss}`;
}
// 语音播报统一为「盘点完成」(盘盈/盘亏详情仅弹窗展示)
this.speakMessage('盘点完成', { force: true, minInterval: 0 });
uni.showModal({
title,
content: '该盘点任务已完成。',
showCancel: false,
confirmText: '返回列表',
success: () => {
setTimeout(() => uni.navigateBack({ delta: 1, fail: () => {} }), 200);
}
});
} catch (error) {
console.error('[inventoryCountDetail] 完成盘点失败:', error);
this.speakMessage('盘点失败', { force: true, minInterval: 0 });
uni.showToast({ title: '完成盘点失败', icon: 'none' });
} finally {
this.submitting = false;
}
this.showFinishConfirm = true;
},
cancelFinish() {
this.showFinishConfirm = false;
},
async confirmFinish() {
this.showFinishConfirm = false;
if (this.submitting || !this.taskId) return;
this.submitting = true;
try {
const response = await this.$http('check.finish', { id: Number(this.taskId) });
if (response?.flag === 'failure') {
this.speakMessage('盘点失败', { force: true, minInterval: 0 });
uni.showToast({ title: response.message || '完成失败', icon: 'none' });
return;
}
});
const profit = Number(response?.profit_total) || 0;
const loss = Number(response?.loss_total) || 0;
let title = '盘点完成';
if (profit || loss) {
title = `盘点完成 盘盈${profit} 盘亏${loss}`;
}
// 语音播报统一为「盘点完成」(盘盈/盘亏详情仅弹窗展示)
this.speakMessage('盘点完成', { force: true, minInterval: 0 });
uni.showModal({
title,
content: '该盘点任务已完成。',
showCancel: false,
confirmText: '返回列表',
success: () => {
setTimeout(() => uni.navigateBack({ delta: 1, fail: () => {} }), 200);
}
});
} catch (error) {
console.error('[inventoryCountDetail] 完成盘点失败:', error);
this.speakMessage('盘点失败', { force: true, minInterval: 0 });
uni.showToast({ title: '完成盘点失败', icon: 'none' });
} finally {
this.submitting = false;
}
},
handleCancel() {
this.showActionsPopup = false;
@ -1089,4 +1155,136 @@ export default {
pointer-events: none;
}
/* 完成盘点确认弹窗(自定义样式) */
.finish-confirm-popup {
width: 640rpx;
padding: 40rpx 32rpx 32rpx;
background: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
}
.finish-confirm-popup__title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
text-align: center;
margin-bottom: 32rpx;
}
.finish-confirm-popup__body {
margin-bottom: 36rpx;
padding: 24rpx;
background: #f5f7fa;
border-radius: 12rpx;
}
.finish-confirm-popup__text {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
}
.finish-confirm-popup__actions {
display: flex;
align-items: center;
}
.finish-confirm-popup__btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 500;
}
.finish-confirm-popup__btn + .finish-confirm-popup__btn {
margin-left: 20rpx;
}
.finish-confirm-popup__btn--cancel {
background: #f5f7fa;
color: #606266;
border: 1rpx solid #dcdfe6;
}
.finish-confirm-popup__btn--confirm {
background: #2979ff;
color: #ffffff;
}
.finish-confirm-popup__btn--disabled {
opacity: 0.6;
pointer-events: none;
}
/* 标记空库位确认弹窗(作业列表行级,自定义样式) */
.mark-empty-confirm-popup {
width: 640rpx;
padding: 40rpx 32rpx 32rpx;
background: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
}
.mark-empty-confirm-popup__title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
text-align: center;
margin-bottom: 32rpx;
}
.mark-empty-confirm-popup__body {
margin-bottom: 36rpx;
padding: 24rpx;
background: #fef0f0;
border-radius: 12rpx;
}
.mark-empty-confirm-popup__text {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
}
.mark-empty-confirm-popup__actions {
display: flex;
align-items: center;
}
.mark-empty-confirm-popup__btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 500;
}
.mark-empty-confirm-popup__btn + .mark-empty-confirm-popup__btn {
margin-left: 20rpx;
}
.mark-empty-confirm-popup__btn--cancel {
background: #f5f7fa;
color: #606266;
border: 1rpx solid #dcdfe6;
}
.mark-empty-confirm-popup__btn--confirm {
background: #f56c6c;
color: #ffffff;
}
.mark-empty-confirm-popup__btn--disabled {
opacity: 0.6;
pointer-events: none;
}
</style>

View File

@ -56,7 +56,7 @@
<view class="inv-goods-card__metrics">
<text v-if="systemQuantityValue !== null" class="inv-goods-card__metric">账面 {{ systemQuantityValue }}</text>
<text class="inv-goods-card__metric">已盘 {{ checkedTotalText }}</text>
<text v-if="diffText" class="inv-goods-card__diff" :class="diffValueClass">盈亏 {{ diffText }}</text>
<text v-if="diffText" class="inv-goods-card__diff" :class="diffValueClass">{{ diffText }}</text>
</view>
</view>
</view>
@ -86,6 +86,33 @@
@close="closeEntryPopup"
@confirm="handleEntryConfirm"
/>
<!-- 删除盘点记录确认弹窗(自定义样式) -->
<u-popup
:show="showDeleteRecordConfirm"
mode="center"
:closeable="true"
:closeOnClickOverlay="false"
border-radius="20"
@close="cancelDeleteRecord"
>
<view class="delete-confirm-popup">
<view class="delete-confirm-popup__title">删除盘点记录</view>
<view class="delete-confirm-popup__body">
<text class="delete-confirm-popup__text">{{ deleteRecordTarget ? deleteRecordTarget.text : '' }}</text>
</view>
<view class="delete-confirm-popup__actions">
<view class="delete-confirm-popup__btn delete-confirm-popup__btn--cancel" @click="cancelDeleteRecord">取消</view>
<view
class="delete-confirm-popup__btn delete-confirm-popup__btn--confirm"
:class="{ 'delete-confirm-popup__btn--disabled': submitting }"
@click="confirmDeleteRecord"
>
<text>{{ submitting ? '处理中...' : '删除' }}</text>
</view>
</view>
</view>
</u-popup>
</view>
</template>
@ -183,6 +210,8 @@ export default {
submitting: false,
scanKeyword: '',
showEntryPopup: false,
showDeleteRecordConfirm: false,
deleteRecordTarget: null,
pendingLocation: ''
};
},
@ -204,8 +233,9 @@ export default {
systemQuantityValue() {
return resolveSystemQuantity(this.goodsInfo);
},
// 已盘合计(接口 checked_quantity,缺失时用库位明细合计)
// 已盘合计(接口 checked_quantity,缺失时用库位明细合计;未盘显示 --)
checkedTotalText() {
if (!this.hasChecked) return '--';
return String(resolveCheckedQuantity(this.goodsInfo));
},
// 盈亏:未盘不显示;已盘 = 已盘合计 - 账面
@ -228,9 +258,9 @@ export default {
const locations = this.goodsInfo.locations || [];
return locations.reduce((acc, item) => acc.concat(item.images || []), []);
},
// 规格 · 条码 · 货主(紧凑卡片一行)
// 条码 · 规格 · 货主(与盘点作业商品卡片副标题顺序一致)
goodsMetaText() {
return [this.goodsInfo.spec, this.goodsInfo.barcode, this.goodsInfo.storeName].filter(Boolean).join(' · ') || '--';
return [this.goodsInfo.barcode, this.goodsInfo.spec, this.goodsInfo.storeName].filter(Boolean).join(' · ') || '--';
},
// CountLocationDetail 只需要 row 结构(概况在卡片,children = 库位明细:账面/实盘/盈亏)
detailRow() {
@ -243,7 +273,7 @@ export default {
return {
key: `goods-${this.detailId}`,
detailId: this.detailId,
title: '盘点记录',
title: '',
subtitle: '',
statusText: '',
statusClass: '',
@ -330,6 +360,21 @@ export default {
handleKeywordClear() {
this.scanKeyword = '';
},
/** 语音播报(复用全局 $tools.speakText,受 voice.enabled 开关控制) */
speakMessage(message, options = {}) {
const text = String(message || '').trim();
if (!text) return;
const tools = this.$tools;
if (!tools || typeof tools.speakText !== 'function') return;
try {
const task = tools.speakText(text, options);
if (task && typeof task.catch === 'function') {
task.catch(error => console.warn('[inventoryCountGoods] 语音播报失败:', error));
}
} catch (error) {
console.warn('[inventoryCountGoods] 语音播报异常:', error);
}
},
// ===== 底部抽屉:选库位 + 录数量 =====
handleEntryOpen() {
if (!this.editable) return;
@ -386,15 +431,18 @@ export default {
itemName: this.goodsInfo.itemName
}));
if (response?.flag === 'failure') {
uni.showToast({ title: response.message || '上报失败', icon: 'none' });
uni.showToast({ title: '接口失败', icon: 'none' });
this.speakMessage('登记失败', { force: true, minInterval: 0 });
return false;
}
uni.showToast({ title: `已记录 ${location}`, icon: 'success', duration: 800 });
uni.showToast({ title: '已登记', icon: 'success', duration: 800 });
this.speakMessage('已登记', { force: true, minInterval: 0 });
await this.loadInfo();
return true;
} catch (error) {
console.error('[inventoryCountGoods] 盘点上报失败:', error);
uni.showToast({ title: '盘点上报失败', icon: 'none' });
uni.showToast({ title: '异常', icon: 'none' });
this.speakMessage('登记失败', { force: true, minInterval: 0 });
return false;
} finally {
this.submitting = false;
@ -422,17 +470,22 @@ export default {
}
const scope = child.title || '该库位';
const suffix = recordIds.length > 1 ? `的 ${recordIds.length} 条记录` : '这条记录';
uni.showModal({
title: '删除盘点记录',
content: `确认删除「${scope}」${suffix}?`,
confirmText: '删除',
confirmColor: '#f56c6c',
cancelText: '取消',
success: async (res) => {
if (!res.confirm) return;
await this.removeRecords(recordIds);
}
});
this.deleteRecordTarget = {
recordIds,
text: `确认删除「${scope}」${suffix}?`
};
this.showDeleteRecordConfirm = true;
},
cancelDeleteRecord() {
this.showDeleteRecordConfirm = false;
this.deleteRecordTarget = null;
},
async confirmDeleteRecord() {
this.showDeleteRecordConfirm = false;
const target = this.deleteRecordTarget;
this.deleteRecordTarget = null;
if (!target || !target.recordIds || !target.recordIds.length) return;
await this.removeRecords(target.recordIds);
},
async removeRecords(recordIds) {
if (!this.editable || !this.taskId) return false;
@ -612,7 +665,7 @@ export default {
.inv-goods-card__title {
flex: 1;
min-width: 0;
font-size: 32rpx;
font-size: 38rpx;
font-weight: 600;
color: #303133;
line-height: 1.3;
@ -624,7 +677,7 @@ export default {
.inv-goods-card__flag {
flex-shrink: 0;
margin-left: 16rpx;
font-size: 26rpx;
font-size: 36rpx;
line-height: 1.2;
}
@ -638,8 +691,9 @@ export default {
.inv-goods-card__line {
margin-top: 6rpx;
font-size: 24rpx;
color: #8a9099;
font-size: 34rpx;
color: #606266;
line-height: 1.4;
word-break: break-all;
}
@ -652,12 +706,13 @@ export default {
.inv-goods-card__metric {
margin-right: 20rpx;
font-size: 26rpx;
color: #606266;
font-size: 34rpx;
color: #303133;
}
.inv-goods-card__diff {
font-size: 26rpx;
margin-right: 20rpx;
font-size: 34rpx;
font-weight: 600;
}
@ -683,4 +738,70 @@ export default {
.safe-area-bottom {
height: 20rpx;
}
/* 删除盘点记录确认弹窗(自定义样式) */
.delete-confirm-popup {
width: 640rpx;
padding: 40rpx 32rpx 32rpx;
background: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
}
.delete-confirm-popup__title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
text-align: center;
margin-bottom: 32rpx;
}
.delete-confirm-popup__body {
margin-bottom: 36rpx;
padding: 24rpx;
background: #fef0f0;
border-radius: 12rpx;
}
.delete-confirm-popup__text {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
}
.delete-confirm-popup__actions {
display: flex;
align-items: center;
}
.delete-confirm-popup__btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 500;
}
.delete-confirm-popup__btn + .delete-confirm-popup__btn {
margin-left: 20rpx;
}
.delete-confirm-popup__btn--cancel {
background: #f5f7fa;
color: #606266;
border: 1rpx solid #dcdfe6;
}
.delete-confirm-popup__btn--confirm {
background: #f56c6c;
color: #ffffff;
}
.delete-confirm-popup__btn--disabled {
opacity: 0.6;
pointer-events: none;
}
</style>

View File

@ -81,6 +81,60 @@
@close="closeAddPopup"
@confirm="handleRecordAddConfirm"
/>
<!-- 标记空库位确认弹窗(自定义样式) -->
<u-popup
:show="showMarkEmptyConfirm"
mode="center"
:closeable="true"
:closeOnClickOverlay="false"
border-radius="20"
@close="cancelMarkEmpty"
>
<view class="mark-empty-confirm-popup">
<view class="mark-empty-confirm-popup__title">标记空库位</view>
<view class="mark-empty-confirm-popup__body">
<text class="mark-empty-confirm-popup__text">确认库位「{{ locationName || locationCode || detailId }}」为空?该库位已有的商品记录会被清除。</text>
</view>
<view class="mark-empty-confirm-popup__actions">
<view class="mark-empty-confirm-popup__btn mark-empty-confirm-popup__btn--cancel" @click="cancelMarkEmpty">取消</view>
<view
class="mark-empty-confirm-popup__btn mark-empty-confirm-popup__btn--confirm"
:class="{ 'mark-empty-confirm-popup__btn--disabled': submitting }"
@click="confirmMarkEmpty"
>
<text>{{ submitting ? '处理中...' : '确认标记' }}</text>
</view>
</view>
</view>
</u-popup>
<!-- 删除商品记录确认弹窗(自定义样式) -->
<u-popup
:show="showDeleteRecordConfirm"
mode="center"
:closeable="true"
:closeOnClickOverlay="false"
border-radius="20"
@close="cancelDeleteRecord"
>
<view class="delete-confirm-popup">
<view class="delete-confirm-popup__title">删除商品记录</view>
<view class="delete-confirm-popup__body">
<text class="delete-confirm-popup__text">{{ deleteRecordTarget ? deleteRecordTarget.text : '' }}</text>
</view>
<view class="delete-confirm-popup__actions">
<view class="delete-confirm-popup__btn delete-confirm-popup__btn--cancel" @click="cancelDeleteRecord">取消</view>
<view
class="delete-confirm-popup__btn delete-confirm-popup__btn--confirm"
:class="{ 'delete-confirm-popup__btn--disabled': submitting }"
@click="confirmDeleteRecord"
>
<text>{{ submitting ? '处理中...' : '删除' }}</text>
</view>
</view>
</view>
</u-popup>
</view>
</template>
@ -124,6 +178,9 @@ export default {
scanKeyword: '',
showRecordAdd: false,
showActionsPopup: false,
showMarkEmptyConfirm: false,
showDeleteRecordConfirm: false,
deleteRecordTarget: null,
pendingBarcode: '',
submitting: false
};
@ -263,17 +320,16 @@ export default {
uni.showToast({ title: '缺少盘点明细ID', icon: 'none' });
return;
}
uni.showModal({
title: '标记空库位',
content: `确认库位「${this.locationName || this.locationCode || this.detailId}」为空?该库位已有的商品记录会被清除。`,
confirmText: '确认',
cancelText: '取消',
success: async (res) => {
if (!res.confirm) return;
const ok = await this.submitReport({ isEmpty: true, detailId: this.detailId }, '已标记空库位');
this.speakMessage(ok ? '已标记空库位' : '标记失败', { force: true, minInterval: 0 });
}
});
this.showMarkEmptyConfirm = true;
},
cancelMarkEmpty() {
this.showMarkEmptyConfirm = false;
},
async confirmMarkEmpty() {
this.showMarkEmptyConfirm = false;
if (!this.detailId) return;
const ok = await this.submitReport({ isEmpty: true, detailId: this.detailId }, '已标记空库位');
this.speakMessage(ok ? '已标记空库位' : '标记失败', { force: true, minInterval: 0 });
},
handleRecordAddConfirm(payload) {
// 提交成功后收起抽屉并清空表单;失败时保留输入便于重试
@ -299,17 +355,22 @@ export default {
uni.showToast({ title: '缺少盘点任务ID', icon: 'none' });
return;
}
uni.showModal({
title: '删除商品记录',
content: `确认删除「${child.title || '该商品'}」本条记录?`,
confirmText: '删除',
confirmColor: '#f56c6c',
cancelText: '取消',
success: async (res) => {
if (!res.confirm) return;
await this.removeRecords([recordId]);
}
});
this.deleteRecordTarget = {
recordId,
text: `确认删除「${child.title || '该商品'}」本条记录?`
};
this.showDeleteRecordConfirm = true;
},
cancelDeleteRecord() {
this.showDeleteRecordConfirm = false;
this.deleteRecordTarget = null;
},
async confirmDeleteRecord() {
this.showDeleteRecordConfirm = false;
const target = this.deleteRecordTarget;
this.deleteRecordTarget = null;
if (!target || !target.recordId) return;
await this.removeRecords([target.recordId]);
},
/** 调用 recordDelete 并刷新当前库位明细 */
async removeRecords(recordIds) {
@ -542,4 +603,136 @@ export default {
opacity: 0.45;
pointer-events: none;
}
/* 标记空库位确认弹窗(自定义样式) */
.mark-empty-confirm-popup {
width: 640rpx;
padding: 40rpx 32rpx 32rpx;
background: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
}
.mark-empty-confirm-popup__title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
text-align: center;
margin-bottom: 32rpx;
}
.mark-empty-confirm-popup__body {
margin-bottom: 36rpx;
padding: 24rpx;
background: #fef0f0;
border-radius: 12rpx;
}
.mark-empty-confirm-popup__text {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
}
.mark-empty-confirm-popup__actions {
display: flex;
align-items: center;
}
.mark-empty-confirm-popup__btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 500;
}
.mark-empty-confirm-popup__btn + .mark-empty-confirm-popup__btn {
margin-left: 20rpx;
}
.mark-empty-confirm-popup__btn--cancel {
background: #f5f7fa;
color: #606266;
border: 1rpx solid #dcdfe6;
}
.mark-empty-confirm-popup__btn--confirm {
background: #f56c6c;
color: #ffffff;
}
.mark-empty-confirm-popup__btn--disabled {
opacity: 0.6;
pointer-events: none;
}
/* 删除商品记录确认弹窗(自定义样式) */
.delete-confirm-popup {
width: 640rpx;
padding: 40rpx 32rpx 32rpx;
background: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
}
.delete-confirm-popup__title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
text-align: center;
margin-bottom: 32rpx;
}
.delete-confirm-popup__body {
margin-bottom: 36rpx;
padding: 24rpx;
background: #fef0f0;
border-radius: 12rpx;
}
.delete-confirm-popup__text {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
}
.delete-confirm-popup__actions {
display: flex;
align-items: center;
}
.delete-confirm-popup__btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 500;
}
.delete-confirm-popup__btn + .delete-confirm-popup__btn {
margin-left: 20rpx;
}
.delete-confirm-popup__btn--cancel {
background: #f5f7fa;
color: #606266;
border: 1rpx solid #dcdfe6;
}
.delete-confirm-popup__btn--confirm {
background: #f56c6c;
color: #ffffff;
}
.delete-confirm-popup__btn--disabled {
opacity: 0.6;
pointer-events: none;
}
</style>

View File

@ -389,14 +389,14 @@ export default {
.inv-space-card__label {
flex-shrink: 0;
width: 160rpx;
font-size: 28rpx;
font-size: 30rpx;
color: #8a9099;
}
.inv-space-card__value {
flex: 1;
min-width: 0;
font-size: 30rpx;
font-size: 36rpx;
color: #303133;
word-break: break-all;
}

View File

@ -37,13 +37,13 @@
</view>
<!-- 状态标签 -->
<scroll-view class="status-tags" scroll-x :show-scrollbar="false">
<view class="status-tags">
<view class="status-tag" v-for="status in statusList" :key="status.value"
:class="{ active: activeStatus === status.value }" @click="changeStatus(status.value)">
<text class="tag-name">{{ status.label }}</text>
<u-badge :value="status.count" size="mini"></u-badge>
</view>
</scroll-view>
</view>
</view>
<!-- 收货列表 -->
@ -997,18 +997,23 @@
}
.status-tags {
white-space: nowrap;
height: 70rpx;
display: flex;
align-items: center;
.status-tag {
display: inline-flex;
flex: 1;
display: flex;
align-items: center;
padding: 10rpx 30rpx;
margin-right: 20rpx;
justify-content: center;
padding: 10rpx 12rpx;
background: #f5f5f5;
border-radius: 30rpx;
position: relative;
& + .status-tag {
margin-left: 16rpx;
}
&.active {
background: #007aff;
@ -1020,6 +1025,7 @@
.tag-name {
font-size: 30rpx;
color: #666;
margin-right: 8rpx;
}
}
}