add order and pay support
This commit is contained in:
1 parent
cfea244d28
commit
2ca68e2559
20 files changed
+490
-118
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<font-awesome-icon v-if="!copied" icon="fa-regular fa-copy" @click="onCopy" />
|
||||
<font-awesome-icon v-if="!copied" icon="fa-regular fa-copy" class="icon-copy" @click="onCopy" />
|
||||
<el-tooltip v-else :visible="copied" effect="dark" :content="$t('common.message.copied')" placement="top-start">
|
||||
<font-awesome-icon icon="fa-solid fa-check" />
|
||||
<font-awesome-icon icon="fa-solid fa-check" class="icon-check" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
@@ -39,3 +39,10 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.icon-check,
|
||||
.icon-copy {
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -7,11 +7,13 @@
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<div class="links">
|
||||
<a
|
||||
v-for="link in links"
|
||||
:key="link.key"
|
||||
:class="{ link: true, active: $route.path == link.href }"
|
||||
@click="onClick(link.href)"
|
||||
<router-link
|
||||
v-for="(link, linkIndex) in links"
|
||||
:key="linkIndex"
|
||||
:to="{
|
||||
name: link.name
|
||||
}"
|
||||
:class="{ link: true, active: $route.name === link.name }"
|
||||
>
|
||||
<span class="icon">
|
||||
<el-icon class="icon">
|
||||
@@ -22,7 +24,7 @@
|
||||
</span>
|
||||
<span class="text">{{ link.text }}</span>
|
||||
<span class="suffix"></span>
|
||||
</a>
|
||||
</router-link>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -30,12 +32,12 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { Clock, MagicStick, Collection, VideoPlay, Goods, Loading, User, Postcard } from '@element-plus/icons-vue';
|
||||
import { Clock, User, Postcard } from '@element-plus/icons-vue';
|
||||
|
||||
interface ILink {
|
||||
key: string;
|
||||
text: string;
|
||||
href: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
}
|
||||
|
||||
@@ -47,11 +49,6 @@ export default defineComponent({
|
||||
name: 'Navigator',
|
||||
components: {
|
||||
Clock,
|
||||
Collection,
|
||||
MagicStick,
|
||||
VideoPlay,
|
||||
Goods,
|
||||
Loading,
|
||||
Postcard,
|
||||
User
|
||||
},
|
||||
@@ -61,13 +58,13 @@ export default defineComponent({
|
||||
{
|
||||
key: 'profile',
|
||||
text: this.$t('console.menu.orderList'),
|
||||
href: '/console/orders',
|
||||
name: 'console-order-list',
|
||||
icon: 'user'
|
||||
},
|
||||
{
|
||||
key: 'verify',
|
||||
text: this.$t('console.menu.applicationList'),
|
||||
href: '/console/applications',
|
||||
name: 'console-application-list',
|
||||
icon: 'postcard'
|
||||
}
|
||||
]
|
||||
@@ -80,9 +77,6 @@ export default defineComponent({
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
onClick(link: string) {
|
||||
window.location.href = link;
|
||||
},
|
||||
onHome() {
|
||||
this.$router.push({
|
||||
name: 'home'
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<el-dialog :model-value="visible" :title="$t('application.title.buyService')" width="60%" center>
|
||||
<el-form label-width="120px">
|
||||
<el-form-item v-if="application?.service?.title" :label="$t('application.field.service')">
|
||||
{{ application?.service?.title }}
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('application.field.amount')">
|
||||
<el-input-number v-model="form.amount" :min="1" :max="10" controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-divider />
|
||||
<el-form-item :label="$t('application.field.shouldPayPrice')">
|
||||
<span class="price">¥{{ (getPrice() / 100).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>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IApplication, IOrderDetailResponse, orderOperator } from '@/operators';
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CreateOrderDialog',
|
||||
props: {
|
||||
application: {
|
||||
type: Object as () => IApplication,
|
||||
required: true
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
emits: ['hide'],
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
amount: 1
|
||||
},
|
||||
creating: false
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
onCreateOrder() {
|
||||
if (!this.application?.id) {
|
||||
return;
|
||||
}
|
||||
this.creating = true;
|
||||
orderOperator
|
||||
.create({
|
||||
application_id: this.application?.id,
|
||||
amount: 10
|
||||
})
|
||||
.then(({ data: data }: { data: IOrderDetailResponse }) => {
|
||||
this.creating = false;
|
||||
const order = data;
|
||||
this.$router.push({
|
||||
name: 'console-order-detail',
|
||||
params: {
|
||||
id: order.id
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
ElMessage.success(this.$t('order.message.createFailed'));
|
||||
|
||||
this.creating = false;
|
||||
});
|
||||
},
|
||||
getPrice() {
|
||||
if (this.application.service?.price && this.form.amount)
|
||||
return this.form.amount * this.application.service?.price;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.price {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user