Browse Source

完善回款返利管理

master
yunuo970428 9 months ago
parent
commit
f474909eb1
  1. 86
      anrui-scm/anrui-scm-ui/src/views/manufacturerrebates/huikuanguanli/collectionrebatemanagementAdd.vue

86
anrui-scm/anrui-scm-ui/src/views/manufacturerrebates/huikuanguanli/collectionrebatemanagementAdd.vue

@ -57,7 +57,7 @@
</el-col>
<el-col :span="4">
<el-form-item>
<el-radio-group v-model="formobj.isReduceFreight" @change="handleRadio">
<el-radio-group v-model="formobj.isReduceFreight">
<el-radio label="1"></el-radio>
<el-radio label="0"></el-radio>
</el-radio-group>
@ -67,13 +67,13 @@
<span>运费</span>
</el-col>
<el-col :span="4">
<el-form-item><el-input v-model="formobj.freight" :disabled="formobj.isReduceFreight === '0'" class="addinputw" @keyup.native="UpNumber" placeholder="" clearable></el-input></el-form-item>
<el-form-item><el-input v-model="formobj.freight" :disabled="formobj.isReduceFreight == '0'" class="addinputw" @keyup.native="formobj.freight = getNumber(formobj.freight, 2)" placeholder="" clearable></el-input></el-form-item>
</el-col>
<el-col :span="2" class="tleftb">
<span>计算标准(%)</span>
</el-col>
<el-col :span="4">
<el-form-item><el-input v-model="formobj.calculationStandard" @keyup.native="UpInput" clearable placeholder="" class="addinputw"></el-input></el-form-item>
<el-form-item><el-input v-model="formobj.calculationStandard" @keyup.native="formobj.calculationStandard = getNumber(formobj.calculationStandard, 2)" clearable placeholder="" class="addinputw"></el-input></el-form-item>
</el-col>
<el-col :span="2" class="tleftb">
<span>预计返利</span>
@ -142,6 +142,7 @@ export default {
freight: '',
manufaSaleChannel: '',
manufaSaleChannelValue: '',
isReduceFreight: '',
remarks: '',
state: '',
uploadDate: '',
@ -158,6 +159,20 @@ export default {
submitdisabled: false
}
},
computed: {
//
estimateRebateSum() {
let estimateRebate = '0'
// = - *
if (this.formobj.isReduceFreight === '1') {
estimateRebate = Math.round((parseFloat(estimateRebate) + (parseFloat(this.formobj.collectionMoney !== '' ? this.formobj.collectionMoney : 0) - parseFloat(this.formobj.freight !== '' ? this.formobj.freight : 0)) * (parseFloat(this.formobj.calculationStandard !== '' ? this.formobj.calculationStandard : 0) / 100)) * 100) / 100
} else {
// = *
estimateRebate = Math.round((parseFloat(estimateRebate) + parseFloat(this.formobj.collectionMoney !== '' ? this.formobj.collectionMoney : 0) * (parseFloat(this.formobj.calculationStandard !== '' ? this.formobj.calculationStandard : 0) / 100)) * 100) / 100
}
return estimateRebate
}
},
methods: {
init() {
fetchBySid(this.formobj.createOrgSid).then((res) => {
@ -167,44 +182,23 @@ export default {
}
})
},
UpNumber(e) {
if (this.formobj.isReduceFreight === '') {
this.formobj.calculationStandard = ''
this.$message({ showClose: true, type: 'error', message: '是否减运费请选择是或否' })
return
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 {
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)
}
}
},
UpInput(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)
}
},
handleRadio(value) {
if (value === '1') {
this.formobj.freight = ''
} else {
this.formobj.freight = '0'
}
},
estimateRebateSum() {
if (this.formobj.freight !== '' && this.formobj.calculationStandard !== '') {
this.formobj.estimateRebate = (parseInt(this.formobj.collectionMoney) - parseInt(this.formobj.freight)) * (parseFloat(this.formobj.calculationStandard) / 100)
return this.formobj.estimateRebate
//
val = val.replace(reg, '$1.$2')
}
return val
},
showEdit(row, createOrgSid) {
this.$nextTick(() => {
@ -218,7 +212,8 @@ export default {
this.formobj = resp.data
if (this.formobj.scmCollectionRebateVehs.length !== 0) {
for (var i = 0; i < this.formobj.scmCollectionRebateVehs.length; i++) {
this.aggregate = parseInt(0) + parseInt(this.formobj.scmCollectionRebateVehs[i].costPrice)
// --
this.aggregate = parseFloat(this.aggregate !== '' ? this.aggregate : 0) + parseFloat(this.formobj.scmCollectionRebateVehs[i].costPrice)
}
}
}
@ -231,21 +226,19 @@ export default {
return
} else {
for (var i = 0; i < this.formobj.scmCollectionRebateVehs.length; i++) {
this.formobj.scmCollectionRebateVehs[i].estimateRebate = parseFloat(this.formobj.estimateRebate) * (parseFloat(this.formobj.scmCollectionRebateVehs[i].costPrice / parseFloat(this.aggregate)))
// = * /
this.formobj.scmCollectionRebateVehs[i].estimateRebate = Math.round((parseFloat(this.estimateRebateSum) * (parseFloat(this.formobj.scmCollectionRebateVehs[i].costPrice !== '' ? this.formobj.scmCollectionRebateVehs[i].costPrice : 0) / parseFloat(this.aggregate !== '' ? this.aggregate : 0))) * 100) / 100
}
}
},
save() {
this.$refs['form_obj'].validate((valid) => {
if (valid) {
this.formobj.estimateRebate = this.estimateRebateSum
this.submitdisabled = true
req.save(this.formobj).then((resp) => {
if (resp.success) {
this.$message({
showClose: true,
type: 'success',
message: resp.msg
})
this.$message({ showClose: true, type: 'success', message: resp.msg })
this.handleReturn('true')
}
}).catch(() => {
@ -275,6 +268,7 @@ export default {
freight: '',
manufaSaleChannel: '',
manufaSaleChannelValue: '',
isReduceFreight: '',
remarks: '',
state: '',
uploadDate: '',

Loading…
Cancel
Save