修复商品库存与网络摘要并校验订购编号

This commit is contained in:
cieanyau committed 2026-11-06 04:48:38 +08:00
1 parent 28894e0813
commit d8224ec5b7
15 files changed
+529 -68

No files matched your search

+4 -10
View File
@@ -20,6 +20,8 @@ import { t as product_name_t } from "~/lib/product-name.js";
import { a as storage_capacity_a } from "~/lib/storage-capacity.js";
import { t as storage_capacity_t } from "~/lib/storage-capacity.js";
import { t as product_order_module_t } from "~/lib/product-order-module.js";
import { resourceOptionValue as k } from "~/lib/resource-option-value.js";
import { productId } from "~/lib/product-id.js";
var y = {
timeoutMs: 5e3,
},
@@ -142,14 +144,6 @@ function O(e) {
: ``);
return `${e.min}${t}`;
}
function k(e) {
return (
e &&
(e.type === `step` || e.type === `total`
? (e.min_value ?? e.value)
: e.value)
);
}
function A(e, t, n = ``) {
return {
label: e,
@@ -158,7 +152,7 @@ function A(e, t, n = ``) {
}
// 按真实订单模块读取配置;含级联或高级限制且无法安全推导默认值时不生成摘要。
async function j(e, t) {
if (!product_name_t(t.name)) return [];
if (!product_name_t(t.name) || productId(t.id) === null) return [];
let n = (t, n) => e.get(t, n, !1, y);
try {
let r = await product_order_module_t(
@@ -252,7 +246,7 @@ async function j(e, t) {
if (e.bill_type === `bw`) s.push(A(`带宽`, k(e.bw?.[0]), `Mbps`));
else if (e.bill_type === `flow`) {
let t = e.flow?.[0];
s.push(A(`流量`, t?.value, `GB`));
s.push(A(`流量`, k(t), `GB`));
let n = t?.bw?.[0] ?? t?.other_config;
n &&
s.push(
+1 -8
View File
@@ -60,14 +60,7 @@ import ConfigResourceOption from "~/components/config/ConfigResourceOption.vue";
import { t as password_t } from "~/lib/password-2.js";
import { n as order_image_continuation_n } from "~/lib/order-image-continuation.js";
import { t as order_image_continuation_t } from "~/lib/order-image-continuation.js";
function I(e) {
if (e)
return Number(
e.type === `step` || e.type === `total`
? (e.min_value ?? e.value)
: e.value,
);
}
import { resourceOptionValue as I } from "~/lib/resource-option-value.js";
function L(e, t) {
// 区间内的值还必须落在步长网格上,不能仅凭最小/最大值认定配置可购买。
if (t == null || t === ``) return !1;
+5 -17
View File
@@ -51,6 +51,8 @@ import { o as cart_edit_o } from "~/lib/cart-edit.js";
import { r as cart_edit_r } from "~/lib/cart-edit.js";
import ConfigDiskCard from "~/components/config/ConfigDiskCard.vue";
import slider from "primevue/slider";
import { productStock } from "~/lib/product-inventory.js";
import { resourceOptionValue } from "~/lib/resource-option-value.js";
function z(e, t = {}, n = `mf_dcim`, r = {}) {
// 商品库存与型号同步库存可能同时生效;可购数量取所有有效限制中的最小值。
let i = useApi(),
@@ -108,17 +110,7 @@ function z(e, t = {}, n = `mf_dcim`, r = {}) {
h.value?.model_config.find((e) => e.id === D.value.model_config_id),
),
ne = computed(() => A.value.find((e) => e.id === D.value.line_id)),
re = computed(() => {
let e = [
m.value?.stock_control === 1 ? m.value.qty : void 0,
j.value?.auto_sync_dcim_stock === 1 ? j.value.qty : void 0,
]
.filter(
(e) => e !== void 0 && Number.isFinite(Number(e)) && Number(e) >= 0,
)
.map(Number);
return e.length ? Math.min(...e) : null;
}),
re = computed(() => productStock(m.value, j.value)),
ie = computed(() => re.value === null || C.value <= re.value),
F = computed(() =>
JSON.stringify({
@@ -188,12 +180,8 @@ function z(e, t = {}, n = `mf_dcim`, r = {}) {
}));
let q = (e) => !V && e === z,
le = (e) => {
let t = e?.[0];
return t
? String(
t.type && t.type !== `radio` ? (t.min_value ?? t.value) : t.value,
)
: ``;
const value = resourceOptionValue(e?.[0]);
return value === undefined ? `` : String(value);
};
function ue() {
// 报价和提交共用前置校验,型号/线路/镜像与正整数数量缺一不可。