修复菜品修改问题
This commit is contained in:
@ -2,10 +2,12 @@ import { getOrder } from "@/api/custom/order";
|
||||
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
|
||||
import { dealHealthy } from "@/utils/healthyData";
|
||||
import { getRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import { getRecipes } from "@/api/custom/recipes";
|
||||
|
||||
const oriState = {
|
||||
healthyData: {},
|
||||
healthyDataType: 0
|
||||
healthyDataType: 0,
|
||||
recipesData: []
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
@ -13,8 +15,11 @@ const mutations = {
|
||||
state.healthyDataType = payload.healthyDataType;
|
||||
state.healthyData = payload.healthyData;
|
||||
},
|
||||
setRecipesData(state, payload) {
|
||||
state.recipesData = payload.recipesData;
|
||||
},
|
||||
clean(state) {
|
||||
console.log("clean");
|
||||
// console.log("clean");
|
||||
Object.keys(oriState).forEach(key => {
|
||||
state[key] = oriState[key];
|
||||
});
|
||||
@ -28,14 +33,30 @@ const actions = {
|
||||
throw new Error("未找到用户id");
|
||||
}
|
||||
|
||||
// 健康数据
|
||||
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
|
||||
orderResult.data.cusId
|
||||
);
|
||||
// 设置健康数据
|
||||
commit("setHealtyData", {
|
||||
healthyDataType: healthyDataResult.data.type,
|
||||
healthyData: dealHealthy(healthyDataResult.data.customerHealthy)
|
||||
});
|
||||
if (healthyDataResult.code === 200) {
|
||||
commit("setHealtyData", {
|
||||
healthyDataType: healthyDataResult.data.type,
|
||||
healthyData: dealHealthy(healthyDataResult.data.customerHealthy)
|
||||
});
|
||||
} else {
|
||||
throw new Error(healthyDataResult.msg);
|
||||
}
|
||||
|
||||
// 食谱数据
|
||||
if (payload.recipesId) {
|
||||
const recipesDataResult = await getRecipes(payload.recipesId);
|
||||
if (recipesDataResult.code === 200) {
|
||||
commit("setRecipesData", {
|
||||
recipesData: recipesDataResult.data
|
||||
});
|
||||
} else {
|
||||
throw new Error(recipesDataResult.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user