|
@@ -5,11 +5,11 @@
|
|
|
<div class="publish-seek">
|
|
<div class="publish-seek">
|
|
|
<div class="content-line">
|
|
<div class="content-line">
|
|
|
<span><i>*</i>型号:</span>
|
|
<span><i>*</i>型号:</span>
|
|
|
- <input type="text" v-model="applyObj.code" placeholder="请勿填中文符号">
|
|
|
|
|
|
|
+ <input type="text" v-model="applyObj.code" @blur="checkCode" @input="onCodeChange" placeholder="请勿填中文符号">
|
|
|
</div>
|
|
</div>
|
|
|
<div class="content-line">
|
|
<div class="content-line">
|
|
|
<span><i>*</i>品牌:</span>
|
|
<span><i>*</i>品牌:</span>
|
|
|
- <input type="text" v-model="applyObj.brand" placeholder="请勿填中文符号">
|
|
|
|
|
|
|
+ <input type="text" v-model="applyObj.brand" @blur="checkBrand" @input="onBrandChange" placeholder="请勿填中文符号">
|
|
|
</div>
|
|
</div>
|
|
|
<div class="content-line">
|
|
<div class="content-line">
|
|
|
<span><i>*</i>截止日期:</span>
|
|
<span><i>*</i>截止日期:</span>
|
|
@@ -28,11 +28,11 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="content-line">
|
|
<div class="content-line">
|
|
|
<span>数量:</span>
|
|
<span>数量:</span>
|
|
|
- <input type="number" v-model="applyObj.amount">
|
|
|
|
|
|
|
+ <input type="number" v-model="applyObj.amount" @blur="checkAmount" @input="onAmountInput">
|
|
|
</div>
|
|
</div>
|
|
|
<div class="content-line">
|
|
<div class="content-line">
|
|
|
<span>生产日期:</span>
|
|
<span>生产日期:</span>
|
|
|
- <input type="text" v-model="applyObj.produceDate">
|
|
|
|
|
|
|
+ <input type="text" v-model="applyObj.produceDate" @input="onProduceDateChange">
|
|
|
</div>
|
|
</div>
|
|
|
<a @click="goPublish">确认发布</a>
|
|
<a @click="goPublish">确认发布</a>
|
|
|
</div>
|
|
</div>
|
|
@@ -74,6 +74,15 @@
|
|
|
}
|
|
}
|
|
|
return len
|
|
return len
|
|
|
}
|
|
}
|
|
|
|
|
+ let cutOutString = function (str, length) {
|
|
|
|
|
+ for (let i = 1; i <= str.length; i++) {
|
|
|
|
|
+ if (getRealLen(str.substr(0, i)) > length) {
|
|
|
|
|
+ str = str.substr(0, i - 1)
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return str
|
|
|
|
|
+ }
|
|
|
export default {
|
|
export default {
|
|
|
props: ['showSayPriceBox'],
|
|
props: ['showSayPriceBox'],
|
|
|
data () {
|
|
data () {
|
|
@@ -88,6 +97,13 @@
|
|
|
amount: '',
|
|
amount: '',
|
|
|
deadline: ''
|
|
deadline: ''
|
|
|
},
|
|
},
|
|
|
|
|
+ validObj: {
|
|
|
|
|
+ code: true,
|
|
|
|
|
+ brand: true,
|
|
|
|
|
+ unitPrice: true,
|
|
|
|
|
+ amount: true,
|
|
|
|
|
+ deadline: true
|
|
|
|
|
+ },
|
|
|
showCurrencyList: false
|
|
showCurrencyList: false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -116,11 +132,12 @@
|
|
|
inquiry.enUU = this.user.data.enterprise.uu
|
|
inquiry.enUU = this.user.data.enterprise.uu
|
|
|
}
|
|
}
|
|
|
let date = new Date()
|
|
let date = new Date()
|
|
|
|
|
+ let endDate = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
|
|
|
inquiry.recorderUU = this.user.data.userUU
|
|
inquiry.recorderUU = this.user.data.userUU
|
|
|
inquiry.code = 'MALL' + date.getTime()
|
|
inquiry.code = 'MALL' + date.getTime()
|
|
|
inquiry.date = date
|
|
inquiry.date = date
|
|
|
inquiry.recorder = this.user.data.userName
|
|
inquiry.recorder = this.user.data.userName
|
|
|
- inquiry.endDate = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
|
|
|
|
|
|
|
+ inquiry.endDate = endDate
|
|
|
inquiry.sourceapp = 'MALL'
|
|
inquiry.sourceapp = 'MALL'
|
|
|
inquiry.amount = 1
|
|
inquiry.amount = 1
|
|
|
inquiryItem.prodTitle = this.applyObj.code
|
|
inquiryItem.prodTitle = this.applyObj.code
|
|
@@ -135,7 +152,7 @@
|
|
|
inquiryItem.unitPrice = this.applyObj.unitPrice
|
|
inquiryItem.unitPrice = this.applyObj.unitPrice
|
|
|
inquiryItem.produceDate = this.applyObj.produceDate
|
|
inquiryItem.produceDate = this.applyObj.produceDate
|
|
|
inquiryItem.date = date
|
|
inquiryItem.date = date
|
|
|
- inquiryItem.endDate = this.applyObj.deadline
|
|
|
|
|
|
|
+ inquiryItem.endDate = endDate
|
|
|
inquiryItem.encapsulation = this.applyObj.encapsulation
|
|
inquiryItem.encapsulation = this.applyObj.encapsulation
|
|
|
let inquiryItems = []
|
|
let inquiryItems = []
|
|
|
inquiryItems.push(inquiryItem)
|
|
inquiryItems.push(inquiryItem)
|
|
@@ -170,89 +187,85 @@
|
|
|
// this.$message.error('日期需不小于今天且在90天以内')
|
|
// this.$message.error('日期需不小于今天且在90天以内')
|
|
|
this.setRemindText('日期需不小于今天且在90天以内')
|
|
this.setRemindText('日期需不小于今天且在90天以内')
|
|
|
this.applyObj.deadline = ''
|
|
this.applyObj.deadline = ''
|
|
|
|
|
+ this.validObj.deadline = false
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.validObj.deadline = true
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
checkAll: function () {
|
|
checkAll: function () {
|
|
|
- return this.checkCode() && this.checkBrand() && this.checkDeadLine() && this.checkAmount() && this.checkProduceDate()
|
|
|
|
|
|
|
+ return this.checkCode() && this.checkBrand() && this.checkDeadline() && this.checkAmount()
|
|
|
},
|
|
},
|
|
|
checkCode: function () {
|
|
checkCode: function () {
|
|
|
- if (!this.applyObj.code) {
|
|
|
|
|
-// this.$message.error('型号不能为空')
|
|
|
|
|
- this.setRemindText('型号不能为空')
|
|
|
|
|
- return false
|
|
|
|
|
- } else if ((/[^\x00-\xff]/g).test(this.applyObj.code)) {
|
|
|
|
|
-// this.$message.error('型号不能包含中文及中文字符')
|
|
|
|
|
- this.setRemindText('型号不能包含中文及中文字符')
|
|
|
|
|
- return false
|
|
|
|
|
- } else if (getRealLen(this.applyObj.code) > 100) {
|
|
|
|
|
-// this.$message.error('型号不能超过100个字符')
|
|
|
|
|
- this.setRemindText('型号不能超过100个字符')
|
|
|
|
|
- return false
|
|
|
|
|
- } else {
|
|
|
|
|
- return true
|
|
|
|
|
|
|
+ this.validObj.code = this.applyObj.code && this.applyObj.code !== ''
|
|
|
|
|
+ if (!this.validObj.code) {
|
|
|
|
|
+ this.$message.error('型号不能为空')
|
|
|
}
|
|
}
|
|
|
|
|
+ return this.validObj.code
|
|
|
},
|
|
},
|
|
|
checkBrand: function () {
|
|
checkBrand: function () {
|
|
|
- let chineseIndex = -1
|
|
|
|
|
|
|
+ this.validObj.brand = this.applyObj.brand && this.applyObj.brand !== ''
|
|
|
|
|
+ if (!this.validObj.brand) {
|
|
|
|
|
+ this.$message.error('品牌不能为空')
|
|
|
|
|
+ }
|
|
|
|
|
+ return this.validObj.brand
|
|
|
|
|
+ },
|
|
|
|
|
+ checkAmount: function () {
|
|
|
|
|
+ this.validObj.amount = this.applyObj.amount === '' ? true : this.applyObj.amount > 0 && this.applyObj.amount < 1000000000
|
|
|
|
|
+ return this.validObj.amount
|
|
|
|
|
+ },
|
|
|
|
|
+ checkDeadline: function () {
|
|
|
|
|
+ this.validObj.deadline = Boolean(this.applyObj.deadline)
|
|
|
|
|
+ return this.validObj.deadline
|
|
|
|
|
+ },
|
|
|
|
|
+ onProduceDateChange: function () {
|
|
|
|
|
+ if (this.applyObj.produceDate && getRealLen(this.applyObj.produceDate) > 12) {
|
|
|
|
|
+ this.applyObj.produceDate = cutOutString(this.applyObj.produceDate, 12)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onCodeChange: function () {
|
|
|
|
|
+ this.applyObj.code = this.applyObj.code.trim()
|
|
|
|
|
+ if ((/[^\x00-\xff]/g).test(this.applyObj.code)) {
|
|
|
|
|
+ let chineseIndex = -1
|
|
|
|
|
+ for (let i = 0; i < this.applyObj.code.length; i++) {
|
|
|
|
|
+ if ((/[^\x00-\xff]/g).test(this.applyObj.code.charAt(i))) {
|
|
|
|
|
+ chineseIndex = i
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ this.applyObj.code = cutOutString(this.applyObj.code, chineseIndex)
|
|
|
|
|
+ } else if (this.applyObj.code && getRealLen(this.applyObj.code) > 100) {
|
|
|
|
|
+ this.applyObj.code = cutOutString(this.applyObj.code, 100)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onBrandChange: function () {
|
|
|
|
|
+ this.applyObj.brand = this.applyObj.brand.trim()
|
|
|
if ((/[^\x00-\xff]/g).test(this.applyObj.brand)) {
|
|
if ((/[^\x00-\xff]/g).test(this.applyObj.brand)) {
|
|
|
|
|
+ let chineseIndex = -1
|
|
|
for (let i = 0; i < this.applyObj.brand.length; i++) {
|
|
for (let i = 0; i < this.applyObj.brand.length; i++) {
|
|
|
if ((/[^\x00-\xff]/g).test(this.applyObj.brand.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.applyObj.brand.charAt(i))) {
|
|
if ((/[^\x00-\xff]/g).test(this.applyObj.brand.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.applyObj.brand.charAt(i))) {
|
|
|
chineseIndex = i
|
|
chineseIndex = i
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- if (!this.applyObj.brand) {
|
|
|
|
|
-// this.$message.error('品牌不能为空')
|
|
|
|
|
- this.setRemindText('品牌不能为空')
|
|
|
|
|
- return false
|
|
|
|
|
- } else if (chineseIndex !== -1) {
|
|
|
|
|
-// this.$message.error('品牌不能包含中文字符')
|
|
|
|
|
- this.setRemindText('品牌不能包含中文字符')
|
|
|
|
|
- return false
|
|
|
|
|
- } else if (getRealLen(this.applyObj.brand) > 50) {
|
|
|
|
|
-// this.$message.error('品牌不能超过50个字符')
|
|
|
|
|
- this.setRemindText('品牌不能超过50个字符')
|
|
|
|
|
- return false
|
|
|
|
|
- } else {
|
|
|
|
|
- return true
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- checkDeadLine: function () {
|
|
|
|
|
- if (!this.applyObj.deadline) {
|
|
|
|
|
-// this.$message.error('截止日期不能为空')
|
|
|
|
|
- this.setRemindText('截止日期不能为空')
|
|
|
|
|
- }
|
|
|
|
|
- return this.applyObj.deadline
|
|
|
|
|
- },
|
|
|
|
|
- checkAmount: function () {
|
|
|
|
|
- if (typeof this.applyObj.amount === 'undefined' || this.applyObj.amount === '') {
|
|
|
|
|
- return true
|
|
|
|
|
- } else {
|
|
|
|
|
- if (!(/^[0-9]*$/).test(this.applyObj.amount)) {
|
|
|
|
|
-// this.$message.error('请输入正确的数量')
|
|
|
|
|
- this.setRemindText('请输入正确的数量')
|
|
|
|
|
- return false
|
|
|
|
|
- } else if (this.applyObj.amount.length > 9) {
|
|
|
|
|
-// this.$message.error('数量不能大于999999999')
|
|
|
|
|
- this.setRemindText('数量不能大于999999999')
|
|
|
|
|
- return false
|
|
|
|
|
- } else {
|
|
|
|
|
- return true
|
|
|
|
|
|
|
+ if (chineseIndex > -1) {
|
|
|
|
|
+ this.applyObj.brand = this.applyObj.brand.substring(0, chineseIndex)
|
|
|
}
|
|
}
|
|
|
|
|
+ } else if (this.applyObj.brand && getRealLen(this.applyObj.brand) > 50) {
|
|
|
|
|
+ this.applyObj.brand = cutOutString(this.applyObj.brand, 50)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- checkProduceDate: function () {
|
|
|
|
|
- if (typeof this.applyObj.produceDate === 'undefined' || this.applyObj.produceDate === '') {
|
|
|
|
|
- return true
|
|
|
|
|
- } else {
|
|
|
|
|
- if (getRealLen(this.applyObj.produceDate) > 12) {
|
|
|
|
|
-// this.$message.error('生产日期不能大于12个字符')
|
|
|
|
|
- this.setRemindText('生产日期不能大于12个字符')
|
|
|
|
|
- return false
|
|
|
|
|
- } else {
|
|
|
|
|
- return true
|
|
|
|
|
|
|
+ onAmountInput: function () {
|
|
|
|
|
+ if (!(/^[0-9]*$/).test(this.applyObj.amount)) {
|
|
|
|
|
+ let chineseIndex = -1
|
|
|
|
|
+ for (let i = 0; i < this.applyObj.amount.length; i++) {
|
|
|
|
|
+ if (!(/^[0-9]*$/).test(this.applyObj.amount.charAt(i))) {
|
|
|
|
|
+ chineseIndex = i
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ this.applyObj.amount = cutOutString(this.applyObj.amount, chineseIndex)
|
|
|
|
|
+ } else if (this.applyObj.amount.length > 9) {
|
|
|
|
|
+ this.applyObj.amount = cutOutString(this.applyObj.amount, 9)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|