update ui for order list
This commit is contained in:
1 parent
2ca68e2559
commit
b82ba7e9d3
17 files changed
+81
-68
No files matched your search
@@ -9,7 +9,7 @@
|
||||
</el-form-item>
|
||||
<el-divider />
|
||||
<el-form-item :label="$t('application.field.shouldPayPrice')">
|
||||
<span class="price">¥{{ (getPrice() / 100).toFixed(2) }}</span>
|
||||
<span class="price">¥{{ getPrice().toFixed(2) }}</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -60,7 +60,7 @@ export default defineComponent({
|
||||
orderOperator
|
||||
.create({
|
||||
application_id: this.application?.id,
|
||||
amount: 10
|
||||
amount: this.form.amount
|
||||
})
|
||||
.then(({ data: data }: { data: IOrderDetailResponse }) => {
|
||||
this.creating = false;
|
||||
@@ -72,9 +72,8 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
ElMessage.success(this.$t('order.message.createFailed'));
|
||||
|
||||
.catch(() => {
|
||||
ElMessage.error(this.$t('order.message.createFailed'));
|
||||
this.creating = false;
|
||||
});
|
||||
},
|
||||
@@ -87,7 +86,7 @@ export default defineComponent({
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
.price {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
|
||||
@@ -5,5 +5,5 @@ export default {
|
||||
service: '服务',
|
||||
operation: '操作',
|
||||
amount: '数量',
|
||||
shouldPayPrice: '应付金额',
|
||||
shouldPayPrice: '应付金额'
|
||||
};
|
||||
@@ -4,5 +4,6 @@ export default {
|
||||
placeholderOfSelect: '请选择',
|
||||
placeholderOfInput: '请填写',
|
||||
allApplications: '所有申请',
|
||||
allOrders: '所有申请'
|
||||
allOrders: '所有订单',
|
||||
orderInfo: '订单信息'
|
||||
};
|
||||
@@ -1,4 +0,0 @@
|
||||
export default {
|
||||
startStudy: '开始学习',
|
||||
buy: '购买课程'
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
import button from './button';
|
||||
import message from './message';
|
||||
import title from './title';
|
||||
|
||||
export default {
|
||||
button,
|
||||
message,
|
||||
title
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
export default {
|
||||
paidSuccessfully: '支付成功',
|
||||
paid: '已经购买成功',
|
||||
needPay: '您需要购买完整课程才能观看',
|
||||
wechatPayHelp: '请打开手机微信,扫一扫完成支付',
|
||||
createOrderFailed: '创建订单失败',
|
||||
creatingOrder: '正在生成订单',
|
||||
transcoding: '为保护版权,正在转码生成专属视频...'
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
export default {
|
||||
orderInfo: '订单信息',
|
||||
orderId: '订单号',
|
||||
orderDescription: '订单描述',
|
||||
orderPrice: '应付金额',
|
||||
orderGood: '商品信息',
|
||||
payWay: '支付方式',
|
||||
payWayWechat: '微信支付'
|
||||
};
|
||||
@@ -1,8 +1,7 @@
|
||||
import common from './common/index';
|
||||
import auth from './auth/index';
|
||||
import course from './course/index';
|
||||
import service from './service/index';
|
||||
import console from './console/index';
|
||||
import common from './common';
|
||||
import auth from './auth';
|
||||
import service from './service';
|
||||
import console from './console';
|
||||
import application from './application';
|
||||
import api from './api';
|
||||
import order from './order';
|
||||
@@ -10,7 +9,6 @@ import order from './order';
|
||||
export default {
|
||||
common,
|
||||
auth,
|
||||
course,
|
||||
service,
|
||||
console,
|
||||
application,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export default {
|
||||
pay: '支付',
|
||||
continuePay: '继续支付'
|
||||
continuePay: '继续支付',
|
||||
checkDetail: '查看详情'
|
||||
};
|
||||
@@ -1,8 +1,9 @@
|
||||
export default {
|
||||
id: '订单号',
|
||||
amount: '金额',
|
||||
amount: '数量',
|
||||
price: '金额',
|
||||
description: '订单描述',
|
||||
state: '状态',
|
||||
createdAt: '创建时间'
|
||||
createdAt: '创建时间',
|
||||
service: '服务名称'
|
||||
};
|
||||
@@ -2,10 +2,12 @@ import field from './field';
|
||||
import button from './button';
|
||||
import message from './message';
|
||||
import state from './state';
|
||||
import title from './title';
|
||||
|
||||
export default {
|
||||
field,
|
||||
button,
|
||||
message,
|
||||
state
|
||||
state,
|
||||
title
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export default {
|
||||
info: '订单信息'
|
||||
};
|
||||
@@ -30,6 +30,10 @@ class OrderService {
|
||||
return await httpClient.put(`/${this.key}/${id}`, data);
|
||||
}
|
||||
|
||||
async refresh(id: string): Promise<AxiosResponse<IOrderDetailResponse>> {
|
||||
return await httpClient.post(`/${this.key}/${id}/refresh/`);
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<AxiosResponse<null>> {
|
||||
return await httpClient.delete(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ export default defineComponent({
|
||||
},
|
||||
computed: {
|
||||
redirect() {
|
||||
return this.$route.query.redirect;
|
||||
return this.$route.query?.redirect;
|
||||
},
|
||||
page() {
|
||||
return parseInt(this.$route.query.page?.toString() || '1');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-col :span="24">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<h2 class="title">{{ $t('common.title.allOrders') }}</h2>
|
||||
<h2 class="title">{{ $t('common.title.orderInfo') }}</h2>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="panel">
|
||||
@@ -11,20 +11,38 @@
|
||||
<el-card shadow="hover">
|
||||
<el-row>
|
||||
<el-col :span="12" :offset="6">
|
||||
<div class="order">
|
||||
<el-descriptions :title="$t('course.title.orderInfo')" :column="1">
|
||||
<el-descriptions-item :label="$t('course.title.orderId')">{{ order?.id }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('course.title.orderDescription')">
|
||||
<div v-if="loading">
|
||||
<el-skeleton />
|
||||
</div>
|
||||
<div v-else class="order">
|
||||
<el-descriptions :title="$t('order.title.info')" :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?.price" :label="$t('course.title.orderPrice')">
|
||||
<span class="price">¥{{ (order?.price / 100).toFixed(2) }}</span>
|
||||
<el-descriptions-item :label="$t('order.field.service')">
|
||||
{{ order?.application?.service?.title }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('order.field.amount')">
|
||||
{{ order?.amount }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('order.field.createdAt')">
|
||||
{{ order?.created_at }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="order?.price" :label="$t('order.field.price')">
|
||||
<span class="price">¥{{ order?.price?.toFixed(2) }}</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<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 class="payways">
|
||||
@@ -41,7 +59,7 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-row v-if="order?.state === OrderState.PENDING || order?.state === OrderState.FAILED">
|
||||
<el-col :span="12" :offset="6">
|
||||
<el-row class="paycodes">
|
||||
<el-col :span="12">
|
||||
@@ -69,7 +87,6 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { IOrder, IOrderDetailResponse, orderOperator, OrderState } from '@/operators/order';
|
||||
import QrCode from 'qrcode.vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
enum PayWay {
|
||||
WechatPay = 'WechatPay',
|
||||
@@ -78,6 +95,7 @@ enum PayWay {
|
||||
|
||||
interface IData {
|
||||
PayWay: typeof PayWay;
|
||||
OrderState: typeof OrderState;
|
||||
payWay: PayWay | undefined;
|
||||
order: IOrder | undefined;
|
||||
loading: boolean;
|
||||
@@ -92,16 +110,17 @@ export default defineComponent({
|
||||
return {
|
||||
PayWay: PayWay,
|
||||
payWay: PayWay.WechatPay,
|
||||
OrderState: OrderState,
|
||||
order: undefined,
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
id() {
|
||||
return this.$route.params.id.toString();
|
||||
return this.$route.params?.id?.toString();
|
||||
},
|
||||
redirect() {
|
||||
return this.$route.query.redirect;
|
||||
return this.$route.query?.redirect;
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
@@ -124,11 +143,10 @@ export default defineComponent({
|
||||
},
|
||||
onCheck() {
|
||||
orderOperator
|
||||
.get(this.id)
|
||||
.refresh(this.id)
|
||||
.then(({ data: data }: { data: IOrderDetailResponse }) => {
|
||||
this.order = data;
|
||||
if (this.order.state === OrderState.PAID) {
|
||||
ElMessage.success(this.$t('order.message.paidSuccessfully'));
|
||||
setTimeout(() => {
|
||||
if (this.redirect) {
|
||||
window.location.replace(this.redirect?.toString());
|
||||
@@ -162,6 +180,9 @@ export default defineComponent({
|
||||
padding: 30px;
|
||||
|
||||
.panel {
|
||||
.el-card {
|
||||
min-height: 500px;
|
||||
}
|
||||
.order {
|
||||
.price {
|
||||
font-size: 20px;
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('order.field.price')">
|
||||
<el-table-column :label="$t('order.field.price')" width="100px">
|
||||
<template #default="scope">
|
||||
<span class="price">¥{{ (scope.row?.price / 100).toFixed(2) }}</span>
|
||||
<span class="price">¥{{ scope.row?.price?.toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('order.field.createdAt')">
|
||||
<el-table-column :label="$t('order.field.createdAt')" width="250px">
|
||||
<template #default="scope">
|
||||
<span class="created-at">{{ scope.row.created_at }}</span>
|
||||
</template>
|
||||
@@ -33,7 +33,7 @@
|
||||
<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">
|
||||
<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>
|
||||
@@ -66,6 +66,19 @@
|
||||
>
|
||||
{{ $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>
|
||||
|
||||
@@ -59,6 +59,7 @@ import { ElMessage } from 'element-plus';
|
||||
import { apiOperator } from '@/operators/api/operator';
|
||||
import { IApi, IApiListResponse } from '@/operators/api/models';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
|
||||
interface IData {
|
||||
service: IService | undefined;
|
||||
apis: IApi[];
|
||||
|
||||
Reference in new issue
Block a user