|
|
@@ -36,7 +36,7 @@
|
|
|
<ul>
|
|
|
<li v-for="(purchaseMan, index) in purchaseManList.content" :class="{'active': purchaseMan.active}">
|
|
|
<div>{{purchaseMan.date| date}}</div>
|
|
|
- <div :title="purchaseMan.userName || purchaseMan.inquiry.enterprise.enName || '-'">{{purchaseMan.userName || purchaseMan.inquiry.enterprise.enName || '-'}}</div>
|
|
|
+ <div :title="purchaseMan.userName || purchaseMan.inquiry.enterprise ? purchaseMan.inquiry.enterprise.enName ? purchaseMan.inquiry.enterprise.enName : '-' : '-' || '-'">{{purchaseMan.userName || purchaseMan.inquiry.enterprise ? purchaseMan.inquiry.enterprise.enName ? purchaseMan.inquiry.enterprise.enName : '-' : '-' || '-'}}</div>
|
|
|
<div :title="purchaseMan.cmpCode">{{purchaseMan.cmpCode || '-'}}</div>
|
|
|
<div :title="purchaseMan.inbrand">{{purchaseMan.inbrand || '-'}}</div>
|
|
|
<div class="date-content"><span>剩余 </span><span v-if="getDay(purchaseMan.remainingTime) > 0" v-text="getDay(purchaseMan.remainingTime)"></span><i v-if="getDay(purchaseMan.remainingTime) > 0"> 天 </i><span v-if="getDay(purchaseMan.remainingTime) <= 0" v-text="getHours(purchaseMan.remainingTime)"></span><i v-if="getDay(purchaseMan.remainingTime) <= 0" > 小时</i></div>
|
|
|
@@ -278,26 +278,30 @@
|
|
|
commitSayPrice: function () {
|
|
|
if (this.user.logged) {
|
|
|
if (this.user.data.enterprise.uu) {
|
|
|
- let purchaseMan = this.purchaseManList.content[this.currentSayPriceIndex]
|
|
|
- this.showLoading = true
|
|
|
- purchaseMan.leadtime = this.sayPriceObj.leadtime
|
|
|
- purchaseMan.replies = this.sayPriceObj.replies
|
|
|
- purchaseMan.vendUU = this.user.data.enterprise.uu
|
|
|
- purchaseMan.vendorUserUU = this.user.data.userUU
|
|
|
- this.$http.post('/inquiry/sale/item/save', purchaseMan).then(response => {
|
|
|
- this.showLoading = false
|
|
|
- if (response.data.success === false) {
|
|
|
- this.$message.error(response.data.message)
|
|
|
- } else {
|
|
|
- this.$message.success('报价成功')
|
|
|
- this.resetSayPrice()
|
|
|
- this.resetList()
|
|
|
- }
|
|
|
- }, error => {
|
|
|
- console.log(error)
|
|
|
- this.$message.error('系统错误')
|
|
|
- this.showLoading = false
|
|
|
- })
|
|
|
+ if (this.checkValid()) {
|
|
|
+ let purchaseMan = this.purchaseManList.content[this.currentSayPriceIndex]
|
|
|
+ this.showLoading = true
|
|
|
+ purchaseMan.leadtime = this.sayPriceObj.leadtime
|
|
|
+ purchaseMan.replies = this.sayPriceObj.replies
|
|
|
+ purchaseMan.vendUU = this.user.data.enterprise.uu
|
|
|
+ purchaseMan.vendorUserUU = this.user.data.userUU
|
|
|
+ this.$http.post('/inquiry/sale/item/save', purchaseMan).then(response => {
|
|
|
+ this.showLoading = false
|
|
|
+ if (response.data.success === false) {
|
|
|
+ this.$message.error(response.data.message)
|
|
|
+ } else {
|
|
|
+ this.$message.success('报价成功')
|
|
|
+ this.resetSayPrice()
|
|
|
+ this.resetList()
|
|
|
+ }
|
|
|
+ }, error => {
|
|
|
+ console.log(error)
|
|
|
+ this.$message.error('系统错误')
|
|
|
+ this.showLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error('请输入正确的报价信息')
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$message.error('个人账户不可报价')
|
|
|
}
|
|
|
@@ -369,21 +373,26 @@
|
|
|
},
|
|
|
onReplyPriceBlur: function (index) {
|
|
|
let price = this.sayPriceObj.replies[index].price
|
|
|
- if (price) {
|
|
|
- if (price <= 0) {
|
|
|
- this.$message.error('单价必须是大于0的数字')
|
|
|
- this.validSayPrice.repliesPrice = false
|
|
|
- } else {
|
|
|
- this.validSayPrice.repliesPrice = true
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message.error('单价必须是大于0的数字')
|
|
|
+ let limitDownObj = this.getLimitDownPrice()
|
|
|
+ if (!price || price <= 0) {
|
|
|
+ this.sayPriceObj.replies[index].price = ''
|
|
|
+ this.$message.error('输入值必须为正整数')
|
|
|
+ this.validSayPrice.repliesPrice = false
|
|
|
+ } else if (limitDownObj.index !== index && limitDownObj.price > price) {
|
|
|
+ this.$message.error('输入值必须大于#该梯度的下限#')
|
|
|
+ this.sayPriceObj.replies[index].price = ''
|
|
|
+ this.validSayPrice.repliesPrice = false
|
|
|
+ } else if ((index - 1 >= 0 && this.sayPriceObj.replies[index - 1].price >= price) || (index + 1 < this.sayPriceObj.replies.length && this.sayPriceObj.replies[index + 1].price <= price)) {
|
|
|
+ this.$message.error('输入值会导致梯度重叠,请重新修改')
|
|
|
+ this.sayPriceObj.replies[index].price = ''
|
|
|
this.validSayPrice.repliesPrice = false
|
|
|
+ } else {
|
|
|
+ this.validSayPrice.repliesPrice = true
|
|
|
}
|
|
|
},
|
|
|
onReplyLapQtyBlur: function (index) {
|
|
|
let lapQty = this.sayPriceObj.replies[index].lapQty
|
|
|
- let limitDownObj = this.getLimitDown()
|
|
|
+ let limitDownObj = this.getLimitDownQty()
|
|
|
if (!lapQty || lapQty < 1) {
|
|
|
this.sayPriceObj.replies[index].lapQty = ''
|
|
|
this.$message.error('输入值必须为正整数')
|
|
|
@@ -392,7 +401,7 @@
|
|
|
this.$message.error('输入值必须大于#该梯度的下限#')
|
|
|
this.sayPriceObj.replies[index].lapQty = ''
|
|
|
this.validSayPrice.repliesLapQty = false
|
|
|
- } else if ((index - 1 >= 0 && this.sayPriceObj.replies[index - 1].lapQty >= lapQty) || (index + 1 <= 4 && this.sayPriceObj.replies[index + 1].lapQty <= lapQty)) {
|
|
|
+ } else if ((index - 1 >= 0 && this.sayPriceObj.replies[index - 1].lapQty >= lapQty) || (index + 1 < this.sayPriceObj.replies.length && this.sayPriceObj.replies[index + 1].lapQty <= lapQty)) {
|
|
|
this.$message.error('输入值会导致梯度重叠,请重新修改')
|
|
|
this.sayPriceObj.replies[index].lapQty = ''
|
|
|
this.validSayPrice.repliesLapQty = false
|
|
|
@@ -400,7 +409,7 @@
|
|
|
this.validSayPrice.repliesLapQty = true
|
|
|
}
|
|
|
},
|
|
|
- getLimitDown: function () {
|
|
|
+ getLimitDownQty: function () {
|
|
|
for (let i = 0; i < this.sayPriceObj.replies.length; i++) {
|
|
|
if (this.sayPriceObj.replies[i].lapQty) {
|
|
|
return {
|
|
|
@@ -411,6 +420,20 @@
|
|
|
}
|
|
|
return {index: -1}
|
|
|
},
|
|
|
+ getLimitDownPrice: function () {
|
|
|
+ for (let i = 0; i < this.sayPriceObj.replies.length; i++) {
|
|
|
+ if (this.sayPriceObj.replies[i].price) {
|
|
|
+ return {
|
|
|
+ price: this.sayPriceObj.replies[i].price,
|
|
|
+ index: i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {index: -1}
|
|
|
+ },
|
|
|
+ checkValid: function () {
|
|
|
+ return this.validSayPrice.leadtime && this.validSayPrice.repliesLapQty && this.validSayPrice.repliesPrice
|
|
|
+ },
|
|
|
// onUnitPriceBlur: function () {
|
|
|
// if (this.sayPriceObj.unitPrice) {
|
|
|
// if (this.sayPriceObj.unitPrice <= 0) {
|