first commit
This commit is contained in:
commit
db5762abd4
687 files changed
+171307
No files matched your search
@@ -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
Reference in new issue
Block a user