1611 lines
60 KiB
Vue
1611 lines
60 KiB
Vue
<script>
|
|
/**
|
|
* 快快云 ECS 商品配置:区域/CPU 型号决定可售套餐,套餐再约束网络、磁盘、防护和周期。
|
|
* productId 确定商品,edit 表示购物车编辑;settled 只在创建即时购买订单后通知父级。
|
|
*/
|
|
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/KkyEcsConfig.BFaAwQPZ.css";
|
|
import { toDisplayString } 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 { 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 { 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";
|
|
function ue(e) {
|
|
if (!e || !Number.isFinite(Number(e.min)) || !Number.isFinite(Number(e.max)))
|
|
return null;
|
|
let t = Math.max(0, Math.min(Number(e.min), Number(e.max))),
|
|
n = Math.max(Number(e.min), Number(e.max));
|
|
return n <= 0
|
|
? null
|
|
: {
|
|
min: t,
|
|
max: n,
|
|
step: Number(e.step) > 0 ? Number(e.step) : 1,
|
|
};
|
|
}
|
|
function M(e, t) {
|
|
// 将磁盘容量吸附到 min + n*step,最大值必须是区间内可达档位。
|
|
let n = ue(t);
|
|
if (!n) return ``;
|
|
let r = e === `` || !Number.isFinite(Number(e)) ? n.min : Number(e),
|
|
i = Math.floor((n.max - n.min) / n.step),
|
|
a = Math.min(i, Math.max(0, Math.round((r - n.min) / n.step)));
|
|
return Number((n.min + a * n.step).toFixed(8));
|
|
}
|
|
function de() {
|
|
return {
|
|
line_id: ``,
|
|
line_name: ``,
|
|
cpu_model_id: ``,
|
|
cpu_model_name: ``,
|
|
cpu_num: ``,
|
|
memory: ``,
|
|
package_config_id: ``,
|
|
system_disk: {
|
|
size: ``,
|
|
type: ``,
|
|
},
|
|
data_disk: [],
|
|
network_id: ``,
|
|
network_name: ``,
|
|
bill_method: ``,
|
|
bill_method_name: ``,
|
|
bandwidth: 0,
|
|
protect: ``,
|
|
qty: 1,
|
|
duration_id: ``,
|
|
duration_name: ``,
|
|
image_id: ``,
|
|
version_name: ``,
|
|
allocate_intranet_ip: 2,
|
|
};
|
|
}
|
|
function fe(e, t = {}) {
|
|
// 配置状态与报价分开保存;N 为当前输入快照,P 为最近成功报价对应快照。
|
|
let n = useApi(),
|
|
i = t.edit,
|
|
o = ref(!i),
|
|
c = cart_edit_r(n, i),
|
|
l = shallowRef(null),
|
|
d = ref([]),
|
|
f = ref([]),
|
|
p = ref(de()),
|
|
m = ref({}),
|
|
h = ref([]),
|
|
g = ref(`—`),
|
|
_ = ref(``),
|
|
v = ref(0),
|
|
y = ref(0),
|
|
b = ref(!0),
|
|
x = ref(!1),
|
|
S = ref(``),
|
|
C = (e, t) => String(e) === String(t),
|
|
w = ref(!1),
|
|
T = computed(() => {
|
|
let e = l.value;
|
|
return !e ||
|
|
w.value ||
|
|
(e.cur_line_id && !C(e.cur_line_id, p.value.line_id)) ||
|
|
(e.cur_cpu_model_id && !C(e.cur_cpu_model_id, p.value.cpu_model_id))
|
|
? []
|
|
: (e.package_list ?? []).filter(
|
|
(e) =>
|
|
Number(e.is_sell_out) !== 1 &&
|
|
Number.isFinite(Number(e.cpu_num)) &&
|
|
Number(e.cpu_num) > 0 &&
|
|
Number.isFinite(Number(e.memory)) &&
|
|
Number(e.memory) > 0,
|
|
);
|
|
}),
|
|
E = computed(() =>
|
|
[...new Set(T.value.map((e) => Number(e.cpu_num)))].sort((e, t) => e - t),
|
|
),
|
|
re = computed(() =>
|
|
[
|
|
...new Set(
|
|
T.value
|
|
.filter((e) => Number(e.cpu_num) === Number(p.value.cpu_num))
|
|
.map((e) => Number(e.memory)),
|
|
),
|
|
].sort((e, t) => e - t),
|
|
),
|
|
k = computed(() => {
|
|
let e = l.value?.data_disk_config;
|
|
if (!ue(e)) return 0;
|
|
let t = Number(e?.max_num);
|
|
return Number.isFinite(t) && t > 0 ? Math.floor(t) : 0;
|
|
});
|
|
function ie() {
|
|
// 切换套餐后重新约束系统盘和数据盘,并截断超出商品允许数量的附加磁盘。
|
|
let e = l.value;
|
|
if (!e) return;
|
|
let t = p.value,
|
|
n = e.system_disk_config?.[String(t.package_config_id)];
|
|
t.system_disk =
|
|
n && ue(n)
|
|
? {
|
|
size: M(t.system_disk.size, n),
|
|
type: n.type,
|
|
}
|
|
: {
|
|
size: ``,
|
|
type: ``,
|
|
};
|
|
let r = e.data_disk_config;
|
|
t.data_disk =
|
|
r && k.value
|
|
? t.data_disk.slice(0, k.value).map((e) => ({
|
|
size: M(e.size, r),
|
|
type: r.type,
|
|
}))
|
|
: [];
|
|
}
|
|
async function ae() {
|
|
let e = l.value?.data_disk_config;
|
|
F ||
|
|
w.value ||
|
|
!e ||
|
|
p.value.data_disk.length >= k.value ||
|
|
(p.value.data_disk.push({
|
|
size: M(``, e),
|
|
type: e.type,
|
|
}),
|
|
await B());
|
|
}
|
|
async function ce(e) {
|
|
F ||
|
|
!Number.isInteger(e) ||
|
|
e < 0 ||
|
|
e >= p.value.data_disk.length ||
|
|
(p.value.data_disk.splice(e, 1), await B());
|
|
}
|
|
function j(e) {
|
|
((p.value.package_config_id = e?.id ?? ``),
|
|
(p.value.cpu_num = e?.cpu_num ?? ``),
|
|
(p.value.memory = e?.memory ?? ``));
|
|
}
|
|
async function le(e) {
|
|
if (Number(e) === Number(p.value.cpu_num)) return;
|
|
let t = T.value.filter((t) => Number(t.cpu_num) === Number(e)),
|
|
n =
|
|
t.find((e) => Number(e.memory) === Number(p.value.memory)) ??
|
|
t.slice().sort((e, t) => Number(e.memory) - Number(t.memory))[0];
|
|
n &&
|
|
!C(n.id, p.value.package_config_id) &&
|
|
(j(n),
|
|
await V({
|
|
pkg: !0,
|
|
}));
|
|
}
|
|
async function fe(e) {
|
|
if (Number(e) === Number(p.value.memory)) return;
|
|
let t = T.value.find(
|
|
(t) =>
|
|
Number(t.cpu_num) === Number(p.value.cpu_num) &&
|
|
Number(t.memory) === Number(e),
|
|
);
|
|
t &&
|
|
!C(t.id, p.value.package_config_id) &&
|
|
(j(t),
|
|
await V({
|
|
pkg: !0,
|
|
}));
|
|
}
|
|
let N = computed(() =>
|
|
JSON.stringify({
|
|
config: p.value,
|
|
promo: _.value,
|
|
fields: m.value,
|
|
}),
|
|
),
|
|
pe = 0,
|
|
P = ref(``),
|
|
F = !1,
|
|
I = 0,
|
|
L = (e) => !F && e === I,
|
|
R = computed(() => o.value && !!P.value && P.value === N.value && !x.value);
|
|
function z() {
|
|
((pe += 1),
|
|
(P.value = ``),
|
|
(g.value = `—`),
|
|
(v.value = 0),
|
|
(y.value = 0),
|
|
(x.value = !1));
|
|
}
|
|
(watch(N, z, {
|
|
flush: `sync`,
|
|
}),
|
|
onBeforeUnmount(() => {
|
|
((F = !0), z());
|
|
}));
|
|
function me() {
|
|
if (F || !R.value)
|
|
throw Error(`当前配置报价尚未确认,请等待或重新计算报价`);
|
|
}
|
|
function he() {
|
|
// 依据服务端可售集合修正级联选择:区域 → CPU 型号/套餐 → 网络 → 计费方式。
|
|
let e = l.value;
|
|
if (!e) return;
|
|
let t = p.value;
|
|
(!t.line_id && e.cur_line_id && (t.line_id = e.cur_line_id),
|
|
!t.cpu_model_id &&
|
|
e.cur_cpu_model_id &&
|
|
(t.cpu_model_id = e.cur_cpu_model_id),
|
|
(t.line_name = e.line_list?.find((e) => C(e.id, t.line_id))?.name ?? ``),
|
|
(t.cpu_model_name =
|
|
e.cpu_model_list?.find((e) => C(e.id, t.cpu_model_id))?.name ?? ``),
|
|
j(T.value.find((e) => C(e.id, t.package_config_id)) ?? T.value[0]));
|
|
let n = String(t.package_config_id),
|
|
r = (e.network_list ?? []).filter(
|
|
(t) => e.bill_method_list?.[n]?.[String(t.id)]?.length,
|
|
);
|
|
r.some((e) => C(e.id, t.network_id)) || (t.network_id = r[0]?.id ?? ``);
|
|
let i = String(t.network_id);
|
|
t.network_name =
|
|
e.network_list?.find((e) => C(e.id, t.network_id))?.name ?? ``;
|
|
let a = e.bill_method_list?.[n]?.[i] ?? [],
|
|
o = a.find((e) => String(e.id) === String(t.bill_method)) ?? a[0];
|
|
(o
|
|
? ((t.bill_method = o.id),
|
|
(t.bill_method_name = o.name),
|
|
(t.bandwidth = Math.min(
|
|
o.config.max,
|
|
Math.max(o.config.min, Number(t.bandwidth) || o.config.min),
|
|
)))
|
|
: ((t.bill_method = ``), (t.bill_method_name = ``)),
|
|
ie());
|
|
let s = e.protect_list?.[n] ?? [];
|
|
if (
|
|
(s.includes(Number(t.protect)) || (t.protect = s[0] ?? ``), !t.image_id)
|
|
) {
|
|
let e = d.value[0]?.image?.[0];
|
|
e && ((t.image_id = e.id), (t.version_name = e.name));
|
|
}
|
|
}
|
|
function ge(e) {
|
|
let t =
|
|
e.config_options &&
|
|
typeof e.config_options == `object` &&
|
|
!Array.isArray(e.config_options)
|
|
? cart_edit_n(e.config_options)
|
|
: {},
|
|
n = {
|
|
...t,
|
|
};
|
|
p.value = {
|
|
...p.value,
|
|
...n,
|
|
};
|
|
let r = Number(e.qty);
|
|
Number.isInteger(r) && r > 0 && (p.value.qty = r);
|
|
let i =
|
|
e.customfield &&
|
|
typeof e.customfield == `object` &&
|
|
!Array.isArray(e.customfield)
|
|
? e.customfield
|
|
: {},
|
|
a = t.promo_code ?? i.promo_code;
|
|
Array.isArray(a)
|
|
? (_.value = String(a.find(Boolean) ?? ``))
|
|
: a != null && (_.value = String(a));
|
|
let o =
|
|
e.self_defined_field &&
|
|
typeof e.self_defined_field == `object` &&
|
|
!Array.isArray(e.self_defined_field)
|
|
? e.self_defined_field
|
|
: {};
|
|
for (let e of h.value) m.value[e.id] = String(o[e.id] ?? ``);
|
|
}
|
|
function _e() {
|
|
let t = p.value;
|
|
return n.get(`/product/${e}/kky_ecs/order_page`, {
|
|
id: e,
|
|
...(t.line_id
|
|
? {
|
|
line_id: t.line_id,
|
|
}
|
|
: {}),
|
|
...(t.cpu_model_id
|
|
? {
|
|
cpu_model_id: t.cpu_model_id,
|
|
}
|
|
: {}),
|
|
...(t.package_config_id
|
|
? {
|
|
package_config_id: t.package_config_id,
|
|
}
|
|
: {}),
|
|
...(t.network_id
|
|
? {
|
|
network_id: t.network_id,
|
|
}
|
|
: {}),
|
|
});
|
|
}
|
|
async function ve(e = I) {
|
|
let t = await _e();
|
|
return L(e) ? ((l.value = t), (w.value = !1), he(), !0) : !1;
|
|
}
|
|
async function ye(t = I) {
|
|
let r = N.value,
|
|
i = await n.post(`/product/${e}/kky_ecs/duration`, {
|
|
id: e,
|
|
...p.value,
|
|
});
|
|
if (!L(t) || r !== N.value) return !1;
|
|
((f.value = Array.isArray(i) ? i : []),
|
|
f.value.some((e) => String(e.id) === String(p.value.duration_id)) ||
|
|
(p.value.duration_id = f.value[0]?.id ?? ``));
|
|
let a = f.value.find((e) => String(e.id) === String(p.value.duration_id));
|
|
return ((p.value.duration_name = a?.name ?? ``), !0);
|
|
}
|
|
async function B() {
|
|
// 报价绑定输入快照与请求序号;配置变化立即废弃旧价格,不能让迟到响应恢复购买按钮。
|
|
if (!o.value || (z(), F || !p.value.duration_id || !p.value.image_id))
|
|
return;
|
|
if (l.value && !T.value.some((e) => C(e.id, p.value.package_config_id))) {
|
|
S.value = `当前暂无可选 CPU 与内存规格`;
|
|
return;
|
|
}
|
|
ie();
|
|
let t = ++pe,
|
|
r = N.value,
|
|
i = () => !F && t === pe && r === N.value;
|
|
((x.value = !0), (S.value = ``));
|
|
try {
|
|
let t = await n.post(`/product/${e}/config_option`, {
|
|
id: e,
|
|
config_options: {
|
|
...p.value,
|
|
promo_code: _.value,
|
|
event_promotion: ``,
|
|
},
|
|
qty: p.value.qty,
|
|
});
|
|
if (!i()) return;
|
|
let a = t?.price_total ?? t?.price;
|
|
if (
|
|
a == null ||
|
|
String(a).trim() === `` ||
|
|
!Number.isFinite(Number(a)) ||
|
|
Number(a) < 0
|
|
)
|
|
throw Error(`未获得有效报价,请重新计算`);
|
|
((g.value = String(a)),
|
|
(v.value = Number(t?.price_promo_code_discount ?? 0)),
|
|
(y.value = Number(t?.price_client_level_discount ?? 0)),
|
|
(P.value = r));
|
|
} catch (e) {
|
|
if (!i()) return;
|
|
S.value = e instanceof Error ? e.message : `报价加载失败,请重试`;
|
|
} finally {
|
|
i() && (x.value = !1);
|
|
}
|
|
}
|
|
async function be() {
|
|
// 初始化并行读取镜像与可售配置,编辑场景再回填购物车和自定义字段,最后获取周期与报价。
|
|
o.value = !1;
|
|
let r = ++I;
|
|
(z(), (b.value = !0), (S.value = ``), i && ge(i.item));
|
|
try {
|
|
let [a, s] = await Promise.all([
|
|
n.get(`/product/${e}/kky_ecs/image`),
|
|
_e(),
|
|
]);
|
|
if (!L(r)) return;
|
|
if (
|
|
((d.value = a.list ?? []),
|
|
(l.value = s),
|
|
(h.value = []),
|
|
(m.value = {}),
|
|
t.customFields || i)
|
|
) {
|
|
let t = await n.get(`/product/${e}/self_defined_field/order_page`);
|
|
if (!L(r)) return;
|
|
if (!Array.isArray(t?.data))
|
|
throw Error(`商品自定义字段加载失败,请重试`);
|
|
((h.value = product_fields_r(t)),
|
|
(m.value = product_fields_t(h.value)));
|
|
}
|
|
if (
|
|
(cart_edit_o(
|
|
i,
|
|
h.value.map((e) => e.id),
|
|
),
|
|
i && ge(i.item),
|
|
(o.value = !0),
|
|
(w.value = !1),
|
|
he(),
|
|
!l.value || !l.value.line_list?.length)
|
|
) {
|
|
S.value = `该商品暂无可售区域(可能已售罄)`;
|
|
return;
|
|
}
|
|
if (!(await ye(r))) return;
|
|
((b.value = !1), L(r) && (await B()));
|
|
} catch (e) {
|
|
L(r) &&
|
|
((l.value = null),
|
|
(S.value = e instanceof Error ? e.message : `加载商品配置失败`));
|
|
} finally {
|
|
L(r) && (b.value = !1);
|
|
}
|
|
}
|
|
async function V(e = {}) {
|
|
// 上游选项改变时清空依赖选项,再按顺序重新读取配置、周期、价格。
|
|
let t = ++I;
|
|
(z(),
|
|
(S.value = ``),
|
|
e.line || e.cpu
|
|
? ((w.value = !0),
|
|
e.line && (p.value.cpu_model_id = ``),
|
|
j(),
|
|
(p.value.network_id = ``),
|
|
(p.value.bill_method = ``))
|
|
: e.pkg && (p.value.bill_method = ``));
|
|
try {
|
|
if (!(await ve(t)) || !(await ye(t))) return;
|
|
L(t) && (await B());
|
|
} catch (e) {
|
|
L(t) &&
|
|
(S.value = e instanceof Error ? e.message : `配置报价加载失败,请重试`);
|
|
}
|
|
}
|
|
async function xe() {
|
|
// 加购与编辑都必须使用已确认报价和已校验字段;编辑保存期间仍核对快照未变化。
|
|
(me(), product_fields_i(h.value, m.value));
|
|
let t = {
|
|
product_id: e,
|
|
config_options: {
|
|
...p.value,
|
|
},
|
|
qty: p.value.qty,
|
|
customfield: {
|
|
promo_code: _.value,
|
|
event_promotion: ``,
|
|
},
|
|
self_defined_field: {
|
|
...m.value,
|
|
},
|
|
};
|
|
if (i) {
|
|
let e = N.value;
|
|
return c(t, () => !F && R.value && e === N.value);
|
|
}
|
|
return n.post(`/cart`, t);
|
|
}
|
|
async function Se() {
|
|
// 编辑模式只能先保存回购物车;即时购买将当前配置提交到 /product/settle。
|
|
if (i) throw Error(`请先保存配置,再返回购物车结算`);
|
|
return (
|
|
me(),
|
|
product_fields_i(h.value, m.value),
|
|
n.post(`/product/settle`, {
|
|
product_id: e,
|
|
config_options: {
|
|
...p.value,
|
|
promo_code: _.value,
|
|
event_promotion: ``,
|
|
},
|
|
qty: p.value.qty,
|
|
self_defined_field: {
|
|
...m.value,
|
|
},
|
|
})
|
|
);
|
|
}
|
|
return {
|
|
page: l,
|
|
images: d,
|
|
cycles: f,
|
|
promoCode: _,
|
|
promoDiscount: v,
|
|
levelDiscount: y,
|
|
config: p,
|
|
customFields: m,
|
|
customFieldDefinitions: h,
|
|
price: g,
|
|
loading: b,
|
|
priceLoading: x,
|
|
quoteReady: R,
|
|
cpuOptions: E,
|
|
memoryOptions: re,
|
|
dataDiskLimit: k,
|
|
error: S,
|
|
init: be,
|
|
refresh: V,
|
|
selectCpu: le,
|
|
selectMemory: fe,
|
|
addDataDisk: ae,
|
|
removeDataDisk: ce,
|
|
calcPrice: B,
|
|
addToCart: xe,
|
|
buyNow: Se,
|
|
};
|
|
}
|
|
var N = {
|
|
class: `config-page`,
|
|
},
|
|
pe = {
|
|
key: 1,
|
|
class: `panel config-load-error`,
|
|
},
|
|
P = {
|
|
key: 2,
|
|
class: `config-layout`,
|
|
},
|
|
F = {
|
|
class: `config-options`,
|
|
},
|
|
I = {
|
|
class: `panel`,
|
|
},
|
|
L = {
|
|
class: `form-row`,
|
|
},
|
|
R = {
|
|
class: `form-row`,
|
|
},
|
|
z = {
|
|
class: `form-row`,
|
|
},
|
|
me = {
|
|
class: `form-row`,
|
|
},
|
|
he = {
|
|
key: 0,
|
|
class: `panel`,
|
|
},
|
|
ge = {
|
|
key: 0,
|
|
class: `form-row storage-system`,
|
|
},
|
|
_e = {
|
|
key: 1,
|
|
class: `form-row`,
|
|
},
|
|
ve = {
|
|
class: `storage-disks`,
|
|
},
|
|
ye = {
|
|
class: `hint`,
|
|
},
|
|
B = {
|
|
class: `panel`,
|
|
},
|
|
be = {
|
|
class: `form-row`,
|
|
},
|
|
V = {
|
|
class: `form-row`,
|
|
},
|
|
xe = {
|
|
key: 0,
|
|
class: `form-row traffic-package-row`,
|
|
},
|
|
Se = {
|
|
class: `traffic-package-value`,
|
|
},
|
|
Ce = {
|
|
class: `form-row`,
|
|
},
|
|
we = {
|
|
key: 1,
|
|
class: `form-row`,
|
|
},
|
|
Te = {
|
|
key: 1,
|
|
class: `panel`,
|
|
},
|
|
Ee = {
|
|
class: `form-row`,
|
|
},
|
|
De = {
|
|
class: `form-row`,
|
|
},
|
|
Oe = {
|
|
class: `form-row`,
|
|
},
|
|
ke = Object.assign(
|
|
_plugin_vue_export_helper_t(
|
|
defineComponent({
|
|
__name: `KkyEcsConfig`,
|
|
props: {
|
|
productId: {},
|
|
identityLocked: {
|
|
type: Boolean,
|
|
},
|
|
edit: {},
|
|
},
|
|
emits: [`settled`],
|
|
setup(a, { emit: ee }) {
|
|
let _ = a,
|
|
te = ee,
|
|
S = fe(_.productId, {
|
|
customFields: !0,
|
|
edit: _.edit,
|
|
}),
|
|
{
|
|
page: D,
|
|
images: O,
|
|
cycles: ne,
|
|
config: A,
|
|
price: oe,
|
|
loading: se,
|
|
priceLoading: ue,
|
|
error: M,
|
|
quoteReady: de,
|
|
cpuOptions: ke,
|
|
memoryOptions: Ae,
|
|
dataDiskLimit: H,
|
|
promoCode: je,
|
|
promoDiscount: Me,
|
|
levelDiscount: Ne,
|
|
customFields: Pe,
|
|
customFieldDefinitions: Fe,
|
|
} = S,
|
|
U = ref(null),
|
|
W = computed(() => !!_.identityLocked || U.value !== null),
|
|
G = ref(``),
|
|
K = ref(``),
|
|
Ie;
|
|
onBeforeUnmount(() => clearTimeout(Ie));
|
|
let Le = computed(
|
|
() =>
|
|
de.value &&
|
|
!W.value &&
|
|
!!A.value.duration_id &&
|
|
!!A.value.image_id,
|
|
),
|
|
Re = ref(null),
|
|
ze = computed(() => String(A.value.package_config_id)),
|
|
Be = computed(() => String(A.value.network_id)),
|
|
Ve = computed(
|
|
() => D.value?.bill_method_list?.[ze.value]?.[Be.value] ?? [],
|
|
),
|
|
q = computed(() =>
|
|
Ve.value.find(
|
|
(e) => String(e.id) === String(A.value.bill_method),
|
|
),
|
|
),
|
|
J = computed(() => {
|
|
if (!/流量/.test(q.value?.name ?? ``)) return ``;
|
|
let e = Number(q.value?.config.default_package);
|
|
return Number.isFinite(e) && e > 0
|
|
? `${Number(e.toFixed(2))} GB`
|
|
: ``;
|
|
}),
|
|
Y = computed(
|
|
() =>
|
|
q.value?.config ?? {
|
|
min: 1,
|
|
max: 100,
|
|
step: 1,
|
|
},
|
|
),
|
|
He = computed(() =>
|
|
q.value
|
|
? [
|
|
{
|
|
type: `step`,
|
|
min_value: Y.value.min,
|
|
max_value: Y.value.max,
|
|
step: Y.value.step,
|
|
},
|
|
]
|
|
: [],
|
|
),
|
|
X = computed(() => D.value?.system_disk_config?.[ze.value]),
|
|
Z = computed(() => D.value?.data_disk_config),
|
|
Ue = computed(() =>
|
|
X.value
|
|
? [
|
|
{
|
|
type: `step`,
|
|
min_value: Math.min(X.value.min, X.value.max),
|
|
max_value: Math.max(X.value.min, X.value.max),
|
|
step: X.value.step,
|
|
},
|
|
]
|
|
: [],
|
|
),
|
|
We = computed(() =>
|
|
Z.value
|
|
? [
|
|
{
|
|
type: `step`,
|
|
min_value: Math.min(Z.value.min, Z.value.max),
|
|
max_value: Math.max(Z.value.min, Z.value.max),
|
|
step: Z.value.step,
|
|
},
|
|
]
|
|
: [],
|
|
),
|
|
Ge = computed(() => D.value?.protect_list?.[ze.value] ?? []),
|
|
Q = computed(() => O.value.filter((e) => e.image?.length)),
|
|
Ke = computed(
|
|
() => Q.value.find((e) => e.id === Re.value)?.image ?? [],
|
|
),
|
|
qe = computed({
|
|
get: () =>
|
|
Q.value.find((e) =>
|
|
e.image?.some((e) => e.id === A.value.image_id),
|
|
)?.id ?? null,
|
|
set: (e) => {
|
|
Re.value = e;
|
|
let t = Q.value.find((t) => t.id === e)?.image?.[0];
|
|
t && (A.value.image_id = t.id);
|
|
},
|
|
}),
|
|
Je = computed(() =>
|
|
ne.value.map((e) => ({
|
|
value: e.id,
|
|
label: e.name_show || e.name,
|
|
})),
|
|
),
|
|
Ye = computed(() => {
|
|
let e = (e, t) => String(e) === String(t),
|
|
t = D.value?.package_list?.find((t) =>
|
|
e(t.id, A.value.package_config_id),
|
|
),
|
|
n = O.value
|
|
.flatMap((e) => e.image ?? [])
|
|
.find((t) => e(t.id, A.value.image_id));
|
|
return [
|
|
{
|
|
label: `区域`,
|
|
value:
|
|
D.value?.line_list?.find((t) => e(t.id, A.value.line_id))
|
|
?.name || `未选择`,
|
|
},
|
|
{
|
|
label: `线路`,
|
|
value:
|
|
D.value?.network_list?.find((t) =>
|
|
e(t.id, A.value.network_id),
|
|
)?.name || `未选择`,
|
|
},
|
|
{
|
|
label: `套餐`,
|
|
value: t?.name || `未选择`,
|
|
},
|
|
...(t?.cpu_num && t?.memory
|
|
? [
|
|
{
|
|
label: `计算资源`,
|
|
value: `${t.cpu_num} 核 / ${t.memory} GB`,
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
label: `操作系统`,
|
|
value: os_name_t(n?.name) || `未选择`,
|
|
},
|
|
{
|
|
label: `网络类型`,
|
|
value: A.value.cpu_model_id ? `经典网络` : `未选择`,
|
|
},
|
|
{
|
|
label: `计费方式`,
|
|
value: q.value?.name || `未选择`,
|
|
},
|
|
...(J.value
|
|
? [
|
|
{
|
|
label: `流量包`,
|
|
value: J.value,
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
label: `带宽上限`,
|
|
value: `${A.value.bandwidth} Mbps`,
|
|
},
|
|
...(X.value
|
|
? [
|
|
{
|
|
label: `系统盘`,
|
|
value: `${A.value.system_disk.size || `未选择`}${A.value.system_disk.size ? ` GB` : ``}`,
|
|
},
|
|
]
|
|
: []),
|
|
...(A.value.data_disk ?? []).map((e, t) => ({
|
|
label: `数据盘 ${t + 1}`,
|
|
value: `${e.size} GB${e.type ? ` · ${e.type}` : ``}`,
|
|
})),
|
|
...(Ge.value.length
|
|
? [
|
|
{
|
|
label: `DDoS 防护`,
|
|
value: `${A.value.protect} Gbps`,
|
|
},
|
|
]
|
|
: []),
|
|
];
|
|
});
|
|
async function Xe() {
|
|
await S.refresh({
|
|
line: !0,
|
|
});
|
|
}
|
|
async function Ze() {
|
|
await S.refresh({
|
|
cpu: !0,
|
|
});
|
|
}
|
|
async function Qe() {
|
|
await S.refresh({
|
|
pkg: !0,
|
|
});
|
|
}
|
|
async function $() {
|
|
await S.calcPrice();
|
|
}
|
|
async function $e() {
|
|
if (Le.value) {
|
|
((U.value = `cart`),
|
|
(G.value = ``),
|
|
(K.value = ``),
|
|
clearTimeout(Ie));
|
|
try {
|
|
if ((await S.addToCart(), _.edit)) {
|
|
await navigateTo(`/cart`);
|
|
return;
|
|
}
|
|
((K.value = _.edit ? `购物车配置已更新` : `已加入购物车`),
|
|
(Ie = setTimeout(() => (K.value = ``), 4e3)));
|
|
} catch (e) {
|
|
G.value = e instanceof Error ? e.message : `提交失败,请重试`;
|
|
} finally {
|
|
U.value = null;
|
|
}
|
|
}
|
|
}
|
|
async function et() {
|
|
if (Le.value) {
|
|
((U.value = `buy`), (G.value = ``), (K.value = ``));
|
|
try {
|
|
let e = await S.buyNow();
|
|
te(`settled`, e);
|
|
} catch (e) {
|
|
G.value = e instanceof Error ? e.message : `提交失败,请重试`;
|
|
} finally {
|
|
U.value = null;
|
|
}
|
|
}
|
|
}
|
|
return (
|
|
onMounted(() => {
|
|
S.init().then(() => {
|
|
Re.value = qe.value;
|
|
});
|
|
}),
|
|
(n, r) => {
|
|
let s = ConfigLoadingShell,
|
|
u = message,
|
|
ee = button,
|
|
b = ConfigChoiceGrid,
|
|
te = select,
|
|
O = ProductCustomFields,
|
|
ne = inputnumber,
|
|
fe = ConfigCheckout;
|
|
return (
|
|
openBlock(),
|
|
createElementBlock(`div`, N, [
|
|
unref(se)
|
|
? (openBlock(),
|
|
createBlock(
|
|
s,
|
|
{
|
|
key: 0,
|
|
},
|
|
{
|
|
catalog: withCtx(() => [
|
|
renderSlot(
|
|
n.$slots,
|
|
`catalog`,
|
|
{
|
|
disabled: unref(U) !== null,
|
|
},
|
|
void 0,
|
|
!0,
|
|
),
|
|
]),
|
|
_: 3,
|
|
},
|
|
))
|
|
: unref(M) && !unref(D)?.line_list?.length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, pe, [
|
|
renderSlot(
|
|
n.$slots,
|
|
`catalog`,
|
|
{
|
|
disabled: unref(U) !== null,
|
|
},
|
|
void 0,
|
|
!0,
|
|
),
|
|
createVNode(
|
|
u,
|
|
{
|
|
severity: `error`,
|
|
closable: !1,
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(M)), 1),
|
|
]),
|
|
_: 1,
|
|
},
|
|
),
|
|
createVNode(
|
|
ee,
|
|
{
|
|
label: `重新加载配置`,
|
|
icon: `pi pi-refresh`,
|
|
severity: `secondary`,
|
|
outlined: ``,
|
|
disabled: a.identityLocked,
|
|
onClick: (r[0] ||= (e) => unref(S).init()),
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`],
|
|
),
|
|
]))
|
|
: unref(D)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, P, [
|
|
createElementVNode(`div`, F, [
|
|
renderSlot(
|
|
n.$slots,
|
|
`catalog`,
|
|
{
|
|
disabled: unref(U) !== null,
|
|
},
|
|
void 0,
|
|
!0,
|
|
),
|
|
createElementVNode(`div`, I, [
|
|
(r[22] ||= createElementVNode(
|
|
`h2`,
|
|
{
|
|
class: `section-title`,
|
|
},
|
|
`基础配置`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`div`, L, [
|
|
(r[18] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`区域`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
b,
|
|
{
|
|
label: `区域`,
|
|
disabled: unref(W),
|
|
modelValue: unref(A).line_id,
|
|
"onUpdate:modelValue": (r[1] ||= (e) =>
|
|
(unref(A).line_id = e)),
|
|
options: (unref(D).line_list || []).map(
|
|
(e) => ({
|
|
label: e.name,
|
|
value: e.id,
|
|
}),
|
|
),
|
|
onChange: Xe,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
]),
|
|
createElementVNode(`div`, R, [
|
|
(r[19] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`线路`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
b,
|
|
{
|
|
label: `线路`,
|
|
disabled: unref(W),
|
|
modelValue: unref(A).network_id,
|
|
"onUpdate:modelValue": (r[2] ||= (e) =>
|
|
(unref(A).network_id = e)),
|
|
options: (
|
|
unref(D).network_list || []
|
|
).map((e) => ({
|
|
label: e.name,
|
|
value: e.id,
|
|
})),
|
|
onChange: Qe,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
]),
|
|
createElementVNode(`div`, z, [
|
|
(r[20] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`CPU`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
b,
|
|
{
|
|
label: `CPU`,
|
|
disabled: unref(W),
|
|
"model-value":
|
|
Number(unref(A).cpu_num) || null,
|
|
options: unref(ke).map((e) => ({
|
|
label: `${e} 核`,
|
|
value: e,
|
|
})),
|
|
compact: ``,
|
|
"onUpdate:modelValue": unref(S).selectCpu,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`model-value`,
|
|
`options`,
|
|
`onUpdate:modelValue`,
|
|
],
|
|
),
|
|
]),
|
|
createElementVNode(`div`, me, [
|
|
(r[21] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`内存`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
b,
|
|
{
|
|
label: `内存`,
|
|
disabled: unref(W),
|
|
"model-value":
|
|
Number(unref(A).memory) || null,
|
|
options: unref(Ae).map((e) => ({
|
|
label: `${e} GB`,
|
|
value: e,
|
|
})),
|
|
compact: ``,
|
|
"onUpdate:modelValue":
|
|
unref(S).selectMemory,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`model-value`,
|
|
`options`,
|
|
`onUpdate:modelValue`,
|
|
],
|
|
),
|
|
]),
|
|
]),
|
|
unref(X) || unref(H)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, he, [
|
|
(r[24] ||= createElementVNode(
|
|
`h2`,
|
|
{
|
|
class: `section-title`,
|
|
},
|
|
`存储配置`,
|
|
-1,
|
|
)),
|
|
unref(X)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, ge, [
|
|
createVNode(
|
|
ConfigDiskCard,
|
|
{
|
|
label: `系统盘`,
|
|
title: unref(X).type || `系统盘`,
|
|
disabled: unref(W),
|
|
modelValue:
|
|
unref(A).system_disk.size,
|
|
"onUpdate:modelValue": (r[3] ||= (
|
|
e,
|
|
) =>
|
|
(unref(A).system_disk.size =
|
|
e)),
|
|
options: unref(Ue),
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`title`,
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
unref(H)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, _e, [
|
|
(r[23] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`数据盘`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`div`, ve, [
|
|
(openBlock(!0),
|
|
createElementBlock(
|
|
Fragment,
|
|
null,
|
|
renderList(
|
|
unref(A).data_disk,
|
|
(e, t) => (
|
|
openBlock(),
|
|
createBlock(
|
|
ConfigDiskCard,
|
|
{
|
|
key: t,
|
|
label: `数据盘 ${t + 1}`,
|
|
"hide-label": ``,
|
|
title: e.type || `数据盘`,
|
|
disabled: unref(W),
|
|
modelValue: e.size,
|
|
"onUpdate:modelValue": (
|
|
t,
|
|
) => (e.size = t),
|
|
options: unref(We),
|
|
removable: ``,
|
|
onChange: $,
|
|
onRemove: (e) =>
|
|
unref(S).removeDataDisk(
|
|
t,
|
|
),
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`label`,
|
|
`title`,
|
|
`disabled`,
|
|
`modelValue`,
|
|
`onUpdate:modelValue`,
|
|
`options`,
|
|
`onRemove`,
|
|
],
|
|
)
|
|
),
|
|
),
|
|
128,
|
|
)),
|
|
unref(A).data_disk.length < unref(H)
|
|
? (openBlock(),
|
|
createBlock(
|
|
ConfigDiskAdd,
|
|
{
|
|
key: 0,
|
|
disabled: unref(W),
|
|
onAdd: (r[4] ||= (e) =>
|
|
unref(S).addDataDisk()),
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`],
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
createElementVNode(
|
|
`span`,
|
|
ye,
|
|
`最多可添加 ` +
|
|
toDisplayString(unref(H)) +
|
|
` 块数据盘,已添加 ` +
|
|
toDisplayString(
|
|
unref(A).data_disk.length,
|
|
) +
|
|
` 块`,
|
|
1,
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
createElementVNode(`div`, B, [
|
|
(r[29] ||= createElementVNode(
|
|
`h2`,
|
|
{
|
|
class: `section-title`,
|
|
},
|
|
`网络配置`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`div`, be, [
|
|
(r[25] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`网络类型`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
b,
|
|
{
|
|
label: `网络类型`,
|
|
disabled: unref(W),
|
|
modelValue: unref(A).cpu_model_id,
|
|
"onUpdate:modelValue": (r[5] ||= (e) =>
|
|
(unref(A).cpu_model_id = e)),
|
|
options: (
|
|
unref(D).cpu_model_list || []
|
|
).map((e) => ({
|
|
label: `经典网络`,
|
|
value: e.id,
|
|
})),
|
|
compact: ``,
|
|
onChange: Ze,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
]),
|
|
createElementVNode(`div`, V, [
|
|
(r[26] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`计费方式`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
b,
|
|
{
|
|
label: `计费方式`,
|
|
disabled: unref(W),
|
|
modelValue: unref(A).bill_method,
|
|
"onUpdate:modelValue": (r[6] ||= (e) =>
|
|
(unref(A).bill_method = e)),
|
|
options: unref(Ve).map((e) => ({
|
|
label: e.name,
|
|
value: e.id,
|
|
})),
|
|
compact: ``,
|
|
onChange: (r[7] ||= (e) => {
|
|
((unref(A).bandwidth = unref(Y).min),
|
|
$());
|
|
}),
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
]),
|
|
unref(J)
|
|
? (openBlock(),
|
|
createElementBlock(`div`, xe, [
|
|
(r[27] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`流量包`,
|
|
-1,
|
|
)),
|
|
createElementVNode(`div`, Se, [
|
|
createElementVNode(
|
|
`strong`,
|
|
null,
|
|
toDisplayString(unref(J)),
|
|
1,
|
|
),
|
|
]),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
createElementVNode(`div`, Ce, [
|
|
createVNode(
|
|
ConfigBandwidth,
|
|
{
|
|
disabled: unref(W),
|
|
modelValue: unref(A).bandwidth,
|
|
"onUpdate:modelValue": (r[8] ||= (e) =>
|
|
(unref(A).bandwidth = e)),
|
|
options: unref(He),
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
]),
|
|
unref(Ge).length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, we, [
|
|
(r[28] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`DDoS 防护`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
b,
|
|
{
|
|
label: `DDoS 防护`,
|
|
disabled: unref(W),
|
|
modelValue: unref(A).protect,
|
|
"onUpdate:modelValue": (r[9] ||= (
|
|
e,
|
|
) => (unref(A).protect = e)),
|
|
options: unref(Ge).map((e) => ({
|
|
label: `${e} Gbps`,
|
|
value: e,
|
|
})),
|
|
compact: ``,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
unref(Q).length
|
|
? (openBlock(),
|
|
createElementBlock(`div`, Te, [
|
|
(r[31] ||= createElementVNode(
|
|
`h2`,
|
|
{
|
|
class: `section-title`,
|
|
},
|
|
`操作系统`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
b,
|
|
{
|
|
modelValue: unref(qe),
|
|
"onUpdate:modelValue": (r[10] ||= (
|
|
e,
|
|
) =>
|
|
isRef(qe) ? (qe.value = e) : null),
|
|
label: `操作系统`,
|
|
images: ``,
|
|
disabled: unref(W),
|
|
options: unref(Q).map((e) => ({
|
|
label: unref(os_name_t)(e.name),
|
|
value: e.id,
|
|
iconUrl: e.icon_url,
|
|
icon: e.icon,
|
|
})),
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[`modelValue`, `disabled`, `options`],
|
|
),
|
|
createElementVNode(`div`, Ee, [
|
|
(r[30] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`镜像版本`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
te,
|
|
{
|
|
"aria-label": `镜像版本`,
|
|
disabled: unref(W),
|
|
modelValue: unref(A).image_id,
|
|
"onUpdate:modelValue": (r[11] ||= (
|
|
e,
|
|
) => (unref(A).image_id = e)),
|
|
options: unref(Ke),
|
|
"option-label": (e) =>
|
|
unref(os_name_t)(e.name),
|
|
optionValue: `id`,
|
|
class: `grow`,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[
|
|
`disabled`,
|
|
`modelValue`,
|
|
`options`,
|
|
`option-label`,
|
|
],
|
|
),
|
|
]),
|
|
]))
|
|
: createCommentVNode(``, !0),
|
|
]),
|
|
createVNode(
|
|
O,
|
|
{
|
|
modelValue: unref(Pe),
|
|
"onUpdate:modelValue": (r[12] ||= (e) =>
|
|
isRef(Pe) ? (Pe.value = e) : null),
|
|
fields: unref(Fe),
|
|
disabled: unref(W),
|
|
},
|
|
null,
|
|
8,
|
|
[`modelValue`, `fields`, `disabled`],
|
|
),
|
|
createVNode(
|
|
fe,
|
|
{
|
|
"product-id": _.productId,
|
|
quantity: unref(A).qty,
|
|
"edit-position": _.edit?.position,
|
|
editing: !!_.edit,
|
|
summary: unref(Ye),
|
|
price: unref(oe),
|
|
"quote-ready": unref(de) && !a.identityLocked,
|
|
"price-loading": unref(ue),
|
|
"can-submit": unref(Le),
|
|
"active-action": unref(U),
|
|
disabled: unref(W),
|
|
"promo-code": unref(je),
|
|
"onUpdate:promoCode": (r[15] ||= (e) =>
|
|
isRef(je) ? (je.value = e) : null),
|
|
"promo-discount": unref(Me),
|
|
"level-discount": unref(Ne),
|
|
error: unref(M),
|
|
"action-error": unref(G),
|
|
"cart-tip": unref(K),
|
|
onCart: $e,
|
|
onBuy: et,
|
|
onRecalc: (r[16] ||= (e) =>
|
|
unref(S).calcPrice()),
|
|
onRetry: (r[17] ||= (e) => unref(S).refresh()),
|
|
},
|
|
{
|
|
default: withCtx(() => [
|
|
createElementVNode(`div`, De, [
|
|
(r[32] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`购买时长`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
te,
|
|
{
|
|
"aria-label": `购买时长`,
|
|
disabled: unref(W),
|
|
modelValue: unref(A).duration_id,
|
|
"onUpdate:modelValue": (r[13] ||= (e) =>
|
|
(unref(A).duration_id = e)),
|
|
options: unref(Je),
|
|
optionLabel: `label`,
|
|
optionValue: `value`,
|
|
placeholder: `请选择周期`,
|
|
class: `grow`,
|
|
onChange: $,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`, `options`],
|
|
),
|
|
]),
|
|
createElementVNode(`div`, Oe, [
|
|
(r[33] ||= createElementVNode(
|
|
`label`,
|
|
null,
|
|
`购买数量`,
|
|
-1,
|
|
)),
|
|
createVNode(
|
|
ne,
|
|
{
|
|
"aria-label": `购买数量`,
|
|
disabled: unref(W),
|
|
modelValue: unref(A).qty,
|
|
"onUpdate:modelValue": [
|
|
(r[14] ||= (e) => (unref(A).qty = e)),
|
|
$,
|
|
],
|
|
min: 1,
|
|
max: 99,
|
|
showButtons: ``,
|
|
buttonLayout: `horizontal`,
|
|
},
|
|
null,
|
|
8,
|
|
[`disabled`, `modelValue`],
|
|
),
|
|
]),
|
|
]),
|
|
_: 1,
|
|
},
|
|
8,
|
|
[
|
|
`product-id`,
|
|
`quantity`,
|
|
`edit-position`,
|
|
`editing`,
|
|
`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-e8ce6418`]],
|
|
),
|
|
{
|
|
__name: `KkyEcsConfig`,
|
|
},
|
|
);
|
|
export {};
|
|
export default ke;
|
|
</script>
|