采购计划生成采购订单
This commit is contained in:
parent
f0e0d9faa8
commit
409719cabd
|
|
@ -73,7 +73,7 @@
|
|||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="1">直接生成生产计划</el-dropdown-item>
|
||||
<el-dropdown-item command="2">按照菜谱生成计划</el-dropdown-item>
|
||||
<el-dropdown-item command="3">按预订单生成计划</el-dropdown-item>
|
||||
<!-- <el-dropdown-item command="3">按预订单生成计划</el-dropdown-item> -->
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<!-- <el-button
|
||||
|
|
@ -405,7 +405,7 @@ export default {
|
|||
let param = {
|
||||
"status": 1,
|
||||
"purchaseDate": this.formatDateTime(new Date()),
|
||||
"productionPlanId": this.rowData.planId,
|
||||
"productionPlanId": this.rowData.productionPlanCode,
|
||||
"areaId": this.rowData.areaId,
|
||||
"canteenId": this.rowData.canteenId,
|
||||
"stallId": this.rowData.stallId,
|
||||
|
|
|
|||
|
|
@ -487,7 +487,9 @@ export default {
|
|||
if (valid) {
|
||||
let param = Object.assign({},this.baseInfo);
|
||||
param.requestArrivalTime = this.formatDate(this.baseInfo.requestArrivalTime)
|
||||
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
|
||||
if(this.baseInfo.payMoneyDate){
|
||||
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
|
||||
}
|
||||
param.orderAmount=0
|
||||
param.totalNum=0
|
||||
param.orderStatus=1
|
||||
|
|
@ -548,7 +550,9 @@ export default {
|
|||
if (valid) {
|
||||
let param = Object.assign({},this.baseInfo);
|
||||
param.requestArrivalTime = this.formatDate(this.baseInfo.requestArrivalTime)
|
||||
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
|
||||
if(this.baseInfo.payMoneyDate){
|
||||
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
|
||||
}
|
||||
param.orderAmount=0
|
||||
param.totalNum=0
|
||||
param.orderStatus=2
|
||||
|
|
|
|||
|
|
@ -115,12 +115,12 @@
|
|||
icon="el-icon-edit" v-if="scope.row.status==2"
|
||||
@click="handleView(scope.row)"
|
||||
>详情</el-button>
|
||||
<!-- <el-button
|
||||
size="mini" v-if="scope.row.status==1"
|
||||
type="text" :disabled="loadingBtn"
|
||||
icon="el-icon-top"
|
||||
@click="confirmSubmit(scope.row)"
|
||||
>提交</el-button> -->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit" v-if="scope.row.status==2"
|
||||
@click="handlePurchaseOrder(scope.row)"
|
||||
>生成采购计划</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
|
@ -158,7 +158,7 @@
|
|||
|
||||
<script>
|
||||
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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue