Commit ad47826a authored by zs嵩's avatar zs嵩

批量加价 批量费用申请

parent 17cb701c
export function formatNumber(num, cent = 2) {
let num2 = num.toString()
if (num2.indexOf(".") > -1) {
const decimalPart = num2.split(".")[1]
if (decimalPart.length > 2) {
num2 = num2.substring(0, num2.length - (decimalPart.length - 2))
}
}
return num2
}
......@@ -27,6 +27,9 @@ import DictSelector from "@/components/DictSelector"
import { DICT_TYPE, getDictDataLabel, getDictDatas, getDictDatas2 } from "@/utils/dict"
import i18n from "./i18n"
import { formatNumber } from "@/filter/filter"
Vue.prototype.$formatNumber = formatNumber
// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
......
......@@ -38,6 +38,13 @@
</dict-selector>
</template>
</el-table-column>
<el-table-column :label="$t('计量单位')">
<template slot-scope="{ row, $index }">
<el-select v-model="row.unit" :placeholder="$t('请选择')" clearable @change="batchUpdateField($index, 'unit')">
<el-option v-for="(item, index) in units" :label="$t(item.name)" :value="item.val" :key="index"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('备注')">
<template slot-scope="{ row, $index }">
<el-input v-model="row.remarks" type="textarea" @input="batchUpdateField($index, 'remarks')"></el-input>
......@@ -97,11 +104,12 @@
/ {{ row.dstWarehouseName }}
</template>
</el-table-column>
<el-table-column :label="$t('额外费用')" width="200">
<el-table-column :label="$t('收费数据')" width="200">
<template slot-scope="{ row }">
<div v-for="(item, feeIndex) in row.costVO.feeDtoList" :key="feeIndex">
<div v-if="item.amount && item.feeType !== 1 && item.feeType !== 2"><dict-tag :type="DICT_TYPE.FEE_TYPE" :value="item.feeType" />: {{ currencyMapF[item.currencyId] }}{{ item.amount }}</div>
</div>
<el-tooltip v-if="row.orderType !== 1" effect="dark" :content="row.orderType == 3 ? `${row.vweight}kg` : `${row.wvolume}m³`" placement="top-start">
<span>{{ row.realityChargeNum }}{{ $t("") }},{{ row.realityChargeVolume }}m³,{{ row.realityChargeWeight }}kg</span>
</el-tooltip>
<template v-else>{{ row.realityChargeNum }}{{ $t("") }},{{ row.realityChargeVolume }}m³,{{ row.realityChargeWeight }}kg</template>
</template>
</el-table-column>
<el-table-column :label="$t('控货')" align="center" prop="transportId">
......@@ -219,7 +227,29 @@ export default {
reason: "",
feeDetailsVOList: [],
orderFeeDetailsVOList: []
}
},
units: [
{
name: "",
val: 1
},
{
name: "收费体积",
val: 2
},
{
name: "入仓体积",
val: 3
},
{
name: "收费重量",
val: 4
},
{
name: "入仓重量",
val: 5
}
]
}
},
computed: {
......@@ -287,25 +317,11 @@ export default {
this.ids = selection.map((item) => item.orderId)
},
formatAmount(row, index) {
// 使用正则表达式限制输入为数字和小数点,并限制小数点后最多两位数字
// row.applicationFee = row.applicationFee.replace(/[^\d.]/g, '').replace(/(\..*)\./g, '$1');
if (row.applicationFee.indexOf(".") > -1) {
const decimalPart = row.applicationFee.split(".")[1]
if (decimalPart.length > 2) {
row.applicationFee = row.applicationFee.substring(0, row.applicationFee.length - (decimalPart.length - 2))
}
}
row.applicationFee = this.$formatNumber(row.applicationFee, 2)
this.batchUpdateField(index, "applicationFee")
},
formatAmount2(row) {
// 使用正则表达式限制输入为数字和小数点,并限制小数点后最多两位数字
// row.applicationFee = row.applicationFee.replace(/[^\d.]/g, '').replace(/(\..*)\./g, '$1');
if (row.applicationFee.indexOf(".") > -1) {
const decimalPart = row.applicationFee.split(".")[1]
if (decimalPart.length > 2) {
row.applicationFee = row.applicationFee.substring(0, row.applicationFee.length - (decimalPart.length - 2))
}
}
row.applicationFee = this.$formatNumber(row.applicationFee, 2)
},
del(index) {
......@@ -331,21 +347,50 @@ export default {
}
return true
},
updatePayer2(item) {
console.log("变动的费用记录:", item)
this.$nextTick(() => {
// 根据新费用类型和索引更新payer付款人信息
this.orderDetails.drawee ? (this.orderDetails.drawee != 3 ? this.$set(item, "payer", this.orderDetails.drawee) : this.getDraweePayer(item)) : undefined // 费用申请付款人
console.log("变动的费用记录:", item)
})
},
batchUpdateField(index, field) {
this.$nextTick(() => {
if (field === "payer" && this.batchApplyDetailsInfoVO.feeDetailsVOList[index][field] === "") {
let cval = this.batchApplyDetailsInfoVO.feeDetailsVOList[index][field]
if (field === "payer" && cval === "") {
this.batchApplyDetailsInfoVO.orderFeeDetailsVOList.forEach((item, i) => {
let ITEM = item.orderFeeApplicationBaseVOList[index]
if (item.drawee) {
item.drawee != 3 ? (ITEM[field] = item.drawee) : this.getDraweePayer(ITEM)
}
})
return
}
if (field === "unit" || "applicationFee") {
let applicationFee = this.batchApplyDetailsInfoVO.feeDetailsVOList[index]["applicationFee"]
if (applicationFee) {
if (cval === 2) {
this.batchApplyDetailsInfoVO.orderFeeDetailsVOList.forEach((item, i) => {
item.orderFeeApplicationBaseVOList[index]["applicationFee"] = this.$formatNumber(item.realityChargeVolume * applicationFee, 2)
})
} else if (cval === 3) {
this.batchApplyDetailsInfoVO.orderFeeDetailsVOList.forEach((item, i) => {
item.orderFeeApplicationBaseVOList[index]["applicationFee"] = this.$formatNumber(item.sumVolume * applicationFee, 2)
})
} else if (cval === 4) {
this.batchApplyDetailsInfoVO.orderFeeDetailsVOList.forEach((item, i) => {
item.orderFeeApplicationBaseVOList[index]["applicationFee"] = this.$formatNumber(item.realityChargeWeight * applicationFee, 2)
})
} else if (cval === 5) {
this.batchApplyDetailsInfoVO.orderFeeDetailsVOList.forEach((item, i) => {
item.orderFeeApplicationBaseVOList[index]["applicationFee"] = this.$formatNumber(item.sumWeight * applicationFee, 2)
})
} else {
this.batchApplyDetailsInfoVO.orderFeeDetailsVOList.forEach((item, i) => {
item.orderFeeApplicationBaseVOList[index]["applicationFee"] = this.$formatNumber(1 * applicationFee, 2)
})
}
}
if ("applicationFee") {
return
}
}
this.batchApplyDetailsInfoVO.orderFeeDetailsVOList.forEach((item, i) => {
item.orderFeeApplicationBaseVOList[index][field] = this.batchApplyDetailsInfoVO.feeDetailsVOList[index][field]
item.orderFeeApplicationBaseVOList[index][field] = cval
})
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment