菜品菜谱对接
This commit is contained in:
parent
175d90cb0d
commit
98ddc2f374
|
|
@ -68,7 +68,7 @@ export function deleteDeviceApi(deviceId){
|
|||
// 获取指定日期菜谱计划菜品详情
|
||||
export function getMenuRecipeDetailApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menurecipe/date/detail',
|
||||
url: '/smart-canteen/menu_recipe/getDetailByDate',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
|
|||
|
|
@ -73,11 +73,11 @@ export function removeMenuDishesTypeApi(typeId) {
|
|||
export function getMenuDishesListApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/menu_dishes/list',
|
||||
method: 'get',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
params: data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 菜品列表-新增
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ export function getmkteffectiveApi(data) {
|
|||
})
|
||||
}
|
||||
|
||||
// 菜品列表
|
||||
// 弹窗-菜品列表
|
||||
export function getDishesByTypePageApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menudishes/type/dishes/list/page',
|
||||
url: '/smart-canteen/menu_dishes/list',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -50,18 +50,18 @@ export function getDishesByTypePageApi(data) {
|
|||
// 获取当前菜谱
|
||||
export function getCurrentRecipeListApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menurecipe/query/current/recipe',
|
||||
method: 'post',
|
||||
url: '/smart-canteen/menu_recipe/list',
|
||||
method: 'get',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
params: data
|
||||
})
|
||||
}
|
||||
// 获取所有菜谱-分页
|
||||
export function getPageRecipeListApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menurecipe/page',
|
||||
url: '/smart-canteen/menu_recipe/getDishesList',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -73,7 +73,7 @@ export function getPageRecipeListApi(data) {
|
|||
//菜谱-新增
|
||||
export function addMenuRecipeApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menurecipe/add',
|
||||
url: '/smart-canteen/menu_recipe/add',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -85,7 +85,7 @@ export function addMenuRecipeApi(data) {
|
|||
//所有菜谱-删除
|
||||
export function removeMenuRecipeApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menurecipe/remove/recipes',
|
||||
url: '/smart-canteen/menu_recipe/deleteRecipeById',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -97,7 +97,7 @@ export function removeMenuRecipeApi(data) {
|
|||
//当日菜谱-绑定或解绑(handleType:1绑定,2解绑)
|
||||
export function unbindMenuRecipeApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menurecipe/app/bind',
|
||||
url: '/smart-canteen/menu_recipe/app/bind',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -110,7 +110,7 @@ export function unbindMenuRecipeApi(data) {
|
|||
// 指定日期菜谱-获取菜谱详情
|
||||
export function getMenuRecipeDetailApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menurecipe/date/detail',
|
||||
url: '/smart-canteen/menu_recipe/getDetailByDate',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -122,7 +122,7 @@ export function getMenuRecipeDetailApi(data) {
|
|||
// 每日循环(每周循环)-获取菜谱详情
|
||||
export function getMenuRecipeTemplateDetailApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menurecipe/template/detail',
|
||||
url: '/smart-canteen/menu_recipe/detail',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export function getDeviceStateLogApi(data) {
|
|||
// 获取指定日期菜谱计划菜品详情
|
||||
export function getMenuRecipeDetailApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menurecipe/date/detail',
|
||||
url: '/smart-canteen/menu_recipe/getDetailByDate',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
|
|||
|
|
@ -1505,13 +1505,13 @@
|
|||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
let param = {
|
||||
current: 1,
|
||||
pageNum: 1,
|
||||
materialName: query,
|
||||
materialType: 1,
|
||||
size: 20
|
||||
pageSize: 50
|
||||
}
|
||||
getMaterialListApi(param).then(response => {
|
||||
this.materialOptions = response.data.records
|
||||
this.materialOptions = response.rows
|
||||
});
|
||||
// this.options = this.list.filter(item => {
|
||||
// return item.label.toLowerCase()
|
||||
|
|
@ -1562,15 +1562,15 @@
|
|||
this.openDish = false;
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.getList();
|
||||
this.btnLoading=false;
|
||||
});
|
||||
this.btnLoading=false;
|
||||
} else {
|
||||
editMenuDishesApi(param).then(response => {
|
||||
this.openDish = false;
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.getList();
|
||||
this.btnLoading=false;
|
||||
});
|
||||
this.btnLoading=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1581,7 +1581,7 @@
|
|||
this.$modal
|
||||
.confirm("是否确认删除数据项?")
|
||||
.then(function () {
|
||||
return removeMenuDishesApi(row.dishesId);
|
||||
return removeMenuDishesApi({ids:[row.id]});
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
|
|
|
|||
|
|
@ -98,14 +98,14 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="营养信息类别" prop="str">
|
||||
<el-form-item label="营养信息类别" prop="nutritionType">
|
||||
<el-cascader
|
||||
v-model="form.str"
|
||||
v-model="form.nutritionType"
|
||||
:options="cascaderOptions"
|
||||
:props="{
|
||||
emitPath: true,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'label',label:'label'
|
||||
value:'value',label:'label'
|
||||
}"
|
||||
placeholder="请选择营养信息类别"
|
||||
clearable style="width: 100%;"
|
||||
|
|
@ -311,6 +311,8 @@ export default {
|
|||
nutritionTypeTreeData:[],//类别接口返回数据(未处理)
|
||||
cascaderOptions: [], // 级联选择器的选项(已处理)
|
||||
nutritionOptions:[],
|
||||
bigType:"",
|
||||
littleType:"",
|
||||
form: {
|
||||
materialName: '',//原料名称
|
||||
areaId: null,//所属区域
|
||||
|
|
@ -320,7 +322,7 @@ export default {
|
|||
unitId: '',//原料单位
|
||||
unitPrice: '',//原料进价(元)
|
||||
barCode: '',//条码
|
||||
str:[],//营养信息类型
|
||||
nutritionType:null,//营养信息类型
|
||||
nutritionId:null,//营养信息
|
||||
shelfLifeType:"1",//保质期类型
|
||||
shelfLifeDays:"",//保质期
|
||||
|
|
@ -490,21 +492,44 @@ export default {
|
|||
children: item.littleTypeList.map(subItem => ({
|
||||
value: subItem.id,//父子类别value一致时选中识别不出来,加个#号区分
|
||||
label: subItem.bigType,
|
||||
bigType: item.bigType,
|
||||
parentId:item.id,
|
||||
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) {
|
||||
console.log("选中营养信息类别",value)
|
||||
let obj = this.getParentCategoryName(value)
|
||||
this.bigType = obj.bigType
|
||||
this.littleType = obj.label
|
||||
// setTimeout(()=>{
|
||||
this.nutritionAllList()
|
||||
// },300)
|
||||
|
||||
},
|
||||
//获取营养信息下拉
|
||||
nutritionAllList(){
|
||||
let param = {
|
||||
bigType:this.form.str[0],
|
||||
littleType:this.form.str[1]
|
||||
bigType:this.bigType,
|
||||
littleType:this.littleType
|
||||
}
|
||||
nutritionAllListApi(param).then((response) => {
|
||||
this.$set(this.form,"nutritionId",null)
|
||||
|
|
@ -593,6 +618,7 @@ export default {
|
|||
this.$set(this.form,"areaId",row.areaId)
|
||||
this.getTypeTreeData()
|
||||
this.getDrpUnitList()
|
||||
this.$set(this.form,"id",row.id)
|
||||
this.$set(this.form,"areaName",row.areaName)
|
||||
this.$set(this.form,"categoryId",row.categoryId)
|
||||
this.$set(this.form,"categoryName",row.categoryName)
|
||||
|
|
@ -624,13 +650,16 @@ export default {
|
|||
// this.$set(this.form,"cutProcessList",row.cutProcessList)
|
||||
|
||||
|
||||
if(row.bigType&&row.littleType){
|
||||
this.$set(this.form,"str",[row.bigType,row.littleType])
|
||||
if(row.nutritionType){
|
||||
this.$set(this.form,"nutritionType",Number(row.nutritionType))
|
||||
let obj = this.getParentCategoryName(row.nutritionType)
|
||||
this.bigType = obj.bigType
|
||||
this.littleType = obj.label
|
||||
this.nutritionAllList()
|
||||
setTimeout(()=>{
|
||||
this.$set(this.form,"nutritionId",row.nutritionId)
|
||||
if(this.form.nutritionId){
|
||||
nutritionDetailApi(this.form.nutritionId).then((response) => {
|
||||
getNutrition({nutritionId: this.form.nutritionId}).then((response) => {
|
||||
this.form.menuMaterialNutritionDTO = response.data
|
||||
});
|
||||
}else{
|
||||
|
|
@ -669,7 +698,7 @@ export default {
|
|||
}
|
||||
},800)
|
||||
}else{
|
||||
this.$set(this.form,"str",[])
|
||||
this.$set(this.form,"nutritionType",null)
|
||||
this.form.menuMaterialNutritionDTO = {
|
||||
edible: '',//可食部分(g/100g)
|
||||
water: '',//水分(g/100g)
|
||||
|
|
@ -739,7 +768,7 @@ export default {
|
|||
unitId: '',//原料单位
|
||||
unitPrice: '',//原料进价(元)
|
||||
barCode: '',//条码
|
||||
str:[],//营养信息类型
|
||||
nutritionType:null,//营养信息类型
|
||||
nutritionId:null,//营养信息
|
||||
shelfLifeType:"1",//保质期类型
|
||||
shelfLifeDays:"",//保质期
|
||||
|
|
|
|||
|
|
@ -669,12 +669,12 @@ export default {
|
|||
"salesMode":this.queryDish.salesMode,
|
||||
"typeId":this.queryDish.typeId,
|
||||
"dishesName":this.queryDish.dishesName,
|
||||
"current":1,
|
||||
"size":100
|
||||
"pageNum":1,
|
||||
"pageSize":100
|
||||
}
|
||||
getDishesByTypePageApi(param).then((response) => {
|
||||
// console.log(response)
|
||||
this.dishesPageList = response.data.records;
|
||||
this.dishesPageList = response.rows;
|
||||
for(let i =0 ;i < this.dishesList.length ;i++){
|
||||
this.dishesPageList.forEach(item=>{
|
||||
if(item.dishesId==this.dishesList[i].dishesId){
|
||||
|
|
@ -690,8 +690,8 @@ export default {
|
|||
let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
|
||||
if(index==-1){
|
||||
let dish = Object.assign({}, obj)
|
||||
this.$set(dish,'salePrice',Number(dish.salePrice/100)||Number(dish.price/100))
|
||||
this.$set(dish,'price',Number(dish.price/100))
|
||||
this.$set(dish,'salePrice',Number(dish.unitPrice/100)||Number(dish.unitPrice/100))
|
||||
this.$set(dish,'price',Number(dish.unitPrice/100))
|
||||
this.$set(dish,'supplyNum',dish.supplyNum||99999)
|
||||
this.$set(dish,'restrictNum',dish.restrictNum||99999)
|
||||
this.dishesList.push(dish)
|
||||
|
|
|
|||
|
|
@ -579,9 +579,31 @@ export default {
|
|||
},
|
||||
//餐次数据
|
||||
getMealTimeList() {
|
||||
mealTimeListApi({}).then(response => {
|
||||
this.mealTimeList=response
|
||||
});
|
||||
// mealTimeListApi({}).then(response => {
|
||||
// this.mealTimeList=response
|
||||
// });
|
||||
this.mealTimeList= [
|
||||
{
|
||||
mealtimeType:"1",
|
||||
mealtimeName:"早餐",
|
||||
},
|
||||
{
|
||||
mealtimeType:"2",
|
||||
mealtimeName:"午餐",
|
||||
},
|
||||
{
|
||||
mealtimeType:"3",
|
||||
mealtimeName:"下午茶",
|
||||
},
|
||||
{
|
||||
mealtimeType:"4",
|
||||
mealtimeName:"晚餐",
|
||||
},
|
||||
{
|
||||
mealtimeType:"5",
|
||||
mealtimeName:"夜宵",
|
||||
}
|
||||
]
|
||||
},
|
||||
// 返回列表页
|
||||
jumpList() {
|
||||
|
|
@ -829,12 +851,12 @@ export default {
|
|||
"salesMode":this.queryDish.salesMode,
|
||||
"typeId":this.queryDish.typeId,
|
||||
"dishesName":this.queryDish.dishesName,
|
||||
"current":1,
|
||||
"size":100
|
||||
"pageNum":1,
|
||||
"pageSize":100
|
||||
}
|
||||
getDishesByTypePageApi(param).then((response) => {
|
||||
// console.log(response)
|
||||
this.dishesPageList = response.data.records;
|
||||
this.dishesPageList = response.rows;
|
||||
for(let i =0 ;i < this.dishesList.length ;i++){
|
||||
this.dishesPageList.forEach(item=>{
|
||||
if(item.dishesId==this.dishesList[i].dishesId){
|
||||
|
|
@ -850,8 +872,8 @@ export default {
|
|||
let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
|
||||
if(index==-1){//新-加入
|
||||
let dish = Object.assign({}, obj)
|
||||
this.$set(dish,'salePrice',Number(dish.salePrice/100)||Number(dish.price/100))
|
||||
this.$set(dish,'price',Number(dish.price/100))
|
||||
this.$set(dish,'salePrice',Number(dish.unitPrice/100)||Number(dish.unitPrice/100))
|
||||
this.$set(dish,'price',Number(dish.unitPrice/100))
|
||||
this.$set(dish,'supplyNum',dish.supplyNum||99999)
|
||||
this.$set(dish,'restrictNum',dish.restrictNum||99999)
|
||||
this.dishesList.push(dish)
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.detail&&scope.row.detail.details.length>0">
|
||||
<div v-for="subItem in scope.row.detail.details" :key="subItem.detailId">
|
||||
<div v-if="scope.row.detail&&scope.row.detail.length>0">
|
||||
<div v-for="subItem in scope.row.detail[0].details" :key="subItem.detailId">
|
||||
<div v-if="subItem.mealtimeType==item.mealtimeType">
|
||||
<div v-for="(lastItem,index) in subItem.dishesList" :key="lastItem.dishesId">
|
||||
<div v-if="index<4">{{ lastItem.dishesName }}</div>
|
||||
|
|
@ -299,20 +299,43 @@
|
|||
},
|
||||
//餐次数据
|
||||
getMealTimeList() {
|
||||
mealTimeListApi({}).then(response => {
|
||||
this.mealTimeList=response
|
||||
});
|
||||
this.mealTimeList= [
|
||||
{
|
||||
mealtimeType:"1",
|
||||
mealtimeName:"早餐",
|
||||
},
|
||||
{
|
||||
mealtimeType:"2",
|
||||
mealtimeName:"午餐",
|
||||
},
|
||||
{
|
||||
mealtimeType:"3",
|
||||
mealtimeName:"下午茶",
|
||||
},
|
||||
{
|
||||
mealtimeType:"4",
|
||||
mealtimeName:"晚餐",
|
||||
},
|
||||
{
|
||||
mealtimeType:"5",
|
||||
mealtimeName:"夜宵",
|
||||
}
|
||||
]
|
||||
// mealTimeListApi({}).then(response => {
|
||||
// this.mealTimeList=response
|
||||
// });
|
||||
},
|
||||
//菜谱类型数据
|
||||
getMealTypeList() {
|
||||
menuTypeListApi({}).then(response => {
|
||||
response.data.forEach(item=>{
|
||||
if(item.id==2||item.id==6||item.id==7||item.id==8){
|
||||
this.menuTypeList.push(item)
|
||||
}
|
||||
})
|
||||
// menuTypeListApi({}).then(response => {
|
||||
// response.data.forEach(item=>{
|
||||
// if(item.id==2||item.id==6||item.id==7||item.id==8){
|
||||
// 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
|
||||
});
|
||||
// });
|
||||
},
|
||||
choseMenuType(item){
|
||||
this.bindType = item.bindType
|
||||
|
|
@ -420,18 +443,17 @@
|
|||
/** 查询当前菜谱列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.current = this.queryParams.pageNum
|
||||
this.queryParams.size = this.queryParams.pageSize
|
||||
this.queryParams.pageNum = this.queryParams.pageNum
|
||||
this.queryParams.pageSize = this.queryParams.pageSize
|
||||
if(this.activeName=='currentRecipe'){
|
||||
|
||||
getCurrentRecipeListApi(this.queryParams).then(response => {
|
||||
this.tableListData = response.data.records;
|
||||
this.total = Number(response.data.total);
|
||||
this.tableListData = response.rows;
|
||||
this.total = Number(response.total);
|
||||
this.loading = false;
|
||||
});
|
||||
}else if(this.activeName=='pageRecipe'){
|
||||
getPageRecipeListApi(this.queryParams).then(response => {
|
||||
this.tableListData = response.records;
|
||||
this.tableListData = response.data;
|
||||
this.total = Number(response.total);
|
||||
this.loading = false;
|
||||
});
|
||||
|
|
@ -449,7 +471,7 @@
|
|||
recipeId:row.recipeId
|
||||
}
|
||||
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)} });
|
||||
});
|
||||
|
|
@ -467,7 +489,7 @@
|
|||
handleDelete(row) {
|
||||
console.log(row)
|
||||
this.$modal.confirm('是否确认删除菜谱?').then(function() {
|
||||
return removeMenuRecipeApi([row.recipeId])
|
||||
return removeMenuRecipeApi({"recipeId":row.recipeId})
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
|
|
@ -500,7 +522,7 @@
|
|||
}
|
||||
getPageRecipeListApi(param).then(response => {
|
||||
// console.log(response.records)
|
||||
this.recipeOptionsData = response.records
|
||||
this.recipeOptionsData = response.data
|
||||
this.resetForm("menuForm");
|
||||
this.openMenu=true
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue