修复食谱采购统计问题
This commit is contained in:
parent
ceb0c6e6b1
commit
86bb66a757
@ -33,7 +33,7 @@
|
|||||||
FROM sys_order
|
FROM sys_order
|
||||||
WHERE ${column} IS NOT NULL AND ${column} <> 0 AND del_flag = 0
|
WHERE ${column} IS NOT NULL AND ${column} <> 0 AND del_flag = 0
|
||||||
<if test="reviewStatus != null and reviewStatus != ''">
|
<if test="reviewStatus != null and reviewStatus != ''">
|
||||||
AND review_status = #{reviewStatus}
|
AND review_status = ${reviewStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="beginTime != null and beginTime != ''">AND date_format(order_time,'%y%m%d') >=
|
<if test="beginTime != null and beginTime != ''">AND date_format(order_time,'%y%m%d') >=
|
||||||
date_format(${beginTime},'%y%m%d')
|
date_format(${beginTime},'%y%m%d')
|
||||||
|
@ -5,7 +5,8 @@ const oriState = {
|
|||||||
cusUnitDict: {},
|
cusUnitDict: {},
|
||||||
cusWeightDict: {},
|
cusWeightDict: {},
|
||||||
menuTypeDict: {},
|
menuTypeDict: {},
|
||||||
idgTypeDict: {}
|
idgTypeDict: {},
|
||||||
|
igdUnitDict: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
@ -55,6 +56,13 @@ const actions = {
|
|||||||
}, {});
|
}, {});
|
||||||
commit("updateStateData", { idgTypeDict });
|
commit("updateStateData", { idgTypeDict });
|
||||||
});
|
});
|
||||||
|
getDicts("sys_ingredient_unit").then(response => {
|
||||||
|
const igdUnitDict = response.data.reduce((obj, cur) => {
|
||||||
|
obj[cur.dictLabel] = cur.dictValue;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
commit("updateStateData", { igdUnitDict });
|
||||||
|
});
|
||||||
},
|
},
|
||||||
async fetchFullRecipes({ commit, dispatch }, payload) {
|
async fetchFullRecipes({ commit, dispatch }, payload) {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
|
@ -67,16 +67,12 @@ export default {
|
|||||||
title: "",
|
title: "",
|
||||||
logo: require("@/assets/logo/st_logo.png"),
|
logo: require("@/assets/logo/st_logo.png"),
|
||||||
shoppingCart: {},
|
shoppingCart: {},
|
||||||
igdUnitDict: {
|
|
||||||
鸡蛋: "个",
|
|
||||||
牛奶: "盒",
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showDrawer(obj) {
|
showDrawer(obj) {
|
||||||
const { recipesId, num, label, data } = obj;
|
const { recipesId, num, label, data } = obj;
|
||||||
console.log(obj);
|
// console.log(obj);
|
||||||
this.label = label;
|
this.label = label;
|
||||||
// num < 0 全部计算
|
// num < 0 全部计算
|
||||||
this.title = `${
|
this.title = `${
|
||||||
@ -100,6 +96,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
processShoppingCart(num, data = []) {
|
processShoppingCart(num, data = []) {
|
||||||
|
console.log(data);
|
||||||
this.shoppingCart = data.reduce((obj, cur, idx) => {
|
this.shoppingCart = data.reduce((obj, cur, idx) => {
|
||||||
if (
|
if (
|
||||||
num < 0 || // 全部计算
|
num < 0 || // 全部计算
|
||||||
@ -115,14 +112,14 @@ export default {
|
|||||||
const tarIObj = tarObj.find((zObj) => zObj.name === iObj.name);
|
const tarIObj = tarObj.find((zObj) => zObj.name === iObj.name);
|
||||||
if (tarIObj) {
|
if (tarIObj) {
|
||||||
tarIObj.weight += this.igdUnitDict[iObj.name]
|
tarIObj.weight += this.igdUnitDict[iObj.name]
|
||||||
? iObj.cusWeight
|
? parseInt(iObj.cusWeight)
|
||||||
: iObj.weight;
|
: iObj.weight;
|
||||||
} else {
|
} else {
|
||||||
tarObj.push({
|
tarObj.push({
|
||||||
type: iObj.type,
|
type: iObj.type,
|
||||||
name: iObj.name,
|
name: iObj.name,
|
||||||
weight: this.igdUnitDict[iObj.name]
|
weight: this.igdUnitDict[iObj.name]
|
||||||
? iObj.cusWeight
|
? parseInt(iObj.cusWeight)
|
||||||
: iObj.weight,
|
: iObj.weight,
|
||||||
unit: this.igdUnitDict[iObj.name] || "g",
|
unit: this.igdUnitDict[iObj.name] || "g",
|
||||||
});
|
});
|
||||||
@ -133,7 +130,7 @@ export default {
|
|||||||
type: iObj.type,
|
type: iObj.type,
|
||||||
name: iObj.name,
|
name: iObj.name,
|
||||||
weight: this.igdUnitDict[iObj.name]
|
weight: this.igdUnitDict[iObj.name]
|
||||||
? iObj.cusWeight
|
? parseInt(iObj.cusWeight)
|
||||||
: iObj.weight,
|
: iObj.weight,
|
||||||
unit: this.igdUnitDict[iObj.name] || "g",
|
unit: this.igdUnitDict[iObj.name] || "g",
|
||||||
},
|
},
|
||||||
@ -144,7 +141,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}, {});
|
}, {});
|
||||||
// console.log(this.shoppingCart);
|
console.log(this.shoppingCart);
|
||||||
},
|
},
|
||||||
handleOnBackClick() {
|
handleOnBackClick() {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
@ -153,7 +150,7 @@ export default {
|
|||||||
...mapActions(["fetchFullRecipes"]),
|
...mapActions(["fetchFullRecipes"]),
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["recipes", "idgTypeDict"]),
|
...mapState(["recipes", "idgTypeDict", "igdUnitDict"]),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user