Browse Source

group

master
pengjun 2 years ago
parent
commit
6c49c4bab8
  1. 2
      src/components/customerOrg/customerOrgGroupAsbitem.vue
  2. 22
      src/views/customerOrg/customerOrgGroup.vue

2
src/components/customerOrg/customerOrgGroupAsbitem.vue

@ -75,7 +75,7 @@
prop="displayName" prop="displayName"
></el-table-column> ></el-table-column>
<el-table-column label="标准价格" prop="price" min-width="60" align="center"/> <el-table-column label="标准价格" prop="price" min-width="60" align="center"/>
<el-table-column label="折扣" prop="price" min-width="60" align="center">
<el-table-column label="折扣" min-width="60" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
@input="changeDiscount(scope.$index)" @input="changeDiscount(scope.$index)"

22
src/views/customerOrg/customerOrgGroup.vue

@ -654,8 +654,7 @@ export default {
} }
}).then(res =>{ }).then(res =>{
if(res.code != -1){ if(res.code != -1){
this.$message.success("操作成功");
//this.$message.success("");
// //
this.form.id = '' this.form.id = ''
// //
@ -672,28 +671,31 @@ export default {
madeNewGroupAsbitems(oldGroupAsbitems,newTotal){ madeNewGroupAsbitems(oldGroupAsbitems,newTotal){
newTotal = Number(newTotal).toFixed(2) newTotal = Number(newTotal).toFixed(2)
let newGroupAsbitems = [] let newGroupAsbitems = []
let oldTotal = 0
let oldTotal = Number(0)
oldGroupAsbitems.forEach(e =>{ oldGroupAsbitems.forEach(e =>{
oldTotal += Number(e.customerOrgGroupDetailMoney)
oldTotal += Number(e.asbitemMoney) //customerOrgGroupDetailMoney
}) })
oldTotal = oldTotal.toFixed(2)
oldTotal = Number(oldTotal).toFixed(2)
let discount = 0 let discount = 0
if(oldTotal != 0) discount = (newTotal * 100 /oldTotal).toFixed(2) if(oldTotal != 0) discount = (newTotal * 100 /oldTotal).toFixed(2)
oldTotal = 0
oldTotal = Number(0)
oldGroupAsbitems.forEach(e =>{ oldGroupAsbitems.forEach(e =>{
e.customerOrgGroupDetailPrice = (e.customerOrgGroupDetailPrice * discount/100).toFixed(2)
e.customerOrgGroupDetailPrice = (e.price * discount/100).toFixed(2)
e.customerOrgGroupDetailMoney = (e.customerOrgGroupDetailPrice * e.customerOrgGroupDetailAmount).toFixed(2) e.customerOrgGroupDetailMoney = (e.customerOrgGroupDetailPrice * e.customerOrgGroupDetailAmount).toFixed(2)
oldTotal += Number(e.customerOrgGroupDetailMoney) oldTotal += Number(e.customerOrgGroupDetailMoney)
}) })
oldTotal = oldTotal.toFixed(2)
oldTotal = Number(oldTotal).toFixed(2)
//console.log('discount,oldTotal',discount,oldTotal)
let didTotal = newTotal - oldTotal
let didTotal = Number(newTotal - oldTotal).toFixed(2)
if(didTotal != 0){ if(didTotal != 0){
for(let i = 0;i<oldGroupAsbitems.length;i++){ for(let i = 0;i<oldGroupAsbitems.length;i++){
if(oldGroupAsbitems[i].customerOrgGroupDetailAmount == 1){ if(oldGroupAsbitems[i].customerOrgGroupDetailAmount == 1){
oldGroupAsbitems[i].customerOrgGroupDetailPrice += Number(didTotal)
oldGroupAsbitems[i].customerOrgGroupDetailPrice = (Number(oldGroupAsbitems[i].customerOrgGroupDetailPrice) + Number(didTotal)).toFixed(2)
break
} }
} }
} }

Loading…
Cancel
Save