|
|
@@ -158,56 +158,61 @@
|
|
|
}
|
|
|
this.showCurrencyList = flag
|
|
|
},
|
|
|
+ getMaterialKind: function (code, brand) {
|
|
|
+ return this.$http.get('/productuser/match/getKind', {params: {cmpCode: code, brand: brand}})
|
|
|
+ },
|
|
|
goPublish: function () {
|
|
|
if (this.checkAll()) {
|
|
|
- let inquiry = {}
|
|
|
- let inquiryItem = {}
|
|
|
- if (this.user.data.enterprise) {
|
|
|
- inquiry.enUU = this.user.data.enterprise.uu
|
|
|
- }
|
|
|
- let date = new Date()
|
|
|
- let endDate = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
|
|
|
-// let currency = this.applyObj.currency === '不限' ? null : this.applyObj.currency
|
|
|
- let currency = null
|
|
|
- inquiry.recorderUU = this.user.data.userUU
|
|
|
- inquiry.code = 'MALL' + date.getTime()
|
|
|
- inquiry.date = date
|
|
|
- inquiry.recorder = this.user.data.userName
|
|
|
- inquiry.endDate = endDate
|
|
|
- inquiry.sourceapp = 'MALL'
|
|
|
- inquiry.amount = 1
|
|
|
- inquiryItem.prodTitle = this.applyObj.code
|
|
|
- inquiryItem.userUU = this.user.data.userUU
|
|
|
- inquiryItem.source = 'MALL'
|
|
|
- inquiryItem.userName = this.user.data.userName
|
|
|
- inquiryItem.userTel = this.user.data.userTel
|
|
|
- inquiryItem.needquantity = this.applyObj.amount
|
|
|
- inquiryItem.inbrand = this.applyObj.brand
|
|
|
- inquiryItem.custCurrency = currency
|
|
|
- inquiryItem.cmpCode = (this.applyObj.code).toUpperCase()
|
|
|
- inquiryItem.unitPrice = this.applyObj.unitPrice
|
|
|
- inquiryItem.produceDate = null
|
|
|
- inquiryItem.date = date
|
|
|
- inquiryItem.endDate = endDate
|
|
|
- inquiryItem.encapsulation = this.applyObj.encapsulation
|
|
|
- let inquiryItems = []
|
|
|
- inquiryItems.push(inquiryItem)
|
|
|
- inquiry.inquiryItems = inquiryItems
|
|
|
- inquiry.currency = currency
|
|
|
- this.$http.post('/inquiry/buyer/save', inquiry)
|
|
|
- .then(response => {
|
|
|
-// this.$message.success('发布成功')
|
|
|
- this.setRemindText('发布成功')
|
|
|
- // this.showRemindBox = true
|
|
|
- this.emptyForm()
|
|
|
- // this.validObj.deadline = true
|
|
|
- this.$emit('reloadAction')
|
|
|
- this.cancel()
|
|
|
- }, error => {
|
|
|
- console.log(error)
|
|
|
-// this.$message.error('发布失败')
|
|
|
- this.setRemindText('发布失败')
|
|
|
- })
|
|
|
+ this.getMaterialKind(this.applyObj.code, this.applyObj.brand).then(response => {
|
|
|
+ let inquiry = {}
|
|
|
+ let inquiryItem = {}
|
|
|
+ if (this.user.data.enterprise) {
|
|
|
+ inquiry.enUU = this.user.data.enterprise.uu
|
|
|
+ }
|
|
|
+ let date = new Date()
|
|
|
+ let endDate = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
|
|
|
+ // let currency = this.applyObj.currency === '不限' ? null : this.applyObj.currency
|
|
|
+ let currency = null
|
|
|
+ inquiry.recorderUU = this.user.data.userUU
|
|
|
+ inquiry.code = 'MALL' + date.getTime()
|
|
|
+ inquiry.date = date
|
|
|
+ inquiry.recorder = this.user.data.userName
|
|
|
+ inquiry.endDate = endDate
|
|
|
+ inquiry.sourceapp = 'MALL'
|
|
|
+ inquiry.amount = 1
|
|
|
+ inquiryItem.prodTitle = response.data && response.data.length ? response.data : '其他'
|
|
|
+ inquiryItem.userUU = this.user.data.userUU
|
|
|
+ inquiryItem.source = 'MALL'
|
|
|
+ inquiryItem.userName = this.user.data.userName
|
|
|
+ inquiryItem.userTel = this.user.data.userTel
|
|
|
+ inquiryItem.needquantity = this.applyObj.amount
|
|
|
+ inquiryItem.inbrand = this.applyObj.brand
|
|
|
+ inquiryItem.custCurrency = currency
|
|
|
+ inquiryItem.cmpCode = (this.applyObj.code).toUpperCase()
|
|
|
+ inquiryItem.unitPrice = this.applyObj.unitPrice
|
|
|
+ inquiryItem.produceDate = null
|
|
|
+ inquiryItem.date = date
|
|
|
+ inquiryItem.endDate = endDate
|
|
|
+ inquiryItem.encapsulation = this.applyObj.encapsulation
|
|
|
+ let inquiryItems = []
|
|
|
+ inquiryItems.push(inquiryItem)
|
|
|
+ inquiry.inquiryItems = inquiryItems
|
|
|
+ inquiry.currency = currency
|
|
|
+ this.$http.post('/inquiry/buyer/save', inquiry)
|
|
|
+ .then(response => {
|
|
|
+ // this.$message.success('发布成功')
|
|
|
+ this.setRemindText('发布成功')
|
|
|
+ // this.showRemindBox = true
|
|
|
+ this.emptyForm()
|
|
|
+ // this.validObj.deadline = true
|
|
|
+ this.$emit('reloadAction')
|
|
|
+ this.cancel()
|
|
|
+ }, error => {
|
|
|
+ console.log(error)
|
|
|
+ // this.$message.error('发布失败')
|
|
|
+ this.setRemindText('发布失败')
|
|
|
+ })
|
|
|
+ })
|
|
|
} else {
|
|
|
if (!this.validObj.code) {
|
|
|
this.setRemindText('型号不能为空')
|