|
|
@@ -232,53 +232,65 @@
|
|
|
getRankBg: function (index) {
|
|
|
return index === 0 ? 1 : index < 3 ? 2 : 3
|
|
|
},
|
|
|
+ getMaterialKind: function (code, brand) {
|
|
|
+ return this.$http.get('/productuser/match/getKind', {params: {cmpCode: code, brand: brand}})
|
|
|
+ },
|
|
|
+ startPublish: function (prodTitle) {
|
|
|
+ let inquiry = {}
|
|
|
+ let inquiryItem = {}
|
|
|
+ if (this.user.data.enterprise) {
|
|
|
+ inquiry.enUU = this.user.data.enterprise.uu
|
|
|
+ }
|
|
|
+ let date = new Date()
|
|
|
+ let currency = this.applyObj.unitPrice ? this.applyObj.currency : null
|
|
|
+ inquiry.recorderUU = this.user.data.userUU
|
|
|
+ inquiry.code = 'MALL' + date.getTime()
|
|
|
+ inquiry.date = date
|
|
|
+ inquiry.recorder = this.user.data.userName
|
|
|
+ inquiry.endDate = this.applyObj.deadline
|
|
|
+ inquiry.sourceapp = 'MALL'
|
|
|
+ inquiry.amount = 1
|
|
|
+ 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.currency = currency
|
|
|
+ inquiryItem.cmpCode = this.applyObj.code.trim().toUpperCase()
|
|
|
+ inquiryItem.unitPrice = this.applyObj.unitPrice
|
|
|
+ inquiryItem.produceDate = this.applyObj.produceDate
|
|
|
+ inquiryItem.date = date
|
|
|
+ inquiryItem.endDate = this.applyObj.deadline
|
|
|
+ inquiryItem.encapsulation = this.applyObj.encapsulation
|
|
|
+ inquiryItem.spec = this.applyObj.spec
|
|
|
+ inquiryItem.prodTitle = prodTitle || this.applyObj.prodTitle || '其他'
|
|
|
+ let inquiryItems = []
|
|
|
+ inquiryItems.push(inquiryItem)
|
|
|
+ inquiry.inquiryItems = inquiryItems
|
|
|
+ inquiry.currency = this.applyObj.unitPrice ? this.applyObj.currency : null
|
|
|
+ this.$http.post('/inquiry/buyer/save', inquiry)
|
|
|
+ .then(response => {
|
|
|
+ this.$message.success('发布成功')
|
|
|
+// this.showRemindBox = true
|
|
|
+ this.emptyForm()
|
|
|
+// this.validObj.deadline = true
|
|
|
+ this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
|
|
|
+ }, error => {
|
|
|
+ console.log(error)
|
|
|
+ this.$message.error('发布失败')
|
|
|
+ })
|
|
|
+ },
|
|
|
goPublish: function () {
|
|
|
if (this.user.logged) {
|
|
|
if (this.checkAll()) {
|
|
|
- let inquiry = {}
|
|
|
- let inquiryItem = {}
|
|
|
- if (this.user.data.enterprise) {
|
|
|
- inquiry.enUU = this.user.data.enterprise.uu
|
|
|
- }
|
|
|
- let date = new Date()
|
|
|
- let currency = this.applyObj.unitPrice ? this.applyObj.currency : null
|
|
|
- inquiry.recorderUU = this.user.data.userUU
|
|
|
- inquiry.code = 'MALL' + date.getTime()
|
|
|
- inquiry.date = date
|
|
|
- inquiry.recorder = this.user.data.userName
|
|
|
- inquiry.endDate = this.applyObj.deadline
|
|
|
- inquiry.sourceapp = 'MALL'
|
|
|
- inquiry.amount = 1
|
|
|
- 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.currency = currency
|
|
|
- inquiryItem.cmpCode = this.applyObj.code.trim().toUpperCase()
|
|
|
- inquiryItem.unitPrice = this.applyObj.unitPrice
|
|
|
- inquiryItem.produceDate = this.applyObj.produceDate
|
|
|
- inquiryItem.date = date
|
|
|
- inquiryItem.endDate = this.applyObj.deadline
|
|
|
- inquiryItem.encapsulation = this.applyObj.encapsulation
|
|
|
- inquiryItem.spec = this.applyObj.spec
|
|
|
- inquiryItem.prodTitle = this.applyObj.prodTitle
|
|
|
- let inquiryItems = []
|
|
|
- inquiryItems.push(inquiryItem)
|
|
|
- inquiry.inquiryItems = inquiryItems
|
|
|
- inquiry.currency = this.applyObj.unitPrice ? this.applyObj.currency : null
|
|
|
- this.$http.post('/inquiry/buyer/save', inquiry)
|
|
|
- .then(response => {
|
|
|
- this.$message.success('发布成功')
|
|
|
-// this.showRemindBox = true
|
|
|
- this.emptyForm()
|
|
|
-// this.validObj.deadline = true
|
|
|
- this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
|
|
|
- }, error => {
|
|
|
- console.log(error)
|
|
|
- this.$message.error('发布失败')
|
|
|
+ if (!this.applyObj.prodTitle || this.applyObj.prodTitle.length === 0) {
|
|
|
+ this.getMaterialKind(this.applyObj.code, this.applyObj.brand).then(response => {
|
|
|
+ this.startPublish(response.data && response.data.length ? response.data : '其他')
|
|
|
})
|
|
|
+ } else {
|
|
|
+ this.startPublish()
|
|
|
+ }
|
|
|
} else {
|
|
|
if (!this.validObj.deadline) {
|
|
|
this.$message.error('截止日期不能为空')
|