feat: add order detail

This commit is contained in:
2025-10-10 05:49:55 +08:00
parent 67c9e0c24e
commit 3bd8d12d09
4 changed files with 185 additions and 98 deletions

View File

@@ -59,6 +59,17 @@
@current-change="currentChangeSub"
@size-change="sizeChangeSub"
@on-load="onLoadSub">
<template #menu="{ row }">
<el-button type="text"
icon="el-icon-download"
@click.stop="handleDownload(row)">Download
</el-button>
<el-button type="text"
icon="el-icon-finished"
v-if="row.status === 1"
@click.stop="handleDone(row)">Done
</el-button>
</template>
</avue-crud>
</basic-container>
</el-drawer>
@@ -72,12 +83,17 @@ import {
getDetail as getDetailSub,
add as addSub,
update as updateSub,
remove as removeSub
remove as removeSub, doneDetail
} from '@/api/kiosk/orderDetail';
import option from '@/option/kiosk/order';
import optionSub from '@/option/kiosk/orderDetail';
import { mapGetters } from 'vuex';
import 'nprogress/nprogress.css';
import func from '@/utils/func';
import NProgress from 'nprogress';
import { exportBlob } from '@/api/common';
import { getToken } from '@/utils/auth';
import { downloadFile, downloadXls } from '@/utils/util';
export default {
data() {
@@ -98,7 +114,7 @@ export default {
direction: 'ttb',
orderId: 0,
serialNumber: '',
orderName: 'KioskOrder:',
orderName: 'Order',
formSub: {},
querySub: {},
loadingSub: true,
@@ -260,10 +276,10 @@ export default {
},
handleAccept(row) {
this.$confirm('Confirmation for Payment?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
})
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
})
.then(() => {
return accept(row);
})
@@ -275,6 +291,42 @@ export default {
});
});
},
handleDone(row) {
this.$confirm('Mark as Done?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
})
.then(() => {
return doneDetail(row);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: 'Success!'
});
});
},
handleDownload(row) {
const account = func.toStr(this.search.account);
const realName = func.toStr(this.search.realName);
this.$confirm('Confirm download of order detail assets?', 'Message', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
// NProgress.start();
// exportBlob(
// `/kiosk/orderDetail/export-assets?${
// this.website.tokenHeader
// }=${getToken()}&account=${account}&realName=${realName}`
// ).then(res => {
// downloadFile(res.data, `${row.id}-assets-${this.$dayjs().format('YYYY-MM-DD')}.zip`);
// NProgress.done();
// });
});
},
rowSaveSub(row, loading, done) {
row = {
...row,
@@ -358,16 +410,11 @@ export default {
this.loadingSub = true;
let values = {
orderId: this.orderId
...params,
orderId: this.orderId,
};
const {} = this.querySub;
values = {
...values
};
getListSub(page.currentPage, page.pageSize, values).then(res => {
// const {} = this.querySub;
getListSub(page.currentPage, page.pageSize, Object.assign(values, this.querySub)).then(res => {
const data = res.data.data;
this.pageSub.total = data.total;
this.dataSub = data.records;