Browse Source

报价列表及报价

yangc 7 years ago
parent
commit
c2d3283a58
5 changed files with 288 additions and 219 deletions
  1. 244 186
      components/applyPurchase/ApplyInfo.vue
  2. 4 2
      nuxt.config.js
  3. 1 1
      pages/applyPurchase/index.vue
  4. 31 30
      store/applyPurchase.js
  5. 8 0
      store/index.js

+ 244 - 186
components/applyPurchase/ApplyInfo.vue

@@ -34,16 +34,16 @@
         <span>操作</span>
       </p>
       <ul>
-        <li v-for="purchaseMan in purchaseManList.content" :class="{'active': purchaseMan.active}">
-          <div>{{purchaseMan.releaseDate | date}}</div>
-          <div :title="getPurchaseManName(purchaseMan)">{{getPurchaseManName(purchaseMan)}}</div>
-          <div :title="purchaseMan.code">{{purchaseMan.code}}</div>
-          <div :title="purchaseMan.brand">{{purchaseMan.brand}}</div>
+        <li v-for="(purchaseMan, index) in purchaseManList.content" :class="{'active': purchaseMan.active}">
+          <div>{{purchaseMan.date| date}}</div>
+          <div :title="purchaseMan.userName || purchaseMan.inquiry.enterprise.enName || '-'">{{purchaseMan.userName || purchaseMan.inquiry.enterprise.enName || '-'}}</div>
+          <div :title="purchaseMan.cmpCode">{{purchaseMan.cmpCode || '-'}}</div>
+          <div :title="purchaseMan.inbrand">{{purchaseMan.inbrand || '-'}}</div>
           <div class="date-content"><span>剩余&nbsp;</span><span v-if="getDay(purchaseMan.remainingTime) > 0" v-text="getDay(purchaseMan.remainingTime)"></span><i v-if="getDay(purchaseMan.remainingTime) > 0">&nbsp;天&nbsp;</i><span v-if="getDay(purchaseMan.remainingTime) <= 0" v-text="getHours(purchaseMan.remainingTime)"></span><i v-if="getDay(purchaseMan.remainingTime) <= 0" >&nbsp;小时</i></div>
           <div class="number-content"><img src="/images/applyPurchase/hot-fire.png" alt="" v-if="purchaseMan.offerAmount > 10"><span :style="purchaseMan.offerAmount > 10 ? 'color: #ff9a00': ''">{{purchaseMan.offerAmount || 0}}</span>&nbsp;条</div>
           <div class="btn-content">
             <a>联系买家</a>
-            <a v-if="!purchaseMan.isOffer" @click="sayPrice(purchaseMan)">我要报价</a>
+            <a v-if="!purchaseMan.quoted || purchaseMan.quoted != 1" @click="sayPrice(purchaseMan, index)">我要报价</a>
             <div class="is-say-price" v-else>已报价 <img src="/images/applyPurchase/green-check.png" alt="">
               <div class="say-price-history">
                 <p class="price-title">历史报价</p>
@@ -77,9 +77,6 @@
             </div>
           </div>
           <div class="expand-content">
-            <div>
-              生产日期:{{purchaseMan.produceDate || '-'}}
-            </div>
             <div>
               封装:{{purchaseMan.encapsulation || '-'}}
             </div>
@@ -89,8 +86,11 @@
             <div>
               单价预算:<span>{{purchaseMan.unitPrice ? (purchaseMan.currency == 'RMB' ? '¥' : '$') + purchaseMan.unitPrice : '-'}}</span>
             </div>
+            <div>
+              规格:{{purchaseMan.produceDate || '-'}}
+            </div>
           </div>
-          <div class="say-price">
+          <!--<div class="say-price">
             <div>报价</div>
             <div>
               <i>*</i>单价
@@ -112,96 +112,84 @@
               <span @click="cancelSayPrice(purchaseMan)">取消</span>
               <span @click="commitSayPrice(purchaseMan)">提交</span>
             </div>
-          </div>
+          </div>-->
         </li>
       </ul>
     </div>
-    <div class="say-price-box">
-      <div class="title">
-        <div>型号:<span>PMDIDASJD</span></div>
-        <div>品牌:<span>台积电</span></div>
-        <i class="fa fa-close"></i>
-      </div>
-      <div class="content">
-        <div class="content-line">
-          <div class="form-item form-left">
-            <span><i>*</i>交期:</span>
-            <input type="text" class="form-control" placeholder="天数">
-            -
-            <input type="text" class="form-control" placeholder="天数">
-          </div>
-          <div class="form-item form-upload">
-            <label>
-              <span><i>+</i>添加附件</span>
-              <input type="file">
-            </label>
-            <!--<div>
-              <span>我是Excel的名字111</span>
-              <i class="fa fa-times-circle"></i>
-              <a href="">更换</a>
-            </div>-->
-          </div>
+    <div class="modal-wrap" v-if="currentSayPriceIndex > -1">
+      <div class="say-price-box" >
+        <div class="title">
+          <div>型号:<span :title="purchaseManList.content[currentSayPriceIndex].cmpCode">{{purchaseManList.content[currentSayPriceIndex].cmpCode}}</span></div>
+          <div>品牌:<span :title="purchaseManList.content[currentSayPriceIndex].inbrand">{{purchaseManList.content[currentSayPriceIndex].inbrand}}</span></div>
+          <i class="fa fa-close" @click="cancelSayPrice"></i>
         </div>
-        <div class="content-line">
-          <div class="form-item form-left">
-            <span><i>*</i>价格梯度:</span>
-            <input type="text" class="form-control" placeholder="数量">
-            -
-            <input type="text" class="form-control" placeholder="数量">
+        <div class="content">
+          <div class="content-line">
+            <div class="form-item form-left">
+              <span><i>*</i>交期:</span>
+              <input type="number" class="form-control" placeholder="天数" @input="onLeadtimeInput" @blur="onLeadtimeBlur" v-model="sayPriceObj.leadtime">
+              <!-- -
+              <input type="text" class="form-control" placeholder="天数">-->
+            </div>
+            <div class="form-item form-upload">
+              <label>
+                <span><i>+</i>添加附件</span>
+                <input type="file">
+              </label>
+              <!--<div>
+                <span>我是Excel的名字111</span>
+                <i class="fa fa-times-circle"></i>
+                <a href="">更换</a>
+              </div>-->
+            </div>
           </div>
-          <div class="form-item form-right">
-            <span><i>*</i>单价($):</span>
-            <input type="text" class="form-control" placeholder="单价">
-            <i class="fa fa-minus-circle"></i>
-            <i class="fa fa-plus-circle"></i>
+          <div class="content-line" v-for="(reply, index) in sayPriceObj.replies">
+            <div class="form-item form-left">
+              <span><i>*</i>价格梯度:</span>
+              <input type="number" class="form-control" @bulr="onReplyLapQtyBlur(index)" v-model="reply.lapQty" placeholder="数量">
+             <!-- -
+              <input type="text" class="form-control" placeholder="数量">-->
+            </div>
+            <div class="form-item form-right">
+              <span><i>*</i>单价({{purchaseManList.content[currentSayPriceIndex].currency == 'USD' ? '$' : '¥'}}):</span>
+              <input type="number" class="form-control" @input="onReplyPriceInput(index)" @blur="onReplyPriceBlur(index)" placeholder="单价" v-model="reply.price">
+              <i class="fa fa-minus-circle" v-if="sayPriceObj.replies.length > 1" @click="setReplies('sub', index)"></i>
+              <i class="fa fa-plus-circle" v-if="sayPriceObj.replies.length < 5" @click="setReplies('add', index)"></i>
+            </div>
           </div>
         </div>
-        <div class="content-line">
-          <div class="form-item form-left">
-            <span><i>*</i>价格梯度:</span>
-            <input type="text" class="form-control" placeholder="数量">
-            -
-            <input type="text" class="form-control" placeholder="数量">
-          </div>
-          <div class="form-item form-right">
-            <span><i>*</i>单价($):</span>
-            <input type="text" class="form-control" placeholder="单价">
-            <i class="fa fa-minus-circle"></i>
-            <i class="fa fa-plus-circle"></i>
-          </div>
+        <div class="operate">
+          <span @click="commitSayPrice">确定</span>
+          <span @click="cancelSayPrice">取消</span>
         </div>
       </div>
-      <div class="operate">
-        <span>确定</span>
-        <span>取消</span>
-      </div>
     </div>
     <page :total="totalCount" :page-size="pageSize"
           :current="nowPage" v-on:childEvent="listenPage"></page>
-    <loading v-if="showLoading"></loading>
+    <loading v-show="showLoading"></loading>
   </div>
 </template>
 <script>
-  let getRealLen = function (str) {
-    let len = 0
-    for (let i = 0; i < str.length; i++) {
-      if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
-        len += 2
-      } else {
-        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
-  }
+//  let getRealLen = function (str) {
+//    let len = 0
+//    for (let i = 0; i < str.length; i++) {
+//      if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
+//        len += 2
+//      } else {
+//        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
+//  }
   import Page from '~components/common/page/pageComponent.vue'
   import Loading from '~components/common/loading/PageLoading.vue'
   export default {
@@ -211,20 +199,23 @@
         nowPage: 1,
         sayPriceObj: {
           currency: 'RMB',
-          unitPrice: '',
-          minDay: '',
-          maxDay: '',
-          produceDate: '',
-          spId: ''
+          leadtime: '',
+          replies: [
+            {
+              lapQty: '',
+              price: ''
+            }
+          ]
         },
         validSayPrice: {
-          unitPrice: false,
-          minDay: false,
-          maxDay: false
+          leadtime: false,
+          repliesPrice: false,
+          repliesLapQty: false
         },
         keyWord: '',
         sorting: {},
-        showLoading: false
+        showLoading: false,
+        currentSayPriceIndex: -1
       }
     },
     components: {
@@ -264,149 +255,207 @@
       getHours: function (timeStamp) {
         return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
       },
-      getPurchaseManName: function (purchaseMan) {
-        return purchaseMan.enUu ? purchaseMan.userName : purchaseMan.userName.charAt(0) + '**'
-      },
+//      getPurchaseManName: function (purchaseMan) {
+//        return purchaseMan.enUu ? purchaseMan.userName : purchaseMan.userName.charAt(0) + '**'
+//      },
       listenPage: function (page) {
         this.nowPage = page
         this.resetList()
       },
-      sayPrice: function (purchaseMan) {
+      sayPrice: function (purchaseMan, index) {
         let _this = this
         for (let i = 0; i < this.purchaseManList.content.length; i++) {
           _this.purchaseManList.content[i].active = false
         }
         this.resetSayPrice()
         purchaseMan.active = true
+        this.currentSayPriceIndex = index
       },
-      cancelSayPrice: function (purchaseMan) {
-        purchaseMan.active = false
+      cancelSayPrice: function () {
+        this.purchaseManList.content[this.currentSayPriceIndex].active = false
+        this.currentSayPriceIndex = -1
       },
-      commitSayPrice: function (purchaseMan) {
+      commitSayPrice: function () {
         if (this.user.logged) {
-          if (this.checkAllSayPrice()) {
+          if (this.user.data.enterprise.uu) {
+            let purchaseMan = this.purchaseManList.content[this.currentSayPriceIndex]
             this.showLoading = true
-            this.sayPriceObj.spId = purchaseMan.id
-            this.sayPriceObj.currency = purchaseMan.currency || this.sayPriceObj.currency
-            this.$http.post('/seek/offer/saveOffer', this.sayPriceObj).then(response => {
-              if (response.data.success) {
+            purchaseMan.leadtime = this.sayPriceObj.leadtime
+            purchaseMan.replies = this.sayPriceObj.replies
+            purchaseMan.vendUU = this.user.data.enterprise.uu
+            purchaseMan.vendorUserUU = this.user.data.userUU
+            this.$http.post('/inquiry/sale/item/save', purchaseMan).then(response => {
+              this.showLoading = false
+              if (response.data.success === false) {
+                this.$message.error(response.data.message)
+              } else {
                 this.$message.success('报价成功')
-                this.nowPage = 1
                 this.resetSayPrice()
                 this.resetList()
-              } else {
-                this.$message.error(response.data.message)
               }
-              this.showLoading = false
             }, error => {
               console.log(error)
               this.$message.error('系统错误')
               this.showLoading = false
             })
           } else {
-            if (!this.validSayPrice.unitPrice) {
-              if (!this.sayPriceObj.unitPrice) {
-                this.$message.error('单价不能为空')
-              } else {
-                this.$message.error('单价必须是大于0的数字')
-              }
-            } else if (!this.validSayPrice.minDay || !this.validSayPrice.maxDay) {
-              if ((!this.sayPriceObj.minDay && this.sayPriceObj.minDay !== 0) || (!this.sayPriceObj.maxDay && this.sayPriceObj.maxDay !== 0)) {
-                this.$message.error('交期不能为空')
-              } else {
-                if (this.sayPriceObj.minDay > 31 || this.sayPriceObj.minDay < 1 || this.sayPriceObj.minDay.toString().indexOf('.') !== -1 || this.sayPriceObj.maxDay > 31 || this.sayPriceObj.maxDay < 1 || this.sayPriceObj.maxDay.toString().indexOf('.') !== -1) {
-                  this.$message.error('交期只能填写1-31之间的整数值')
-                } else {
-                  this.$message.error('最短交期应小于等于最长交期')
-                }
-              }
-            }
+            this.$message.error('个人账户不可报价')
           }
+//          if (this.checkAllSayPrice()) {
+//          } else {
+//            if (!this.validSayPrice.unitPrice) {
+//              if (!this.sayPriceObj.unitPrice) {
+//                this.$message.error('单价不能为空')
+//              } else {
+//                this.$message.error('单价必须是大于0的数字')
+//              }
+//            } else if (!this.validSayPrice.minDay || !this.validSayPrice.maxDay) {
+//              if ((!this.sayPriceObj.minDay && this.sayPriceObj.minDay !== 0) || (!this.sayPriceObj.maxDay && this.sayPriceObj.maxDay !== 0)) {
+//                this.$message.error('交期不能为空')
+//              } else {
+//                if (this.sayPriceObj.minDay > 31 || this.sayPriceObj.minDay < 1 || this.sayPriceObj.minDay.toString().indexOf('.') !== -1 || this.sayPriceObj.maxDay > 31 || this.sayPriceObj.maxDay < 1 || this.sayPriceObj.maxDay.toString().indexOf('.') !== -1) {
+//                  this.$message.error('交期只能填写1-31之间的整数值')
+//                } else {
+//                  this.$message.error('最短交期应小于等于最长交期')
+//                }
+//              }
+//            }
+//          }
         } else {
           this.$router.push('/auth/login?returnUrl=' + window.location.href)
         }
       },
       resetList: function () {
-        this.$store.dispatch('applyPurchase/loadPurchaseManList', {page: this.nowPage, count: this.pageSize, keyWord: this.keyWord, sorting: !this.sorting || JSON.stringify(this.sorting) === '{}' ? {releaseDate: 'DESC'} : this.sorting})
+        this.currentSayPriceIndex = -1
+        this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: this.nowPage, pageSize: this.pageSize, keyWord: this.keyWord, sorting: !this.sorting || JSON.stringify(this.sorting) === '{}' ? {releaseDate: 'DESC'} : this.sorting})
       },
       resetSayPrice: function () {
         this.sayPriceObj = {
           currency: 'RMB',
-          unitPrice: '',
-          minDay: '',
-          maxDay: '',
-          produceDate: '',
-          spId: ''
+          leadtime: '',
+          replies: [
+            {
+              lapQty: '',
+              price: ''
+            }
+          ]
         }
       },
-      onUnitPriceBlur: function () {
-        if (this.sayPriceObj.unitPrice) {
-          if (this.sayPriceObj.unitPrice <= 0) {
-            this.$message.error('单价必须是大于0的数字')
-            this.validSayPrice.unitPrice = false
-          } else {
-            this.validSayPrice.unitPrice = true
-          }
+      onLeadtimeInput: function () {
+        if (this.sayPriceObj.leadtime.length > 2) {
+          this.sayPriceObj.leadtime = this.sayPriceObj.leadtime.substring(0, 2)
+        }
+      },
+      onLeadtimeBlur: function () {
+        if (!this.sayPriceObj.leadtime || this.sayPriceObj.leadtime < 1 || this.sayPriceObj.leadtime > 31 || this.sayPriceObj.leadtime.toString().indexOf('.') !== -1) {
+          this.validSayPrice.leadtime = false
+          this.$message.error('交期只能填写1-31之间的整数值')
         } else {
-          this.$message.error('单价必须是大于0的数字')
-          this.validSayPrice.unitPrice = false
+          this.validSayPrice.leadtime = true
         }
       },
-      onUnitPriceChange: function () {
-        let price = this.sayPriceObj.unitPrice
+      onReplyPriceInput: function (index) {
+        let price = this.sayPriceObj.replies[index].price
         if (price >= 10000) {
-          this.sayPriceObj.unitPrice = price.substring(0, 4)
+          this.sayPriceObj.replies[index].price = price.substring(0, 4)
         } else if (price.indexOf('.') > -1) {
           let arr = price.split('.')
           if (arr[0].length > 4) {
-            this.sayPriceObj.unitPrice = Number(arr[0].substring(0, 4) + '.' + arr[1])
+            this.sayPriceObj.replies[index].price = Number(arr[0].substring(0, 4) + '.' + arr[1])
           } else if (arr[1].length > 6) {
-            this.sayPriceObj.unitPrice = Number(arr[0] + '.' + arr[1].substring(0, 6))
+            this.sayPriceObj.replies[index].price = Number(arr[0] + '.' + arr[1].substring(0, 6))
           }
         }
       },
-      onMinDayInput: function () {
-        this.sayPriceObj.minDay = Number(this.sayPriceObj.minDay)
-        if (this.sayPriceObj.minDay < 1 || this.sayPriceObj.minDay > 31 || this.sayPriceObj.minDay.toString().indexOf('.') !== -1) {
-          this.validSayPrice.minDay = false
-          this.$message.error('交期只能填写1-31之间的整数值')
-        } else if (this.sayPriceObj.maxDay && this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
-          this.validSayPrice.minDay = false
-          this.$message.error('最短交期应小于等于最长交期')
-        } else {
-          this.validSayPrice.minDay = true
-        }
-      },
-      onMinDayChange: function () {
-        if (this.sayPriceObj.minDay.length > 2) {
-          this.sayPriceObj.minDay = this.sayPriceObj.minDay.substring(0, 2)
-        }
-      },
-      onMaxDayInput: function () {
-        this.sayPriceObj.maxDay = Number(this.sayPriceObj.maxDay)
-        if (this.sayPriceObj.maxDay < 1 || this.sayPriceObj.maxDay > 31 || this.sayPriceObj.maxDay.toString().indexOf('.') !== -1) {
-          this.validSayPrice.maxDay = false
-          this.$message.error('交期只能填写1-31之间的整数值')
-        } else if (this.sayPriceObj.minDay && this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
-          this.validSayPrice.maxDay = false
-          this.$message.error('最短交期应小于等于最长交期')
+      onReplyPriceBlur: function (index) {
+        let price = this.sayPriceObj.replies[index].price
+        if (price) {
+          if (price <= 0) {
+            this.$message.error('单价必须是大于0的数字')
+            this.validSayPrice.repliesPrice = false
+          } else {
+            this.validSayPrice.repliesPrice = true
+          }
         } else {
-          this.validSayPrice.maxDay = true
-        }
-      },
-      onMaxDayChange: function () {
-        if (this.sayPriceObj.maxDay.length > 2) {
-          this.sayPriceObj.maxDay = this.sayPriceObj.maxDay.substring(0, 2)
+          this.$message.error('单价必须是大于0的数字')
+          this.validSayPrice.repliesPrice = false
         }
       },
-      onProduceDateChange: function () {
-        if (this.sayPriceObj.produceDate && getRealLen(this.sayPriceObj.produceDate) > 12) {
-          this.sayPriceObj.produceDate = cutOutString(this.sayPriceObj.produceDate, 12)
+      onReplyLapQtyBlur: function (index) {
+        let lapQty = this.sayPriceObj.replies[index].lapQty
+        if (!lapQty || lapQty < 1) {
+          this.sayPriceObj.replies[index].lapQty = ''
+          this.$message.error('输入值必须为正整数')
         }
       },
-      checkAllSayPrice: function () {
-        return this.validSayPrice.unitPrice && this.validSayPrice.minDay && this.validSayPrice.maxDay
-      },
+//      onUnitPriceBlur: function () {
+//        if (this.sayPriceObj.unitPrice) {
+//          if (this.sayPriceObj.unitPrice <= 0) {
+//            this.$message.error('单价必须是大于0的数字')
+//            this.validSayPrice.unitPrice = false
+//          } else {
+//            this.validSayPrice.unitPrice = true
+//          }
+//        } else {
+//          this.$message.error('单价必须是大于0的数字')
+//          this.validSayPrice.unitPrice = false
+//        }
+//      },
+//      onUnitPriceChange: function () {
+//        let price = this.sayPriceObj.unitPrice
+//        if (price >= 10000) {
+//          this.sayPriceObj.unitPrice = price.substring(0, 4)
+//        } else if (price.indexOf('.') > -1) {
+//          let arr = price.split('.')
+//          if (arr[0].length > 4) {
+//            this.sayPriceObj.unitPrice = Number(arr[0].substring(0, 4) + '.' + arr[1])
+//          } else if (arr[1].length > 6) {
+//            this.sayPriceObj.unitPrice = Number(arr[0] + '.' + arr[1].substring(0, 6))
+//          }
+//        }
+//      },
+//      onMinDayInput: function () {
+//        this.sayPriceObj.minDay = Number(this.sayPriceObj.minDay)
+//        if (this.sayPriceObj.minDay < 1 || this.sayPriceObj.minDay > 31 || this.sayPriceObj.minDay.toString().indexOf('.') !== -1) {
+//          this.validSayPrice.minDay = false
+//          this.$message.error('交期只能填写1-31之间的整数值')
+//        } else if (this.sayPriceObj.maxDay && this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
+//          this.validSayPrice.minDay = false
+//          this.$message.error('最短交期应小于等于最长交期')
+//        } else {
+//          this.validSayPrice.minDay = true
+//        }
+//      },
+//      onMinDayChange: function () {
+//        if (this.sayPriceObj.minDay.length > 2) {
+//          this.sayPriceObj.minDay = this.sayPriceObj.minDay.substring(0, 2)
+//        }
+//      },
+//      onMaxDayInput: function () {
+//        this.sayPriceObj.maxDay = Number(this.sayPriceObj.maxDay)
+//        if (this.sayPriceObj.maxDay < 1 || this.sayPriceObj.maxDay > 31 || this.sayPriceObj.maxDay.toString().indexOf('.') !== -1) {
+//          this.validSayPrice.maxDay = false
+//          this.$message.error('交期只能填写1-31之间的整数值')
+//        } else if (this.sayPriceObj.minDay && this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
+//          this.validSayPrice.maxDay = false
+//          this.$message.error('最短交期应小于等于最长交期')
+//        } else {
+//          this.validSayPrice.maxDay = true
+//        }
+//      },
+//      onMaxDayChange: function () {
+//        if (this.sayPriceObj.maxDay.length > 2) {
+//          this.sayPriceObj.maxDay = this.sayPriceObj.maxDay.substring(0, 2)
+//        }
+//      },
+//      onProduceDateChange: function () {
+//        if (this.sayPriceObj.produceDate && getRealLen(this.sayPriceObj.produceDate) > 12) {
+//          this.sayPriceObj.produceDate = cutOutString(this.sayPriceObj.produceDate, 12)
+//        }
+//      },
+//      checkAllSayPrice: function () {
+//        return this.validSayPrice.unitPrice && this.validSayPrice.minDay && this.validSayPrice.maxDay
+//      },
       searchList: function () {
         this.nowPage = 1
         this.resetList()
@@ -424,6 +473,16 @@
         }
         this.nowPage = 1
         this.resetList()
+      },
+      setReplies: function (type, index) {
+        if (type === 'add' && this.sayPriceObj.replies.length < 5) {
+          this.sayPriceObj.replies.splice(index + 1, 0, {
+            lapQty: '',
+            price: ''
+          })
+        } else if (type === 'sub' && this.sayPriceObj.replies.length > 1) {
+          this.sayPriceObj.replies.splice(index, 1)
+        }
       }
     }
   }
@@ -867,7 +926,6 @@
       float: none;
     }
     .say-price-box {
-      display: none;
       position: fixed;
       width: 527px;
       top: 30%;

+ 4 - 2
nuxt.config.js

@@ -1,6 +1,7 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://192.168.253.60:9090/platform-b2c/' : 'http://192.168.253.121:9090/platform-b2c/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://192.168.253.60:9090/platform-b2c/' : 'http://10.1.51.90:8080/platform-b2c/')
+const commonUrl = process.env.BASE_URL || (isProdMode ? 'http://10.1.51.88:8080/' : 'http://10.1.51.88:8080/')
 
 module.exports = {
   router: {
@@ -148,6 +149,7 @@ module.exports = {
     '/tip/**': baseUrl,
     '/UASBatchPutOnProperty**': baseUrl,
     '/UASBatchPutOnProperty/**': baseUrl,
-    '/seek/**': baseUrl
+    '/seek/**': baseUrl,
+    '/inquiry/**': commonUrl
   }
 }

+ 1 - 1
pages/applyPurchase/index.vue

@@ -16,7 +16,7 @@
     },
     fetch ({store}) {
       return Promise.all([
-        store.dispatch('applyPurchase/loadPurchaseManList', {page: 1, count: 10}),
+        store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null}),
         store.dispatch('applyPurchase/loadPurchaseApplyRank'),
         store.dispatch('applyPurchase/loadGoodPurchaseManList')
       ])

+ 31 - 30
store/applyPurchase.js

@@ -1,45 +1,46 @@
 import axios from '~plugins/axios'
 
-let findStoreInfoFromUuid = function ({ commit }, params = {}) {
-  let str = ''
-  let list = params.list
-  for (let i = 0; i < list.content.length; i++) {
-    str += list.content[i].id
-    str += i !== list.content.length - 1 ? ',' : ''
-  }
-  return axios.get('/seek/offer/getSeekPurchaseOfferList', {params: {spIds: str}}).then(response => {
-    for (let i = 0; i < list.content.length; i++) {
-      if (response.data.length) {
-        for (let j = 0; j < response.data.length; j++) {
-          list.content[i].isOffer = list.content[i].id === response.data[j].spId
-          if (list.content[i].isOffer) {
-            break
-          }
-        }
-      } else {
-        list.content[i].isOffer = false
-      }
-    }
-    commit('purchaseManList/GET_PURCHASEMAN_SUCCESS', list)
-  }, err => {
-    console.log(err)
-    commit('purchaseManList/GET_PURCHASEMAN_SUCCESS', list)
-  })
-}
+// let findStoreInfoFromUuid = function ({ commit }, params = {}) {
+//   let str = ''
+//   let list = params.list
+//   for (let i = 0; i < list.content.length; i++) {
+//     str += list.content[i].id
+//     str += i !== list.content.length - 1 ? ',' : ''
+//   }
+//   return axios.get('/seek/offer/getSeekPurchaseOfferList', {params: {spIds: str}}).then(response => {
+//     for (let i = 0; i < list.content.length; i++) {
+//       if (response.data.length) {
+//         for (let j = 0; j < response.data.length; j++) {
+//           list.content[i].isOffer = list.content[i].id === response.data[j].spId
+//           if (list.content[i].isOffer) {
+//             break
+//           }
+//         }
+//       } else {
+//         list.content[i].isOffer = false
+//       }
+//     }
+//     commit('purchaseManList/GET_PURCHASEMAN_SUCCESS', list)
+//   }, err => {
+//     console.log(err)
+//     commit('purchaseManList/GET_PURCHASEMAN_SUCCESS', list)
+//   })
+// }
 
 export const actions = {
 // 采购商列表
   loadPurchaseManList ({ commit }, params = {}) {
     commit('purchaseManList/REQUEST_PURCHASEMAN')
-    return axios.get('/seek/getSeekPageInfo', {params})
+    return axios.get('/inquiry/public', {params})
       .then(response => {
         let list = response.data
         for (let i = 0; i < list.content.length; i++) {
           list.content[i].active = false
         }
-        return Promise.all([
-          findStoreInfoFromUuid({ commit }, {list: list})
-        ])
+        // return Promise.all([
+        //   findStoreInfoFromUuid({ commit }, {list: list})
+        // ])
+        commit('purchaseManList/GET_PURCHASEMAN_SUCCESS', list)
       }, err => {
         commit('purchaseManList/GET_PURCHASEMAN_FAILURE', err)
       })

+ 8 - 0
store/index.js

@@ -52,6 +52,14 @@ export const actions = {
     commit('option/REQUEST_USER_INFO')
     return axios.get('/user/authentication')
       .then(response => {
+        if (response.data.userName) {
+          let ens = response.data.enterprises
+          if (ens && ens.length) {
+            response.data.enterprise = ens.find(item => item.current) || {enName: '个人账户'}
+          } else {
+            response.data.enterprise = {enName: '个人账户'}
+          }
+        }
         commit('option/REQUEST_USER_INFO_SUCCESS', response.data)
       }, err => {
         commit('option/REQUEST_USER_INFO_FAILURE', err)