Browse Source

完善回款返利管理

zhanglei
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>
<el-col :span="4"> <el-col :span="4">
<el-form-item> <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="1"></el-radio>
<el-radio label="0"></el-radio> <el-radio label="0"></el-radio>
</el-radio-group> </el-radio-group>
@ -67,13 +67,13 @@
<span>运费</span> <span>运费</span>
</el-col> </el-col>
<el-col :span="4"> <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>
<el-col :span="2" class="tleftb"> <el-col :span="2" class="tleftb">
<span>计算标准(%)</span> <span>计算标准(%)</span>
</el-col> </el-col>
<el-col :span="4"> <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>
<el-col :span="2" class="tleftb"> <el-col :span="2" class="tleftb">
<span>预计返利</span> <span>预计返利</span>
@ -142,6 +142,7 @@ export default {
freight: '', freight: '',
manufaSaleChannel: '', manufaSaleChannel: '',
manufaSaleChannelValue: '', manufaSaleChannelValue: '',
isReduceFreight: '',
remarks: '', remarks: '',
state: '', state: '',
uploadDate: '', uploadDate: '',
@ -158,6 +159,20 @@ export default {
submitdisabled: false 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: { methods: {
init() { init() {
fetchBySid(this.formobj.createOrgSid).then((res) => { fetchBySid(this.formobj.createOrgSid).then((res) => {
@ -167,44 +182,23 @@ export default {
} }
}) })
}, },
UpNumber(e) { getNumber(val, limit) {
if (this.formobj.isReduceFreight === '') { val = val.replace(/[^0-9.]/g, '') //
this.formobj.calculationStandard = '' val = val.replace(/^00/, '0.') // 0
this.$message({ showClose: true, type: 'error', message: '是否减运费请选择是或否' }) val = val.replace(/^\./g, '0.') // 0.
return val = val.replace(/\.{2,}/g, '.') //
} else { val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); //
e.target.value = e.target.value.replace(/[^\d]/g, '') // ."-" /^0\d+/.test(val) ? val = val.slice(1) : '' // 0
e.target.value = e.target.value.replace(/^00/, '0') // 0 const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
// e.target.value = e.target.value.replace(/\.{2,}/g, '.') // . const reg = new RegExp(str)
// e.target.value = e.target.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3') // if (limit === 0) {
if (e.target.value.indexOf('.') < 0 && e.target.value !== '' && e.target.value !== '-') { //
// 0102 val = val.replace(reg, '$1')
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 { } else {
this.formobj.freight = '0' //
} val = val.replace(reg, '$1.$2')
},
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
} }
return val
}, },
showEdit(row, createOrgSid) { showEdit(row, createOrgSid) {
this.$nextTick(() => { this.$nextTick(() => {
@ -218,7 +212,8 @@ export default {
this.formobj = resp.data this.formobj = resp.data
if (this.formobj.scmCollectionRebateVehs.length !== 0) { if (this.formobj.scmCollectionRebateVehs.length !== 0) {
for (var i = 0; i < this.formobj.scmCollectionRebateVehs.length; i++) { 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 return
} else { } else {
for (var i = 0; i < this.formobj.scmCollectionRebateVehs.length; i++) { 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() { save() {
this.$refs['form_obj'].validate((valid) => { this.$refs['form_obj'].validate((valid) => {
if (valid) { if (valid) {
this.formobj.estimateRebate = this.estimateRebateSum
this.submitdisabled = true this.submitdisabled = true
req.save(this.formobj).then((resp) => { req.save(this.formobj).then((resp) => {
if (resp.success) { if (resp.success) {
this.$message({ this.$message({ showClose: true, type: 'success', message: resp.msg })
showClose: true,
type: 'success',
message: resp.msg
})
this.handleReturn('true') this.handleReturn('true')
} }
}).catch(() => { }).catch(() => {
@ -275,6 +268,7 @@ export default {
freight: '', freight: '',
manufaSaleChannel: '', manufaSaleChannel: '',
manufaSaleChannelValue: '', manufaSaleChannelValue: '',
isReduceFreight: '',
remarks: '', remarks: '',
state: '', state: '',
uploadDate: '', uploadDate: '',

Loading…
Cancel
Save