|
@@ -32,6 +32,11 @@
|
|
|
<el-input v-model="baseInfoForm.deductWeight"></el-input>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
+ <div class="grid-content">
|
|
|
+ <el-form-item label="干粮收购价格">
|
|
|
+ <el-input v-model="baseInfoForm.dryGrainPrice"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="row2">
|
|
|
<div class="grid-content">
|
|
@@ -238,6 +243,7 @@
|
|
|
workflowId: '',
|
|
|
approveStatus: '',
|
|
|
passDate: '',
|
|
|
+ dryGrainPrice: '',
|
|
|
details: [],
|
|
|
detailPrints: []
|
|
|
},
|
|
@@ -249,16 +255,16 @@
|
|
|
activated() {
|
|
|
switch (this.$route.query.type) {
|
|
|
case "新增":
|
|
|
- let _goodsNameList = []
|
|
|
- this.baseInfoForm.warehouseId = this.$route.query.warehouseId
|
|
|
- this.baseInfoForm.warehouseName = this.$route.query.warehouseName
|
|
|
- this.baseInfoForm.compId = this.$route.query.compId
|
|
|
- this.type = this.$route.query.type
|
|
|
- console.log(this.baseInfoForm)
|
|
|
- _goodsNameList = this.$route.query.goodsNameList
|
|
|
- this.priceList[0].detailList[0].water = this.baseInfoForm.waterMin
|
|
|
- this.priceList[0].detailList[2].water = this.baseInfoForm.waterBase
|
|
|
- this.priceList[0].detailList[4].water = this.baseInfoForm.waterMax
|
|
|
+ let _goodsNameList = []
|
|
|
+ this.baseInfoForm.warehouseId = this.$route.query.warehouseId
|
|
|
+ this.baseInfoForm.warehouseName = this.$route.query.warehouseName
|
|
|
+ this.baseInfoForm.compId = this.$route.query.compId
|
|
|
+ this.type = this.$route.query.type
|
|
|
+ console.log(this.baseInfoForm)
|
|
|
+ _goodsNameList = this.$route.query.goodsNameList
|
|
|
+ this.priceList[0].detailList[0].water = this.baseInfoForm.waterMin
|
|
|
+ this.priceList[0].detailList[2].water = this.baseInfoForm.waterBase
|
|
|
+ this.priceList[0].detailList[4].water = this.baseInfoForm.waterMax
|
|
|
// 货名
|
|
|
packList({
|
|
|
constId: 'CON2'
|
|
@@ -285,12 +291,14 @@
|
|
|
case "编辑":
|
|
|
break;
|
|
|
case "查看":
|
|
|
- this.baseInfoForm =JSON.parse(this.$route.query.data)
|
|
|
- purchasePriceLook({id:this.baseInfoForm.id}).toPromise().then((response) => {
|
|
|
- console.log(response)
|
|
|
- // this.tableData = response.records
|
|
|
- // this.getList()
|
|
|
- })
|
|
|
+ this.baseInfoForm = JSON.parse(this.$route.query.data)
|
|
|
+ purchasePriceLook({
|
|
|
+ id: this.baseInfoForm.id
|
|
|
+ }).toPromise().then((response) => {
|
|
|
+ console.log(response)
|
|
|
+ // this.tableData = response.records
|
|
|
+ // this.getList()
|
|
|
+ })
|
|
|
break;
|
|
|
default:
|
|
|
break
|
|
@@ -530,10 +538,10 @@
|
|
|
},
|
|
|
closeCount() {
|
|
|
this.isCountShow = true
|
|
|
- this.splitPriceList = []
|
|
|
- this.$router.push({
|
|
|
- name: 'acquisitionManagement',
|
|
|
- })
|
|
|
+ // this.splitPriceList = []
|
|
|
+ // this.$router.push({
|
|
|
+ // name: 'acquisitionManagement',
|
|
|
+ // })
|
|
|
},
|
|
|
//处理表格数据
|
|
|
makeTableList() {
|
|
@@ -546,8 +554,7 @@
|
|
|
|
|
|
// 获取等级对应分界钱数
|
|
|
this.getSplitPrice()
|
|
|
- // 分界价钱数据
|
|
|
- // this.splitPriceList
|
|
|
+ // 构造表格等差数列
|
|
|
let _list = []
|
|
|
let _obj = {}
|
|
|
let _waterMin = parseFloat(this.baseInfoForm.waterMin)
|
|
@@ -581,9 +588,8 @@
|
|
|
}
|
|
|
this.tableData = _list
|
|
|
},
|
|
|
- // 获取分界价格数据
|
|
|
+ // 获取分界价格数据,构造分界价格区间数据
|
|
|
getSplitPrice() {
|
|
|
-
|
|
|
let _priceList = this.priceList
|
|
|
for (let i = 0; i < _priceList.length; i++) {
|
|
|
for (let k = 0; k < _priceList[i].checkList.length; k++) {
|
|
@@ -598,6 +604,7 @@
|
|
|
}
|
|
|
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),
|
|
@@ -609,13 +616,56 @@
|
|
|
}
|
|
|
console.log(_obj)
|
|
|
this.splitPriceList.push(_obj)
|
|
|
-
|
|
|
console.log(this.splitPriceList)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- getOtherPrice(list) {
|
|
|
-
|
|
|
+ // 获取当前价格左右价格区间数据
|
|
|
+ getOtherPrice(list, nowList, direction) {
|
|
|
+
|
|
|
+ //判断当前价格左右各有几个分界
|
|
|
+ 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
|
|
|
},
|
|
|
// 计算价格
|
|
|
calculatePrice(_waterMin) {
|
|
@@ -638,56 +688,40 @@
|
|
|
console.log(this.keepTwoDecimal(((parseFloat(this.baseInfoForm.waterBase) - _waterMin) / 0.5) * _list[k]
|
|
|
.betweenPrice))
|
|
|
_price = basePrice + (parseFloat(this.baseInfoForm.waterBase) - _waterMin) / 0.5 * _list[k]
|
|
|
- .betweenPrice;
|
|
|
+ .betweenPrice;
|
|
|
console.log(_price)
|
|
|
prcieList.push(this.keepTwoDecimal(_price))
|
|
|
} else if (_waterMin >= _list[k].priceStart && _waterMin < _list[k].priceEnd) {
|
|
|
// 当前段价格+其他段价格
|
|
|
- let _otherPice = this.getOtherPrice(_list[k])
|
|
|
+ let _otherPice = this.getOtherPrice(_list, _list[k], "leftBasic")
|
|
|
let _price1 = (_list[k].priceEnd - _waterMin) / 0.5 * _list[k].betweenPrice + _otherPice;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // _price+=_list[k].totalPrice
|
|
|
+ prcieList.push(basePrice + _price1)
|
|
|
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
//基准值
|
|
|
else if (_waterMin == parseFloat(this.baseInfoForm.waterBase)) {
|
|
|
- prcieList.push(this.keepTwoDecimal(basePrice))
|
|
|
+ prcieList.push(this.keepTwoDecimal(basePrice))
|
|
|
}
|
|
|
// 基准右边
|
|
|
else {
|
|
|
-
|
|
|
- if (_waterMin > _list[k].priceStart && _waterMin <=_list[k].priceEnd && !this.splitPriceList[i]
|
|
|
+ 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;
|
|
|
+ _price = basePrice - (_waterMin - parseFloat(this.baseInfoForm.waterBase)) / 0.5 * _list[k]
|
|
|
+ .betweenPrice;
|
|
|
console.log(_price)
|
|
|
prcieList.push(this.keepTwoDecimal(_price))
|
|
|
- } else if (_waterMin >= _list[k].priceStart && _waterMin < _list[k].priceEnd) {
|
|
|
+ } else if (_waterMin > _list[k].priceStart && _waterMin <= _list[k].priceEnd) {
|
|
|
// 当前段价格+其他段价格
|
|
|
- let _otherPice = this.getOtherPrice(_list[k])
|
|
|
- let _price1 = (_list[k].priceEnd - _waterMin) / 0.5 * _list[k].betweenPrice + _otherPice;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // _price+=_list[k].totalPrice
|
|
|
-
|
|
|
+ let _otherPice2 = this.getOtherPrice(_list, _list[k], "rightBasic")
|
|
|
+ let _price2 = (_waterMin - _list[k].priceEnd) / 0.5 * _list[k].betweenPrice + _otherPice2;
|
|
|
+ prcieList.push(basePrice - _price2)
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
return prcieList
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
}
|
|
|
</script>
|