update user experience of buy order
This commit is contained in:
1 parent
768b1d66ca
commit
265fe7edf4
11 files changed
+202
-81
No files matched your search
@@ -7,3 +7,13 @@
|
|||||||
list-style: decimal;
|
list-style: decimal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markdown-body .highlight pre,
|
||||||
|
.markdown-body pre {
|
||||||
|
background-color: white !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.markdown-body img {
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0px 0px 3px 0px var(--color-border-muted);
|
||||||
|
}
|
||||||
@@ -14,6 +14,10 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<div class="item-body">
|
<div class="item-body">
|
||||||
|
<div>
|
||||||
|
{{ response.description }}
|
||||||
|
</div>
|
||||||
|
<el-divider class="my-3" />
|
||||||
<div v-if="response?.headers?.properties" class="headers">
|
<div v-if="response?.headers?.properties" class="headers">
|
||||||
<h2 class="title">{{ $t('api.entity.responseHeaders') }}</h2>
|
<h2 class="title">{{ $t('api.entity.responseHeaders') }}</h2>
|
||||||
<div class="properties">
|
<div class="properties">
|
||||||
@@ -45,7 +49,7 @@
|
|||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { IResponse } from '@/operators/api/models';
|
import { IResponse } from '@/operators/api/models';
|
||||||
import CodeSnippet from '../common/CodeSnippet.vue';
|
import CodeSnippet from '../common/CodeSnippet.vue';
|
||||||
import { ElCollapse, ElCollapseItem, ElTag } from 'element-plus';
|
import { ElCollapse, ElCollapseItem, ElTag, ElDivider } from 'element-plus';
|
||||||
import ResponseBody from './ResponseBody.vue';
|
import ResponseBody from './ResponseBody.vue';
|
||||||
|
|
||||||
interface IData {
|
interface IData {
|
||||||
@@ -61,7 +65,8 @@ export default defineComponent({
|
|||||||
ElCollapse,
|
ElCollapse,
|
||||||
ElCollapseItem,
|
ElCollapseItem,
|
||||||
ElTag,
|
ElTag,
|
||||||
ResponseBody
|
ResponseBody,
|
||||||
|
ElDivider
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
responses: {
|
responses: {
|
||||||
|
|||||||
@@ -1,59 +1,54 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :model-value="visible" :title="$t('application.title.buyService')" width="500px" center>
|
<el-form label-width="100px">
|
||||||
<el-form label-width="120px">
|
<el-form-item v-if="application?.api?.title" :label="$t('application.field.service')">
|
||||||
<el-form-item v-if="application?.api?.title" :label="$t('application.field.service')">
|
{{ application?.api?.title }}
|
||||||
{{ application?.api?.title }}
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item :label="$t('application.field.package')">
|
||||||
<el-form-item :label="$t('application.field.package')">
|
<el-radio-group v-if="application.type === applicationType.API" v-model="form.packageId">
|
||||||
<el-radio-group v-if="application.type === applicationType.API" v-model="form.packageId">
|
<el-radio-button v-for="(pkg, pkgIndex) in application?.api?.packages" :key="pkgIndex" :label="pkg.id">
|
||||||
<el-radio-button v-for="(pkg, pkgIndex) in application?.api?.packages" :key="pkgIndex" :label="pkg.id">
|
{{ pkg.amount }}{{ $t(`api.unit.${application?.api?.unit}`) }}
|
||||||
{{ pkg.amount }}{{ $t(`api.unit.${application?.api?.unit}`) }}
|
</el-radio-button>
|
||||||
</el-radio-button>
|
<el-radio-button label="custom">
|
||||||
<el-radio-button label="custom">
|
{{ $t('application.button.custom') }}
|
||||||
{{ $t('application.button.custom') }}
|
</el-radio-button>
|
||||||
</el-radio-button>
|
</el-radio-group>
|
||||||
</el-radio-group>
|
<el-radio-group v-else-if="application.type === applicationType.PROXY" v-model="form.packageId">
|
||||||
<el-radio-group v-else-if="application.type === applicationType.PROXY" v-model="form.packageId">
|
<el-radio-button v-for="(pkg, pkgIndex) in application?.proxy?.packages" :key="pkgIndex" :label="pkg.id">
|
||||||
<el-radio-button v-for="(pkg, pkgIndex) in application?.proxy?.packages" :key="pkgIndex" :label="pkg.id">
|
{{ pkg.amount }}{{ $t(`proxy.unit.${application?.proxy?.unit}`) }}
|
||||||
{{ pkg.amount }}{{ $t(`proxy.unit.${application?.proxy?.unit}`) }}
|
</el-radio-button>
|
||||||
</el-radio-button>
|
</el-radio-group>
|
||||||
</el-radio-group>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item v-if="form.packageId === 'custom'" :label="$t('application.field.amount')">
|
||||||
<el-form-item v-if="form.packageId === 'custom'" :label="$t('application.field.amount')">
|
<el-input-number v-model="form.amount" :min="1" :max="10000" controls-position="right" />
|
||||||
<el-input-number v-model="form.amount" :min="1" :max="10000" controls-position="right" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item :label="$t('service.field.price')">
|
||||||
<el-form-item :label="$t('service.field.price')">
|
<div v-if="application.type === applicationType.API">
|
||||||
<div v-if="application.type === applicationType.API">
|
<price
|
||||||
<price
|
v-if="form.packageId === 'custom'"
|
||||||
v-if="form.packageId === 'custom'"
|
:price="application?.api?.price"
|
||||||
:price="application?.api?.price"
|
:unit="$t(`api.unit.${application?.api?.unit}`)"
|
||||||
:unit="$t(`api.unit.${application?.api?.unit}`)"
|
/>
|
||||||
/>
|
<price v-else :price="package?.price" />
|
||||||
<price v-else :price="package?.price" />
|
</div>
|
||||||
</div>
|
<div v-if="application.type === applicationType.PROXY">
|
||||||
<div v-if="application.type === applicationType.PROXY">
|
<price :price="package?.price" />
|
||||||
<price :price="package?.price" />
|
</div>
|
||||||
</div>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-divider border-style="dashed" />
|
||||||
<el-divider />
|
<el-form-item :label="$t('application.field.shouldPayPrice')">
|
||||||
<el-form-item :label="$t('application.field.shouldPayPrice')">
|
<span v-if="form.packageId === 'custom'" :class="{ price: true, unfree: price > 0, free: price === 0 }">
|
||||||
<span v-if="form.packageId === 'custom'" :class="{ price: true, unfree: price > 0, free: price === 0 }">
|
¥{{ price.toFixed(2) }}
|
||||||
¥{{ price.toFixed(2) }}
|
|
||||||
</span>
|
|
||||||
<span v-else-if="package" :class="{ price: true, unfree: package?.price > 0, free: package?.price === 0 }">
|
|
||||||
¥{{ package?.price?.toFixed(2) }}
|
|
||||||
</span>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<span class="dialog-footer">
|
|
||||||
<el-button @click="$emit('hide')">{{ $t('common.button.cancel') }}</el-button>
|
|
||||||
<el-button type="primary" :loading="creating" @click="onCreateOrder">
|
|
||||||
{{ $t('application.button.createOrder') }}
|
|
||||||
</el-button>
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
<span v-else-if="package" :class="{ price: true, unfree: package?.price > 0, free: package?.price === 0 }">
|
||||||
</el-dialog>
|
¥{{ package?.price?.toFixed(2) }}
|
||||||
|
</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" size="large" class="btn-create" :loading="creating" @click="onCreateOrder">
|
||||||
|
{{ $t('application.button.createOrder') }}
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@@ -85,11 +80,10 @@ interface IData {
|
|||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CreateOrderDialog',
|
name: 'CreateOrderDialog',
|
||||||
components: {
|
components: {
|
||||||
ElDialog,
|
|
||||||
ElForm,
|
ElForm,
|
||||||
ElFormItem,
|
ElFormItem,
|
||||||
ElButton,
|
|
||||||
ElInputNumber,
|
ElInputNumber,
|
||||||
|
ElButton,
|
||||||
ElDivider,
|
ElDivider,
|
||||||
ElRadioGroup,
|
ElRadioGroup,
|
||||||
ElRadioButton,
|
ElRadioButton,
|
||||||
@@ -99,14 +93,8 @@ export default defineComponent({
|
|||||||
application: {
|
application: {
|
||||||
type: Object as () => IApplication,
|
type: Object as () => IApplication,
|
||||||
required: true
|
required: true
|
||||||
},
|
|
||||||
visible: {
|
|
||||||
type: Boolean,
|
|
||||||
required: false,
|
|
||||||
default: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['hide'],
|
|
||||||
data(): IData {
|
data(): IData {
|
||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
@@ -151,15 +139,6 @@ export default defineComponent({
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
visible: {
|
|
||||||
handler(val) {
|
|
||||||
if (val) {
|
|
||||||
this.onInit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.onInit();
|
this.onInit();
|
||||||
},
|
},
|
||||||
@@ -226,4 +205,8 @@ export default defineComponent({
|
|||||||
color: #29c287;
|
color: #29c287;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-create {
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -5,5 +5,6 @@ export default {
|
|||||||
placeholderOfInput: '请填写',
|
placeholderOfInput: '请填写',
|
||||||
allApplications: '所有申请',
|
allApplications: '所有申请',
|
||||||
allOrders: '所有订单',
|
allOrders: '所有订单',
|
||||||
orderInfo: '订单信息'
|
orderInfo: '订单信息',
|
||||||
|
buyMore: '购买更多'
|
||||||
};
|
};
|
||||||
@@ -65,6 +65,7 @@ export interface IApi {
|
|||||||
title?: string;
|
title?: string;
|
||||||
introduction?: string;
|
introduction?: string;
|
||||||
applied_count?: number;
|
applied_count?: number;
|
||||||
|
application_id?: string;
|
||||||
free_amount?: number;
|
free_amount?: number;
|
||||||
applied?: boolean;
|
applied?: boolean;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -115,7 +115,7 @@ import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
|||||||
import RotateCredential from '@/components/application/RotateCredential.vue';
|
import RotateCredential from '@/components/application/RotateCredential.vue';
|
||||||
import CreateOrder from '@/components/order/Create.vue';
|
import CreateOrder from '@/components/order/Create.vue';
|
||||||
import { ElTable, ElRow, ElCol, ElTableColumn, ElButton, ElCard, ElMenu, ElMenuItem, ElMessage } from 'element-plus';
|
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 {
|
interface IData {
|
||||||
applications: IApplication[];
|
applications: IApplication[];
|
||||||
@@ -235,8 +235,14 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onBuyMore(application: IApplication) {
|
onBuyMore(application: IApplication) {
|
||||||
this.active.application = application;
|
// this.active.application = application;
|
||||||
this.buying = true;
|
// this.buying = true;
|
||||||
|
this.$router.push({
|
||||||
|
name: ROUTE_CONSOLE_APPLICATION_BUY,
|
||||||
|
params: {
|
||||||
|
id: application.id
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onPageChange(page: number) {
|
onPageChange(page: number) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<api-info v-if="document.api" :api="document.api" />
|
<api-info v-if="document.api" :api="document.api" />
|
||||||
<el-divider />
|
<el-divider />
|
||||||
<api-usage v-if="document.api" v-model:form="form" :api="document.api" />
|
<api-usage v-if="document.api" v-model:form="form" :api="document.api" />
|
||||||
|
<markdown-renderer :content="document?.content" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="document.type === documentType.PROXY">
|
<div v-else-if="document.type === documentType.PROXY">
|
||||||
<proxy-info v-if="document.proxy" :proxy="document.proxy" />
|
<proxy-info v-if="document.proxy" :proxy="document.proxy" />
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
<el-button disabled>
|
<el-button disabled>
|
||||||
{{ $t('common.button.applied') }}
|
{{ $t('common.button.applied') }}
|
||||||
</el-button>
|
</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') }}
|
{{ $t('common.button.buyMore') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -133,7 +133,7 @@ import { apiOperator } from '@/operators/api/operator';
|
|||||||
import { IApi, IApiListResponse } from '@/operators/api/models';
|
import { IApi, IApiListResponse } from '@/operators/api/models';
|
||||||
import { IApplicationType } from '@/operators/application/models';
|
import { IApplicationType } from '@/operators/application/models';
|
||||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
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 { ElCol, ElRow, ElButton, ElCard, ElDivider, ElSkeleton, ElSkeletonItem } from 'element-plus';
|
||||||
import ApiPreview from '@/components/api/Preview.vue';
|
import ApiPreview from '@/components/api/Preview.vue';
|
||||||
import ProxyPreview from '@/components/proxy/Preview.vue';
|
import ProxyPreview from '@/components/proxy/Preview.vue';
|
||||||
@@ -243,8 +243,13 @@ export default defineComponent({
|
|||||||
behavior: 'smooth'
|
behavior: 'smooth'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onBuyMore() {
|
onBuyMore(id: string) {
|
||||||
this.$router.push({ name: ROUTE_CONSOLE_APPLICATION_LIST });
|
this.$router.push({
|
||||||
|
name: ROUTE_CONSOLE_APPLICATION_BUY,
|
||||||
|
params: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onConfirm(obj: IApi | IProxy, type: IApplicationType) {
|
onConfirm(obj: IApi | IProxy, type: IApplicationType) {
|
||||||
if (!this.$store.getters.authenticated) {
|
if (!this.$store.getters.authenticated) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
ROUTE_CONSOLE_APPLICATION_BUY,
|
||||||
ROUTE_CONSOLE_APPLICATION_LIST,
|
ROUTE_CONSOLE_APPLICATION_LIST,
|
||||||
ROUTE_CONSOLE_ORDER_DETAIL,
|
ROUTE_CONSOLE_ORDER_DETAIL,
|
||||||
ROUTE_CONSOLE_ORDER_LIST,
|
ROUTE_CONSOLE_ORDER_LIST,
|
||||||
@@ -33,6 +34,11 @@ export default {
|
|||||||
path: 'applications',
|
path: 'applications',
|
||||||
name: ROUTE_CONSOLE_APPLICATION_LIST,
|
name: ROUTE_CONSOLE_APPLICATION_LIST,
|
||||||
component: () => import('@/pages/console/application/List.vue')
|
component: () => import('@/pages/console/application/List.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'applications/:id/buy',
|
||||||
|
name: ROUTE_CONSOLE_APPLICATION_BUY,
|
||||||
|
component: () => import('@/pages/console/application/Buy.vue')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@@ -7,6 +7,7 @@ export const ROUTE_CONSOLE_ROOT = 'console-root';
|
|||||||
export const ROUTE_CONSOLE_ORDER_LIST = 'console-order-list';
|
export const ROUTE_CONSOLE_ORDER_LIST = 'console-order-list';
|
||||||
export const ROUTE_CONSOLE_ORDER_DETAIL = 'console-order-detail';
|
export const ROUTE_CONSOLE_ORDER_DETAIL = 'console-order-detail';
|
||||||
export const ROUTE_CONSOLE_APPLICATION_LIST = 'console-application-list';
|
export const ROUTE_CONSOLE_APPLICATION_LIST = 'console-application-list';
|
||||||
|
export const ROUTE_CONSOLE_APPLICATION_BUY = 'console-application-buy';
|
||||||
|
|
||||||
export const ROUTE_DOCUMENT_LIST = 'document-list';
|
export const ROUTE_DOCUMENT_LIST = 'document-list';
|
||||||
export const ROUTE_DOCUMENT_DETAIL = 'document-detail';
|
export const ROUTE_DOCUMENT_DETAIL = 'document-detail';
|
||||||
|
|||||||
Reference in new issue
Block a user