!173 修复食谱采购统计问题

Merge pull request !173 from 德仔/develop
This commit is contained in:
德仔 2021-03-26 14:17:12 +08:00 committed by Gitee
commit 6c0796342b
3 changed files with 17 additions and 12 deletions

View File

@ -33,7 +33,7 @@
FROM sys_order
WHERE ${column} IS NOT NULL AND ${column} <> 0 AND del_flag = 0
<if test="reviewStatus != null and reviewStatus != ''">
AND review_status = #{reviewStatus}
AND review_status = ${reviewStatus}
</if>
<if test="beginTime != null and beginTime != ''">AND date_format(order_time,'%y%m%d') &gt;=
date_format(${beginTime},'%y%m%d')

View File

@ -5,7 +5,8 @@ const oriState = {
cusUnitDict: {},
cusWeightDict: {},
menuTypeDict: {},
idgTypeDict: {}
idgTypeDict: {},
igdUnitDict: {}
};
const mutations = {
@ -55,6 +56,13 @@ const actions = {
}, {});
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) {
return new Promise((res, rej) => {

View File

@ -67,16 +67,12 @@ export default {
title: "",
logo: require("@/assets/logo/st_logo.png"),
shoppingCart: {},
igdUnitDict: {
鸡蛋: "个",
牛奶: "盒",
},
};
},
methods: {
showDrawer(obj) {
const { recipesId, num, label, data } = obj;
console.log(obj);
// console.log(obj);
this.label = label;
// num < 0
this.title = `${
@ -100,6 +96,7 @@ export default {
}
},
processShoppingCart(num, data = []) {
console.log(data);
this.shoppingCart = data.reduce((obj, cur, idx) => {
if (
num < 0 || //
@ -115,14 +112,14 @@ export default {
const tarIObj = tarObj.find((zObj) => zObj.name === iObj.name);
if (tarIObj) {
tarIObj.weight += this.igdUnitDict[iObj.name]
? iObj.cusWeight
? parseInt(iObj.cusWeight)
: iObj.weight;
} else {
tarObj.push({
type: iObj.type,
name: iObj.name,
weight: this.igdUnitDict[iObj.name]
? iObj.cusWeight
? parseInt(iObj.cusWeight)
: iObj.weight,
unit: this.igdUnitDict[iObj.name] || "g",
});
@ -133,7 +130,7 @@ export default {
type: iObj.type,
name: iObj.name,
weight: this.igdUnitDict[iObj.name]
? iObj.cusWeight
? parseInt(iObj.cusWeight)
: iObj.weight,
unit: this.igdUnitDict[iObj.name] || "g",
},
@ -144,7 +141,7 @@ export default {
}
return obj;
}, {});
// console.log(this.shoppingCart);
console.log(this.shoppingCart);
},
handleOnBackClick() {
this.visible = false;
@ -153,7 +150,7 @@ export default {
...mapActions(["fetchFullRecipes"]),
},
computed: {
...mapState(["recipes", "idgTypeDict"]),
...mapState(["recipes", "idgTypeDict", "igdUnitDict"]),
},
};
</script>