first commit

This commit is contained in:
cieanyau committed 2026-11-06 00:04:38 +08:00
commit db5762abd4
687 files changed
+171307

No files matched your search

+460
View File
@@ -0,0 +1,460 @@
<script>
import "~/assets/styles/MfDcimConfig.BhC_eZ0V.css";
import "~/assets/styles/MfCloudConfig.DbgUu8qr.css";
import "~/assets/styles/KkyEcsConfig.BFaAwQPZ.css";
import "~/assets/styles/ConfigResourceOption.Dj4VopnA.css";
import "~/assets/styles/ConfigDiskAdd.C92e9ZuF.css";
import "~/assets/styles/ConfigBandwidth.CWSH1WJZ.css";
import "~/assets/styles/JyCloudConfig.kGfttaHi.css";
import "~/assets/styles/FinanceConfig.CLwX1CC8.css";
import "~/assets/styles/ConfigDiskCard.Dx9IqqQ_.css";
import "~/assets/styles/PromoCodeField.qFEkB6Hm.css";
import "~/assets/styles/ProductCustomFields.B2QMnPil.css";
import "~/assets/styles/OsIcon.CAi4Iz2S.css";
import "~/assets/styles/CommonConfig.Cfik-oMe.css";
import "~/assets/styles/PaymentDialog.BNFKQF1U.css";
import "~/assets/styles/_id_.CSXsMADH.css";
definePageMeta({
key: (e) => e.fullPath,
});
import { toDisplayString } from "vue";
import { onMounted } from "vue";
import { onScopeDispose } from "vue";
import { createBlock } from "vue";
import { ref } from "vue";
import { withCtx } from "vue";
import { createCommentVNode } from "vue";
import { computed } from "vue";
import { isRef } from "vue";
import { createElementBlock } from "vue";
import { Fragment } from "vue";
import { createElementVNode } from "vue";
import { createTextVNode } from "vue";
import { unref } from "vue";
import { defineComponent } from "vue";
import { createVNode } from "vue";
import { openBlock } from "vue";
import { useRoute } from "#app";
import { useRouter } from "#app";
import { NuxtLink } from "#components";
import { useApi } from "~/lib/auth.js";
import button from "primevue/button";
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
import message from "primevue/message";
import { n as product_name_n } from "~/lib/product-name.js";
import PaymentDialog from "~/components/PaymentDialog.vue";
import { t as product_order_module_t } from "~/lib/product-order-module.js";
import ConfigLoadingShell from "~/components/config/ConfigLoadingShell.vue";
import { n as cart_edit_n } from "~/lib/cart-edit.js";
import CommonConfig from "~/components/config/CommonConfig.vue";
import FinanceConfig from "~/components/config/FinanceConfig.vue";
import JyCloudConfig from "~/components/config/JyCloudConfig.vue";
import KkyEcsConfig from "~/components/config/KkyEcsConfig.vue";
import MfCloudConfig from "~/components/config/MfCloudConfig.vue";
import { r as order_image_continuation_r } from "~/lib/order-image-continuation.js";
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";
var j = {
class: `page product-order-page`,
},
M = {
class: `product-head`,
},
N = {
class: `product-links`,
"aria-label": `订购导航`,
},
P = {
key: 1,
class: `panel config-load-error`,
},
F = {
key: 6,
class: `panel`,
},
I = _plugin_vue_export_helper_t(
defineComponent({
__name: `[id]`,
setup(f) {
let b = useRoute(),
I = useRouter(),
L = useApi(),
R = String(b.params.id ?? b.query.id ?? b.query.product_id ?? ``),
z = order_image_continuation_r(b.query.order_image),
B = b.fullPath;
composables_t({
key: (e) => e.fullPath,
});
function V() {
let e = {},
t = b.query.g ?? b.query.first_group_id,
n = b.query.sg ?? b.query.second_group_id;
return (
typeof t == `string` && /^[1-9]\d*$/.test(t) && (e.g = t),
typeof n == `string` && /^[1-9]\d*$/.test(n) && (e.sg = n),
{
path: `/products`,
query: e,
}
);
}
let H = ref(null),
U = ref(null),
W = ref(!0),
G = ref(``),
K = computed(() => {
let e = b.query.edit_position;
if (typeof e != `string` || !/^\d+$/.test(e)) return null;
let t = Number(e);
return Number.isInteger(t) && t >= 0 ? t : null;
}),
q = computed(() => {
if (K.value !== null && U.value)
return {
position: K.value,
item: U.value,
};
}),
J = ref(!1),
Y = ref(null),
X = ref(``),
Z = 0;
onScopeDispose(() => {
Z++;
});
async function Q() {
let e = ++Z;
((W.value = !0), (G.value = ``), (H.value = null), (U.value = null));
try {
if (!/^[1-9]\d*$/.test(R)) throw Error(`商品编号无效`);
let t = await L.get(`/product/${R}`);
if (e !== Z) return;
let n = t?.product ?? t;
if (
!n ||
typeof n != `object` ||
!n.id ||
Number(n.id) !== Number(R)
)
throw Error(`商品不存在或已下架`);
let r = n;
if (r.order_allowed === !1)
throw Error(r.order_block_reason || `该产品已停止订购`);
if (K.value !== null) {
let t = (await L.get(`/cart`))?.list?.[K.value];
if (!t || Number(t.product_id) !== Number(R))
throw Error(`购物车商品已变化,请返回购物车重新编辑`);
if (e !== Z) return;
U.value = cart_edit_n(t);
}
let i = await product_order_module_t(L, r);
if (e !== Z) return;
((H.value = {
...r,
module: i,
}),
product_description_data_t(L, r).then((t) => {
e === Z && H.value && (H.value.description = t);
}));
} catch (t) {
e === Z &&
(G.value = t instanceof Error ? t.message : `加载商品失败`);
} finally {
e === Z && (W.value = !1);
}
}
function $(e) {
((Y.value = e.order_id), (X.value = e.amount), (J.value = !0));
}
function se() {
I.push(`/orders`);
}
return (
onMounted(Q),
(t, n) => {
let i = NuxtLink,
o = ConfigLoadingShell,
f = message,
h = button,
g = MfCloudConfig,
v = MfDcimConfig,
b = CommonConfig,
C = FinanceConfig,
T = KkyEcsConfig,
O = PaymentDialog;
return (
openBlock(),
createElementBlock(`div`, j, [
createElementVNode(`header`, M, [
createElementVNode(`div`, null, [
createElementVNode(
`h1`,
null,
toDisplayString(
unref(product_name_n)(unref(H)?.name) || `配置产品`,
),
1,
),
createElementVNode(
`p`,
null,
toDisplayString(
unref(q)
? `编辑购物车商品配置,保存后返回购物车结算。`
: `选择所需资源,确认配置与费用后购买。`,
),
1,
),
]),
createElementVNode(`nav`, N, [
createVNode(
i,
{
to: V(),
class: `back`,
},
{
default: withCtx(() => [
...(n[1] ||= [
createElementVNode(
`i`,
{
class: `pi pi-angle-left`,
"aria-hidden": `true`,
},
null,
-1,
),
createTextVNode(`返回产品列表`, -1),
]),
]),
_: 1,
},
8,
[`to`],
),
createVNode(
i,
{
to: `/cart`,
class: `cart-link`,
},
{
default: withCtx(() => [
...(n[2] ||= [
createElementVNode(
`i`,
{
class: `pi pi-shopping-cart`,
"aria-hidden": `true`,
},
null,
-1,
),
createTextVNode(`购物车`, -1),
]),
]),
_: 1,
},
),
]),
]),
unref(W)
? (openBlock(),
createBlock(o, {
key: 0,
}))
: unref(G) && !unref(H)
? (openBlock(),
createElementBlock(`div`, P, [
createVNode(
f,
{
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(toDisplayString(unref(G)), 1),
]),
_: 1,
},
),
createVNode(h, {
label: `重新加载商品`,
icon: `pi pi-refresh`,
severity: `secondary`,
text: ``,
onClick: Q,
}),
]))
: unref(H)
? (openBlock(),
createElementBlock(
Fragment,
{
key: 2,
},
[
unref(H).module === `mf_cloud` ||
unref(H).module === `remf_cloud`
? (openBlock(),
createBlock(
g,
{
key: 0,
"product-id": unref(R),
module: unref(H).module,
"initial-image-id": unref(z),
"continuation-path": unref(B),
"initial-product": unref(H),
edit: unref(q),
onSettled: $,
},
null,
8,
[
`product-id`,
`module`,
`initial-image-id`,
`continuation-path`,
`initial-product`,
`edit`,
],
))
: unref(H).module === `mf_dcim` ||
unref(H).module === `remf_dcim`
? (openBlock(),
createBlock(
v,
{
key: 1,
"product-id": unref(R),
module: unref(H).module,
"initial-product": unref(H),
edit: unref(q),
onSettled: $,
},
null,
8,
[
`product-id`,
`module`,
`initial-product`,
`edit`,
],
))
: unref(H).module === `jy_cloud` ||
unref(H).module === `jy_dcim`
? (openBlock(),
createBlock(
JyCloudConfig,
{
key: 2,
"product-id": unref(R),
module: unref(H).module,
edit: unref(q),
onSettled: $,
},
null,
8,
[`product-id`, `module`, `edit`],
))
: unref(H).module === `idcsmart_common`
? (openBlock(),
createBlock(
b,
{
key: 3,
"product-id": unref(R),
edit: unref(q),
onSettled: $,
},
null,
8,
[`product-id`, `edit`],
))
: [
`remf_finance`,
`remf_finance_dcim`,
`remf_finance_common`,
].includes(unref(H).module || ``)
? (openBlock(),
createBlock(
C,
{
key: 4,
"product-id": unref(R),
module: unref(H).module,
edit: unref(q),
onSettled: $,
},
null,
8,
[`product-id`, `module`, `edit`],
))
: unref(H).module === `kky_ecs`
? (openBlock(),
createBlock(
T,
{
key: 5,
"product-id": unref(R),
edit: unref(q),
onSettled: $,
},
null,
8,
[`product-id`, `edit`],
))
: (openBlock(),
createElementBlock(`div`, F, [
createVNode(
f,
{
severity: `warn`,
closable: !1,
},
{
default: withCtx(() => [
...(n[3] ||= [
createTextVNode(
` 该商品暂不支持在线配置,请联系客服下单。 `,
-1,
),
]),
]),
_: 1,
},
),
])),
],
64,
))
: createCommentVNode(``, !0),
createVNode(
O,
{
modelValue: unref(J),
"onUpdate:modelValue": (n[0] ||= (e) =>
isRef(J) ? (J.value = e) : null),
"order-id": unref(Y),
amount: unref(X),
onSuccess: se,
},
null,
8,
[`modelValue`, `order-id`, `amount`],
),
])
);
}
);
},
}),
[[`__scopeId`, `data-v-49461ec8`]],
);
export {};
export default I;
</script>
+494
View File
@@ -0,0 +1,494 @@
<script>
import "~/assets/styles/MfCloudConfig.DbgUu8qr.css";
import "~/assets/styles/KkyEcsConfig.BFaAwQPZ.css";
import "~/assets/styles/ConfigResourceOption.Dj4VopnA.css";
import "~/assets/styles/ConfigDiskAdd.C92e9ZuF.css";
import "~/assets/styles/ConfigBandwidth.CWSH1WJZ.css";
import "~/assets/styles/JyCloudConfig.kGfttaHi.css";
import "~/assets/styles/FinanceConfig.CLwX1CC8.css";
import "~/assets/styles/ConfigDiskCard.Dx9IqqQ_.css";
import "~/assets/styles/PromoCodeField.qFEkB6Hm.css";
import "~/assets/styles/ProductCustomFields.B2QMnPil.css";
import "~/assets/styles/OsIcon.CAi4Iz2S.css";
import "~/assets/styles/CommonConfig.Cfik-oMe.css";
import "~/assets/styles/CloudProductPicker.CAm9rmUl.css";
import "~/assets/styles/ProductGroupLabel.B1kWpFA-.css";
import "~/assets/styles/PaymentDialog.BNFKQF1U.css";
import "~/assets/styles/cloud-server.CcwlOXJ0.css";
definePageMeta({
key: (e) => e.fullPath,
alias: [`/products/cvm`],
});
import { toDisplayString } from "vue";
import { onMounted } from "vue";
import { resolveDynamicComponent } from "vue";
import { onScopeDispose } from "vue";
import { createBlock } from "vue";
import { ref } from "vue";
import { withCtx } from "vue";
import { createCommentVNode } from "vue";
import { mergeProps } from "vue";
import { computed } from "vue";
import { isRef } from "vue";
import { createElementBlock } from "vue";
import { toHandlers } from "vue";
import { createElementVNode } from "vue";
import { createTextVNode } from "vue";
import { unref } from "vue";
import { defineComponent } from "vue";
import { createVNode } from "vue";
import { openBlock } from "vue";
import { useRoute } from "#app";
import { useRouter } from "#app";
import { useHead } from "#app";
import { useApi } from "~/lib/auth.js";
import button from "primevue/button";
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
import message from "primevue/message";
import PaymentDialog from "~/components/PaymentDialog.vue";
import { t as product_order_module_t } from "~/lib/product-order-module.js";
import { n as ProductGroupLabel_n } from "~/components/ProductGroupLabel.vue";
import CloudProductPicker from "~/components/config/CloudProductPicker.vue";
import ConfigLoadingShell from "~/components/config/ConfigLoadingShell.vue";
import CommonConfig from "~/components/config/CommonConfig.vue";
import FinanceConfig from "~/components/config/FinanceConfig.vue";
import JyCloudConfig from "~/components/config/JyCloudConfig.vue";
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";
var ge = {
class: `cloud-order-page`,
},
_e = {
key: 0,
class: `product-switch-status`,
role: `status`,
},
S = _plugin_vue_export_helper_t(
defineComponent({
__name: `cloud-server`,
setup(m) {
let y = new Set([
`云服务器`,
`轻量云服务器`,
`国内云服务器`,
`香港云服务器`,
`弹性云服务器`,
]);
(composables_t({
alias: `/products/cvm`,
key: (e) => e.fullPath,
}),
useHead({
title: `创建云服务器实例 - 破碎工坊网络`,
}));
let S = useApi(),
C = useRoute(),
ve = useRouter(),
w = ref([]),
T = ref(null),
E = ref([]),
D = ref(null),
O = ref(null),
k = ref(!0),
A = ref(!1),
j = ref(!1),
M = ref(``),
N = ref(`groups`),
P = ref(``),
F = ref(0),
ye = computed(() => j.value || !!P.value || O.value !== D.value?.id),
I = ref(0),
L = ref(1),
R = 0,
z = 0;
onScopeDispose(() => {
(R++, z++);
});
let be = {
mf_cloud: MfCloudConfig,
remf_cloud: MfCloudConfig,
jy_cloud: JyCloudConfig,
jy_dcim: JyCloudConfig,
kky_ecs: KkyEcsConfig,
idcsmart_common: CommonConfig,
remf_finance: FinanceConfig,
},
B = computed(() => be[D.value?.module ?? ``]),
V = computed(() =>
D.value?.module === `mf_cloud` || D.value?.module === `remf_cloud`
? D.value.module
: void 0,
),
H = computed(() =>
D.value?.module === `jy_cloud` || D.value?.module === `jy_dcim`
? D.value.module
: void 0,
),
U = (e) => Number(e.stock_control) === 1 && !(Number(e.qty) > 0),
W = (e) =>
e.qty == null || !Number.isFinite(Number(e.qty))
? `库存待确认`
: `暂时缺货`,
G = (e) =>
Number(e.hidden ?? 0) !== 1 &&
(e.product_group_id_second == null ||
Number(e.product_group_id_second) === T.value);
async function K(e) {
let t = E.value.find((t) => t.id === e);
if (
!t ||
!G(t) ||
U(t) ||
(O.value === e && (j.value || (D.value?.id === e && !P.value)))
)
return;
let n = ++z;
((O.value = e), (P.value = ``), (j.value = !0));
try {
let r = await S.get(`/product/${e}`);
if (n !== z) return;
let i = r?.product ?? r;
if (!i?.id || Number(i.id) !== e) throw Error(`商品不存在或已下架`);
let a = {
...t,
...i,
};
if (
(typeof i.description != `string` &&
typeof t.description == `string` &&
(a.description = t.description),
!G(a))
)
throw Error(`商品不存在或已下架`);
if (U(a)) throw Error(`当前商品${W(a)},请稍后重试`);
let o = await product_order_module_t(S, a);
if (n !== z) return;
(F.value++,
(D.value = {
...a,
module: o,
}),
product_description_data_t(S, a).then((e) => {
n === z && D.value && (D.value.description = e);
}));
} catch (e) {
n === z &&
(P.value = e instanceof Error ? e.message : `商品配置加载失败`);
} finally {
n === z && (j.value = !1);
}
}
async function q() {
let e = ++R;
(z++,
(E.value = []),
(D.value = null),
(O.value = null),
(j.value = !1),
(P.value = ``),
(I.value = 0),
(M.value = ``),
(N.value = `products`),
(A.value = !0));
try {
if (!T.value || !w.value.some((e) => e.id === T.value)) return;
let t = await S.get(`/product`, {
id: T.value,
page: L.value,
limit: 24,
});
if (e !== R) return;
((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),
r =
E.value.find((e) => e.id === n && !U(e)) ??
E.value.find((e) => !U(e));
r && (await K(r.id));
} catch (t) {
e === R &&
(M.value = t instanceof Error ? t.message : `产品加载失败`);
} finally {
e === R && (A.value = !1);
}
}
async function J() {
let e = ++R;
(z++,
(k.value = !0),
(M.value = ``),
(N.value = `groups`),
(P.value = ``),
(w.value = []),
(T.value = null),
(E.value = []),
(D.value = null),
(O.value = null),
(I.value = 0),
(L.value = 1),
(j.value = !1),
(A.value = !1));
try {
let [t, n] = await Promise.all([
S.get(`/product/group/first`),
S.get(`/product/group/second`),
]);
if (e !== R) return;
let r = new Set(
(t.list ?? [])
.filter((e) => y.has(ProductGroupLabel_n(e.name).name))
.map((e) => Number(e.id)),
);
((w.value = (n.list ?? []).filter((e) =>
r.has(Number(e.parent_id)),
)),
(T.value = w.value[0]?.id ?? null),
(k.value = !1),
await q());
} catch (t) {
e === R &&
(M.value = t instanceof Error ? t.message : `线路加载失败`);
} finally {
e === R && (k.value = !1);
}
}
function xe(e) {
T.value !== e &&
w.value.some((t) => t.id === e) &&
((T.value = e), (L.value = 1), q());
}
function Se(e) {
((L.value = e.page + 1), q());
}
let Y = ref(!1),
X = ref(null),
Z = ref(``);
function Ce(e) {
((X.value = e.order_id), (Z.value = e.amount), (Y.value = !0));
}
function we() {
((Y.value = !1),
X.value && ve.push(`/orders/order/paid?id=${X.value}`));
}
let Q = computed(() => ({
groups: w.value,
activeGroup: T.value,
products: E.value,
selectedId: O.value,
loading: k.value,
productLoading: A.value,
error: M.value,
errorSource: N.value,
total: I.value,
page: L.value,
soldOut: U,
stockLabel: W,
})),
$ = {
"choose-group": xe,
"choose-product": K,
"retry-groups": J,
"retry-products": q,
paginate: Se,
};
return (
onMounted(J),
(t, r) => {
let a = CloudProductPicker,
l = button,
m = message,
_ = ConfigLoadingShell,
v = PaymentDialog;
return (
openBlock(),
createElementBlock(`div`, ge, [
(r[4] ||= createElementVNode(
`h2`,
null,
`创建云服务器实例`,
-1,
)),
unref(D) && unref(B)
? (openBlock(),
createBlock(
resolveDynamicComponent(unref(B)),
mergeProps(
{
key: `${unref(D).id}-${unref(F)}`,
"product-id": unref(D).id,
"identity-locked": unref(ye),
},
unref(V)
? {
module: unref(V),
initialProduct: unref(D),
}
: unref(H)
? {
module: unref(H),
}
: {},
{
onSettled: Ce,
},
),
{
catalog: withCtx(({ disabled: t }) => [
createVNode(
a,
mergeProps(
unref(Q),
{
disabled: t,
},
toHandlers($),
),
null,
16,
[`disabled`],
),
unref(j)
? (openBlock(),
createElementBlock(
`p`,
_e,
`正在加载所选商品,原配置暂不可操作。`,
))
: unref(P)
? (openBlock(),
createBlock(
m,
{
key: 1,
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(
toDisplayString(unref(P)),
1,
),
unref(O)
? (openBlock(),
createBlock(l, {
key: 0,
label: `重新加载配置`,
severity: `secondary`,
text: ``,
onClick: (r[0] ||= (e) =>
K(unref(O))),
}))
: createCommentVNode(``, !0),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
]),
_: 1,
},
16,
[`product-id`, `identity-locked`],
))
: (openBlock(),
createBlock(
_,
{
key: 1,
busy: unref(k) || unref(A) || unref(j),
},
{
catalog: withCtx(() => [
createVNode(
a,
mergeProps(unref(Q), toHandlers($)),
null,
16,
),
unref(P)
? (openBlock(),
createBlock(
m,
{
key: 0,
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(
toDisplayString(unref(P)),
1,
),
unref(O)
? (openBlock(),
createBlock(l, {
key: 0,
label: `重新加载配置`,
severity: `secondary`,
text: ``,
onClick: (r[1] ||= (e) =>
K(unref(O))),
}))
: createCommentVNode(``, !0),
]),
_: 1,
},
))
: unref(D)
? (openBlock(),
createBlock(
m,
{
key: 1,
severity: `warn`,
closable: !1,
},
{
default: withCtx(() => [
...(r[3] ||= [
createTextVNode(
`当前商品暂不支持在线配置,请通过工单咨询。`,
-1,
),
]),
]),
_: 1,
},
))
: createCommentVNode(``, !0),
]),
_: 1,
},
8,
[`busy`],
)),
createVNode(
v,
{
modelValue: unref(Y),
"onUpdate:modelValue": (r[2] ||= (e) =>
isRef(Y) ? (Y.value = e) : null),
"order-id": unref(X),
amount: unref(Z),
onSuccess: we,
},
null,
8,
[`modelValue`, `order-id`, `amount`],
),
])
);
}
);
},
}),
[[`__scopeId`, `data-v-ef3931f0`]],
);
export {};
export default S;
</script>
@@ -0,0 +1,255 @@
<script>
import "~/assets/styles/dedicated-server.CiJfMYtk.css";
import "~/assets/styles/ConfigDiskCard.Dx9IqqQ_.css";
import "~/assets/styles/PromoCodeField.qFEkB6Hm.css";
import "~/assets/styles/ProductCustomFields.B2QMnPil.css";
import "~/assets/styles/OsIcon.CAi4Iz2S.css";
import "~/assets/styles/MfDcimConfig.BhC_eZ0V.css";
import "~/assets/styles/PaymentDialog.BNFKQF1U.css";
import "~/assets/styles/customize.Cc123Awf.css";
definePageMeta({
key: (e) => e.fullPath,
});
import { toDisplayString } from "vue";
import { onMounted } from "vue";
import { onScopeDispose } from "vue";
import { createBlock } from "vue";
import { ref } from "vue";
import { withCtx } from "vue";
import { createCommentVNode } from "vue";
import { computed } from "vue";
import { isRef } from "vue";
import { createElementBlock } from "vue";
import { createElementVNode } from "vue";
import { createTextVNode } from "vue";
import { unref } from "vue";
import { defineComponent } from "vue";
import { createVNode } from "vue";
import { openBlock } from "vue";
import { useRoute } from "#app";
import { useRouter } from "#app";
import { NuxtLink } from "#components";
import { useApi } from "~/lib/auth.js";
import button from "primevue/button";
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
import message from "primevue/message";
import PaymentDialog from "~/components/PaymentDialog.vue";
import skeleton from "primevue/skeleton";
import { t as product_order_module_t } from "~/lib/product-order-module.js";
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";
var A = {
key: 1,
class: `dedicated-customize`,
},
j = {
class: `product-links`,
},
M = {
key: 0,
class: `panel`,
},
N = {
key: 1,
class: `panel config-load-error`,
},
P = _plugin_vue_export_helper_t(
defineComponent({
__name: `customize`,
setup(p) {
let x = useRoute(),
P = useRouter(),
F = useApi(),
I = computed(() => String(x.query.id ?? x.query.product_id ?? ``));
composables_t({
key: (e) => e.fullPath,
});
let L = ref(null),
R = ref(!0),
z = ref(``),
B = ref(!1),
V = ref(null),
H = ref(``),
U = 0;
onScopeDispose(() => {
U++;
});
async function W() {
let e = ++U,
t = I.value;
((R.value = !0), (z.value = ``), (L.value = null));
try {
if (!/^[1-9]\d*$/.test(t)) throw Error(`商品编号无效`);
let n = await F.get(`/product/${t}`);
if (e !== U) return;
let r = n?.product ?? n;
if (!r || Number(r.id) !== Number(t) || r.hidden === 1)
throw Error(`商品不存在或已下架`);
let i = r,
a = await product_order_module_t(F, i);
if (a !== `mf_dcim` && a !== `remf_dcim`)
throw Error(`该商品不支持物理服务器定制,请返回列表重新选择`);
((L.value = {
...i,
module: a,
}),
product_description_data_t(F, L.value).then((t) => {
e === U && L.value && (L.value.description = t);
}));
} catch (t) {
e === U &&
(z.value = t instanceof Error ? t.message : `加载商品失败`);
} finally {
e === U && (R.value = !1);
}
}
function G(e) {
((V.value = e.order_id), (H.value = e.amount), (B.value = !0));
}
return (
onMounted(() => {
I.value ? W() : (R.value = !1);
}),
(t, n) => {
let i = NuxtLink,
s = skeleton,
p = message,
g = button,
_ = MfDcimConfig,
y = PaymentDialog;
return unref(I)
? (openBlock(),
createElementBlock(`div`, A, [
createElementVNode(`header`, null, [
(n[4] ||= createElementVNode(
`h1`,
null,
`定制物理服务器`,
-1,
)),
createElementVNode(`div`, j, [
createVNode(
i,
{
to: `/products/dedicated-server`,
},
{
default: withCtx(() => [
...(n[2] ||= [
createElementVNode(
`i`,
{
class: `pi pi-angle-left`,
"aria-hidden": `true`,
},
null,
-1,
),
createTextVNode(`返回物理服务器列表`, -1),
]),
]),
_: 1,
},
),
createVNode(
i,
{
to: `/cart`,
},
{
default: withCtx(() => [
...(n[3] ||= [
createElementVNode(
`i`,
{
class: `pi pi-shopping-cart`,
"aria-hidden": `true`,
},
null,
-1,
),
createTextVNode(`购物车`, -1),
]),
]),
_: 1,
},
),
]),
]),
unref(R)
? (openBlock(),
createElementBlock(`div`, M, [
createVNode(s, {
height: `360px`,
}),
]))
: unref(z)
? (openBlock(),
createElementBlock(`div`, N, [
createVNode(
p,
{
severity: `error`,
closable: !1,
},
{
default: withCtx(() => [
createTextVNode(toDisplayString(unref(z)), 1),
]),
_: 1,
},
),
createVNode(g, {
label: `重新加载商品`,
icon: `pi pi-refresh`,
severity: `secondary`,
text: ``,
onClick: W,
}),
]))
: unref(L)
? (openBlock(),
createBlock(
_,
{
key: 2,
"product-id": unref(I),
module: unref(L).module,
"initial-product": unref(L),
onSettled: G,
},
null,
8,
[`product-id`, `module`, `initial-product`],
))
: createCommentVNode(``, !0),
createVNode(
y,
{
modelValue: unref(B),
"onUpdate:modelValue": (n[0] ||= (e) =>
isRef(B) ? (B.value = e) : null),
"order-id": unref(V),
amount: unref(H),
onSuccess: (n[1] ||= (e) => unref(P).push(`/orders`)),
},
null,
8,
[`modelValue`, `order-id`, `amount`],
),
]))
: (openBlock(),
createBlock(index, {
key: 0,
}));
}
);
},
}),
[[`__scopeId`, `data-v-5618b27d`]],
);
export {};
export default P;
</script>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff