feat: add order detail done function

This commit is contained in:
2025-10-12 16:27:02 +08:00
parent a6fade86e5
commit 920798ddd3
5 changed files with 221 additions and 77 deletions

View File

@@ -41,7 +41,7 @@
</avue-crud>
<el-drawer :title="`[${orderName}:${serialNumber}] Detail`" v-model="subVisible" :direction="direction"
append-to-body
:before-close="handleSubClose" size="80%">
:before-close="handleSubClose" size="90%">
<basic-container>
<avue-crud :option="optionSub"
:data="dataSub"
@@ -60,6 +60,10 @@
@size-change="sizeChangeSub"
@on-load="onLoadSub">
<template #menu="{ row }">
<el-button type="text"
icon="el-icon-folder"
@click.stop="handleAssets(row)">Assets
</el-button>
<el-button type="text"
icon="el-icon-download"
v-if="row.status === 1"
@@ -74,6 +78,23 @@
</avue-crud>
</basic-container>
</el-drawer>
<el-drawer :title="`[${category}] [${material}] [${size}] [${shape}]`" v-model="photosVisible" :direction="directionPhotos"
append-to-body
:before-close="handlePhotosClose" size="90%">
<basic-container>
<avue-crud :option="optionPhotos" :data="dataPhotos" >
<template #texts="{ row }">
<div v-if="row.texts?.length">
<div v-for="(item, index) in row.texts" :key="index" style="display: flex; gap: 4px; flex-wrap: wrap;">
<el-tag size="small">{{ item.font }}</el-tag>
<el-tag size="small" type="warning">{{ item.content }}</el-tag>
</div>
</div>
<span v-else></span>
</template>
</avue-crud>
</basic-container>
</el-drawer>
</basic-container>
</template>
@@ -88,9 +109,11 @@ import {
} from '@/api/kiosk/orderDetail';
import option from '@/option/kiosk/order';
import optionSub from '@/option/kiosk/orderDetail';
import optionPhotos from '@/option/kiosk/photos';
import { mapGetters } from 'vuex';
import 'nprogress/nprogress.css';
import { $Export } from '@smallwei/avue';
import photos from '@/option/kiosk/photos';
export default {
@@ -109,10 +132,16 @@ export default {
},
option: option,
subVisible: false,
photosVisible: false,
direction: 'ttb',
directionPhotos: 'rtl',
orderId: 0,
serialNumber: '',
orderName: 'Order',
category: '',
material: '',
size: '',
shape:'',
formSub: {},
querySub: {},
loadingSub: true,
@@ -123,10 +152,15 @@ export default {
currentPage: 1,
total: 0
},
optionSub: optionSub
optionSub: optionSub,
optionPhotos: optionPhotos,
dataPhotos: []
};
},
computed: {
photos() {
return photos;
},
...mapGetters(['permission']),
permissionList() {
return {
@@ -272,6 +306,9 @@ export default {
handleSubClose(hide) {
hide();
},
handlePhotosClose(hide){
hide();
},
handleAccept(row) {
this.$confirm('Confirmation for Payment?', {
confirmButtonText: 'Confirm',
@@ -306,23 +343,57 @@ export default {
});
});
},
handleAssets(row) {
this.photosVisible = true;
this.dataPhotos = row.photos;
this.category = row.categoryName;
this.size = row.size;
this.material = row.material;
this.shape = row.shape;
},
handleDownload(row) {
const urlData = (row.photos || []).map(url => ({ url }));
const u = (row.stickers || []).map(url => ({ url }));
const t = (row.texts || []).map(t => ({
url: `[font:${t.font || 'normal'}] [size:${t.size || 12}] [content:${t.content || ''}]`
}));
// const urlData = (row.photos || []).map(url => ({ url }));
// const u = (row.stickers || []).map(url => ({ url }));
// const t = (row.texts || []).map(t => ({
// url: `[font:${t.font || 'normal'}] [size:${t.size || 12}] [content:${t.content || ''}]`
// }));
//
// const r = [
// ...urlData,
// { url: '======Stickers=====' },
// ...u,
// { url: '======Texts=======' },
// ...t
// ];
// $Export.excel({
// columns: [{ label: '======Photos======', prop: 'url' }],
// data: r
// });
const data = (row.photos || []).map(photoObj => {
// 提取 texts 内容(拼接为字符串)
const textsStr = (photoObj.texts || [])
.map(t => `[font:${t.font || 'normal'}] [content:${t.content || ''}]`)
.join('; ');
// 提取 stickers(拼接为字符串)
const stickersStr = (photoObj.stickers || []).join('; ');
return {
photo: photoObj.photo || '',
snapshot: photoObj.snapshot || '',
texts: textsStr,
stickers: stickersStr
};
});
const r = [
...urlData,
{ url: '======Stickers=====' },
...u,
{ url: '======Texts=======' },
...t
];
$Export.excel({
columns: [{ label: '======Photos======', prop: 'url' }],
data: r
columns: [
{ label: 'Photo', prop: 'photo' },
{ label: 'Snapshot', prop: 'snapshot' },
{ label: 'Texts', prop: 'texts' },
{ label: 'Stickers', prop: 'stickers' }
],
data: data
});
},
rowSaveSub(row, loading, done) {

View File

@@ -28,7 +28,7 @@
v-if="permission.menu_delete"
plain
@click="handleDelete"
>删 除
>Delete
</el-button>
</template>
<template #menu="scope">
@@ -38,7 +38,7 @@
icon="el-icon-circle-plus"
@click.stop="handleAdd(scope.row, scope.index)"
v-if="userInfo.authority.includes('admin') && scope.row.category === 1"
>新增子项
>Add Sub
</el-button>
</template>
<template #name="{ row }">