yangc 7 жил өмнө
parent
commit
b21a30e03d

+ 4 - 6
assets/scss/mobileCommon.scss

@@ -249,19 +249,17 @@ input {
     margin: .15rem 0 0 .11rem;
     font-size: .23rem;
     padding: 0 0 0 .21rem;
-    border: .01rem solid #376ff3;
+    border: .02rem solid #376ff3;
   }
   span {
     display: inline-block;
-    height: .46rem;
-    line-height: .46rem;
+    height: .62rem;
+    line-height: .62rem;
     width: .68rem;
     color: #376ff3;
-    border-left: .01rem solid #376ff3;
+    border-left: .02rem solid #376ff3;
     margin-left: -.68rem;
     text-align: center;
-    vertical-align: middle;
-    margin-bottom: .08rem;
     i {
       font-size: .3rem;
     }

+ 1 - 3
components/mobile/MobileFooter.vue

@@ -78,11 +78,9 @@
       onReload: function () {
         const path = this.$route.path
         if (path === '/') {
-          this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 5, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
+          this.$store.dispatch('applyPurchase/loadMobileHomeList', {pageNumber: 1, pageSize: 5, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
         } else if (path === '/mobile/applyPurchase/list') {
           this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
-        } else if (path === '/user') {
-          this.$store.dispatch('applyPurchase/loadBuyerPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : this.user.data.userUU})
         }
       },
       goSayPrice: function () {

+ 144 - 52
components/mobile/applyPurchase/PublishSeek.vue

@@ -13,7 +13,7 @@
         </div>
         <div class="content-line">
           <span><i>*</i>截止日期:</span>
-          <input type="text" v-model="applyObj.deadline" @blur="formatDeadLine" placeholder="如2017-02-11">
+          <input type="date" v-model="applyObj.deadline" @change="deadlineChange">
         </div>
         <div class="content-line">
           <span>币种:</span>
@@ -27,7 +27,7 @@
         </div>
         <div class="content-line">
           <span>数量:</span>
-          <input type="text" v-model="applyObj.amount">
+          <input type="number" v-model="applyObj.amount">
         </div>
         <div class="content-line">
           <span>生产日期:</span>
@@ -62,6 +62,17 @@
     }
     return fmt
   }
+  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
+  }
   export default {
     props: ['showSayPriceBox'],
     data () {
@@ -94,57 +105,138 @@
         }
       },
       goPublish: function () {
-        let inquiry = {}
-        let inquiryItem = {}
-        if (this.user.data.enterprise) {
-          inquiry.enUU = this.user.data.enterprise.uu
-        }
-        let date = new Date()
-        inquiry.recorderUU = this.user.data.userUU
-        inquiry.code = 'MALL' + date.getTime()
-        inquiry.date = date
-        inquiry.recorder = this.user.data.userName
-        inquiry.endDate = this.applyObj.deadline
-        inquiry.sourceapp = 'MALL'
-        inquiry.amount = 1
-        inquiryItem.prodTitle = this.applyObj.code
-        inquiryItem.userUU = this.user.data.userUU
-        inquiryItem.source = 'MALL'
-        inquiryItem.userName = this.user.data.userName
-        inquiryItem.userTel = this.user.data.userTel
-        inquiryItem.needquantity = this.applyObj.amount
-        inquiryItem.inbrand = this.applyObj.brand
-        inquiryItem.currency = this.applyObj.unitPrice ? this.applyObj.currency : null
-        inquiryItem.cmpCode = (this.applyObj.code).toUpperCase()
-        inquiryItem.unitPrice = this.applyObj.unitPrice
-        inquiryItem.produceDate = this.applyObj.produceDate
-        inquiryItem.date = date
-        inquiryItem.endDate = this.applyObj.deadline
-        inquiryItem.encapsulation = this.applyObj.encapsulation
-        let inquiryItems = []
-        inquiryItems.push(inquiryItem)
-        inquiry.inquiryItems = inquiryItems
-        this.$http.post('/inquiry/buyer/save', inquiry)
-          .then(response => {
-            this.$message.success('发布成功')
-//                this.showRemindBox = true
-            this.emptyForm()
-//                this.validObj.deadline = true
-            this.$emit('reloadAction')
-            this.cancel()
-          }, error => {
-            console.log(error)
-            this.$message.error('发布失败')
-          })
-      },
-      formatDeadLine: function () {
-        if (this.applyObj.deadline) {
-          this.applyObj.deadline = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+        if (this.checkAll()) {
+          let inquiry = {}
+          let inquiryItem = {}
+          if (this.user.data.enterprise) {
+            inquiry.enUU = this.user.data.enterprise.uu
+          }
+          let date = new Date()
+          inquiry.recorderUU = this.user.data.userUU
+          inquiry.code = 'MALL' + date.getTime()
+          inquiry.date = date
+          inquiry.recorder = this.user.data.userName
+          inquiry.endDate = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+          inquiry.sourceapp = 'MALL'
+          inquiry.amount = 1
+          inquiryItem.prodTitle = this.applyObj.code
+          inquiryItem.userUU = this.user.data.userUU
+          inquiryItem.source = 'MALL'
+          inquiryItem.userName = this.user.data.userName
+          inquiryItem.userTel = this.user.data.userTel
+          inquiryItem.needquantity = this.applyObj.amount
+          inquiryItem.inbrand = this.applyObj.brand
+          inquiryItem.currency = this.applyObj.unitPrice ? this.applyObj.currency : null
+          inquiryItem.cmpCode = (this.applyObj.code).toUpperCase()
+          inquiryItem.unitPrice = this.applyObj.unitPrice
+          inquiryItem.produceDate = this.applyObj.produceDate
+          inquiryItem.date = date
+          inquiryItem.endDate = this.applyObj.deadline
+          inquiryItem.encapsulation = this.applyObj.encapsulation
+          let inquiryItems = []
+          inquiryItems.push(inquiryItem)
+          inquiry.inquiryItems = inquiryItems
+          this.$http.post('/inquiry/buyer/save', inquiry)
+            .then(response => {
+              this.$message.success('发布成功')
+              //                this.showRemindBox = true
+              this.emptyForm()
+              //                this.validObj.deadline = true
+              this.$emit('reloadAction')
+              this.cancel()
+            }, error => {
+              console.log(error)
+              this.$message.error('发布失败')
+            })
         }
       },
       setCurrency: function (type) {
         this.applyObj.currency = type
         this.showCurrencyList = false
+      },
+      isValidDate: function (date) {
+        let now = new Date().getTime()
+        let time = new Date(formatDate(date, 'yyyy-MM-dd hh:mm:ss')).getTime()
+        return !time || (time >= now && time <= now + 1000 * 60 * 60 * 24 * 91)
+      },
+      deadlineChange: function () {
+        if (!this.isValidDate(this.applyObj.deadline)) {
+          this.$message.error('日期需不小于今天且在90天以内')
+          this.applyObj.deadline = ''
+        }
+      },
+      checkAll: function () {
+        return this.checkCode() && this.checkBrand() && this.checkDeadLine() && this.checkAmount() && this.checkProduceDate()
+      },
+      checkCode: function () {
+        if (!this.applyObj.code) {
+          this.$message.error('型号不能为空')
+          return false
+        } else if ((/[^\x00-\xff]/g).test(this.applyObj.code)) {
+          this.$message.error('型号不能包含中文及中文字符')
+          return false
+        } else if (getRealLen(this.applyObj.code) > 100) {
+          this.$message.error('型号不能超过100个字符')
+          return false
+        } else {
+          return true
+        }
+      },
+      checkBrand: function () {
+        let chineseIndex = -1
+        if ((/[^\x00-\xff]/g).test(this.applyObj.brand)) {
+          for (let i = 0; i < this.applyObj.brand.length; i++) {
+            if ((/[^\x00-\xff]/g).test(this.applyObj.brand.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.applyObj.brand.charAt(i))) {
+              chineseIndex = i
+              break
+            }
+          }
+        }
+        if (!this.applyObj.brand) {
+          this.$message.error('品牌不能为空')
+          return false
+        } else if (chineseIndex !== -1) {
+          this.$message.error('品牌不能包含中文字符')
+          return false
+        } else if (getRealLen(this.applyObj.brand) > 50) {
+          this.$message.error('品牌不能超过50个字符')
+          return false
+        } else {
+          return true
+        }
+      },
+      checkDeadLine: function () {
+        if (!this.applyObj.deadline) {
+          this.$message.error('截止日期不能为空')
+        }
+        return this.applyObj.deadline
+      },
+      checkAmount: function () {
+        if (typeof this.applyObj.amount === 'undefined' || this.applyObj.amount === '') {
+          return true
+        } else {
+          if (!(/^[0-9]*$/).test(this.applyObj.amount)) {
+            this.$message.error('请输入正确的数量')
+            return false
+          } else if (this.applyObj.amount.length > 9) {
+            this.$message.error('数量不能大于999999999')
+            return false
+          } else {
+            return true
+          }
+        }
+      },
+      checkProduceDate: function () {
+        if (typeof this.applyObj.produceDate === 'undefined' || this.applyObj.produceDate === '') {
+          return true
+        } else {
+          if (getRealLen(this.applyObj.produceDate) > 12) {
+            this.$message.error('生产日期不能大于12个字符')
+            return false
+          } else {
+            return true
+          }
+        }
       }
     }
   }
@@ -161,13 +253,13 @@
           line-height: .8rem;
           font-size: .26rem;
           text-align: left;
-          border-bottom: .01rem solid #b7d5fe;
+          border-bottom: .04rem solid #b7d5fe;
           position: relative;
           input {
             width: 3.49rem;
             height: .52rem;
             padding-left: .19rem;
-            border: .01rem solid #7e7e7e;
+            border: .04rem solid #7e7e7e;
           }
           > span {
             display: inline-block;
@@ -197,14 +289,14 @@
             background: #fff;
             text-align: center;
             border-radius: .1rem;
-            border: .01rem 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: .01rem solid #dfdfdf;
+              border-bottom: .04rem solid #dfdfdf;
               &:hover, &:active {
                 background: #dedede;
               }

+ 4 - 4
components/mobile/applyPurchase/SayPrice.vue

@@ -179,11 +179,11 @@
         input {
           height: .7rem;
           text-align: center;
-          border: .01rem solid #666;
+          border: .04rem solid #666;
           border-radius: .05rem;
         }
         &.form-title {
-          border: .01rem solid #666;
+          border: .04rem solid #666;
           border-radius: .05rem;
           padding: 0 .07rem 0 .17rem;
           .fl {
@@ -207,14 +207,14 @@
               background: #fff;
               text-align: center;
               border-radius: .1rem;
-              border: .01rem solid #dfdfdf;
+              border: .04rem 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;
+                border-bottom: .04rem solid #dfdfdf;
                 &:hover, &:active {
                   background: #dedede;
                 }

+ 4 - 4
components/mobile/applyPurchase/SayPriceInfo.vue

@@ -223,8 +223,8 @@
                 padding-left: .22rem;
                 text-align: left;
                 display: inline-block;
-                border-top: .01rem solid #7e7e7e;
-                border-left: .01rem solid #7e7e7e;
+                border-top: .04rem solid #7e7e7e;
+                border-left: .04rem solid #7e7e7e;
                 overflow: hidden;
                 text-overflow: ellipsis;
                 white-space: nowrap;
@@ -233,11 +233,11 @@
                 }
                 &:last-child {
                   width: 55%;
-                  border-right: .01rem solid #7e7e7e;
+                  border-right: .04rem solid #7e7e7e;
                 }
               }
               &:last-child {
-                border-bottom: .01rem solid #7e7e7e;
+                border-bottom: .04rem solid #7e7e7e;
               }
             }
           }

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

@@ -149,7 +149,7 @@
             text-align: center;
             font-size: .32rem;
             color: #e62f36;
-            border: .01rem solid #ea494f;
+            border: .02rem solid #ea494f;
             margin-top: .34rem;
             border-radius: .06rem;
           }

+ 6 - 6
pages/mobile/user/index.vue

@@ -343,7 +343,7 @@
         top: .45rem;
         right: .1rem;
         color: #3f84f6;
-        border: .01rem solid #3f84f6;
+        border: .02rem solid #3f84f6;
         border-radius: .2rem;
         padding: .06rem .12rem;
       }
@@ -481,10 +481,10 @@
         font-size: .28rem;
         color: #666;
         background: #fff;
-        border: .01rem solid #b4b4b4;
+        border: .02rem solid #b4b4b4;
         &.active {
           background: #0067e7;
-          border: .01rem solid #0067e7;
+          border: .02rem solid #0067e7;
           color: #fff;
         }
         &:first-child {
@@ -525,9 +525,9 @@
           margin: .25rem 0 0 0;
         }
         span {
-          height: .54rem;
-          line-height: .54rem;
-          margin-bottom: 0;
+          height: .56rem;
+          line-height: .56rem;
+          margin-top: .04rem;
         }
       }
     }