|
|
|
@ -72,7 +72,7 @@ export default { |
|
|
|
tagNo:undefined, |
|
|
|
type:undefined, |
|
|
|
|
|
|
|
allCheckedLabel:['工具','测试','其他','包装','运输'], |
|
|
|
allCheckedLabel:['工具','测试','包装','运输','其他'], |
|
|
|
// selectionChecked:[], |
|
|
|
checkAll:false, |
|
|
|
|
|
|
|
@ -80,6 +80,8 @@ export default { |
|
|
|
|
|
|
|
totalPartCost:0, |
|
|
|
totalElseCost:0, |
|
|
|
|
|
|
|
editInput:'VA', |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
@ -103,24 +105,31 @@ export default { |
|
|
|
this.quoteDetail.adjustFabricateCost + |
|
|
|
this.quoteDetail.adjustLabourCost + |
|
|
|
this.quoteDetail.manageCost; |
|
|
|
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; |
|
|
|
} |
|
|
|
// 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.computeProfitAmount(); |
|
|
|
this.computeCurrencyTotalCost(); |
|
|
|
}, |
|
|
|
@ -129,11 +138,6 @@ export default { |
|
|
|
this.quoteDetail.totalCost * (this.quoteDetail.profitRate / 100); |
|
|
|
this.computeTaxCost(); |
|
|
|
}, |
|
|
|
computeQuoteProfitAmount(){ |
|
|
|
this.quoteDetail.quoteProfitAmount = |
|
|
|
this.quoteDetail.quoteTotalCost * (this.quoteDetail.quoteProfitRate / 100); |
|
|
|
this.computeQuoteTaxCost(); |
|
|
|
}, |
|
|
|
computeTaxCost(){ |
|
|
|
this.quoteDetail.totalPrice = |
|
|
|
this.quoteDetail.totalCost + this.quoteDetail.profitAmount; |
|
|
|
@ -145,16 +149,6 @@ export default { |
|
|
|
this.quoteDetail.taxTotalPrice / this.quoteDetail.qty; |
|
|
|
this.computeCurrencyTotalCost(); |
|
|
|
}, |
|
|
|
computeQuoteTaxCost(){ |
|
|
|
this.quoteDetail.quoteTotalPrice = |
|
|
|
this.quoteDetail.quoteTotalCost + this.quoteDetail.quoteProfitAmount; |
|
|
|
this.quoteDetail.quoteUnitPrice = |
|
|
|
this.quoteDetail.quoteTotalPrice / this.quoteDetail.qty; |
|
|
|
this.quoteDetail.quoteTaxTotalPrice = |
|
|
|
this.quoteDetail.quoteTotalPrice + this.quoteDetail.quoteTotalPrice * (this.quoteDetail.quoteTaxRate+this.quoteDetail.exchangeRate1 / 100); |
|
|
|
this.quoteDetail.quoteTaxUnitPrice = |
|
|
|
this.quoteDetail.quoteTaxTotalPrice / this.quoteDetail.qty; |
|
|
|
}, |
|
|
|
handleQueryAllCost(){ |
|
|
|
let params = { |
|
|
|
...this.quoteDetail |
|
|
|
@ -232,6 +226,53 @@ export default { |
|
|
|
if (!this.selectionChecked.includes('运输')){ |
|
|
|
this.totalElseCost += this.quoteDetail.shippingCost; |
|
|
|
} |
|
|
|
}, |
|
|
|
computePriceByRate(val,type){ |
|
|
|
if (val === undefined || val === null || val <=0){ |
|
|
|
return; |
|
|
|
} |
|
|
|
let value = 0; |
|
|
|
// 公式包含Tool +测试+其他+包装+运输 |
|
|
|
let otherCost = this.quoteDetail.toolCost + this.quoteDetail.testCost + this.quoteDetail.elseCost + 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 |
|
|
|
//price = (物料成本+工具成本+运输成本+包装成本)/(1-value)+其他额外成本 |
|
|
|
this.quoteDetail.quoteTaxTotalPrice = (this.quoteDetail.adjustPartCost + otherCost)/(1-value)+this.totalElseCost |
|
|
|
// contribution = 1-(物料成本+人工成本+工具成本+运输成本+包装成本)/(price-额外其他成本) |
|
|
|
this.quoteDetail.quoteProfitAmount = (1-(this.quoteDetail.adjustPartCost + this.quoteDetail.adjustLabourCost + otherCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100 |
|
|
|
// margin = (price-额外其他成本-总成本)/(price-额外其他成本) |
|
|
|
this.quoteDetail.quoteTaxRate = ((this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost - ttlCost)/(this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost))*100 |
|
|
|
break; |
|
|
|
case 'contribution': |
|
|
|
value = this.quoteDetail.quoteProfitAmount/100 |
|
|
|
//price = (物料成本+工具成本+运输成本+包装成本+人工成本)/(1-value)+其他额外成本 |
|
|
|
this.quoteDetail.quoteTaxTotalPrice = (this.quoteDetail.adjustPartCost + this.quoteDetail.adjustLabourCost + otherCost)/(1-value)+this.totalElseCost |
|
|
|
// va = 1-(物料成本+工具成本+运输成本+包装成本)/(price-额外其他成本) |
|
|
|
this.quoteDetail.quoteProfitRate = (1-(this.quoteDetail.adjustPartCost + otherCost)/(this.quoteDetail.quoteTaxTotalPrice-this.totalElseCost))*100 |
|
|
|
// margin = (price-额外其他成本-总成本)/(price-额外其他成本) |
|
|
|
this.quoteDetail.quoteTaxRate=((this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost - ttlCost)/(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 |
|
|
|
// va = 1-(物料成本+工具成本+运输成本+包装成本)/(price-额外其他成本) |
|
|
|
this.quoteDetail.quoteProfitRate = (1-(this.quoteDetail.adjustPartCost + otherCost)/(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 |
|
|
|
break; |
|
|
|
case 'price': |
|
|
|
value = this.quoteDetail.quoteTaxTotalPrice |
|
|
|
// va = 1-(物料成本+工具成本+运输成本+包装成本)/(value-额外其他成本) |
|
|
|
this.quoteDetail.quoteProfitRate = (1-(this.quoteDetail.adjustPartCost + otherCost)/(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 |
|
|
|
// margin = (value-额外其他成本-总成本)/(value-额外其他成本) |
|
|
|
this.quoteDetail.quoteTaxRate=((this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost - ttlCost)/(this.quoteDetail.quoteTaxTotalPrice - this.totalElseCost))*100 |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
watch:{ |
|
|
|
@ -293,7 +334,7 @@ export default { |
|
|
|
if (newValue === undefined || newValue === null){ |
|
|
|
this.quoteDetail.profitRate = 0; |
|
|
|
} |
|
|
|
this.quoteDetail.quoteProfitRate = newValue; |
|
|
|
// this.quoteDetail.quoteProfitRate = newValue; |
|
|
|
this.computeTotalCost(); |
|
|
|
}, |
|
|
|
'quoteDetail.taxRate'(newValue, oldValue){ |
|
|
|
@ -348,7 +389,6 @@ export default { |
|
|
|
this.selection = newVal.join(',') |
|
|
|
this.quoteDetail.calculatedItems = this.selection; |
|
|
|
this.computeTotalCost(); |
|
|
|
this.computedTotalPartCost(); |
|
|
|
}, |
|
|
|
get(){ |
|
|
|
if (this.selection === '' || this.selection === undefined || this.selection === null){ |
|
|
|
@ -364,7 +404,6 @@ export default { |
|
|
|
} |
|
|
|
this.$nextTick(()=>{ |
|
|
|
this.computeProfitAmount() |
|
|
|
this.computeQuoteProfitAmount() |
|
|
|
this.computedTotalPartCost();// 重新计算成本 |
|
|
|
}) |
|
|
|
} |
|
|
|
@ -502,16 +541,44 @@ export default { |
|
|
|
<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="利润率%:" 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 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="利润额:" 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 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> |
|
|
|
|