|
|
@@ -132,6 +132,12 @@
|
|
|
@change="dicChange('existStationDay')" placeholder="请输入 在场站天数" size="small"
|
|
|
:controls="false" :min="0" :disabled="editDisabled"></el-input-number>
|
|
|
</tempalte>
|
|
|
+ <tempalte slot="exrateDate">
|
|
|
+ <el-date-picker v-model="form.exrateDate" type="date" placeholder="选择日期"
|
|
|
+ format="yyyy-MM-dd" value-format="yyyy-MM-dd"
|
|
|
+ :disabled="editDisabled || form.costItemList.length || polFeeList.length || podFeeList.length || potFeeList.length">
|
|
|
+ </el-date-picker>
|
|
|
+ </tempalte>
|
|
|
</avue-form>
|
|
|
</trade-card>
|
|
|
<trade-card title="基础明细">
|
|
|
@@ -270,9 +276,9 @@
|
|
|
<span v-else>{{ row.measurementTicket }}</span>
|
|
|
</template>
|
|
|
<template slot="costPriceForm" slot-scope="{ row }">
|
|
|
- <el-input-number v-if="row.$cellEdit" v-model="row.costPrice"
|
|
|
- @change="costPriceChange()" :controls="false" placeholder="请输入 成本价" size="small"
|
|
|
- style="width: 100%;" :precision="2"></el-input-number>
|
|
|
+ <el-input-number v-if="row.$cellEdit" v-model="row.costPrice" @change="countChange()"
|
|
|
+ :controls="false" placeholder="请输入 成本价" size="small" style="width: 100%;"
|
|
|
+ :precision="2"></el-input-number>
|
|
|
<span v-else>{{ row.costPrice }}</span>
|
|
|
</template>
|
|
|
<template slot="menu" slot-scope="{ row, index }">
|
|
|
@@ -352,9 +358,9 @@
|
|
|
<span v-else>{{ row.measurementTicket }}</span>
|
|
|
</template>
|
|
|
<template slot="costPriceForm" slot-scope="{ row }">
|
|
|
- <el-input-number v-if="row.$cellEdit" v-model="row.costPrice"
|
|
|
- @change="costPriceChange()" :controls="false" placeholder="请输入 成本价" size="small"
|
|
|
- style="width: 100%;" :precision="2"></el-input-number>
|
|
|
+ <el-input-number v-if="row.$cellEdit" v-model="row.costPrice" @change="countChange()"
|
|
|
+ :controls="false" placeholder="请输入 成本价" size="small" style="width: 100%;"
|
|
|
+ :precision="2"></el-input-number>
|
|
|
<span v-else>{{ row.costPrice }}</span>
|
|
|
</template>
|
|
|
<template slot="menu" slot-scope="{ row, index }">
|
|
|
@@ -434,9 +440,9 @@
|
|
|
<span v-else>{{ row.measurementTicket }}</span>
|
|
|
</template>
|
|
|
<template slot="costPriceForm" slot-scope="{ row }">
|
|
|
- <el-input-number v-if="row.$cellEdit" v-model="row.costPrice"
|
|
|
- @change="costPriceChange()" :controls="false" placeholder="请输入 成本价" size="small"
|
|
|
- style="width: 100%;" :precision="2"></el-input-number>
|
|
|
+ <el-input-number v-if="row.$cellEdit" v-model="row.costPrice" @change="countChange()"
|
|
|
+ :controls="false" placeholder="请输入 成本价" size="small" style="width: 100%;"
|
|
|
+ :precision="2"></el-input-number>
|
|
|
<span v-else>{{ row.costPrice }}</span>
|
|
|
</template>
|
|
|
<template slot="menu" slot-scope="{ row, index }">
|
|
|
@@ -689,9 +695,9 @@ export default {
|
|
|
prop: "exrateDate",
|
|
|
width: "120",
|
|
|
disabled: false,
|
|
|
- type: "date",
|
|
|
- format: "yyyy-MM-dd",
|
|
|
- valueFormat: "yyyy-MM-dd",
|
|
|
+ // type: "date",
|
|
|
+ // format: "yyyy-MM-dd",
|
|
|
+ // valueFormat: "yyyy-MM-dd",
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: " ",
|
|
|
@@ -1030,7 +1036,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "制单人",
|
|
|
- prop: "createUser",
|
|
|
+ prop: "createUserName",
|
|
|
width: "120",
|
|
|
overHidden: true
|
|
|
},
|
|
|
@@ -1042,7 +1048,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "修改人",
|
|
|
- prop: "updateUser",
|
|
|
+ prop: "updateUserName",
|
|
|
width: "120",
|
|
|
overHidden: true
|
|
|
},
|
|
|
@@ -1218,7 +1224,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "制单人",
|
|
|
- prop: "createUser",
|
|
|
+ prop: "createUserName",
|
|
|
width: "120",
|
|
|
overHidden: true
|
|
|
},
|
|
|
@@ -1230,7 +1236,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "修改人",
|
|
|
- prop: "updateUser",
|
|
|
+ prop: "updateUserName",
|
|
|
width: "120",
|
|
|
overHidden: true
|
|
|
},
|
|
|
@@ -1406,7 +1412,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "制单人",
|
|
|
- prop: "createUser",
|
|
|
+ prop: "createUserName",
|
|
|
width: "120",
|
|
|
overHidden: true
|
|
|
},
|
|
|
@@ -1418,7 +1424,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "修改人",
|
|
|
- prop: "updateUser",
|
|
|
+ prop: "updateUserName",
|
|
|
width: "120",
|
|
|
overHidden: true
|
|
|
},
|
|
|
@@ -1472,34 +1478,67 @@ export default {
|
|
|
methods: {
|
|
|
costPriceChange() {
|
|
|
this.form.costItemList.forEach(item => {
|
|
|
+ let polSUM = 0
|
|
|
+ let podSUM = 0
|
|
|
+ let potSUM = 0
|
|
|
item.polCost = 0
|
|
|
item.podCost = 0
|
|
|
item.potCost = 0
|
|
|
this.polFeeList.forEach(e => {
|
|
|
if (item.boxType == e.boxType) {
|
|
|
- item.polCost += Number(e.costPrice)
|
|
|
+ polSUM += _.multiply(Number(e.costPrice), Number(e.exrate))
|
|
|
+ item.polCost = _.divide(polSUM, item.exrate)
|
|
|
}
|
|
|
})
|
|
|
this.podFeeList.forEach(e => {
|
|
|
if (item.boxType == e.boxType) {
|
|
|
- item.podCost += Number(e.costPrice)
|
|
|
+ podSUM += _.multiply(Number(e.costPrice), Number(e.exrate))
|
|
|
+ item.podCost = _.divide(podSUM, item.exrate)
|
|
|
}
|
|
|
})
|
|
|
this.potFeeList.forEach(e => {
|
|
|
if (item.boxType == e.boxType) {
|
|
|
- item.potCost += Number(e.costPrice)
|
|
|
+ potSUM += _.multiply(Number(e.costPrice), Number(e.exrate))
|
|
|
+ item.potCost = _.divide(potSUM, item.exrate)
|
|
|
}
|
|
|
})
|
|
|
this.countChange(item)
|
|
|
})
|
|
|
},
|
|
|
countChange(row) {
|
|
|
- // 用箱成本=(航线天数+在场站天数) *箱成本/天/汇率
|
|
|
- row.useBoxCost = _.round(_.divide(_.multiply(_.add(Number(this.form.navigateDay ? this.form.navigateDay : 0), Number(this.form.existStationDay ? this.form.existStationDay : 0)), row.boxCost ? row.boxCost : 0), row.exrate ? row.exrate : 1), 2)
|
|
|
- // 成本价=海运费+用箱成本+pol杂费+pod成本
|
|
|
- row.costPrice = _.round(_.add(_.add(Number(row.oceanFreight ? row.oceanFreight : 0), Number(row.useBoxCost ? row.useBoxCost : 0)), _.add(Number(row.polCost ? row.polCost : 0), Number(row.podCost ? row.podCost : 0))), 2)
|
|
|
- // 合计利润=销售价-成本价
|
|
|
- row.totalProfit = _.round(_.subtract(row.salesPrice ? row.salesPrice : 0, row.costPrice ? row.costPrice : 0), 2)
|
|
|
+ this.form.costItemList.forEach(item => {
|
|
|
+ let polSUM = 0
|
|
|
+ let podSUM = 0
|
|
|
+ let potSUM = 0
|
|
|
+ item.polCost = 0
|
|
|
+ item.podCost = 0
|
|
|
+ item.potCost = 0
|
|
|
+ this.polFeeList.forEach(e => {
|
|
|
+ if (item.boxType == e.boxType) {
|
|
|
+ polSUM += _.multiply(Number(e.costPrice), Number(e.exrate))
|
|
|
+ item.polCost = _.round(_.divide(polSUM, item.exrate), 2)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.podFeeList.forEach(e => {
|
|
|
+ if (item.boxType == e.boxType) {
|
|
|
+ podSUM += _.multiply(Number(e.costPrice), Number(e.exrate))
|
|
|
+ item.podCost = _.round(_.divide(podSUM, item.exrate), 2)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.potFeeList.forEach(e => {
|
|
|
+ if (item.boxType == e.boxType) {
|
|
|
+ potSUM += _.multiply(Number(e.costPrice), Number(e.exrate))
|
|
|
+ item.potCost = _.round(_.divide(potSUM, item.exrate), 2)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 用箱成本=(航线天数+在场站天数) *箱成本/天/汇率
|
|
|
+ item.useBoxCost = _.round(_.divide(_.multiply(_.add(Number(this.form.navigateDay ? this.form.navigateDay : 0), Number(this.form.existStationDay ? this.form.existStationDay : 0)), item.boxCost ? item.boxCost : 0), item.exrate ? item.exrate : 1), 2)
|
|
|
+ // 成本价=海运费+用箱成本+pol杂费+pod成本
|
|
|
+ item.costPrice = _.round(_.add(_.add(Number(item.oceanFreight ? item.oceanFreight : 0), Number(item.useBoxCost ? item.useBoxCost : 0)), _.add(Number(item.polCost ? item.polCost : 0), Number(item.podCost ? item.podCost : 0))), 2)
|
|
|
+ // 合计利润=销售价-成本价
|
|
|
+ item.totalProfit = _.round(_.subtract(item.salesPrice ? item.salesPrice : 0, item.costPrice ? item.costPrice : 0), 2)
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
dicChange(name, row) {
|
|
|
if (name == 'belongingCompanyName') {
|
|
|
@@ -1653,18 +1692,10 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
if (name == 'navigateDay') {
|
|
|
- if (this.form.navigateDay > 0) {
|
|
|
- this.form.costItemList.forEach(item => {
|
|
|
- this.countChange(item)
|
|
|
- })
|
|
|
- }
|
|
|
+ this.countChange()
|
|
|
}
|
|
|
if (name == 'existStationDay') {
|
|
|
- if (this.form.existStationDay > 0) {
|
|
|
- this.form.costItemList.forEach(item => {
|
|
|
- this.countChange(item)
|
|
|
- })
|
|
|
- }
|
|
|
+ this.countChange()
|
|
|
}
|
|
|
},
|
|
|
rowDicChange(name, row, el) {
|
|
|
@@ -1708,7 +1739,7 @@ export default {
|
|
|
}
|
|
|
if (name == 'boxType') {
|
|
|
if (row) {
|
|
|
- this.costPriceChange()
|
|
|
+ this.countChange()
|
|
|
} else {
|
|
|
el.salesPrice = 0
|
|
|
el.costPrice = 0
|
|
|
@@ -1724,7 +1755,7 @@ export default {
|
|
|
}
|
|
|
if (name == 'feeBoxType') {
|
|
|
if (row) {
|
|
|
- this.costPriceChange()
|
|
|
+ this.countChange()
|
|
|
} else {
|
|
|
el.salesPrice = 0
|
|
|
el.costPrice = 0
|
|
|
@@ -1843,11 +1874,13 @@ export default {
|
|
|
feeRemove({ ids: row.id }).then(res => {
|
|
|
this.polFeeList.splice(index, 1);
|
|
|
this.$message.success("成功删除");
|
|
|
+ this.countChange()
|
|
|
})
|
|
|
} else {
|
|
|
this.polFeeList.splice(index, 1);
|
|
|
+ this.countChange()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
podRowDel(row, index) {
|
|
|
@@ -1860,11 +1893,13 @@ export default {
|
|
|
feeRemove({ ids: row.id }).then(res => {
|
|
|
this.podFeeList.splice(index, 1);
|
|
|
this.$message.success("成功删除");
|
|
|
+ this.countChange()
|
|
|
})
|
|
|
} else {
|
|
|
this.podFeeList.splice(index, 1);
|
|
|
+ this.countChange()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
potRowDel(row, index) {
|
|
|
@@ -1877,11 +1912,13 @@ export default {
|
|
|
feeRemove({ ids: row.id }).then(res => {
|
|
|
this.potFeeList.splice(index, 1);
|
|
|
this.$message.success("成功删除");
|
|
|
+ this.countChange()
|
|
|
})
|
|
|
} else {
|
|
|
this.potFeeList.splice(index, 1);
|
|
|
+ this.countChange()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
allClick(name) {
|