Refine console ux detail (#233)

This commit is contained in:
Germey authored and GitHub committed 2025-07-27 02:08:41 +08:00
1 parent 9019629c42
commit ffea198d14
15 files changed
+315 -393

No files matched your search

-26
View File
@@ -13,10 +13,6 @@
<el-col :span="16" :offset="4">
<el-skeleton v-if="loading" />
<el-form v-else-if="application" label-width="100px">
<div v-if="!application?.service">
<p class="description">{{ $t('application.message.globalBalanceBuyDescription') }}</p>
<el-divider border-style="dashed" />
</div>
<el-form-item v-if="application?.service" :label="$t('application.field.service')">
{{ application?.service?.title }}
</el-form-item>
@@ -273,13 +269,6 @@ export default defineComponent({
</script>
<style lang="scss" scoped>
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: var(--el-text-color-primary);
}
.el-form {
.el-radio-group {
.el-radio-button {
@@ -301,10 +290,6 @@ export default defineComponent({
}
.panel {
padding: 30px;
width: calc(100% - 200px);
background-color: var(--el-bg-color-page);
.el-card {
padding: 50px 0;
.price {
@@ -319,15 +304,4 @@ export default defineComponent({
}
}
}
.pagination {
float: right;
}
@media (max-width: 767px) {
.panel {
width: 100%;
height: 100%;
}
}
</style>
+10 -44
View File
@@ -16,7 +16,7 @@
table-layout="fixed"
:empty-text="$t('common.message.noData')"
>
<el-table-column prop="id" :label="$t('application.field.id')" width="280px" class-name="text-center">
<el-table-column prop="id" :label="$t('application.field.id')" width="190px" class-name="text-center">
<template #default="scope">
<span>{{ scope.row.id }}</span>
<span class="copy">
@@ -26,10 +26,10 @@
</el-table-column>
<el-table-column :label="$t('application.field.type')" width="80px">
<template #default="scope">
<el-tag v-if="scope.row?.type === 'Period'" type="success" effect="dark">
<el-tag v-if="scope.row?.type === 'Period'" type="success" effect="dark" round>
{{ $t('application.type.period') }}
</el-tag>
<el-tag v-if="scope.row?.type === 'Usage'" effect="dark">
<el-tag v-if="scope.row?.type === 'Usage'" effect="dark" round>
{{ $t('application.type.usage') }}
</el-tag>
</template>
@@ -42,7 +42,7 @@
<el-table-column
prop="remaining_amount"
:label="$t('application.field.remainingAmount')"
width="160px"
width="140px"
class-name="text-center"
>
<template #default="scope">
@@ -52,14 +52,14 @@
<el-table-column
prop="used_amount"
:label="$t('application.field.usedAmount')"
width="160px"
width="140px"
class-name="text-center"
>
<template #default="scope">
<span>{{ getUsedAmount(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('application.field.expiredAt')" width="200px">
<el-table-column :label="$t('application.field.expiredAt')" width="170px">
<template #default="scope">
<span v-if="scope.row.expired_at" class="expired-at">{{ $dayjs.format(scope.row.expired_at) }}</span>
</template>
@@ -84,7 +84,7 @@
</el-col>
</el-row>
<el-row>
<el-col>
<el-col :span="24">
<div class="pagination">
<pagination :current-page="page" :page-size="limit" :total="total" @change="onPageChange"> </pagination>
</div>
@@ -100,7 +100,7 @@ import { applicationOperator } from '@/operators';
import Pagination from '@/components/common/Pagination.vue';
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
import { ElTable, ElRow, ElCol, ElTableColumn, ElCard, ElButton, ElTag } from 'element-plus';
import { ROUTE_CONSOLE_APPLICATION_SUBSCRIBE } from '@/router/constants';
import { ROUTE_CONSOLE_APPLICATION_EXTRA, ROUTE_CONSOLE_APPLICATION_SUBSCRIBE } from '@/router/constants';
import { IApplication, IApplicationListResponse, ICredentialType, IService } from '@/models';
interface IData {
@@ -139,7 +139,7 @@ export default defineComponent({
loading: false,
total: undefined,
buying: false,
limit: 10,
limit: 12,
form: {
amount: 1
},
@@ -175,7 +175,7 @@ export default defineComponent({
methods: {
onBuyMore(application: IApplication) {
this.$router.push({
name: ROUTE_CONSOLE_APPLICATION_SUBSCRIBE,
name: ROUTE_CONSOLE_APPLICATION_EXTRA,
params: {
id: application.id
}
@@ -225,37 +225,3 @@ export default defineComponent({
}
});
</script>
<style lang="scss" scoped>
.panel {
padding: 30px;
width: calc(100% - 200px);
background-color: var(--el-bg-color-page);
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: var(--el-text-color-primary);
}
.el-table {
min-height: calc(100vh - 350px);
margin-bottom: 50px;
.el-button {
border-radius: 20px;
}
}
}
.pagination {
margin: auto;
width: fit-content;
}
@media (max-width: 767px) {
.panel {
width: 100%;
height: 100%;
}
}
</style>
@@ -296,19 +296,7 @@ export default defineComponent({
</script>
<style lang="scss" scoped>
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: var(--el-text-color-primary);
}
.panel {
padding: 30px;
overflow: scroll;
width: calc(100% - 200px);
background-color: var(--el-bg-color-page);
.card {
padding: 50px 0 100px 0;
cursor: pointer;
@@ -377,15 +365,4 @@ export default defineComponent({
font-size: 14px;
}
}
.pagination {
float: right;
}
@media (max-width: 767px) {
.panel {
width: 100%;
height: 100%;
}
}
</style>
+109 -102
View File
@@ -29,6 +29,7 @@
<el-descriptions-item v-if="order?.pay_way" :label="$t('order.field.payWay')">
<span v-if="order?.pay_way === PayWay.WechatPay">{{ $t('order.title.wechatPay') }}</span>
<span v-if="order?.pay_way === PayWay.Stripe">{{ $t('order.title.stripe') }}</span>
<span v-if="order?.pay_way === PayWay.AliPay">{{ $t('order.title.aliPay') }}</span>
</el-descriptions-item>
<el-descriptions-item :label="$t('order.field.createdAt')">
{{ $dayjs.format(order?.created_at) }}
@@ -72,7 +73,6 @@
<span class="payname">{{ $t('order.title.wechatPay') }}</span>
</div>
<div
v-if="false"
:class="{
payway: true,
alipay: true,
@@ -111,15 +111,30 @@
</el-card>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<wechat-pay-order
v-if="order && payWay === PayWay.WechatPay"
v-model="order"
:visible="paying"
@hide="paying = false"
/>
<stripe-pay-order
v-if="order && payWay === PayWay.Stripe"
v-model="order"
:visible="paying"
@hide="paying = false"
/>
<alipay-pay-order
v-if="order && payWay === PayWay.AliPay"
v-model="order"
:visible="paying"
@hide="paying = false"
/>
</el-col>
</el-row>
</el-col>
</el-row>
<wechat-pay-order
v-if="order && payWay === PayWay.WechatPay"
v-model="order"
:visible="paying"
@hide="paying = false"
/>
<stripe-pay-order v-if="order && payWay === PayWay.Stripe" v-model="order" :visible="paying" @hide="paying = false" />
</template>
<script lang="ts">
@@ -138,6 +153,7 @@ import {
} from 'element-plus';
import WechatPayOrder from '@/components/order/WechatPay.vue';
import StripePayOrder from '@/components/order/StripePay.vue';
import AlipayPayOrder from '@/components/order/AliPay.vue';
import { IApplicationType, IOrder, IOrderDetailResponse, OrderState } from '@/models';
import { getPriceString } from '@/utils';
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
@@ -174,7 +190,8 @@ export default defineComponent({
ElDescriptions,
ElDescriptionsItem,
WechatPayOrder,
StripePayOrder
StripePayOrder,
AlipayPayOrder
},
data(): IData {
return {
@@ -258,110 +275,100 @@ export default defineComponent({
</script>
<style lang="scss" scoped>
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: var(--el-text-color-primary);
.el-card {
min-height: 500px;
}
.panel {
padding: 30px;
width: calc(100% - 200px);
background-color: var(--el-bg-color-page);
.el-card {
min-height: 500px;
.order {
padding-top: 50px;
.price {
font-size: 20px;
font-weight: bold;
&.unfree {
color: #ff5441;
}
&.free {
color: #29c287;
}
}
.order {
padding-top: 50px;
.price {
font-size: 20px;
font-weight: bold;
&.unfree {
color: #ff5441;
}
&.free {
color: #29c287;
}
.payways {
overflow: hidden;
.payway {
cursor: pointer;
font-size: 14px;
float: left;
width: 120px;
line-height: 40px;
text-align: center;
height: 40px;
border: 2px solid var(--el-border-color);
&:first-child {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
&:last-child {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
&:not(:last-child) {
border-right: none;
}
&.active {
border-top: 2px solid var(--el-color-primary);
border-right: 2px solid var(--el-color-primary);
border-bottom: 2px solid var(--el-color-primary);
border-left: 2px solid var(--el-color-primary);
& + .payway {
border-left: none;
}
}
}
.payways {
overflow: hidden;
.payway {
cursor: pointer;
font-size: 14px;
float: left;
width: 120px;
line-height: 40px;
text-align: center;
height: 40px;
border: 2px solid var(--el-border-color);
&:first-child {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
&:last-child {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
&:not(:last-child) {
border-right: none;
}
&.active {
border-top: 2px solid var(--el-color-primary);
border-right: 2px solid var(--el-color-primary);
border-bottom: 2px solid var(--el-color-primary);
border-left: 2px solid var(--el-color-primary);
& + .payway {
border-left: none;
}
}
}
.payname {
display: inline-block;
font-size: 12px;
margin-left: 5px;
.payname {
display: inline-block;
font-size: 12px;
margin-left: 5px;
position: relative;
top: -2px;
}
.payicon {
width: 20px;
height: 20px;
margin-top: 2px;
display: inline-block;
&.wechatpay {
position: relative;
top: -2px;
top: 3px;
width: 22px;
height: 19px;
background-image: url(//midas.gtimg.cn/enterprise/images/ep_new_sprites@2x.png);
background-repeat: no-repeat;
background-size: 60px 250px;
background-position: 0 -50px;
}
.payicon {
width: 20px;
height: 20px;
margin-top: 2px;
display: inline-block;
&.wechatpay {
position: relative;
top: 3px;
width: 22px;
height: 19px;
background-image: url(//midas.gtimg.cn/enterprise/images/ep_new_sprites@2x.png);
background-repeat: no-repeat;
background-size: 60px 250px;
background-position: 0 -50px;
}
&.stripe {
position: relative;
top: 3px;
width: 22px;
height: 18px;
background-image: url(//cdn.acedata.cloud/2023-08-27-164440.png);
background-size: contain;
background-repeat: no-repeat;
}
&.stripe {
position: relative;
top: 3px;
width: 22px;
height: 18px;
background-image: url(//cdn.acedata.cloud/2023-08-27-164440.png);
background-size: contain;
background-repeat: no-repeat;
}
&.alipay {
position: relative;
top: 3px;
width: 22px;
height: 18px;
background-image: url(//cdn.acedata.cloud/alipay.webp);
background-size: contain;
background-repeat: no-repeat;
}
}
.btn-pay {
width: 150px;
}
}
@media (max-width: 767px) {
.panel {
width: 100%;
height: 100%;
}
.btn-pay {
width: 150px;
}
</style>
+6 -40
View File
@@ -10,7 +10,7 @@
<el-col :span="24">
<el-card shadow="hover">
<el-table v-loading="loading" :data="orders" stripe>
<el-table-column prop="id" :label="$t('order.field.id')" class-name="text-center" width="350px">
<el-table-column prop="id" :label="$t('order.field.id')" class-name="text-center" width="190px">
<template #default="scope">
<span class="key">{{ scope.row.id }}</span>
<span class="copy">
@@ -26,19 +26,19 @@
<el-table-column prop="state" :label="$t('order.field.state')" class-name="text-center" width="150px">
<template #default="scope">
<span v-if="scope.row.state === OrderState?.PENDING">
<el-tag type="info" class="mx-1" effect="dark">{{ $t('order.state.pending') }}</el-tag>
<el-tag type="info" class="mx-1" effect="dark" round>{{ $t('order.state.pending') }}</el-tag>
</span>
<span v-else-if="scope.row.state === OrderState?.PAID" class="state state-paid">
<el-tag type="success" class="mx-1" effect="dark">{{ $t('order.state.paid') }}</el-tag>
<el-tag type="success" class="mx-1" effect="dark" round>{{ $t('order.state.paid') }}</el-tag>
</span>
<span v-else-if="scope.row.state === OrderState?.FINISHED" class="state state-finished">
<el-tag type="success" class="mx-1" effect="dark">{{ $t('order.state.finished') }}</el-tag>
<el-tag type="success" class="mx-1" effect="dark" round>{{ $t('order.state.finished') }}</el-tag>
</span>
<span v-else-if="scope.row.state === OrderState?.EXPIRED" class="state state-expired">
<el-tag type="danger" class="mx-1" effect="dark">{{ $t('order.state.expired') }}</el-tag>
<el-tag type="danger" class="mx-1" effect="dark" round>{{ $t('order.state.expired') }}</el-tag>
</span>
<span v-else-if="scope.row.state === OrderState?.FAILED" class="state state-failed">
<el-tag type="danger" class="mx-1" effect="dark"> {{ $t('order.state.failed') }}</el-tag>
<el-tag type="danger" class="mx-1" effect="dark" round> {{ $t('order.state.failed') }}</el-tag>
</span>
</template>
</el-table-column>
@@ -197,37 +197,3 @@ export default defineComponent({
}
});
</script>
<style lang="scss" scoped>
.panel {
padding: 30px;
width: calc(100% - 200px);
background-color: var(--el-bg-color-page);
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: var(--el-text-color-primary);
}
.el-table {
height: calc(100vh - 350px);
margin-bottom: 50px;
.el-button {
border-radius: 20px;
}
}
}
.pagination {
margin: auto;
width: fit-content;
}
@media (max-width: 767px) {
.panel {
width: 100%;
height: 100%;
}
}
</style>
+10 -42
View File
@@ -36,46 +36,33 @@
table-layout="fixed"
:empty-text="$t('common.message.noData')"
>
<el-table-column :label="$t('application.field.name')" width="160px">
<el-table-column :label="$t('application.field.name')" width="140px">
<template #default="scope">
<span>{{ scope.row?.api?.title }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('usage.field.statusCode')" width="120px">
<el-table-column :label="$t('usage.field.statusCode')" width="80px">
<template #default="scope">
<span>{{ scope.row.status_code }}</span>
</template>
</el-table-column>
<el-table-column
prop="remaining_amount"
:label="$t('usage.field.remainingAmount')"
width="160px"
class-name="text-center"
>
<template #default="scope">
<span>{{ getRemainingAmount(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column
prop="deducted_amount"
:label="$t('usage.field.deductedAmount')"
width="150px"
width="130px"
class-name="text-center"
>
<template #default="scope">
<span>{{ getDeductedAmount(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column
prop="metadata"
:label="$t('usage.field.metadata')"
width="200px"
class-name="text-center"
>
<el-table-column prop="metadata" width="350px" :label="$t('usage.field.metadata')">
<template #default="scope">
<el-tag v-for="(name, key) in scope.row.metadata" :key="key" class="mb-2">
{{ key }}: {{ name }}
</el-tag>
<div class="flex flex-wrap gap-2 justify-start">
<div v-for="(name, key) in scope.row.metadata" :key="key" class="inline-block">
<el-tag round> {{ key }}: {{ name }} </el-tag>
</div>
</div>
</template>
</el-table-column>
<el-table-column
@@ -278,27 +265,8 @@ export default defineComponent({
<style lang="scss" scoped>
.panel {
padding: 30px;
width: calc(100% - 200px);
background-color: var(--el-bg-color-page);
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: var(--el-text-color-primary);
}
.el-table {
height: calc(100vh - 430px);
margin-bottom: 50px;
.el-button {
border-radius: 20px;
}
height: calc(100vh - 300px) !important;
}
}
.pagination {
margin: auto;
width: fit-content;
}
</style>