Browse Source

手机求购

yangc 7 years ago
parent
commit
5e1dfdc439

+ 7 - 5
assets/scss/mobileCommon.scss

@@ -242,19 +242,21 @@ input {
 
 /*search*/
 .search-content {
+  padding-top: .15rem;
   input {
     width: 6.48rem;
     height: .58rem;
     border-radius: .14rem;
-    margin: .15rem 0 0 .11rem;
+    margin: 0 0 0 .11rem;
     font-size: .23rem;
     padding: 0 0 0 .21rem;
-    border: .02rem solid #376ff3;
   }
   span {
     display: inline-block;
-    height: .62rem;
-    line-height: .62rem;
+    height: .58rem;
+    line-height: .58rem;
+    position: relative;
+    top: .04rem;
     width: .68rem;
     color: #376ff3;
     border-left: .02rem solid #376ff3;
@@ -269,7 +271,7 @@ input {
     height: .44rem;
     float: right;
     margin-right: .2rem;
-    margin-top: .2rem;
+    margin-top: .1rem;
   }
 }
 /*报价info*/

+ 12 - 4
components/mobile/MobileFooter.vue

@@ -23,12 +23,13 @@
     </span>
     <a @click="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
     <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
-    <publish-seek :showSayPriceBox="showSayPriceBox" @cancelAction="showSayPriceBox = false" @reloadAction="onReload()"></publish-seek>
+    <publish-seek :showSayPriceBox="showSayPriceBox" @cancelAction="showSayPriceBox = false" @reloadAction="onReload" @remindAction="onRemind"></publish-seek>
+    <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
   </div>
 </template>
 <script>
   import { scrollTo } from '~utils/scroll'
-  import {LoginBox} from '~components/mobile/common'
+  import {LoginBox, RemindBox} from '~components/mobile/common'
   import PublishSeek from './applyPurchase/PublishSeek.vue'
   export default{
     name: 'MobileFooter',
@@ -36,12 +37,15 @@
       return {
         hideToTop: true,
         showLoginBox: false,
-        showSayPriceBox: false
+        showSayPriceBox: false,
+        remindText: '',
+        timeoutCount: 0
       }
     },
     components: {
       LoginBox,
-      PublishSeek
+      PublishSeek,
+      RemindBox
     },
     computed: {
       activeType () {
@@ -89,6 +93,10 @@
         } else {
           this.showLoginBox = true
         }
+      },
+      onRemind: function (str) {
+        this.remindText = str
+        this.timeoutCount ++
       }
     }
   }

+ 14 - 2
components/mobile/MobileHeader.vue

@@ -137,7 +137,7 @@
 //          this.showHeader = false
 //          this.showSearch = false
 //        }
-        this.showHeader = val !== '/' || !val || val === ''
+        this.showHeader = val && val !== '/' && val !== '/mobile/applyPurchase/list'
 //        this.showSearch = val !== '/' && !this.startWith(val, '/mobile/search')
         let title = '优软商城'
         if (this.startWith(val, '/mobile/brand/componentDetail/')) {
@@ -168,11 +168,17 @@
           title = '店铺列表'
 //          this.rightIcon = 'phone'
         } else if (this.startWith(val, '/mobile/user')) {
-          title = '我的收藏'
+          if (this.$route.query.type === 'saler') {
+            title = '卖家中心'
+          } else {
+            title = '买家中心'
+          }
 //          this.rightIcon = 'phone'
         } else if (this.startWith(val, '/mobile/search')) {
           title = '搜索结果'
 //          this.rightIcon = 'share'
+        } else if (this.startWith(val, '/mobile/applyPurchase/sayPrice')) {
+          title = '编辑报价'
         } else if (val === '' || val === '/' || !val) {
           title = '优软商城'
 //          this.rightIcon = 'phone'
@@ -316,4 +322,10 @@
   .hide {
     display: none;
   }
+  .search-content {
+    margin-left: .5rem;
+    input {
+      color: #333;
+    }
+  }
 </style>

+ 32 - 16
components/mobile/applyPurchase/PublishSeek.vue

@@ -104,6 +104,9 @@
           this.applyObj[attr] = attr === 'currency' ? 'RMB' : ''
         }
       },
+      setRemindText: function (str) {
+        this.$emit('remindAction', str)
+      },
       goPublish: function () {
         if (this.checkAll()) {
           let inquiry = {}
@@ -138,7 +141,8 @@
           inquiry.inquiryItems = inquiryItems
           this.$http.post('/inquiry/buyer/save', inquiry)
             .then(response => {
-              this.$message.success('发布成功')
+//              this.$message.success('发布成功')
+              this.setRemindText('发布成功')
               //                this.showRemindBox = true
               this.emptyForm()
               //                this.validObj.deadline = true
@@ -146,7 +150,8 @@
               this.cancel()
             }, error => {
               console.log(error)
-              this.$message.error('发布失败')
+//              this.$message.error('发布失败')
+              this.setRemindText('发布失败')
             })
         }
       },
@@ -161,7 +166,8 @@
       },
       deadlineChange: function () {
         if (!this.isValidDate(this.applyObj.deadline)) {
-          this.$message.error('日期需不小于今天且在90天以内')
+//          this.$message.error('日期需不小于今天且在90天以内')
+          this.setRemindText('日期需不小于今天且在90天以内')
           this.applyObj.deadline = ''
         }
       },
@@ -170,13 +176,16 @@
       },
       checkCode: function () {
         if (!this.applyObj.code) {
-          this.$message.error('型号不能为空')
+//          this.$message.error('型号不能为空')
+          this.setRemindText('型号不能为空')
           return false
         } else if ((/[^\x00-\xff]/g).test(this.applyObj.code)) {
-          this.$message.error('型号不能包含中文及中文字符')
+//          this.$message.error('型号不能包含中文及中文字符')
+          this.setRemindText('型号不能包含中文及中文字符')
           return false
         } else if (getRealLen(this.applyObj.code) > 100) {
-          this.$message.error('型号不能超过100个字符')
+//          this.$message.error('型号不能超过100个字符')
+          this.setRemindText('型号不能超过100个字符')
           return false
         } else {
           return true
@@ -193,13 +202,16 @@
           }
         }
         if (!this.applyObj.brand) {
-          this.$message.error('品牌不能为空')
+//          this.$message.error('品牌不能为空')
+          this.setRemindText('品牌不能为空')
           return false
         } else if (chineseIndex !== -1) {
-          this.$message.error('品牌不能包含中文字符')
+//          this.$message.error('品牌不能包含中文字符')
+          this.setRemindText('品牌不能包含中文字符')
           return false
         } else if (getRealLen(this.applyObj.brand) > 50) {
-          this.$message.error('品牌不能超过50个字符')
+//          this.$message.error('品牌不能超过50个字符')
+          this.setRemindText('品牌不能超过50个字符')
           return false
         } else {
           return true
@@ -207,7 +219,8 @@
       },
       checkDeadLine: function () {
         if (!this.applyObj.deadline) {
-          this.$message.error('截止日期不能为空')
+//          this.$message.error('截止日期不能为空')
+          this.setRemindText('截止日期不能为空')
         }
         return this.applyObj.deadline
       },
@@ -216,10 +229,12 @@
           return true
         } else {
           if (!(/^[0-9]*$/).test(this.applyObj.amount)) {
-            this.$message.error('请输入正确的数量')
+//            this.$message.error('请输入正确的数量')
+            this.setRemindText('请输入正确的数量')
             return false
           } else if (this.applyObj.amount.length > 9) {
-            this.$message.error('数量不能大于999999999')
+//            this.$message.error('数量不能大于999999999')
+            this.setRemindText('数量不能大于999999999')
             return false
           } else {
             return true
@@ -231,7 +246,8 @@
           return true
         } else {
           if (getRealLen(this.applyObj.produceDate) > 12) {
-            this.$message.error('生产日期不能大于12个字符')
+//            this.$message.error('生产日期不能大于12个字符')
+            this.setRemindText('生产日期不能大于12个字符')
             return false
           } else {
             return true
@@ -253,13 +269,13 @@
           line-height: .8rem;
           font-size: .26rem;
           text-align: left;
-          border-bottom: .04rem solid #b7d5fe;
+          border-bottom: .02rem solid #b7d5fe;
           position: relative;
           input {
             width: 3.49rem;
             height: .52rem;
             padding-left: .19rem;
-            border: .04rem solid #7e7e7e;
+            border: .02rem solid #7e7e7e;
           }
           > span {
             display: inline-block;
@@ -296,7 +312,7 @@
             li {
               height: .52rem;
               line-height: .52rem;
-              border-bottom: .04rem solid #dfdfdf;
+              border-bottom: .02rem solid #dfdfdf;
               &:hover, &:active {
                 background: #dedede;
               }

+ 32 - 18
components/mobile/applyPurchase/SayPrice.vue

@@ -36,8 +36,8 @@
       <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>
+        <i class="iconfont icon-minus" v-if="index > 0" @click="setReplies('sub', index)"></i>
+        <i class="iconfont icon-add" v-if="index == 0 && sayPriceObj.replies.length < 5" @click="setReplies('add', index)"></i>
       </div>
       <div class="date">
         <span>交期(天)</span>
@@ -45,9 +45,11 @@
       </div>
       <a class="say-price-btn" @click="commitSayPrice">确定</a>
     </div>
+    <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
   </div>
 </template>
 <script>
+  import {RemindBox} from '~components/mobile/common'
   export default {
     data () {
       return {
@@ -61,9 +63,14 @@
               price: ''
             }
           ]
-        }
+        },
+        remindText: '',
+        timeoutCount: 0
       }
     },
+    components: {
+      RemindBox
+    },
     filters: {
       date: function (date) {
         if (date) {
@@ -106,12 +113,13 @@
       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, {
+            this.sayPriceObj.replies.splice(this.sayPriceObj.replies.length, 0, {
               lapQty: '',
               price: ''
             })
           } else {
-            this.$message.error('请填完整信息')
+//            this.$message.error('请填完整信息')
+            this.onRemind('请填完整信息')
           }
         } else if (type === 'sub' && this.sayPriceObj.replies.length > 1) {
           this.sayPriceObj.replies.splice(index, 1)
@@ -132,27 +140,36 @@
           this.$http.post('/inquiry/sale/item/save', purchaseMan).then(response => {
             this.showLoading = false
             if (response.data.success === false) {
-              this.$message.error(response.data.message)
+//              this.$message.error(response.data.message)
+              this.onRemind('response.data.message')
             } else {
-              this.$message.success('报价成功')
+//              this.$message.success('报价成功')
+              this.onRemind('报价成功')
               this.resetSayPrice()
             }
           }, error => {
             console.log(error)
-            this.$message.error('请勿重复报价或报价自己的求购')
+//            this.$message.error('请勿重复报价或报价自己的求购')
+            this.onRemind('请勿重复报价或报价自己的求购')
 //            this.showLoading = false
           })
         } else {
-          this.$message.error('请输入正确的报价信息')
+          this.onRemind('报价信息为空或梯度不合法')
         }
       },
       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
+          } else if (i > 0 && ((this.sayPriceObj.replies[i].lapQty <= this.sayPriceObj.replies[i - 1].lapQty) || (this.sayPriceObj.replies[i].price <= this.sayPriceObj.replies[i - 1].price))) {
+            return false
           }
         }
         return this.sayPriceObj.leadtime
+      },
+      onRemind: function (str) {
+        this.remindText = str
+        this.timeoutCount ++
       }
     }
   }
@@ -179,11 +196,11 @@
         input {
           height: .7rem;
           text-align: center;
-          border: .04rem solid #666;
+          border: .02rem solid #666;
           border-radius: .05rem;
         }
         &.form-title {
-          border: .04rem solid #666;
+          border: .02rem solid #666;
           border-radius: .05rem;
           padding: 0 .07rem 0 .17rem;
           .fl {
@@ -207,14 +224,14 @@
               background: #fff;
               text-align: center;
               border-radius: .1rem;
-              border: .04rem solid #dfdfdf;
+              border: .02rem 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: .04rem solid #dfdfdf;
+                border-bottom: .02rem solid #dfdfdf;
                 &:hover, &:active {
                   background: #dedede;
                 }
@@ -229,12 +246,9 @@
           }
           i {
             position: absolute;
-            right: -.32rem;
+            right: -.48rem;
             top: 0;
-            font-size: .3rem;
-            & + i {
-              right: -.65rem;
-            }
+            font-size: .36rem;
             &.icon-add {
               color: #4768f3;
             }

+ 24 - 9
components/mobile/applyPurchase/SayPriceInfo.vue

@@ -108,15 +108,22 @@
         </div>
       </div>
     </div>
+    <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
   </div>
 </template>
 <script>
+  import {RemindBox} from '~components/mobile/common'
   export default {
     data () {
       return {
-        activeIndex: -1
+        activeIndex: -1,
+        remindText: '',
+        timeoutCount: 0
       }
     },
+    components: {
+      RemindBox
+    },
     filters: {
       date: function (date) {
         if (date) {
@@ -154,15 +161,22 @@
           let obj = this.purchaseDetail.qutations[this.activeIndex]
           this.$http.post('/inquiry/buyer/decide?id=' + obj.id + '&status=1')
             .then(response => {
-              this.$message.success('报价成功')
+//              this.$message.success('采纳成功')
+              this.onRemind('采纳成功')
               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('系统错误')
+//              this.$message.success('系统错误')
+              this.onRemind('系统错误')
             })
         } else {
-          this.$message.success('请选择报价信息')
+//          this.$message.success('请选择报价信息')
+          this.onRemind('请选择报价信息')
         }
+      },
+      onRemind: function (str) {
+        this.remindText = str
+        this.timeoutCount ++
       }
     }
   }
@@ -218,13 +232,14 @@
           ul {
             li {
               height: .52rem;
-              line-height: .52rem;
               span {
+                height: .52rem;
+                line-height: .52rem;
                 padding-left: .22rem;
                 text-align: left;
                 display: inline-block;
-                border-top: .04rem solid #7e7e7e;
-                border-left: .04rem solid #7e7e7e;
+                border-top: .02rem solid #7e7e7e;
+                border-left: .02rem solid #7e7e7e;
                 overflow: hidden;
                 text-overflow: ellipsis;
                 white-space: nowrap;
@@ -233,11 +248,11 @@
                 }
                 &:last-child {
                   width: 55%;
-                  border-right: .04rem solid #7e7e7e;
+                  border-right: .02rem solid #7e7e7e;
                 }
               }
               &:last-child {
-                border-bottom: .04rem solid #7e7e7e;
+                border-bottom: .02rem solid #7e7e7e;
               }
             }
           }

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

@@ -21,7 +21,7 @@
           </div>
         </div>
         <div class="fr">
-          <p v-if="item.remainingTime > 0">剩余
+          <p v-if="item.remainingTime > 0">剩余&nbsp;:
             <span v-if="getDay(item.remainingTime) > 0" v-text="getDay(item.remainingTime)"></span>
             <i v-if="getDay(item.remainingTime) > 0">&nbsp;天&nbsp;</i>
             <span v-if="getDay(item.remainingTime) <= 0" v-text="getHours(item.remainingTime)"></span>

+ 2 - 2
components/mobile/common/RemindBox.vue

@@ -30,7 +30,7 @@
         if (_this.title === '收藏成功' || _this.title === '取消成功') {
           timeout = 1000
         } else {
-          timeout = 2000
+          timeout = 1500
         }
         _this.timer = setTimeout(function () {
           _this.showBox = false
@@ -46,7 +46,7 @@
     left: 0;
     right: 0;
     margin-top: -.6rem;
-    z-index: 100;
+    z-index: 10000;
     div {
       background: rgba(0,0,0,.6);
       color: #fff;

+ 66 - 5
pages/mobile/applyPurchase/list/index.vue

@@ -1,5 +1,14 @@
 <template>
   <div class="mobile-content">
+    <div class="mobile-header">
+      <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
+      <div class="search-content">
+        <input type="text" v-model="seekKeyword" placeholder="请输入您要查找的型号或品牌">
+        <span @click="searchSeek">
+        <i class="iconfont icon-sousuo"></i>
+        </span>
+      </div>
+    </div>
     <div class="seek-title">
       <img src="/images/mobile/@2x/applyPurchase/home/seek-title.png" alt="">
       <span>最新求购信息</span>
@@ -23,7 +32,10 @@
         isSearchSearchingMore: false,
         page: 1,
         size: 10,
-        purchaseManListData: []
+        purchaseManListData: [],
+        showSeekSearch: true,
+        seekKeyword: '',
+        isChange: false
       }
     },
     mounted: function () {
@@ -38,14 +50,20 @@
 //    },
     fetch ({store}) {
       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, sorting: {'releaseDate': 'DESC'}, keyword: this.seekKeyword, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null})
       ])
     },
     computed: {
       purchaseManList () {
         let list = this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
-        this.purchaseManListData = this.purchaseManListData.concat(list.content)
-        this.isSearchSearchingMore = false
+        if (this.isChange) {
+          this.purchaseManListData = []
+          this.seekPage = 1
+          this.isChange = false
+        } else {
+          this.purchaseManListData = this.purchaseManListData.concat(list.content)
+          this.isSearchSearchingMore = false
+        }
         return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
       },
       allPage () {
@@ -62,8 +80,51 @@
       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})
+        this.reloadData()
+      },
+      reloadData: function () {
+        this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: this.page, pageSize: this.size, sorting: {'releaseDate': 'DESC'}, keyword: this.seekKeyword, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null})
+      },
+      goLastPage: function () {
+        window.history.back(-1)
+      },
+      searchSeek: function () {
+        this.page = 1
+        this.isChange = true
+        this.reloadData()
       }
     }
   }
 </script>
+<style lang="scss" scoped>
+  .mobile-content {
+    .mobile-header {
+      position: fixed;
+      top: 0;
+      z-index: 10;
+      width:100%;
+      height:.88rem;
+      line-height: .88rem;
+      background: #3e82f5;
+      padding:0 .2rem 0 .1rem;
+      color:#fff;
+      > a {
+        font-size:.28rem;
+        color:#fff;
+        position: absolute;
+        i {
+          font-size: .48rem;
+          margin-right: -.1rem;
+        }
+      }
+      .search-content {
+        margin-left: .5rem;
+        line-height: normal;
+        padding-top: .08rem;
+        input {
+          color: #333;
+        }
+      }
+    }
+  }
+</style>

+ 7 - 10
pages/mobile/user/index.vue

@@ -17,7 +17,7 @@
       <ul class="seek-type">
         <li :class="{active: seekType == 'wait'}" @click="switchSeek('wait')"><div>待报价</div></li>
         <li :class="{active: seekType == 'done'}" @click="switchSeek('done')"><div>已报价</div></li>
-        <li :class="{active: seekType == 'accept'}" @click="switchSeek('accept')"><div>已采纳</div></li>
+        <!--<li :class="{active: seekType == 'accept'}" @click="switchSeek('accept')"><div>已采纳</div></li>-->
       </ul>
       <div class="search-content">
         <input type="text" placeholder="请输入您要查找的型号或品牌" v-model="seekKeyword">
@@ -260,7 +260,7 @@
           this.purchaseManListData = this.purchaseManListData.concat(list)
           this.isSearchSearchingMore = false
         }
-        console.log(this.purchaseManListData)
+//        console.log(this.purchaseManListData)
         return this.purchase.data.content
       },
       allPage () {
@@ -482,6 +482,7 @@
         color: #666;
         background: #fff;
         border: .02rem solid #b4b4b4;
+        border-right: none;
         &.active {
           background: #0067e7;
           border: .02rem solid #0067e7;
@@ -502,11 +503,11 @@
           font-size: .28rem;
           color: #666;
           display: inline-block;
-          width: 2.5rem;
+          width: 50%;
           text-align: center;
           div {
             width: 2rem;
-            border-bottom: .04rem solid #c1c4c9;
+            border-bottom: .02rem solid #c1c4c9;
             margin: 0 auto;
             height: .6rem;
             line-height: .6rem;
@@ -521,13 +522,9 @@
       }
       .search-content {
         text-align: center;
+        padding: .25rem 0 0 0;
         input {
-          margin: .25rem 0 0 0;
-        }
-        span {
-          height: .56rem;
-          line-height: .56rem;
-          margin-top: .04rem;
+          border: .02rem solid #376ff3;
         }
       }
     }