remove unused

This commit is contained in:
AceDataCloud committed 2023-04-07 13:05:35 +08:00
1 parent 301dab1ca5
commit ea1c3413a5
88 files changed
+29 -5766

No files matched your search

-142
View File
@@ -1,142 +0,0 @@
<template>
<el-row class="panel">
<el-col :span="24">
<el-row>
<el-col :span="24">
<h2 class="title">{{ $t('application.title.manageApplication') }}</h2>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-card shadow="hover">
<el-row>
<el-col :span="12" :offset="6">
<el-form :inline="true" label-width="120px">
<el-form-item :label="$t('application.field.id')">
<el-input v-model="id" />
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="loading" @click="onQuery">
{{ $t('application.button.query') }}
</el-button>
</el-form-item>
</el-form>
<el-divider border-style="dashed" />
<el-form v-if="application" :inline="true" label-width="120px">
<el-form-item :label="$t('application.field.remainingAmount')">
<el-input v-model="application.remaining_amount" />
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="updating" @click="onUpdateRemainingAmount">
{{ $t('common.button.update') }}
</el-button>
</el-form-item>
</el-form>
</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 { ElRow, ElCol, ElCard, ElForm, ElFormItem, ElInput, ElButton, ElDivider, ElMessage } from 'element-plus';
interface IData {
application: IApplication | undefined;
loading: boolean;
updating: boolean;
id: string | undefined;
}
export default defineComponent({
name: 'ConsoleApplication',
components: {
ElRow,
ElCol,
ElCard,
ElForm,
ElFormItem,
ElInput,
ElButton,
ElDivider
},
data(): IData {
return {
application: undefined,
id: undefined,
loading: false,
updating: false
};
},
computed: {},
methods: {
onQuery() {
if (!this.id) {
return;
}
this.loading = true;
applicationOperator
.get(this.id)
.then(({ data: data }: { data: IApplicationDetailResponse }) => {
this.application = data;
this.loading = false;
})
.catch(() => {
this.loading = false;
});
},
onUpdateRemainingAmount() {
if (!this.id) {
return;
}
this.updating = true;
applicationOperator
.updateRemainingAmount(this.id, {
remaining_amount: this.application?.remaining_amount
})
.then(({ data: data }: { data: IApplicationDetailResponse }) => {
this.application = data;
this.updating = false;
ElMessage.success(this.$t('application.message.updateSuccessfully'));
})
.catch(() => {
this.updating = false;
ElMessage.error(this.$t('application.message.updateFailed'));
});
}
}
});
</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>
-102
View File
@@ -1,102 +0,0 @@
<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>
-327
View File
@@ -1,327 +0,0 @@
<template>
<el-row class="panel">
<el-col :span="24">
<el-row>
<el-col :span="24">
<h2 class="title">{{ $t('common.title.allApplications') }}</h2>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-card shadow="hover">
<el-menu :default-active="type" class="mb-4" mode="horizontal" @select="onFilterType">
<el-menu-item :index="applicationType.API">{{ $t('application.field.api') }}</el-menu-item>
<el-menu-item :index="applicationType.PROXY">{{ $t('application.field.proxy') }}</el-menu-item>
</el-menu>
<el-table v-loading="loading" :data="applications" stripe table-layout="fixed">
<el-table-column prop="id" :label="$t('application.field.id')" width="350px" class-name="text-center">
<template #default="scope">
<span>{{ scope.row.id }}</span>
<span class="copy">
<copy-to-clipboard :content="scope?.row?.id" />
</span>
</template>
</el-table-column>
<el-table-column :label="$t('application.field.name')" width="220px">
<template #default="scope">
<span v-if="scope.row.type === applicationType.API">{{ scope.row?.api?.title }}</span>
<span v-if="scope.row.type === applicationType.PROXY">{{ scope.row?.proxy?.title }}</span>
</template>
</el-table-column>
<el-table-column
prop="remaining_amount"
:label="$t('application.field.remainingAmount')"
width="120px"
class-name="text-center"
>
<template #default="scope">
<span>{{ getRemainingAmount(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column
prop="used_amount"
:label="$t('application.field.usedAmount')"
width="120px"
class-name="text-center"
>
<template #default="scope">
<span>{{ getUsedAmount(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('application.field.credential')" class-name="credential" width="380px">
<template #default="scope">
<div v-if="scope?.row?.credential?.type === credentialType.TOKEN">
<span class="key">{{ scope?.row?.credential?.token }}</span>
<span class="copy">
<copy-to-clipboard :content="scope?.row?.credential?.token" />
</span>
<span class="rotate">
<rotate-credential @rotate="onRotateCredential(scope.row)" />
</span>
</div>
<div v-if="scope?.row?.credential?.type === credentialType.IDENTITY">
<span class="key"
>{{ scope?.row?.credential?.username }}:{{ scope?.row?.credential?.password }}</span
>
<span class="copy">
<copy-to-clipboard
:content="`${scope?.row?.credential?.username}:${scope?.row?.credential?.password}`"
/>
</span>
</div>
</template>
</el-table-column>
<el-table-column fixed="right" width="220px">
<template #default="scope">
<div class="float-right">
<el-button v-if="scope.row?.api?.document_id" @click="onGoDocument(scope?.row)">
{{ $t('application.button.goDocument') }}
</el-button>
<el-button type="primary" @click="onBuyMore(scope?.row)">
{{ $t('application.button.buyMore') }}
</el-button>
</div>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<el-row>
<el-col :span="10" :offset="14">
<div class="pagination m-v-lg">
<pagination :current-page="page" :page-size="limit" :total="total" @change="onPageChange"> </pagination>
</div>
</el-col>
</el-row>
</el-col>
</el-row>
<create-order v-if="active.application" :visible="buying" :application="active.application" @hide="buying = false" />
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import {
applicationOperator,
IApplication,
IApplicationDetailResponse,
IApplicationListResponse,
IApplicationType,
ICredentialType,
IService
} from '@/operators';
import Pagination from '@/components/common/Pagination.vue';
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_CONSOLE_APPLICATION_BUY, ROUTE_DOCUMENT_DETAIL } from '@/router/constants';
interface IData {
applications: IApplication[];
loading: boolean;
total: number | undefined;
limit: number;
buying: boolean;
form: {
amount: number | undefined;
};
active: {
service: IService | undefined;
application: IApplication | undefined;
};
applicationType: typeof IApplicationType;
credentialType: typeof ICredentialType;
}
export default defineComponent({
name: 'ConsoleApplicationList',
components: {
Pagination,
CopyToClipboard,
RotateCredential,
CreateOrder,
ElTable,
ElRow,
ElCol,
ElTableColumn,
ElButton,
ElCard,
ElMenu,
ElMenuItem
},
data(): IData {
return {
credentialType: ICredentialType,
applicationType: IApplicationType,
applications: [],
loading: false,
total: undefined,
buying: false,
limit: 10,
form: {
amount: 1
},
active: {
service: undefined,
application: undefined
}
};
},
computed: {
redirect() {
return this.$route.query?.redirect;
},
page() {
return parseInt(this.$route.query.page?.toString() || '1');
},
type() {
return (this.$route.query.type?.toString() || IApplicationType.API) as IApplicationType;
}
},
watch: {
page: {
handler() {
this.onFetchData();
}
},
type: {
handler() {
this.onFetchData();
}
}
},
mounted() {
this.onFetchData();
},
methods: {
onFilterType(type: string) {
if (type === this.type) {
return;
}
this.$router.push({
...this.$route,
query: {
...this.$route.query,
page: 1,
type
}
});
},
onRotateCredential(application: IApplication) {
const id = application.id;
if (!id) {
ElMessage.error(this.$t('application.message.idDoesNotExist'));
return;
}
applicationOperator
.rotateCredential(id)
.then(({ data: data }: { data: IApplicationDetailResponse }) => {
console.log('rotate successfully');
ElMessage.success(this.$t('application.message.rotateCredentialSuccessfully'));
application.credential = data.credential;
})
.catch(() => {
ElMessage.error(this.$t('application.message.rotateCredentialFailed'));
});
},
onGoDocument(application: IApplication) {
const documentId = application?.api?.document_id;
this.$router.push({
name: ROUTE_DOCUMENT_DETAIL,
params: {
id: documentId
}
});
},
onBuyMore(application: IApplication) {
// 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({
name: this.$route.name?.toString(),
query: {
...this.$route.query,
page: page
}
});
},
onFetchData() {
this.loading = true;
applicationOperator
.getAll({
limit: this.limit,
offset: (this.page - 1) * this.limit,
user_id: this.$store.getters.user.id,
type: this.type,
ordering: '-created_at'
})
.then(({ data: data }: { data: IApplicationListResponse }) => {
this.applications = data.items;
this.loading = false;
this.total = data.count;
})
.catch(() => {
this.loading = false;
});
},
getRemainingAmount(application: IApplication) {
if (application.type === IApplicationType.API) {
const unit = this.$t(`api.unit.${application?.api?.unit}`);
return `${application.remaining_amount}${unit}`;
}
if (application.type === IApplicationType.PROXY) {
const unit = this.$t(`proxy.unit.${application?.proxy?.unit}`);
if (unit === 'MB') {
return `${(application.remaining_amount || 0).toFixed(2)}${unit}`;
}
}
},
getUsedAmount(application: IApplication) {
if (application.type === IApplicationType.API) {
const unit = this.$t(`api.unit.${application?.api?.unit}`);
return `${application.used_amount}${unit}`;
}
if (application.type === IApplicationType.PROXY) {
const unit = this.$t(`proxy.unit.${application?.proxy?.unit}`);
if (unit === 'MB') {
return `${((application.used_amount || 0) / 1024 / 1024).toFixed(2)}${unit}`;
}
}
}
}
});
</script>
<style lang="scss" scoped>
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: #333;
}
.el-table {
min-height: calc(100vh - 350px);
margin-bottom: 50px;
}
.panel {
padding: 30px;
.credential {
.copy {
cursor: pointer;
}
}
}
.pagination {
float: right;
}
</style>
-307
View File
@@ -1,307 +0,0 @@
<template>
<el-row class="wrapper">
<el-col :span="24">
<el-row>
<el-col :span="24">
<h2 class="title">{{ $t('order.title.info') }}</h2>
</el-col>
</el-row>
<el-row class="panel">
<el-col :span="24">
<el-card shadow="hover">
<el-row>
<el-col :span="12" :offset="6">
<div v-if="loading" class="pt-5">
<el-skeleton animated />
</div>
<div v-else class="order">
<el-descriptions :column="1">
<el-descriptions-item :label="$t('order.field.id')">{{ order?.id }}</el-descriptions-item>
<el-descriptions-item :label="$t('order.field.description')">
{{ order?.description }}
</el-descriptions-item>
<el-descriptions-item
v-if="order?.application?.type === applicationType.API"
:label="$t('order.field.api')"
>
{{ order?.application?.api?.title }}
</el-descriptions-item>
<el-descriptions-item
v-if="order?.application?.type === applicationType.PROXY"
:label="$t('order.field.proxy')"
>
{{ order?.application?.proxy?.title }}
</el-descriptions-item>
<el-descriptions-item :label="$t('order.field.amount')">
<span v-if="order?.application?.type === applicationType.API">
{{ order?.amount }}{{ $t(`api.unit.${order?.application?.api?.unit}`) }}
</span>
<span v-if="order?.application?.type === applicationType.PROXY">
{{ order?.amount }}{{ $t(`proxy.unit.${order?.application?.proxy?.unit}`) }}
</span>
</el-descriptions-item>
<el-descriptions-item :label="$t('order.field.createdAt')">
{{ $dayjs.format(order?.created_at) }}
</el-descriptions-item>
<el-descriptions-item :label="$t('order.field.price')">
<span v-if="order?.price && order?.price > 0" class="price unfree">
¥{{ order?.price?.toFixed(2) }}
</span>
<span v-else class="price free"> {{ $t('order.message.free') }} </span>
</el-descriptions-item>
<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.AliPay">
{{ $t('order.title.aliPay') }}
</span>
</el-descriptions-item>
</el-descriptions>
</div>
</el-col>
</el-row>
<el-row v-if="order?.state === OrderState.PAID" class="mb-5">
<el-col :span="12" :offset="6">
<el-divider border-style="dashed" />
<el-alert :title="$t('order.message.paidSuccessfully')" type="success" show-icon :closable="false" />
</el-col>
</el-row>
<el-row v-if="order?.state === OrderState.PENDING || order?.state === OrderState.FAILED">
<el-col :span="12" :offset="6">
<el-divider border-style="dashed" />
<div v-if="order.price && order.price > 0 && !order.pay_way" class="payways mb-4">
<div
:class="{
payway: true,
wechatpay: true,
active: payWay === PayWay.WechatPay
}"
@click="payWay = PayWay.WechatPay"
>
<span class="payicon wechatpay"></span>
{{ $t('order.title.wechatPay') }}
</div>
<div
v-if="false"
:class="{
payway: true,
alipay: true,
active: payWay === PayWay.AliPay
}"
@click="payWay = PayWay.AliPay"
>
<span class="payicon alipay"></span>
{{ $t('order.title.aliPay') }}
</div>
</div>
<div v-if="!order?.pay_way">
<el-button :loading="prepaying" type="primary" size="large" class="btn-pay" @click="onPay">{{
$t('common.button.pay')
}}</el-button>
</div>
<div v-else>
<el-button type="primary" size="large" class="btn-repay" @click="onRepay">{{
$t('common.button.repay')
}}</el-button>
</div>
</el-col>
</el-row>
</el-card>
</el-col>
</el-row>
</el-col>
</el-row>
<pay-order v-if="order" v-model="order" :visible="paying" @hide="paying = false" />
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { IOrder, IOrderDetailResponse, orderOperator, OrderState } from '@/operators/order';
import {
ElRow,
ElCol,
ElCard,
ElSkeleton,
ElDivider,
ElAlert,
ElDescriptions,
ElDescriptionsItem,
ElButton
} from 'element-plus';
import PayOrder from '@/components/order/Pay.vue';
import { IApplicationType } from '@/operators';
enum PayWay {
WechatPay = 'WechatPay',
AliPay = 'AliPay'
}
interface IData {
PayWay: typeof PayWay;
OrderState: typeof OrderState;
payWay: PayWay | undefined;
order: IOrder | undefined;
loading: boolean;
paying: boolean;
prepaying: boolean;
applicationType: typeof IApplicationType;
}
export default defineComponent({
name: 'ConsoleOrderDetail',
components: {
ElButton,
ElRow,
ElCol,
ElCard,
ElSkeleton,
ElDivider,
ElAlert,
ElDescriptions,
ElDescriptionsItem,
PayOrder
},
data(): IData {
return {
PayWay: PayWay,
payWay: PayWay.WechatPay,
OrderState: OrderState,
order: undefined,
loading: false,
paying: false,
prepaying: false,
applicationType: IApplicationType
};
},
computed: {
id() {
return this.$route.params?.id?.toString();
},
redirect() {
return this.$route.query?.redirect;
}
},
watch: {
order: {
handler(val) {
if (val?.state === OrderState.PAID) {
setTimeout(() => {
if (this.redirect) {
window.location.replace(this.redirect?.toString());
}
}, 2000);
return;
}
},
deep: true
}
},
mounted() {
this.onFetchData();
},
methods: {
onFetchData() {
this.loading = true;
orderOperator
.refresh(this.id)
.then(({ data: data }: { data: IOrderDetailResponse }) => {
this.order = data;
this.loading = false;
})
.catch(() => {
this.loading = false;
});
},
onRepay() {
this.paying = true;
},
onPay() {
this.prepaying = true;
orderOperator
.pay(this.id, {
pay_way: this.payWay
})
.then(({ data: data }: { data: IOrderDetailResponse }) => {
this.prepaying = false;
this.order = data;
if (this.order.price && this.order.price > 0) {
this.paying = true;
}
})
.catch(() => {
this.prepaying = false;
});
}
}
});
</script>
<style lang="scss" scoped>
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: #333;
}
.wrapper {
padding: 30px;
.panel {
.el-card {
min-height: 500px;
}
.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: 1px solid #eee;
&.active {
border: 1px solid #3879d1;
}
}
.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;
}
}
}
.btn-pay {
width: 150px;
}
}
}
</style>
-211
View File
@@ -1,211 +0,0 @@
<template>
<el-row class="wrapper">
<el-col :span="24">
<el-row>
<el-col :span="24">
<h2 class="title">{{ $t('common.title.allOrders') }}</h2>
</el-col>
</el-row>
<el-row class="panel">
<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">
<template #default="scope">
<span class="key">{{ scope.row.id }}</span>
<span class="copy">
<copy-to-clipboard :content="scope.row.id" />
</span>
</template>
</el-table-column>
<el-table-column :label="$t('order.field.price')" width="100px">
<template #default="scope">
<span class="price">¥{{ scope.row?.price?.toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('order.field.createdAt')" width="250px">
<template #default="scope">
<span class="created-at">{{ $dayjs.format(scope.row.created_at) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('order.field.description')">
<template #default="scope">
<span class="description">{{ scope.row.description }}</span>
</template>
</el-table-column>
<el-table-column prop="state" :label="$t('order.field.state')" class-name="text-center" width="100px">
<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>
</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>
</span>
<span v-else-if="scope.row.state === OrderState?.EXPIRED" class="state state-expired">
<el-tag type="warning" class="mx-1" effect="dark">{{ $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>
</span>
</template>
</el-table-column>
<el-table-column min-width="300px">
<template #default="scope">
<div class="float-right">
<el-button
v-if="scope.row.state !== OrderState.PAID"
type="primary"
@click="
$router.push({
name: 'console-order-detail',
params: {
id: scope.row.id
}
})
"
>
{{ $t('order.button.continuePay') }}
</el-button>
<el-button
v-else
@click="
$router.push({
name: 'console-order-detail',
params: {
id: scope.row.id
}
})
"
>
{{ $t('order.button.checkDetail') }}
</el-button>
</div>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<el-row>
<el-col :span="10" :offset="14">
<div class="pagination m-v-lg">
<pagination :current-page="page" :page-size="limit" :total="total" @change="onPageChange"> </pagination>
</div>
</el-col>
</el-row>
</el-col>
</el-row>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { IOrder, IOrderListResponse, orderOperator, OrderState } from '@/operators/order';
import Pagination from '@/components/common/Pagination.vue';
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
import { ElRow, ElCol, ElTable, ElTableColumn, ElButton, ElTag, ElCard } from 'element-plus';
interface IData {
orders: IOrder[];
loading: boolean;
total: number | undefined;
limit: number;
OrderState: typeof OrderState;
}
export default defineComponent({
name: 'ConsoleOrderList',
components: {
Pagination,
CopyToClipboard,
ElRow,
ElCol,
ElTable,
ElTableColumn,
ElButton,
ElTag,
ElCard
},
data(): IData {
return {
OrderState: OrderState,
orders: [],
loading: false,
total: undefined,
limit: 10
};
},
computed: {
redirect() {
return this.$route.query.redirect;
},
page() {
return parseInt(this.$route.query.page?.toString() || '1');
}
},
watch: {
page: {
handler() {
this.onFetchData();
}
}
},
mounted() {
this.onFetchData();
},
methods: {
onPageChange(page: number) {
this.$router.push({
name: this.$route.name?.toString(),
query: {
page: page
}
});
},
onFetchData() {
this.loading = true;
orderOperator
.getAll({
ordering: '-created_at',
limit: this.limit,
offset: (this.page - 1) * this.limit,
user_id: this.$store.getters.user.id
})
.then(({ data: data }: { data: IOrderListResponse }) => {
this.orders = data.items;
this.loading = false;
this.total = data.count;
})
.catch(() => {
this.loading = false;
});
}
}
});
</script>
<style lang="scss" scoped>
.title {
font-size: 26px;
font-weight: bold;
margin-bottom: 20px;
color: #333;
}
.el-table {
min-height: calc(100vh - 300px);
margin-bottom: 50px;
}
.wrapper {
padding: 30px;
.api-key {
.copy {
cursor: pointer;
margin: 0 10px;
}
}
}
.pagination {
float: right;
}
</style>