jsk 商超

This commit is contained in:
skjia 2025-06-09 08:52:52 +08:00
parent 7e81bee3ba
commit d33855f05b
3 changed files with 680 additions and 172 deletions

View File

@ -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) {

View File

@ -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,// falseid emitPath: false,// falseid
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,// falseid emitPath: false,// falseid
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') {
// MapidKey // MapidKey
const nodeMap = new Map(); const nodeMap = new Map();
// //
const rootNodes = []; const rootNodes = [];
// nodeMap // nodeMap
data.forEach(node => { data.forEach(node => {
// nodeMapchildren // nodeMapchildren
nodeMap.set(node[idKey], { ...node, [childrenKey]: [] }); nodeMap.set(node[idKey], { ...node, [childrenKey]: [] });
// parentIdnullnodeMap // parentIdnullnodeMap
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