增加功能报价
This commit is contained in:
@@ -12,11 +12,25 @@
|
||||
<el-option
|
||||
v-for="p in packageOptions"
|
||||
:key="p.id"
|
||||
:label="p.name"
|
||||
:label="`${p.name}(${formatMoney(p.price)}${priceUnit(p)})`"
|
||||
:value="p.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="套餐到期">
|
||||
<template v-if="info.package_expire_time">
|
||||
<span>{{ formatDateTime(info.package_expire_time) }}</span>
|
||||
<el-tag
|
||||
size="small"
|
||||
:type="expireTagType"
|
||||
effect="plain"
|
||||
class="ml8"
|
||||
>
|
||||
剩余 {{ info.days_remaining }} 天
|
||||
</el-tag>
|
||||
</template>
|
||||
<span v-else class="muted">永久有效</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="开通功能">
|
||||
<template v-if="info.module_names && info.module_names.length">
|
||||
<el-tag v-for="(m, i) in info.module_names" :key="i" size="small" class="module-tag">
|
||||
@@ -51,6 +65,14 @@
|
||||
class="quota-alert"
|
||||
title="该租户用户数已达上限,新增账号前请先增购用户数"
|
||||
/>
|
||||
<el-alert
|
||||
v-if="expiringSoon"
|
||||
type="warning"
|
||||
show-icon
|
||||
:closable="false"
|
||||
class="quota-alert"
|
||||
title="该租户套餐即将到期,到期后将自动切换为基础套餐,请及时续费"
|
||||
/>
|
||||
|
||||
<div class="section-title">增购记录</div>
|
||||
<el-table :data="orders" style="width: 100%" size="small" v-loading="ordersLoading">
|
||||
@@ -181,6 +203,27 @@ const rechargeForm = ref({
|
||||
});
|
||||
|
||||
const formatMoney = (v: any) => `¥${Number(v || 0).toFixed(2)}`;
|
||||
/** 套餐价格单位随有效时长变化:365天=元/年,30=元/月,90=元/季,其余=元/N天 */
|
||||
const priceUnit = (row: any) => {
|
||||
const d = Number(row?.duration_days || 365);
|
||||
if (d === 365) return "/年";
|
||||
if (d === 30) return "/月";
|
||||
if (d === 90) return "/季";
|
||||
return `/${d}天`;
|
||||
};
|
||||
|
||||
/** 套餐剩余天数:<=30 天给出预警 */
|
||||
const expiringSoon = computed(() => {
|
||||
if (!info.value.package_expire_time) return false;
|
||||
return Number(info.value.days_remaining || 0) <= 30;
|
||||
});
|
||||
|
||||
const expireTagType = computed(() => {
|
||||
const days = Number(info.value.days_remaining || 0);
|
||||
if (days <= 7) return "danger";
|
||||
if (days <= 30) return "warning";
|
||||
return "success";
|
||||
});
|
||||
|
||||
const usedPercent = computed(() => {
|
||||
const quota = Number(info.value.quota || 0);
|
||||
@@ -264,9 +307,13 @@ watch(
|
||||
const handleSetPackage = async (id: number) => {
|
||||
const tid = props.tid;
|
||||
if (tid == null || !id) return;
|
||||
const isRenewal = Number(id) === Number(info.value.package_id) && !!info.value.package_expire_time;
|
||||
const billingTip = isRenewal
|
||||
? "同套餐未到期再次绑定视为续费,将在原到期时间上顺延一个有效时长"
|
||||
: "绑定套餐将按套餐有效时长计费(默认一年),到期后自动切换为基础套餐";
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
"调整套餐会改变该租户可用的功能模块(用户数上限只增不减),确定继续吗?",
|
||||
`调整套餐会改变该租户可用的功能模块(用户数上限只增不减)。${billingTip},确定继续吗?`,
|
||||
"提示",
|
||||
{ type: "warning" }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user