You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
523 lines
32 KiB
523 lines
32 KiB
<template>
|
|
<div class="app-container">
|
|
<div v-show="viewState == 1">
|
|
<!--标题按钮部分开始-->
|
|
<div class="tab-header webtop">
|
|
<!--标题-->
|
|
<div>{{ viewTitle }}</div>
|
|
<!--start 添加修改按钮-->
|
|
<div>
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="save()">保存</el-button>
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submit()">提交</el-button>
|
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
|
|
</div>
|
|
</div>
|
|
<!--标题按钮部分结束-->
|
|
<!--Start 新增修改部分-->
|
|
<div class="listconadd">
|
|
<div class="titwu"><span>{{ formobj.checkApply }}专项返利核对审核申请</span></div>
|
|
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02">
|
|
<el-row style="border-top: 1px solid #E0E3EB">
|
|
<el-col :span="16">
|
|
<div class="span-sty">申请编号</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.billNo }}</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<div class="span-sty">申请日期</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.createTime }}</span></el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="8">
|
|
<div class="span-sty">分公司</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.createOrgName }}</span></el-form-item>
|
|
</el-col>
|
|
<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="8">
|
|
<div class="span-sty">申请人</div>
|
|
<el-form-item><span class="addinputInfo">{{ formobj.createByName }}</span></el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div class="title titleOne">
|
|
<div>本月上传返利核对情况(按返利类型统计)</div>
|
|
<el-button size="mini" type="primary" class="btntopblueline" @click="handleSelect()">选择</el-button>
|
|
</div>
|
|
<el-table :key="tableKey" :data="formobj.scmWhenSpecialrebateCheckapplydetailDetails" :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 prop="purchaseSystemName" label="采购系统" align="center" min-width="120" />
|
|
<el-table-column prop="brandName" label="品牌" align="center" min-width="100" />
|
|
<el-table-column prop="rebateTypeValue" label="返利类型" align="center" min-width="120" />
|
|
<el-table-column prop="num" label="数量" align="center" min-width="100" />
|
|
<el-table-column prop="withRebate" label="预提金额" align="center" min-width="120" />
|
|
<el-table-column prop="withholdCost" label="其中预提费用" align="center" min-width="140" />
|
|
<el-table-column prop="uploadMoney" label="上传金额" align="center" min-width="120" />
|
|
<el-table-column prop="stayDetermineMoney" label="其中待确认金额" align="center" min-width="150" />
|
|
<el-table-column prop="money" label="其中费用" align="center" min-width="120" />
|
|
<el-table-column prop="adjustmentMoney" label="返利调整金额" align="center" min-width="140" />
|
|
<el-table-column prop="fyAdjustmentMoney" label="其中费用调整金额" align="center" min-width="160" />
|
|
<el-table-column label="明细" align="center" min-width="100">
|
|
<template slot-scope="scope">
|
|
<el-button type="primary" size="mini" @click="handleLook(scope.row)">查看</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="title">本月上传返利核对情况(按预提年月统计)</div>
|
|
<el-table :key="lastSpecialrebateKey" :data="formobj.scmLastSpecialrebateCheckapplydetailDetails" border style="width: 100%">
|
|
<el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/>
|
|
<el-table-column prop="purchaseSystemName" label="采购系统" align="center" min-width="120" />
|
|
<el-table-column prop="brandName" label="品牌" align="center" min-width="100" />
|
|
<el-table-column prop="withholdingDate" label="预提年月" align="center" min-width="120" />
|
|
<el-table-column prop="num" label="预提数量" align="center" min-width="120" />
|
|
<el-table-column prop="withRebate" label="预提金额" align="center" min-width="120" />
|
|
<el-table-column prop="withholdCost" label="其中预提费用" align="center" min-width="140" />
|
|
<el-table-column prop="uploadMoney" label="上传金额" align="center" min-width="120" />
|
|
<el-table-column prop="stayDetermineMoney" label="其中待确认金额" align="center" min-width="150" />
|
|
<el-table-column prop="money" label="其中费用" align="center" min-width="120" />
|
|
<el-table-column prop="adjustmentMoney" label="返利调整金额" align="center" min-width="140" />
|
|
<el-table-column prop="fyAdjustmentMoney" label="其中费用调整金额" align="center" min-width="160" />
|
|
<el-table-column label="明细" align="center" min-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="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>
|
|
</div>
|
|
</div>
|
|
<!--End 添加修改部分-->
|
|
<yiheduizhuanxiangfanli v-show="viewState == 2" ref="divSelect" @backData="backData" @doback="resetState"/>
|
|
<specialrebatetobecheckedAdd v-show="viewState == 3" ref="divAdd" @backAdd="backAdd" @doback="resetState"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import req from '@/api/specialrebate/specialrebatecheck'
|
|
import { fetchBySid } from '@/api/cheliang/dictcommons'
|
|
import yiheduizhuanxiangfanli from './relation/yiheduizhuanxiangfanli'
|
|
import specialrebatetobecheckedAdd from './relation/specialrebatetobecheckedAdd'
|
|
|
|
export default {
|
|
name: 'SpecialRebateCheckAdd',
|
|
components: {
|
|
yiheduizhuanxiangfanli,
|
|
specialrebatetobecheckedAdd
|
|
},
|
|
data() {
|
|
return {
|
|
viewTitle: '',
|
|
viewState: 1,
|
|
index: 0,
|
|
tableKey: 0,
|
|
lastSpecialrebateKey: 1,
|
|
// 表单数据
|
|
formobj: {
|
|
sid: '',
|
|
createTime: '',
|
|
deptSid: '',
|
|
deptName: '',
|
|
createByName: '',
|
|
createBySid: '',
|
|
checkApply: '',
|
|
createOrgName: '',
|
|
createOrgSid: '',
|
|
useOrgName: '',
|
|
useOrgSid: '',
|
|
remarks: '',
|
|
instanceId: '', // 流程实例ID
|
|
taskId: '', // 任务ID
|
|
orgPath: '',
|
|
scmWhenSpecialrebateCheckapplydetailDetails: [],
|
|
scmLastSpecialrebateCheckapplydetailDetails: [],
|
|
scmSpecialrebateCheckapplydetailDetails: []
|
|
},
|
|
rules: {},
|
|
submitdisabled: false
|
|
}
|
|
},
|
|
methods: {
|
|
// 获取制单日期
|
|
newDate() {
|
|
let date = new Date()
|
|
let year = date.getFullYear() // 本年
|
|
let month = date.getMonth() // 上一月
|
|
let day = date.getDate() // 本日
|
|
if (month < 1 && day < 7) {
|
|
month = 12
|
|
year = date.getFullYear() - 1
|
|
} else if (month < 1 && day > 6) {
|
|
month = date.getMonth() + 1 // 本月
|
|
} else if (month > 0 && day > 6) {
|
|
month = date.getMonth() + 1 // 本月
|
|
} else if (month > 0 && day < 7) {
|
|
month = date.getMonth() // 上一月
|
|
}
|
|
this.formobj.checkApply = year + '年' + month + '月'
|
|
},
|
|
init() {
|
|
fetchBySid(this.formobj.createOrgSid).then((res) => {
|
|
if (res.success) {
|
|
this.formobj.createOrgName = res.data.name
|
|
this.formobj.useOrgName = res.data.name
|
|
}
|
|
})
|
|
},
|
|
showAdd(createOrgSid) {
|
|
this.$nextTick(() => {
|
|
this.$refs['form_obj'].clearValidate()
|
|
this.init()
|
|
this.newDate()
|
|
})
|
|
this.formobj.createOrgSid = createOrgSid
|
|
this.formobj.useOrgSid = createOrgSid
|
|
this.formobj.createByName = window.sessionStorage.getItem('name')
|
|
this.formobj.createBySid = window.sessionStorage.getItem('userSid')
|
|
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)
|
|
var nowDate = new Date()
|
|
var date = {
|
|
year: nowDate.getFullYear(),
|
|
month: nowDate.getMonth() + 1,
|
|
day: nowDate.getDate()
|
|
}
|
|
this.formobj.createTime = date.year + '-' + (date.month >= 10 ? date.month : '0' + date.month) + '-' + (date.day >= 10 ? date.day : '0' + date.day)
|
|
this.viewTitle = '【新增】专项返利核对审核申请'
|
|
},
|
|
showEdit(row) {
|
|
this.$nextTick(() => {
|
|
this.$refs['form_obj'].clearValidate()
|
|
})
|
|
this.viewTitle = '【编辑】专项返利核对审核申请'
|
|
console.log('编辑回显', row.sid)
|
|
req.fetchDetailsBySid(row.sid).then((resp) => {
|
|
if (resp.success) {
|
|
this.formobj = resp.data
|
|
this.formobj.instanceId = resp.data.procInstId
|
|
}
|
|
}).catch((e) => {
|
|
this.formobj = row
|
|
})
|
|
},
|
|
// 明细表添加一行数据
|
|
handleSelect() {
|
|
this.viewState = 2
|
|
this.$refs['divSelect'].showData(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails, this.formobj.createOrgSid)
|
|
},
|
|
backData(val) {
|
|
this.viewState = 1
|
|
var list = JSON.parse(JSON.stringify(val))
|
|
// 同一数据源
|
|
list.forEach((e) => {
|
|
this.formobj.scmSpecialrebateCheckapplydetailDetails.push(e)
|
|
})
|
|
// 将同一数据源进行拆分(1.按照返利类型统计 2.按照预提年月统计)
|
|
// 按照返利类型统计
|
|
list.forEach((e) => {
|
|
let v = 0
|
|
for (var i in this.formobj.scmWhenSpecialrebateCheckapplydetailDetails) {
|
|
if (this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].rebateTypeValue === e.rebateTypeValue && this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].purchaseSystemName === e.purchaseSystemName && this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].brandName === e.brandName) {
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].num = parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].num) + parseFloat(1)
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withRebate = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withRebate !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withRebate : 0) + parseFloat(e.estimateRebate !== '' ? e.estimateRebate : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withholdCost = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withholdCost !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withholdCost : 0) + parseFloat(e.withholdCost !== '' ? e.withholdCost : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].uploadMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].uploadMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].uploadMoney : 0) + (parseFloat(e.uploadMoney !== '' ? e.uploadMoney : 0) + parseFloat(e.secondaryUploadMoney !== '' ? e.secondaryUploadMoney : 0))) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].stayDetermineMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].stayDetermineMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].stayDetermineMoney : 0) + parseFloat(e.stayDetermineMoney !== '' ? e.stayDetermineMoney : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].adjustmentMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].adjustmentMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].adjustmentMoney : 0) + parseFloat(e.adjustmentMoney !== '' ? e.adjustmentMoney : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].money = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].money !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].money : 0) + parseFloat(e.money !== '' ? e.money : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].fyAdjustmentMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].fyAdjustmentMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].fyAdjustmentMoney : 0) + (parseFloat(e.money !== '' ? e.money : 0) - parseFloat(e.withholdCost !== '' ? e.withholdCost : 0))) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].specialRebateSids.push(e.sid)
|
|
v = 1
|
|
break
|
|
}
|
|
}
|
|
if (v === 0) {
|
|
// 第一次对比没有参照,放入参照物
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails.push({
|
|
rebateTypeKey: e.rebateTypeKey,
|
|
rebateTypeValue: e.rebateTypeValue,
|
|
num: 1,
|
|
withRebate: e.estimateRebate,
|
|
withholdCost: e.withholdCost,
|
|
purchaseSystemName: e.purchaseSystemName,
|
|
purchaseSystemSid: e.purchaseSystemSid,
|
|
brandName: e.brandName,
|
|
brandSid: e.brandSid,
|
|
uploadMoney: Math.round((parseFloat(e.uploadMoney !== '' ? e.uploadMoney : 0) + parseFloat(e.secondaryUploadMoney !== '' ? e.secondaryUploadMoney : 0)) * 100) / 100,
|
|
stayDetermineMoney: e.stayDetermineMoney,
|
|
adjustmentMoney: e.adjustmentMoney,
|
|
money: e.money,
|
|
fyAdjustmentMoney: Math.round((parseFloat(e.money !== '' ? e.money : 0) - parseFloat(e.withholdCost !== '' ? e.withholdCost : 0)) * 100) / 100,
|
|
specialRebateSids: [e.sid],
|
|
sid: '',
|
|
mainSid: ''
|
|
})
|
|
}
|
|
})
|
|
let k = 0
|
|
// 按照预提年月统计
|
|
list.forEach((s) => {
|
|
for (var l in this.formobj.scmLastSpecialrebateCheckapplydetailDetails) {
|
|
if (this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withholdingDate === s.withholdingDate && this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].purchaseSystemName === s.purchaseSystemName && this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].brandName === s.brandName) {
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].num = parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].num) + parseFloat(1)
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withRebate = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withRebate !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withRebate : 0) + parseFloat(s.estimateRebate !== '' ? s.estimateRebate : 0)) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withholdCost = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withholdCost !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withholdCost : 0) + parseFloat(s.withholdCost !== '' ? s.withholdCost : 0)) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].uploadMoney = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].uploadMoney !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].uploadMoney : 0) + (parseFloat(s.uploadMoney !== '' ? s.uploadMoney : 0) + parseFloat(s.secondaryUploadMoney !== '' ? s.secondaryUploadMoney : 0))) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].stayDetermineMoney = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].stayDetermineMoney !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].stayDetermineMoney : 0) + parseFloat(s.stayDetermineMoney !== '' ? s.stayDetermineMoney : 0)) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].adjustmentMoney = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].adjustmentMoney !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].adjustmentMoney : 0) + parseFloat(s.adjustmentMoney !== '' ? s.adjustmentMoney : 0)) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].money = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].money !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].money : 0) + parseFloat(s.money !== '' ? s.money : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[l].fyAdjustmentMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[l].fyAdjustmentMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[l].fyAdjustmentMoney : 0) + (parseFloat(s.money !== '' ? s.money : 0) - parseFloat(s.withholdCost !== '' ? s.withholdCost : 0))) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].specialRebateSids.push(s.sid)
|
|
k = 1
|
|
break
|
|
}
|
|
}
|
|
if (k === 0) {
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails.push({
|
|
withholdingDate: s.withholdingDate,
|
|
num: 1,
|
|
withRebate: s.estimateRebate,
|
|
withholdCost: s.withholdCost,
|
|
purchaseSystemName: s.purchaseSystemName,
|
|
purchaseSystemSid: s.purchaseSystemSid,
|
|
brandName: s.brandName,
|
|
brandSid: s.brandSid,
|
|
uploadMoney: Math.round((parseFloat(s.uploadMoney !== '' ? s.uploadMoney : 0) + parseFloat(s.secondaryUploadMoney !== '' ? s.secondaryUploadMoney : 0)) * 100) / 100,
|
|
stayDetermineMoney: s.stayDetermineMoney,
|
|
adjustmentMoney: s.adjustmentMoney,
|
|
money: s.money,
|
|
fyAdjustmentMoney: Math.round((parseFloat(s.money !== '' ? s.money : 0) - parseFloat(s.withholdCost !== '' ? s.withholdCost : 0)) * 100) / 100,
|
|
specialRebateSids: [s.sid],
|
|
sid: '',
|
|
mainSid: ''
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 明细表删除一行数据
|
|
dataDelete(index) {
|
|
this.formobj.baseVehinstallModpricedetails.splice(index, 1)
|
|
},
|
|
handleLook(row) {
|
|
this.viewState = 3
|
|
this.$refs['divAdd'].showInfo(row.specialRebateSids)
|
|
},
|
|
backAdd(val) {
|
|
this.viewState = 1
|
|
// 先将数据清空
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails = []
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails = []
|
|
var list = JSON.parse(JSON.stringify(val))
|
|
// 同一数据源
|
|
for (var n = 0; n < list.length; n++) {
|
|
for (var m = 0; m < this.formobj.scmSpecialrebateCheckapplydetailDetails.length; m++) {
|
|
if (list[n] === this.formobj.scmSpecialrebateCheckapplydetailDetails[m].sid) {
|
|
this.formobj.scmSpecialrebateCheckapplydetailDetails.splice(this.formobj.scmSpecialrebateCheckapplydetailDetails[m], 1)
|
|
}
|
|
}
|
|
}
|
|
// 将同一数据源进行拆分(1.按照返利类型统计 2.按照预提年月统计)
|
|
// 按照返利类型统计
|
|
this.formobj.scmSpecialrebateCheckapplydetailDetails.forEach((e) => {
|
|
let v = 0
|
|
for (var i in this.formobj.scmWhenSpecialrebateCheckapplydetailDetails) {
|
|
if (this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].rebateTypeValue === e.rebateTypeValue && this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].purchaseSystemName === e.purchaseSystemName && this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].brandName === e.brandName) {
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].num = parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].num) + parseFloat(1)
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withRebate = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withRebate !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withRebate : 0) + parseFloat(e.estimateRebate !== '' ? e.estimateRebate : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withholdCost = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withholdCost !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].withholdCost : 0) + parseFloat(e.withholdCost !== '' ? e.withholdCost : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].uploadMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].uploadMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].uploadMoney : 0) + (parseFloat(e.uploadMoney !== '' ? e.uploadMoney : 0) + parseFloat(e.secondaryUploadMoney !== '' ? e.secondaryUploadMoney : 0))) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].stayDetermineMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].stayDetermineMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].stayDetermineMoney : 0) + parseFloat(e.stayDetermineMoney !== '' ? e.stayDetermineMoney : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].adjustmentMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].adjustmentMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].adjustmentMoney : 0) + parseFloat(e.adjustmentMoney !== '' ? e.adjustmentMoney : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].money = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].money !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].money : 0) + parseFloat(e.money !== '' ? e.money : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].fyAdjustmentMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].fyAdjustmentMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].fyAdjustmentMoney : 0) + (parseFloat(e.money !== '' ? e.money : 0) - parseFloat(e.withholdCost !== '' ? e.withholdCost : 0))) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[i].specialRebateSids.push(e.sid)
|
|
v = 1
|
|
break
|
|
}
|
|
}
|
|
if (v === 0) {
|
|
// 第一次对比没有参照,放入参照物
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails.push({
|
|
rebateTypeKey: e.rebateTypeKey,
|
|
rebateTypeValue: e.rebateTypeValue,
|
|
num: 1,
|
|
withRebate: e.estimateRebate,
|
|
withholdCost: e.withholdCost,
|
|
purchaseSystemName: e.purchaseSystemName,
|
|
purchaseSystemSid: e.purchaseSystemSid,
|
|
brandName: e.brandName,
|
|
brandSid: e.brandSid,
|
|
uploadMoney: Math.round((parseFloat(e.uploadMoney !== '' ? e.uploadMoney : 0) + parseFloat(e.secondaryUploadMoney !== '' ? e.secondaryUploadMoney : 0)) * 100) / 100,
|
|
stayDetermineMoney: e.stayDetermineMoney,
|
|
adjustmentMoney: e.adjustmentMoney,
|
|
money: e.money,
|
|
fyAdjustmentMoney: Math.round((parseFloat(e.money !== '' ? e.money : 0) - parseFloat(e.withholdCost !== '' ? e.withholdCost : 0)) * 100) / 100,
|
|
specialRebateSids: [e.sid],
|
|
sid: '',
|
|
mainSid: ''
|
|
})
|
|
}
|
|
})
|
|
let k = 0
|
|
// 按照预提年月统计
|
|
this.formobj.scmSpecialrebateCheckapplydetailDetails.forEach((s) => {
|
|
for (var l in this.formobj.scmLastSpecialrebateCheckapplydetailDetails) {
|
|
if (this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withholdingDate === s.withholdingDate && this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].purchaseSystemName === s.purchaseSystemName && this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].brandName === s.brandName) {
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].num = parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].num) + parseFloat(1)
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withRebate = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withRebate !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withRebate : 0) + parseFloat(s.estimateRebate !== '' ? s.estimateRebate : 0)) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withholdCost = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withholdCost !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].withholdCost : 0) + parseFloat(s.withholdCost !== '' ? s.withholdCost : 0)) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].uploadMoney = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].uploadMoney !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].uploadMoney : 0) + (parseFloat(s.uploadMoney !== '' ? s.uploadMoney : 0) + parseFloat(s.secondaryUploadMoney !== '' ? s.secondaryUploadMoney : 0))) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].stayDetermineMoney = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].stayDetermineMoney !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].stayDetermineMoney : 0) + parseFloat(s.stayDetermineMoney !== '' ? s.stayDetermineMoney : 0)) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].adjustmentMoney = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].adjustmentMoney !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].adjustmentMoney : 0) + parseFloat(s.adjustmentMoney !== '' ? s.adjustmentMoney : 0)) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].money = Math.round((parseFloat(this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].money !== '' ? this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].money : 0) + parseFloat(s.money !== '' ? s.money : 0)) * 100) / 100
|
|
this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[l].fyAdjustmentMoney = Math.round((parseFloat(this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[l].fyAdjustmentMoney !== '' ? this.formobj.scmWhenSpecialrebateCheckapplydetailDetails[l].fyAdjustmentMoney : 0) + (parseFloat(s.money !== '' ? s.money : 0) - parseFloat(s.withholdCost !== '' ? s.withholdCost : 0))) * 100) / 100
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails[l].specialRebateSids.push(s.sid)
|
|
k = 1
|
|
break
|
|
}
|
|
}
|
|
if (k === 0) {
|
|
this.formobj.scmLastSpecialrebateCheckapplydetailDetails.push({
|
|
withholdingDate: s.withholdingDate,
|
|
num: 1,
|
|
withRebate: s.estimateRebate,
|
|
withholdCost: s.withholdCost,
|
|
purchaseSystemName: s.purchaseSystemName,
|
|
purchaseSystemSid: s.purchaseSystemSid,
|
|
brandName: s.brandName,
|
|
brandSid: s.brandSid,
|
|
uploadMoney: Math.round((parseFloat(s.uploadMoney !== '' ? s.uploadMoney : 0) + parseFloat(s.secondaryUploadMoney !== '' ? s.secondaryUploadMoney : 0)) * 100) / 100,
|
|
stayDetermineMoney: s.stayDetermineMoney,
|
|
adjustmentMoney: s.adjustmentMoney,
|
|
money: s.money,
|
|
fyAdjustmentMoney: Math.round((parseFloat(s.money !== '' ? s.money : 0) - parseFloat(s.withholdCost !== '' ? s.withholdCost : 0)) * 100) / 100,
|
|
specialRebateSids: [s.sid],
|
|
sid: '',
|
|
mainSid: ''
|
|
})
|
|
}
|
|
})
|
|
},
|
|
resetState() {
|
|
this.viewState = 1
|
|
},
|
|
save() {
|
|
console.log(this.formobj)
|
|
this.$refs['form_obj'].validate((valid) => {
|
|
if (valid) {
|
|
this.submitdisabled = true
|
|
req.save(this.formobj).then((resp) => {
|
|
this.submitdisabled = false
|
|
if (resp.success) {
|
|
this.$message({ showClose: true, type: 'success', message: resp.msg })
|
|
this.handleReturn('true')
|
|
}
|
|
}).catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
} else {
|
|
return false
|
|
}
|
|
})
|
|
},
|
|
submit() {
|
|
this.$refs['form_obj'].validate((valid) => {
|
|
if (valid) {
|
|
this.submitdisabled = true
|
|
req.submitVehicleApply(this.formobj).then((resp) => {
|
|
this.submitdisabled = false
|
|
if (resp.success) {
|
|
this.$message({ showClose: true, type: 'success', message: resp.msg })
|
|
this.handleReturn('true')
|
|
}
|
|
}).catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
} else {
|
|
return false
|
|
}
|
|
})
|
|
},
|
|
// 合计
|
|
getSummaries(param) {
|
|
const { columns, data } = param
|
|
const sums = []
|
|
columns.forEach((column, index) => {
|
|
if (index === 0) {
|
|
sums[index] = '合计'
|
|
return
|
|
}
|
|
const values = data.map(item => Number(item[column.property]))
|
|
if (column.property !== 'purchaseSystemName' && column.property !== 'brandName' && column.property !== 'rebateTypeValue' && column.property !== undefined) {
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
const value = Number(curr)
|
|
if (!isNaN(value)) {
|
|
return Math.round((parseFloat(prev) + parseFloat(curr)) * 100) / 100
|
|
} else {
|
|
return Math.round((parseFloat(prev)) * 100) / 100
|
|
}
|
|
}, 0)
|
|
sums[index] += ''
|
|
}
|
|
})
|
|
return sums
|
|
},
|
|
// 返回(===既判断)
|
|
handleReturn(isreload) {
|
|
if (isreload === 'true') this.$emit('reloadlist')
|
|
// 表单数据
|
|
this.formobj = {
|
|
sid: '',
|
|
createTime: '',
|
|
deptSid: '',
|
|
deptName: '',
|
|
createByName: '',
|
|
createBySid: '',
|
|
brandName: '',
|
|
brandSid: '',
|
|
checkApply: '',
|
|
createOrgName: '',
|
|
createOrgSid: '',
|
|
useOrgName: '',
|
|
useOrgSid: '',
|
|
remarks: '',
|
|
instanceId: '', // 流程实例ID
|
|
taskId: '', // 任务ID
|
|
orgPath: '',
|
|
scmWhenSpecialrebateCheckapplydetailDetails: [],
|
|
scmLastSpecialrebateCheckapplydetailDetails: [],
|
|
scmSpecialrebateCheckapplydetailDetails: []
|
|
}
|
|
this.$refs['form_obj'].resetFields()
|
|
this.$emit('doback')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
.span-sty {
|
|
width: 130px !important;
|
|
}
|
|
.addinputInfo {
|
|
margin-left: 120px !important;
|
|
}
|
|
.formaddcopy02 .el-row .el-col /deep/ .el-form-item .addinputw {
|
|
margin-left: 120px !important;
|
|
width: calc(100% - 115px);
|
|
}
|
|
.titleOne {
|
|
padding: 7px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
</style>
|
|
|
|
|