修复商品库存与网络摘要并校验订购编号
This commit is contained in:
1 parent
28894e0813
commit
d8224ec5b7
15 files changed
+529
-68
No files matched your search
@@ -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,
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user