|
|
@@ -87,48 +87,60 @@
|
|
|
setRemindText: function (str) {
|
|
|
this.$emit('remindAction', str)
|
|
|
},
|
|
|
+ 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 endDate = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
|
|
|
+ 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'
|
|
|
+ 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.cmpCode = (this.applyObj.code).toUpperCase()
|
|
|
+ inquiryItem.prodTitle = prodTitle || this.applyObj.prodTitle || '其他'
|
|
|
+ inquiryItem.date = date
|
|
|
+ inquiryItem.endDate = endDate
|
|
|
+ let inquiryItems = []
|
|
|
+ inquiryItems.push(inquiryItem)
|
|
|
+ inquiry.inquiryItems = inquiryItems
|
|
|
+ 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('发布失败')
|
|
|
+ })
|
|
|
+ },
|
|
|
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')
|
|
|
- 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'
|
|
|
- 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.cmpCode = (this.applyObj.code).toUpperCase()
|
|
|
- inquiryItem.prodTitle = this.applyObj.prodTitle
|
|
|
- inquiryItem.date = date
|
|
|
- inquiryItem.endDate = endDate
|
|
|
- let inquiryItems = []
|
|
|
- inquiryItems.push(inquiryItem)
|
|
|
- inquiry.inquiryItems = inquiryItems
|
|
|
- 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('发布失败')
|
|
|
+ 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.setRemindText('截止日期不能为空')
|