You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
741 lines
34 KiB
741 lines
34 KiB
<script>
|
|
import {queryQuoteDetailAllCost} from "../../../../../api/quote/quoteDetail";
|
|
import {Decimal} from "decimal.js";
|
|
import DictDataSelect from "../../../sys/dict-data-select.vue";
|
|
|
|
export default {
|
|
name: "quoteDetailCost",
|
|
components: {DictDataSelect},
|
|
props: {
|
|
quoteDetail: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
},
|
|
model: {
|
|
prop: "quoteDetail",
|
|
event: "update",
|
|
},
|
|
data(){
|
|
return {
|
|
computeLoading:false,
|
|
quoteDetail: {
|
|
id: null,
|
|
otherCost: null,
|
|
elseCost: null,
|
|
machineCost: null,
|
|
profitAmount: null,
|
|
totalPrice: null,
|
|
adjustToolCost: null,
|
|
adjustLabourCost: null,
|
|
currencyTotalCost1: null,
|
|
adjustBomUnYield: null,
|
|
currencyTotalCost2: null,
|
|
toolCost: null,
|
|
quoteCurrencyTotalCost1: null,
|
|
adjustElseCost: null,
|
|
quoteCurrencyTotalCost2: null,
|
|
unitPrice: null,
|
|
quoteProfitRate: null,
|
|
testCost: null,
|
|
shippingCost: null,
|
|
taxTotalPrice: null,
|
|
quoteProfitAmount: null,
|
|
adjustFabricateCost: null,
|
|
adjustTestCost: null,
|
|
profitRate: null,
|
|
partCost: null,
|
|
calculatedItems: null,
|
|
adjustMachineCost: null,
|
|
taxUnitPrice: null,
|
|
manageCost: null,
|
|
taxRate: null,
|
|
quoteTaxTotalPrice: null,
|
|
labourCost: null,
|
|
fabricateCost: null,
|
|
currency1: null,
|
|
bomUnYield: null,
|
|
currency2: null,
|
|
exchangeRate1: null,
|
|
exchangeRate2: null,
|
|
packCost: null,
|
|
quoteTaxRate: null,
|
|
totalCost: null,
|
|
adjustPartCost: null,
|
|
status: '',
|
|
},
|
|
rules:{
|
|
adjustPartCost: [
|
|
{ required: true, message: "请输入材料成本", trigger: ["blur","change"] }
|
|
],
|
|
adjustBomUnYield: [
|
|
{ required: true, message: "请输入实际成本", trigger: ["blur","change"] }
|
|
],
|
|
adjustMachineCost: [
|
|
{ required: true, message: "请输入机器成本", trigger: ["blur","change"] }
|
|
],
|
|
adjustFabricateCost: [
|
|
{ required: true, message: "请输入制造费用成本", trigger: ["blur","change"] }
|
|
],
|
|
adjustLabourCost: [
|
|
{ required: true, message: "请输入人工成本", trigger: ["blur","change"] }
|
|
],
|
|
adjustToolCost: [
|
|
{ required: true, message: "请输入工具成本", trigger: ["blur","change"] }
|
|
],
|
|
adjustTestCost: [
|
|
{ required: true, message: "请输入测试成本", trigger: ["blur","change"] }
|
|
],
|
|
adjustElseCost: [
|
|
{ required: true, message: "请输入其他成本", trigger: ["blur","change"] }
|
|
],
|
|
manageCost: [
|
|
{ required: true, message: "请输入管理成本", trigger: ["blur","change"] }
|
|
],
|
|
otherCost: [
|
|
{ required: true, message: "请输入包装&运输成本", trigger: ["blur","change"] }
|
|
],
|
|
profitRate: [
|
|
{ required: true, message: "请输入利润率", trigger: ["blur","change"] }
|
|
],
|
|
quoteProfitRate: [
|
|
{ required: true, message: "请输入报价利润率", trigger: ["blur","change"] }
|
|
],
|
|
taxRate: [
|
|
{ required: true, message: "请输入税率", trigger: ["blur","change"] }
|
|
],
|
|
quoteTaxRate: [
|
|
{ required: true, message: "请输入报价税率", trigger: ["blur","change"] }
|
|
],
|
|
},
|
|
|
|
showQuoteCost:false,
|
|
isShowCost:true,
|
|
isShowOtherCost:true,
|
|
isShowRatePrice:true,
|
|
|
|
tagNo:undefined,
|
|
type:undefined,
|
|
|
|
allCheckedLabel:['工具','测试','包装','运输','其他'],
|
|
// selectionChecked:[],
|
|
checkAll:false,
|
|
|
|
selection:undefined,
|
|
|
|
totalPartCost:0,
|
|
totalElseCost:0,
|
|
|
|
editInput:'VA',
|
|
}
|
|
},
|
|
methods:{
|
|
computeCurrencyTotalCost(){
|
|
// if (this.quoteDetail.exchangeRate1 && this.quoteDetail.exchangeRate1 > 0){
|
|
// this.quoteDetail.currencyTotalCost1 = new Decimal(this.quoteDetail.totalCost).div(this.quoteDetail.exchangeRate1).toNumber();
|
|
// }
|
|
// if (this.quoteDetail.exchangeRate2 && this.quoteDetail.exchangeRate2 > 0){
|
|
// this.quoteDetail.currencyTotalCost2 = new Decimal(this.quoteDetail.totalCost).div(this.quoteDetail.exchangeRate2).toNumber();
|
|
// }
|
|
// 特殊处理
|
|
if (this.quoteDetail.exchangeRate2 && this.quoteDetail.exchangeRate2 > 0){
|
|
this.quoteDetail.currencyTotalCost2 = new Decimal(this.quoteDetail.taxUnitPrice).div(this.quoteDetail.exchangeRate2).toNumber()
|
|
}else {
|
|
this.quoteDetail.currencyTotalCost2 = 0
|
|
}
|
|
},
|
|
computeTotalCost(){
|
|
// 标准总成本
|
|
this.quoteDetail.totalCost =
|
|
this.quoteDetail.adjustPartCost +
|
|
this.quoteDetail.adjustMachineCost +
|
|
this.quoteDetail.adjustLabourCost;
|
|
if (this.selectionChecked.includes('其他')){
|
|
this.quoteDetail.totalCost += this.quoteDetail.adjustElseCost;
|
|
}
|
|
if (this.selectionChecked.includes('工具')){
|
|
this.quoteDetail.totalCost += this.quoteDetail.adjustToolCost;
|
|
}
|
|
if (this.selectionChecked.includes('测试')){
|
|
this.quoteDetail.totalCost += this.quoteDetail.adjustTestCost;
|
|
}
|
|
if (this.selectionChecked.includes('包装')){
|
|
this.quoteDetail.totalCost += this.quoteDetail.packCost;
|
|
}
|
|
if (this.selectionChecked.includes('运输')){
|
|
this.quoteDetail.totalCost += this.quoteDetail.shippingCost;
|
|
}
|
|
// this.quoteDetail.totalCost += this.quoteDetail.adjustElseCost;
|
|
// this.quoteDetail.totalCost += this.quoteDetail.adjustToolCost;
|
|
// this.quoteDetail.totalCost += this.quoteDetail.adjustTestCost;
|
|
// this.quoteDetail.totalCost += this.quoteDetail.packCost;
|
|
// this.quoteDetail.totalCost += this.quoteDetail.shippingCost;
|
|
|
|
// if (this.selectionChecked.includes('包装&运输')){
|
|
// this.quoteDetail.totalCost += this.quoteDetail.otherCost;
|
|
// }
|
|
// 计算成本
|
|
this.computedTotalPartCost();//计算总物料成本和其他额外成本
|
|
this.computeMarkup();// 计算利润
|
|
this.computeProfitAmount(); // 计算 CNY
|
|
this.computeCurrencyTotalCost();//计算外汇成本
|
|
},
|
|
computeMarkup(){
|
|
let val = 0;
|
|
let editInput = this.editInput.toLowerCase();
|
|
if (editInput === 'va'){
|
|
val = this.quoteDetail.quoteProfitRate
|
|
}else if (editInput === 'contribution'){
|
|
val = this.quoteDetail.quoteProfitAmount
|
|
}else if (editInput === 'margin'){
|
|
val = this.quoteDetail.quoteTaxRate
|
|
}else if (editInput === 'price'){
|
|
val = this.quoteDetail.quoteTaxTotalPrice
|
|
}
|
|
this.computePriceByRate(val,editInput)
|
|
},
|
|
computeProfitAmount(){
|
|
this.quoteDetail.profitAmount =
|
|
this.quoteDetail.totalCost * (this.quoteDetail.profitRate / 100);
|
|
this.computeTaxCost();
|
|
},
|
|
computeTaxCost(){
|
|
this.quoteDetail.totalPrice =
|
|
this.quoteDetail.totalCost + this.quoteDetail.profitAmount;
|
|
this.quoteDetail.unitPrice =
|
|
this.quoteDetail.quoteTaxTotalPrice ;
|
|
this.quoteDetail.taxTotalPrice =
|
|
this.quoteDetail.unitPrice + this.quoteDetail.unitPrice * ((this.quoteDetail.taxRate+this.quoteDetail.exchangeRate1) / 100);
|
|
this.quoteDetail.taxUnitPrice =
|
|
this.quoteDetail.taxTotalPrice ;
|
|
this.computeCurrencyTotalCost();
|
|
},
|
|
handleQueryAllCost(){
|
|
let params = {
|
|
...this.quoteDetail
|
|
}
|
|
this.computeLoading = true
|
|
queryQuoteDetailAllCost(params).then(({data})=>{
|
|
if (data && data.code === 0){
|
|
this.quoteDetail.partCost = data.row.unitQuotePrice;// 标准成本
|
|
this.quoteDetail.adjustPartCost = data.row.unitQuotePrice;
|
|
this.quoteDetail.bomUnYield = data.row.actualQuotePrice;//实际成本
|
|
this.quoteDetail.adjustBomUnYield = data.row.actualQuotePrice;
|
|
this.quoteDetail.labourCost = data.row.labourCost;
|
|
this.quoteDetail.adjustLabourCost = data.row.labourCost;
|
|
this.quoteDetail.machineCost = data.row.machineCost;
|
|
this.quoteDetail.adjustMachineCost = data.row.machineCost;
|
|
this.quoteDetail.fabricateCost = data.row.manufactureCost;
|
|
this.quoteDetail.adjustFabricateCost = data.row.manufactureCost;
|
|
this.quoteDetail.toolCost = data.row.toolCost;
|
|
this.quoteDetail.adjustToolCost = data.row.toolCost;
|
|
this.quoteDetail.testCost = data.row.testCost;
|
|
this.quoteDetail.adjustTestCost = data.row.testCost;
|
|
this.quoteDetail.elseCost = data.row.elseCost;
|
|
this.quoteDetail.adjustElseCost = data.row.elseCost;
|
|
this.quoteDetail.packCost = data.row.packCost;
|
|
this.quoteDetail.shippingCost = data.row.shippingCost;
|
|
this.quoteDetail.otherCost = data.row.otherCost;
|
|
|
|
this.computedTotalPartCost();// 重新计算成本
|
|
}else {
|
|
this.$message.warning(data.msg);
|
|
}
|
|
this.computeLoading = false
|
|
}).catch((error)=>{
|
|
this.$message.error(error);
|
|
this.computeLoading = false
|
|
})
|
|
},
|
|
changeAllCheck(val){
|
|
if (val){
|
|
this.selectionChecked = [...this.allCheckedLabel]
|
|
}else {
|
|
this.selectionChecked = [];
|
|
}
|
|
},
|
|
computedTotalPartCost(){
|
|
this.totalPartCost = this.quoteDetail.adjustPartCost;
|
|
if (this.selectionChecked.includes('工具')){
|
|
this.totalPartCost += this.quoteDetail.adjustToolCost;
|
|
}
|
|
if (this.selectionChecked.includes('测试')){
|
|
this.totalPartCost += this.quoteDetail.adjustTestCost;
|
|
}
|
|
if (this.selectionChecked.includes('其他')){
|
|
this.totalPartCost += this.quoteDetail.adjustElseCost;
|
|
}
|
|
if (this.selectionChecked.includes('包装')){
|
|
this.totalPartCost += this.quoteDetail.packCost;
|
|
}
|
|
if (this.selectionChecked.includes('运输')){
|
|
this.totalPartCost += this.quoteDetail.shippingCost;
|
|
}
|
|
this.totalElseCost = 0;
|
|
if (!this.selectionChecked.includes('工具')){
|
|
this.totalElseCost += this.quoteDetail.adjustToolCost;
|
|
}
|
|
if (!this.selectionChecked.includes('测试')){
|
|
this.totalElseCost += this.quoteDetail.adjustTestCost;
|
|
}
|
|
if (!this.selectionChecked.includes('其他')){
|
|
this.totalElseCost += this.quoteDetail.adjustElseCost;
|
|
}
|
|
if (!this.selectionChecked.includes('包装')){
|
|
this.totalElseCost += this.quoteDetail.packCost;
|
|
}
|
|
if (!this.selectionChecked.includes('运输')){
|
|
this.totalElseCost += this.quoteDetail.shippingCost;
|
|
}
|
|
},
|
|
computePriceByRate(val,type){
|
|
if (val === undefined || val === null){
|
|
return;
|
|
}
|
|
let value = 0;
|
|
// 公式包含Tool +测试+其他+包装+运输
|
|
let otherCost = this.quoteDetail.toolCost + this.quoteDetail.testCost + this.quoteDetail.elseCost + this.quoteDetail.packCost + this.quoteDetail.shippingCost
|
|
let partCost = this.quoteDetail.toolCost + this.quoteDetail.adjustPartCost + this.quoteDetail.packCost + this.quoteDetail.shippingCost
|
|
// 其他成本 + 材料成本 + 机器成本 + 人工成本
|
|
let ttlCost = otherCost + this.quoteDetail.adjustPartCost + this.quoteDetail.adjustMachineCost + this.quoteDetail.adjustLabourCost;
|
|
switch (type){
|
|
case 'va':
|
|
value = this.quoteDetail.quoteProfitRate/100
|
|
if (1-value === 0){
|
|
return;
|
|
}
|
|
//price = (物料成本+工具成本+运输成本+包装成本)/(1-value)+其他额外成本
|
|
// this.quoteDetail.quoteTaxTotalPrice = (this.quoteDetail.adjustPartCost + otherCost)/(1-value)+this.totalElseCost
|
|
this.quoteDetail.quoteTaxTotalPrice = (partCost)/(1-value)+this.totalElseCost
|
|
// contribution = 1-(物料成本+人工成本+工具成本+运输成本+包装成本)/(price-额外其他成本)
|
|
// this.quoteDetail.quoteProfitAmount = (1-(this.quoteDetail.adjustPartCost + this.quoteDetail.adjustLabourCost + otherCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
this.quoteDetail.quoteProfitAmount = (1-(this.quoteDetail.adjustLabourCost + partCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
// margin = (price-额外其他成本-总成本)/(price-额外其他成本)
|
|
// this.quoteDetail.quoteTaxRate = ((this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost - ttlCost)/(this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost))*100
|
|
this.quoteDetail.quoteTaxRate=((this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost - this.quoteDetail.totalCost)/(this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost))*100
|
|
break;
|
|
case 'contribution':
|
|
value = this.quoteDetail.quoteProfitAmount/100
|
|
//price = (物料成本+工具成本+运输成本+包装成本+人工成本)/(1-value)+其他额外成本
|
|
// this.quoteDetail.quoteTaxTotalPzorice = (this.quoteDetail.adjustPartCost + this.quoteDetail.adjustLabourCost + otherCost)/(1-value)+this.totalElseCost
|
|
// this.quoteDetail.quoteTaxTotalPrice = (partCost + this.quoteDetail.adjustLabourCost)/(1-this.quoteDetail.quoteProfitAmount)+this.totalElseCost
|
|
this.quoteDetail.quoteTaxTotalPrice = (partCost + this.quoteDetail.adjustLabourCost)/(1-value)+this.totalElseCost
|
|
// va = 1-(物料成本+工具成本+运输成本+包装成本)/(price-额外其他成本)
|
|
// this.quoteDetail.quoteProfitRate = (1-(this.quoteDetail.adjustPartCost + otherCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
this.quoteDetail.quoteProfitRate = (1-(partCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
// margin = (price-额外其他成本-总成本)/(price-额外其他成本)
|
|
// this.quoteDetail.quoteTaxRate=((this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost - ttlCost)/(this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost))*100
|
|
this.quoteDetail.quoteTaxRate=((this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost - this.quoteDetail.totalCost)/(this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost))*100
|
|
break;
|
|
case 'margin':
|
|
value = this.quoteDetail.quoteTaxRate/100
|
|
// price = 总成本/(1-value)+其他额外成本
|
|
// this.quoteDetail.quoteTaxTotalPrice = ttlCost/(1-value)+this.totalElseCost
|
|
// this.quoteDetail.quoteTaxTotalPrice = ttlCost1/(1-this.quoteDetail.quoteTaxRate)+this.totalElseCost
|
|
this.quoteDetail.quoteTaxTotalPrice = ttlCost1/(1-value)+this.totalElseCost
|
|
// va = 1-(物料成本+工具成本+运输成本+包装成本)/(price-额外其他成本)
|
|
// this.quoteDetail.quoteProfitRate = (1-(this.quoteDetail.adjustPartCost + otherCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
this.quoteDetail.quoteProfitRate = (1-(partCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
// contribution = 1-(物料成本+人工成本+工具成本+运输成本+包装成本)/(price-额外其他成本)
|
|
// this.quoteDetail.quoteProfitAmount = (1-(this.quoteDetail.adjustPartCost + this.quoteDetail.adjustLabourCost + otherCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
this.quoteDetail.quoteProfitAmount = (1-(this.quoteDetail.adjustLabourCost + partCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
break;
|
|
case 'price':
|
|
value = this.quoteDetail.quoteTaxTotalPrice
|
|
// va = 1-(物料成本+工具成本+运输成本+包装成本)/(value-额外其他成本)
|
|
// this.quoteDetail.quoteProfitRate = (1-(this.quoteDetail.adjustPartCost + otherCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
this.quoteDetail.quoteProfitRate = (1-(partCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
// contribution = 1-(物料成本+人工成本+工具成本+运输成本+包装成本)/(value-额外其他成本)
|
|
// this.quoteDetail.quoteProfitAmount = (1-(this.quoteDetail.adjustPartCost + this.quoteDetail.adjustLabourCost + otherCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
this.quoteDetail.quoteProfitAmount = (1-(this.quoteDetail.adjustLabourCost + partCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100
|
|
// margin = (value-额外其他成本-总成本)/(value-额外其他成本)
|
|
// this.quoteDetail.quoteTaxRate=((this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost - ttlCost)/(this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost))*100
|
|
this.quoteDetail.quoteTaxRate=((this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost - this.quoteDetail.totalCost)/(this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost))*100
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
watch:{
|
|
'quoteDetail.adjustPartCost'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.$set(this.quoteDetail, 'adjustPartCost', 0);
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.adjustMachineCost'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.adjustMachineCost = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.adjustFabricateCost'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.adjustFabricateCost = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.adjustLabourCost'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.adjustLabourCost = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.adjustToolCost'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.adjustToolCost = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.adjustTestCost'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.adjustTestCost = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.adjustElseCost'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.adjustElseCost = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.manageCost'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.manageCost = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.otherCost'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.otherCost = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.profitRate'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.profitRate = 0;
|
|
}
|
|
// this.quoteDetail.quoteProfitRate = newValue;
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.taxRate'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.taxRate = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.exchangeRate1'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.exchangeRate1 = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.exchangeRate2'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.exchangeRate2 = 0;
|
|
}
|
|
this.computeTotalCost();
|
|
},
|
|
'quoteDetail.quoteCurrencyTotalCost1'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.quoteCurrencyTotalCost1 = 0;
|
|
}
|
|
},
|
|
'quoteDetail.quoteCurrencyTotalCost2'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.quoteCurrencyTotalCost2 = 0;
|
|
}
|
|
},
|
|
'quoteDetail.currencyTotalCost1'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.currencyTotalCost1 = 0;
|
|
}
|
|
},
|
|
'quoteDetail.currencyTotalCost2'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.currencyTotalCost2 = 0;
|
|
}
|
|
},
|
|
'quoteDetail.quoteTaxTotalPrice'(newValue, oldValue){
|
|
if (newValue === undefined || newValue === null){
|
|
this.quoteDetail.quoteTaxTotalPrice = 0;
|
|
}
|
|
this.computeTaxCost();
|
|
},
|
|
'quoteDetail.currency1'(newValue, oldValue){
|
|
this.quoteDetail.currency2 = newValue;
|
|
},
|
|
selectionChecked(newVal,oldVal){
|
|
if (newVal.length === this.allCheckedLabel.length){
|
|
this.checkAll = true;
|
|
}else {
|
|
this.checkAll = false;
|
|
}
|
|
},
|
|
},
|
|
computed:{
|
|
selectionChecked:{
|
|
set(newVal){
|
|
this.selection = newVal.join(',')
|
|
this.quoteDetail.calculatedItems = this.selection;
|
|
this.computeTotalCost();
|
|
},
|
|
get(){
|
|
if (this.selection === '' || this.selection === undefined || this.selection === null){
|
|
return []
|
|
}
|
|
return this.selection.split(',')
|
|
}
|
|
},
|
|
unitPrice(){
|
|
if (this.quoteDetail.exchangeRate2 === 0){
|
|
return 0
|
|
}
|
|
return this.quoteDetail.unitPrice/this.quoteDetail.exchangeRate2
|
|
}
|
|
},
|
|
mounted() {
|
|
if (this.quoteDetail.calculatedItems){
|
|
this.selection = this.quoteDetail.calculatedItems;
|
|
}
|
|
this.$nextTick(()=>{
|
|
this.computeProfitAmount()
|
|
this.computedTotalPartCost();// 重新计算成本
|
|
})
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<template v-if="isAuth('5011:detail:tab7:compute')">
|
|
<el-button :loading="computeLoading" style="margin-right: 10px" type="primary" :disabled="quoteDetail.status === '下达'" @click="handleQueryAllCost"> 计 算</el-button>
|
|
</template>
|
|
<el-popover
|
|
placement="bottom-start"
|
|
width="100"
|
|
trigger="hover">
|
|
<div>
|
|
<el-checkbox :indeterminate="selectionChecked.length > 0 && selectionChecked.length < allCheckedLabel.length" v-model="checkAll" @change="changeAllCheck"> 全选 </el-checkbox>
|
|
</div>
|
|
<el-checkbox-group v-model="selectionChecked">
|
|
<div v-for="label in allCheckedLabel">
|
|
<el-checkbox :label="label" :key="label">{{label}}</el-checkbox>
|
|
</div>
|
|
</el-checkbox-group>
|
|
<a slot="reference">计入材料成本</a>
|
|
</el-popover>
|
|
<!--系统自动计算结果-->
|
|
<el-form :model="quoteDetail" ref="costForm" :rules="rules" label-position="top" label-width="120px">
|
|
<div style="display: flex">
|
|
<fieldset v-show="isShowCost"
|
|
style="margin-top: 5px;border: 1px solid #777;width: 50%">
|
|
<legend>系统自动计算结果(料工费)</legend>
|
|
<el-row :gutter="10" >
|
|
<el-col :span="8" v-show="!showQuoteCost">
|
|
<el-form-item label="材料成本:" prop="partCost" :show-message="false">
|
|
<el-input-number style="width: 100%; " :controls="false" v-model="quoteDetail.partCost" :precision="4" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="机器成本:" prop="machineCost" :show-message="false">
|
|
<el-input-number style="width: 100%; " :controls="false"
|
|
v-model="quoteDetail.machineCost" :precision="4" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="人工成本:" prop="labourCost" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.labourCost" :precision="4" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</fieldset>
|
|
<fieldset
|
|
style="margin-top: 5px;border: 1px solid #777;width: 50%">
|
|
<legend>调整后成本(料工费)</legend>
|
|
<el-row :gutter="10" >
|
|
<el-col :span="8" v-show="!showQuoteCost">
|
|
<el-form-item label="材料成本:" prop="adjustPartCost" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.adjustPartCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="机器成本:" prop="adjustMachineCost" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.adjustMachineCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="人工成本:" prop="adjustLabourCost" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.adjustLabourCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</fieldset>
|
|
</div>
|
|
<fieldset style="margin-top: 5px;border: 1px solid #777;">
|
|
<legend>其他成本</legend>
|
|
<el-row :gutter="10" >
|
|
<el-col :span="4">
|
|
<el-form-item label="工具成本:" prop="toolCost" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.toolCost" :precision="4" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="测试成本:" prop="testCost" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.testCost" :precision="4" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="包装成本:">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.packCost" :step="0" :precision="4" :min="0" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="运输成本:">
|
|
<el-input-number style="width: 100%; " :controls="false"
|
|
v-model="quoteDetail.shippingCost" :step="0" :precision="4" :min="0" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="其他成本:" prop="elseCost" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.elseCost" :precision="4" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</fieldset>
|
|
<fieldset style="margin-top: 5px;border: 1px solid #777;">
|
|
<legend>总成本</legend>
|
|
<el-row :gutter="10" >
|
|
<el-col :span="4">
|
|
<el-form-item label="总成本:" prop="totalCost" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.totalCost" :step="0" :precision="4" :min="0" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="总材料成本:" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="totalPartCost" :step="0" :precision="4" :min="0" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="额外添加其他成本:" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="totalElseCost" :step="0" :precision="4" :min="0" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</fieldset>
|
|
<fieldset style="margin-top: 5px;border: 1px solid #777;">
|
|
<legend>利润</legend>
|
|
<el-row :gutter="10" >
|
|
<!-- <el-col :span="4">-->
|
|
<!-- <el-form-item label="利润率%:" prop="profitRate" :show-message="false">-->
|
|
<!-- <el-input-number style="width: 100%;" :controls="false"-->
|
|
<!-- v-model="quoteDetail.profitRate" :disabled="quoteDetail.status === '下达'" :step="0" :min="0"/>-->
|
|
<!-- </el-form-item>-->
|
|
<!-- </el-col>-->
|
|
<!-- <el-col :span="4">-->
|
|
<!-- <el-form-item label="利润额:" prop="profitAmount" :show-message="false">-->
|
|
<!-- <el-input-number style="width: 100%;" :controls="false"-->
|
|
<!-- v-model="quoteDetail.profitAmount" :step="0" :precision="4" :min="0" disabled/>-->
|
|
<!-- </el-form-item>-->
|
|
<!-- </el-col>-->
|
|
<el-col :span="4">
|
|
<el-form-item label="VA%" :show-message="false">
|
|
<el-input-number style="width: 60%;" @blur="(value)=>computePriceByRate(value,'va')" :controls="false"
|
|
v-model="quoteDetail.quoteProfitRate" :disabled="quoteDetail.status === '下达' || editInput !== 'VA'" :step="0" :precision="0"/>
|
|
<el-link v-if="editInput !== 'VA' && quoteDetail.status === '草稿'" @click="editInput = 'VA'"><i class="el-icon-edit"></i></el-link>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="Contribution%" :show-message="false">
|
|
<el-input-number style="width: 60%;" @blur="(value)=>computePriceByRate(value,'contribution')" :controls="false"
|
|
v-model="quoteDetail.quoteProfitAmount" :disabled="quoteDetail.status === '下达' || editInput !== 'Contribution'" :step="0" :precision="0"/>
|
|
<el-link v-if="editInput !== 'Contribution' && quoteDetail.status === '草稿'" @click="editInput = 'Contribution'"><i class="el-icon-edit"></i></el-link>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="Margin%" :show-message="false">
|
|
<el-input-number style="width: 60%;" @blur="(value)=>computePriceByRate(value,'margin')" :controls="false"
|
|
v-model="quoteDetail.quoteTaxRate" :disabled="quoteDetail.status === '下达' || editInput !== 'Margin'" :step="0" :precision="0"/>
|
|
<el-link v-if="editInput !== 'Margin' && quoteDetail.status === '草稿'" @click="editInput = 'Margin'"><i class="el-icon-edit"></i></el-link>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="Price ¥(ex VAT)" :show-message="false">
|
|
<el-input-number style="width: 60%;" @blur="(value)=>computePriceByRate(value,'price')" :controls="false"
|
|
v-model="quoteDetail.quoteTaxTotalPrice" :disabled="quoteDetail.status === '下达'|| editInput !== 'Price'" :step="0" :min="0" :precision="4"/>
|
|
<el-link v-if="editInput !== 'Price' && quoteDetail.status === '草稿'" @click="editInput = 'Price'"><i class="el-icon-edit"></i></el-link>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</fieldset>
|
|
<fieldset style="margin-top: 5px;border: 1px solid #777;">
|
|
<legend>最终价格</legend>
|
|
<el-row :gutter="10">
|
|
<el-col :span="4">
|
|
<el-form-item label="未税单价(CNY):" prop="unitPrice" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.unitPrice" :step="0" :min="0" :precision="4" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="税率%:" prop="taxRate" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.taxRate" :disabled="quoteDetail.status === '下达'" :step="0" :min="0"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="其他税率%:" prop="exchangeRate1" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.exchangeRate1" :disabled="quoteDetail.status === '下达'" :step="0" :min="0"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="含税单价(CNY):" prop="taxUnitPrice" :show-message="false">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.taxUnitPrice" :step="0" :precision="4" :min="0" disabled/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="10">
|
|
<el-col :span="4">
|
|
<el-form-item label="未税单价">
|
|
<el-input-number style="width: 100%;" v-model="unitPrice" :controls="false" :step="0" :precision="4" :min="0" disabled></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="币种:">
|
|
<dict-data-select v-model="quoteDetail.currency2" disabled
|
|
clearable dict-type="plm_customer_information_customer_customer_currency" :use-default-value="true"></dict-data-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="汇率:">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.exchangeRate2" :disabled="quoteDetail.status === '下达'" :step="0" :min="0"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="含税单价:">
|
|
<el-input-number style="width: 100%;" :controls="false"
|
|
v-model="quoteDetail.currencyTotalCost2" disabled :step="0" :min="0" :precision="4"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</fieldset>
|
|
</el-form>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|