feat(库存盘点): 详情页新增盘点明细选择器
- 新增 CountDetailPicker 盘点明细选择组件 - inventoryCountDetail 接入明细选择流程 - countModel 补充明细选择相关共享口径 - apis 调整盘点相关接口定义
This commit is contained in:
parent
002fdbf455
commit
630f2a3a3c
@ -526,7 +526,7 @@ export default {
|
||||
isSystemApi: true
|
||||
},
|
||||
// 添加盘点明细(按任务盘点类型决定维度):商品任务传 stock_ids;
|
||||
// 库位任务传 locations/location_ids(location_ids 优先),type=all 两者都不传则自动拉全仓启用库位
|
||||
// 库位任务传 locations/location_ids(location_ids 优先),type=location 两者都不传则自动拉全仓启用库位
|
||||
// 仅 created/rejected 允许;已存在的盘点项自动跳过(幂等);完成后重算主表 total_items
|
||||
addDetail: {
|
||||
path: "stock.check.addDetail",
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
></u-search>
|
||||
</view>
|
||||
|
||||
<!-- type=all 库位任务:一键全仓 -->
|
||||
<!-- type=location 库位任务:一键全仓 -->
|
||||
<view v-if="allowAllLocations" class="picker__all" @click="handleAllLocations">
|
||||
<text class="picker__all-text">全部库位(自动拉取全仓库启用库位)</text>
|
||||
</view>
|
||||
|
||||
@ -72,23 +72,22 @@ export function detailStatusText(status) {
|
||||
return map[key] || '';
|
||||
}
|
||||
|
||||
/** 盘点类型文案:goods=商品盘点 / store=商品盘点(货主)/ location=库位盘点 / all=库位盘点(全仓) */
|
||||
/** 盘点类型文案:goods=商品盘点 / store=商品盘点(货主)/ location=库位盘点 */
|
||||
export function typeText(type) {
|
||||
const map = {
|
||||
goods: '商品盘点',
|
||||
store: '商品盘点(货主)',
|
||||
location: '库位盘点',
|
||||
all: '库位盘点(全仓)'
|
||||
location: '库位盘点'
|
||||
};
|
||||
const key = String(type || '').trim().toLowerCase();
|
||||
return map[key] || (type ? String(type) : '--');
|
||||
}
|
||||
|
||||
/** 盘点类型色调:goods/store→商品盘点,location/all→库位盘点 */
|
||||
/** 盘点类型色调:goods/store→商品盘点,location→库位盘点 */
|
||||
export function typeTone(type) {
|
||||
const key = String(type || '').trim().toLowerCase();
|
||||
if (key === 'goods' || key === 'store') return 'goods';
|
||||
if (key === 'location' || key === 'all') return 'location';
|
||||
if (key === 'location') return 'location';
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -482,7 +481,7 @@ export function normalizeCheckResultRows(rows) {
|
||||
|
||||
// ===== 作业列表(stock.check.workData)=====
|
||||
|
||||
/** 商品类任务:type=goods/store(库位类任务 type=location/all) */
|
||||
/** 商品类任务:type=goods/store(库位类任务 type=location) */
|
||||
export function isGoodsTask(type) {
|
||||
const key = String(type || '').trim().toLowerCase();
|
||||
return key === 'goods' || key === 'store';
|
||||
@ -495,7 +494,7 @@ export function isOpenCheckMode(mode) {
|
||||
|
||||
/**
|
||||
* 作业解析视图:
|
||||
* 库位任务(location/all)一律 location;商品任务(goods/store)默认 space,isGoods=true 时为 goods
|
||||
* 库位任务(location)一律 location;商品任务(goods/store)默认 space,isGoods=true 时为 goods
|
||||
*/
|
||||
export function resolveWorkView(type, isGoods) {
|
||||
if (!isGoodsTask(type)) return 'location';
|
||||
|
||||
@ -195,6 +195,33 @@
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<!-- 全部库位二次确认弹窗(一键全仓前提示) -->
|
||||
<u-popup
|
||||
:show="showAllLocationsConfirm"
|
||||
mode="center"
|
||||
:closeable="true"
|
||||
:closeOnClickOverlay="false"
|
||||
border-radius="20"
|
||||
@close="cancelAllLocations"
|
||||
>
|
||||
<view class="all-locations-confirm-popup">
|
||||
<view class="all-locations-confirm-popup__title">全部库位</view>
|
||||
<view class="all-locations-confirm-popup__body">
|
||||
<text class="all-locations-confirm-popup__text">将自动添加当前仓库全部启用库位,盘点范围会扩大。确认继续?</text>
|
||||
</view>
|
||||
<view class="all-locations-confirm-popup__actions">
|
||||
<view class="all-locations-confirm-popup__btn all-locations-confirm-popup__btn--cancel" @click="cancelAllLocations">取消</view>
|
||||
<view
|
||||
class="all-locations-confirm-popup__btn all-locations-confirm-popup__btn--confirm"
|
||||
:class="{ 'all-locations-confirm-popup__btn--disabled': submitting }"
|
||||
@click="confirmAllLocations"
|
||||
>
|
||||
<text>{{ submitting ? '添加中...' : '确认添加' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -249,6 +276,8 @@ export default {
|
||||
showMarkEmptyConfirm: false,
|
||||
markEmptyTarget: null,
|
||||
showDetailPicker: false,
|
||||
showAllLocationsConfirm: false,
|
||||
pendingAllLocationsParams: null,
|
||||
showRecordAdd: false,
|
||||
recordAddTarget: { detailId: '', location: '', locationName: '', spaceId: '' },
|
||||
currentTab: 0,
|
||||
@ -306,13 +335,13 @@ export default {
|
||||
showAddDetailEntry() {
|
||||
return this.currentTab === 0 && this.canAddDetail;
|
||||
},
|
||||
// 添加维度由任务盘点类型决定:商品任务加商品行,库位任务(含 all)加库位行
|
||||
// 添加维度由任务盘点类型决定:商品任务加商品行,库位任务加库位行
|
||||
detailPickerMode() {
|
||||
return this.isGoodsCheckTask ? 'goods' : 'location';
|
||||
},
|
||||
// type=all 的库位任务支持一键全仓(不传 locations/location_ids)
|
||||
// 库位任务(type=location)支持一键全仓(不传 locations/location_ids)
|
||||
allowAllLocations() {
|
||||
return this.detailPickerMode === 'location' && String(this.taskInfo.type || '').trim().toLowerCase() === 'all';
|
||||
return this.detailPickerMode === 'location';
|
||||
},
|
||||
// 作业数据解析视图:location / goods / space
|
||||
workView() {
|
||||
@ -826,18 +855,25 @@ export default {
|
||||
},
|
||||
// ===== 添加明细(stock.check.addDetail)=====
|
||||
async handleDetailPickerConfirm(payload) {
|
||||
this.showDetailPicker = false;
|
||||
if (!this.taskId || !payload) return;
|
||||
const params = { id: Number(this.taskId) };
|
||||
if (payload.mode === 'goods') {
|
||||
if (!payload.ids.length) return;
|
||||
params.stock_ids = payload.ids;
|
||||
} else if (payload.all) {
|
||||
// 不传 locations / location_ids,后端自动拉取全仓启用库位
|
||||
// 不传 locations / location_ids,后端自动拉取全仓启用库位;先二次确认
|
||||
this.showDetailPicker = false;
|
||||
this.pendingAllLocationsParams = params;
|
||||
this.showAllLocationsConfirm = true;
|
||||
return;
|
||||
} else {
|
||||
if (!payload.ids.length) return;
|
||||
params.location_ids = payload.ids;
|
||||
}
|
||||
this.showDetailPicker = false;
|
||||
await this.submitAddDetail(params);
|
||||
},
|
||||
async submitAddDetail(params) {
|
||||
uni.showLoading({ title: '添加中...', mask: true });
|
||||
try {
|
||||
const response = await this.$http('check.addDetail', params);
|
||||
@ -863,6 +899,17 @@ export default {
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
cancelAllLocations() {
|
||||
this.showAllLocationsConfirm = false;
|
||||
this.pendingAllLocationsParams = null;
|
||||
},
|
||||
async confirmAllLocations() {
|
||||
const params = this.pendingAllLocationsParams;
|
||||
this.showAllLocationsConfirm = false;
|
||||
this.pendingAllLocationsParams = null;
|
||||
if (!params) return;
|
||||
await this.submitAddDetail(params);
|
||||
},
|
||||
// ===== 加载与提交 =====
|
||||
async loadTaskDetail() {
|
||||
this.loading = true;
|
||||
@ -1302,4 +1349,70 @@ export default {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 全部库位二次确认弹窗(一键全仓前提示) */
|
||||
.all-locations-confirm-popup {
|
||||
width: 640rpx;
|
||||
padding: 40rpx 32rpx 32rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.all-locations-confirm-popup__title {
|
||||
font-size: 42rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
text-align: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.all-locations-confirm-popup__body {
|
||||
margin-bottom: 36rpx;
|
||||
padding: 24rpx;
|
||||
background: #eef4ff;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.all-locations-confirm-popup__text {
|
||||
font-size: 36rpx;
|
||||
color: #303133;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.all-locations-confirm-popup__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.all-locations-confirm-popup__btn {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.all-locations-confirm-popup__btn + .all-locations-confirm-popup__btn {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.all-locations-confirm-popup__btn--cancel {
|
||||
background: #f5f7fa;
|
||||
color: #606266;
|
||||
border: 1rpx solid #dcdfe6;
|
||||
}
|
||||
|
||||
.all-locations-confirm-popup__btn--confirm {
|
||||
background: #2979ff;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.all-locations-confirm-popup__btn--disabled {
|
||||
opacity: 0.6;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user