diff --git a/src/components/api/Price.vue b/src/components/common/Price.vue similarity index 71% rename from src/components/api/Price.vue rename to src/components/common/Price.vue index 12ff92a0..ade42833 100644 --- a/src/components/api/Price.vue +++ b/src/components/common/Price.vue @@ -1,8 +1,10 @@ @@ -21,6 +23,11 @@ export default defineComponent({ type: String, required: false, default: undefined + }, + start: { + type: Boolean, + required: false, + default: false } } }); diff --git a/src/components/order/Create.vue b/src/components/order/Create.vue index 7fd99d26..9ffe23e4 100644 --- a/src/components/order/Create.vue +++ b/src/components/order/Create.vue @@ -7,7 +7,7 @@ - {{ pkg.amount }}{{ $t('api.unit.usage') }} + {{ pkg.amount }}{{ $t(`api.unit.${application?.api?.unit}`) }} {{ $t('application.button.custom') }} @@ -15,7 +15,7 @@ - {{ pkg.amount }}{{ $t('proxy.unit.usage') }} + {{ pkg.amount }}{{ $t(`proxy.unit.${application?.proxy?.unit}`) }} @@ -24,11 +24,15 @@
- - + +
- +
@@ -67,8 +71,7 @@ import { ElRadioGroup, ElRadioButton } from 'element-plus'; -import ApiPrice from '@/components/api/Price.vue'; -import ProxyPrice from '@/components/proxy/Price.vue'; +import Price from '@/components/common/Price.vue'; interface IData { form: { @@ -90,8 +93,7 @@ export default defineComponent({ ElDivider, ElRadioGroup, ElRadioButton, - ApiPrice, - ProxyPrice + Price }, props: { application: { @@ -149,21 +151,33 @@ export default defineComponent({ return undefined; } }, - mounted() { - if (this.application.type === IApplicationType.API) { - if (this.application?.api?.packages && this.application?.api?.packages.length > 0) { - this.form.packageId = this.application?.api?.packages[0].id; - } else { - this.form.packageId = 'custom'; - } - } - if (this.application.type === IApplicationType.PROXY) { - if (this.application?.proxy?.packages && this.application?.proxy?.packages.length > 0) { - this.form.packageId = this.application?.proxy?.packages[0].id; + watch: { + visible: { + handler(val) { + if (val) { + this.onInit(); + } } } }, + mounted() { + this.onInit(); + }, methods: { + onInit() { + if (this.application.type === IApplicationType.API) { + if (this.application?.api?.packages && this.application?.api?.packages.length > 0) { + this.form.packageId = this.application?.api?.packages[0].id; + } else { + this.form.packageId = 'custom'; + } + } + if (this.application.type === IApplicationType.PROXY) { + if (this.application?.proxy?.packages && this.application?.proxy?.packages.length > 0) { + this.form.packageId = this.application?.proxy?.packages[0].id; + } + } + }, onChangePackage(pkg: IPackage) { console.log('pkg', pkg); }, diff --git a/src/components/proxy/Price.vue b/src/components/proxy/Price.vue deleted file mode 100644 index 29c29249..00000000 --- a/src/components/proxy/Price.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - - - diff --git a/src/components/service/Price.vue b/src/components/service/Price.vue deleted file mode 100644 index 616e8372..00000000 --- a/src/components/service/Price.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - - - diff --git a/src/i18n/zh/api/unit.ts b/src/i18n/zh/api/unit.ts index 3c5b3d8a..672f711e 100644 --- a/src/i18n/zh/api/unit.ts +++ b/src/i18n/zh/api/unit.ts @@ -1,3 +1,3 @@ export default { - usage: '次' + Count: '次' }; diff --git a/src/i18n/zh/common/message.ts b/src/i18n/zh/common/message.ts index 7b9e1aae..649b6060 100644 --- a/src/i18n/zh/common/message.ts +++ b/src/i18n/zh/common/message.ts @@ -2,5 +2,7 @@ export default { copied: '复制成功', confirmDelete: '确认删除吗?', alert: '警告', - info: '温馨提示' + info: '温馨提示', + free: '免费', + startPrice: '起' }; diff --git a/src/i18n/zh/proxy/unit.ts b/src/i18n/zh/proxy/unit.ts index 31860e6e..e31909bd 100644 --- a/src/i18n/zh/proxy/unit.ts +++ b/src/i18n/zh/proxy/unit.ts @@ -1,3 +1,5 @@ export default { - usage: 'MB' + MB: 'MB', + KB: 'KB', + B: 'B' }; diff --git a/src/operators/api/models.ts b/src/operators/api/models.ts index 12322aad..ce1d8fa2 100644 --- a/src/operators/api/models.ts +++ b/src/operators/api/models.ts @@ -50,11 +50,16 @@ export interface IPackage { price: number; } +export enum IApiUnit { + COUNT = 'Count' +} + export interface IApi { id: string; path: string; endpoint: string; price?: number; + unit?: IApiUnit; title?: string; introduction?: string; apply_count?: number; diff --git a/src/operators/proxy/models.ts b/src/operators/proxy/models.ts index 2d4675c7..0316b5f6 100644 --- a/src/operators/proxy/models.ts +++ b/src/operators/proxy/models.ts @@ -2,10 +2,15 @@ import { IPackage } from '../api'; import { IDocument } from '../document'; import { IService } from '../service'; +export enum IProxyUnit { + MB = 'MB' +} + export interface IProxy { id: string; path: string; endpoint: string; + unit?: IProxyUnit; price?: number; title?: string; introduction?: string; diff --git a/src/pages/console/application/List.vue b/src/pages/console/application/List.vue index c8726049..576fb96e 100644 --- a/src/pages/console/application/List.vue +++ b/src/pages/console/application/List.vue @@ -27,7 +27,7 @@ class-name="text-center" > + > + +