|
@@ -95,7 +95,8 @@
|
|
|
v-show="item1.type!=1&&item1.type!=2&&item1.type!=3" :disabled="!isEdit">-</el-button>
|
|
|
</div>
|
|
|
<div v-show="item1.type!=4">
|
|
|
- <input v-if='item1.type==1' class="water-price" v-model="baseInfoForm.waterMin" :disabled="item1.isWrite?false:true"></input>
|
|
|
+ <input v-if='item1.type==1' class="water-price" v-model="baseInfoForm.waterMin"
|
|
|
+ :disabled="item1.isWrite?false:true"></input>
|
|
|
<input v-if='item1.type==2' class="water-price" v-model="baseInfoForm.waterBase"
|
|
|
:disabled="item1.isWrite?false:true"></input>
|
|
|
<input v-if='item1.type==3' class="water-price" v-model="baseInfoForm.waterMax"
|
|
@@ -156,7 +157,9 @@
|
|
|
import {
|
|
|
packList,
|
|
|
} from '@/model/contarct/index'
|
|
|
- import { posthandle } from '@/model/purchasingManagement/index'
|
|
|
+ import {
|
|
|
+ posthandle
|
|
|
+ } from '@/model/purchasingManagement/index'
|
|
|
export default {
|
|
|
|
|
|
components: {
|
|
@@ -168,8 +171,8 @@
|
|
|
data() {
|
|
|
return {
|
|
|
price: 0,
|
|
|
- left:[],
|
|
|
- right:[],
|
|
|
+ left: [],
|
|
|
+ right: [],
|
|
|
selectVal: "",
|
|
|
goodnameList: [],
|
|
|
tableData: [],
|
|
@@ -243,8 +246,8 @@
|
|
|
// 货名
|
|
|
let _goodsNameList = []
|
|
|
_goodsNameList = this.$route.query.goodsNameList
|
|
|
- if(_goodsNameList==undefined){
|
|
|
- _goodsNameList=[]
|
|
|
+ if (_goodsNameList == undefined) {
|
|
|
+ _goodsNameList = []
|
|
|
}
|
|
|
packList({
|
|
|
constId: 'CON2'
|
|
@@ -264,18 +267,18 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(_goodsNameList.length==0){
|
|
|
+ if (_goodsNameList.length == 0) {
|
|
|
this.goodnameList = response
|
|
|
this.selectVal = response[0].constValue
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.goodnameList = _list
|
|
|
this.goodnameList = _list
|
|
|
- if(_list.length!=0){
|
|
|
- this.selectVal = _list[0].constValue
|
|
|
+ if (_list.length != 0) {
|
|
|
+ this.selectVal = _list[0].constValue
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- this.isCountShow = true
|
|
|
+ this.isCountShow = true
|
|
|
switch (this.$route.query.type) {
|
|
|
case "新增":
|
|
|
this.submitName = "提交"
|
|
@@ -347,11 +350,11 @@
|
|
|
this.submitName = "提交"
|
|
|
this.getData()
|
|
|
break;
|
|
|
- case "审核中":
|
|
|
- // this.isEdit = false;
|
|
|
- this.submitName = "通过"
|
|
|
- this.getData()
|
|
|
- break;
|
|
|
+ case "审核中":
|
|
|
+ // this.isEdit = false;
|
|
|
+ this.submitName = "通过"
|
|
|
+ this.getData()
|
|
|
+ break;
|
|
|
case "查看":
|
|
|
this.isEdit = false;
|
|
|
this.submitName = "计算"
|
|
@@ -376,8 +379,7 @@
|
|
|
this.makeLookPriceList()
|
|
|
})
|
|
|
},
|
|
|
- goodsChange(e) {
|
|
|
- },
|
|
|
+ goodsChange(e) {},
|
|
|
changeBaseWater(val) {
|
|
|
for (let i = 0; i < this.priceList.length; i++) {
|
|
|
for (let k = 0; k < this.priceList[i].detailList.length; k++) {
|
|
@@ -506,7 +508,7 @@
|
|
|
result = Math.round(result * 100) / 100;
|
|
|
return result;
|
|
|
},
|
|
|
- //保留两位小数
|
|
|
+ //保留两位小数
|
|
|
keepOneDecimal(num) {
|
|
|
var result = parseFloat(num);
|
|
|
if (isNaN(result)) {
|
|
@@ -580,7 +582,7 @@
|
|
|
});
|
|
|
} else {
|
|
|
that.priceList.splice(index, 1)
|
|
|
- that.baseInfoForm.details.split(index,1)
|
|
|
+ that.baseInfoForm.details.split(index, 1)
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
@@ -739,7 +741,7 @@
|
|
|
let _item1 = _item.detailList[j]
|
|
|
if (_item1.type == 4) {
|
|
|
if (_item1.jfprice == "" || _baseWaterValidate(0, 100, 3, '', 'deductWeight', parseFloat(_item1
|
|
|
- .jfprice))) {
|
|
|
+ .jfprice))) {
|
|
|
if (_item1.jfprice == "") {
|
|
|
this.$message.error('降幅价格不能为空!');
|
|
|
} else {
|
|
@@ -761,16 +763,16 @@
|
|
|
}
|
|
|
return true
|
|
|
},
|
|
|
- getEditCheckList(){
|
|
|
- let _data = this.baseInfoForm.details
|
|
|
- let _list = []
|
|
|
- for(let k = 0;k<_data.length;k++){
|
|
|
- let _list1 = []
|
|
|
- _list1 = _data[k].level.split(',')
|
|
|
- _list = _list.concat(_list1)
|
|
|
- }
|
|
|
- this.checkList = [...new Set(_list)];
|
|
|
- console.log(this.checkList)
|
|
|
+ getEditCheckList() {
|
|
|
+ let _data = this.baseInfoForm.details
|
|
|
+ let _list = []
|
|
|
+ for (let k = 0; k < _data.length; k++) {
|
|
|
+ let _list1 = []
|
|
|
+ _list1 = _data[k].level.split(',')
|
|
|
+ _list = _list.concat(_list1)
|
|
|
+ }
|
|
|
+ this.checkList = [...new Set(_list)];
|
|
|
+ console.log(this.checkList)
|
|
|
},
|
|
|
// 提交
|
|
|
submit() {
|
|
@@ -793,7 +795,7 @@
|
|
|
}
|
|
|
break;
|
|
|
case "编辑":
|
|
|
- this.getEditCheckList()
|
|
|
+ this.getEditCheckList()
|
|
|
isValidate = this.validate()
|
|
|
if (isValidate) {
|
|
|
purchasePriceEdit(this.baseInfoForm).toPromise().then((response) => {
|
|
@@ -801,41 +803,41 @@
|
|
|
})
|
|
|
}
|
|
|
break;
|
|
|
- case "审核中":
|
|
|
- // this.makePriceDataList()
|
|
|
- this.getEditCheckList()
|
|
|
+ case "审核中":
|
|
|
+ // this.makePriceDataList()
|
|
|
+ this.getEditCheckList()
|
|
|
isValidate = this.validate()
|
|
|
if (isValidate) {
|
|
|
purchasePriceEdit(this.baseInfoForm).toPromise().then((response) => {
|
|
|
let that = this
|
|
|
- this.$confirm(`是否确定通过?`, {
|
|
|
- cancelButtonText: '取消',
|
|
|
- confirmButtonText: '确定',
|
|
|
- type: 'warning',
|
|
|
- }).then(() => {
|
|
|
- //审核
|
|
|
- that.audit(this.baseInfoForm,true,2)
|
|
|
- })
|
|
|
+ this.$confirm(`是否确定通过?`, {
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(() => {
|
|
|
+ //审核
|
|
|
+ that.audit(this.baseInfoForm, true, 2)
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
//审核
|
|
|
- audit(item,status, status2) {
|
|
|
- posthandle({
|
|
|
+ audit(item, status, status2) {
|
|
|
+ posthandle({
|
|
|
taskId: item.taskId,
|
|
|
approved: status,
|
|
|
auditMind: '',
|
|
|
needReapply: status2 != undefined ? true : false,
|
|
|
})
|
|
|
- .toPromise()
|
|
|
- .then((response) => {
|
|
|
- this.isCountShow = false
|
|
|
- })
|
|
|
- .catch((req) => {
|
|
|
- this.$message.warning(req.message)
|
|
|
- })
|
|
|
+ .toPromise()
|
|
|
+ .then((response) => {
|
|
|
+ this.isCountShow = false
|
|
|
+ })
|
|
|
+ .catch((req) => {
|
|
|
+ this.$message.warning(req.message)
|
|
|
+ })
|
|
|
},
|
|
|
// 关闭
|
|
|
closeCount() {
|
|
@@ -861,325 +863,152 @@
|
|
|
} else {
|
|
|
_waterMax -= 0.5
|
|
|
}
|
|
|
- let priceList = this.calculatePrice(_waterMax)
|
|
|
- _obj = {
|
|
|
- waterMin:this.keepOneDecimal(_waterMax -0.4),
|
|
|
- waterMax:this.keepOneDecimal(_waterMax),
|
|
|
- price1: this.keepTwoDecimal(priceList[0]),
|
|
|
- price2: this.keepTwoDecimal(priceList[1]),
|
|
|
- price3: this.keepTwoDecimal(priceList[2]),
|
|
|
- priceOther: this.keepTwoDecimal(priceList[3]),
|
|
|
- }
|
|
|
+ let priceList = this.calculatePrice(_waterMax)
|
|
|
+ _obj = {
|
|
|
+ waterMin: this.keepOneDecimal(_waterMax - 0.4),
|
|
|
+ waterMax: this.keepOneDecimal(_waterMax),
|
|
|
+ price1: this.keepTwoDecimal(priceList[0]),
|
|
|
+ price2: this.keepTwoDecimal(priceList[1]),
|
|
|
+ price3: this.keepTwoDecimal(priceList[2]),
|
|
|
+ priceOther: this.keepTwoDecimal(priceList[3]),
|
|
|
+ }
|
|
|
_list.unshift(_obj)
|
|
|
}
|
|
|
_obj = {}
|
|
|
_waterMin = parseFloat(this.baseInfoForm.waterBase)
|
|
|
_waterMax = parseFloat(this.baseInfoForm.waterMax)
|
|
|
- _count = (_waterMax - _waterMin) / 0.5
|
|
|
+ _count = (_waterMax - _waterMin) / 0.5
|
|
|
for (let i = 0; i < _count; i++) {
|
|
|
if (i == 0) {
|
|
|
_waterMin += 0.4
|
|
|
} else {
|
|
|
_waterMin += 0.5
|
|
|
}
|
|
|
- let priceList = this.calculatePriceRight(_waterMin)
|
|
|
- _obj = {
|
|
|
- waterMin:this.keepOneDecimal(_waterMin - 0.4),
|
|
|
- waterMax:this.keepOneDecimal(_waterMin),
|
|
|
- price1: this.keepTwoDecimal(priceList[0]),
|
|
|
- price2: this.keepTwoDecimal(priceList[1]),
|
|
|
- price3: this.keepTwoDecimal(priceList[2]),
|
|
|
- priceOther: this.keepTwoDecimal(priceList[3]),
|
|
|
- }
|
|
|
+ let priceList = this.calculatePriceRight(_waterMin)
|
|
|
+ _obj = {
|
|
|
+ waterMin: this.keepOneDecimal(_waterMin - 0.4),
|
|
|
+ waterMax: this.keepOneDecimal(_waterMin),
|
|
|
+ price1: this.keepTwoDecimal(priceList[0]),
|
|
|
+ price2: this.keepTwoDecimal(priceList[1]),
|
|
|
+ price3: this.keepTwoDecimal(priceList[2]),
|
|
|
+ priceOther: this.keepTwoDecimal(priceList[3]),
|
|
|
+ }
|
|
|
_list.push(_obj)
|
|
|
- console.log("_list",_list)
|
|
|
-
|
|
|
+ console.log("_list", _list)
|
|
|
+
|
|
|
}
|
|
|
this.baseInfoForm.detailPrints = _list
|
|
|
this.tableData = _list
|
|
|
},
|
|
|
// 获取分界价格数据,构造分界价格区间数据
|
|
|
- getSplitPrice() {debugger
|
|
|
- this.left=[]
|
|
|
- this.right = []
|
|
|
- // let _priceList = this.priceList
|
|
|
- // for (let i = 0; i < _priceList.length; i++) {
|
|
|
- // for (let k = 0; k < _priceList[i].checkList.length; k++) {
|
|
|
- // let _obj = {}
|
|
|
- // _obj.level = _priceList[i].checkList[k]
|
|
|
- // _obj.basicUnitPrice = parseFloat(_priceList[i].basicUnitPrice)
|
|
|
- // _obj.priceList = []
|
|
|
- // _obj.haveSplit = false
|
|
|
- // for (let j = 0; j < _priceList[i].detailList.length; j++) {
|
|
|
- // if (_priceList[i].detailList[j].type == 5) {
|
|
|
- // _obj.haveSplit = true
|
|
|
- // }
|
|
|
- // if (_priceList[i].detailList[j].type != 4 && _priceList[i].detailList[j].type != 3) {
|
|
|
- // _obj.priceList.push({
|
|
|
- // index: j,
|
|
|
- // type: parseFloat(_priceList[i].detailList[j].type),
|
|
|
- // priceStart: parseFloat(_priceList[i].detailList[j].water),
|
|
|
- // priceEnd: parseFloat(_priceList[i].detailList[j + 2].water),
|
|
|
- // betweenPrice: parseFloat(_priceList[i].detailList[j + 1].jfprice),
|
|
|
- // totalPrice: (parseFloat(this.baseInfoForm.waterBase) - parseFloat(_priceList[i]
|
|
|
- // .detailList[j].water)) / 0.5 * parseFloat(_priceList[i].detailList[j + 1].jfprice)
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // this.splitPriceList.push(_obj)
|
|
|
- // }
|
|
|
- // }
|
|
|
+ getSplitPrice() {
|
|
|
+ this.left = []
|
|
|
+ this.right = []
|
|
|
let _priceList = this.priceList;
|
|
|
- for(let i=0;i<_priceList.length;i++){
|
|
|
- for (let k = 0; k < _priceList[i].checkList.length; k++) {
|
|
|
- let _leftObj = {}
|
|
|
+ for (let i = 0; i < _priceList.length; i++) {
|
|
|
+ for (let k = 0; k < _priceList[i].checkList.length; k++) {
|
|
|
+ let _leftObj = {}
|
|
|
_leftObj.level = _priceList[i].checkList[k]
|
|
|
_leftObj.basicUnitPrice = parseFloat(_priceList[i].basicUnitPrice)
|
|
|
_leftObj.priceList = []
|
|
|
_leftObj.haveSplit = false
|
|
|
|
|
|
- let _rightObj = {}
|
|
|
+ let _rightObj = {}
|
|
|
_rightObj.level = _priceList[i].checkList[k]
|
|
|
_rightObj.basicUnitPrice = parseFloat(_priceList[i].basicUnitPrice)
|
|
|
_rightObj.priceList = []
|
|
|
_rightObj.haveSplit = false
|
|
|
|
|
|
|
|
|
- for (let j = (_priceList[i].detailList.length+1)/2-1; j >=0; j--) {
|
|
|
- if(_priceList[i].detailList[j]&&_priceList[i].detailList[j].type != 4){
|
|
|
- if(_priceList[i].detailList[j].type != 1){
|
|
|
- let baseprice = ""
|
|
|
- if(j == (_priceList[i].detailList.length+1)/2-1){
|
|
|
- baseprice = parseFloat(_priceList[i].basicUnitPrice)
|
|
|
- }
|
|
|
- else{
|
|
|
- baseprice = parseFloat(_priceList[i].basicUnitPrice + (parseFloat(_priceList[i].detailList[j].water) -parseFloat(_priceList[i].detailList[j-2].water))/0.5*parseFloat(_priceList[i].detailList[j - 1].jfprice))
|
|
|
- }
|
|
|
+ for (let j = (_priceList[i].detailList.length + 1) / 2 - 1; j > 0; j--) {
|
|
|
+ if (_priceList[i].detailList[j] && _priceList[i].detailList[j].type != 4) {
|
|
|
+ if (_priceList[i].detailList[j].type != 1) {
|
|
|
+ let baseprice = ""
|
|
|
+ if (j == (_priceList[i].detailList.length + 1) / 2 - 1) {
|
|
|
+ baseprice = parseFloat(_priceList[i].basicUnitPrice)
|
|
|
+ } else {
|
|
|
+ baseprice = parseFloat(_priceList[i].basicUnitPrice + (parseFloat(_priceList[i].detailList[j + 2]
|
|
|
+ .water) - parseFloat(_priceList[i].detailList[j].water)) / 0.5 * parseFloat(_priceList[i]
|
|
|
+ .detailList[j + 1].jfprice))
|
|
|
+ }
|
|
|
_leftObj.priceList.push({
|
|
|
- index: j,
|
|
|
- priceStart: parseFloat(_priceList[i].detailList[j].water),
|
|
|
- priceEnd: parseFloat(_priceList[i].detailList[j-2].water),
|
|
|
- type: parseFloat(_priceList[i].detailList[j].type),
|
|
|
- water:_priceList[i].detailList[j].water,
|
|
|
- jfprice:parseFloat(_priceList[i].detailList[j - 1].jfprice),
|
|
|
- baseprice:baseprice,
|
|
|
- price:(parseFloat(_priceList[i].detailList[j].water) -parseFloat(_priceList[i].detailList[j-2].water))/0.5*parseFloat(_priceList[i].detailList[j - 1].jfprice)
|
|
|
- })
|
|
|
- }
|
|
|
+ index: j,
|
|
|
+ priceStart: parseFloat(_priceList[i].detailList[j].water),
|
|
|
+ priceEnd: parseFloat(_priceList[i].detailList[j - 2].water),
|
|
|
+ type: parseFloat(_priceList[i].detailList[j].type),
|
|
|
+ water: _priceList[i].detailList[j].water,
|
|
|
+ jfprice: parseFloat(_priceList[i].detailList[j - 1].jfprice),
|
|
|
+ baseprice: baseprice,
|
|
|
+ price: (parseFloat(_priceList[i].detailList[j].water) - parseFloat(_priceList[i].detailList[j -
|
|
|
+ 2].water)) / 0.5 * parseFloat(_priceList[i].detailList[j - 1].jfprice)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
this.left.push(_leftObj)
|
|
|
- for (let j = (_priceList[i].detailList.length+1)/2-1; j<=_priceList[i].detailList.length; j++) {
|
|
|
- if(_priceList[i].detailList[j]&&_priceList[i].detailList[j].type != 4){
|
|
|
- if(_priceList[i].detailList[j].type != 3){
|
|
|
- let baseprice = ""
|
|
|
- if(j == (_priceList[i].detailList.length+1)/2-1){
|
|
|
- baseprice = parseFloat(_priceList[i].basicUnitPrice)
|
|
|
- }
|
|
|
- else{
|
|
|
- baseprice = parseFloat(_priceList[i].basicUnitPrice - (parseFloat(_priceList[i].detailList[j].water) -parseFloat(_priceList[i].detailList[j-2].water))/0.5*parseFloat(_priceList[i].detailList[j - 1].jfprice))
|
|
|
- }
|
|
|
+ console.log("this.left", this.left)
|
|
|
+ for (let k = (_priceList[i].detailList.length + 1) / 2 - 1; k <= _priceList[i].detailList.length; k++) {
|
|
|
+ if (_priceList[i].detailList[k] && _priceList[i].detailList[k].type != 4) {
|
|
|
+ if (_priceList[i].detailList[k].type != 3) {
|
|
|
+ let baseprice = ""
|
|
|
+ if (k == (_priceList[i].detailList.length + 1) / 2 - 1) {
|
|
|
+ baseprice = parseFloat(_priceList[i].basicUnitPrice)
|
|
|
+ } else {
|
|
|
+ baseprice = parseFloat(_priceList[i].basicUnitPrice - (parseFloat(_priceList[i].detailList[k]
|
|
|
+ .water) - parseFloat(_priceList[i].detailList[k - 2].water)) / 0.5 * parseFloat(_priceList[i]
|
|
|
+ .detailList[k - 1].jfprice))
|
|
|
+ }
|
|
|
_rightObj.priceList.push({
|
|
|
- index: j,
|
|
|
- priceStart: parseFloat(_priceList[i].detailList[j].water),
|
|
|
- priceEnd: parseFloat(_priceList[i].detailList[j+2].water),
|
|
|
- type: parseFloat(_priceList[i].detailList[j].type),
|
|
|
- water:_priceList[i].detailList[j].water,
|
|
|
- jfprice:parseFloat(_priceList[i].detailList[j + 1].jfprice),
|
|
|
- baseprice:baseprice,
|
|
|
- price:(parseFloat(_priceList[i].detailList[j+2].water) -parseFloat(_priceList[i].detailList[j].water))/0.5*parseFloat(_priceList[i].detailList[j + 1].jfprice)
|
|
|
- })
|
|
|
- }
|
|
|
+ index: k,
|
|
|
+ priceStart: parseFloat(_priceList[i].detailList[k].water),
|
|
|
+ priceEnd: parseFloat(_priceList[i].detailList[k + 2].water),
|
|
|
+ type: parseFloat(_priceList[i].detailList[k].type),
|
|
|
+ water: _priceList[i].detailList[k].water,
|
|
|
+ jfprice: parseFloat(_priceList[i].detailList[k + 1].jfprice),
|
|
|
+ baseprice: baseprice,
|
|
|
+ price: (parseFloat(_priceList[i].detailList[k + 2].water) - parseFloat(_priceList[i].detailList[
|
|
|
+ k].water)) / 0.5 * parseFloat(_priceList[i].detailList[k + 1].jfprice)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
this.right.push(_rightObj)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // for (let j = 0; j < _priceList[i].detailList.length; j++) {
|
|
|
- // if (_priceList[i].detailList[j].type != 4) {
|
|
|
- // if(_priceList[i].detailList[j].water<this.baseInfoForm.waterBase){
|
|
|
- // _obj.priceList.push({
|
|
|
- // index: j,
|
|
|
- // priceStart: parseFloat(_priceList[i].detailList[j].water),
|
|
|
- // priceEnd: parseFloat(_priceList[i].detailList[j + 2].water),
|
|
|
- // type: parseFloat(_priceList[i].detailList[j].type),
|
|
|
- // water:_priceList[i].detailList[j].water,
|
|
|
- // price:(parseFloat(this.baseInfoForm.waterBase) -parseFloat(_priceList[i].detailList[j].water))/0.5*parseFloat(_priceList[i].detailList[j + 1].jfprice)
|
|
|
- // })
|
|
|
- // }
|
|
|
- // else if(_priceList[i].detailList[j].water==this.baseInfoForm.waterBase){
|
|
|
- // _obj.priceList.push({
|
|
|
- // index: j,
|
|
|
- // type: parseFloat(_priceList[i].detailList[j].type),
|
|
|
- // priceStart: _priceList[i].detailList[j].water,
|
|
|
- // priceEnd: _priceList[i].detailList[j].water,
|
|
|
- // water:_priceList[i].detailList[j].water,
|
|
|
- // price:_priceList[i].basicUnitPrice
|
|
|
- // })
|
|
|
- // }else{
|
|
|
-
|
|
|
- // _obj.priceList.push({
|
|
|
- // index: j,
|
|
|
- // type: parseFloat(_priceList[i].detailList[j].type),
|
|
|
- // water:_priceList[i].detailList[j].water,
|
|
|
- // priceStart: parseFloat(_priceList[i].detailList[j].water),
|
|
|
- // priceEnd: parseFloat(_priceList[i].detailList[j + 2].water),
|
|
|
- // price:(parseFloat(_priceList[i].detailList[j].water)-parseFloat(this.baseInfoForm.waterBase))/0.5*parseFloat(_priceList[i].detailList[j - 1].jfprice)
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // this.splitPriceList.push(_obj)
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ console.log("this.right", this.right)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 获取当前价格左右价格区间数据
|
|
|
- getOtherPrice(list, water, direction) {
|
|
|
-
|
|
|
- // let _leftTotalPrice = 0
|
|
|
- // let _rightTotalPrice = 0
|
|
|
- // for(let i = 0;i<list.length;i++){
|
|
|
- // if(water<list[i].priceEnd&&water>=list[i].priceStart){
|
|
|
- // this.price +=parseFloat(list[i].totalPrice)+parseFloat(list[i].betweenPrice)
|
|
|
- // }
|
|
|
- // }
|
|
|
- //判断当前价格左右各有几个分界,返回当前除当前分界其他分界价格和
|
|
|
- // for(let i=0;i<list.length;i++){
|
|
|
-
|
|
|
- // }
|
|
|
- // let _left = []
|
|
|
- // let _right = []
|
|
|
- // let _leftTotalPrice = 0
|
|
|
- // let _rightTotalPrice = 0
|
|
|
- // //当前分界左边价格
|
|
|
- // if (direction == "leftBasic") {
|
|
|
- // for (let i = 0; i < list.length; i++) {
|
|
|
- // if (nowList.index <= list[i].index && list[i].priceStart < 30) {
|
|
|
- // _right.push(list[i])
|
|
|
- // } else if (list[i].priceStart < 30) {
|
|
|
- // _left.push(list[i])
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (_left.length > 0) {
|
|
|
- // for (let j = 0; j < _left.length; j++) {
|
|
|
- // _leftTotalPrice += _left[j].totalPrice
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (_right.length > 0) {
|
|
|
- // for (let k = 0; k < _right.length; k++) {
|
|
|
- // _rightTotalPrice += _right[k].totalPrice
|
|
|
- // }
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // for (let m = 0; m < list.length; m++) {
|
|
|
- // if (nowList.index <= list[m].index && list[m].priceStart > 30) {
|
|
|
- // _left.push(list[m])
|
|
|
- // } else if (list[m].priceStart > 30) {
|
|
|
- // _right.push(list[m])
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (_left.length > 0) {
|
|
|
- // for (let j = 0; j < _left.length; j++) {
|
|
|
- // _leftTotalPrice += _left[j].totalPrice
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (_right.length > 0) {
|
|
|
- // for (let k = 0; k < _right.length; k++) {
|
|
|
- // _rightTotalPrice += _right[k].totalPrice
|
|
|
- // }
|
|
|
- // }
|
|
|
- // return _leftTotalPrice + _rightTotalPrice
|
|
|
- // return _price
|
|
|
- },
|
|
|
+ getOtherPrice(list, water, direction) {},
|
|
|
calculatePriceRight(_waterMax) {
|
|
|
- //获取每个分界值
|
|
|
- let _listResult = []
|
|
|
- for(let i = 0;i<this.right.length;i++){
|
|
|
+ //获取每个分界值
|
|
|
+ let _listResult = []
|
|
|
+ for (let i = 0; i < this.right.length; i++) {
|
|
|
let _list = this.right[i].priceList
|
|
|
let tmp = ""
|
|
|
- for (let k =0; k <_list.length; k++) {
|
|
|
- if(_waterMax < _list[k].priceEnd && _waterMax >= _list[k].priceStart){
|
|
|
- tmp = parseFloat(_list[k].baseprice - _list[k].jfprice*(((_waterMax-0.4) - _list[k].priceStart)*2))
|
|
|
- }
|
|
|
- }
|
|
|
- _listResult.push(tmp)
|
|
|
+ for (let k = 0; k < _list.length; k++) {
|
|
|
+ if (_waterMax < _list[k].priceEnd && _waterMax >= _list[k].priceStart) {
|
|
|
+ tmp = parseFloat(_list[k].baseprice - _list[k].jfprice * (((_waterMax - 0.4) - _list[k].priceStart) * 2))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _listResult.push(tmp)
|
|
|
}
|
|
|
- return _listResult
|
|
|
+ return _listResult
|
|
|
},
|
|
|
// 计算价格
|
|
|
- calculatePrice(_waterMax) {debugger
|
|
|
- let _listResult = []
|
|
|
- for(let i = 0;i<this.left.length;i++){
|
|
|
- let _list = this.left[i].priceList
|
|
|
- let tmp = ""
|
|
|
- for (let k =0; k <_list.length; k++) {
|
|
|
- if(_waterMax >= _list[k].priceEnd && _waterMax < _list[k].priceStart){
|
|
|
- tmp = parseFloat(_list[k].baseprice + _list[k].jfprice*((_list[k].priceStart - (_waterMax+0.1))*2+1))
|
|
|
- }
|
|
|
+ calculatePrice(_waterMax) {
|
|
|
+ let _listResult = []
|
|
|
+ for (let i = 0; i < this.left.length; i++) {
|
|
|
+ let _list = this.left[i].priceList
|
|
|
+ let tmp = ""
|
|
|
+ for (let k = 0; k < _list.length; k++) {
|
|
|
+ if (_waterMax >= _list[k].priceEnd && _waterMax < _list[k].priceStart) {
|
|
|
+ tmp = parseFloat(_list[k].baseprice + _list[k].jfprice * ((_list[k].priceStart - (_waterMax + 0.1)) * 2 +
|
|
|
+ 1))
|
|
|
}
|
|
|
- _listResult.push(tmp)
|
|
|
- }
|
|
|
- return _listResult
|
|
|
- // console.log(this.splitPriceList)
|
|
|
- // 当前水在哪个分界基于哪个分界值做处理
|
|
|
-
|
|
|
- // let prcieList = []
|
|
|
- // let totalPrice = []
|
|
|
- // let _price = 0
|
|
|
- // this.price = 0
|
|
|
- // for (let i = 0; i < this.splitPriceList.length; i++) {
|
|
|
- // let _list = this.splitPriceList[i].priceList
|
|
|
- // let basePrice = parseFloat(this.splitPriceList[i].basicUnitPrice)
|
|
|
- // for (let k = 0; k < _list.length; k++) {
|
|
|
- // //基准左边
|
|
|
- // if (_waterMin < parseFloat(this.baseInfoForm.waterBase)) {
|
|
|
- // // 未设置分界
|
|
|
- // if (_waterMin >= _list[k].priceStart && _waterMin < _list[k].priceEnd && !this.splitPriceList[i]
|
|
|
- // .haveSplit) {
|
|
|
- // _price = basePrice + (parseFloat(this.baseInfoForm.waterBase) - _waterMin) / 0.5 * _list[k]
|
|
|
- // .betweenPrice;
|
|
|
- // prcieList.push(this.keepTwoDecimal(_price))
|
|
|
- // } else if (_waterMin >= _list[k].priceStart && _waterMin < _list[k].priceEnd) {
|
|
|
- // // 当前区间段价格+其他区间段价格
|
|
|
- // // let _otherPice = this.getOtherPrice(_list, _waterMin, "leftBasic")
|
|
|
- // // let _price1 = (_list[k].priceEnd - _waterMin) / 0.5 * _list[k].betweenPrice
|
|
|
- // // prcieList.push(basePrice + _price1)
|
|
|
- // this.getOtherPrice(_list, _waterMin, "leftBasic")
|
|
|
- // prcieList.push(this.price)
|
|
|
-
|
|
|
- // }
|
|
|
- // }
|
|
|
- // //基准值
|
|
|
- // else if (_waterMin == parseFloat(this.baseInfoForm.waterBase)) {
|
|
|
- // prcieList.push(this.keepTwoDecimal(basePrice))
|
|
|
- // }
|
|
|
- // // 基准右边
|
|
|
- // else {
|
|
|
- // if (_waterMin > _list[k].priceStart && _waterMin <= _list[k].priceEnd && !this.splitPriceList[i]
|
|
|
- // .haveSplit) {
|
|
|
- // _price = basePrice - (_waterMin - parseFloat(this.baseInfoForm.waterBase)) / 0.5 * _list[k]
|
|
|
- // .betweenPrice;
|
|
|
- // prcieList.push(this.keepTwoDecimal(_price))
|
|
|
- // } else if (_waterMin > _list[k].priceStart && _waterMin <= _list[k].priceEnd) {
|
|
|
- // // 当前段价格+其他段价格
|
|
|
- // // let _otherPice2 = this.getOtherPrice(_list, _list[k], "rightBasic")
|
|
|
- // let _price2 = (_waterMin - _list[k].priceEnd) / 0.5 * _list[k].betweenPrice
|
|
|
- // prcieList.push(basePrice - _price2)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // return prcieList
|
|
|
+ }
|
|
|
+ _listResult.push(tmp)
|
|
|
+ }
|
|
|
+ return _listResult
|
|
|
},
|
|
|
// 构造查看粮价设置数据
|
|
|
makeLookPriceList() {
|