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/list',
|
||||
url: '/kiosk/price-list/page',
|
||||
method: 'get',
|
||||
params: {
|
||||
...params,
|
||||
@@ -48,3 +48,13 @@ export const update = (row) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const init = (id) => {
|
||||
return request({
|
||||
url: '/kiosk/price-list/init-price',
|
||||
method: 'post',
|
||||
params: {
|
||||
id,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default {
|
||||
height: 'auto',
|
||||
calcHeight: 30,
|
||||
calcHeight: 150,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
@@ -10,15 +10,9 @@ export default {
|
||||
addBtn: false,
|
||||
editBtn: false,
|
||||
delBtn: false,
|
||||
menu: false,
|
||||
searchBtn: false,
|
||||
emptyBtn:false,
|
||||
selection: false,
|
||||
columnBtn: false,
|
||||
searchShowBtn: false,
|
||||
refreshBtn: false,
|
||||
gridBtn: false,
|
||||
dialogClickModal: false,
|
||||
menuWidth: 150,
|
||||
column: [
|
||||
{
|
||||
label: '主键',
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
<template>
|
||||
<el-row v-loading="initLoading">
|
||||
<el-col :span="5">
|
||||
<div class="box">
|
||||
<el-scrollbar>
|
||||
<basic-container>
|
||||
<avue-crud :option="option"
|
||||
<avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" />
|
||||
</basic-container>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="19">
|
||||
<basic-container>
|
||||
<avue-crud
|
||||
:option="option"
|
||||
v-model:search="search"
|
||||
v-model:page="page"
|
||||
v-model="form"
|
||||
@@ -18,25 +30,39 @@
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad">
|
||||
@on-load="onLoad"
|
||||
>
|
||||
<template #menu-left>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-refresh"
|
||||
v-if="permission.priceList_refresh_price"
|
||||
@click="handleRefresh"
|
||||
>Refresh
|
||||
</el-button>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, getDetail, add, update, remove } from '@/api/kiosk/priceList';
|
||||
import { getList, getDetail, add, update, remove, init } from '@/api/kiosk/priceList';
|
||||
import option from '@/option/kiosk/priceList';
|
||||
import { mapGetters } from 'vuex';
|
||||
import 'nprogress/nprogress.css';
|
||||
import { treeOption } from '@/option/system/user';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
depts: '',
|
||||
query: {},
|
||||
search: {},
|
||||
loading: true,
|
||||
initLoading: false,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
@@ -45,7 +71,10 @@ export default {
|
||||
selectionList: [],
|
||||
option: option,
|
||||
data: [],
|
||||
deptOptions: [],
|
||||
treeDeptId: '0',
|
||||
treeParentId: '0',
|
||||
treeData: [],
|
||||
treeOption: treeOption
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -67,6 +96,14 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
nodeClick(data) {
|
||||
this.treeDeptId = data.id;
|
||||
this.treeParentId = data.parentId;
|
||||
this.page.currentPage = 1;
|
||||
if (this.treeParentId !== '0') {
|
||||
this.onLoad(this.page);
|
||||
}
|
||||
},
|
||||
rowSave(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
@@ -149,7 +186,11 @@ export default {
|
||||
|
||||
const {} = this.query;
|
||||
|
||||
let values = {};
|
||||
let values = {
|
||||
...this.query,
|
||||
...params,
|
||||
deptId: this.treeDeptId
|
||||
};
|
||||
|
||||
getList(page.currentPage, page.pageSize, values).then(res => {
|
||||
const data = res.data.data;
|
||||
@@ -157,6 +198,32 @@ export default {
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
|
||||
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',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.initLoading = true;
|
||||
this.loading = true;
|
||||
return init(this.treeDeptId);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: 'Success!'
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
this.initLoading = false;
|
||||
});
|
||||
} else {
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user