update price plan
This commit is contained in:
1 parent
73cc056272
commit
cf506104ce
5 files changed
+168
-7
No files matched your search
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<div class="title">
|
||||
{{ api?.title }}
|
||||
</div>
|
||||
<div class="introduction">
|
||||
<p>{{ api?.introduction }}</p>
|
||||
</div>
|
||||
<div class="options">
|
||||
<el-button
|
||||
v-if="showFirstOption"
|
||||
ref="option"
|
||||
type="primary"
|
||||
:plain="activeOption !== 'first'"
|
||||
class="option"
|
||||
@click="activeOption = 'first'"
|
||||
>{{ $t('api.message.firstFree') }}</el-button
|
||||
>
|
||||
<el-button
|
||||
v-for="(pkg, pkgIndex) in api?.packages"
|
||||
ref="option"
|
||||
:key="pkgIndex"
|
||||
type="primary"
|
||||
:plain="activePackage?.id !== pkg.id"
|
||||
class="option"
|
||||
@click="
|
||||
activeOption = 'package';
|
||||
activePackage = pkg;
|
||||
"
|
||||
>
|
||||
{{ pkg.amount }}{{ $t(`api.unit.${api.unit}`) }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="showCustomOption"
|
||||
ref="option"
|
||||
type="primary"
|
||||
:plain="activeOption !== 'custom'"
|
||||
class="option"
|
||||
@click="activeOption = 'custom'"
|
||||
>{{ $t('api.message.custom') }}</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="price">
|
||||
<span v-if="activeOption === 'first'" class="value">¥0</span>
|
||||
<span v-if="activeOption === 'first'" class="remark">
|
||||
({{ $t('api.message.present') + `${api.free_amount}` + $t(`api.unit.${api.unit}`) }})
|
||||
</span>
|
||||
<span v-if="activeOption === 'custom'" class="value">¥{{ api?.price }}</span>
|
||||
<span v-if="activeOption === 'custom'" class="remark">{{ '/' + $t(`api.unit.${api.unit}`) }}</span>
|
||||
<span v-if="activeOption === 'package'" class="value"> ¥{{ activePackage?.price }} </span>
|
||||
<span v-if="activeOption === 'package' && activePackage" class="remark">
|
||||
({{
|
||||
$t('api.message.around') +
|
||||
'¥' +
|
||||
(activePackage?.price / activePackage?.amount).toFixed(2) +
|
||||
'/' +
|
||||
$t(`api.unit.${api.unit}`)
|
||||
}})
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IApi, IPackage } from '@/operators';
|
||||
import { defineComponent } from 'vue';
|
||||
import urlJoin from 'url-join';
|
||||
import { ElButton } from 'element-plus';
|
||||
|
||||
interface IData {
|
||||
activeOption: string | undefined;
|
||||
activePackage: IPackage | undefined;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApiInfo',
|
||||
components: {
|
||||
ElButton
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
type: Object as () => IApi,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
activeOption: undefined,
|
||||
activePackage: undefined
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
showFirstOption() {
|
||||
return this.api.free_amount !== 0;
|
||||
},
|
||||
showPackageOption() {
|
||||
return this.api && this.api.packages && this.api?.packages?.length > 0;
|
||||
},
|
||||
showCustomOption() {
|
||||
return this.api.price === 0 || this.api?.price;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.showFirstOption) {
|
||||
this.activeOption = 'first';
|
||||
} else if (this.showPackageOption) {
|
||||
this.activeOption = 'package';
|
||||
// @ts-ignore
|
||||
this.activePackage = this.api.packages[0];
|
||||
} else if (this.showCustomOption) {
|
||||
this.activeOption = 'custom';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
urlJoin,
|
||||
onSelect(option: string, pkg?: IPackage) {
|
||||
this.activeOption = option;
|
||||
this.activePackage = pkg;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: 26px;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.introduction {
|
||||
font-size: 14px;
|
||||
margin-bottom: 15px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.options {
|
||||
.option {
|
||||
border-radius: 5px !important;
|
||||
}
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.price {
|
||||
.value {
|
||||
font-weight: bold;
|
||||
color: #ff5441;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.remark {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,4 +1,8 @@
|
||||
export default {
|
||||
free: '免费',
|
||||
appliedCount: '申请次数'
|
||||
appliedCount: '申请次数',
|
||||
firstFree: '首次送',
|
||||
custom: '指定次数',
|
||||
present: '赠送',
|
||||
around: '约'
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
export default {
|
||||
free: '免费',
|
||||
appliedCount: '申请次数',
|
||||
indexTitle: '方便易用的数字化解决方案',
|
||||
indexTitle: '数字化服务的智慧之选',
|
||||
indexSubtitle: '用一个个标准化服务,助力你工作与生活的方方面面。',
|
||||
fromPrice: '起'
|
||||
};
|
||||
@@ -60,7 +60,7 @@
|
||||
<div v-for="(api, apiIndex) in apis" :key="apiIndex">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<api-info :api="api" />
|
||||
<api-preview :api="api" />
|
||||
</el-col>
|
||||
<el-col :span="4" class="operations">
|
||||
<el-button v-if="!api.applied" type="primary" @click="onConfirm(api, applicationType.API)">
|
||||
@@ -71,7 +71,7 @@
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider v-if="apiIndex < apis.length - 1" />
|
||||
<el-divider v-if="apiIndex < apis.length - 1" border-style="dashed" />
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
@@ -128,7 +128,7 @@ import { IApplicationType } from '@/operators/application/models';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
import { ROUTE_CONSOLE_APPLICATION_LIST } from '@/router';
|
||||
import { ElCol, ElRow, ElButton, ElCard, ElDivider, ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||
import ApiInfo from '@/components/api/Info.vue';
|
||||
import ApiPreview from '@/components/api/Preview.vue';
|
||||
import ProxyInfo from '@/components/proxy/Info.vue';
|
||||
import ApplicationConfirm from '@/components/application/Confirm.vue';
|
||||
import { getVerificationUrl } from '@/utils';
|
||||
@@ -159,7 +159,7 @@ export default defineComponent({
|
||||
ElButton,
|
||||
ElCard,
|
||||
ElDivider,
|
||||
ApiInfo,
|
||||
ApiPreview,
|
||||
ApplicationConfirm,
|
||||
ProxyInfo,
|
||||
ElSkeleton,
|
||||
|
||||
@@ -158,7 +158,7 @@ export default defineComponent({
|
||||
height: calc(100vh - 60px);
|
||||
background-color: #111827;
|
||||
width: 100%;
|
||||
background-image: url('@/assets/images/bg.png');
|
||||
background-image: url('https://zhishuyun-1256437459.cos.ap-beijing.myqcloud.com/background-lines.png');
|
||||
background-position: 50% 50%;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
Reference in new issue
Block a user