update user experience of buy order

This commit is contained in:
AceDataCloud committed 2023-03-26 03:06:06 +08:00
1 parent 768b1d66ca
commit 265fe7edf4
11 files changed
+202 -81

No files matched your search

+102
View File
@@ -0,0 +1,102 @@
<template>
<el-row class="panel">
<el-col :span="24">
<el-row>
<el-col :span="24">
<h2 class="title">{{ $t('common.title.buyMore') }}</h2>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-card shadow="hover">
<el-row>
<el-col :span="12" :offset="6">
<el-skeleton v-if="loading" />
<create-order v-else-if="application" :application="application" />
</el-col>
</el-row>
</el-card>
</el-col>
</el-row>
</el-col>
</el-row>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { applicationOperator, IApplication, IApplicationDetailResponse } from '@/operators';
import CreateOrder from '@/components/order/Create.vue';
import { ElRow, ElCol, ElCard, ElSkeleton } from 'element-plus';
interface IData {
application: IApplication | undefined;
loading: boolean;
}
export default defineComponent({
name: 'ConsoleApplicationBuy',
components: {
CreateOrder,
ElSkeleton,
ElRow,
ElCol,
ElCard
},
data(): IData {
return {
application: undefined,
loading: false
};
},
computed: {
id() {
return this.$route.params?.id?.toString();
}
},
mounted() {
console.log('this', this.id);
this.onFetchData();
},
methods: {
onFetchData() {
this.loading = true;
applicationOperator
.get(this.id)
.then(({ data: data }: { data: IApplicationDetailResponse }) => {
this.application = data;
this.loading = false;
})
.catch(() => {
this.loading = false;
});
}
}
});
</script>
<style lang="scss" scoped>
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: #333;
}
.el-card {
min-height: 500px;
padding-top: 50px;
}
.panel {
padding: 30px;
.credential {
.copy {
cursor: pointer;
}
}
}
.pagination {
float: right;
}
</style>
+9 -3
View File
@@ -115,7 +115,7 @@ import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
import RotateCredential from '@/components/application/RotateCredential.vue';
import CreateOrder from '@/components/order/Create.vue';
import { ElTable, ElRow, ElCol, ElTableColumn, ElButton, ElCard, ElMenu, ElMenuItem, ElMessage } from 'element-plus';
import { ROUTE_DOCUMENT_DETAIL } from '@/router/constants';
import { ROUTE_CONSOLE_APPLICATION_BUY, ROUTE_DOCUMENT_DETAIL } from '@/router/constants';
interface IData {
applications: IApplication[];
@@ -235,8 +235,14 @@ export default defineComponent({
});
},
onBuyMore(application: IApplication) {
this.active.application = application;
this.buying = true;
// this.active.application = application;
// this.buying = true;
this.$router.push({
name: ROUTE_CONSOLE_APPLICATION_BUY,
params: {
id: application.id
}
});
},
onPageChange(page: number) {
this.$router.push({
+1
View File
@@ -12,6 +12,7 @@
<api-info v-if="document.api" :api="document.api" />
<el-divider />
<api-usage v-if="document.api" v-model:form="form" :api="document.api" />
<markdown-renderer :content="document?.content" />
</div>
<div v-else-if="document.type === documentType.PROXY">
<proxy-info v-if="document.proxy" :proxy="document.proxy" />
+9 -4
View File
@@ -72,7 +72,7 @@
<el-button disabled>
{{ $t('common.button.applied') }}
</el-button>
<el-button type="primary" @click="onBuyMore">
<el-button v-if="api?.application_id" type="primary" @click="onBuyMore(api?.application_id!)">
{{ $t('common.button.buyMore') }}
</el-button>
</div>
@@ -133,7 +133,7 @@ import { apiOperator } from '@/operators/api/operator';
import { IApi, IApiListResponse } from '@/operators/api/models';
import { IApplicationType } from '@/operators/application/models';
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
import { ROUTE_AUTH_LOGIN, ROUTE_CONSOLE_APPLICATION_LIST } from '@/router';
import { ROUTE_AUTH_LOGIN, ROUTE_CONSOLE_APPLICATION_BUY, ROUTE_CONSOLE_APPLICATION_LIST } from '@/router';
import { ElCol, ElRow, ElButton, ElCard, ElDivider, ElSkeleton, ElSkeletonItem } from 'element-plus';
import ApiPreview from '@/components/api/Preview.vue';
import ProxyPreview from '@/components/proxy/Preview.vue';
@@ -243,8 +243,13 @@ export default defineComponent({
behavior: 'smooth'
});
},
onBuyMore() {
this.$router.push({ name: ROUTE_CONSOLE_APPLICATION_LIST });
onBuyMore(id: string) {
this.$router.push({
name: ROUTE_CONSOLE_APPLICATION_BUY,
params: {
id
}
});
},
onConfirm(obj: IApi | IProxy, type: IApplicationType) {
if (!this.$store.getters.authenticated) {