采购计划获取参考价功能
This commit is contained in:
parent
ed84a6638e
commit
a0c44f9159
|
|
@ -53,6 +53,17 @@ export function dishesConvertApi(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//采购计划获取参考价-根据原料id获取进价接口
|
||||||
|
export function checkMaterialAndPriceApi(data) {
|
||||||
|
return request({
|
||||||
|
url: '/smart-canteen/cook_material/checkMaterialAndPriceVO',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -------------采购合同---------------
|
// -------------采购合同---------------
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex;align-items: center;">
|
<div style="display: flex;align-items: center;">
|
||||||
<el-button type="primary" plain @click="addMaterial">添加货品</el-button>
|
<el-button type="primary" plain @click="addMaterial">添加货品</el-button>
|
||||||
|
<el-button type="primary" @click="checkMaterialPrice">参考价</el-button>
|
||||||
<el-button type="danger" plain @click="delMaterial">删除</el-button>
|
<el-button type="danger" plain @click="delMaterial">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -180,7 +181,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { imgUpLoadTwo } from '@/api/system/upload'
|
import { imgUpLoadTwo } from '@/api/system/upload'
|
||||||
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
|
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
|
||||||
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage";
|
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi,checkMaterialAndPriceApi } from "@/api/foodManage/purchaseManage";
|
||||||
import { getPurchasePlanInfoApi, addPurchasePlanApi, editPurchasePlanApi } from "@/api/foodManage/purchaseManage";
|
import { getPurchasePlanInfoApi, addPurchasePlanApi, editPurchasePlanApi } from "@/api/foodManage/purchaseManage";
|
||||||
export default {
|
export default {
|
||||||
name: "PurchasePlanEdit",
|
name: "PurchasePlanEdit",
|
||||||
|
|
@ -399,7 +400,7 @@ export default {
|
||||||
this.batchChosenMaterial = [];
|
this.batchChosenMaterial = [];
|
||||||
selection.forEach(item=>{
|
selection.forEach(item=>{
|
||||||
let obj = Object.assign({}, item)
|
let obj = Object.assign({}, item)
|
||||||
obj.unitPrice = item.unitPrice/100;
|
this.$set(obj,"unitPrice",item.unitPrice/100)
|
||||||
this.$set(obj,"purchaseNum",0)
|
this.$set(obj,"purchaseNum",0)
|
||||||
this.batchChosenMaterial.push(obj)
|
this.batchChosenMaterial.push(obj)
|
||||||
})
|
})
|
||||||
|
|
@ -418,6 +419,30 @@ export default {
|
||||||
},500)
|
},500)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//获取参考价
|
||||||
|
async checkMaterialPrice(){
|
||||||
|
if(this.batchChosenMaterial.length>0){
|
||||||
|
console.log(this.batchChosenMaterial)
|
||||||
|
let arr = this.batchChosenMaterial.map(item=>item.materialId)
|
||||||
|
let param = {
|
||||||
|
materialIds:arr,
|
||||||
|
type:3
|
||||||
|
}
|
||||||
|
console.log(param)
|
||||||
|
const res = await checkMaterialAndPriceApi(param)
|
||||||
|
if(res.code==200){
|
||||||
|
console.log(res)
|
||||||
|
this.$modal.msgSuccess("获取成功!");
|
||||||
|
res.data.forEach(item=>{
|
||||||
|
let index = this.batchChosenMaterial.findIndex(v=>v.materialId==item.materialId)
|
||||||
|
this.$set(this.batchChosenMaterial[index],"unitPrice",item.unitPrice/100)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.$modal.msgError("请添加货品!");
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
//保存草稿
|
//保存草稿
|
||||||
confirmSave(){
|
confirmSave(){
|
||||||
this.$refs["baseInfo"].validate(valid => {
|
this.$refs["baseInfo"].validate(valid => {
|
||||||
|
|
@ -523,7 +548,7 @@ export default {
|
||||||
this.loadingBtn=true;
|
this.loadingBtn=true;
|
||||||
if (this.baseInfo.planId != undefined) {
|
if (this.baseInfo.planId != undefined) {
|
||||||
editPurchasePlanApi(param).then((response) => {
|
editPurchasePlanApi(param).then((response) => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("提交成功");
|
||||||
this.loadingBtn=false
|
this.loadingBtn=false
|
||||||
this.jumpList()
|
this.jumpList()
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|
@ -531,7 +556,7 @@ export default {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addPurchasePlanApi(param).then((response) => {
|
addPurchasePlanApi(param).then((response) => {
|
||||||
this.$modal.msgSuccess("保存成功");
|
this.$modal.msgSuccess("提交成功");
|
||||||
this.loadingBtn=false
|
this.loadingBtn=false
|
||||||
this.jumpList()
|
this.jumpList()
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|
@ -544,7 +569,6 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
//日期
|
//日期
|
||||||
formatDate(date) {
|
formatDate(date) {
|
||||||
// 格式化为 YYYY-MM-DD
|
// 格式化为 YYYY-MM-DD
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue