2826 lines
118 KiB
Vue
2826 lines
118 KiB
Vue
<script>
|
|
/**
|
|
* 魔方云系列商品配置:支持自选/推荐套餐、磁盘、网络、备份快照及商品开放的预付/按需模式。
|
|
* initialProduct/initialImageId 用于进入配置页时续接选择;真实成交价始终来自配置报价接口。
|
|
*/
|
|
import "~/assets/styles/ConfigResourceOption.Dj4VopnA.css";
|
|
import "~/assets/styles/ConfigDiskAdd.C92e9ZuF.css";
|
|
import "~/assets/styles/ConfigBandwidth.CWSH1WJZ.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/MfCloudConfig.DbgUu8qr.css";
|
|
import { toDisplayString } from "vue";
|
|
import { inject } from "vue";
|
|
import { renderList } from "vue";
|
|
import { onMounted } from "vue";
|
|
import { onBeforeUnmount } from "vue";
|
|
import { renderSlot } from "vue";
|
|
import { watch } from "vue";
|
|
import { createBlock } from "vue";
|
|
import { ref } from "vue";
|
|
import { withCtx } from "vue";
|
|
import { createCommentVNode } from "vue";
|
|
import { createSlots } from "vue";
|
|
import { computed } from "vue";
|
|
import { isRef } from "vue";
|
|
import { createElementBlock } from "vue";
|
|
import { shallowRef } 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 { navigateTo } 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 select from "primevue/select";
|
|
import inputnumber from "primevue/inputnumber";
|
|
import { t as os_name_t } from "~/lib/os-name.js";
|
|
import { r as configuration_display_r } from "~/lib/configuration-display.js";
|
|
import { i as product_fields_i } from "~/lib/product-fields.js";
|
|
import { r as product_fields_r } from "~/lib/product-fields.js";
|
|
import { t as product_fields_t } from "~/lib/product-fields.js";
|
|
import ConfigLoadingShell from "~/components/config/ConfigLoadingShell.vue";
|
|
import ConfigChoiceGrid from "~/components/config/ConfigChoiceGrid.vue";
|
|
import ProductCustomFields from "~/components/config/ProductCustomFields.vue";
|
|
import ConfigCheckout from "~/components/config/ConfigCheckout.vue";
|
|
import { n as cart_edit_n } from "~/lib/cart-edit.js";
|
|
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 ConfigBandwidth from "~/components/config/ConfigBandwidth.vue";
|
|
import ConfigDiskAdd from "~/components/config/ConfigDiskAdd.vue";
|
|
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,
|
|
);
|
|
}
|
|
function L(e, t) {
|
|
// 区间内的值还必须落在步长网格上,不能仅凭最小/最大值认定配置可购买。
|
|
if (t == null || t === ``) return !1;
|
|
let n = Number(t);
|
|
return !e?.length || !Number.isFinite(n)
|
|
? !1
|
|
: e.some((e) => {
|
|
if (e.type === `step` || e.type === `total`) {
|
|
let t = Number(e.min_value ?? e.value),
|
|
r = Number(e.max_value ?? e.value),
|
|
i = Number(e.step) || 1;
|
|
return (
|
|
n >= t &&
|
|
n <= r &&
|
|
Math.abs((n - t) / i - Math.round((n - t) / i)) < 1e-7
|
|
);
|
|
}
|
|
return n === Number(e.value);
|
|
});
|
|
}
|
|
function pe() {
|
|
return {
|
|
data_center_id: ``,
|
|
cpu: ``,
|
|
memory: 1,
|
|
image_id: 0,
|
|
app_preset_id: 0,
|
|
system_disk: {
|
|
size: ``,
|
|
disk_type: ``,
|
|
disk_limit_id: ``,
|
|
},
|
|
data_disk: [],
|
|
backup_num: ``,
|
|
snap_num: ``,
|
|
line_id: ``,
|
|
bw: 0,
|
|
flow: 0,
|
|
peak_defence: ``,
|
|
ip_num: null,
|
|
ipv6_num: null,
|
|
network_type: `normal`,
|
|
name: ``,
|
|
ssh_key_id: ``,
|
|
security_group_id: ``,
|
|
security_group_protocol: [],
|
|
password: password_t(),
|
|
re_password: ``,
|
|
vpc: {
|
|
id: ``,
|
|
ips: ``,
|
|
},
|
|
port: 22,
|
|
notes: ``,
|
|
auto_renew: !1,
|
|
resource_package_id: ``,
|
|
ip_mac_bind_enable: !1,
|
|
nat_acl_limit_enable: !1,
|
|
nat_web_limit_enable: !1,
|
|
ipv6_num_enable: !1,
|
|
billing_cycle: `recurring_prepayment`,
|
|
duration_id: ``,
|
|
};
|
|
}
|
|
function R(e, t = `mf_cloud`, n = {}) {
|
|
// 这里集中维护报价、配置代次及购物车回填;下方 setup 只组织控件与意图事件。
|
|
let r = useApi(),
|
|
a = `/product/${e}/${t}`,
|
|
s = n.customFields === !0 || !!n.edit,
|
|
l = n.edit,
|
|
u = n.initialProduct?.pay_type || `recurring_prepayment`,
|
|
d =
|
|
u === `recurring_prepayment_on_demand`
|
|
? [`recurring_prepayment`, `on_demand`]
|
|
: [u === `on_demand` ? `on_demand` : `recurring_prepayment`],
|
|
p = !1,
|
|
m = !1,
|
|
h = !1,
|
|
g = ref(!l),
|
|
te = cart_edit_r(r, l),
|
|
_ = shallowRef(null),
|
|
v = ref([]),
|
|
y = ref(null),
|
|
b = ref(``),
|
|
x = null,
|
|
C = ref([]),
|
|
w = ref(pe());
|
|
w.value.billing_cycle = String(l?.item.config_options?.billing_cycle || d[0]);
|
|
let T = computed(() => w.value.billing_cycle === `on_demand`),
|
|
ne = ref(null),
|
|
re = computed(() =>
|
|
T.value ? (y.value?.flow_on_demand ?? []) : (y.value?.flow ?? []),
|
|
),
|
|
ie = computed(() =>
|
|
_.value?.data_center
|
|
.flatMap((e) => e.city ?? [])
|
|
.flatMap((e) => e.area ?? [])
|
|
.find((e) =>
|
|
e.line?.some(
|
|
(e) => String(e.data_center_id) === String(w.value.data_center_id),
|
|
),
|
|
),
|
|
),
|
|
E = computed(() =>
|
|
(ie.value?.recommend_config ?? []).filter(
|
|
(e) =>
|
|
Number.isSafeInteger(Number(e.id)) &&
|
|
Number(e.id) > 0 &&
|
|
Number(e.hidden ?? 0) !== 1 &&
|
|
String(e.line_id) === String(w.value.line_id),
|
|
),
|
|
),
|
|
oe = computed(
|
|
() => Number(_.value?.config?.only_sale_recommend_config) === 1,
|
|
),
|
|
k = computed(() =>
|
|
E.value.find((e) => Number(e.id) === Number(w.value.recommend_config_id)),
|
|
),
|
|
se = computed(() =>
|
|
Number(_.value?.config?.backup_enable) === 1
|
|
? (_.value?.backup_config ?? [])
|
|
: [],
|
|
),
|
|
ce = computed(() =>
|
|
Number(_.value?.config?.snap_enable) === 1
|
|
? (_.value?.snap_config ?? [])
|
|
: [],
|
|
),
|
|
ue = computed(() => ie.value?.gpu ?? []);
|
|
function de(e) {
|
|
((w.value.recommend_config_id = Number(e.id)),
|
|
(w.value.cpu = e.cpu ?? w.value.cpu),
|
|
(w.value.memory = e.memory ?? w.value.memory),
|
|
e.system_disk_size != null &&
|
|
(w.value.system_disk = {
|
|
size: e.system_disk_size,
|
|
disk_type: e.system_disk_type ?? ``,
|
|
disk_limit_id: ``,
|
|
}),
|
|
(w.value.data_disk =
|
|
Number(e.data_disk_size) > 0
|
|
? [
|
|
{
|
|
size: e.data_disk_size,
|
|
disk_type: e.data_disk_type ?? ``,
|
|
disk_limit_id: ``,
|
|
},
|
|
]
|
|
: []));
|
|
for (let t of [`bw`, `flow`, `ip_num`, `gpu_num`, `ipv6_num`])
|
|
e[t] != null &&
|
|
Object.assign(w.value, {
|
|
[t]: e[t],
|
|
});
|
|
e.peak_defence != null && (w.value.peak_defence = String(e.peak_defence));
|
|
}
|
|
function fe() {
|
|
// 商品若仅售套餐,必须选当前线路的可售推荐配置,不可绕过套餐约束使用自选资源。
|
|
if (w.value.recommend_config_id && !k.value)
|
|
throw Error(`所选套餐已不可用,请重新选择套餐`);
|
|
if (!w.value.recommend_config_id && oe.value) {
|
|
let e = E.value[0];
|
|
if (!e) throw Error(`此商品仅销售套餐,当前线路暂无可售套餐`);
|
|
de(e);
|
|
} else k.value && de(k.value);
|
|
}
|
|
function M() {
|
|
// 备份、快照和 GPU 额度按商品已开放档位校验;推荐套餐自带 GPU 也保留其合法额度。
|
|
for (let [e, t, n] of [
|
|
[`备份`, w.value.backup_num, se.value.map((e) => e.num)],
|
|
[`快照`, w.value.snap_num, ce.value.map((e) => e.num)],
|
|
[`GPU`, w.value.gpu_num ?? 0, ue.value.map((e) => e.value)],
|
|
]) {
|
|
let r = Number(t);
|
|
if (
|
|
!Number.isSafeInteger(r) ||
|
|
r < 0 ||
|
|
(r > 0 && !n.some((e) => Number(e) === r))
|
|
) {
|
|
if (e === `GPU` && k.value && r === Number(k.value.gpu_num)) continue;
|
|
throw Error(`请选择当前商品支持的${e}数量`);
|
|
}
|
|
}
|
|
}
|
|
async function N(e) {
|
|
if ((q(), !(W || z.value))) {
|
|
if (e === 0 && !oe.value) ((w.value.recommend_config_id = 0), Ae());
|
|
else {
|
|
let t = E.value.find((t) => Number(t.id) === e);
|
|
if (!t) {
|
|
V.value = `所选套餐不可用,请重新选择`;
|
|
return;
|
|
}
|
|
de(t);
|
|
}
|
|
await Y();
|
|
}
|
|
}
|
|
let P = ref({}),
|
|
F = ref([]),
|
|
R = ref(1),
|
|
me = ref(`—`),
|
|
z = ref(!0),
|
|
B = ref(!1),
|
|
V = ref(``),
|
|
H = ref(``),
|
|
he = ref(0),
|
|
ge = ref(0),
|
|
U = computed(() =>
|
|
JSON.stringify({
|
|
config: w.value,
|
|
qty: R.value,
|
|
promo: H.value,
|
|
fields: P.value,
|
|
}),
|
|
),
|
|
_e = 0,
|
|
ve = ref(``),
|
|
W = !1,
|
|
G = 0,
|
|
K = (e) => !W && e === G,
|
|
ye = computed(
|
|
() => !w.value.line_id || (b.value === w.value.line_id && !!y.value),
|
|
),
|
|
be = computed(
|
|
() =>
|
|
g.value &&
|
|
d.includes(w.value.billing_cycle) &&
|
|
ye.value &&
|
|
!!ve.value &&
|
|
ve.value === U.value &&
|
|
!B.value,
|
|
);
|
|
function q() {
|
|
// 任意输入改变立即清空已确认报价与折扣,防止旧价在新配置上继续可提交。
|
|
((_e += 1),
|
|
(ve.value = ``),
|
|
(me.value = `—`),
|
|
(ne.value = null),
|
|
(he.value = 0),
|
|
(ge.value = 0),
|
|
(B.value = !1));
|
|
}
|
|
function xe() {
|
|
return (
|
|
h &&
|
|
v.value.some((e) =>
|
|
e.image?.some((e) => String(e.id) === String(w.value.image_id)),
|
|
) &&
|
|
(h = !1),
|
|
h
|
|
);
|
|
}
|
|
(watch(U, q, {
|
|
flush: `sync`,
|
|
}),
|
|
watch(
|
|
() => w.value.line_id,
|
|
() => {
|
|
((b.value = ``), (y.value = null));
|
|
},
|
|
{
|
|
flush: `sync`,
|
|
},
|
|
),
|
|
onBeforeUnmount(() => {
|
|
((W = !0), q());
|
|
}));
|
|
function Se() {
|
|
if (W || !be.value)
|
|
throw Error(`当前配置报价尚未确认,请等待或重新计算报价`);
|
|
}
|
|
let Ce = computed(() => {
|
|
let e = _.value?.config?.disk_limit_num;
|
|
return e != null && Number.isFinite(Number(e))
|
|
? Math.max(0, Math.floor(Number(e)))
|
|
: 16;
|
|
});
|
|
function J(e, t, n = !1) {
|
|
// 磁盘选项结合介质、容量步长和赠送盘规则生成;赠送容量也需保留独立合法档位。
|
|
let r = _.value;
|
|
if (!r) return [];
|
|
let i = r.config,
|
|
a = Number(i?.disk_range_limit),
|
|
o =
|
|
Number(i?.disk_range_limit_switch) === 1 && a > 0 && Number.isFinite(a)
|
|
? a
|
|
: 1,
|
|
s = n && Number(i?.free_disk_switch) === 1 ? Number(i.free_disk_size) : 0,
|
|
c = s > 0 && Number.isFinite(s) && t === (i?.free_disk_type ?? ``),
|
|
l = c ? s : 0,
|
|
u = [];
|
|
for (let n of r[e === `system` ? `system_disk` : `data_disk`] ?? [])
|
|
if ((n.other_config?.disk_type ?? ``) === t) {
|
|
if (n.type === `step` || n.type === `total`) {
|
|
let e =
|
|
Math.ceil(Math.max(Number(n.min_value ?? n.value), l) / o) * o,
|
|
t =
|
|
Math.floor(Number(n.max_value ?? n.min_value ?? n.value) / o) * o;
|
|
Number.isFinite(e) &&
|
|
Number.isFinite(t) &&
|
|
e > 0 &&
|
|
e <= t &&
|
|
u.push({
|
|
...n,
|
|
min_value: e,
|
|
max_value: t,
|
|
step: o,
|
|
});
|
|
} else {
|
|
let e = Number(n.value);
|
|
Number.isFinite(e) &&
|
|
e > 0 &&
|
|
e >= l &&
|
|
u.push({
|
|
...n,
|
|
value: e,
|
|
});
|
|
}
|
|
}
|
|
return (
|
|
c &&
|
|
!u.some((e) => e.type === `radio` && Number(e.value) === s) &&
|
|
u.push({
|
|
id: -1,
|
|
type: `radio`,
|
|
value: s,
|
|
other_config: {
|
|
disk_type: t,
|
|
},
|
|
}),
|
|
u.sort((e, t) => I(e) - I(t))
|
|
);
|
|
}
|
|
function we(e, t) {
|
|
let n = Number(t);
|
|
return e.some((e) =>
|
|
e.type !== `step` && e.type !== `total`
|
|
? n === Number(e.value)
|
|
: n >= e.min_value &&
|
|
n <= e.max_value &&
|
|
(n - e.min_value) % e.step === 0,
|
|
);
|
|
}
|
|
function Te() {
|
|
// 赠送盘按站点规则补入,并和普通数据盘区分,避免被删除或重复赠送。
|
|
let e = _.value?.config,
|
|
t = Number(e?.free_disk_size),
|
|
n = w.value.data_disk.find((e) => Number(e.is_free) === 1),
|
|
r = w.value.data_disk.filter((e) => Number(e.is_free) !== 1);
|
|
if (Number(e?.free_disk_switch) === 1 && t > 0 && Number.isFinite(t)) {
|
|
let i = e?.free_disk_type ?? ``,
|
|
a = n && n.disk_type === i && we(J(`data`, i, !0), n.size) ? n.size : t;
|
|
w.value.data_disk = [
|
|
{
|
|
size: a,
|
|
disk_type: i,
|
|
is_free: 1,
|
|
},
|
|
...r,
|
|
];
|
|
} else w.value.data_disk = r;
|
|
}
|
|
function Ee() {
|
|
// 容量或介质变化后,原磁盘性能套餐可能失效,需要在报价前清除不匹配的 disk_limit_id。
|
|
for (let [e, t] of [
|
|
[`system`, [w.value.system_disk]],
|
|
[`data`, w.value.data_disk],
|
|
])
|
|
for (let n of t)
|
|
n.disk_limit_id &&
|
|
(J(e, n.disk_type)
|
|
.find((e) => we([e], n.size))
|
|
?.disk_limit?.some(
|
|
(e) => String(e.id) === String(n.disk_limit_id),
|
|
) ||
|
|
(n.disk_limit_id = ``));
|
|
}
|
|
async function De() {
|
|
if (w.value.data_disk.length >= Ce.value) return;
|
|
let e = [
|
|
...new Set(
|
|
(_.value?.data_disk ?? []).map((e) => e.other_config?.disk_type ?? ``),
|
|
),
|
|
].find((e) => J(`data`, e).length > 0);
|
|
if (e === void 0) return;
|
|
let t = I(J(`data`, e)[0]);
|
|
(w.value.data_disk.push({
|
|
size: t,
|
|
disk_type: e,
|
|
disk_limit_id: ``,
|
|
}),
|
|
await Y());
|
|
}
|
|
async function Oe(e) {
|
|
if (!Number.isInteger(e) || e < 0) return;
|
|
let t = w.value.data_disk[e];
|
|
t && Number(t.is_free) !== 1 && (w.value.data_disk.splice(e, 1), await Y());
|
|
}
|
|
async function ke(e, t) {
|
|
let n = w.value.data_disk[e];
|
|
if (!n || Number(n.is_free) === 1) return;
|
|
let r = I(J(`data`, t)[0]);
|
|
r !== void 0 &&
|
|
((n.disk_type = t), (n.size = r), (n.disk_limit_id = ``), await Y());
|
|
}
|
|
function Ae() {
|
|
let e = _.value;
|
|
if (!e) return;
|
|
if (oe.value && !w.value.line_id) {
|
|
let t = e.data_center
|
|
.flatMap((e) => e.city ?? [])
|
|
.flatMap((e) => e.area ?? [])
|
|
.flatMap((e) =>
|
|
(e.recommend_config ?? [])
|
|
.filter((e) => Number(e.hidden ?? 0) !== 1)
|
|
.map((t) => e.line?.find((e) => Number(e.id) === Number(t.line_id)))
|
|
.filter(Boolean),
|
|
)[0];
|
|
t &&
|
|
((w.value.line_id = t.id), (w.value.data_center_id = t.data_center_id));
|
|
}
|
|
let t = e.data_center?.[0]?.city?.[0]?.area?.[0]?.line?.[0],
|
|
n = e.data_center
|
|
?.flatMap((e) => e.city ?? [])
|
|
.flatMap((e) => e.area ?? [])
|
|
.flatMap((e) => e.line ?? [])
|
|
.find((e) => String(e.id) === String(w.value.line_id));
|
|
(n
|
|
? ((w.value.data_center_id = n.data_center_id), (w.value.line_id = n.id))
|
|
: t &&
|
|
((w.value.data_center_id = t.data_center_id), (w.value.line_id = t.id)),
|
|
e.cpu?.length &&
|
|
!e.cpu.some((e) => String(e.value) === String(w.value.cpu)) &&
|
|
(w.value.cpu = e.cpu[0].value),
|
|
e.memory?.length &&
|
|
!L(e.memory, w.value.memory) &&
|
|
(w.value.memory = I(e.memory[0])));
|
|
let r =
|
|
e.system_disk?.find(
|
|
(e) =>
|
|
String(e.other_config?.disk_type ?? ``) ===
|
|
String(w.value.system_disk.disk_type),
|
|
) ?? e.system_disk?.[0];
|
|
(r &&
|
|
(w.value.system_disk.disk_type ||
|
|
(w.value.system_disk.disk_type = r.other_config?.disk_type ?? ``),
|
|
(!w.value.system_disk.size ||
|
|
!we(
|
|
J(`system`, w.value.system_disk.disk_type),
|
|
Number(w.value.system_disk.size),
|
|
)) &&
|
|
(w.value.system_disk.size =
|
|
I(J(`system`, w.value.system_disk.disk_type)[0]) ?? ``)),
|
|
Te());
|
|
let i = v.value[0]?.image?.[0];
|
|
i &&
|
|
!v.value.some((e) =>
|
|
e.image?.some((e) => String(e.id) === String(w.value.image_id)),
|
|
) &&
|
|
(w.value.image_id = i.id);
|
|
let a = [
|
|
...(Number(e.config?.support_normal_network) === 1 ? [`normal`] : []),
|
|
...(Number(e.config?.support_vpc_network) === 1 ? [`vpc`] : []),
|
|
];
|
|
(a.includes(w.value.network_type) ||
|
|
(w.value.network_type = a[0] ?? `normal`),
|
|
fe(),
|
|
M());
|
|
}
|
|
function je(e) {
|
|
let t =
|
|
e.config_options &&
|
|
typeof e.config_options == `object` &&
|
|
!Array.isArray(e.config_options)
|
|
? cart_edit_n(e.config_options)
|
|
: {},
|
|
n = {
|
|
...t,
|
|
},
|
|
r =
|
|
n.system_disk &&
|
|
typeof n.system_disk == `object` &&
|
|
!Array.isArray(n.system_disk)
|
|
? n.system_disk
|
|
: {};
|
|
w.value = {
|
|
...w.value,
|
|
...n,
|
|
system_disk: {
|
|
...w.value.system_disk,
|
|
...r,
|
|
},
|
|
data_disk: Array.isArray(n.data_disk) ? n.data_disk : w.value.data_disk,
|
|
};
|
|
let i = Number(e.qty);
|
|
Number.isInteger(i) && i > 0 && (R.value = i);
|
|
let a =
|
|
e.customfield &&
|
|
typeof e.customfield == `object` &&
|
|
!Array.isArray(e.customfield)
|
|
? e.customfield
|
|
: {},
|
|
o = t.promo_code ?? a.promo_code;
|
|
Array.isArray(o)
|
|
? (H.value = String(o.find(Boolean) ?? ``))
|
|
: o != null && (H.value = String(o));
|
|
let s =
|
|
e.self_defined_field &&
|
|
typeof e.self_defined_field == `object` &&
|
|
!Array.isArray(e.self_defined_field)
|
|
? e.self_defined_field
|
|
: {};
|
|
for (let e of F.value) P.value[e.id] = String(s[e.id] ?? ``);
|
|
}
|
|
function Me() {
|
|
if (w.value.recommend_config_id || y.value?.bill_type !== `flow`) return;
|
|
let e = re.value.find((e) => Number(e.value) === Number(w.value.flow)),
|
|
t = (
|
|
e?.bw?.length
|
|
? e.bw.map((e) => Number(e.out_bw))
|
|
: e?.other_config?.out_bw == null
|
|
? []
|
|
: [Number(e.other_config.out_bw)]
|
|
).filter((e) => Number.isFinite(e) && e >= 0);
|
|
t.length && !t.includes(Number(w.value.bw)) && (w.value.bw = t[0]);
|
|
}
|
|
async function Ne(t) {
|
|
let n = await r.get(`/product/${e}/self_defined_field/order_page`);
|
|
if (K(t)) {
|
|
if (!Array.isArray(n?.data))
|
|
throw Error(`商品自定义字段加载失败,请重试`);
|
|
((F.value = product_fields_r(n)), (P.value = product_fields_t(F.value)));
|
|
}
|
|
}
|
|
async function Pe() {
|
|
((s = !0), (g.value = !1), _.value && (await Re()));
|
|
}
|
|
async function Fe(e = G) {
|
|
// 同一线路合并在途读取;写回前同时核对配置代次和当前线路,避免串用上一个线路价格。
|
|
let t = w.value.line_id;
|
|
if (!t) return !1;
|
|
if (b.value === t && y.value) return !0;
|
|
(!x || x.id !== t) &&
|
|
(x = {
|
|
id: t,
|
|
promise: r.get(`${a}/line/${t}`),
|
|
});
|
|
let n = x;
|
|
try {
|
|
let r = await n.promise;
|
|
if (!K(e) || w.value.line_id !== t) return !1;
|
|
if (((y.value = r), k.value)) return (de(k.value), (b.value = t), !0);
|
|
if (
|
|
(r.bill_type === `bw` &&
|
|
!L(r.bw, w.value.bw) &&
|
|
(w.value.bw = I(r.bw?.[0]) ?? 0),
|
|
r.bill_type === `flow`)
|
|
) {
|
|
if (T.value && !re.value.some((e) => Number(e.value) === 0))
|
|
throw Error(`此线路未提供按需流量配置,请选择其他线路`);
|
|
T.value
|
|
? (w.value.flow = 0)
|
|
: L(r.flow, w.value.flow) || (w.value.flow = I(r.flow?.[0]) ?? 0);
|
|
}
|
|
(Me(),
|
|
L(r.ip, w.value.ip_num) || (w.value.ip_num = I(r.ip?.[0]) ?? null));
|
|
let i =
|
|
r.defence?.find(
|
|
(e) => String(e.value) === String(w.value.peak_defence),
|
|
) ??
|
|
r.defence?.find(
|
|
(e) => String(e.value) === String(r.order_default_defence),
|
|
);
|
|
return (
|
|
!i && r.defence?.length
|
|
? (w.value.peak_defence = String(r.defence[0]?.value ?? ``))
|
|
: w.value.peak_defence ||
|
|
(w.value.peak_defence = i ? String(i.value) : ``),
|
|
(b.value = t),
|
|
!0
|
|
);
|
|
} finally {
|
|
x === n && (x = null);
|
|
}
|
|
}
|
|
async function Ie(t = G) {
|
|
(fe(), M());
|
|
let n = U.value,
|
|
i = await r.post(`${a}/duration`, {
|
|
...w.value,
|
|
id: String(e),
|
|
});
|
|
if (!K(t) || n !== U.value) return !1;
|
|
if (
|
|
((C.value = Array.isArray(i) ? i : []),
|
|
!C.value.some((e) => String(e.id) === String(w.value.duration_id)))
|
|
) {
|
|
let e = C.value.find((e) => e.is_default === 1) ?? C.value[0];
|
|
w.value.duration_id = e?.id ?? ``;
|
|
}
|
|
return !0;
|
|
}
|
|
async function Le() {
|
|
// 报价前完成套餐/额度/线路校验;按需模式还必须获得合法运行费、流量费及保留费信息。
|
|
if ((q(), W || !g.value)) return;
|
|
if (!d.includes(w.value.billing_cycle)) {
|
|
V.value = `当前商品未开放所选计费方式`;
|
|
return;
|
|
}
|
|
if (xe()) {
|
|
V.value = `登录前选择的操作系统已不可用,请重新选择操作系统`;
|
|
return;
|
|
}
|
|
try {
|
|
(fe(), M());
|
|
} catch (e) {
|
|
V.value = e instanceof Error ? e.message : `商品配置无效`;
|
|
return;
|
|
}
|
|
if (!ye.value) {
|
|
await Y();
|
|
return;
|
|
}
|
|
if ((Me(), Ee(), !w.value.duration_id || !w.value.image_id)) return;
|
|
let t = ++_e,
|
|
n = U.value,
|
|
i = () => !W && t === _e && n === U.value;
|
|
((B.value = !0), (V.value = ``));
|
|
try {
|
|
let t = await r.post(`/product/${e}/config_option`, {
|
|
id: e,
|
|
config_options: {
|
|
...w.value,
|
|
promo_code: H.value,
|
|
event_promotion: ``,
|
|
},
|
|
qty: R.value,
|
|
});
|
|
if (!i()) return;
|
|
let a = t?.price_total ?? t?.total_price ?? t?.price ?? t?.amount;
|
|
if (
|
|
a == null ||
|
|
String(a).trim() === `` ||
|
|
!Number.isFinite(Number(a)) ||
|
|
Number(a) < 0
|
|
)
|
|
throw Error(`未获得有效报价,请重新计算`);
|
|
if (T.value) {
|
|
let e = (e) =>
|
|
((typeof e == `string` && e.trim() !== ``) ||
|
|
typeof e == `number`) &&
|
|
Number.isFinite(Number(e)) &&
|
|
Number(e) >= 0,
|
|
n = t.renew_price_total ?? t.renew_price;
|
|
if (
|
|
!e(n) ||
|
|
(y.value?.bill_type === `flow` && !e(t.on_demand_flow_price)) ||
|
|
(t.keep_time_price != null && !e(t.keep_time_price))
|
|
)
|
|
throw Error(`按需运行费用响应无效,请重新计算`);
|
|
ne.value = {
|
|
renew: String(n),
|
|
total: t.renew_price_total != null,
|
|
...(y.value?.bill_type === `flow`
|
|
? {
|
|
flow: String(t.on_demand_flow_price),
|
|
}
|
|
: {}),
|
|
...(t.keep_time_price == null
|
|
? {}
|
|
: {
|
|
keep: String(t.keep_time_price),
|
|
}),
|
|
};
|
|
}
|
|
((me.value = String(a)),
|
|
(he.value = Number(t?.price_promo_code_discount ?? 0)),
|
|
(ge.value = Number(t?.price_client_level_discount ?? 0)),
|
|
(ve.value = n));
|
|
} catch (e) {
|
|
if (!i()) return;
|
|
V.value = e instanceof Error ? e.message : `报价加载失败,请重试`;
|
|
} finally {
|
|
i() && (B.value = !1);
|
|
}
|
|
}
|
|
async function Re(t) {
|
|
// 整体初始化重读商品及镜像;登录前选中的镜像若已失效,要求用户重新选择而非静默换系统。
|
|
g.value = !1;
|
|
let i = ++G;
|
|
(q(),
|
|
(z.value = !0),
|
|
(V.value = ``),
|
|
(b.value = ``),
|
|
(y.value = null),
|
|
(x = null));
|
|
try {
|
|
if (!d.includes(w.value.billing_cycle))
|
|
throw Error(`当前商品未开放购物车中的计费方式,请重新选择商品`);
|
|
let [o, c] = await Promise.all([
|
|
r.get(`${a}/order_page`, {
|
|
id: e,
|
|
billing_cycle: w.value.billing_cycle,
|
|
}),
|
|
r.get(`${a}/image`, {
|
|
id: e,
|
|
is_market: 0,
|
|
}),
|
|
]);
|
|
if (
|
|
!K(i) ||
|
|
((_.value = o),
|
|
(v.value = c.list ?? []),
|
|
(F.value = []),
|
|
(P.value = {}),
|
|
s && (await Ne(i)),
|
|
!K(i))
|
|
)
|
|
return;
|
|
if (t) for (let e of F.value) P.value[e.id] = t[e.id] ?? ``;
|
|
if (
|
|
(cart_edit_o(
|
|
l,
|
|
F.value.map((e) => e.id),
|
|
),
|
|
l && !p && (je(l.item), (p = !0)),
|
|
!l && !m)
|
|
) {
|
|
let e = v.value
|
|
.flatMap((e) => e.image ?? [])
|
|
.find((e) => String(e.id) === String(n.initialImageId));
|
|
(e ? (w.value.image_id = e.id) : (h = n.initialImageId !== void 0),
|
|
(m = !0));
|
|
}
|
|
g.value = !0;
|
|
let u = xe();
|
|
if ((Ae(), u)) {
|
|
((w.value.image_id = 0),
|
|
(V.value = `登录前选择的操作系统已不可用,请重新选择操作系统`));
|
|
return;
|
|
}
|
|
if (!(await Fe(i)) || !(await Ie(i))) return;
|
|
((z.value = !1), K(i) && (await Le()));
|
|
} catch (e) {
|
|
K(i) &&
|
|
((e instanceof Error && /套餐/.test(e.message)) || (_.value = null),
|
|
(V.value = e instanceof Error ? e.message : `加载商品配置失败`));
|
|
} finally {
|
|
K(i) && (z.value = !1);
|
|
}
|
|
}
|
|
async function ze(e) {
|
|
// 改计费模式必须重读商品配置并清空周期/流量/带宽,不能沿用另一模式的报价。
|
|
!W &&
|
|
e !== w.value.billing_cycle &&
|
|
d.includes(e) &&
|
|
((w.value.billing_cycle = e),
|
|
(w.value.duration_id = ``),
|
|
(w.value.flow = 0),
|
|
(w.value.bw = 0),
|
|
(C.value = []),
|
|
await Re({
|
|
...P.value,
|
|
}));
|
|
}
|
|
async function Y(e = !1) {
|
|
let t = ++G;
|
|
(q(), (V.value = ``));
|
|
try {
|
|
if (
|
|
(e &&
|
|
((b.value = ``),
|
|
(y.value = null),
|
|
(w.value.bw = 0),
|
|
(w.value.flow = 0),
|
|
(w.value.ip_num = null),
|
|
(w.value.peak_defence = ``)),
|
|
(w.value.line_id && !(await Fe(t))) ||
|
|
!K(t) ||
|
|
(Me(), Ee(), !(await Ie(t))))
|
|
)
|
|
return;
|
|
K(t) && (await Le());
|
|
} catch (e) {
|
|
K(t) &&
|
|
(V.value = e instanceof Error ? e.message : `配置报价加载失败,请重试`);
|
|
}
|
|
}
|
|
async function Be() {
|
|
!k.value &&
|
|
w.value.recommend_config_id &&
|
|
(w.value.recommend_config_id = 0);
|
|
try {
|
|
fe();
|
|
} catch (e) {
|
|
(q(), (V.value = e instanceof Error ? e.message : `套餐不可用`));
|
|
return;
|
|
}
|
|
await Y(!0);
|
|
}
|
|
async function Ve() {
|
|
// 提交前检查报价快照与自定义字段;加购保持现有 cycle/configoption 协议形状。
|
|
(Se(), product_fields_i(F.value, P.value));
|
|
let t = {
|
|
product_id: e,
|
|
config_options: {
|
|
configoption: {},
|
|
cascade_configoption: {},
|
|
cycle: w.value.duration_id,
|
|
...w.value,
|
|
},
|
|
qty: R.value,
|
|
customfield: {
|
|
promo_code: H.value,
|
|
event_promotion: ``,
|
|
},
|
|
self_defined_field: {
|
|
...P.value,
|
|
},
|
|
};
|
|
if (l) {
|
|
let e = U.value;
|
|
return te(t, () => !W && be.value && e === U.value);
|
|
}
|
|
return r.post(`/cart`, t);
|
|
}
|
|
async function He() {
|
|
if (l) throw Error(`请先保存配置,再返回购物车结算`);
|
|
return (
|
|
Se(),
|
|
product_fields_i(F.value, P.value),
|
|
r.post(`/product/settle`, {
|
|
product_id: e,
|
|
config_options: {
|
|
...w.value,
|
|
promo_code: H.value,
|
|
event_promotion: ``,
|
|
},
|
|
qty: R.value,
|
|
self_defined_field: {
|
|
...P.value,
|
|
},
|
|
})
|
|
);
|
|
}
|
|
return {
|
|
orderPage: _,
|
|
images: v,
|
|
lineDetail: y,
|
|
cycles: C,
|
|
config: w,
|
|
qty: R,
|
|
customFields: P,
|
|
customFieldDefinitions: F,
|
|
price: me,
|
|
promoCode: H,
|
|
promoDiscount: he,
|
|
levelDiscount: ge,
|
|
loading: z,
|
|
priceLoading: B,
|
|
quoteReady: be,
|
|
billingModes: d,
|
|
onDemand: T,
|
|
onDemandPrice: ne,
|
|
flowOptions: re,
|
|
changeBillingCycle: ze,
|
|
error: V,
|
|
init: Re,
|
|
refresh: Y,
|
|
dataDiskLimit: Ce,
|
|
diskOptions: J,
|
|
addDataDisk: De,
|
|
removeDataDisk: Oe,
|
|
changeDataDiskType: ke,
|
|
onLineChange: Be,
|
|
recommendations: E,
|
|
selectedRecommendation: k,
|
|
onlyPackages: oe,
|
|
selectRecommendation: N,
|
|
backupOptions: se,
|
|
snapshotOptions: ce,
|
|
gpuOptions: ue,
|
|
calcPrice: Le,
|
|
addToCart: Ve,
|
|
buyNow: He,
|
|
enableCustomFields: Pe,
|
|
};
|
|
}
|
|
var me = {
|
|
class: `config-page`,
|
|
},
|
|
z = {
|
|
key: 1,
|
|
class: `panel config-load-error`,
|
|
},
|
|
B = {
|
|
key: 2,
|
|
class: `config-layout`,
|
|
},
|
|
V = {
|
|
class: `config-options`,
|
|
},
|
|
H = {
|
|
class: `panel`,
|
|
},
|
|
he = {
|
|
class: `form-row`,
|
|
},
|
|
ge = {
|
|
class: `form-row`,
|
|
},
|
|
U = {
|
|
key: 0,
|
|
class: `form-row`,
|
|
},
|
|
_e = {
|
|
key: 0,
|
|
class: `hint`,
|
|
},
|
|
ve = {
|
|
key: 1,
|
|
class: `form-row`,
|
|
},
|
|
W = {
|
|
key: 2,
|
|
class: `form-row`,
|
|
},
|
|
G = {
|
|
key: 0,
|
|
class: `panel`,
|
|
},
|
|
K = {
|
|
class: `form-row storage-system`,
|
|
},
|
|
ye = {
|
|
key: 0,
|
|
class: `form-row`,
|
|
},
|
|
be = {
|
|
class: `storage-disks`,
|
|
},
|
|
q = {
|
|
class: `storage-hint`,
|
|
},
|
|
xe = {
|
|
class: `hint`,
|
|
},
|
|
Se = {
|
|
key: 1,
|
|
class: `panel`,
|
|
},
|
|
Ce = {
|
|
key: 0,
|
|
class: `form-row`,
|
|
},
|
|
J = {
|
|
key: 1,
|
|
class: `form-row`,
|
|
},
|
|
we = {
|
|
key: 2,
|
|
class: `form-row`,
|
|
},
|
|
Te = {
|
|
key: 3,
|
|
class: `form-row`,
|
|
},
|
|
Ee = {
|
|
key: 4,
|
|
class: `form-row`,
|
|
},
|
|
De = {
|
|
key: 5,
|
|
class: `form-row`,
|
|
},
|
|
Oe = {
|
|
key: 2,
|
|
class: `panel`,
|
|
},
|
|
ke = {
|
|
key: 0,
|
|
class: `form-row`,
|
|
},
|
|
Ae = {
|
|
key: 1,
|
|
class: `form-row`,
|
|
},
|
|
je = {
|
|
key: 2,
|
|
class: `form-row`,
|
|
},
|
|
Me = {
|
|
key: 3,
|
|
class: `panel`,
|
|
},
|
|
Ne = {
|
|
class: `form-row`,
|
|
},
|
|
Pe = {
|
|
class: `config-summary-row`,
|
|
},
|
|
Fe = {
|
|
class: `config-summary-row`,
|
|
},
|
|
Ie = {
|
|
key: 0,
|
|
class: `config-summary-row`,
|
|
},
|
|
Le = {
|
|
key: 1,
|
|
class: `config-summary-row`,
|
|
},
|
|
Re = {
|
|
class: `form-row`,
|
|
},
|
|
ze = {
|
|
class: `form-row`,
|
|
},
|
|
Y = Object.assign(
|
|
_plugin_vue_export_helper_t(
|
|
defineComponent({
|
|
__name: `MfCloudConfig`,
|
|
props: {
|
|
productId: {},
|
|
identityLocked: {
|
|
type: Boolean,
|
|
},
|
|
module: {},
|
|
edit: {},
|
|
initialProduct: {},
|
|
initialImageId: {},
|
|
continuationPath: {},
|
|
},
|
|
emits: [`settled`],
|
|
setup(ee, { emit: v }) {
|
|
let S = ee,
|
|
w = v,
|
|
D = R(S.productId, S.module, {
|
|
edit: S.edit,
|
|
initialProduct: S.initialProduct,
|
|
initialImageId: S.initialImageId,
|
|
}),
|
|
{
|
|
orderPage: O,
|
|
images: ae,
|
|
lineDetail: A,
|
|
cycles: le,
|
|
config: j,
|
|
qty: N,
|
|
price: I,
|
|
loading: L,
|
|
priceLoading: pe,
|
|
error: Y,
|
|
quoteReady: Be,
|
|
dataDiskLimit: Ve,
|
|
promoCode: He,
|
|
promoDiscount: Ue,
|
|
levelDiscount: We,
|
|
customFields: Ge,
|
|
customFieldDefinitions: Ke,
|
|
onDemand: qe,
|
|
onDemandPrice: X,
|
|
flowOptions: Je,
|
|
} = D,
|
|
Ye = inject(order_image_continuation_t, null),
|
|
Xe = computed(() =>
|
|
order_image_continuation_n(
|
|
S.continuationPath || `/products/${S.productId}`,
|
|
j.value.image_id,
|
|
),
|
|
);
|
|
watch(
|
|
// 将当前镜像选择登记到父级续接路径,watch 清理函数释放上一条登记。
|
|
Xe,
|
|
(e, t, n) => {
|
|
let r = Ye?.(e);
|
|
r && n(r);
|
|
},
|
|
{
|
|
immediate: !0,
|
|
},
|
|
);
|
|
let Z = ref(null),
|
|
Q = computed(() => !!S.identityLocked || Z.value !== null),
|
|
Ze = ref(``),
|
|
Qe = ref(``),
|
|
$e;
|
|
onBeforeUnmount(() => clearTimeout($e));
|
|
let et = computed(
|
|
() =>
|
|
Be.value &&
|
|
!Q.value &&
|
|
!!j.value.duration_id &&
|
|
!!j.value.image_id,
|
|
),
|
|
tt = ref(null),
|
|
nt = computed(() => {
|
|
let e = [];
|
|
for (let t of O.value?.data_center ?? [])
|
|
for (let n of t.city ?? [])
|
|
for (let t of n.area ?? []) {
|
|
let r = t.line?.[0];
|
|
r &&
|
|
e.push({
|
|
label: [n.name, t.name].filter(Boolean).join(` / `),
|
|
areaId: t.id,
|
|
line: {
|
|
id: r.id,
|
|
data_center_id: r.data_center_id,
|
|
name: r.name,
|
|
},
|
|
});
|
|
}
|
|
return e;
|
|
}),
|
|
rt = computed({
|
|
get: () =>
|
|
nt.value.find(
|
|
(e) => e.line.data_center_id === j.value.data_center_id,
|
|
)?.areaId ?? null,
|
|
set: (e) => {
|
|
let t = nt.value.find((t) => t.areaId === e);
|
|
t &&
|
|
((j.value.data_center_id = t.line.data_center_id),
|
|
(j.value.line_id = t.line.id));
|
|
},
|
|
}),
|
|
it = computed(() => ae.value.filter((e) => e.image?.length)),
|
|
at = computed(
|
|
() => it.value.find((e) => e.id === tt.value)?.image ?? [],
|
|
),
|
|
ot = computed({
|
|
get: () =>
|
|
it.value.find((e) =>
|
|
e.image?.some((e) => e.id === j.value.image_id),
|
|
)?.id ?? null,
|
|
set: (e) => {
|
|
tt.value = e;
|
|
let t = it.value.find((t) => t.id === e)?.image?.[0];
|
|
t && (j.value.image_id = t.id);
|
|
},
|
|
}),
|
|
st = computed(() => D.recommendations?.value ?? []),
|
|
ct = computed(() => D.selectedRecommendation?.value),
|
|
lt = computed(() => D.onlyPackages?.value ?? !1),
|
|
ut = computed(() => D.backupOptions?.value ?? []),
|
|
dt = computed(() => D.snapshotOptions?.value ?? []),
|
|
ft = computed(() => D.gpuOptions?.value ?? []),
|
|
pt = computed(() => O.value?.config),
|
|
mt = computed(() => {
|
|
let e = pt.value;
|
|
if (!e) return [];
|
|
let t = [];
|
|
return (
|
|
e.support_normal_network === 1 &&
|
|
t.push({
|
|
label: configuration_display_r(`normal`),
|
|
value: `normal`,
|
|
}),
|
|
e.support_vpc_network === 1 &&
|
|
t.push({
|
|
label: configuration_display_r(`vpc`),
|
|
value: `vpc`,
|
|
}),
|
|
t
|
|
);
|
|
}),
|
|
ht = computed(() => A.value?.ip ?? []),
|
|
gt = computed(() =>
|
|
[
|
|
...new Set(
|
|
(O.value?.system_disk ?? []).map(
|
|
(e) => e.other_config?.disk_type ?? ``,
|
|
),
|
|
),
|
|
].map((e) => ({
|
|
label: e || `默认`,
|
|
value: e,
|
|
})),
|
|
),
|
|
_t = computed(() =>
|
|
D.diskOptions(`system`, j.value.system_disk.disk_type ?? ``),
|
|
),
|
|
vt = computed(() =>
|
|
[
|
|
...new Set(
|
|
(O.value?.data_disk ?? []).map(
|
|
(e) => e.other_config?.disk_type ?? ``,
|
|
),
|
|
),
|
|
].map((e) => ({
|
|
label: e || `默认`,
|
|
value: e,
|
|
})),
|
|
);
|
|
function yt(e) {
|
|
return D.diskOptions(`data`, e.disk_type, Number(e.is_free) === 1);
|
|
}
|
|
function bt(e, t) {
|
|
return Number(t.is_free) === 1
|
|
? []
|
|
: ((
|
|
O.value?.[e === `system` ? `system_disk` : `data_disk`] ?? []
|
|
).find((e) =>
|
|
(e.other_config?.disk_type ?? ``) === (t.disk_type ?? ``)
|
|
? e.type === `step` || e.type === `total`
|
|
? Number(t.size) >= Number(e.min_value) &&
|
|
Number(t.size) <= Number(e.max_value)
|
|
: Number(t.size) === Number(e.value)
|
|
: !1,
|
|
)?.disk_limit ?? []);
|
|
}
|
|
function xt(e) {
|
|
return (
|
|
[
|
|
e.read_bytes ? `读取 ${e.read_bytes} MB/s` : ``,
|
|
e.write_bytes ? `写入 ${e.write_bytes} MB/s` : ``,
|
|
e.read_iops ? `读 IOPS ${e.read_iops}` : ``,
|
|
e.write_iops ? `写 IOPS ${e.write_iops}` : ``,
|
|
]
|
|
.filter(Boolean)
|
|
.join(` · `) || `默认性能`
|
|
);
|
|
}
|
|
let St = computed(() =>
|
|
(
|
|
(Je?.value ?? A.value?.flow)?.find(
|
|
(e) => Number(e.value) === Number(j.value.flow),
|
|
)?.bw ?? []
|
|
).map((e) => ({
|
|
value: Number(e.out_bw),
|
|
label:
|
|
Number(e.in_bw) === Number(e.out_bw)
|
|
? `${e.out_bw} Mbps`
|
|
: `出站 ${e.out_bw} / 入站 ${e.in_bw} Mbps`,
|
|
})),
|
|
),
|
|
Ct = computed(() =>
|
|
le.value.map((e) => ({
|
|
...e,
|
|
label:
|
|
e.name ||
|
|
`${e.num ?? ``}${e.unit === `month` ? `个月` : (e.unit ?? ``)}`,
|
|
})),
|
|
),
|
|
wt = computed(() => {
|
|
let e = nt.value.find(
|
|
(e) =>
|
|
String(e.line.data_center_id) ===
|
|
String(j.value.data_center_id),
|
|
),
|
|
t = O.value?.data_center
|
|
.flatMap((e) =>
|
|
e.city.flatMap((e) => e.area.flatMap((e) => e.line)),
|
|
)
|
|
.find((e) => String(e.id) === String(j.value.line_id)),
|
|
n = ae.value
|
|
.flatMap((e) => e.image ?? [])
|
|
.find((e) => e.id === j.value.image_id);
|
|
return [
|
|
{
|
|
label: `区域`,
|
|
value: e?.label || `未选择`,
|
|
},
|
|
{
|
|
label: `线路`,
|
|
value: t?.name || `未选择`,
|
|
},
|
|
...(ct.value
|
|
? [
|
|
{
|
|
label: `套餐`,
|
|
value: ct.value.name,
|
|
},
|
|
]
|
|
: []),
|
|
...(Number(j.value.backup_num) > 0
|
|
? [
|
|
{
|
|
label: `备份额度`,
|
|
value: `${j.value.backup_num} 个`,
|
|
},
|
|
]
|
|
: []),
|
|
...(Number(j.value.snap_num) > 0
|
|
? [
|
|
{
|
|
label: `快照额度`,
|
|
value: `${j.value.snap_num} 个`,
|
|
},
|
|
]
|
|
: []),
|
|
...(Number(j.value.gpu_num) > 0
|
|
? [
|
|
{
|
|
label: `GPU`,
|
|
value: `${j.value.gpu_num} 张`,
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
label: `计算资源`,
|
|
value: `${j.value.cpu} 核 / ${j.value.memory} ${pt.value?.memory_unit || `GB`}`,
|
|
},
|
|
{
|
|
label: `操作系统`,
|
|
value: os_name_t(n?.name) || `未选择`,
|
|
},
|
|
{
|
|
label: `系统盘`,
|
|
value: `${j.value.system_disk.size} GB${j.value.system_disk.disk_type ? ` ${j.value.system_disk.disk_type}` : ``}`,
|
|
},
|
|
...(j.value.data_disk ?? []).map((e, t) => ({
|
|
label: `数据盘 ${t + 1}`,
|
|
value: `${e.size} GB${e.disk_type ? ` ${e.disk_type}` : ``}${Number(e.is_free) === 1 ? `(含赠送容量)` : ``}`,
|
|
})),
|
|
...(mt.value.length
|
|
? [
|
|
{
|
|
label: `网络类型`,
|
|
value:
|
|
mt.value.find((e) => e.value === j.value.network_type)
|
|
?.label || `未选择`,
|
|
},
|
|
]
|
|
: []),
|
|
...(A.value?.bill_type === `bw`
|
|
? [
|
|
{
|
|
label: `带宽上限`,
|
|
value: `${j.value.bw} Mbps`,
|
|
},
|
|
]
|
|
: []),
|
|
...(A.value?.bill_type === `flow`
|
|
? [
|
|
{
|
|
label: `流量`,
|
|
value: qe?.value
|
|
? `按实际用量计费`
|
|
: `${j.value.flow} GB`,
|
|
},
|
|
]
|
|
: []),
|
|
...(A.value?.bill_type === `flow` && St.value.length
|
|
? [
|
|
{
|
|
label: `带宽上限`,
|
|
value:
|
|
St.value.find(
|
|
(e) => Number(e.value) === Number(j.value.bw),
|
|
)?.label || `未选择`,
|
|
},
|
|
]
|
|
: []),
|
|
...(A.value?.defence?.length
|
|
? [
|
|
{
|
|
label: `防护峰值`,
|
|
value: `${j.value.peak_defence} Gbps`,
|
|
},
|
|
]
|
|
: []),
|
|
...(ht.value.length
|
|
? [
|
|
{
|
|
label: `附加 IPv4`,
|
|
value: `${j.value.ip_num ?? 0} 个`,
|
|
},
|
|
]
|
|
: []),
|
|
];
|
|
});
|
|
async function $() {
|
|
await D.refresh();
|
|
}
|
|
async function Tt() {
|
|
let e = _t.value[0];
|
|
(e &&
|
|
(j.value.system_disk.size =
|
|
e.type === `step` || e.type === `total`
|
|
? Number(e.min_value ?? e.value)
|
|
: Number(e.value)),
|
|
await D.refresh());
|
|
}
|
|
async function Et(e) {
|
|
if (Q.value || Number(e.is_free) === 1) return;
|
|
let t = yt(e)[0];
|
|
(t &&
|
|
(e.size =
|
|
t.type === `step` || t.type === `total`
|
|
? Number(t.min_value ?? t.value)
|
|
: Number(t.value)),
|
|
(e.disk_limit_id = ``),
|
|
await D.refresh());
|
|
}
|
|
async function Dt() {
|
|
await D.onLineChange();
|
|
}
|
|
async function Ot() {
|
|
await D.refresh();
|
|
}
|
|
async function kt() {
|
|
if (et.value) {
|
|
((Z.value = `cart`),
|
|
(Ze.value = ``),
|
|
(Qe.value = ``),
|
|
clearTimeout($e));
|
|
try {
|
|
if ((await D.addToCart(), S.edit)) {
|
|
await navigateTo(`/cart`);
|
|
return;
|
|
}
|
|
((Qe.value = S.edit ? `购物车配置已更新` : `已加入购物车`),
|
|
($e = setTimeout(() => (Qe.value = ``), 4e3)));
|
|
} catch (e) {
|
|
Ze.value = e instanceof Error ? e.message : `提交失败,请重试`;
|
|
} finally {
|
|
Z.value = null;
|
|
}
|
|
}
|
|
}
|
|
async function At() {
|
|
// 只有报价已确认且未锁定身份/操作时才能创建订单,成功结果由父级接入支付流程。
|
|
if (et.value) {
|
|
((Z.value = `buy`), (Ze.value = ``), (Qe.value = ``));
|
|
try {
|
|
let e = await D.buyNow();
|
|
w(`settled`, e);
|
|
} catch (e) {
|
|
Ze.value = e instanceof Error ? e.message : `提交失败,请重试`;
|
|
} finally {
|
|
Z.value = null;
|
|
}
|
|
}
|
|
}
|
|
return (
|
|
onMounted(() => {
|
|
(D.enableCustomFields?.(),
|
|
D.init().then(() => {
|
|
tt.value = ot.value;
|
|
}));
|
|
}),
|
|
(t, r) => {
|
|
let i = ConfigLoadingShell,
|
|
o = message,
|
|
c = button,
|
|
f = ConfigChoiceGrid,
|
|
v = select,
|
|
x = ProductCustomFields,
|
|
w = inputnumber,
|
|
E = ConfigCheckout;
|
|
return (
|
|
openBlock(),
|
|
createElementBlock(`div`, me, [
|
|
unref(L)
|
|
? (openBlock(),
|
|
createBlock(
|
|
i,
|
|
{
|
|
key: 0,
|
|
},
|
|
{
|
|
catalog: withCtx(() => [
|
|
renderSlot(
|
|
t.$slots,
|
|
`catalog`,
|
|
{
|
|
disabled: unref(Z) !== null,
|
|
},
|
|
void 0,
|
|
!0,
|
|
),
|
|
]),
|
|
_: 3,
|
|
},
|
|
))
|
|
: unref(Y) && !unref(O)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, z, [
|
|
renderSlot(
|
|
t.$slots,
|
|
`catalog`,
|
|
{
|
|
disabled: unref(Z) !== null,
|
|
},
|
|
void 0,
|
|
!0,
|
|
),
|
|
createVNode(
|
|
o,
|
|
{
|
|
severity: `error`,
|
|
closable: !1,
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(Y)), 1),
|
|
]),
|
|
_: 1,
|
|
},
|
|
),
|
|
createVNode(
|
|
c,
|
|
{
|
|
label: `重新加载配置`,
|
|
icon: `pi pi-refresh`,
|
|
severity: `secondary`,
|
|
outlined: ``,
|
|
disabled: ee.identityLocked,
|
|
onClick: (r[0] ||= (e) => unref(D).init()),
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`],
|
|
),
|
|
]))
|
|
: unref(O)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, B, [
|
|
createElementVNode(`div`, V, [
|
|
renderSlot(
|
|
t.$slots,
|
|
`catalog`,
|
|
{
|
|
disabled: unref(Z) !== null,
|
|
},
|
|
void 0,
|
|
!0,
|
|
),
|
|
createElementVNode(`div`, H, [
|
|
(r[32] ||= createElementVNode(
|
|
`h2`,
|
|
{
|
|
class: `section-title`,
|
|
},
|
|
`基础配置`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`div`, he, [
|
|
(r[27] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`区域`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `区域`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(rt),
|
|
"onUpdate:modelValue": (r[1] ||= (e) =>
|
|
isRef(rt) ? (rt.value = e) : null),
|
|
options: unref(nt).map((e) => ({
|
|
label: e.label,
|
|
value: e.areaId,
|
|
})),
|
|
onChange: Dt,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
]),
|
|
createElementVNode(`div`, ge, [
|
|
(r[28] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`线路`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `线路`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).line_id,
|
|
"onUpdate:modelValue": (r[2] ||= (e) =>
|
|
(unref(j).line_id = e)),
|
|
options: unref(O)
|
|
.data_center.flatMap((e) =>
|
|
e.city.flatMap((e) =>
|
|
e.area.flatMap((e) => e.line),
|
|
),
|
|
)
|
|
.map((e) => ({
|
|
label: e.name,
|
|
value: e.id,
|
|
})),
|
|
onChange: Dt,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
]),
|
|
unref(st).length || unref(lt)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, U, [
|
|
(r[29] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`套餐`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `套餐`,
|
|
disabled: unref(Q),
|
|
"model-value":
|
|
unref(j).recommend_config_id || 0,
|
|
options: [
|
|
...(unref(lt)
|
|
? []
|
|
: [
|
|
{
|
|
label: `自选配置`,
|
|
value: 0,
|
|
},
|
|
]),
|
|
...unref(st).map((e) => ({
|
|
label: e.name,
|
|
value: Number(e.id),
|
|
})),
|
|
],
|
|
"onUpdate:modelValue": (r[3] ||= (
|
|
e,
|
|
) =>
|
|
unref(D).selectRecommendation(
|
|
Number(e),
|
|
)),
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `model-value`, `options`],
|
|
),
|
|
unref(ct)?.description
|
|
? (openBlock(),
|
|
createElementBlock(
|
|
`p`,
|
|
_e,
|
|
toDisplayString(
|
|
unref(ct).description,
|
|
),
|
|
1,
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(j).recommend_config_id
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createElementBlock(`div`, ve, [
|
|
(r[30] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`CPU`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
ConfigResourceOption,
|
|
{
|
|
label: `CPU`,
|
|
unit: `核`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).cpu,
|
|
"onUpdate:modelValue": (r[4] ||= (
|
|
e,
|
|
) => (unref(j).cpu = e)),
|
|
options: unref(O).cpu,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
])),
|
|
unref(j).recommend_config_id
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createElementBlock(`div`, W, [
|
|
(r[31] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`内存`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
ConfigResourceOption,
|
|
{
|
|
label: `内存`,
|
|
unit: unref(pt)?.memory_unit || `GB`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).memory,
|
|
"onUpdate:modelValue": (r[5] ||= (
|
|
e,
|
|
) => (unref(j).memory = e)),
|
|
options: unref(O).memory,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`unit`,
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
],
|
|
),
|
|
])),
|
|
]),
|
|
unref(j).recommend_config_id
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createElementBlock(`div`, G, [
|
|
(r[34] ||= createElementVNode(
|
|
`h2`,
|
|
{
|
|
class: `section-title`,
|
|
},
|
|
`存储配置`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`div`, K, [
|
|
createVNode(
|
|
ConfigDiskCard,
|
|
{
|
|
label: `系统盘`,
|
|
title:
|
|
unref(j).system_disk.disk_type ||
|
|
`标准存储`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).system_disk.size,
|
|
"onUpdate:modelValue": (r[8] ||= (
|
|
e,
|
|
) => (unref(j).system_disk.size = e)),
|
|
options: unref(_t),
|
|
onChange: $,
|
|
},
|
|
createSlots(
|
|
{
|
|
_: 2,
|
|
},
|
|
[
|
|
unref(gt).length > 1
|
|
? {
|
|
name: `type`,
|
|
fn: withCtx(() => [
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `磁盘类型`,
|
|
disabled: unref(Q),
|
|
modelValue:
|
|
unref(j).system_disk
|
|
.disk_type,
|
|
"onUpdate:modelValue":
|
|
(r[6] ||= (e) =>
|
|
(unref(
|
|
j,
|
|
).system_disk.disk_type =
|
|
e)),
|
|
options: unref(gt),
|
|
compact: ``,
|
|
onChange: Tt,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
],
|
|
),
|
|
]),
|
|
key: `0`,
|
|
}
|
|
: void 0,
|
|
bt(`system`, unref(j).system_disk)
|
|
.length
|
|
? {
|
|
name: `extra`,
|
|
fn: withCtx(() => [
|
|
createVNode(
|
|
v,
|
|
{
|
|
"aria-label": `系统盘性能`,
|
|
disabled: unref(Q),
|
|
"model-value":
|
|
unref(j).system_disk
|
|
.disk_limit_id,
|
|
options: bt(
|
|
`system`,
|
|
unref(j).system_disk,
|
|
).map((e) => ({
|
|
label: xt(e),
|
|
value: e.id,
|
|
})),
|
|
"option-label": `label`,
|
|
"option-value": `value`,
|
|
placeholder: `默认性能`,
|
|
"show-clear": ``,
|
|
"onUpdate:modelValue":
|
|
(r[7] ||= (e) => {
|
|
((unref(
|
|
j,
|
|
).system_disk.disk_limit_id =
|
|
e ?? ``),
|
|
$());
|
|
}),
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`model-value`,
|
|
`options`,
|
|
],
|
|
),
|
|
]),
|
|
key: `1`,
|
|
}
|
|
: void 0,
|
|
],
|
|
),
|
|
1032,
|
|
[
|
|
`title`,
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
],
|
|
),
|
|
]),
|
|
(unref(vt).length && unref(Ve)) ||
|
|
unref(j).data_disk?.length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, ye, [
|
|
(r[33] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`数据盘`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`div`, be, [
|
|
(openBlock(!0),
|
|
createElementBlock(
|
|
Fragment,
|
|
null,
|
|
renderList(
|
|
unref(j).data_disk,
|
|
(t, n) => (
|
|
openBlock(),
|
|
createBlock(
|
|
ConfigDiskCard,
|
|
{
|
|
key: n,
|
|
label: `数据盘 ${n + 1}`,
|
|
"hide-label": ``,
|
|
title:
|
|
t.disk_type ||
|
|
`标准存储`,
|
|
disabled: unref(Q),
|
|
modelValue: t.size,
|
|
"onUpdate:modelValue": (
|
|
e,
|
|
) => (t.size = e),
|
|
options: yt(t),
|
|
removable:
|
|
Number(t.is_free) !== 1,
|
|
onChange: $,
|
|
onRemove: (e) =>
|
|
unref(D).removeDataDisk(
|
|
n,
|
|
),
|
|
},
|
|
createSlots(
|
|
{
|
|
_: 2,
|
|
},
|
|
[
|
|
unref(vt).length > 1 &&
|
|
Number(t.is_free) !== 1
|
|
? {
|
|
name: `type`,
|
|
fn: withCtx(
|
|
() => [
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `数据盘 ${n + 1}类型`,
|
|
disabled:
|
|
unref(
|
|
Q,
|
|
),
|
|
modelValue:
|
|
t.disk_type,
|
|
"onUpdate:modelValue":
|
|
(e) =>
|
|
(t.disk_type =
|
|
e),
|
|
options:
|
|
unref(
|
|
vt,
|
|
),
|
|
compact: ``,
|
|
onChange:
|
|
(e) =>
|
|
Et(t),
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`label`,
|
|
`disabled`,
|
|
`modelValue`,
|
|
`onUpdate:modelValue`,
|
|
`options`,
|
|
`onChange`,
|
|
],
|
|
),
|
|
],
|
|
),
|
|
key: `0`,
|
|
}
|
|
: void 0,
|
|
bt(`data`, t).length
|
|
? {
|
|
name: `extra`,
|
|
fn: withCtx(
|
|
() => [
|
|
createVNode(
|
|
v,
|
|
{
|
|
"aria-label": `数据盘 ${n + 1}性能`,
|
|
disabled:
|
|
unref(
|
|
Q,
|
|
),
|
|
"model-value":
|
|
t.disk_limit_id,
|
|
options:
|
|
bt(
|
|
`data`,
|
|
t,
|
|
).map(
|
|
(
|
|
e,
|
|
) => ({
|
|
label:
|
|
xt(
|
|
e,
|
|
),
|
|
value:
|
|
e.id,
|
|
}),
|
|
),
|
|
"option-label": `label`,
|
|
"option-value": `value`,
|
|
placeholder: `默认性能`,
|
|
"show-clear": ``,
|
|
"onUpdate:modelValue":
|
|
(e) => {
|
|
((t.disk_limit_id =
|
|
e ??
|
|
``),
|
|
$());
|
|
},
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`aria-label`,
|
|
`disabled`,
|
|
`model-value`,
|
|
`options`,
|
|
`onUpdate:modelValue`,
|
|
],
|
|
),
|
|
],
|
|
),
|
|
key: `1`,
|
|
}
|
|
: void 0,
|
|
Number(t.is_free) === 1
|
|
? {
|
|
name: `hint`,
|
|
fn: withCtx(
|
|
() => [
|
|
createElementVNode(
|
|
`p`,
|
|
q,
|
|
`含赠送 ` +
|
|
toDisplayString(
|
|
unref(
|
|
pt,
|
|
)
|
|
?.free_disk_size,
|
|
) +
|
|
` GB,扩容费用以当前报价为准。`,
|
|
1,
|
|
),
|
|
],
|
|
),
|
|
key: `2`,
|
|
}
|
|
: void 0,
|
|
],
|
|
),
|
|
1032,
|
|
[
|
|
`label`,
|
|
`title`,
|
|
`disabled`,
|
|
`modelValue`,
|
|
`onUpdate:modelValue`,
|
|
`options`,
|
|
`removable`,
|
|
`onRemove`,
|
|
],
|
|
)
|
|
),
|
|
),
|
|
128,
|
|
)),
|
|
(unref(j).data_disk?.length ?? 0) <
|
|
unref(Ve) && unref(vt).length
|
|
? (openBlock(),
|
|
createBlock(
|
|
ConfigDiskAdd,
|
|
{
|
|
key: 0,
|
|
disabled: unref(Q),
|
|
onAdd: (r[9] ||= (e) =>
|
|
unref(D).addDataDisk()),
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`],
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
createElementVNode(
|
|
`span`,
|
|
xe,
|
|
`最多可添加 ` +
|
|
toDisplayString(unref(Ve)) +
|
|
` 块数据盘,已添加 ` +
|
|
toDisplayString(
|
|
unref(j).data_disk?.length ?? 0,
|
|
) +
|
|
` 块`,
|
|
1,
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
])),
|
|
unref(j).recommend_config_id
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createElementBlock(`div`, Se, [
|
|
(r[40] ||= createElementVNode(
|
|
`h2`,
|
|
{
|
|
class: `section-title`,
|
|
},
|
|
`网络配置`,
|
|
-1,
|
|
)),
|
|
unref(mt).length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, Ce, [
|
|
(r[35] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`网络类型`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `网络类型`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).network_type,
|
|
"onUpdate:modelValue": (r[10] ||=
|
|
(e) =>
|
|
(unref(j).network_type = e)),
|
|
options: unref(mt),
|
|
compact: ``,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(A)?.bill_type === `bw`
|
|
? (openBlock(),
|
|
createElementBlock(`div`, J, [
|
|
createVNode(
|
|
ConfigBandwidth,
|
|
{
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).bw,
|
|
"onUpdate:modelValue": (r[11] ||=
|
|
(e) => (unref(j).bw = e)),
|
|
options: unref(A).bw,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(A)?.bill_type === `flow` &&
|
|
!unref(qe) &&
|
|
unref(A).flow.length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, we, [
|
|
(r[36] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`流量`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
ConfigResourceOption,
|
|
{
|
|
label: `流量`,
|
|
unit: `GB`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).flow,
|
|
"onUpdate:modelValue": (r[12] ||=
|
|
(e) => (unref(j).flow = e)),
|
|
options: unref(A).flow,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(A)?.bill_type === `flow` &&
|
|
unref(St).length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, Te, [
|
|
(r[37] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`带宽上限`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `带宽上限`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).bw,
|
|
"onUpdate:modelValue": (r[13] ||=
|
|
(e) => (unref(j).bw = e)),
|
|
options: unref(St),
|
|
compact: ``,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(A)?.defence?.length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, Ee, [
|
|
(r[38] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`防护峰值`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
ConfigResourceOption,
|
|
{
|
|
label: `防护峰值`,
|
|
unit: `Gbps`,
|
|
disabled: unref(Q),
|
|
"model-value":
|
|
unref(j).peak_defence,
|
|
options: unref(A).defence,
|
|
"onUpdate:modelValue": (r[14] ||=
|
|
(e) =>
|
|
(unref(j).peak_defence =
|
|
String(e))),
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`model-value`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(ht).length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, De, [
|
|
(r[39] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`附加 IPv4`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
ConfigResourceOption,
|
|
{
|
|
label: `附加 IPv4`,
|
|
unit: `个`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).ip_num,
|
|
"onUpdate:modelValue": (r[15] ||=
|
|
(e) => (unref(j).ip_num = e)),
|
|
options: unref(ht),
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
])),
|
|
unref(ut).length ||
|
|
unref(dt).length ||
|
|
(unref(ft).length &&
|
|
!unref(j).recommend_config_id)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, Oe, [
|
|
(r[44] ||= createElementVNode(
|
|
`h2`,
|
|
{
|
|
class: `section-title`,
|
|
},
|
|
`附加资源`,
|
|
-1,
|
|
)),
|
|
unref(ut).length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, ke, [
|
|
(r[41] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`备份额度`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `备份额度`,
|
|
compact: ``,
|
|
modelValue: unref(j).backup_num,
|
|
"onUpdate:modelValue": (r[16] ||=
|
|
(e) =>
|
|
(unref(j).backup_num = e)),
|
|
disabled: unref(Q),
|
|
options: [
|
|
{
|
|
label: `不启用`,
|
|
value: ``,
|
|
},
|
|
...unref(ut).map((e) => ({
|
|
label: `${e.num} 个`,
|
|
value: String(e.num),
|
|
})),
|
|
],
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`modelValue`,
|
|
`disabled`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(dt).length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, Ae, [
|
|
(r[42] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`快照额度`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `快照额度`,
|
|
compact: ``,
|
|
modelValue: unref(j).snap_num,
|
|
"onUpdate:modelValue": (r[17] ||=
|
|
(e) => (unref(j).snap_num = e)),
|
|
disabled: unref(Q),
|
|
options: [
|
|
{
|
|
label: `不启用`,
|
|
value: ``,
|
|
},
|
|
...unref(dt).map((e) => ({
|
|
label: `${e.num} 个`,
|
|
value: String(e.num),
|
|
})),
|
|
],
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`modelValue`,
|
|
`disabled`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(ft).length &&
|
|
!unref(j).recommend_config_id
|
|
? (openBlock(),
|
|
createElementBlock(`div`, je, [
|
|
(r[43] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`GPU 数量`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
f,
|
|
{
|
|
label: `GPU 数量`,
|
|
compact: ``,
|
|
"model-value":
|
|
unref(j).gpu_num || 0,
|
|
disabled: unref(Q),
|
|
options: [
|
|
{
|
|
label: `不启用`,
|
|
value: 0,
|
|
},
|
|
...unref(ft).map((e) => ({
|
|
label: `${e.value} 张`,
|
|
value: e.value,
|
|
})),
|
|
],
|
|
"option-label": `label`,
|
|
"option-value": `value`,
|
|
"onUpdate:modelValue": (r[18] ||=
|
|
(e) => {
|
|
((unref(j).gpu_num =
|
|
Number(e)),
|
|
$());
|
|
}),
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`model-value`,
|
|
`disabled`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(it).length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, Me, [
|
|
(r[46] ||= createElementVNode(
|
|
`h2`,
|
|
{
|
|
class: `section-title`,
|
|
},
|
|
`操作系统`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
f,
|
|
{
|
|
modelValue: unref(ot),
|
|
"onUpdate:modelValue": (r[19] ||= (
|
|
e,
|
|
) =>
|
|
isRef(ot) ? (ot.value = e) : null),
|
|
label: `操作系统`,
|
|
images: ``,
|
|
disabled: unref(Q),
|
|
options: unref(it).map((e) => ({
|
|
label: unref(os_name_t)(e.name),
|
|
value: e.id,
|
|
iconUrl: e.icon_url,
|
|
icon: e.icon,
|
|
})),
|
|
onChange: Ot,
|
|
},
|
|
null,
|
|
8,
|
|
[`modelValue`, `disabled`, `options`],
|
|
),
|
|
createElementVNode(`div`, Ne, [
|
|
(r[45] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`镜像版本`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
v,
|
|
{
|
|
"aria-label": `镜像版本`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).image_id,
|
|
"onUpdate:modelValue": (r[20] ||= (
|
|
e,
|
|
) => (unref(j).image_id = e)),
|
|
options: unref(at),
|
|
"option-label": (e) =>
|
|
unref(os_name_t)(e.name),
|
|
optionValue: `id`,
|
|
class: `grow`,
|
|
onChange: Ot,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
`option-label`,
|
|
],
|
|
),
|
|
]),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
createVNode(
|
|
x,
|
|
{
|
|
modelValue: unref(Ge),
|
|
"onUpdate:modelValue": (r[21] ||= (e) =>
|
|
isRef(Ge) ? (Ge.value = e) : null),
|
|
fields: unref(Ke),
|
|
disabled: unref(Q),
|
|
},
|
|
null,
|
|
8,
|
|
[`modelValue`, `fields`, `disabled`],
|
|
),
|
|
createVNode(
|
|
E,
|
|
{
|
|
"product-id": S.productId,
|
|
quantity: unref(N),
|
|
"edit-position": S.edit?.position,
|
|
editing: !!S.edit,
|
|
"login-redirect": unref(Xe),
|
|
summary: unref(wt),
|
|
price: unref(I),
|
|
"quote-ready": unref(Be) && !ee.identityLocked,
|
|
"price-loading": unref(pe),
|
|
"can-submit": unref(et),
|
|
"active-action": unref(Z),
|
|
disabled: unref(Q),
|
|
"promo-code": unref(He),
|
|
"onUpdate:promoCode": (r[24] ||= (e) =>
|
|
isRef(He) ? (He.value = e) : null),
|
|
"promo-discount": unref(Ue),
|
|
"level-discount": unref(We),
|
|
error: unref(Y),
|
|
"action-error": unref(Ze),
|
|
"cart-tip": unref(Qe),
|
|
onCart: kt,
|
|
onBuy: At,
|
|
onRecalc: (r[25] ||= (e) =>
|
|
unref(D).calcPrice()),
|
|
onRetry: (r[26] ||= (e) =>
|
|
unref(D).calcPrice()),
|
|
},
|
|
{
|
|
summary: withCtx(() => [
|
|
createElementVNode(`div`, Pe, [
|
|
(r[47] ||= createElementVNode(
|
|
`dt`,
|
|
null,
|
|
`计费方式`,
|
|
-1,
|
|
)),
|
|
createElementVNode(
|
|
`dd`,
|
|
null,
|
|
toDisplayString(
|
|
unref(qe) ? `按需计费` : `包年包月`,
|
|
),
|
|
1,
|
|
),
|
|
]),
|
|
unref(Be) && unref(X)
|
|
? (openBlock(),
|
|
createElementBlock(
|
|
Fragment,
|
|
{
|
|
key: 0,
|
|
},
|
|
[
|
|
createElementVNode(`div`, Fe, [
|
|
createElementVNode(
|
|
`dt`,
|
|
null,
|
|
toDisplayString(
|
|
unref(X).total
|
|
? `运行费用(全部实例)`
|
|
: `运行费用(每台)`,
|
|
),
|
|
1,
|
|
),
|
|
createElementVNode(
|
|
`dd`,
|
|
null,
|
|
`¥ ` +
|
|
toDisplayString(
|
|
unref(X).renew,
|
|
) +
|
|
` / 小时`,
|
|
1,
|
|
),
|
|
]),
|
|
unref(X).flow === void 0
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createElementBlock(`div`, Ie, [
|
|
(r[48] ||= createElementVNode(
|
|
`dt`,
|
|
null,
|
|
`流量单价`,
|
|
-1,
|
|
)),
|
|
createElementVNode(
|
|
`dd`,
|
|
null,
|
|
`¥ ` +
|
|
toDisplayString(
|
|
unref(X).flow,
|
|
) +
|
|
` / GB`,
|
|
1,
|
|
),
|
|
])),
|
|
unref(X).keep === void 0
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createElementBlock(`div`, Le, [
|
|
(r[49] ||= createElementVNode(
|
|
`dt`,
|
|
null,
|
|
`保留期费用(每台)`,
|
|
-1,
|
|
)),
|
|
createElementVNode(
|
|
`dd`,
|
|
null,
|
|
`¥ ` +
|
|
toDisplayString(
|
|
unref(X).keep,
|
|
) +
|
|
` / 小时`,
|
|
1,
|
|
),
|
|
])),
|
|
],
|
|
64,
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
default: withCtx(() => [
|
|
unref(qe)
|
|
? (openBlock(),
|
|
createBlock(
|
|
o,
|
|
{
|
|
key: 0,
|
|
severity: `info`,
|
|
closable: !1,
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
...(r[50] ||= [
|
|
createTextVNode(
|
|
`配置费用为当前开通应付费用。实例运行与流量费用按实际用量另计。`,
|
|
-1,
|
|
),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
createElementVNode(`div`, Re, [
|
|
createElementVNode(
|
|
`label`,
|
|
null,
|
|
toDisplayString(
|
|
unref(qe) ? `计费单位` : `购买时长`,
|
|
),
|
|
1,
|
|
),
|
|
createVNode(
|
|
v,
|
|
{
|
|
"aria-label": `购买时长`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(j).duration_id,
|
|
"onUpdate:modelValue": (r[22] ||= (e) =>
|
|
(unref(j).duration_id = e)),
|
|
options: unref(Ct),
|
|
optionLabel: `label`,
|
|
optionValue: `id`,
|
|
placeholder: `请选择周期`,
|
|
class: `grow`,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
unref(le).length
|
|
? createCommentVNode(``, !0)
|
|
: (openBlock(),
|
|
createBlock(
|
|
o,
|
|
{
|
|
key: 0,
|
|
severity: `warn`,
|
|
closable: !1,
|
|
class: `cycle-warn`,
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
...(r[51] ||= [
|
|
createTextVNode(
|
|
` 该商品暂未配置可售周期 `,
|
|
-1,
|
|
),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
)),
|
|
]),
|
|
createElementVNode(`div`, ze, [
|
|
(r[52] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`购买数量`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
w,
|
|
{
|
|
"aria-label": `购买数量`,
|
|
disabled: unref(Q),
|
|
modelValue: unref(N),
|
|
"onUpdate:modelValue": [
|
|
(r[23] ||= (e) =>
|
|
isRef(N) ? (N.value = e) : null),
|
|
$,
|
|
],
|
|
min: 1,
|
|
max: 99,
|
|
showButtons: ``,
|
|
buttonLayout: `horizontal`,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`],
|
|
),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
8,
|
|
[
|
|
`product-id`,
|
|
`quantity`,
|
|
`edit-position`,
|
|
`editing`,
|
|
`login-redirect`,
|
|
`summary`,
|
|
`price`,
|
|
`quote-ready`,
|
|
`price-loading`,
|
|
`can-submit`,
|
|
`active-action`,
|
|
`disabled`,
|
|
`promo-code`,
|
|
`promo-discount`,
|
|
`level-discount`,
|
|
`error`,
|
|
`action-error`,
|
|
`cart-tip`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
])
|
|
);
|
|
}
|
|
);
|
|
},
|
|
}),
|
|
[[`__scopeId`, `data-v-8ba1c9ae`]],
|
|
),
|
|
{
|
|
__name: `MfCloudConfig`,
|
|
},
|
|
);
|
|
export {};
|
|
export default Y;
|
|
</script>
|