jsk 商超
This commit is contained in:
parent
7e81bee3ba
commit
d33855f05b
|
|
@ -57,7 +57,7 @@ export function deleteSupermarketApi(data) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通过角色查人员
|
// 通过角色查人员
|
||||||
export function userListByRoleApi(data) {
|
export function userListByRoleApi(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
@ -69,6 +69,17 @@ export function deleteSupermarketApi(data) {
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 商品列表
|
||||||
|
export function shopPageListApi(data) {
|
||||||
|
return request({
|
||||||
|
url: '/smart-canteen/supermarket_product/list',
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
"merchant-id":"378915229716713472",
|
||||||
|
},
|
||||||
|
params: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -79,4 +90,3 @@ export function deleteSupermarketApi(data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,11 @@
|
||||||
:inline="true"
|
:inline="true"
|
||||||
v-show="showSearch"
|
v-show="showSearch"
|
||||||
label-width="68px"
|
label-width="68px"
|
||||||
>
|
>
|
||||||
<el-form-item label="所属区域" prop="areaId">
|
<el-form-item label="所属区域" prop="areaId">
|
||||||
<el-cascader v-model="queryParams.areaId"
|
<el-cascader v-model="queryParams.areaId"
|
||||||
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||||
:props="{
|
:props="{
|
||||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||||
value:'id',label:'label'
|
value:'id',label:'label'
|
||||||
|
|
@ -116,7 +116,7 @@
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -149,7 +149,7 @@
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleBatchDel"
|
@click="handleBatchDel"
|
||||||
>批量删除</el-button>
|
>批量删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="1.5">
|
<!-- <el-col :span="1.5">
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="upload"
|
ref="upload"
|
||||||
|
|
@ -160,23 +160,23 @@
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:disabled="upload.isUploading"
|
:disabled="upload.isUploading"
|
||||||
:on-progress="handleFileUploadProgress"
|
:on-progress="handleFileUploadProgress"
|
||||||
:on-success="handleFileSuccess"
|
:on-success="handleFileSuccess"
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
>批量导入
|
>批量导入
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="importTemplate"
|
@click="importTemplate"
|
||||||
>模板下载
|
>模板下载
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col> -->
|
</el-col> -->
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -189,22 +189,22 @@
|
||||||
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品编码" align="center" key="materialCode" prop="materialCode" :show-overflow-tooltip="true" />
|
<el-table-column label="商品编码" align="center" key="materialCode" prop="materialCode" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="商品名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" />
|
<el-table-column label="商品名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="所属区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" />
|
<el-table-column label="所属区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="商品类别" align="center" key="materialTypeName" prop="materialTypeName" :show-overflow-tooltip="true" />
|
<el-table-column label="商品类别" align="center" key="materialTypeName" prop="materialTypeName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="单位" align="center" key="unitName" prop="unitName" :show-overflow-tooltip="true" width="100"/>
|
<el-table-column label="单位" align="center" key="unitName" prop="unitName" :show-overflow-tooltip="true" width="100"/>
|
||||||
<el-table-column label="条码" align="center" key="barCode" prop="barCode" :show-overflow-tooltip="true" />
|
<el-table-column label="条码" align="center" key="barCode" prop="barCode" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="商品进价(元)" align="center" key="unitPrice" prop="unitPrice" :show-overflow-tooltip="true">
|
<el-table-column label="商品进价(元)" align="center" key="unitPrice" prop="unitPrice" :show-overflow-tooltip="true">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span>
|
<span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="零售价(元)" align="center" key="salePrice" prop="salePrice" :show-overflow-tooltip="true">
|
<el-table-column label="零售价(元)" align="center" key="salePrice" prop="salePrice" :show-overflow-tooltip="true">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ (scope.row.salePrice/100).toFixed(2)||"" }}</span>
|
<span>{{ (scope.row.salePrice/100).toFixed(2)||"" }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="100" fixed="right">
|
<el-table-column label="操作" align="center" width="100" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -247,7 +247,7 @@
|
||||||
<el-form-item label="所属区域" prop="areaId">
|
<el-form-item label="所属区域" prop="areaId">
|
||||||
<el-cascader v-model="form.areaId" :disabled="isEditType"
|
<el-cascader v-model="form.areaId" :disabled="isEditType"
|
||||||
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||||
:props="{
|
:props="{
|
||||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||||
value:'id',label:'label'
|
value:'id',label:'label'
|
||||||
|
|
@ -265,14 +265,14 @@
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
||||||
<el-button @click="open=false">取 消</el-button>
|
<el-button @click="open=false">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
<!-- 添加或修改用户配置对话框 -->
|
<!-- 添加或修改用户配置对话框 -->
|
||||||
<material-dialog :visible.sync="dialogVisible" :title="title" :treeOptions="treeOptions" :treeAreaOptions="treeAreaOptions" @submit="handleDialogSubmit" ref="materialDialog" />
|
<material-dialog :visible.sync="dialogVisible" :title="title" :treeOptions="treeOptions" :treeAreaOptions="treeAreaOptions" @submit="handleDialogSubmit" ref="materialDialog" />
|
||||||
|
|
@ -323,7 +323,7 @@ export default {
|
||||||
areaId:null,
|
areaId:null,
|
||||||
materialName:"",
|
materialName:"",
|
||||||
barCode:"",
|
barCode:"",
|
||||||
materialCode:"",
|
materialCode:"",
|
||||||
materialTypeIds:[]
|
materialTypeIds:[]
|
||||||
},
|
},
|
||||||
// 总条数
|
// 总条数
|
||||||
|
|
@ -351,13 +351,13 @@ export default {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
treeAreaOptions:[],//区域树
|
treeAreaOptions:[],//区域树
|
||||||
batchIds:[],
|
batchIds:[],
|
||||||
//导入参数
|
//导入参数
|
||||||
upload: {
|
upload: {
|
||||||
// 是否禁用上传
|
// 是否禁用上传
|
||||||
isUploading: false,
|
isUploading: false,
|
||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: { Authorization: 'Bearer ' + getToken() },
|
headers: { Authorization: 'Bearer ' + getToken() },
|
||||||
// 上传的地址
|
// 上传的地址
|
||||||
|
|
@ -384,26 +384,26 @@ export default {
|
||||||
/** 查询新增页面-上级类型下拉树结构 */
|
/** 查询新增页面-上级类型下拉树结构 */
|
||||||
getTreeData() {
|
getTreeData() {
|
||||||
shopMaterialTreeApi().then((response) => {
|
shopMaterialTreeApi().then((response) => {
|
||||||
this.treeOptions = this.handleTree(response.rows,'materialTypeId');
|
this.treeOptions = this.handleTree(response.rows,'materialTypeId');
|
||||||
this.addLevel(this.treeOptions)
|
this.addLevel(this.treeOptions)
|
||||||
console.log("this.treeOptions",this.treeOptions)
|
console.log("this.treeOptions",this.treeOptions)
|
||||||
if(this.treeOptions && this.treeOptions.length > 0){
|
if(this.treeOptions && this.treeOptions.length > 0){
|
||||||
this.getList();
|
this.getList();
|
||||||
} else {
|
} else {
|
||||||
this.getList();
|
this.getList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleTree(data, idKey, parentIdKey = 'parentId', childrenKey = 'children') {
|
handleTree(data, idKey, parentIdKey = 'parentId', childrenKey = 'children') {
|
||||||
// 用于存储节点数据的Map,以idKey为键
|
// 用于存储节点数据的Map,以idKey为键
|
||||||
const nodeMap = new Map();
|
const nodeMap = new Map();
|
||||||
// 用于存储根节点的数组
|
// 用于存储根节点的数组
|
||||||
const rootNodes = [];
|
const rootNodes = [];
|
||||||
|
|
||||||
// 遍历数据,构建nodeMap并找到根节点
|
// 遍历数据,构建nodeMap并找到根节点
|
||||||
data.forEach(node => {
|
data.forEach(node => {
|
||||||
// 将节点添加到nodeMap中,并初始化children为空数组
|
// 将节点添加到nodeMap中,并初始化children为空数组
|
||||||
nodeMap.set(node[idKey], { ...node, [childrenKey]: [] });
|
nodeMap.set(node[idKey], { ...node, [childrenKey]: [] });
|
||||||
// 如果parentId为null或父节点不存在于nodeMap中,则该节点为根节点
|
// 如果parentId为null或父节点不存在于nodeMap中,则该节点为根节点
|
||||||
if (node[parentIdKey] === null || !nodeMap.has(node[parentIdKey])) {
|
if (node[parentIdKey] === null || !nodeMap.has(node[parentIdKey])) {
|
||||||
// 将根节点添加到rootNodes数组中
|
// 将根节点添加到rootNodes数组中
|
||||||
|
|
@ -418,12 +418,12 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
// 返回根节点数组,它现在包含了完整的树形结构
|
// 返回根节点数组,它现在包含了完整的树形结构
|
||||||
return rootNodes;
|
return rootNodes;
|
||||||
},
|
},
|
||||||
addLevel(nodes, level = 0) {
|
addLevel(nodes, level = 0) {
|
||||||
nodes.forEach(node => {
|
nodes.forEach(node => {
|
||||||
node.level = level; // 设置当前节点的层级
|
node.level = level; // 设置当前节点的层级
|
||||||
if (node.children) { // 如果节点有子节点,递归处理子节点
|
if (node.children) { // 如果节点有子节点,递归处理子节点
|
||||||
this.addLevel(node.children, level + 1);
|
this.addLevel(node.children, level + 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -433,19 +433,19 @@ export default {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
// this.handleQuery();
|
// this.handleQuery();
|
||||||
},
|
},
|
||||||
handleCheckChange(data, checked, indeterminate) {
|
handleCheckChange(data, checked, indeterminate) {
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
/* 树节点增加 */
|
/* 树节点增加 */
|
||||||
appendTreeNode(data) {
|
appendTreeNode(data) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
this.isEditType=false;
|
this.isEditType=false;
|
||||||
this.form={}
|
this.form={}
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
this.$set(this.form,"parentId",data.materialTypeId)
|
this.$set(this.form,"parentId",data.materialTypeId)
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "新增";
|
this.title = "新增";
|
||||||
},
|
},
|
||||||
/* 树节点修改 */
|
/* 树节点修改 */
|
||||||
editTreeNode(data) {
|
editTreeNode(data) {
|
||||||
this.isEditType=true;
|
this.isEditType=true;
|
||||||
|
|
@ -516,7 +516,7 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
|
|
@ -526,7 +526,7 @@ export default {
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
this.queryParams.pageSize = 10;
|
this.queryParams.pageSize = 10;
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
|
|
@ -539,7 +539,7 @@ export default {
|
||||||
"areaId": this.queryParams.areaId,
|
"areaId": this.queryParams.areaId,
|
||||||
"materialName": this.queryParams.materialName,
|
"materialName": this.queryParams.materialName,
|
||||||
"barCode": this.queryParams.barCode,
|
"barCode": this.queryParams.barCode,
|
||||||
"materialCode": this.queryParams.materialCode,
|
"materialCode": this.queryParams.materialCode,
|
||||||
"materialTypeIds": this.$refs.typeTree.getCheckedKeys(),
|
"materialTypeIds": this.$refs.typeTree.getCheckedKeys(),
|
||||||
}
|
}
|
||||||
getMaterialListApi(params).then((response) => {
|
getMaterialListApi(params).then((response) => {
|
||||||
|
|
@ -551,7 +551,7 @@ export default {
|
||||||
//新增修改弹窗-区域树
|
//新增修改弹窗-区域树
|
||||||
getAreaTreeData() {
|
getAreaTreeData() {
|
||||||
systemAreaTreeApi({}).then((response) => {
|
systemAreaTreeApi({}).then((response) => {
|
||||||
this.treeAreaOptions = response.data;
|
this.treeAreaOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
|
|
@ -563,7 +563,7 @@ export default {
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.title = "修改";
|
this.title = "修改";
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
// 在显示对话框后,可以通过 $refs 访问子组件方法设置表单数据
|
// 在显示对话框后,可以通过 $refs 访问子组件方法设置表单数据
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
// 假设子组件提供了 setFormData 方法
|
// 假设子组件提供了 setFormData 方法
|
||||||
|
|
@ -600,10 +600,10 @@ export default {
|
||||||
this.getList();
|
this.getList();
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
handleSelectionChange(selection){
|
handleSelectionChange(selection){
|
||||||
this.batchIds = []
|
this.batchIds = []
|
||||||
this.batchIds = selection.map((item) => item.materialId)
|
this.batchIds = selection.map((item) => item.materialId)
|
||||||
this.single = selection.length !== 1
|
this.single = selection.length !== 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
|
|
@ -611,11 +611,11 @@ export default {
|
||||||
handleBatchDel(){
|
handleBatchDel(){
|
||||||
console.log(this.batchIds)
|
console.log(this.batchIds)
|
||||||
removeMaterialApi({"materialId":this.batchIds.join(",")}).then(response => {
|
removeMaterialApi({"materialId":this.batchIds.join(",")}).then(response => {
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
this.$refs.multipleTable.clearSelection()
|
this.$refs.multipleTable.clearSelection()
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
//批量导入
|
//批量导入
|
||||||
// /api/v1/menumaterial/batch/import/material
|
// /api/v1/menumaterial/batch/import/material
|
||||||
|
|
@ -624,7 +624,7 @@ export default {
|
||||||
this.upload.isUploading = true
|
this.upload.isUploading = true
|
||||||
},
|
},
|
||||||
// 文件上传成功处理
|
// 文件上传成功处理
|
||||||
handleFileSuccess(response, file, fileList) {
|
handleFileSuccess(response, file, fileList) {
|
||||||
this.upload.isUploading = false
|
this.upload.isUploading = false
|
||||||
this.$refs.upload.clearFiles()
|
this.$refs.upload.clearFiles()
|
||||||
this.$modal.msgSuccess("后台导入中,请稍后刷新列表!");
|
this.$modal.msgSuccess("后台导入中,请稍后刷新列表!");
|
||||||
|
|
@ -637,7 +637,7 @@ export default {
|
||||||
downloadFileByUrl(url)
|
downloadFileByUrl(url)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// getParentName(list, id) {
|
// getParentName(list, id) {
|
||||||
// try {
|
// try {
|
||||||
// list.forEach((e) => {
|
// list.forEach((e) => {
|
||||||
|
|
@ -652,7 +652,7 @@ export default {
|
||||||
// });
|
// });
|
||||||
// } catch (error) {}
|
// } catch (error) {}
|
||||||
// },
|
// },
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue