Browse Source

完善回款返利分配

master
yunuo970428 8 months ago
parent
commit
fdac43695b
  1. 52
      anrui-scm/anrui-scm-ui/src/views/manufacturerrebates/huikuanfenpei/collectionrebateallotAdd.vue

52
anrui-scm/anrui-scm-ui/src/views/manufacturerrebates/huikuanfenpei/collectionrebateallotAdd.vue

@ -48,7 +48,7 @@
</el-col>
<el-col :span="5">
<el-form-item>
<el-input v-model="formobj.shareProportion" clearable @keyup.native="UpNumber" placeholder="" class="addinputw"/>
<el-input v-model="formobj.shareProportion" @input="shareProportionInput" @keyup.native="formobj.shareProportion = getNumber(formobj.shareProportion, 2)" clearable placeholder="" class="addinputw"/>
</el-form-item>
</el-col>
<el-col :span="3" class="tleftb">
@ -56,7 +56,7 @@
</el-col>
<el-col :span="5">
<el-form-item>
<span>{{ shareRebateTotalSummation() }}</span>
<span>{{ formobj.shareRebateTotal }}</span>
</el-form-item>
</el-col>
<el-col :span="3" class="tleftb">
@ -64,7 +64,7 @@
</el-col>
<el-col :span="5">
<el-form-item>
<span>{{ thisRebateBalanceSummation() }}</span>
<span>{{ formobj.thisRebateBalance }}</span>
</el-form-item>
</el-col>
</el-row>
@ -149,15 +149,23 @@ export default {
}
},
methods: {
UpNumber(e) {
e.target.value = e.target.value.replace(/[^\d.]/g, '') // ."-"
e.target.value = e.target.value.replace(/^00/, '0.') // 0
e.target.value = e.target.value.replace(/\.{2,}/g, '.') // .
e.target.value = e.target.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3') //
if (e.target.value.indexOf('.') < 0 && e.target.value !== '' && e.target.value !== '-') {
// 0102
e.target.value = parseFloat(e.target.value)
getNumber(val, limit) {
val = val.replace(/[^0-9.]/g, '') //
val = val.replace(/^00/, '0.') // 0
val = val.replace(/^\./g, '0.') // 0.
val = val.replace(/\.{2,}/g, '.') //
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); //
/^0\d+/.test(val) ? val = val.slice(1) : '' // 0
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
const reg = new RegExp(str)
if (limit === 0) {
//
val = val.replace(reg, '$1')
} else {
//
val = val.replace(reg, '$1.$2')
}
return val
},
showEdit(val) {
this.$nextTick(() => {
@ -175,24 +183,20 @@ export default {
this.formobj.withholdingApply = val.withholdingApply
this.formobj.distributionState = '已分配'
this.formobj.scmCollectionRebateDistributionVehs = val.scmCollectionRebateDistributionVehs
this.formobj.shareGinExaProportion = parseFloat(this.formobj.estimateRebate) / parseFloat(this.formobj.collectionMoney)
// = /
this.formobj.shareGinExaProportion = Math.round((parseFloat(this.formobj.estimateRebate !== '' ? this.formobj.estimateRebate : 0) / parseFloat(this.formobj.collectionMoney !== '' ? this.formobj.collectionMoney : 0)) * 100) / 100
this.viewTitle = '回款返利分配'
},
shareRebateTotalSummation() {
if (this.formobj.shareProportion !== '') {
this.formobj.shareRebateTotal = parseFloat(this.formobj.collectionMoney) * parseFloat(this.formobj.shareProportion)
return this.formobj.shareRebateTotal
}
},
thisRebateBalanceSummation() {
if (this.formobj.shareRebateTotal !== '') {
this.formobj.thisRebateBalance = parseFloat(this.formobj.estimateRebate) - parseFloat(this.formobj.shareRebateTotal)
return this.formobj.thisRebateBalance
}
shareProportionInput() {
// = *
this.formobj.shareRebateTotal = Math.round((parseFloat(this.formobj.collectionMoney !== '' ? this.formobj.collectionMoney : 0) * parseFloat(this.formobj.shareProportion !== '' ? this.formobj.shareProportion : 0)) * 100) / 100
// = -
this.formobj.thisRebateBalance = parseFloat(this.formobj.estimateRebate !== '' ? this.formobj.estimateRebate : 0) - parseFloat(this.formobj.shareRebateTotal !== '' ? this.formobj.shareRebateTotal : 0)
},
handleAllocation() {
for (var i = 0; i < this.formobj.scmCollectionRebateDistributionVehs.length; i++) {
this.formobj.scmCollectionRebateDistributionVehs[i].distributionCollectionRebate = parseFloat(this.formobj.scmCollectionRebateDistributionVehs[i].costPrice) * parseFloat(this.formobj.shareProportion)
// = *
this.formobj.scmCollectionRebateDistributionVehs[i].distributionCollectionRebate = Math.round((parseFloat(this.formobj.scmCollectionRebateDistributionVehs[i].costPrice !== '' ? this.formobj.scmCollectionRebateDistributionVehs[i].costPrice : 0) * (parseFloat(this.formobj.shareProportion !== '' ? this.formobj.shareProportion : 0) / 100)) * 100) / 100
}
},
handleSave() {

Loading…
Cancel
Save