修复商品库存与网络摘要并校验订购编号
This commit is contained in:
1 parent
28894e0813
commit
d8224ec5b7
15 files changed
+529
-68
No files matched your search
@@ -58,6 +58,7 @@ import { r as order_image_continuation_r } from "~/lib/order-image-continuation.
|
||||
import MfDcimConfig from "~/components/config/MfDcimConfig.vue";
|
||||
import { t as composables_t } from "~/lib/composables-2.js";
|
||||
import { t as product_description_data_t } from "~/lib/product-description-data.js";
|
||||
import { productId } from "~/lib/product-id.js";
|
||||
var j = {
|
||||
class: `page product-order-page`,
|
||||
},
|
||||
@@ -83,7 +84,7 @@ var j = {
|
||||
let b = useRoute(),
|
||||
I = useRouter(),
|
||||
L = useApi(),
|
||||
R = String(b.params.id ?? b.query.id ?? b.query.product_id ?? ``),
|
||||
R = b.params.id ?? b.query.id ?? b.query.product_id ?? ``,
|
||||
z = order_image_continuation_r(b.query.order_image),
|
||||
B = b.fullPath;
|
||||
composables_t({
|
||||
@@ -132,7 +133,7 @@ var j = {
|
||||
let e = ++Z;
|
||||
((W.value = !0), (G.value = ``), (H.value = null), (U.value = null));
|
||||
try {
|
||||
if (!/^[1-9]\d*$/.test(R)) throw Error(`商品编号无效`);
|
||||
if (productId(R) === null) throw Error(`商品编号无效`);
|
||||
let t = await L.get(`/product/${R}`);
|
||||
if (e !== Z) return;
|
||||
let n = t?.product ?? t;
|
||||
|
||||
@@ -60,6 +60,7 @@ import KkyEcsConfig from "~/components/config/KkyEcsConfig.vue";
|
||||
import MfCloudConfig from "~/components/config/MfCloudConfig.vue";
|
||||
import { t as composables_t } from "~/lib/composables-2.js";
|
||||
import { t as product_description_data_t } from "~/lib/product-description-data.js";
|
||||
import { productId } from "~/lib/product-id.js";
|
||||
var ge = {
|
||||
class: `cloud-order-page`,
|
||||
},
|
||||
@@ -135,6 +136,7 @@ var ge = {
|
||||
? `库存待确认`
|
||||
: `暂时缺货`,
|
||||
G = (e) =>
|
||||
productId(e.id) !== null &&
|
||||
Number(e.hidden ?? 0) !== 1 &&
|
||||
(e.product_group_id_second == null ||
|
||||
Number(e.product_group_id_second) === T.value);
|
||||
@@ -208,7 +210,7 @@ var ge = {
|
||||
((E.value = (t.list ?? []).filter(G)),
|
||||
(I.value = Number(t.count) || 0),
|
||||
(A.value = !1));
|
||||
let n = Number(C.query.id ?? C.query.product_id),
|
||||
let n = productId(C.query.id ?? C.query.product_id),
|
||||
r =
|
||||
E.value.find((e) => e.id === n && !U(e)) ??
|
||||
E.value.find((e) => !U(e));
|
||||
@@ -238,6 +240,10 @@ var ge = {
|
||||
(j.value = !1),
|
||||
(A.value = !1));
|
||||
try {
|
||||
// 显式指定的商品编号无效时就地提示,不改选首件商品,更不把超限值交给后端。
|
||||
const requestedId = C.query.id ?? C.query.product_id;
|
||||
if (requestedId !== undefined && productId(requestedId) === null)
|
||||
throw Error(`商品编号无效`);
|
||||
let [t, n] = await Promise.all([
|
||||
S.get(`/product/group/first`),
|
||||
S.get(`/product/group/second`),
|
||||
|
||||
@@ -43,6 +43,7 @@ import MfDcimConfig from "~/components/config/MfDcimConfig.vue";
|
||||
import { t as composables_t } from "~/lib/composables-2.js";
|
||||
import { t as product_description_data_t } from "~/lib/product-description-data.js";
|
||||
import index from "~/pages/products/dedicated-server/index.vue";
|
||||
import { productId } from "~/lib/product-id.js";
|
||||
var A = {
|
||||
key: 1,
|
||||
class: `dedicated-customize`,
|
||||
@@ -65,7 +66,7 @@ var A = {
|
||||
let x = useRoute(),
|
||||
P = useRouter(),
|
||||
F = useApi(),
|
||||
I = computed(() => String(x.query.id ?? x.query.product_id ?? ``));
|
||||
I = computed(() => x.query.id ?? x.query.product_id ?? ``);
|
||||
composables_t({
|
||||
key: (e) => e.fullPath,
|
||||
});
|
||||
@@ -85,7 +86,7 @@ var A = {
|
||||
t = I.value;
|
||||
((R.value = !0), (z.value = ``), (L.value = null));
|
||||
try {
|
||||
if (!/^[1-9]\d*$/.test(t)) throw Error(`商品编号无效`);
|
||||
if (productId(t) === null) throw Error(`商品编号无效`);
|
||||
let n = await F.get(`/product/${t}`);
|
||||
if (e !== U) return;
|
||||
let r = n?.product ?? n;
|
||||
|
||||
@@ -32,6 +32,9 @@ import { n as product_name_n } from "~/lib/product-name.js";
|
||||
import inputnumber from "primevue/inputnumber";
|
||||
import tag from "primevue/tag";
|
||||
import skeleton from "primevue/skeleton";
|
||||
import { productStock } from "~/lib/product-inventory.js";
|
||||
import { resourceOptionValue } from "~/lib/resource-option-value.js";
|
||||
import { productId } from "~/lib/product-id.js";
|
||||
// 只识别本地或资源模块映射到 mf_dcim 的物理商品;未知模块不强行套用配置器。
|
||||
function O(e) {
|
||||
let t = e.module?.trim() || ``;
|
||||
@@ -122,14 +125,8 @@ function k() {
|
||||
}
|
||||
// 商品库存与自动同步的机型库存都满足时才允许选购。
|
||||
function w(e) {
|
||||
return (
|
||||
!(e.product.stock_control === 1 && Number(e.product.qty) <= 0) &&
|
||||
!(
|
||||
e.model.auto_sync_dcim_stock === 1 &&
|
||||
e.model.qty !== void 0 &&
|
||||
Number(e.model.qty) <= 0
|
||||
)
|
||||
);
|
||||
const stock = productStock(e.product, e.model);
|
||||
return stock === null || stock > 0;
|
||||
}
|
||||
// 分页收集商品后并行加载物理模块配置;单个商品失败保留其余可用项并提示部分加载失败。
|
||||
async function T() {
|
||||
@@ -158,7 +155,7 @@ function k() {
|
||||
}
|
||||
let o = t.flatMap((e) => {
|
||||
let t = O(e);
|
||||
return e.hidden !== 1 && t
|
||||
return e.hidden !== 1 && productId(e.id) !== null && t
|
||||
? [
|
||||
{
|
||||
product: {
|
||||
@@ -851,15 +848,20 @@ var te = {
|
||||
),
|
||||
t.lines.length
|
||||
? unref(s).inStock(t)
|
||||
? t.model.qty !== void 0 &&
|
||||
t.model.qty >= 0
|
||||
? productStock(
|
||||
t.product,
|
||||
t.model,
|
||||
) !== null
|
||||
? (openBlock(),
|
||||
createElementBlock(
|
||||
`span`,
|
||||
B,
|
||||
`剩余 ` +
|
||||
toDisplayString(
|
||||
t.model.qty,
|
||||
productStock(
|
||||
t.product,
|
||||
t.model,
|
||||
),
|
||||
) +
|
||||
` 台`,
|
||||
1,
|
||||
@@ -1100,8 +1102,8 @@ var te = {
|
||||
toDisplayString(
|
||||
unref(H)[t.id]
|
||||
?.bill_type === `flow`
|
||||
? `${unref(H)[t.id]?.flow?.[0]?.value ?? `—`} GB`
|
||||
: `${unref(H)[t.id]?.bw?.[0]?.value ?? `—`} Mbps`,
|
||||
? `${resourceOptionValue(unref(H)[t.id]?.flow?.[0]) ?? `—`} GB`
|
||||
: `${resourceOptionValue(unref(H)[t.id]?.bw?.[0]) ?? `—`} Mbps`,
|
||||
),
|
||||
1,
|
||||
),
|
||||
|
||||
@@ -51,6 +51,7 @@ import { n as ProductConfigurationSummary_n } from "~/components/ProductConfigur
|
||||
import ProductConfigurationSummary from "~/components/ProductConfigurationSummary.vue";
|
||||
import ProductDescription from "~/components/ProductDescription.vue";
|
||||
import ProductGroupLabel from "~/components/ProductGroupLabel.vue";
|
||||
import { productId } from "~/lib/product-id.js";
|
||||
var j = rolldown_runtime_i(getCrypto(), 1),
|
||||
M = 2592e6,
|
||||
N = 100,
|
||||
@@ -613,17 +614,19 @@ var me = {
|
||||
a || ((T.value = []), (E.value = 0), (A.value = !1));
|
||||
let s = await t.get(`/product`, r);
|
||||
if (n !== W) return;
|
||||
((T.value = (s.list ?? []).map((t) => ({
|
||||
...t,
|
||||
startingPrice: q(t)
|
||||
? (o.get(t.id)?.startingPrice ?? null)
|
||||
: void 0,
|
||||
configurationSummary: product_name_t(t.name)
|
||||
? e
|
||||
? o.get(t.id)?.configurationSummary
|
||||
: y.peek(t)
|
||||
: [],
|
||||
}))),
|
||||
((T.value = (s.list ?? [])
|
||||
.filter((t) => productId(t.id) !== null)
|
||||
.map((t) => ({
|
||||
...t,
|
||||
startingPrice: q(t)
|
||||
? (o.get(t.id)?.startingPrice ?? null)
|
||||
: void 0,
|
||||
configurationSummary: product_name_t(t.name)
|
||||
? e
|
||||
? o.get(t.id)?.configurationSummary
|
||||
: y.peek(t)
|
||||
: [],
|
||||
}))),
|
||||
(E.value = Number(s.count) || 0),
|
||||
(K = i),
|
||||
(A.value = !0));
|
||||
|
||||
Reference in new issue
Block a user