Browse Source

求购手机

yangc 7 years ago
parent
commit
6c3edb0bfa

+ 1 - 1
assets/scss/mobileCommon.scss

@@ -299,7 +299,7 @@ input {
   height: .74rem;
   height: .74rem;
   line-height: .74rem;
   line-height: .74rem;
   text-align: center;
   text-align: center;
-  color: #fff;
+  color: #fff !important;
   background: #3f84f6;
   background: #3f84f6;
   border-radius: .08rem;
   border-radius: .08rem;
   font-size: .32rem;
   font-size: .32rem;

+ 2 - 2
components/applyPurchase/ApplyInfo.vue

@@ -156,13 +156,13 @@
         return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
         return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
       },
       },
       phone: function (str) {
       phone: function (str) {
-        return str.substring(0, 3) + '****' + str.substring(7, 11)
+        return str ? (str.substring(0, 3) + '****' + str.substring(7, 11)) : '-'
       },
       },
       enterpriseFilter (str) {
       enterpriseFilter (str) {
         return str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str
         return str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str
       },
       },
       userNameFilter (str) {
       userNameFilter (str) {
-        return str.substring(0, 1) + '**'
+        return str ? (str.substring(0, 1) + '**') : '-'
       }
       }
     },
     },
     computed: {
     computed: {

+ 6 - 1
components/mobile/Home.vue

@@ -35,7 +35,7 @@
         <span>最新求购信息</span>
         <span>最新求购信息</span>
         <nuxt-link to="/mobile/applyPurchase/list">查看更多 <img src="/images/mobile/@2x/applyPurchase/home/arrow-right.png" alt=""></nuxt-link>
         <nuxt-link to="/mobile/applyPurchase/list">查看更多 <img src="/images/mobile/@2x/applyPurchase/home/arrow-right.png" alt=""></nuxt-link>
       </div>
       </div>
-      <seek-list></seek-list>
+      <seek-list :purchaseManList="purchaseManList"></seek-list>
     </div>
     </div>
     <div class="mobile-modal" v-if="showStoreInfo">
     <div class="mobile-modal" v-if="showStoreInfo">
       <div class="mobile-modal-box">
       <div class="mobile-modal-box">
@@ -65,6 +65,11 @@
       SeekList,
       SeekList,
       MainSearch
       MainSearch
     },
     },
+    computed: {
+      purchaseManList () {
+        return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
+      }
+    },
     methods: {
     methods: {
       onHomeSearchClick () {
       onHomeSearchClick () {
         this.showMainSearch = true
         this.showMainSearch = true

+ 160 - 35
components/mobile/applyPurchase/SayPrice.vue

@@ -2,62 +2,161 @@
   <div class="say-price">
   <div class="say-price">
     <div class="base-info">
     <div class="base-info">
       <div class="content-line">
       <div class="content-line">
-        型号:<span>ASDASDASDASDASD</span>
+        型号:<span>{{purchaseDetail.cmpCode || '-'}}</span>
       </div>
       </div>
       <div class="content-line">
       <div class="content-line">
-        品牌:<span>ASDASDASDASDASD</span>
+        品牌:<span>{{purchaseDetail.inbrand || '-'}}</span>
       </div>
       </div>
       <div class="content-line">
       <div class="content-line">
-        规格:<span>ASDASDASDASDASD</span>
+        规格:<span>{{purchaseDetail.spec || '-'}}</span>
       </div>
       </div>
       <div class="content-line">
       <div class="content-line">
-        采购数量:<span>ASDASDASDASDASD</span>
+        采购数量:<span>{{purchaseDetail.offerAmount || '-'}}</span>
       </div>
       </div>
       <div class="content-line">
       <div class="content-line">
-        币种:<span>ASDASDASDASDASD</span>
+        币种:<span>{{purchaseDetail.currency || '不限'}}</span>
       </div>
       </div>
       <div class="content-line">
       <div class="content-line">
-        截止日期:<span>ASDASDASDASDASD</span>
+        截止日期:<span>{{purchaseDetail.endDate | date}}</span>
       </div>
       </div>
     </div>
     </div>
     <div class="form-list">
     <div class="form-list">
       <div class="form-title">
       <div class="form-title">
         <span class="fl">价格梯度<span>(PCS)</span></span>
         <span class="fl">价格梯度<span>(PCS)</span></span>
-        <span class="fr">RMB<img src="/images/mobile/@2x/applyPurchase/currency-arrow-down.png" alt=""></span>
+        <span class="fr">
+          <span v-text="sayPriceObj.currency" @click="showCurrencyList = !showCurrencyList"></span>
+          <img v-if="!showCurrencyList" src="/images/mobile/@2x/applyPurchase/currency-arrow-down.png" alt="">
+          <img v-if="showCurrencyList" src="/images/mobile/@2x/applyPurchase/currency-arrow-up.png" alt="">
+          <ul v-if="showCurrencyList">
+            <li @click="setCurrency('RMB')">RMB</li>
+            <li @click="setCurrency('USD')">USD</li>
+          </ul>
+        </span>
       </div>
       </div>
-      <div class="form-item">
-        <input type="number" placeholder="梯度" class="fl">
-        <input type="number" placeholder="单价" class="fr">
-        <i class="iconfont icon-add"></i>
-      </div>
-      <div class="form-item">
-        <input type="number" placeholder="梯度" class="fl">
-        <input type="number" placeholder="单价" class="fr">
-        <i class="iconfont icon-minus"></i>
-      </div>
-      <div class="form-item">
-        <input type="number" placeholder="梯度" class="fl">
-        <input type="number" placeholder="单价" class="fr">
-        <i class="iconfont icon-minus"></i>
-      </div>
-      <div class="form-item">
-        <input type="number" placeholder="梯度" class="fl">
-        <input type="number" placeholder="单价" class="fr">
-        <i class="iconfont icon-minus"></i>
-      </div>
-      <div class="form-item">
-        <input type="number" placeholder="梯度" class="fl">
-        <input type="number" placeholder="单价" class="fr">
-        <i class="iconfont icon-minus"></i>
+      <div class="form-item" v-for="(reply, index) in sayPriceObj.replies">
+        <input type="number" placeholder="梯度" class="fl" v-model="reply.lapQty">
+        <input type="number" placeholder="单价" class="fr" v-model="reply.price">
+        <i class="iconfont icon-minus" v-if="sayPriceObj.replies.length > 1" @click="setReplies('sub', index)"></i>
+        <i class="iconfont icon-add" v-if="sayPriceObj.replies.length < 5 && index == sayPriceObj.replies.length - 1" @click="setReplies('add', index)"></i>
       </div>
       </div>
       <div class="date">
       <div class="date">
         <span>交期(天)</span>
         <span>交期(天)</span>
-        <input type="number" placeholder="最大值" class="fr">
+        <input type="number" placeholder="最大值" v-model="sayPriceObj.leadtime" class="fr">
       </div>
       </div>
-      <a class="say-price-btn">确定</a>
+      <a class="say-price-btn" @click="commitSayPrice">确定</a>
     </div>
     </div>
   </div>
   </div>
 </template>
 </template>
+<script>
+  export default {
+    data () {
+      return {
+        showCurrencyList: false,
+        sayPriceObj: {
+          currency: 'RMB',
+          leadtime: '',
+          replies: [
+            {
+              lapQty: '',
+              price: ''
+            }
+          ]
+        }
+      }
+    },
+    filters: {
+      date: function (date) {
+        if (date) {
+          const d = new Date(Number(date))
+          const year = d.getFullYear()
+          const monthTemp = d.getMonth() + 1
+          const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
+          const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
+          return year + '-' + month + '-' + day
+        } else {
+          return '-'
+        }
+      }
+    },
+    computed: {
+      purchaseDetail () {
+        return this.$store.state.applyPurchase.purchaseManList.purchaseManDetail.data
+      },
+      user () {
+        return this.$store.state.option.user
+      }
+    },
+    methods: {
+      setCurrency: function (type) {
+        this.sayPriceObj.currency = type
+        this.showCurrencyList = false
+      },
+      resetSayPrice: function () {
+        this.sayPriceObj = {
+          currency: 'RMB',
+          leadtime: '',
+          replies: [
+            {
+              lapQty: '',
+              price: ''
+            }
+          ]
+        }
+      },
+      setReplies: function (type, index) {
+        if (type === 'add' && this.sayPriceObj.replies.length < 5) {
+          if (this.sayPriceObj.replies[index].lapQty && this.sayPriceObj.replies[index].price) {
+            this.sayPriceObj.replies.splice(index + 1, 0, {
+              lapQty: '',
+              price: ''
+            })
+          } else {
+            this.$message.error('请填完整信息')
+          }
+        } else if (type === 'sub' && this.sayPriceObj.replies.length > 1) {
+          this.sayPriceObj.replies.splice(index, 1)
+        }
+      },
+      commitSayPrice: function () {
+        if (this.checkValid()) {
+          let purchaseMan = this.purchaseDetail
+//          this.showLoading = true
+          purchaseMan.leadtime = this.sayPriceObj.leadtime
+          purchaseMan.replies = this.sayPriceObj.replies
+          purchaseMan.vendUU = this.user.data.enterprise.uu
+          purchaseMan.vendorUserUU = this.user.data.userUU
+          purchaseMan.qutoApp = 'MALL'
+          if (!purchaseMan.currency) {
+            purchaseMan.currency = this.sayPriceObj.currency
+          }
+          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.resetSayPrice()
+            }
+          }, error => {
+            console.log(error)
+            this.$message.error('请勿重复报价或报价自己的求购')
+//            this.showLoading = false
+          })
+        } else {
+          this.$message.error('请输入正确的报价信息')
+        }
+      },
+      checkValid: function () {
+        for (let i = 0; i < this.sayPriceObj.replies.length; i++) {
+          if (!this.sayPriceObj.replies[i].lapQty || !this.sayPriceObj.replies[i].price) {
+            return false
+          }
+        }
+        return this.sayPriceObj.leadtime
+      }
+    }
+  }
+</script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
   .say-price {
   .say-price {
     background: #f3f3f3;
     background: #f3f3f3;
@@ -93,11 +192,34 @@
             }
             }
           }
           }
           .fr {
           .fr {
+            position: relative;
             img {
             img {
               width: .12rem;
               width: .12rem;
               height: .06rem;
               height: .06rem;
               margin-left: .04rem;
               margin-left: .04rem;
             }
             }
+            > ul {
+              position: absolute;
+              top: .6rem;
+              right: -.4rem;
+              z-index: 1;
+              width: 1.75rem;
+              background: #fff;
+              text-align: center;
+              border-radius: .1rem;
+              border: .01rem solid #dfdfdf;
+              -webkit-box-shadow: 0 0 .12rem .02rem #e2d9d975;
+              -moz-box-shadow:  0 0 .12rem .02rem #e2d9d975;
+              box-shadow:  0 0 .12rem .02rem #e2d9d975;
+              li {
+                height: .52rem;
+                line-height: .52rem;
+                border-bottom: .01rem solid #dfdfdf;
+                &:hover, &:active {
+                  background: #dedede;
+                }
+              }
+            }
           }
           }
         }
         }
         &.form-item {
         &.form-item {
@@ -107,9 +229,12 @@
           }
           }
           i {
           i {
             position: absolute;
             position: absolute;
-            right: -.5rem;
+            right: -.32rem;
             top: 0;
             top: 0;
-            font-size: .34rem;
+            font-size: .3rem;
+            & + i {
+              right: -.65rem;
+            }
             &.icon-add {
             &.icon-add {
               color: #4768f3;
               color: #4768f3;
             }
             }

+ 163 - 63
components/mobile/applyPurchase/SayPriceInfo.vue

@@ -1,78 +1,172 @@
 <template>
 <template>
   <div class="say-price-info">
   <div class="say-price-info">
-    <div class="base-info">
-      <div class="content-line">
-        型号:<span>ASDASDASDASDASD</span>
+    <div v-if="!isVendor">
+      <div class="base-info">
+        <div class="content-line">
+          型号:<span>{{purchaseDetail.cmpCode || '-'}}</span>
+        </div>
+        <div class="content-line">
+          品牌:<span>{{purchaseDetail.inbrand || '-'}}</span>
+        </div>
+        <div class="content-line">
+          规格:<span>{{purchaseDetail.spec || '-'}}</span>
+        </div>
+        <div class="content-line">
+          采购数量:<span>{{purchaseDetail.offerAmount || '-'}}</span>
+        </div>
+        <div class="content-line">
+          币种:<span>{{purchaseDetail.currency || '不限'}}</span>
+        </div>
+        <div class="content-line">
+          截止日期:<span>{{purchaseDetail.endDate | date}}</span>
+        </div>
       </div>
       </div>
-      <div class="content-line">
-        品牌:<span>ASDASDASDASDASD</span>
+      <div class="base-info">
+        <div class="content-line">
+          买家:<span>{{purchaseDetail.inquiry.enterprise.enName || purchaseDetail.userName}}</span>
+        </div>
+        <div class="content-line">
+          联系电话:<span>{{purchaseDetail.userTel || '-'}}</span>
+        </div>
       </div>
       </div>
-      <div class="content-line">
-        规格:<span>ASDASDASDASDASD</span>
-      </div>
-      <div class="content-line">
-        采购数量:<span>ASDASDASDASDASD</span>
-      </div>
-      <div class="content-line">
-        币种:<span>ASDASDASDASDASD</span>
-      </div>
-      <div class="content-line">
-        截止日期:<span>ASDASDASDASDASD</span>
+      <div class="base-info say-info" v-for="(item, index) in purchaseDetail.qutations" @click="selectQutation(index)">
+        <img v-if="(!item.agreed || item.agreed !== 1) && activeIndex == index" src="/images/mobile/@2x/applyPurchase/say-price-check.png" alt="">
+        <img v-if="item.agreed == 1" src="/images/mobile/@2x/applyPurchase/say-price-accept.png" alt="">
+        <div class="content-line">
+          {{item.vendName}}
+        </div>
+        <div class="content-line">
+          报价人:<span>{{item.user.userName | userNameFilter}}</span>
+        </div>
+        <div class="content-line">
+          电话:<span>{{item.user.userTel}}</span>
+        </div>
+        <div class="content-line date">
+          交期(天):<span>{{item.leadtime}}</span>
+        </div>
+        <p>{{item.offerTime | date}}</p>
+        <div class="price-level">
+          <p>价格梯度:<span>(pcs)</span></p>
+          <ul>
+            <li v-for="replie in item.replies">
+              <span>{{replie.lapQty ? replie.lapQty + '+' : '-'}}</span>
+              <span>{{replie.price ? (purchaseDetail.currency == 'USD' ? '$' : '¥') + replie.price : '-'}}</span>
+            </li>
+          </ul>
+        </div>
       </div>
       </div>
+      <a class="say-price-btn" v-if="purchaseDetail.agreed != 1" @click="acceptQutation">采纳报价</a>
     </div>
     </div>
-    <div class="base-info">
-      <div class="content-line">
-        买家:<span>ASDASDASDASDASD</span>
+    <div v-if="isVendor">
+      <div class="base-info">
+        <div class="content-line">
+          型号:<span>{{purchaseDetail.cmpCode || '-'}}</span>
+        </div>
+        <div class="content-line">
+          品牌:<span>{{purchaseDetail.inbrand || '-'}}</span>
+        </div>
+        <div class="content-line">
+          规格:<span>{{purchaseDetail.spec || '-'}}</span>
+        </div>
+        <div class="content-line">
+          采购数量:<span>{{purchaseDetail.offerAmount || '-'}}</span>
+        </div>
+        <div class="content-line">
+          币种:<span>{{purchaseDetail.currency || '不限'}}</span>
+        </div>
+        <div class="content-line">
+          截止日期:<span>{{purchaseDetail.endDate | date}}</span>
+        </div>
+        <div class="content-line">
+          买家:<span>{{purchaseDetail.inquiry.enterprise.enName || purchaseDetail.userName}}</span>
+        </div>
+        <div class="content-line">
+          联系电话:<span>{{purchaseDetail.userTel || '-'}}</span>
+        </div>
       </div>
       </div>
-      <div class="content-line">
-        联系电话:<span>ASDASDASDASDASD</span>
-      </div>
-    </div>
-    <div class="base-info say-info">
-      <img src="/images/mobile/@2x/applyPurchase/say-price-check.png" alt="">
-      <!--<img src="/images/mobile/@2x/applyPurchase/say-price-accept.png" alt="">-->
-      <div class="content-line">
-        华商龙肯德基撒话费卡刷卡
+      <div class="base-info">
+        <div class="content-line">
+          报价人:<span>{{purchaseDetail.vendName || purchaseDetail.enterprise.enName}}</span>
+        </div>
+        <div class="content-line">
+          联系电话:<span>{{purchaseDetail.enterprise.enTel || '-'}}</span>
+        </div>
       </div>
       </div>
-      <div class="content-line">
-        报价人:<span>张三</span>
-      </div>
-      <div class="content-line">
-        电话:<span>13213123123</span>
-      </div>
-      <div class="content-line date">
-        交期(天):<span>3-5</span>
-      </div>
-      <p>2018-01-22</p>
-      <div class="price-level">
-        <p>价格梯度:<span>(pcs)</span></p>
-        <ul>
-          <li>
-            <span>1+</span>
-            <span>$10</span>
-          </li>
-          <li>
-            <span>1+</span>
-            <span>$10</span>
-          </li>
-          <li>
-            <span>1+</span>
-            <span>$10</span>
-          </li>
-          <li>
-            <span>1+</span>
-            <span>$10</span>
-          </li>
-          <li>
-            <span>1+</span>
-            <span>$10</span>
-          </li>
-        </ul>
+      <div class="base-info say-info">
+        <div class="content-line date">
+          交期(天):<span>{{purchaseDetail.leadtime}}</span>
+        </div>
+        <p>{{purchaseDetail.offerTime | date}}</p>
+        <div class="price-level vendor">
+          <p>价格梯度:<span>(pcs)</span></p>
+          <ul>
+            <li v-for="replie in purchaseDetail.replies">
+              <span>{{replie.lapQty ? replie.lapQty + '+' : '-'}}</span>
+              <span>{{replie.price ? (purchaseDetail.currency == 'USD' ? '$' : '¥') + replie.price : '-'}}</span>
+            </li>
+          </ul>
+        </div>
       </div>
       </div>
     </div>
     </div>
-    <a class="say-price-btn">采纳报价</a>
   </div>
   </div>
 </template>
 </template>
+<script>
+  export default {
+    data () {
+      return {
+        activeIndex: -1
+      }
+    },
+    filters: {
+      date: function (date) {
+        if (date) {
+          const d = new Date(Number(date))
+          const year = d.getFullYear()
+          const monthTemp = d.getMonth() + 1
+          const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
+          const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
+          return year + '-' + month + '-' + day
+        } else {
+          return '-'
+        }
+      },
+      userNameFilter (str) {
+        return str ? str.substring(0, 1) + '**' : '-'
+      }
+    },
+    computed: {
+      purchaseDetail () {
+        return this.isVendor ? this.$store.state.applyPurchase.purchaseManList.vendorInquiryDetail.data : this.$store.state.applyPurchase.purchaseManList.buyerInquiryDetail.data
+      },
+      user () {
+        return this.$store.state.option.user
+      },
+      isVendor () {
+        return this.$route.query.type === 'saler'
+      }
+    },
+    methods: {
+      selectQutation: function (index) {
+        this.activeIndex = index
+      },
+      acceptQutation: function () {
+        if (this.activeIndex > -1) {
+          let obj = this.purchaseDetail.qutations[this.activeIndex]
+          this.$http.post('/inquiry/buyer/decide?id=' + obj.id + '&status=1')
+            .then(response => {
+              this.$message.success('报价成功')
+              this.$route.query.type === 'saler' ? this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {id: this.$route.params.id}) : this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {id: this.$route.params.id})
+            }, err => {
+              console.log(err)
+              this.$message.success('系统错误')
+            })
+        } else {
+          this.$message.success('请选择报价信息')
+        }
+      }
+    }
+  }
+</script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
   .say-price-info {
   .say-price-info {
     background: #f3f3f3;
     background: #f3f3f3;
@@ -90,6 +184,8 @@
           position: absolute;
           position: absolute;
           right: 0;
           right: 0;
           top: 0;
           top: 0;
+          width: 1rem;
+          height: 1rem;
         }
         }
         .content-line {
         .content-line {
           width: 4.55rem;
           width: 4.55rem;
@@ -145,6 +241,10 @@
               }
               }
             }
             }
           }
           }
+          &.vendor {
+            position: unset;
+            margin: .15rem auto 0;
+          }
         }
         }
       }
       }
     }
     }

+ 8 - 7
components/mobile/applyPurchase/SeekList.vue

@@ -28,10 +28,10 @@
             <i v-if="getDay(item.remainingTime) <= 0" >&nbsp;小时</i>
             <i v-if="getDay(item.remainingTime) <= 0" >&nbsp;小时</i>
           </p>
           </p>
           <p v-else>已截止</p>
           <p v-else>已截止</p>
-          <!--<a v-if="item.remainingTime > 0 && item.quoted == 1">已报价</a>-->
-          <!--<a v-if="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)))">自己发布的</a>-->
-          <!--<a v-if="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)))">我要报价</a>-->
-          <!--<nuxt-link to="/mobile/applyPurchase/list/1">查看报价</nuxt-link>-->
+          <!--<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)))">自己发布的</a>-->
+          <nuxt-link 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))))"  :to="'/mobile/applyPurchase/sayPrice/' + item.inquiry.id" >我要报价</nuxt-link>
+          <nuxt-link v-if="((!userType || userType == 'buyer') && (seekType  && seekType != 'wait')) || (userType == 'saler' && seekType  && seekType != 'wait') || item.quoted == 1" :to="'/mobile/applyPurchase/list/' + (userType ? item.inquiry.id +'?type=' + userType : item.id)">查看报价</nuxt-link>
           </div>
           </div>
       </div>
       </div>
     </li>
     </li>
@@ -39,6 +39,7 @@
 </template>
 </template>
 <script>
 <script>
   export default {
   export default {
+    props: ['userType', 'seekType', 'purchaseManList'],
     filters: {
     filters: {
       date: function (date) {
       date: function (date) {
         const d = new Date(Number(date))
         const d = new Date(Number(date))
@@ -56,9 +57,9 @@
       }
       }
     },
     },
     computed: {
     computed: {
-      purchaseManList () {
-        return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
-      },
+//      purchaseManList () {
+//        return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
+//      },
       user () {
       user () {
         return this.$store.state.option.user
         return this.$store.state.option.user
       }
       }

+ 1 - 1
nuxt.config.js

@@ -1,7 +1,7 @@
 const path = require('path')
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
 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://10.1.51.90:8080/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.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
+const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://10.1.51.88:8080/')
 
 
 module.exports = {
 module.exports = {
   router: {
   router: {

+ 2 - 2
pages/index.vue

@@ -103,9 +103,9 @@
             'BT2018012900002056']
             'BT2018012900002056']
         }),
         }),
         store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 50, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null})
         store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 50, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null})
-      ]) : [
+      ]) : Promise.all([
         store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 5, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null})
         store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 5, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null})
-      ]
+      ])
     },
     },
     computed: {
     computed: {
       user () {
       user () {

+ 5 - 0
pages/mobile/applyPurchase/list/_id.vue

@@ -9,6 +9,11 @@
     layout: 'mobile',
     layout: 'mobile',
     components: {
     components: {
       SayPriceInfo
       SayPriceInfo
+    },
+    fetch ({store, route}) {
+      return Promise.all([
+        route.query.type === 'saler' ? store.dispatch('applyPurchase/loadVendorInquiryDetail', {id: route.params.id}) : store.dispatch('applyPurchase/loadBuyerInquiryDetail', {id: route.params.id})
+      ])
     }
     }
   }
   }
 </script>
 </script>

+ 41 - 2
pages/mobile/applyPurchase/list/index.vue

@@ -4,20 +4,59 @@
       <img src="/images/mobile/@2x/applyPurchase/home/seek-title.png" alt="">
       <img src="/images/mobile/@2x/applyPurchase/home/seek-title.png" alt="">
       <span>最新求购信息</span>
       <span>最新求购信息</span>
     </div>
     </div>
-    <seek-list></seek-list>
+    <seek-list :purchaseManList="purchaseManList"></seek-list>
+    <loading v-show="isSearchSearchingMore"></loading>
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
   import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
   import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
+  import {Loading} from '~components/mobile/common'
   export default {
   export default {
     layout: 'mobile',
     layout: 'mobile',
     components: {
     components: {
-      SeekList
+      SeekList,
+      Loading
     },
     },
+    data () {
+      return {
+        isSearchSearchingMore: false,
+        page: 1,
+        size: 10
+      }
+    },
+//    mounted: function () {
+//      let _this = this
+//      _this.$nextTick(function () {
+//        window.addEventListener('scroll', function () {
+//          _this.scroll()
+//        }, false)
+//      })
+//    },
     fetch ({store}) {
     fetch ({store}) {
       return Promise.all([
       return Promise.all([
         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/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null})
       ])
       ])
+    },
+    computed: {
+      purchaseManList () {
+        return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
+      },
+      allPage () {
+        return Math.floor(this.purchaseManList.totalElements / this.purchaseManList.size) + Math.floor(this.purchaseManList.totalElements % this.purchaseManList.size > 0 ? 1 : 0)
+      }
+    },
+    methods: {
+      scroll: function () {
+        let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
+        if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchSearchingMore && this.page < this.allPage) {
+          this.getMoreSearch()
+        }
+      },
+      getMoreSearch: function () {
+        this.page++
+        this.isSearchSearchingMore = true
+        this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: this.page, pageSize: this.size, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null})
+      }
     }
     }
   }
   }
 </script>
 </script>

+ 5 - 0
pages/mobile/applyPurchase/sayPrice/_id.vue

@@ -9,6 +9,11 @@
     layout: 'mobile',
     layout: 'mobile',
     components: {
     components: {
       SayPrice
       SayPrice
+    },
+    fetch ({store, route}) {
+      return Promise.all([
+        store.dispatch('applyPurchase/loadPurchaseManDetail', {itemId: route.params.id, enuu: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null})
+      ])
     }
     }
   }
   }
 </script>
 </script>

+ 73 - 20
pages/mobile/user/index.vue

@@ -6,7 +6,7 @@
         <p v-text="userInfo.data.userName"></p>
         <p v-text="userInfo.data.userName"></p>
         <p v-text="enterpriseInfo.enName"></p>
         <p v-text="enterpriseInfo.enName"></p>
       </div>
       </div>
-      <a>切换至卖家中心</a>
+      <a v-if="isVendor" v-text="userType === 'saler' ? '切换至买家中心' : '切换至卖家中心'" @click="switchType"></a>
     </div>
     </div>
     <ul class="switch-list">
     <ul class="switch-list">
       <li :class="{active: activeType == 'seek'}" @click="activeType = 'seek'">我的求购</li>
       <li :class="{active: activeType == 'seek'}" @click="activeType = 'seek'">我的求购</li>
@@ -20,12 +20,12 @@
         <li :class="{active: seekType == 'accept'}" @click="switchSeek('accept')"><div>已采纳</div></li>
         <li :class="{active: seekType == 'accept'}" @click="switchSeek('accept')"><div>已采纳</div></li>
       </ul>
       </ul>
       <div class="search-content">
       <div class="search-content">
-        <input type="text" placeholder="请输入您要查找的型号或品牌">
-        <span>
+        <input type="text" placeholder="请输入您要查找的型号或品牌" v-model="seekKeyword">
+        <span @click="searchSeek">
         <i class="iconfont icon-sousuo"></i>
         <i class="iconfont icon-sousuo"></i>
         </span>
         </span>
       </div>
       </div>
-      <seek-list></seek-list>
+      <seek-list :userType="userType" :seekType="seekType" :purchaseManList="purchaseManList"></seek-list>
     </div>
     </div>
     <div class="shop-list" v-if="activeType == 'store'" v-for="item in focusPage.content" @click="goStoreDetail(item.storeInfo.uuid)">
     <div class="shop-list" v-if="activeType == 'store'" v-for="item in focusPage.content" @click="goStoreDetail(item.storeInfo.uuid)">
       <h3>{{item.storeName}}</h3>
       <h3>{{item.storeName}}</h3>
@@ -52,7 +52,7 @@
         </div>
         </div>
       </a>
       </a>
     </div>
     </div>
-    <div class="none-state" v-if="(collectSave.totalElements == 0 && activeType == 'comp') || (focusPage.totalElements == 0 && activeType == 'store') || (collectSave.totalElements == 0 && focusPage.totalElements == 0)">
+    <div class="none-state" v-if="(activeType != 'seek') && ((collectSave.totalElements == 0 && activeType == 'comp') || (focusPage.totalElements == 0 && activeType == 'store') || (collectSave.totalElements == 0 && focusPage.totalElements == 0))">
       <img src="/images/mobile/@2x/empty-collect.png">
       <img src="/images/mobile/@2x/empty-collect.png">
       <p v-text="getRemindText()"></p>
       <p v-text="getRemindText()"></p>
       <nuxt-link to="/">返回首页</nuxt-link>
       <nuxt-link to="/">返回首页</nuxt-link>
@@ -69,12 +69,15 @@
         </div>
         </div>
       </div>
       </div>
     </div>
     </div>
+    <page-loading v-show="showLoading"></page-loading>
+    <div v-if="purchaseManListFetching && false"></div>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-  import RemindBox from '~components/mobile/common/RemindBox.vue'
   import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
   import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
+  import {RemindBox} from '~components/mobile/common'
+  import PageLoading from '~components/common/loading/PageLoading.vue'
   export default {
   export default {
     layout: 'mobile',
     layout: 'mobile',
     data () {
     data () {
@@ -88,18 +91,21 @@
         timeoutCount: 0,
         timeoutCount: 0,
         showStoreInfo: false,
         showStoreInfo: false,
         storeInfo: {},
         storeInfo: {},
-        seekType: 'wait'
+        seekType: 'wait',
+        showLoading: false,
+        seekKeyword: ''
       }
       }
     },
     },
     components: {
     components: {
       RemindBox,
       RemindBox,
-      SeekList
+      SeekList,
+      PageLoading
     },
     },
-    fetch ({ store }) {
+    fetch ({ store, route }) {
       return Promise.all([
       return Promise.all([
         store.dispatch('product/saveStores', { count: 100, page: 1, type: 'component' }),
         store.dispatch('product/saveStores', { count: 100, page: 1, type: 'component' }),
         store.dispatch('shop/StoreFocusPage', { count: 100, page: 1 }),
         store.dispatch('shop/StoreFocusPage', { count: 100, page: 1 }),
-        store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : store.state.option.user.data.userUU})
+        store.dispatch(route.query.type === 'saler' ? 'applyPurchase/loadPurchaseManList' : 'applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : store.state.option.user.data.userUU})
       ])
       ])
     },
     },
     methods: {
     methods: {
@@ -156,12 +162,46 @@
       },
       },
       switchSeek: function (type) {
       switchSeek: function (type) {
         this.seekType = type
         this.seekType = type
-        if (type === 'wait') {
-          this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null})
-        } else if (type === 'done') {
-          this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, _state: 'done'})
+        this.showLoading = true
+        if (this.userType !== 'saler') {
+          if (type === 'wait') {
+            this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null})
+          } else if (type === 'done') {
+            this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, _state: 'done'})
+          } else {
+            this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, _state: 'done'})
+          }
         } else {
         } else {
-          this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, _state: 'done'})
+          if (type === 'wait') {
+            this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise.uu})
+          } else if (type === 'done') {
+            this.$store.dispatch('applyPurchase/loadVendorPurchaseManList', {pageNumber: 1, pageSize: 10, _state: 'done', filter: {vendUU: this.$store.state.option.user.data.enterprise.uu, fromDate: null, endDate: null}})
+          } else {
+            this.$store.dispatch('applyPurchase/loadVendorPurchaseManList', {pageNumber: 1, pageSize: 10, _state: 'done', filter: {vendUU: this.$store.state.option.user.data.enterprise.uu, fromDate: null, endDate: null}})
+          }
+        }
+      },
+      switchType: function () {
+        this.$router.push('/mobile/user' + (this.userType === 'saler' ? '' : '?type=saler'))
+      },
+      searchSeek: function () {
+        let type = this.seekType
+        if (this.userType !== 'saler') {
+          if (type === 'wait') {
+            this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, keyword: this.seekKeyword})
+          } else if (type === 'done') {
+            this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, _state: 'done', keyword: this.seekKeyword})
+          } else {
+            this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, _state: 'done', keyword: this.seekKeyword})
+          }
+        } else {
+          if (type === 'wait') {
+            this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.$store.state.option.user.data.enterprise.uu, keyword: this.seekKeyword})
+          } else if (type === 'done') {
+            this.$store.dispatch('applyPurchase/loadVendorPurchaseManList', {pageNumber: 1, pageSize: 10, _state: 'done', filter: {vendUU: this.$store.state.option.user.data.enterprise.uu, fromDate: null, endDate: null, keyword: this.seekKeyword}})
+          } else {
+            this.$store.dispatch('applyPurchase/loadVendorPurchaseManList', {pageNumber: 1, pageSize: 10, _state: 'done', filter: {vendUU: this.$store.state.option.user.data.enterprise.uu, fromDate: null, endDate: null, keyword: this.seekKeyword}})
+          }
         }
         }
       }
       }
     },
     },
@@ -174,11 +214,6 @@
       },
       },
       enterpriseInfo () {
       enterpriseInfo () {
         let ens = this.userInfo.data.enterprises
         let ens = this.userInfo.data.enterprises
-//        if (ens && ens.length) {
-//          return ens.find(item => item.current) || {enName: this.userInfo.data.userName + '(个人账户)'}
-//        } else {
-//          return {enName: this.userInfo.data.userName + '(个人账户)'}
-//        }
         if (ens && ens.length) {
         if (ens && ens.length) {
           for (let i = 0; i < ens.length; i++) {
           for (let i = 0; i < ens.length; i++) {
             if (ens[i].current) {
             if (ens[i].current) {
@@ -188,8 +223,21 @@
         }
         }
         return {enName: this.userInfo.data.userName + '(个人账户)'}
         return {enName: this.userInfo.data.userName + '(个人账户)'}
       },
       },
+      isVendor () {
+        return this.enterpriseInfo.isVendor === 313
+      },
+      userType () {
+        return this.$route.query.type
+      },
       focusPage () {
       focusPage () {
         return this.$store.state.shop.storeInfo.focusPage.data
         return this.$store.state.shop.storeInfo.focusPage.data
+      },
+      purchaseManList () {
+        return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
+      },
+      purchaseManListFetching () {
+        this.showLoading = false
+        return this.$store.state.applyPurchase.purchaseManList.purchaseManList.fetching
       }
       }
     }
     }
   }
   }
@@ -445,6 +493,11 @@
         input {
         input {
           margin: .25rem 0 0 0;
           margin: .25rem 0 0 0;
         }
         }
+        span {
+          height: .54rem;
+          line-height: .54rem;
+          margin-bottom: 0;
+        }
       }
       }
     }
     }
   }
   }

+ 38 - 0
store/applyPurchase.js

@@ -45,6 +45,35 @@ export const actions = {
         commit('purchaseManList/GET_PURCHASEMAN_FAILURE', err)
         commit('purchaseManList/GET_PURCHASEMAN_FAILURE', err)
       })
       })
   },
   },
+  loadPurchaseManDetail ({ commit }, params = {}) {
+    commit('purchaseManList/REQUEST_PURCHASEMAN_DETAIL')
+    return axios.get('/inquiry/public/findItemByItemId', {params})
+      .then(response => {
+        commit('purchaseManList/GET_PURCHASEMAN_DETAIL_SUCCESS', response.data)
+      }, err => {
+        commit('purchaseManList/GET_PURCHASEMAN_DETAIL_FAILURE', err)
+      })
+  },
+  /* 获取卖家报价信息 */
+  loadVendorInquiryDetail ({ commit }, params = {}) {
+    commit('purchaseManList/REQUEST_VENDOR_INQUIRY_DETAIL')
+    return axios.get('/inquiry/public/quotation/one', {params})
+      .then(response => {
+        commit('purchaseManList/GET_VENDOR_INQUIRY_DETAIL_SUCCESS', response.data)
+      }, err => {
+        commit('purchaseManList/GET_VENDOR_INQUIRY_DETAIL_FAILURE', err)
+      })
+  },
+  /* 获取卖家报价信息 */
+  loadBuyerInquiryDetail ({ commit }, params = {}) {
+    commit('purchaseManList/REQUEST_BUYER_INQUIRY_DETAIL')
+    return axios.get('/inquiry/buyer/quotation', {params})
+      .then(response => {
+        commit('purchaseManList/GET_BUYER_INQUIRY_DETAIL_SUCCESS', response.data)
+      }, err => {
+        commit('purchaseManList/GET_BUYER_INQUIRY_DETAIL_FAILURE', err)
+      })
+  },
   loadBuyerPurchaseManList ({ commit }, params = {}) {
   loadBuyerPurchaseManList ({ commit }, params = {}) {
     commit('purchaseManList/REQUEST_PURCHASEMAN')
     commit('purchaseManList/REQUEST_PURCHASEMAN')
     return axios.get('/inquiry/buyer/quotations', {params})
     return axios.get('/inquiry/buyer/quotations', {params})
@@ -54,6 +83,15 @@ export const actions = {
         commit('purchaseManList/GET_PURCHASEMAN_FAILURE', err)
         commit('purchaseManList/GET_PURCHASEMAN_FAILURE', err)
       })
       })
   },
   },
+  loadVendorPurchaseManList ({ commit }, params = {}) {
+    commit('purchaseManList/REQUEST_PURCHASEMAN')
+    return axios.get('/inquiry/public/quotation/list', {params})
+      .then(response => {
+        commit('purchaseManList/GET_PURCHASEMAN_SUCCESS', response.data)
+      }, err => {
+        commit('purchaseManList/GET_PURCHASEMAN_FAILURE', err)
+      })
+  },
   // 求购排行榜
   // 求购排行榜
   loadPurchaseApplyRank ({ commit }, params = {}) {
   loadPurchaseApplyRank ({ commit }, params = {}) {
     commit('purchaseApplyRank/REQUEST_PURCHASERANK', params)
     commit('purchaseApplyRank/REQUEST_PURCHASERANK', params)

+ 42 - 0
store/applyPurchase/purchaseManList.js

@@ -2,6 +2,18 @@ export const state = () => ({
   purchaseManList: {
   purchaseManList: {
     fetching: false,
     fetching: false,
     data: []
     data: []
+  },
+  purchaseManDetail: {
+    fetching: false,
+    data: []
+  },
+  vendorInquiryDetail: {
+    fetching: false,
+    data: []
+  },
+  buyerInquiryDetail: {
+    fetching: false,
+    data: []
   }
   }
 })
 })
 
 
@@ -15,6 +27,36 @@ export const mutations = {
   GET_PURCHASEMAN_SUCCESS (state, result) {
   GET_PURCHASEMAN_SUCCESS (state, result) {
     state.purchaseManList.fetching = false
     state.purchaseManList.fetching = false
     state.purchaseManList.data = result
     state.purchaseManList.data = result
+  },
+  REQUEST_PURCHASEMAN_DETAIL (state) {
+    state.purchaseManDetail.fetching = true
+  },
+  GET_PURCHASEMAN_DETAIL_FAILURE (state) {
+    state.purchaseManDetail.fetching = false
+  },
+  GET_PURCHASEMAN_DETAIL_SUCCESS (state, result) {
+    state.purchaseManDetail.fetching = false
+    state.purchaseManDetail.data = result
+  },
+  REQUEST_VENDOR_INQUIRY_DETAIL (state) {
+    state.vendorInquiryDetail.fetching = true
+  },
+  GET_VENDOR_INQUIRY_DETAIL_FAILURE (state) {
+    state.vendorInquiryDetail.fetching = false
+  },
+  GET_VENDOR_INQUIRY_DETAIL_SUCCESS (state, result) {
+    state.vendorInquiryDetail.fetching = false
+    state.vendorInquiryDetail.data = result
+  },
+  REQUEST_BUYER_INQUIRY_DETAIL (state) {
+    state.buyerInquiryDetail.fetching = true
+  },
+  GET_BUYER_INQUIRY_DETAIL_FAILURE (state) {
+    state.buyerInquiryDetail.fetching = false
+  },
+  GET_BUYER_INQUIRY_DETAIL_SUCCESS (state, result) {
+    state.buyerInquiryDetail.fetching = false
+    state.buyerInquiryDetail.data = result
   }
   }
 }
 }