refactor(prefetch): 合并库存相关字段为统一阈值字段

- 将面额的最小库存和目标库存字段合并为单一的库存阈值字段 capacity
- 修改接口定义和文档,更新对应的库存阈值说明
- 调整前端表单及表格展示,统一使用库存阈值字段
- 更新表单校验逻辑,确保库存阈值有效且大于0
- 优化提示文案,明确系统根据库存阈值管理预拉取订单库存
This commit is contained in:
danial
2025-12-07 20:16:43 +08:00
parent 813d9f0c0e
commit 932b8473c9
3 changed files with 18 additions and 43 deletions

View File

@@ -2,11 +2,10 @@
## Properties
| Name | Type | Description | Notes |
| ------------------ | ---------- | -------------------------------------------------------- | --------------------------------- |
| **denomination** | **number** | 面额值如100、200、500等 | [optional] [default to undefined] |
| **minCapacity** | **number** | 该面额预拉取订单最小库存值(当库存低于此值时触发补充 | [optional] [default to undefined] |
| **targetCapacity** | **number** | 该面额预拉取订单目标库存(补充时的目标数量) | [optional] [default to undefined] |
| Name | Type | Description | Notes |
| ---------------- | ---------- | ---------------------------------------- | --------------------------------- |
| **denomination** | **number** | 面额值如100、200、500等 | [optional] [default to undefined] |
| **capacity** | **number** | 该面额预拉取订单库存值(统一的库存阈值 | [optional] [default to undefined] |
## Example
@@ -15,8 +14,7 @@ import { KamiApiCamelOilV1DenominationSetting } from './api';
const instance: KamiApiCamelOilV1DenominationSetting = {
denomination,
minCapacity,
targetCapacity
capacity
};
```

View File

@@ -18,11 +18,7 @@ export interface KamiApiCamelOilV1DenominationSetting {
*/
denomination?: number;
/**
* 该面额预拉取订单最小库存值(当库存低于此值时触发补充
* 该面额预拉取订单库存值(统一的库存阈值
*/
minCapacity?: number;
/**
* 该面额预拉取订单目标库存(补充时的目标数量)
*/
targetCapacity?: number;
capacity?: number;
}

View File

@@ -159,7 +159,7 @@
<a-space>
<icon-currency-dollar />
<span style="color: var(--color-text-3); font-size: 13px">
配置不同面额卡券的最小库存和目标库存当库存低于最小值时自动补充到目标值
配置不同面额卡券的库存阈值系统将根据此阈值管理预拉取订单库存
</span>
</a-space>
</template>
@@ -194,19 +194,11 @@
@change="validateDenomination(rowIndex)"
/>
</template>
<template #minCapacity="{ rowIndex }">
<template #capacity="{ rowIndex }">
<a-input-number
v-model="formModel.targetDenominations[rowIndex].minCapacity"
:min="0"
placeholder="库存低于此值时触发补充可为0"
style="width: 100%"
/>
</template>
<template #targetCapacity="{ rowIndex }">
<a-input-number
v-model="formModel.targetDenominations[rowIndex].targetCapacity"
v-model="formModel.targetDenominations[rowIndex].capacity"
:min="1"
placeholder="补充时的目标数量"
placeholder="请输入库存阈值"
style="width: 100%"
/>
</template>
@@ -273,16 +265,10 @@ const columns: TableColumnData[] = [
slotName: 'denomination'
},
{
title: '最小库存',
dataIndex: 'minCapacity',
title: '库存阈值',
dataIndex: 'capacity',
width: 150,
slotName: 'minCapacity'
},
{
title: '目标库存',
dataIndex: 'targetCapacity',
width: 150,
slotName: 'targetCapacity'
slotName: 'capacity'
},
{
title: '操作',
@@ -295,8 +281,7 @@ const columns: TableColumnData[] = [
const addDenomination = () => {
formModel.targetDenominations.push({
denomination: null,
minCapacity: null,
targetCapacity: null
capacity: null
});
};
@@ -338,16 +323,12 @@ const handleSubmit = async () => {
) {
for (let i = 0; i < formModel.targetDenominations.length; i++) {
const item = formModel.targetDenominations[i];
if (
!item.denomination ||
item.minCapacity === null ||
!item.targetCapacity
) {
if (!item.denomination || !item.capacity) {
Message.warning(`请完善第${i + 1}个面额设置的必填项`);
return;
}
if (item.minCapacity >= item.targetCapacity) {
Message.warning(`${i + 1}个面额设置的最小库存必须小于目标库存`);
if (item.capacity < 1) {
Message.warning(`${i + 1}个面额设置的库存阈值必须大于0`);
return;
}
}