Browse Source

Merge remote-tracking branch 'origin/master'

shenjj 7 years ago
parent
commit
59466c1bc0

+ 53 - 48
components/mobile/applyPurchase/PublishSeek.vue

@@ -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('型号不能为空')

+ 1 - 1
components/mobile/applyPurchase/SeekList.vue

@@ -43,7 +43,7 @@
             <p class="over-deadline" v-else>已截止</p>
             <!--<a v-if="!userType && item.quoted == 1">已报价</a>-->
             <a v-if="!userType && item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && (user.logged && ((item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU  && !item.inquiry.enterprise)))" class="self-publish" @click="onRemind('此为贵公司的求购')">我要报价</a>
-            <a v-if="!(userType == 'saler' && seekType  && seekType != 'wait') && (item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && !(user.logged && ((item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU  && !item.inquiry.enterprise))))" @click="goSayPrice(item.id, index)">我要报价</a>
+            <a v-if="!(userType == 'saler' && seekType  && seekType != 'wait') && (item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && !(user.logged && ((item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU))))" @click="goSayPrice(item.id, index)">我要报价</a>
             <a v-if="((!userType || userType == 'buyer') && (seekType  && seekType != 'wait')) || (userType == 'saler' && seekType  && seekType != 'wait') || item.quoted == 1" @click="goSayPriceInfo(item.quteId || item.id, item.agreed, index)">查看报价</a>
           </div>
         </div>

+ 5 - 2
nuxt.config.js

@@ -2,6 +2,7 @@ const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
 const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://192.168.253.121:9090/platform-b2c')
 const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
+const materialUrl = process.env.MATERIAL_URL || (isProdMode ? 'https://api-product.usoftmall.com/' : 'http://218.17.158.219:24000/')
 
 module.exports = {
   router: {
@@ -80,7 +81,8 @@ module.exports = {
   dev: !isProdMode,
   env: {
     baseUrl,
-    commonUrl
+    commonUrl,
+    materialUrl
   },
   plugins: [
     {
@@ -166,6 +168,7 @@ module.exports = {
     '/b2b/**': baseUrl,
     '/commodity-service/**': baseUrl,
     '/background/**': baseUrl,
-    '/goods/**': baseUrl
+    '/goods/**': baseUrl,
+    '/productuser/**': materialUrl
   }
 }

+ 9 - 3
pages/mobile/user/index.vue

@@ -99,6 +99,7 @@
   import PageLoading from '~components/common/loading/PageLoading.vue'
   export default {
     layout: 'mobile',
+    middleware: 'authenticated',
     data () {
       return {
         userName: '',
@@ -147,6 +148,13 @@
         store.dispatch(route.query.type === 'saler' ? 'applyPurchase/loadPurchaseManList' : 'applyPurchase/loadBuyerUnSayPricePurchaseManList', params)
       ])
     },
+    watch: {
+      '$route.query': {
+        handler: function (val, old) {
+          this.switchSeek('wait')
+        }
+      }
+    },
     mounted: function () {
       this.$nextTick(() => {
         window.addEventListener('scroll', this.scroll, false)
@@ -237,10 +245,8 @@
       },
       switchType: function () {
         this.activeType = 'seek'
-        this.seekType = 'wait'
         this.seekKeyword = ''
         this.$router.push('/mobile/user' + (this.userType === 'saler' ? '?type=buyer' : '?type=saler'))
-        this.reloadData()
       },
       searchSeek: function () {
         this.isChange = true
@@ -460,7 +466,7 @@
             overflow: hidden;
             white-space: nowrap;
             text-overflow: ellipsis;
-            background: rgba(0, 0, 0, .4);
+            background: rgba(0, 0, 0, .6);
             &:active, &:focus, &:hover {
               background: #7d7d7d;
             }

+ 3 - 0
plugins/axios.js

@@ -14,9 +14,12 @@ service.interceptors.request.use(config => {
   if (isServer) {
     if (config.url.indexOf('/inquiry') === 0) {
       config.url = process.env.commonUrl + config.url
+    } else if (config.url.indexOf('/productsuer') === 0) {
+      config.url = process.env.materialUrl + config.url
     } else {
       config.url = process.env.baseUrl + config.url
     }
+    console.log(config.url)
     // config.headers.cookie = store.state.option.cookies + '; ' + store.state.option.sessionId
     // config.headers['User-Agent']
   } else {