菜品菜谱对接

This commit is contained in:
zzyuan 2025-04-16 18:29:28 +08:00
parent 175d90cb0d
commit 98ddc2f374
9 changed files with 145 additions and 72 deletions

View File

@ -68,7 +68,7 @@ export function deleteDeviceApi(deviceId){
// 获取指定日期菜谱计划菜品详情 // 获取指定日期菜谱计划菜品详情
export function getMenuRecipeDetailApi(data) { export function getMenuRecipeDetailApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menurecipe/date/detail', url: '/smart-canteen/menu_recipe/getDetailByDate',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",

View File

@ -73,11 +73,11 @@ export function removeMenuDishesTypeApi(typeId) {
export function getMenuDishesListApi(data) { export function getMenuDishesListApi(data) {
return request({ return request({
url: '/smart-canteen/menu_dishes/list', url: '/smart-canteen/menu_dishes/list',
method: 'get', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",
}, },
params: data data: data
}) })
} }
// 菜品列表-新增 // 菜品列表-新增

View File

@ -35,10 +35,10 @@ export function getmkteffectiveApi(data) {
}) })
} }
// 菜品列表 // 弹窗-菜品列表
export function getDishesByTypePageApi(data) { export function getDishesByTypePageApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menudishes/type/dishes/list/page', url: '/smart-canteen/menu_dishes/list',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",
@ -50,18 +50,18 @@ export function getDishesByTypePageApi(data) {
// 获取当前菜谱 // 获取当前菜谱
export function getCurrentRecipeListApi(data) { export function getCurrentRecipeListApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menurecipe/query/current/recipe', url: '/smart-canteen/menu_recipe/list',
method: 'post', method: 'get',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",
}, },
data: data params: data
}) })
} }
// 获取所有菜谱-分页 // 获取所有菜谱-分页
export function getPageRecipeListApi(data) { export function getPageRecipeListApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menurecipe/page', url: '/smart-canteen/menu_recipe/getDishesList',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",
@ -73,7 +73,7 @@ export function getPageRecipeListApi(data) {
//菜谱-新增 //菜谱-新增
export function addMenuRecipeApi(data) { export function addMenuRecipeApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menurecipe/add', url: '/smart-canteen/menu_recipe/add',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",
@ -85,7 +85,7 @@ export function addMenuRecipeApi(data) {
//所有菜谱-删除 //所有菜谱-删除
export function removeMenuRecipeApi(data) { export function removeMenuRecipeApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menurecipe/remove/recipes', url: '/smart-canteen/menu_recipe/deleteRecipeById',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",
@ -97,7 +97,7 @@ export function removeMenuRecipeApi(data) {
//当日菜谱-绑定或解绑handleType1绑定2解绑 //当日菜谱-绑定或解绑handleType1绑定2解绑
export function unbindMenuRecipeApi(data) { export function unbindMenuRecipeApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menurecipe/app/bind', url: '/smart-canteen/menu_recipe/app/bind',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",
@ -110,7 +110,7 @@ export function unbindMenuRecipeApi(data) {
// 指定日期菜谱-获取菜谱详情 // 指定日期菜谱-获取菜谱详情
export function getMenuRecipeDetailApi(data) { export function getMenuRecipeDetailApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menurecipe/date/detail', url: '/smart-canteen/menu_recipe/getDetailByDate',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",
@ -122,7 +122,7 @@ export function getMenuRecipeDetailApi(data) {
// 每日循环(每周循环)-获取菜谱详情 // 每日循环(每周循环)-获取菜谱详情
export function getMenuRecipeTemplateDetailApi(data) { export function getMenuRecipeTemplateDetailApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menurecipe/template/detail', url: '/smart-canteen/menu_recipe/detail',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",

View File

@ -93,7 +93,7 @@ export function getDeviceStateLogApi(data) {
// 获取指定日期菜谱计划菜品详情 // 获取指定日期菜谱计划菜品详情
export function getMenuRecipeDetailApi(data) { export function getMenuRecipeDetailApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menurecipe/date/detail', url: '/smart-canteen/menu_recipe/getDetailByDate',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",

View File

@ -1505,13 +1505,13 @@
setTimeout(() => { setTimeout(() => {
this.loading = false; this.loading = false;
let param = { let param = {
current: 1, pageNum: 1,
materialName: query, materialName: query,
materialType: 1, materialType: 1,
size: 20 pageSize: 50
} }
getMaterialListApi(param).then(response => { getMaterialListApi(param).then(response => {
this.materialOptions = response.data.records this.materialOptions = response.rows
}); });
// this.options = this.list.filter(item => { // this.options = this.list.filter(item => {
// return item.label.toLowerCase() // return item.label.toLowerCase()
@ -1561,16 +1561,16 @@
addMenuDishesApi(param).then(response => { addMenuDishesApi(param).then(response => {
this.openDish = false; this.openDish = false;
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.getList(); this.getList();
this.btnLoading=false;
}); });
this.btnLoading=false;
} else { } else {
editMenuDishesApi(param).then(response => { editMenuDishesApi(param).then(response => {
this.openDish = false; this.openDish = false;
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.getList(); this.getList();
this.btnLoading=false;
}); });
this.btnLoading=false;
} }
} }
} }
@ -1581,7 +1581,7 @@
this.$modal this.$modal
.confirm("是否确认删除数据项?") .confirm("是否确认删除数据项?")
.then(function () { .then(function () {
return removeMenuDishesApi(row.dishesId); return removeMenuDishesApi({ids:[row.id]});
}) })
.then(() => { .then(() => {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");

View File

@ -98,14 +98,14 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="营养信息类别" prop="str"> <el-form-item label="营养信息类别" prop="nutritionType">
<el-cascader <el-cascader
v-model="form.str" v-model="form.nutritionType"
:options="cascaderOptions" :options="cascaderOptions"
:props="{ :props="{
emitPath: true,// falseid emitPath: false,// falseid
checkStrictly: false,// checkStrictly: false,//
value:'label',label:'label' value:'value',label:'label'
}" }"
placeholder="请选择营养信息类别" placeholder="请选择营养信息类别"
clearable style="width: 100%;" clearable style="width: 100%;"
@ -311,6 +311,8 @@ export default {
nutritionTypeTreeData:[],// nutritionTypeTreeData:[],//
cascaderOptions: [], // cascaderOptions: [], //
nutritionOptions:[], nutritionOptions:[],
bigType:"",
littleType:"",
form: { form: {
materialName: '',// materialName: '',//
areaId: null,// areaId: null,//
@ -320,7 +322,7 @@ export default {
unitId: '',// unitId: '',//
unitPrice: '',//() unitPrice: '',//()
barCode: '',// barCode: '',//
str:[],// nutritionType:null,//
nutritionId:null,// nutritionId:null,//
shelfLifeType:"1",// shelfLifeType:"1",//
shelfLifeDays:"",// shelfLifeDays:"",//
@ -490,21 +492,44 @@ export default {
children: item.littleTypeList.map(subItem => ({ children: item.littleTypeList.map(subItem => ({
value: subItem.id,//value# value: subItem.id,//value#
label: subItem.bigType, label: subItem.bigType,
bigType: item.bigType,
parentId:item.id, parentId:item.id,
level:2 level:2
})) }))
})); }));
}, },
//
getParentCategoryName(Id) {
const findNode = (nodes) => {
for (let node of nodes) {
if (node.value == Id) {
return node;
}
if (node.children) {
const result = findNode(node.children);
if (result) return result;
}
}
return "";
};
return findNode(this.cascaderOptions);
},
// //
handleNutritionChange(value) { handleNutritionChange(value) {
console.log("选中营养信息类别",value) console.log("选中营养信息类别",value)
this.nutritionAllList() let obj = this.getParentCategoryName(value)
}, this.bigType = obj.bigType
this.littleType = obj.label
// setTimeout(()=>{
this.nutritionAllList()
// },300)
},
// //
nutritionAllList(){ nutritionAllList(){
let param = { let param = {
bigType:this.form.str[0], bigType:this.bigType,
littleType:this.form.str[1] littleType:this.littleType
} }
nutritionAllListApi(param).then((response) => { nutritionAllListApi(param).then((response) => {
this.$set(this.form,"nutritionId",null) this.$set(this.form,"nutritionId",null)
@ -593,6 +618,7 @@ export default {
this.$set(this.form,"areaId",row.areaId) this.$set(this.form,"areaId",row.areaId)
this.getTypeTreeData() this.getTypeTreeData()
this.getDrpUnitList() this.getDrpUnitList()
this.$set(this.form,"id",row.id)
this.$set(this.form,"areaName",row.areaName) this.$set(this.form,"areaName",row.areaName)
this.$set(this.form,"categoryId",row.categoryId) this.$set(this.form,"categoryId",row.categoryId)
this.$set(this.form,"categoryName",row.categoryName) this.$set(this.form,"categoryName",row.categoryName)
@ -624,13 +650,16 @@ export default {
// this.$set(this.form,"cutProcessList",row.cutProcessList) // this.$set(this.form,"cutProcessList",row.cutProcessList)
if(row.bigType&&row.littleType){ if(row.nutritionType){
this.$set(this.form,"str",[row.bigType,row.littleType]) this.$set(this.form,"nutritionType",Number(row.nutritionType))
let obj = this.getParentCategoryName(row.nutritionType)
this.bigType = obj.bigType
this.littleType = obj.label
this.nutritionAllList() this.nutritionAllList()
setTimeout(()=>{ setTimeout(()=>{
this.$set(this.form,"nutritionId",row.nutritionId) this.$set(this.form,"nutritionId",row.nutritionId)
if(this.form.nutritionId){ if(this.form.nutritionId){
nutritionDetailApi(this.form.nutritionId).then((response) => { getNutrition({nutritionId: this.form.nutritionId}).then((response) => {
this.form.menuMaterialNutritionDTO = response.data this.form.menuMaterialNutritionDTO = response.data
}); });
}else{ }else{
@ -669,7 +698,7 @@ export default {
} }
},800) },800)
}else{ }else{
this.$set(this.form,"str",[]) this.$set(this.form,"nutritionType",null)
this.form.menuMaterialNutritionDTO = { this.form.menuMaterialNutritionDTO = {
edible: '',//(g/100g) edible: '',//(g/100g)
water: '',//(g/100g) water: '',//(g/100g)
@ -739,7 +768,7 @@ export default {
unitId: '',// unitId: '',//
unitPrice: '',//() unitPrice: '',//()
barCode: '',// barCode: '',//
str:[],// nutritionType:null,//
nutritionId:null,// nutritionId:null,//
shelfLifeType:"1",// shelfLifeType:"1",//
shelfLifeDays:"",// shelfLifeDays:"",//

View File

@ -669,12 +669,12 @@ export default {
"salesMode":this.queryDish.salesMode, "salesMode":this.queryDish.salesMode,
"typeId":this.queryDish.typeId, "typeId":this.queryDish.typeId,
"dishesName":this.queryDish.dishesName, "dishesName":this.queryDish.dishesName,
"current":1, "pageNum":1,
"size":100 "pageSize":100
} }
getDishesByTypePageApi(param).then((response) => { getDishesByTypePageApi(param).then((response) => {
// console.log(response) // console.log(response)
this.dishesPageList = response.data.records; this.dishesPageList = response.rows;
for(let i =0 ;i < this.dishesList.length ;i++){ for(let i =0 ;i < this.dishesList.length ;i++){
this.dishesPageList.forEach(item=>{ this.dishesPageList.forEach(item=>{
if(item.dishesId==this.dishesList[i].dishesId){ if(item.dishesId==this.dishesList[i].dishesId){
@ -690,8 +690,8 @@ export default {
let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId) let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
if(index==-1){ if(index==-1){
let dish = Object.assign({}, obj) let dish = Object.assign({}, obj)
this.$set(dish,'salePrice',Number(dish.salePrice/100)||Number(dish.price/100)) this.$set(dish,'salePrice',Number(dish.unitPrice/100)||Number(dish.unitPrice/100))
this.$set(dish,'price',Number(dish.price/100)) this.$set(dish,'price',Number(dish.unitPrice/100))
this.$set(dish,'supplyNum',dish.supplyNum||99999) this.$set(dish,'supplyNum',dish.supplyNum||99999)
this.$set(dish,'restrictNum',dish.restrictNum||99999) this.$set(dish,'restrictNum',dish.restrictNum||99999)
this.dishesList.push(dish) this.dishesList.push(dish)

View File

@ -579,9 +579,31 @@ export default {
}, },
// //
getMealTimeList() { getMealTimeList() {
mealTimeListApi({}).then(response => { // mealTimeListApi({}).then(response => {
this.mealTimeList=response // this.mealTimeList=response
}); // });
this.mealTimeList= [
{
mealtimeType:"1",
mealtimeName:"早餐",
},
{
mealtimeType:"2",
mealtimeName:"午餐",
},
{
mealtimeType:"3",
mealtimeName:"下午茶",
},
{
mealtimeType:"4",
mealtimeName:"晚餐",
},
{
mealtimeType:"5",
mealtimeName:"夜宵",
}
]
}, },
// //
jumpList() { jumpList() {
@ -829,12 +851,12 @@ export default {
"salesMode":this.queryDish.salesMode, "salesMode":this.queryDish.salesMode,
"typeId":this.queryDish.typeId, "typeId":this.queryDish.typeId,
"dishesName":this.queryDish.dishesName, "dishesName":this.queryDish.dishesName,
"current":1, "pageNum":1,
"size":100 "pageSize":100
} }
getDishesByTypePageApi(param).then((response) => { getDishesByTypePageApi(param).then((response) => {
// console.log(response) // console.log(response)
this.dishesPageList = response.data.records; this.dishesPageList = response.rows;
for(let i =0 ;i < this.dishesList.length ;i++){ for(let i =0 ;i < this.dishesList.length ;i++){
this.dishesPageList.forEach(item=>{ this.dishesPageList.forEach(item=>{
if(item.dishesId==this.dishesList[i].dishesId){ if(item.dishesId==this.dishesList[i].dishesId){
@ -850,8 +872,8 @@ export default {
let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId) let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
if(index==-1){//- if(index==-1){//-
let dish = Object.assign({}, obj) let dish = Object.assign({}, obj)
this.$set(dish,'salePrice',Number(dish.salePrice/100)||Number(dish.price/100)) this.$set(dish,'salePrice',Number(dish.unitPrice/100)||Number(dish.unitPrice/100))
this.$set(dish,'price',Number(dish.price/100)) this.$set(dish,'price',Number(dish.unitPrice/100))
this.$set(dish,'supplyNum',dish.supplyNum||99999) this.$set(dish,'supplyNum',dish.supplyNum||99999)
this.$set(dish,'restrictNum',dish.restrictNum||99999) this.$set(dish,'restrictNum',dish.restrictNum||99999)
this.dishesList.push(dish) this.dishesList.push(dish)

View File

@ -102,8 +102,8 @@
<el-table-column v-for="item in mealTimeList" :key="item.mealtimeType" :label="item.mealtimeName" align="center" v-if="activeName=='currentRecipe'" width="200"> <el-table-column v-for="item in mealTimeList" :key="item.mealtimeType" :label="item.mealtimeName" align="center" v-if="activeName=='currentRecipe'" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.detail&&scope.row.detail.details.length>0"> <div v-if="scope.row.detail&&scope.row.detail.length>0">
<div v-for="subItem in scope.row.detail.details" :key="subItem.detailId"> <div v-for="subItem in scope.row.detail[0].details" :key="subItem.detailId">
<div v-if="subItem.mealtimeType==item.mealtimeType"> <div v-if="subItem.mealtimeType==item.mealtimeType">
<div v-for="(lastItem,index) in subItem.dishesList" :key="lastItem.dishesId"> <div v-for="(lastItem,index) in subItem.dishesList" :key="lastItem.dishesId">
<div v-if="index<4">{{ lastItem.dishesName }}</div> <div v-if="index<4">{{ lastItem.dishesName }}</div>
@ -299,20 +299,43 @@
}, },
// //
getMealTimeList() { getMealTimeList() {
mealTimeListApi({}).then(response => { this.mealTimeList= [
this.mealTimeList=response {
}); mealtimeType:"1",
mealtimeName:"早餐",
},
{
mealtimeType:"2",
mealtimeName:"午餐",
},
{
mealtimeType:"3",
mealtimeName:"下午茶",
},
{
mealtimeType:"4",
mealtimeName:"晚餐",
},
{
mealtimeType:"5",
mealtimeName:"夜宵",
}
]
// mealTimeListApi({}).then(response => {
// this.mealTimeList=response
// });
}, },
// //
getMealTypeList() { getMealTypeList() {
menuTypeListApi({}).then(response => { // menuTypeListApi({}).then(response => {
response.data.forEach(item=>{ // response.data.forEach(item=>{
if(item.id==2||item.id==6||item.id==7||item.id==8){ // if(item.id==2||item.id==6||item.id==7||item.id==8){
this.menuTypeList.push(item) // this.menuTypeList.push(item)
} // }
}) // })
this.menuTypeList = [{bindType: 7,id: 2,name: "智慧餐台/消费机"},{bindType: 1,id: 6,name: "移动端当餐点餐"},{bindType: 2,id: 7,name: "移动端预订餐"},{bindType: 3,id: 8,name: "移动端一周菜谱"}]
this.bindType = this.menuTypeList[0].bindType this.bindType = this.menuTypeList[0].bindType
}); // });
}, },
choseMenuType(item){ choseMenuType(item){
this.bindType = item.bindType this.bindType = item.bindType
@ -420,18 +443,17 @@
/** 查询当前菜谱列表 */ /** 查询当前菜谱列表 */
getList() { getList() {
this.loading = true; this.loading = true;
this.queryParams.current = this.queryParams.pageNum this.queryParams.pageNum = this.queryParams.pageNum
this.queryParams.size = this.queryParams.pageSize this.queryParams.pageSize = this.queryParams.pageSize
if(this.activeName=='currentRecipe'){ if(this.activeName=='currentRecipe'){
getCurrentRecipeListApi(this.queryParams).then(response => { getCurrentRecipeListApi(this.queryParams).then(response => {
this.tableListData = response.data.records; this.tableListData = response.rows;
this.total = Number(response.data.total); this.total = Number(response.total);
this.loading = false; this.loading = false;
}); });
}else if(this.activeName=='pageRecipe'){ }else if(this.activeName=='pageRecipe'){
getPageRecipeListApi(this.queryParams).then(response => { getPageRecipeListApi(this.queryParams).then(response => {
this.tableListData = response.records; this.tableListData = response.data;
this.total = Number(response.total); this.total = Number(response.total);
this.loading = false; this.loading = false;
}); });
@ -449,7 +471,7 @@
recipeId:row.recipeId recipeId:row.recipeId
} }
getPageRecipeListApi(param).then(response => { getPageRecipeListApi(param).then(response => {
let obj = response.records[0] let obj = response.data[0]
this.$router.push({ path: "/dish/menuEdit",query: {pageJson:JSON.stringify(obj)} }); this.$router.push({ path: "/dish/menuEdit",query: {pageJson:JSON.stringify(obj)} });
}); });
@ -467,7 +489,7 @@
handleDelete(row) { handleDelete(row) {
console.log(row) console.log(row)
this.$modal.confirm('是否确认删除菜谱?').then(function() { this.$modal.confirm('是否确认删除菜谱?').then(function() {
return removeMenuRecipeApi([row.recipeId]) return removeMenuRecipeApi({"recipeId":row.recipeId})
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
@ -500,7 +522,7 @@
} }
getPageRecipeListApi(param).then(response => { getPageRecipeListApi(param).then(response => {
// console.log(response.records) // console.log(response.records)
this.recipeOptionsData = response.records this.recipeOptionsData = response.data
this.resetForm("menuForm"); this.resetForm("menuForm");
this.openMenu=true this.openMenu=true
}); });