From 409719cabd65c316a6b04fc6c2c5a731095cea36 Mon Sep 17 00:00:00 2001 From: zzyuan <781948537@qq.com> Date: Wed, 16 Jul 2025 15:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E7=94=9F?= =?UTF-8?q?=E6=88=90=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchaseManage/productionPlan/index.vue | 4 +- .../purchaseManage/purchaseOrder/edit.vue | 8 ++- .../purchaseManage/purchasePlan/index.vue | 65 +++++++++++++------ 3 files changed, 53 insertions(+), 24 deletions(-) diff --git a/src/views/foodManage/purchaseManage/productionPlan/index.vue b/src/views/foodManage/purchaseManage/productionPlan/index.vue index 77db67e8..77cd3f75 100644 --- a/src/views/foodManage/purchaseManage/productionPlan/index.vue +++ b/src/views/foodManage/purchaseManage/productionPlan/index.vue @@ -73,7 +73,7 @@ 直接生成生产计划 按照菜谱生成计划 - 按预订单生成计划 + + 生成采购计划 import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; -import { purchasePlanPageApi, getPurchasePlanInfoApi, addPurchasePlanApi, editPurchasePlanApi, delPurchasePlanApi } from "@/api/foodManage/purchaseManage"; +import { purchasePlanPageApi, getPurchasePlanInfoApi, delPurchasePlanApi,addPurchaseOrderApi } from "@/api/foodManage/purchaseManage"; export default { name: "", @@ -356,19 +356,44 @@ export default { this.$modal.msgSuccess("删除成功"); }).catch(() => {}); }, - // 提交按钮 - confirmSubmit(row){ - let param = Object.assign({},row); - this.loadingBtn=true - param.commitStatus=2 - editPurchasePlanApi(param).then((response) => { - this.$modal.msgSuccess("提交成功"); - this.getList() - this.loadingBtn=false - }).catch(() => { - this.loadingBtn=false - }); - }, + handlePurchaseOrder(row){ + //获取计划详情 + getPurchasePlanInfoApi({planId:row.planId}).then((response) => { + var purchasePlanDetailList = response.data.purchasePlanDetailList + this.$modal.confirm('是否确认生成采购订单?').then(function() { + let param = { + orderTitle:"采购计划单生成采购订单", + purchasePlanCode:row.planCode, + requestArrivalTime:null, + warehouseId:null, + supplierId:null, + areaId:row.areaId, + canteenId:row.canteenId, + stallId:row.stallId, + orderAmount: 0, + totalNum: 0, + orderStatus: 2, + orderGoodsDetailList: [], + remark:"采购计划单生成采购订单", + } + purchasePlanDetailList.forEach(item=>{ + let obj = Object.assign({}, item) + console.log(obj) + obj.singlePrice = Number(item.unitPrice) + obj.orderNum = Number(item.purchaseNum) + obj.totalPrice = (Number(obj.singlePrice)*Number(obj.orderNum)) + param.orderAmount = param.orderAmount+obj.totalPrice; + param.totalNum = param.totalNum+Number(obj.orderNum) + param.orderGoodsDetailList.push(obj) + }) + return addPurchaseOrderApi(param);//新增采购订单 + }).then((res) => { + this.getList(); + this.$router.push({ path: "/foodManage/purchaseManage/orderEdit",query: {purchaseOrderRowData:JSON.stringify(res.data)} }); + }).catch(() => {}); + }); + + }, defaultDateRange() { const end = new Date(new Date().toLocaleDateString()); end.setTime(end.getTime() + 24 * 60 * 60 * 1000 -1);