|
|
@ -18,68 +18,43 @@ |
|
|
|
<!--Start 新增修改部分--> |
|
|
|
<div class="listconadd"> |
|
|
|
<div class="titwu"><span>{{ formobj.collectionApply }}回款返利预提申请</span></div> |
|
|
|
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formadd"> |
|
|
|
<el-row class="rowStyle"> |
|
|
|
<el-col :span="24" class="tleftb colOneStyle"> |
|
|
|
<div><span style="font-size: 16px">金额单位:元</span></div> |
|
|
|
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02"> |
|
|
|
<el-row style="border-top: 1px solid #e0e3eb"> |
|
|
|
<el-col :span="8"> |
|
|
|
<div class="span-sty">分公司</div> |
|
|
|
<el-form-item><span class="addinputInfo">{{ formobj.createOrgName }}</span></el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row class="rowStyle"> |
|
|
|
<el-col :span="2" class="tleftb colOneStyle"> |
|
|
|
<span>品牌:</span> |
|
|
|
<el-col :span="8"> |
|
|
|
<div class="span-sty">申请部门</div> |
|
|
|
<el-form-item><span class="addinputInfo">{{ formobj.deptName }}</span></el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4" class="colOneStyle"> |
|
|
|
<el-form-item> |
|
|
|
<el-select :disabled="dialogStatus === 'edit'" v-model="formobj.brandName" placeholder="请选择" filterable clearable @change="changeBrand"> |
|
|
|
<el-option v-for="item in brand_list" :key="item.sid" :label="item.brandName" :value="item.brandName"/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-col :span="8"> |
|
|
|
<div class="span-sty">申请人</div> |
|
|
|
<el-form-item><span class="addinputInfo">{{ formobj.createByName }}</span></el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="18" class="tleftb colOneStyle"> |
|
|
|
<el-button size="small" type="primary" @click="handleSelect()">选择</el-button> |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<div style="text-align: right"><el-button size="small" type="primary" class="btntopblueline" @click="handleSelect()">选择</el-button></div> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-table :key="tableKey" :data="formobj.scmCollectionRebateWiths" :index="index" border style="width: 100%" show-summary :summary-method="getSummaries"> |
|
|
|
<el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/> |
|
|
|
<el-table-column label="回款方式" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ scope.row.collectionTypeValue }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="回款金额" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ scope.row.collectionMoney }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="运费" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ scope.row.freight }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="计算标准" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ scope.row.calculationStandard }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="estimateRebate" label="预计返利" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ scope.row.estimateRebate }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="明细" align="center"> |
|
|
|
<el-table-column prop="purchaseSystemName" label="采购系统" align="center" min-width="150" /> |
|
|
|
<el-table-column prop="brandName" label="品牌" align="center" min-width="150" /> |
|
|
|
<el-table-column prop="rebateTypeValue" label="返利类型" align="center" min-width="150" /> |
|
|
|
<el-table-column prop="rebateName" label="返利名称" align="center" min-width="150" /> |
|
|
|
<el-table-column prop="estimateRebate" label="预计返利" align="center" min-width="150"/> |
|
|
|
<el-table-column label="明细" align="center" width="100"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="primary" size="mini" @click="handleLook(scope.row)">查看</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<el-row> |
|
|
|
<el-col :span="2" class="tleftb"> |
|
|
|
<span>备注</span> |
|
|
|
</el-col> |
|
|
|
<el-col :span="22"> |
|
|
|
<el-form-item> |
|
|
|
<el-input v-model="formobj.remarks" clearable placeholder="" class="addinputw"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-col :span="24"> |
|
|
|
<div class="span-sty">备注</div> |
|
|
|
<el-form-item><el-input v-model="formobj.remarks" clearable placeholder="" class="addinputInfo addinputw"></el-input></el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
@ -93,7 +68,7 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import req from '@/api/manufacturerrebates/collectionrebatewithholding' |
|
|
|
import { brandDown, fetchBySid } from '@/api/cheliang/dictcommons' |
|
|
|
import { fetchBySid } from '@/api/cheliang/dictcommons' |
|
|
|
import huikuanfanliselect from './relation/huikuanfanliselect' |
|
|
|
import huikuanfanliAdd from './relation/huikuanfanliAdd' |
|
|
|
|
|
|
@ -109,16 +84,14 @@ export default { |
|
|
|
index: 0, |
|
|
|
tableKey: 0, |
|
|
|
viewState: 1, |
|
|
|
dialogStatus: '', |
|
|
|
brand_list: [], |
|
|
|
// 表单数据 |
|
|
|
formobj: { |
|
|
|
sid: '', |
|
|
|
brandName: '', |
|
|
|
brandSid: '', |
|
|
|
deptName: '', |
|
|
|
deptSid: '', |
|
|
|
collectionApply: '', |
|
|
|
createOrgName: '', |
|
|
|
createOrgSId: '', |
|
|
|
createOrgSid: '', |
|
|
|
useOrgName: '', |
|
|
|
useOrgSid: '', |
|
|
|
remarks: '', |
|
|
@ -142,17 +115,12 @@ export default { |
|
|
|
this.formobj.useOrgName = res.data.name |
|
|
|
} |
|
|
|
}) |
|
|
|
brandDown({ useOrg: this.formobj.createOrgSid }).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.brand_list = res.data |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取日期 |
|
|
|
newDate() { |
|
|
|
let date = new Date() |
|
|
|
let year = date.getFullYear() // 年 |
|
|
|
let month = date.getMonth() + 1 // 月 |
|
|
|
let month = date.getMonth() // 月 |
|
|
|
this.formobj.collectionApply = year + '年' + month + '月' |
|
|
|
}, |
|
|
|
showAdd(createOrgSid) { |
|
|
@ -161,19 +129,19 @@ export default { |
|
|
|
this.init() |
|
|
|
this.newDate() |
|
|
|
}) |
|
|
|
this.dialogStatus = 'add' |
|
|
|
this.formobj.createBySid = window.sessionStorage.getItem('userSid') |
|
|
|
this.formobj.createOrgSid = createOrgSid |
|
|
|
this.formobj.useOrgSid = createOrgSid |
|
|
|
this.formobj.createByName = window.sessionStorage.getItem('name') |
|
|
|
this.formobj.orgPath = window.sessionStorage.getItem('defaultOrgPath') |
|
|
|
this.formobj.deptName = window.sessionStorage.getItem('defaultOrgPathName').substring(window.sessionStorage.getItem('defaultOrgPathName').lastIndexOf('/') + 1) |
|
|
|
this.formobj.deptSid = window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage.getItem('defaultOrgPath').lastIndexOf('/') + 1) |
|
|
|
this.viewTitle = '【新增】回款返利预提申请' |
|
|
|
}, |
|
|
|
showEdit(row) { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs['form_obj'].clearValidate() |
|
|
|
}) |
|
|
|
this.dialogStatus = 'edit' |
|
|
|
this.viewTitle = '【编辑】回款返利预提申请' |
|
|
|
console.log('编辑回显', row.sid) |
|
|
|
req.fetchBySid(row.sid).then((resp) => { |
|
|
@ -185,26 +153,15 @@ export default { |
|
|
|
this.formobj = row |
|
|
|
}) |
|
|
|
}, |
|
|
|
changeBrand(value) { |
|
|
|
const choose = this.brand_list.filter((item) => item.brandName === value) |
|
|
|
if (choose !== null && choose.length > 0) { |
|
|
|
this.formobj.brandSid = choose[0].sid |
|
|
|
} else { |
|
|
|
this.formobj.brandSid = '' |
|
|
|
} |
|
|
|
}, |
|
|
|
// 列表--选择 |
|
|
|
handleSelect() { |
|
|
|
if (this.formobj.brandName === '' || this.formobj.brandName === null || this.formobj.brandName === undefined) { |
|
|
|
this.$message({ showClose: true, type: 'error', message: '请先选择品牌' }) |
|
|
|
return |
|
|
|
} |
|
|
|
this.viewState = 2 |
|
|
|
this.$refs['divSelect'].showData(this.formobj.scmCollectionRebateWiths, this.formobj.createOrgSid, this.formobj.brandSid) |
|
|
|
this.$refs['divSelect'].showData(this.formobj.scmCollectionRebateWiths, this.formobj.createOrgSid) |
|
|
|
}, |
|
|
|
// 列表--选择返回数据 |
|
|
|
backData(value) { |
|
|
|
this.viewState = 1 |
|
|
|
value = JSON.parse(JSON.stringify(value)) |
|
|
|
for (var i in value) { |
|
|
|
let cval = value[i] |
|
|
|
if (!this.formobj.scmCollectionRebateWiths || this.formobj.scmCollectionRebateWiths.length === 0) { |
|
|
@ -212,10 +169,8 @@ export default { |
|
|
|
} |
|
|
|
let v = 0 |
|
|
|
for (var j in this.formobj.scmCollectionRebateWiths) { |
|
|
|
if (this.formobj.scmCollectionRebateWiths[j].collectionTypeValue === cval.collectionTypeValue && this.formobj.scmCollectionRebateWiths[j].calculationStandard === cval.calculationStandard) { |
|
|
|
this.formobj.scmCollectionRebateWiths[j].collectionMoney = parseFloat(this.formobj.scmCollectionRebateWiths[j].collectionMoney !== '' ? this.formobj.scmCollectionRebateWiths[j].collectionMoney : 0) + parseFloat(cval.collectionMoney !== '' ? cval.collectionMoney : 0) |
|
|
|
this.formobj.scmCollectionRebateWiths[j].freight = parseFloat(this.formobj.scmCollectionRebateWiths[j].freight !== '' ? this.formobj.scmCollectionRebateWiths[j].freight : 0) + parseFloat(cval.freight !== '' ? cval.freight : 0) |
|
|
|
this.formobj.scmCollectionRebateWiths[j].estimateRebate = parseFloat(this.formobj.scmCollectionRebateWiths[j].estimateRebate !== '' ? this.formobj.scmCollectionRebateWiths[j].estimateRebate : 0) + parseFloat(cval.estimateRebate !== '' ? cval.estimateRebate : 0) |
|
|
|
if (this.formobj.scmCollectionRebateWiths[j].purchaseSystemName === cval.purchaseSystemName && this.formobj.scmCollectionRebateWiths[j].brandName === cval.brandName && this.formobj.scmCollectionRebateWiths[j].rebateTypeValue === cval.rebateTypeValue && this.formobj.scmCollectionRebateWiths[j].rebateName === cval.rebateName) { |
|
|
|
this.formobj.scmCollectionRebateWiths[j].estimateRebate = Math.round((parseFloat(this.formobj.scmCollectionRebateWiths[j].estimateRebate !== '' ? this.formobj.scmCollectionRebateWiths[j].estimateRebate : 0) + parseFloat(cval.estimateRebate !== '' ? cval.estimateRebate : 0)) * 100) / 100 |
|
|
|
this.formobj.scmCollectionRebateWiths[j].collectionRebateSids.push(cval.sid) |
|
|
|
v = 1 |
|
|
|
break |
|
|
@ -223,14 +178,14 @@ export default { |
|
|
|
} |
|
|
|
if (v === 0) { |
|
|
|
this.formobj.scmCollectionRebateWiths.push({ |
|
|
|
collectionTypeKey: cval.collectionTypeKey, |
|
|
|
collectionTypeValue: cval.collectionTypeValue, |
|
|
|
collectionMoney: cval.collectionMoney, |
|
|
|
freight: cval.freight, |
|
|
|
calculationStandard: cval.calculationStandard, |
|
|
|
estimateRebate: cval.estimateRebate, |
|
|
|
purchaseSystemName: cval.purchaseSystemName, |
|
|
|
purchaseSystemSid: cval.purchaseSystemSid, |
|
|
|
brandName: cval.brandName, |
|
|
|
brandSid: cval.brandSid, |
|
|
|
rebateTypeKey: cval.rebateTypeKey, |
|
|
|
rebateTypeValue: cval.rebateTypeValue, |
|
|
|
rebateName: cval.rebateName, |
|
|
|
estimateRebate: cval.estimateRebate, |
|
|
|
collectionRebateSids: [cval.sid], |
|
|
|
sid: '', |
|
|
|
mainSid: '' |
|
|
@ -244,7 +199,7 @@ export default { |
|
|
|
this.$refs['divAdd'].showInfo(row) |
|
|
|
}, |
|
|
|
// 明细--查看返回数据 |
|
|
|
backAdd(value, collectionTypeValue, calculationStandard) { |
|
|
|
backAdd(value, purchaseSystemName, brandName, rebateTypeValue, rebateName) { |
|
|
|
this.viewState = 1 |
|
|
|
const aa = [] |
|
|
|
if (value.length > 0) { |
|
|
@ -252,10 +207,8 @@ export default { |
|
|
|
let cval = value[i] |
|
|
|
let v = 0 |
|
|
|
for (var j in aa) { |
|
|
|
if (aa[j].collectionTypeValue === cval.collectionTypeValue && aa[j].calculationStandard === cval.calculationStandard) { |
|
|
|
aa[j].collectionMoney = parseFloat(aa[j].collectionMoney !== '' ? aa[j].collectionMoney : 0) + parseFloat(cval.collectionMoney !== '' ? cval.collectionMoney : 0) |
|
|
|
aa[j].freight = parseFloat(aa[j].freight !== '' ? aa[j].freight : 0) + parseFloat(cval.freight !== '' ? cval.freight : 0) |
|
|
|
aa[j].estimateRebate = parseFloat(aa[j].estimateRebate !== '' ? aa[j].estimateRebate : 0) + parseFloat(cval.estimateRebate !== '' ? cval.estimateRebate : 0) |
|
|
|
if (aa[j].purchaseSystemName === cval.purchaseSystemName && aa[j].brandName === cval.brandName && aa[j].rebateTypeValue === cval.rebateTypeValue && aa[j].rebateName === cval.rebateName) { |
|
|
|
aa[j].estimateRebate = Math.round((parseFloat(aa[j].estimateRebate !== '' ? aa[j].estimateRebate : 0) + parseFloat(cval.estimateRebate !== '' ? cval.estimateRebate : 0)) * 100) / 100 |
|
|
|
aa[j].collectionRebateSids.push(cval.sid) |
|
|
|
v = 1 |
|
|
|
break |
|
|
@ -263,14 +216,14 @@ export default { |
|
|
|
} |
|
|
|
if (v === 0) { |
|
|
|
aa.push({ |
|
|
|
collectionTypeKey: cval.collectionTypeKey, |
|
|
|
collectionTypeValue: cval.collectionTypeValue, |
|
|
|
collectionMoney: cval.collectionMoney, |
|
|
|
freight: cval.freight, |
|
|
|
calculationStandard: cval.calculationStandard, |
|
|
|
estimateRebate: cval.estimateRebate, |
|
|
|
purchaseSystemName: cval.purchaseSystemName, |
|
|
|
purchaseSystemSid: cval.purchaseSystemSid, |
|
|
|
brandName: cval.brandName, |
|
|
|
brandSid: cval.brandSid, |
|
|
|
rebateTypeKey: cval.rebateTypeKey, |
|
|
|
rebateTypeValue: cval.rebateTypeValue, |
|
|
|
rebateName: cval.rebateName, |
|
|
|
estimateRebate: cval.estimateRebate, |
|
|
|
collectionRebateSids: [cval.sid], |
|
|
|
sid: '', |
|
|
|
mainSid: '' |
|
|
@ -278,22 +231,22 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
for (var k = 0; k < this.formobj.scmCollectionRebateWiths.length; k++) { |
|
|
|
if (this.formobj.scmCollectionRebateWiths[k].collectionTypeValue === collectionTypeValue && this.formobj.scmCollectionRebateWiths[k].calculationStandard === calculationStandard) { |
|
|
|
this.formobj.scmCollectionRebateWiths[k].collectionTypeKey = aa[0].collectionTypeKey |
|
|
|
this.formobj.scmCollectionRebateWiths[k].collectionTypeValue = aa[0].collectionTypeValue |
|
|
|
this.formobj.scmCollectionRebateWiths[k].collectionMoney = aa[0].collectionMoney |
|
|
|
this.formobj.scmCollectionRebateWiths[k].estimateRebate = aa[0].estimateRebate |
|
|
|
this.formobj.scmCollectionRebateWiths[k].freight = aa[0].freight |
|
|
|
this.formobj.scmCollectionRebateWiths[k].calculationStandard = aa[0].calculationStandard |
|
|
|
if (this.formobj.scmCollectionRebateWiths[k].purchaseSystemName === purchaseSystemName && this.formobj.scmCollectionRebateWiths[k].brandName === brandName && this.formobj.scmCollectionRebateWiths[k].rebateTypeValue === rebateTypeValue && this.formobj.scmCollectionRebateWiths[k].rebateName === rebateName) { |
|
|
|
this.formobj.scmCollectionRebateWiths[k].purchaseSystemName = aa[0].purchaseSystemName |
|
|
|
this.formobj.scmCollectionRebateWiths[k].purchaseSystemSid = aa[0].purchaseSystemSid |
|
|
|
this.formobj.scmCollectionRebateWiths[k].brandName = aa[0].brandName |
|
|
|
this.formobj.scmCollectionRebateWiths[k].brandSid = aa[0].brandSid |
|
|
|
this.formobj.scmCollectionRebateWiths[k].rebateTypeKey = aa[0].rebateTypeKey |
|
|
|
this.formobj.scmCollectionRebateWiths[k].rebateTypeValue = aa[0].rebateTypeValue |
|
|
|
this.formobj.scmCollectionRebateWiths[k].rebateName = aa[0].rebateName |
|
|
|
this.formobj.scmCollectionRebateWiths[k].estimateRebate = aa[0].estimateRebate |
|
|
|
this.formobj.scmCollectionRebateWiths[k].vehRebateSids = aa[0].vehRebateSids |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (value.length === 0) { |
|
|
|
for (var l = 0; l < this.formobj.scmCollectionRebateWiths.length; l++) { |
|
|
|
if (this.formobj.scmCollectionRebateWiths[l].collectionTypeValue === collectionTypeValue && this.formobj.scmCollectionRebateWiths[l].calculationStandard === calculationStandard) { |
|
|
|
if (this.formobj.scmCollectionRebateWiths[l].purchaseSystemName === purchaseSystemName && this.formobj.scmCollectionRebateWiths[l].brandName === brandName && this.formobj.scmCollectionRebateWiths[l].rebateTypeValue === rebateTypeValue && this.formobj.scmCollectionRebateWiths[l].rebateName === rebateName) { |
|
|
|
this.formobj.scmCollectionRebateWiths.splice(l, 1) |
|
|
|
break |
|
|
|
} |
|
|
@ -358,21 +311,6 @@ export default { |
|
|
|
}, 0) |
|
|
|
sums[index] += '' |
|
|
|
this.formobj.withRebateTotal = sums[index] += '' |
|
|
|
} else { |
|
|
|
if (!values.every(value => isNaN(value))) { |
|
|
|
sums[index] = values.reduce((prev, curr) => { |
|
|
|
const value = Number(curr) |
|
|
|
if (!isNaN(value)) { |
|
|
|
return prev + curr |
|
|
|
} else { |
|
|
|
return prev |
|
|
|
} |
|
|
|
}, 0) |
|
|
|
sums[index] += '' |
|
|
|
this.amount = sums[index] += '' |
|
|
|
} else { |
|
|
|
sums[index] = '' |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
return sums |
|
|
@ -383,11 +321,11 @@ export default { |
|
|
|
// 表单数据 |
|
|
|
this.formobj = { |
|
|
|
sid: '', |
|
|
|
brandName: '', |
|
|
|
brandSid: '', |
|
|
|
deptName: '', |
|
|
|
deptSid: '', |
|
|
|
collectionApply: '', |
|
|
|
createOrgName: '', |
|
|
|
createOrgSId: '', |
|
|
|
createOrgSid: '', |
|
|
|
useOrgName: '', |
|
|
|
useOrgSid: '', |
|
|
|
remarks: '', |
|
|
@ -406,13 +344,13 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped> |
|
|
|
.rowStyle { |
|
|
|
border-left: 0px; |
|
|
|
.span-sty { |
|
|
|
width: 130px !important; |
|
|
|
} |
|
|
|
.colOneStyle { |
|
|
|
border-right: 0px !important; |
|
|
|
border-bottom: 0px !important; |
|
|
|
.addinputInfo { |
|
|
|
margin-left: 120px !important; |
|
|
|
} |
|
|
|
</style> |
|
|
|
|
|
|
|