feat:
add price list
This commit is contained in:
@@ -2,7 +2,7 @@ import request from '@/axios';
|
||||
|
||||
export const getList = (current, size, params) => {
|
||||
return request({
|
||||
url: '/kiosk/price-list/page',
|
||||
url: '/kiosk/price-list/summary-page',
|
||||
method: 'get',
|
||||
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) => {
|
||||
return request({
|
||||
url: '/kiosk/price-list/detail',
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
export default {
|
||||
height: 'auto',
|
||||
calcHeight: 150,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
@@ -70,6 +69,7 @@ export default {
|
||||
},
|
||||
dataType: 'number',
|
||||
overHidden: true,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
label: 'Material',
|
||||
@@ -82,6 +82,7 @@ export default {
|
||||
},
|
||||
dataType: 'number',
|
||||
overHidden: true,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
label: 'Size',
|
||||
|
||||
61
src/option/kiosk/priceListSummary.js
Normal file
61
src/option/kiosk/priceListSummary.js
Normal 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',
|
||||
},
|
||||
]
|
||||
};
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user