add price list
This commit is contained in:
2025-10-13 23:08:29 +08:00
parent 803e218a09
commit ee4e211c36
4 changed files with 184 additions and 15 deletions

View File

@@ -12,7 +12,7 @@
<el-col :span="19">
<basic-container>
<div style="margin-bottom: 20px;">
<el-tag effect="dark">{{ deptName || 'Not selected' }}</el-tag>
<el-tag effect="dark">{{ deptName || 'Please select dept from left side' }}</el-tag>
</div>
<avue-crud
:option="option"
@@ -24,9 +24,6 @@
:permission="permissionList"
:before-open="beforeOpen"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@@ -45,15 +42,45 @@
>Sync
</el-button>
</template>
<template #menu="{row}">
<el-button type="text"
icon="el-icon-setting"
@click.stop="handleDataSub(row)">Detail
</el-button>
</template>
</avue-crud>
<el-drawer :title="`[${categoryName}] Detail`" v-model="subVisible" :direction="direction"
append-to-body
:before-close="handleSubClose" size="90%">
<basic-container>
<avue-crud :option="optionSub"
:data="dataSub"
v-model:page="pageSub"
v-model="formSub"
:table-loading="loadingSub"
ref="crudSub"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
:before-open="beforeOpenSub"
@search-change="searchChangeSub"
@search-reset="searchResetSub"
@selection-change="selectionChangeSub"
@current-change="currentChangeSub"
@size-change="sizeChangeSub"
@on-load="onLoadSub">
</avue-crud>
</basic-container>
</el-drawer>
</basic-container>
</el-col>
</el-row>
</template>
<script>
import { getList, getDetail, add, update, remove, init } from '@/api/kiosk/priceList';
import option from '@/option/kiosk/priceList';
import { add, getDetail, getList, getSubList, init, remove, update } from '@/api/kiosk/priceList';
import option from '@/option/kiosk/priceListSummary';
import optionSub from '@/option/kiosk/priceList';
import { mapGetters } from 'vuex';
import 'nprogress/nprogress.css';
import { treeOption } from '@/option/system/user';
@@ -67,18 +94,33 @@ export default {
loading: true,
initLoading: false,
page: {
pageSize: 50,
pageSize: 30,
currentPage: 1,
total: 0
},
selectionList: [],
option: option,
subVisible: false,
direction: 'rtl',
data: [],
treeDeptId: '0',
treeParentId: '0',
treeDeptId: 0,
treeParentId: 0,
categoryId: 0,
categoryName: '',
treeData: [],
treeOption: treeOption,
deptName: '',
formSub: {},
querySub: {},
loadingSub: false,
dataSub: [],
selectionListSub: [],
pageSub: {
pageSize: 30,
currentPage: 1,
total: 0
},
optionSub: optionSub,
};
},
computed: {
@@ -124,7 +166,7 @@ export default {
},
rowUpdate(row, index, done, loading) {
update(row).then(() => {
this.onLoad(this.page);
this.onLoadSub(this.pageSub);
this.$message({
type: 'success',
message: 'Success!'
@@ -196,7 +238,6 @@ export default {
...params,
deptId: this.treeDeptId
};
getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data;
this.page.total = data.total;
@@ -204,7 +245,7 @@ export default {
this.loading = false;
this.selectionClear();
if (this.treeParentId !== '0' && this.page.currentPage === 1 && this.data.length === 0) {
if (this.treeParentId !== 0 && this.page.currentPage === 1 && this.data.length === 0) {
this.$confirm('Price is not set for this store. Initialize now?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
@@ -230,7 +271,59 @@ export default {
this.loading = false;
}
});
}
},
handleSubClose(hide) {
hide();
},
beforeOpenSub(done, type) {
if (['edit', 'view'].includes(type)) {
getDetail(this.formSub.id).then(res => {
this.formSub = res.data.data;
});
}
done();
},
searchChangeSub(params, done) {
this.querySub = params;
this.onLoadSub(this.pageSub, params);
done();
},
onLoadSub(page, params = {}) {
this.loadingSub = true;
let values = {
...params,
categoryId: this.categoryId,
deptId: this.treeDeptId,
};
getSubList(page.currentPage, page.pageSize, Object.assign(values, this.querySub)).then(res => {
this.dataSub = res.data.data;
this.selectionListSub = [];
this.loadingSub = false;
});
},
searchResetSub() {
this.querySub = {};
this.onLoadSub(this.pageSub);
},
selectionChangeSub(list) {
this.selectionListSub = list;
},
currentChangeSub(currentPage) {
this.pageSub.currentPage = currentPage;
},
sizeChangeSub(pageSize) {
this.pageSub.pageSize = pageSize;
},
handleDataSub(row) {
this.subVisible = true;
this.categoryId = row.categoryId;
this.categoryName = row.categoryName;
this.onLoadSub(this.pageSub);
},
handleSync(){
},
}
};
</script>