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

@@ -2,7 +2,7 @@ import request from '@/axios';
export const getList = (current, size, params) => { export const getList = (current, size, params) => {
return request({ return request({
url: '/kiosk/price-list/page', url: '/kiosk/price-list/summary-page',
method: 'get', method: 'get',
params: { params: {
...params, ...params,
@@ -12,6 +12,20 @@ export const getList = (current, size, params) => {
}) })
} }
export const getSubList = (current, size, params) => {
return request({
url: '/kiosk/price-list/detail-list',
method: 'get',
params: {
...params,
current,
size,
}
})
}
export const getDetail = (id) => { export const getDetail = (id) => {
return request({ return request({
url: '/kiosk/price-list/detail', url: '/kiosk/price-list/detail',

View File

@@ -1,6 +1,5 @@
export default { export default {
height: 'auto', height: 'auto',
calcHeight: 150,
tip: false, tip: false,
searchShow: true, searchShow: true,
searchMenuSpan: 6, searchMenuSpan: 6,
@@ -70,6 +69,7 @@ export default {
}, },
dataType: 'number', dataType: 'number',
overHidden: true, overHidden: true,
search: true,
}, },
{ {
label: 'Material', label: 'Material',
@@ -82,6 +82,7 @@ export default {
}, },
dataType: 'number', dataType: 'number',
overHidden: true, overHidden: true,
search: true,
}, },
{ {
label: 'Size', label: 'Size',

View File

@@ -0,0 +1,61 @@
export default {
height: 'auto',
calcHeight: 150,
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
index: true,
viewBtn: false,
addBtn: false,
editBtn: false,
delBtn: false,
selection: false,
dialogClickModal: false,
// menuWidth: 150,
column: [
{
label: 'cid',
prop: 'categoryId',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true
},
{
label: 'Category',
prop: 'categoryName',
type: 'input',
overHidden: true,
},
{
label: 'Type',
prop: 'categoryType',
type: 'radio',
dicUrl: '/blade-system/dict-biz/dictionary?code=category_type',
props: {
label: 'dictValue',
value: 'dictKey'
},
overHidden: true,
},
{
label: 'Image',
prop: 'imageUrl',
type: 'upload',
listType: 'picture-img',
dataType: 'string',
action: '/blade-resource/oss/endpoint/put-file',
propsHttp: {
res: 'data',
url: 'link'
}
},
{
label: 'PhotoLimit',
prop: 'photoLimit',
type: 'number',
},
]
};

View File

@@ -12,7 +12,7 @@
<el-col :span="19"> <el-col :span="19">
<basic-container> <basic-container>
<div style="margin-bottom: 20px;"> <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> </div>
<avue-crud <avue-crud
:option="option" :option="option"
@@ -24,9 +24,6 @@
:permission="permissionList" :permission="permissionList"
:before-open="beforeOpen" :before-open="beforeOpen"
ref="crud" ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange" @search-change="searchChange"
@search-reset="searchReset" @search-reset="searchReset"
@selection-change="selectionChange" @selection-change="selectionChange"
@@ -45,15 +42,45 @@
>Sync >Sync
</el-button> </el-button>
</template> </template>
<template #menu="{row}">
<el-button type="text"
icon="el-icon-setting"
@click.stop="handleDataSub(row)">Detail
</el-button>
</template>
</avue-crud> </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> </basic-container>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
<script> <script>
import { getList, getDetail, add, update, remove, init } from '@/api/kiosk/priceList'; import { add, getDetail, getList, getSubList, init, remove, update } from '@/api/kiosk/priceList';
import option from '@/option/kiosk/priceList'; import option from '@/option/kiosk/priceListSummary';
import optionSub from '@/option/kiosk/priceList';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
import { treeOption } from '@/option/system/user'; import { treeOption } from '@/option/system/user';
@@ -67,18 +94,33 @@ export default {
loading: true, loading: true,
initLoading: false, initLoading: false,
page: { page: {
pageSize: 50, pageSize: 30,
currentPage: 1, currentPage: 1,
total: 0 total: 0
}, },
selectionList: [], selectionList: [],
option: option, option: option,
subVisible: false,
direction: 'rtl',
data: [], data: [],
treeDeptId: '0', treeDeptId: 0,
treeParentId: '0', treeParentId: 0,
categoryId: 0,
categoryName: '',
treeData: [], treeData: [],
treeOption: treeOption, treeOption: treeOption,
deptName: '', deptName: '',
formSub: {},
querySub: {},
loadingSub: false,
dataSub: [],
selectionListSub: [],
pageSub: {
pageSize: 30,
currentPage: 1,
total: 0
},
optionSub: optionSub,
}; };
}, },
computed: { computed: {
@@ -124,7 +166,7 @@ export default {
}, },
rowUpdate(row, index, done, loading) { rowUpdate(row, index, done, loading) {
update(row).then(() => { update(row).then(() => {
this.onLoad(this.page); this.onLoadSub(this.pageSub);
this.$message({ this.$message({
type: 'success', type: 'success',
message: 'Success!' message: 'Success!'
@@ -196,7 +238,6 @@ export default {
...params, ...params,
deptId: this.treeDeptId deptId: this.treeDeptId
}; };
getList(page.currentPage, page.pageSize, values).then(res => { getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data; const data = res.data.data;
this.page.total = data.total; this.page.total = data.total;
@@ -204,7 +245,7 @@ export default {
this.loading = false; this.loading = false;
this.selectionClear(); 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?', { this.$confirm('Price is not set for this store. Initialize now?', {
confirmButtonText: 'Confirm', confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
@@ -230,7 +271,59 @@ export default {
this.loading = false; 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> </script>