mirror of
https://github.com/certd/certd.git
synced 2026-07-19 13:17:33 +08:00
perf: 商业版套餐只支持设置为可叠加
This commit is contained in:
@@ -245,6 +245,8 @@ export class SysSuiteSetting extends BaseSettings {
|
|||||||
|
|
||||||
enabled: boolean = false;
|
enabled: boolean = false;
|
||||||
|
|
||||||
|
allowSuiteStack: boolean = false;
|
||||||
|
|
||||||
registerGift?: {
|
registerGift?: {
|
||||||
productId: number;
|
productId: number;
|
||||||
duration: number;
|
duration: number;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-card>
|
<a-card>
|
||||||
<div class="suite-intro-box">
|
<div class="suite-intro-box">
|
||||||
<div>说明:① 同一时间只有最新购买的一个套餐生效;② 可以购买多个加量包,加量包立即生效;③ 套餐和加量包内的数量可以叠加</div>
|
<div>{{ buyHelperText }}</div>
|
||||||
<div v-if="suiteIntro" v-html="suiteIntro"></div>
|
<div v-if="suiteIntro" v-html="suiteIntro"></div>
|
||||||
</div>
|
</div>
|
||||||
</a-card>
|
</a-card>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import ProductInfo from "/@/views/certd/suite/product-info.vue";
|
import ProductInfo from "/@/views/certd/suite/product-info.vue";
|
||||||
import OrderModal from "/@/views/certd/suite/order-modal.vue";
|
import OrderModal from "/@/views/certd/suite/order-modal.vue";
|
||||||
@@ -55,9 +55,17 @@ async function doOrder(req: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const suiteIntro = ref("");
|
const suiteIntro = ref("");
|
||||||
|
const allowSuiteStack = ref(false);
|
||||||
|
const buyHelperText = computed(() => {
|
||||||
|
if (allowSuiteStack.value) {
|
||||||
|
return "说明:可以购买多个套餐和加量包,套餐和加量包内的数量可以叠加";
|
||||||
|
}
|
||||||
|
return "说明:① 同一时间只有最新购买的一个套餐生效;② 可以购买多个加量包,加量包立即生效;③ 套餐和加量包内的数量可以叠加";
|
||||||
|
});
|
||||||
async function loadSuiteIntro() {
|
async function loadSuiteIntro() {
|
||||||
const res = await api.GetSuiteSetting();
|
const res = await api.GetSuiteSetting();
|
||||||
suiteIntro.value = res.intro;
|
suiteIntro.value = res.intro;
|
||||||
|
allowSuiteStack.value = !!res.allowSuiteStack;
|
||||||
}
|
}
|
||||||
loadSuiteIntro();
|
loadSuiteIntro();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -4,8 +4,14 @@
|
|||||||
<a-popover>
|
<a-popover>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div style="width: 300px">
|
<div style="width: 300px">
|
||||||
<div v-if="detail.addonList.length > 0" class="flex flex-wrap">
|
<div v-if="hiddenSuiteList.length > 0 || detail.addonList.length > 0" class="flex flex-wrap">
|
||||||
<a-tag v-for="(item, index) of detail.addonList" :key="index" color="green" class="pointer flex-o m-1">
|
<a-tag v-for="(item, index) of hiddenSuiteList" :key="`suite-${index}`" color="green" class="pointer flex-o m-1">
|
||||||
|
<span class="mr-5">
|
||||||
|
{{ item.title }}
|
||||||
|
</span>
|
||||||
|
<span>(<expires-time-text :value="item.expiresTime" />)</span>
|
||||||
|
</a-tag>
|
||||||
|
<a-tag v-for="(item, index) of detail.addonList" :key="`addon-${index}`" color="green" class="pointer flex-o m-1">
|
||||||
<span class="mr-5">
|
<span class="mr-5">
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
</span>
|
</span>
|
||||||
@@ -43,13 +49,13 @@
|
|||||||
</template>
|
</template>
|
||||||
<div class="flex-o">
|
<div class="flex-o">
|
||||||
<fs-icon icon="ant-design:gift-outlined" class="color-green mr-5" />
|
<fs-icon icon="ant-design:gift-outlined" class="color-green mr-5" />
|
||||||
<a-tag v-for="(item, index) of detail.suiteList" :key="index" color="green" class="pointer flex-o">
|
<a-tag v-if="currentSuite" color="green" class="pointer flex-o">
|
||||||
<span class="mr-5">
|
<span class="mr-5">
|
||||||
{{ item.title }}
|
{{ currentSuite.title }}
|
||||||
</span>
|
</span>
|
||||||
<span>(<expires-time-text :value="item.expiresTime" />)</span>
|
<span>(<expires-time-text :value="currentSuite.expiresTime" />)</span>
|
||||||
|
<span v-if="hiddenCount > 0" class="ml-5">+{{ hiddenCount }}</span>
|
||||||
</a-tag>
|
</a-tag>
|
||||||
<a-tag v-if="detail.addonList.length > 0" color="green" class="pointer flex-o">加量包+{{ detail.addonList.length }}</a-tag>
|
|
||||||
<div v-if="detail.suites?.length === 0" class="flex-o ml-5">暂无套餐 <a-button class="ml-5" type="primary" size="small" @click="goBuy">去购买</a-button></div>
|
<div v-if="detail.suites?.length === 0" class="flex-o ml-5">暂无套餐 <a-button class="ml-5" type="primary" size="small" @click="goBuy">去购买</a-button></div>
|
||||||
</div>
|
</div>
|
||||||
</a-popover>
|
</a-popover>
|
||||||
@@ -59,7 +65,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import SuiteValue from "/@/views/sys/suite/product/suite-value.vue";
|
import SuiteValue from "/@/views/sys/suite/product/suite-value.vue";
|
||||||
import { ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import ExpiresTimeText from "/@/components/expires-time-text.vue";
|
import ExpiresTimeText from "/@/components/expires-time-text.vue";
|
||||||
import { mySuiteApi, SuiteDetail } from "/@/views/certd/suite/mine/api";
|
import { mySuiteApi, SuiteDetail } from "/@/views/certd/suite/mine/api";
|
||||||
import { FsIcon } from "@fast-crud/fast-crud";
|
import { FsIcon } from "@fast-crud/fast-crud";
|
||||||
@@ -71,6 +77,10 @@ defineOptions({
|
|||||||
|
|
||||||
const detail = ref<SuiteDetail>({});
|
const detail = ref<SuiteDetail>({});
|
||||||
|
|
||||||
|
const currentSuite = computed(() => detail.value.suiteList?.[0]);
|
||||||
|
const hiddenSuiteList = computed(() => detail.value.suiteList?.slice(1) || []);
|
||||||
|
const hiddenCount = computed(() => hiddenSuiteList.value.length + (detail.value.addonList?.length || 0));
|
||||||
|
|
||||||
async function loadSuiteDetail() {
|
async function loadSuiteDetail() {
|
||||||
detail.value = await mySuiteApi.SuiteDetailGet();
|
detail.value = await mySuiteApi.SuiteDetailGet();
|
||||||
const suites = detail.value.suites.filter(item => item.productType === "suite");
|
const suites = detail.value.suites.filter(item => item.productType === "suite");
|
||||||
|
|||||||
@@ -21,6 +21,11 @@
|
|||||||
<div class="helper">不建议设置免费套餐,可以在下方配置注册赠送套餐,或者在用户套餐管理中手动赠送套餐</div>
|
<div class="helper">不建议设置免费套餐,可以在下方配置注册赠送套餐,或者在用户套餐管理中手动赠送套餐</div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="套餐支持叠加" name="allowSuiteStack">
|
||||||
|
<a-switch v-model:checked="formState.allowSuiteStack" />
|
||||||
|
<div class="helper">默认只有一个套餐生效。开启此开关,可以让多个套餐可以叠加;加量包无论是否开启此开关都可以叠加。</div>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="注册赠送套餐" name="registerGift">
|
<a-form-item label="注册赠送套餐" name="registerGift">
|
||||||
<suite-duration-selector ref="suiteDurationSelectedRef" v-model="formState.registerGift"></suite-duration-selector>
|
<suite-duration-selector ref="suiteDurationSelectedRef" v-model="formState.registerGift"></suite-duration-selector>
|
||||||
<div class="helper">添加套餐后再选择</div>
|
<div class="helper">添加套餐后再选择</div>
|
||||||
@@ -73,6 +78,7 @@ const formRef = ref<any>(null);
|
|||||||
const formState = reactive<
|
const formState = reactive<
|
||||||
Partial<{
|
Partial<{
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
allowSuiteStack: boolean;
|
||||||
registerGift?: {
|
registerGift?: {
|
||||||
productId?: number;
|
productId?: number;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user