|
@@ -14,7 +14,12 @@
|
|
<div class="row1">
|
|
<div class="row1">
|
|
<div class="grid-content">
|
|
<div class="grid-content">
|
|
<el-form-item label="货名">
|
|
<el-form-item label="货名">
|
|
- <el-input v-model="baseInfoForm.goodsName"></el-input>
|
|
|
|
|
|
+ <!-- <el-input v-model="baseInfoForm.goodsName"></el-input> -->
|
|
|
|
+ <el-select v-model="selectVal" placeholder="请选择" @change="goodsChange">
|
|
|
|
+ <el-option v-for="item in goodnameList" :key="item.constValue" :label="item.constValue"
|
|
|
|
+ :value="item.constValue">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
<div class="grid-content">
|
|
<div class="grid-content">
|
|
@@ -104,7 +109,6 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
<el-button class="submit" @click="submit">提交</el-button>
|
|
<el-button class="submit" @click="submit">提交</el-button>
|
|
</el-row>
|
|
</el-row>
|
|
</el-main>
|
|
</el-main>
|
|
@@ -124,11 +128,13 @@
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="price3" label="三等单价">
|
|
<el-table-column prop="price3" label="三等单价">
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column prop="price4" label="等外单价">
|
|
|
|
|
|
+ <el-table-column prop="priceOther" label="等外单价">
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
<el-button class="submit" @click="closeCount">关闭</el-button>
|
|
<el-button class="submit" @click="closeCount">关闭</el-button>
|
|
|
|
+ <el-button class="submit" @click="print">打印</el-button>
|
|
|
|
+
|
|
</el-main>
|
|
</el-main>
|
|
</el-container>
|
|
</el-container>
|
|
</template>
|
|
</template>
|
|
@@ -136,6 +142,9 @@
|
|
import {
|
|
import {
|
|
purchasePriceAdd
|
|
purchasePriceAdd
|
|
} from '@/model/houseSelfCollect/index'
|
|
} from '@/model/houseSelfCollect/index'
|
|
|
|
+ import {
|
|
|
|
+ packList,
|
|
|
|
+ } from '@/model/contarct/index'
|
|
export default {
|
|
export default {
|
|
|
|
|
|
components: {
|
|
components: {
|
|
@@ -146,34 +155,36 @@
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ selectVal: "",
|
|
|
|
+ goodnameList: [],
|
|
tableData: [{
|
|
tableData: [{
|
|
waterMin: '10',
|
|
waterMin: '10',
|
|
waterMax: '20',
|
|
waterMax: '20',
|
|
price1: '30',
|
|
price1: '30',
|
|
price2: '30',
|
|
price2: '30',
|
|
price3: '30',
|
|
price3: '30',
|
|
- price4: '30',
|
|
|
|
|
|
+ priceOther: '30',
|
|
}, {
|
|
}, {
|
|
waterMin: '11',
|
|
waterMin: '11',
|
|
waterMax: '20',
|
|
waterMax: '20',
|
|
price1: '30',
|
|
price1: '30',
|
|
price2: '30',
|
|
price2: '30',
|
|
price3: '30',
|
|
price3: '30',
|
|
- price4: '30',
|
|
|
|
|
|
+ priceOther: '30',
|
|
}, {
|
|
}, {
|
|
waterMin: '12',
|
|
waterMin: '12',
|
|
waterMax: '20',
|
|
waterMax: '20',
|
|
price1: '30',
|
|
price1: '30',
|
|
price2: '30',
|
|
price2: '30',
|
|
price3: '30',
|
|
price3: '30',
|
|
- price4: '30',
|
|
|
|
|
|
+ priceOther: '30',
|
|
}, {
|
|
}, {
|
|
waterMin: '13',
|
|
waterMin: '13',
|
|
waterMax: '20',
|
|
waterMax: '20',
|
|
price1: '30',
|
|
price1: '30',
|
|
price2: '30',
|
|
price2: '30',
|
|
price3: '30',
|
|
price3: '30',
|
|
- price4: '30',
|
|
|
|
|
|
+ priceOther: '30',
|
|
}],
|
|
}],
|
|
isCountShow: true,
|
|
isCountShow: true,
|
|
priceList: [{
|
|
priceList: [{
|
|
@@ -235,17 +246,40 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- debugger
|
|
|
|
|
|
+ let _goodsNameList = []
|
|
this.baseInfoForm.warehouseId = this.$route.query.warehouseId
|
|
this.baseInfoForm.warehouseId = this.$route.query.warehouseId
|
|
this.baseInfoForm.warehouseName = this.$route.query.warehouseName
|
|
this.baseInfoForm.warehouseName = this.$route.query.warehouseName
|
|
this.baseInfoForm.compId = this.$route.query.compId
|
|
this.baseInfoForm.compId = this.$route.query.compId
|
|
this.type = this.$route.query.type
|
|
this.type = this.$route.query.type
|
|
console.log(this.baseInfoForm)
|
|
console.log(this.baseInfoForm)
|
|
|
|
+ _goodsNameList = this.$route.query.goodsNameList
|
|
this.priceList[0].detailList[0].water = this.baseInfoForm.waterMin
|
|
this.priceList[0].detailList[0].water = this.baseInfoForm.waterMin
|
|
this.priceList[0].detailList[2].water = this.baseInfoForm.waterBase
|
|
this.priceList[0].detailList[2].water = this.baseInfoForm.waterBase
|
|
this.priceList[0].detailList[4].water = this.baseInfoForm.waterMax
|
|
this.priceList[0].detailList[4].water = this.baseInfoForm.waterMax
|
|
switch (this.$route.query.type) {
|
|
switch (this.$route.query.type) {
|
|
case "新增":
|
|
case "新增":
|
|
|
|
+ // 货名
|
|
|
|
+ packList({
|
|
|
|
+ constId: 'CON2'
|
|
|
|
+ })
|
|
|
|
+ .toPromise()
|
|
|
|
+ .then((response) => {
|
|
|
|
+ let _list = []
|
|
|
|
+ for (let i = 0; i < response.length; i++) {
|
|
|
|
+ let _isAll = true
|
|
|
|
+ for (let j = 0; j < _goodsNameList.length; j++) {
|
|
|
|
+ if (response[i].constValue != _goodsNameList[j]) {
|
|
|
|
+ if (j == _goodsNameList.length - 1 && _isAll) {
|
|
|
|
+ _list.push(response[i])
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ _isAll = false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.goodnameList = _list
|
|
|
|
+ this.selectVal = _list[0].constValue
|
|
|
|
+ })
|
|
break;
|
|
break;
|
|
case "编辑":
|
|
case "编辑":
|
|
break;
|
|
break;
|
|
@@ -256,12 +290,11 @@
|
|
break
|
|
break
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- mounted() {
|
|
|
|
- debugger
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ mounted() {},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ goodsChange(e) {
|
|
|
|
+ console.log(e)
|
|
|
|
+ },
|
|
changeBaseWater(val) {
|
|
changeBaseWater(val) {
|
|
console.log('val', val)
|
|
console.log('val', val)
|
|
for (let i = 0; i < this.priceList.length; i++) {
|
|
for (let i = 0; i < this.priceList.length; i++) {
|
|
@@ -358,6 +391,28 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ // 算价格纠正精度不准
|
|
|
|
+ accMul(arg1, arg2) {
|
|
|
|
+ var m = 0,
|
|
|
|
+ s1 = arg1.toString(),
|
|
|
|
+ s2 = arg2.toString();
|
|
|
|
+ try {
|
|
|
|
+ m += s1.split(".")[1].length
|
|
|
|
+ } catch (e) {}
|
|
|
|
+ try {
|
|
|
|
+ m += s2.split(".")[1].length
|
|
|
|
+ } catch (e) {}
|
|
|
|
+ return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
|
|
|
|
+ },
|
|
|
|
+ keepTwoDecimal(num) {
|
|
|
|
+ var result = parseFloat(num);
|
|
|
|
+ if (isNaN(result)) {
|
|
|
|
+ console.log('传递参数错误,请检查!');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ result = Math.round(result * 100) / 100;
|
|
|
|
+ return result;
|
|
|
|
+ },
|
|
newSetPrice() {
|
|
newSetPrice() {
|
|
let _newObj = {
|
|
let _newObj = {
|
|
unitPrice: '',
|
|
unitPrice: '',
|
|
@@ -410,10 +465,9 @@
|
|
return false
|
|
return false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 提交
|
|
|
|
- submit() {
|
|
|
|
- debugger
|
|
|
|
- this.isCountShow = false
|
|
|
|
|
|
+
|
|
|
|
+ //构造新增价格数据
|
|
|
|
+ makePriceDataList() {
|
|
for (let k = 0; k < this.priceList.length; k++) {
|
|
for (let k = 0; k < this.priceList.length; k++) {
|
|
// 新增
|
|
// 新增
|
|
let _detailsObj = {
|
|
let _detailsObj = {
|
|
@@ -448,13 +502,21 @@
|
|
_detailsObj.point += ',' + this.priceList[k].detailList[i].water
|
|
_detailsObj.point += ',' + this.priceList[k].detailList[i].water
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- debugger
|
|
|
|
this.baseInfoForm.details.push(_detailsObj)
|
|
this.baseInfoForm.details.push(_detailsObj)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
|
|
|
|
+ //打印
|
|
|
|
+ print() {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ // 提交
|
|
|
|
+ submit() {
|
|
|
|
+ this.isCountShow = false
|
|
this.makeTableList()
|
|
this.makeTableList()
|
|
|
|
+ this.makePriceDataList()
|
|
|
|
+ this.baseInfoForm.goodsName = this.selectVal
|
|
purchasePriceAdd(this.baseInfoForm).toPromise().then((response) => {
|
|
purchasePriceAdd(this.baseInfoForm).toPromise().then((response) => {
|
|
console.log(response)
|
|
console.log(response)
|
|
// this.tableData = response.records
|
|
// this.tableData = response.records
|
|
@@ -463,6 +525,9 @@
|
|
closeCount() {
|
|
closeCount() {
|
|
this.isCountShow = true
|
|
this.isCountShow = true
|
|
this.splitPriceList = []
|
|
this.splitPriceList = []
|
|
|
|
+ this.$router.push({
|
|
|
|
+ name: 'acquisitionManagement',
|
|
|
|
+ })
|
|
},
|
|
},
|
|
//处理表格数据
|
|
//处理表格数据
|
|
makeTableList() {
|
|
makeTableList() {
|
|
@@ -480,7 +545,7 @@
|
|
let _list = []
|
|
let _list = []
|
|
let _obj = {}
|
|
let _obj = {}
|
|
let _waterMin = parseFloat(this.baseInfoForm.waterMin)
|
|
let _waterMin = parseFloat(this.baseInfoForm.waterMin)
|
|
- let _waterMax = this.baseInfoForm.waterMax
|
|
|
|
|
|
+ let _waterMax = parseFloat(this.baseInfoForm.waterMax)
|
|
let _count = (_waterMax - _waterMin) / 0.5 + 1
|
|
let _count = (_waterMax - _waterMin) / 0.5 + 1
|
|
for (let i = 0; i < _count; i++) {
|
|
for (let i = 0; i < _count; i++) {
|
|
if (i == 0) {
|
|
if (i == 0) {
|
|
@@ -491,7 +556,7 @@
|
|
price1: priceList[0],
|
|
price1: priceList[0],
|
|
price2: priceList[1],
|
|
price2: priceList[1],
|
|
price3: priceList[2],
|
|
price3: priceList[2],
|
|
- price4: priceList[3],
|
|
|
|
|
|
+ priceOther: priceList[3],
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
_waterMin += 0.5
|
|
_waterMin += 0.5
|
|
@@ -502,10 +567,11 @@
|
|
price1: priceList[0],
|
|
price1: priceList[0],
|
|
price2: priceList[1],
|
|
price2: priceList[1],
|
|
price3: priceList[2],
|
|
price3: priceList[2],
|
|
- price4: priceList[3],
|
|
|
|
|
|
+ priceOther: priceList[3],
|
|
}
|
|
}
|
|
}
|
|
}
|
|
_list.push(_obj)
|
|
_list.push(_obj)
|
|
|
|
+ this.baseInfoForm.detailPrints.push(_obj)
|
|
}
|
|
}
|
|
this.tableData = _list
|
|
this.tableData = _list
|
|
},
|
|
},
|
|
@@ -517,7 +583,7 @@
|
|
for (let k = 0; k < _priceList[i].checkList.length; k++) {
|
|
for (let k = 0; k < _priceList[i].checkList.length; k++) {
|
|
let _obj = {}
|
|
let _obj = {}
|
|
_obj.level = _priceList[i].checkList[k]
|
|
_obj.level = _priceList[i].checkList[k]
|
|
- _obj.basicUnitPrice = _priceList[i].basicUnitPrice
|
|
|
|
|
|
+ _obj.basicUnitPrice = parseFloat(_priceList[i].basicUnitPrice)
|
|
_obj.priceList = []
|
|
_obj.priceList = []
|
|
_obj.haveSplit = false
|
|
_obj.haveSplit = false
|
|
for (let j = 0; j < _priceList[i].detailList.length; j++) {
|
|
for (let j = 0; j < _priceList[i].detailList.length; j++) {
|
|
@@ -558,12 +624,18 @@
|
|
.waterBase) * 0.01
|
|
.waterBase) * 0.01
|
|
for (let k = 0; k < _list.length; k++) {
|
|
for (let k = 0; k < _list.length; k++) {
|
|
//基准左边
|
|
//基准左边
|
|
|
|
+ debugger
|
|
if (_waterMin < parseFloat(this.baseInfoForm.waterBase)) {
|
|
if (_waterMin < parseFloat(this.baseInfoForm.waterBase)) {
|
|
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) {
|
|
.haveSplit) {
|
|
- _price = basePrice + (parseFloat(this.baseInfoForm.waterBase) - _waterMin) / 0.5 *
|
|
|
|
- _list[k].betweenPrice
|
|
|
|
- prcieList.push(_price)
|
|
|
|
|
|
+ console.log(basePrice)
|
|
|
|
+ console.log(this.keepTwoDecimal(basePrice))
|
|
|
|
+ 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;
|
|
|
|
+ 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 _otherPice = this.getOtherPrice(_list[k])
|
|
@@ -577,12 +649,30 @@
|
|
|
|
|
|
}
|
|
}
|
|
//基准值
|
|
//基准值
|
|
- else if (_waterMin = parseFloat(this.baseInfoForm.waterBase)) {
|
|
|
|
-
|
|
|
|
|
|
+ else if (_waterMin == parseFloat(this.baseInfoForm.waterBase)) {
|
|
|
|
+ prcieList.push(this.keepTwoDecimal(basePrice))
|
|
}
|
|
}
|
|
// 基准右边
|
|
// 基准右边
|
|
else {
|
|
else {
|
|
|
|
|
|
|
|
+ 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;
|
|
|
|
+ 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 _price1 = (_list[k].priceEnd - _waterMin) / 0.5 * _list[k].betweenPrice + _otherPice;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // _price+=_list[k].totalPrice
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|