采购计划获取参考价功能

This commit is contained in:
zzyuan 2025-08-13 18:10:25 +08:00
parent ed84a6638e
commit a0c44f9159
2 changed files with 41 additions and 6 deletions

View File

@ -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
})
}
// -------------采购合同---------------

View File

@ -62,6 +62,7 @@
</div>
<div style="display: flex;align-items: center;">
<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>
</div>
</div>
@ -180,7 +181,7 @@
<script>
import { imgUpLoadTwo } from '@/api/system/upload'
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";
export default {
name: "PurchasePlanEdit",
@ -398,8 +399,8 @@ export default {
handleSelectionChange2(selection) {
this.batchChosenMaterial = [];
selection.forEach(item=>{
let obj = Object.assign({}, item)
obj.unitPrice = item.unitPrice/100;
let obj = Object.assign({}, item)
this.$set(obj,"unitPrice",item.unitPrice/100)
this.$set(obj,"purchaseNum",0)
this.batchChosenMaterial.push(obj)
})
@ -418,6 +419,30 @@ export default {
},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(){
this.$refs["baseInfo"].validate(valid => {
@ -523,7 +548,7 @@ export default {
this.loadingBtn=true;
if (this.baseInfo.planId != undefined) {
editPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("修改成功");
this.$modal.msgSuccess("提交成功");
this.loadingBtn=false
this.jumpList()
}).catch(() => {
@ -531,7 +556,7 @@ export default {
});
} else {
addPurchasePlanApi(param).then((response) => {
this.$modal.msgSuccess("保存成功");
this.$modal.msgSuccess("提交成功");
this.loadingBtn=false
this.jumpList()
}).catch(() => {
@ -544,7 +569,6 @@ export default {
}
});
},
//
formatDate(date) {
// YYYY-MM-DD