Browse Source

baseUtils格式规范及引用修改

yangc 7 years ago
parent
commit
b8ad36ee21
34 changed files with 186 additions and 220 deletions
  1. 2 2
      components/applyPurchase/ApplyInfo.vue
  2. 23 24
      components/applyPurchase/BatchPublish.vue
  3. 19 20
      components/applyPurchase/PublishApply.vue
  4. 2 3
      components/common/buyOrCar/buyComponent.vue
  5. 1 2
      components/help/left.vue
  6. 1 2
      components/home/displayCard.vue
  7. 2 2
      components/home/floor/FloorList.vue
  8. 3 4
      components/mobile/MobileFooter.vue
  9. 1 2
      components/mobile/MobileHeader.vue
  10. 18 19
      components/mobile/applyPurchase/PublishSeek.vue
  11. 6 7
      components/mobile/applyPurchase/PublishSupplierSeek.vue
  12. 1 2
      components/mobile/applyPurchase/SayPriceInfo.vue
  13. 1 2
      components/mobile/brand/BrandCenter.vue
  14. 1 2
      components/mobile/center/Seek.vue
  15. 2 3
      components/mobile/common/StatisticsMobile.vue
  16. 2 2
      components/mobile/share/store/StoreHeader.vue
  17. 1 2
      components/pcb/brand/BrandList.vue
  18. 1 2
      components/pcb/product/Detail.vue
  19. 1 11
      components/product/BrandList.vue
  20. 1 14
      components/product/brand/CategoriesList.vue
  21. 3 3
      components/product/component/ComponentDetail.vue
  22. 1 2
      components/searchStore/StoreContent.vue
  23. 2 3
      components/store/BaseInfo.vue
  24. 2 3
      components/store/CommodityInfo.vue
  25. 1 2
      components/store/CommodityList.vue
  26. 1 2
      components/store/ComponentInfo.vue
  27. 2 3
      components/store/RecommendProduct.vue
  28. 1 2
      components/store/common/StoreHeader.vue
  29. 2 3
      components/supplier/details.vue
  30. 2 3
      components/supplier/resource.vue
  31. 1 13
      pages/mobile/center/vendor/productdetails.vue
  32. 1 14
      pages/mobile/wechat/index.vue
  33. 2 6
      plugins/mixin.js
  34. 76 34
      utils/baseUtils.js

+ 2 - 2
components/applyPurchase/ApplyInfo.vue

@@ -149,8 +149,8 @@
 <script>
 import Page from '~components/common/page/pageComponent.vue'
 import SayPrice from './SayPrice.vue'
-import { checkNullStr } from '~utils/baseUtils'
 import Clipboard from 'clipboard'
+import baseUtils from '~utils/baseUtils'
 let QRCode = require('qrcode')
 export default {
   data() {
@@ -202,7 +202,7 @@ export default {
       }
     },
     nullFilter(str) {
-      return checkNullStr(str) ? str : '-'
+      return baseUtils.checkNullStr(str) ? str : '-'
     }
   },
   components: { Page, SayPrice },

+ 23 - 24
components/applyPurchase/BatchPublish.vue

@@ -233,7 +233,6 @@
   </div>
 </template>
 <script>
-  import { enidfilter, getRealLen, cutOutString, formatDate, checkNullStr } from '~utils/baseUtils'
   import Page from '~components/common/page/pageComponent.vue'
   export default {
     data () {
@@ -362,7 +361,7 @@
     },
     methods: {
       getDate1: function () {
-        this.modifyObj.deadline = formatDate(this.modifyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+        this.modifyObj.deadline = this.baseUtils.formatDate(this.modifyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
         this.validObj.deadline = true
       },
       initModifyObj: function () {
@@ -564,7 +563,7 @@
         return !time || (time >= now && time <= now + 1000 * 60 * 60 * 24 * 91)
       },
       isValidDate: function (date) {
-        date = formatDate(date, 'yyyy-MM-dd hh:mm:ss')
+        date = this.baseUtils.formatDate(date, 'yyyy-MM-dd hh:mm:ss')
         this.modifyObj.deadline = date
         let now = new Date().getTime()
         let time = new Date(date).getTime()
@@ -605,7 +604,7 @@
       },
       checkCode: function () {
         let code = this.modifyObj.code.trim()
-        let nullStrFlag = checkNullStr(code)
+        let nullStrFlag = this.baseUtils.checkNullStr(code)
         this.validObj.code = code && code !== '' && nullStrFlag
         if (!this.validObj.code) {
           if (!nullStrFlag) {
@@ -617,7 +616,7 @@
         return this.validObj.code
       },
       checkBrand: function () {
-        let nullStrFlag = checkNullStr(this.modifyObj.brand)
+        let nullStrFlag = this.baseUtils.checkNullStr(this.modifyObj.brand)
         this.validObj.brand = this.modifyObj.brand && this.modifyObj.brand !== '' && nullStrFlag
         if (!this.validObj.brand) {
           if (!nullStrFlag) {
@@ -637,7 +636,7 @@
         return this.validObj.amount
       },
       checkKind: function() {
-        let nullStrFlag = checkNullStr(this.modifyObj.kind)
+        let nullStrFlag = this.baseUtils.checkNullStr(this.modifyObj.kind)
         this.validObj.kind = this.modifyObj.kind && this.modifyObj.kind !== ''
         // if (!this.validObj.kind) {
         if (!nullStrFlag) {
@@ -649,7 +648,7 @@
         return this.validObj.kind
       },
       checkSpec: function () {
-        let nullStrFlag = checkNullStr(this.modifyObj.spec)
+        let nullStrFlag = this.baseUtils.checkNullStr(this.modifyObj.spec)
         this.validObj.spec = nullStrFlag
         if (!nullStrFlag) {
           this.$message.error('规格输入不合法')
@@ -677,13 +676,13 @@
         }
       },
       onProduceDateChange: function () {
-        if (this.modifyObj.produceDate && getRealLen(this.modifyObj.produceDate) > 12) {
-          this.modifyObj.produceDate = cutOutString(this.modifyObj.produceDate, 12)
+        if (this.modifyObj.produceDate && this.baseUtils.getRealLen(this.modifyObj.produceDate) > 12) {
+          this.modifyObj.produceDate = this.baseUtils.cutOutString(this.modifyObj.produceDate, 12)
         }
       },
       onEncapsulationChange: function () {
-        if (this.modifyObj.encapsulation && getRealLen(this.modifyObj.encapsulation) > 20) {
-          this.modifyObj.encapsulation = cutOutString(this.modifyObj.encapsulation, 20)
+        if (this.modifyObj.encapsulation && this.baseUtils.getRealLen(this.modifyObj.encapsulation) > 20) {
+          this.modifyObj.encapsulation = this.baseUtils.cutOutString(this.modifyObj.encapsulation, 20)
         }
       },
       onCodeChange: function () {
@@ -695,9 +694,9 @@
               break
             }
           }
-          this.modifyObj.code = cutOutString(this.modifyObj.code, chineseIndex)
-        } else if (this.modifyObj.code && getRealLen(this.modifyObj.code) > 100) {
-          this.modifyObj.code = cutOutString(this.modifyObj.code, 100)
+          this.modifyObj.code = this.baseUtils.cutOutString(this.modifyObj.code, chineseIndex)
+        } else if (this.modifyObj.code && this.baseUtils.getRealLen(this.modifyObj.code) > 100) {
+          this.modifyObj.code = this.baseUtils.cutOutString(this.modifyObj.code, 100)
         } else {
           this.getSimilarCode()
         }
@@ -715,19 +714,19 @@
           if (chineseIndex > -1) {
             this.modifyObj.brand = this.modifyObj.brand.substring(0, chineseIndex)
           }
-        } else if (this.modifyObj.brand && getRealLen(this.modifyObj.brand) > 50) {
-          this.modifyObj.brand = cutOutString(this.modifyObj.brand, 50)
+        } else if (this.modifyObj.brand && this.baseUtils.getRealLen(this.modifyObj.brand) > 50) {
+          this.modifyObj.brand = this.baseUtils.cutOutString(this.modifyObj.brand, 50)
         }
         this.getSimilarBrand()
       },
       onProdTitleInput: function () {
-        if (this.modifyObj.kind && getRealLen(this.modifyObj.kind) > 40) {
-          this.modifyObj.kind = cutOutString(this.modifyObj.kind, 40)
+        if (this.modifyObj.kind && this.baseUtils.getRealLen(this.modifyObj.kind) > 40) {
+          this.modifyObj.kind = this.baseUtils.cutOutString(this.modifyObj.kind, 40)
         }
       },
       onSpecInput: function () {
-        if (this.modifyObj.spec && getRealLen(this.modifyObj.spec) > 100) {
-          this.modifyObj.spec = cutOutString(this.modifyObj.spec, 100)
+        if (this.modifyObj.spec && this.baseUtils.getRealLen(this.modifyObj.spec) > 100) {
+          this.modifyObj.spec = this.baseUtils.cutOutString(this.modifyObj.spec, 100)
         }
       },
       onAmountInput: function () {
@@ -739,9 +738,9 @@
               break
             }
           }
-          this.modifyObj.amount = cutOutString(this.modifyObj.amount, chineseIndex)
+          this.modifyObj.amount = this.baseUtils.cutOutString(this.modifyObj.amount, chineseIndex)
         } else if (this.modifyObj.amount.length > 9) {
-          this.modifyObj.amount = cutOutString(this.modifyObj.amount, 9)
+          this.modifyObj.amount = this.baseUtils.cutOutString(this.modifyObj.amount, 9)
         }
       },
       setCode: function (code) {
@@ -990,10 +989,10 @@
                   type: 'success'
                 })
                 window.setTimeout(function () {
-                  window.open('/user#/order/pay/' + enidfilter(response.data.data.orderid))
+                  window.open('/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid))
                 }, 1000)
               } else {
-                window.open('/user#/order/pay/' + enidfilter(response.data.data.orderid))
+                window.open('/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid))
               }
             } else {
               if (response.data.data && response.data.data.unvailable === 1) {

+ 19 - 20
components/applyPurchase/PublishApply.vue

@@ -155,7 +155,6 @@
   </div>
 </template>
 <script>
-  import { getRealLen, cutOutString, formatDate, checkNullStr } from '~utils/baseUtils'
   export default {
     data () {
       return {
@@ -333,7 +332,7 @@
       },
       checkCode: function () {
         let code = this.applyObj.code.trim()
-        let nullStrFlag = checkNullStr(code)
+        let nullStrFlag = this.baseUtils.checkNullStr(code)
         this.validObj.code = code && code !== '' && nullStrFlag
         if (!this.validObj.code) {
           if (!nullStrFlag) {
@@ -354,7 +353,7 @@
         return this.validObj.prodTitle
       },
       checkBrand: function () {
-        let nullStrFlag = checkNullStr(this.applyObj.brand)
+        let nullStrFlag = this.baseUtils.checkNullStr(this.applyObj.brand)
         this.validObj.brand = this.applyObj.brand && this.applyObj.brand !== '' && nullStrFlag
         if (!this.validObj.brand) {
           if (!nullStrFlag) {
@@ -373,7 +372,7 @@
         return this.validObj.unitPrice
       },
       checkSpec: function () {
-        let nullStrFlag = checkNullStr(this.applyObj.spec)
+        let nullStrFlag = this.baseUtils.checkNullStr(this.applyObj.spec)
         this.validObj.spec = nullStrFlag
         if (!nullStrFlag) {
           this.$message.error('规格输入不合法')
@@ -392,7 +391,7 @@
         return this.validObj.deadline
       },
       setDeadLineValid: function () {
-        this.applyObj.deadline = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+        this.applyObj.deadline = this.baseUtils.formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
         this.validObj.deadline = true
       },
       onUnitPriceInput: function () {
@@ -409,23 +408,23 @@
         }
       },
       onProduceDateChange: function () {
-        if (this.applyObj.produceDate && getRealLen(this.applyObj.produceDate) > 12) {
-          this.applyObj.produceDate = cutOutString(this.applyObj.produceDate, 12)
+        if (this.applyObj.produceDate && this.baseUtils.getRealLen(this.applyObj.produceDate) > 12) {
+          this.applyObj.produceDate = this.baseUtils.cutOutString(this.applyObj.produceDate, 12)
         }
       },
       onEncapsulationChange: function () {
-        if (this.applyObj.encapsulation && getRealLen(this.applyObj.encapsulation) > 20) {
-          this.applyObj.encapsulation = cutOutString(this.applyObj.encapsulation, 20)
+        if (this.applyObj.encapsulation && this.baseUtils.getRealLen(this.applyObj.encapsulation) > 20) {
+          this.applyObj.encapsulation = this.baseUtils.cutOutString(this.applyObj.encapsulation, 20)
         }
       },
       onProdTitleInput: function () {
-        if (this.applyObj.prodTitle && getRealLen(this.applyObj.prodTitle) > 40) {
-          this.applyObj.prodTitle = cutOutString(this.applyObj.prodTitle, 40)
+        if (this.applyObj.prodTitle && this.baseUtils.getRealLen(this.applyObj.prodTitle) > 40) {
+          this.applyObj.prodTitle = this.baseUtils.cutOutString(this.applyObj.prodTitle, 40)
         }
       },
       onSpecInput: function () {
-        if (this.applyObj.spec && getRealLen(this.applyObj.spec) > 100) {
-          this.applyObj.spec = cutOutString(this.applyObj.spec, 100)
+        if (this.applyObj.spec && this.baseUtils.getRealLen(this.applyObj.spec) > 100) {
+          this.applyObj.spec = this.baseUtils.cutOutString(this.applyObj.spec, 100)
         }
       },
       onCodeChange: function () {
@@ -437,9 +436,9 @@
               break
             }
           }
-          this.applyObj.code = cutOutString(this.applyObj.code, chineseIndex)
-        } else if (this.applyObj.code && getRealLen(this.applyObj.code) > 100) {
-          this.applyObj.code = cutOutString(this.applyObj.code, 100)
+          this.applyObj.code = this.baseUtils.cutOutString(this.applyObj.code, chineseIndex)
+        } else if (this.applyObj.code && this.baseUtils.getRealLen(this.applyObj.code) > 100) {
+          this.applyObj.code = this.baseUtils.cutOutString(this.applyObj.code, 100)
         } else {
           this.getSimilarCode()
         }
@@ -457,8 +456,8 @@
           if (chineseIndex > -1) {
             this.applyObj.brand = this.applyObj.brand.substring(0, chineseIndex)
           }
-        } else if (this.applyObj.brand && getRealLen(this.applyObj.brand) > 50) {
-          this.applyObj.brand = cutOutString(this.applyObj.brand, 50)
+        } else if (this.applyObj.brand && this.baseUtils.getRealLen(this.applyObj.brand) > 50) {
+          this.applyObj.brand = this.baseUtils.cutOutString(this.applyObj.brand, 50)
         } else {
           this.getSimilarBrand()
         }
@@ -472,9 +471,9 @@
               break
             }
           }
-          this.applyObj.amount = cutOutString(this.applyObj.amount, chineseIndex)
+          this.applyObj.amount = this.baseUtils.cutOutString(this.applyObj.amount, chineseIndex)
         } else if (this.applyObj.amount.length > 9) {
-          this.applyObj.amount = cutOutString(this.applyObj.amount, 9)
+          this.applyObj.amount = this.baseUtils.cutOutString(this.applyObj.amount, 9)
         }
       },
       onSuccess: function (data) {

+ 2 - 3
components/common/buyOrCar/buyComponent.vue

@@ -6,7 +6,6 @@
 </template>
 
 <script>
-  import { enidfilter } from '~utils/baseUtils'
   export default {
     props: ['item', 'disabledFlag'],
     methods: {
@@ -38,10 +37,10 @@
                         type: 'success'
                       })
                       window.setTimeout(function () {
-                        window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
+                        window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
                       }, 1000)
                     } else {
-                      window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
+                      window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
                     }
                   } else {
                     if (response.data.data && response.data.data.unvailable === 1) {

+ 1 - 2
components/help/left.vue

@@ -25,7 +25,6 @@
       return value1 - value2
     }
   }
-  import {deepCopy} from '~utils/baseUtils'
   export default {
     name: 'left',
     data () {
@@ -38,7 +37,7 @@
     },
     computed: {
       helps () {
-        let data = deepCopy(this.$store.state.help.snapsho.data)
+        let data = this.baseUtils.deepCopy(this.$store.state.help.snapsho.data)
         let list = data.sort(compare('detno'))
         if (list) {
           for (let i = 0; i < list.length; i++) {

+ 1 - 2
components/home/displayCard.vue

@@ -27,7 +27,6 @@
   </div>
 </template>
 <script>
-  import {whichTransitionEvent} from '~utils/baseUtils.js'
   export default {
     name: 'display-card',
     data () {
@@ -52,7 +51,7 @@
             let isChange = true
             this.timerIndex++
             if (this.$refs.pingdanListWrapper[0]) {
-              let _transitionEvent = whichTransitionEvent()
+              let _transitionEvent = this.baseUtils.whichTransitionEvent()
               _transitionEvent && this.$refs.pingdanListWrapper[0].addEventListener(
                 _transitionEvent, () => {
                   if (isChange) {

+ 2 - 2
components/home/floor/FloorList.vue

@@ -66,7 +66,7 @@
   import Floor from './Floor.vue'
   import FloorBar from './FloorBar.vue'
   import SayPrice from '~components/applyPurchase/SayPrice.vue'
-  import { formatDate } from '~utils/baseUtils'
+  import baseUtils from '~utils/baseUtils'
   export default {
     name: 'floor-list',
     components: {
@@ -120,7 +120,7 @@
     },
     filters: {
       date: function (date) {
-        const now = formatDate('yyyy-MM-dd', Date.now())
+        const now = baseUtils.formatDate('yyyy-MM-dd', Date.now())
         const day = Math.floor((now - date) / (1000 * 60 * 60 * 24))
         return day <= 0 ? '今天' : day + '天前'
       },

+ 3 - 4
components/mobile/MobileFooter.vue

@@ -42,7 +42,6 @@
 <script>
   import { scrollTo } from '~utils/scroll'
   import {LoginBox, RemindBox} from '~components/mobile/common'
-  import { startWith } from '~utils/baseUtils'
 //  import PublishSeek from './applyPurchase/PublishSeek.vue'
   export default{
     name: 'MobileFooter',
@@ -71,11 +70,11 @@
           return 'home'
         } else if (path === '/mobile/shop') {
           return 'shops'
-        } else if (startWith(path, '/mobile/user')) {
+        } else if (this.baseUtils.startWith(path, '/mobile/user')) {
           return 'user'
-        } else if (startWith(path, '/mobile/center/user')) {
+        } else if (this.baseUtils.startWith(path, '/mobile/center/user')) {
           return 'userCenter'
-        } else if (startWith(path, '/mobile/center/vendor')) {
+        } else if (this.baseUtils.startWith(path, '/mobile/center/vendor')) {
           return 'vendorCenter'
         } else {
           return ''

+ 1 - 2
components/mobile/MobileHeader.vue

@@ -275,8 +275,7 @@
         this.$store.dispatch('searchData/getSearchHistory')
       },
       startWith: function (str, s) {
-        let reg = new RegExp('^' + s)
-        return reg.test(str)
+        return this.baseUtils.startWith(str, s)
       }
     }
   }

+ 18 - 19
components/mobile/applyPurchase/PublishSeek.vue

@@ -63,7 +63,6 @@
   </div>
 </template>
 <script>
-  import { formatDate, getRealLen, cutOutString, checkNullStr } from '~utils/baseUtils'
   export default {
     props: ['showSayPriceBox'],
     data () {
@@ -99,11 +98,11 @@
         return this.$store.state.option.user
       },
       minDay: function () {
-        return formatDate(new Date(), 'yyyy-MM-dd')
+        return this.baseUtils.formatDate(new Date(), 'yyyy-MM-dd')
       },
       maxDay: function () {
         let deadDate = new Date().getTime() + 1000 * 60 * 60 * 24 * 90
-        deadDate = formatDate(new Date(deadDate), 'yyyy-MM-dd')
+        deadDate = this.baseUtils.formatDate(new Date(deadDate), 'yyyy-MM-dd')
         return deadDate
       }
     },
@@ -156,7 +155,7 @@
               inquiry.enUU = this.user.data.enterprise.uu
             }
             let date = new Date()
-            let endDate = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+            let endDate = this.baseUtils.formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
             //          let currency = this.applyObj.currency === '不限' ? null : this.applyObj.currency
             let currency = null
             inquiry.recorderUU = this.user.data.userUU
@@ -216,7 +215,7 @@
         this.applyObj.currency = type
       },
       isValidDate: function (date) {
-        let now = new Date(formatDate(new Date(), 'yyyy-MM-dd')).getTime()
+        let now = new Date(this.baseUtils.formatDate(new Date(), 'yyyy-MM-dd')).getTime()
         let time = new Date(date).getTime()
         return !time || (time >= now && time <= now + 1000 * 60 * 60 * 24 * 90)
       },
@@ -255,7 +254,7 @@
         return this.validObj.prodTitle
       },
       checkSpec: function () {
-        let nullStrFlag = checkNullStr(this.applyObj.spec)
+        let nullStrFlag = this.baseUtils.checkNullStr(this.applyObj.spec)
         this.validObj.spec = nullStrFlag
         if (!nullStrFlag) {
           this.setRemindText('规格输入不合法')
@@ -271,8 +270,8 @@
         return this.validObj.deadline
       },
       onProduceDateChange: function () {
-        if (this.applyObj.produceDate && getRealLen(this.applyObj.produceDate) > 12) {
-          this.applyObj.produceDate = cutOutString(this.applyObj.produceDate, 12)
+        if (this.applyObj.produceDate && this.baseUtils.getRealLen(this.applyObj.produceDate) > 12) {
+          this.applyObj.produceDate = this.baseUtils.cutOutString(this.applyObj.produceDate, 12)
         }
       },
       getSimilarCode: function () {
@@ -307,9 +306,9 @@
               break
             }
           }
-          this.applyObj.code = cutOutString(this.applyObj.code, chineseIndex)
-        } else if (this.applyObj.code && getRealLen(this.applyObj.code) > 100) {
-          this.applyObj.code = cutOutString(this.applyObj.code, 100)
+          this.applyObj.code = this.baseUtils.cutOutString(this.applyObj.code, chineseIndex)
+        } else if (this.applyObj.code && this.baseUtils.getRealLen(this.applyObj.code) > 100) {
+          this.applyObj.code = this.baseUtils.cutOutString(this.applyObj.code, 100)
         } else {
           this.getSimilarCode()
         }
@@ -327,20 +326,20 @@
           if (chineseIndex > -1) {
             this.applyObj.brand = this.applyObj.brand.substring(0, chineseIndex)
           }
-        } else if (this.applyObj.brand && getRealLen(this.applyObj.brand) > 50) {
-          this.applyObj.brand = cutOutString(this.applyObj.brand, 50)
+        } else if (this.applyObj.brand && this.baseUtils.getRealLen(this.applyObj.brand) > 50) {
+          this.applyObj.brand = this.baseUtils.cutOutString(this.applyObj.brand, 50)
         } else {
           this.getSimilarBrand()
         }
       },
       onProdTitleInput: function () {
-        if (this.applyObj.prodTitle && getRealLen(this.applyObj.prodTitle) > 40) {
-          this.applyObj.prodTitle = cutOutString(this.applyObj.prodTitle, 40)
+        if (this.applyObj.prodTitle && this.baseUtils.getRealLen(this.applyObj.prodTitle) > 40) {
+          this.applyObj.prodTitle = this.baseUtils.cutOutString(this.applyObj.prodTitle, 40)
         }
       },
       onSpecInput: function () {
-        if (this.applyObj.spec && getRealLen(this.applyObj.spec) > 100) {
-          this.applyObj.spec = cutOutString(this.applyObj.spec, 100)
+        if (this.applyObj.spec && this.baseUtils.getRealLen(this.applyObj.spec) > 100) {
+          this.applyObj.spec = this.baseUtils.cutOutString(this.applyObj.spec, 100)
         }
       },
       onAmountInput: function () {
@@ -352,9 +351,9 @@
               break
             }
           }
-          this.applyObj.amount = cutOutString(this.applyObj.amount, chineseIndex)
+          this.applyObj.amount = this.baseUtils.cutOutString(this.applyObj.amount, chineseIndex)
         } else if (this.applyObj.amount.length > 9) {
-          this.applyObj.amount = cutOutString(this.applyObj.amount, 9)
+          this.applyObj.amount = this.baseUtils.cutOutString(this.applyObj.amount, 9)
         }
       },
       setCode: function (code) {

+ 6 - 7
components/mobile/applyPurchase/PublishSupplierSeek.vue

@@ -23,7 +23,6 @@
   </div>
 </template>
 <script>
-  import { formatDate, cutOutString } from '~utils/baseUtils'
   export default {
     props: ['showPublishBox', 'product'],
     data () {
@@ -43,11 +42,11 @@
     },
     computed: {
       minDay: function () {
-        return formatDate(new Date(), 'yyyy-MM-dd')
+        return this.baseUtils.formatDate(new Date(), 'yyyy-MM-dd')
       },
       maxDay: function () {
         let deadDate = new Date().getTime() + 1000 * 60 * 60 * 24 * 90
-        deadDate = formatDate(new Date(deadDate), 'yyyy-MM-dd')
+        deadDate = this.baseUtils.formatDate(new Date(deadDate), 'yyyy-MM-dd')
         return deadDate
       }
     },
@@ -97,7 +96,7 @@
           inquiry.enUU = this.user.data.enterprise.uu
         }
         let date = new Date()
-        let endDate = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+        let endDate = this.baseUtils.formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
         inquiry.recorderUU = this.user.data.userUU
         inquiry.code = 'MALL' + date.getTime()
         inquiry.date = date
@@ -150,7 +149,7 @@
         }
       },
       isValidDate: function (date) {
-        let now = new Date(formatDate(new Date(), 'yyyy-MM-dd')).getTime()
+        let now = new Date(this.baseUtils.formatDate(new Date(), 'yyyy-MM-dd')).getTime()
         let time = new Date(date).getTime()
         return !time || (time >= now && time <= now + 1000 * 60 * 60 * 24 * 90)
       },
@@ -183,9 +182,9 @@
               break
             }
           }
-          this.applyObj.amount = cutOutString(this.applyObj.amount, chineseIndex)
+          this.applyObj.amount = this.baseUtils.cutOutString(this.applyObj.amount, chineseIndex)
         } else if (this.applyObj.amount.length > 9) {
-          this.applyObj.amount = cutOutString(this.applyObj.amount, 9)
+          this.applyObj.amount = this.baseUtils.cutOutString(this.applyObj.amount, 9)
         }
       }
     }

+ 1 - 2
components/mobile/applyPurchase/SayPriceInfo.vue

@@ -213,7 +213,6 @@
 </template>
 <script>
   import {RemindBox} from '~components/mobile/common'
-  import {deepCopy} from '~utils/baseUtils'
   export default {
     data () {
       return {
@@ -249,7 +248,7 @@
       purchaseDetail () {
         let obj = {}
         if (this.isBuyer) {
-          obj = deepCopy(this.$store.state.applyPurchase.purchaseManList.buyerInquiryDetail.data)
+          obj = this.baseUtils.deepCopy(this.$store.state.applyPurchase.purchaseManList.buyerInquiryDetail.data)
           if (obj.qutations) {
             this.qutationsTemp = obj.qutations
             for (let i = 0; i < this.qutationsTemp.length; i++) {

+ 1 - 2
components/mobile/brand/BrandCenter.vue

@@ -50,7 +50,6 @@
 <script>
   import {SearchHeader} from '~components/mobile/base'
   import { PullUp, EmptyStatus } from '~components/mobile/common'
-  import { startWith } from '~utils/baseUtils'
   export default {
     name: 'brandList',
     data () {
@@ -113,7 +112,7 @@
     },
     methods: {
       onScroll () {
-        if (startWith(this.$route.path, '/mobile/brand/brandCenter')) {
+        if (this.baseUtils.startWith(this.$route.path, '/mobile/brand/brandCenter')) {
           let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
           this.isScrolled = scrolled > 200
         }

+ 1 - 2
components/mobile/center/Seek.vue

@@ -22,7 +22,6 @@
 <script>
   import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
   import { PullUp, EmptyStatus } from '~components/mobile/common'
-  import {deepCopy} from '~utils/baseUtils'
   export default {
     layout: 'mobileNoHeader',
     middleware: 'authenticated',
@@ -47,7 +46,7 @@
     watch: {
       'purchase.data': {
         handler: function (val) {
-          let list = deepCopy(val.content || [])
+          let list = this.baseUtils.deepCopy(val.content || [])
           if (this.seekType === 'done' && this.userType === 'saler') {
             list.map(val => {
               val.quotation = {

+ 2 - 3
components/mobile/common/StatisticsMobile.vue

@@ -27,7 +27,6 @@
   </div>
 </template>
 <script>
-  import {whichTransitionEvent} from '~utils/baseUtils.js'
   export default {
     name: 'StatisticsView',
     data () {
@@ -64,7 +63,7 @@
             let isChange = true
             this.timerIndexL++
             if (this.$refs.pingdanListWrapperL) {
-              let _transitionEvent = whichTransitionEvent()
+              let _transitionEvent = this.baseUtils.whichTransitionEvent()
               _transitionEvent && this.$refs.pingdanListWrapperL.addEventListener(
                 _transitionEvent, () => {
                   if (isChange) {
@@ -90,7 +89,7 @@
             let isChange = true
             this.timerIndexR++
             if (this.$refs.pingdanListWrapperR) {
-              let _transitionEvent = whichTransitionEvent()
+              let _transitionEvent = this.baseUtils.whichTransitionEvent()
               _transitionEvent && this.$refs.pingdanListWrapperR.addEventListener(
                 _transitionEvent, () => {
                   if (isChange) {

+ 2 - 2
components/mobile/share/store/StoreHeader.vue

@@ -12,7 +12,7 @@
   </div>
 </template>
 <script>
-  import { getRealLen, cutOutString } from '~utils/baseUtils'
+  import baseUtils from '~utils/baseUtils'
   export default {
     computed: {
       storeInfo () {
@@ -21,7 +21,7 @@
     },
     filters: {
       descFilter: function (val) {
-        return getRealLen(val) > 78 ? cutOutString(val, 78) + '...' : val
+        return baseUtils.filterStringEllipsis(val, 78)
       }
     }
   }

+ 1 - 2
components/pcb/brand/BrandList.vue

@@ -51,7 +51,6 @@
 </template>
 <script>
   import Page from '~components/common/page/pageComponent.vue'
-  import { buyOrCar } from '~utils/baseUtils'
   export default {
     name: 'BrandComponent',
     data () {
@@ -123,7 +122,7 @@
         }
       },
       addToCar: function (item) {
-        buyOrCar(false, null, this, item)
+        this.baseUtils.buyOrCar(false, null, this, item)
       }
     }
   }

+ 1 - 2
components/pcb/product/Detail.vue

@@ -125,7 +125,6 @@
       }
     }
   }
-  import { buyOrCar } from '~utils/baseUtils'
   import LinkSalerBox from '~components/common/LinkSalerBox.vue'
   export default {
     data () {
@@ -235,7 +234,7 @@
         }
       },
       buy (flag) {
-        buyOrCar(flag, null, this, this.commodity)
+        this.baseUtils.buyOrCar(flag, null, this, this.commodity)
       },
       goLink: function () {
         this.baseUtils.goLinkUser(this, this.storeInfo.enUU)

+ 1 - 11
components/product/BrandList.vue

@@ -39,22 +39,12 @@
 //     }
 //   }
 // }
-function deepCopy(obj) {
-  if (typeof obj !== 'object') {
-    return obj
-  }
-  var newobj = {}
-  for (var attr in obj) {
-    newobj[attr] = deepCopy(obj[attr])
-  }
-  return newobj
-}
 
 export default {
   name: 'brandList',
   computed: {
     brandList() {
-      var brandsList = deepCopy(this.$store.state.product.brand.brandList.data)
+      let brandsList = this.baseUtils.deepCopy(this.$store.state.product.brand.brandList.data)
       // console.log(this.$store.state.product.brand.brandList.data)
       // if (brandsList) {
       //   for (let i in brandsList) {

+ 1 - 14
components/product/brand/CategoriesList.vue

@@ -13,24 +13,11 @@
 </template>
 
 <script>
-  // 实现深拷贝
-  function deepCopy(target) {
-    if (typeof target !== 'object') return
-    // 判断目标类型,来创建返回值
-    var newObj = target instanceof Array ? [] : {}
-    for (var item in target) {
-      // 只复制元素自身的属性,不复制原型链上的
-      if (target.hasOwnProperty(item)) {
-        newObj[item] = typeof target[item] === 'object' ? deepCopy(target[item]) : target[item]
-        }
-      }
-      return newObj
-  }
   export default {
     name: 'CategoriesList',
     computed: {
       list () {
-        let brands = deepCopy(this.$store.state.brandCategories.categories.data)
+        let brands = this.baseUtils.deepCopy(this.$store.state.brandCategories.categories.data)
         if (!brands || brands.length === 0) {
           return []
         }

+ 3 - 3
components/product/component/ComponentDetail.vue

@@ -110,7 +110,7 @@
 </template>
 <script>
   //  import ComponentMenu from '~components/product/component/componentMenu.vue'
-  import {getRealLen, cutOutString} from '~utils/baseUtils'
+  import baseUtils from '~utils/baseUtils'
   export default {
     name: 'ComponentDetail',
     data () {
@@ -161,7 +161,7 @@
 //    },
     filters: {
       descriptionFilter: function ([str, type]) {
-        return !type ? getRealLen(str) > 84 ? cutOutString(str, 84) + '...' : str : str
+        return !type ? baseUtils.getRealLen(str) > 84 ? baseUtils.cutOutString(str, 84) + '...' : str : str
       },
       lifecycleFilter: function (code) {
         if (code === 815) {
@@ -217,7 +217,7 @@
         return tmp
       },
       getRealLength: function (str) {
-        return getRealLen(str)
+        return this.baseUtils.getRealLen(str)
       }
 //      getRealLen: function (str) {
 //        let len = 0

+ 1 - 2
components/searchStore/StoreContent.vue

@@ -71,7 +71,6 @@
 </template>
 <script>
   import Page from '~components/common/page/pageComponent.vue'
-  import { goLinkUser } from '~utils/baseUtils'
   import LinkSalerBox from '~components/common/LinkSalerBox.vue'
   export default {
     data () {
@@ -142,7 +141,7 @@
         window.open('/store/productDetail/' + this.componentData[index].content[compIndex].batchCode)
       },
       goLink: function (store) {
-        goLinkUser(this, store.enUU)
+        this.baseUtils.goLinkUser(this, store.enUU)
       }
     }
   }

+ 2 - 3
components/store/BaseInfo.vue

@@ -94,7 +94,6 @@
   </div>
 </template>
 <script>
-  import {startWith, judgeIsPdf} from '~utils/baseUtils'
   export default {
     name: 'base-info',
     data () {
@@ -114,7 +113,7 @@
           return qualification && qualification.type === 'APTITUDE'
         })
         for (let i = 0; i < qualifications.length; i++) {
-          qualifications[i].isPdf = judgeIsPdf(qualifications[i].resourceUrl)
+          qualifications[i].isPdf = this.baseUtils.judgeIsPdf(qualifications[i].resourceUrl)
         }
         return qualifications || []
       }
@@ -126,7 +125,7 @@
       },
       goTarget: function (url) {
         if (url) {
-          if (startWith(url, 'http://') || startWith(url, 'https://')) {
+          if (this.baseUtils.startWith(url, 'http://') || this.baseUtils.startWith(url, 'https://')) {
             window.open(url)
           } else {
             window.open(`http://${url}`)

+ 2 - 3
components/store/CommodityInfo.vue

@@ -170,7 +170,6 @@
       }
     }
   }
-  import { enidfilter } from '~utils/baseUtils'
   export default {
     name: 'commodity-info',
     data () {
@@ -427,10 +426,10 @@
                         type: 'success'
                       })
                       window.setTimeout(function () {
-                        window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
+                        window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
                       }, 1000)
                     } else {
-                      window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
+                      window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
                     }
                   } else {
                     if (response.data.data && response.data.data.unvailable === 1) {

+ 1 - 2
components/store/CommodityList.vue

@@ -174,7 +174,6 @@ function getAllLeafIds (kind) {
 import Buy from '~components/common/buyOrCar/buyComponent.vue'
 import Page from '~components/common/page/pageComponent.vue'
 import LinkSalerBox from '~components/common/LinkSalerBox.vue'
-import { goLinkUser } from '~utils/baseUtils'
 export default {
   name: 'commodity-list',
   props: ['kinds'],
@@ -396,7 +395,7 @@ export default {
       }
     },
     goLink: function () {
-      goLinkUser(this, this.storeInfo.enUU)
+      this.baseUtils.goLinkUser(this, this.storeInfo.enUU)
     }
   }
 }

+ 1 - 2
components/store/ComponentInfo.vue

@@ -27,7 +27,6 @@
 <script>
 
   import LinkSalerBox from '~components/common/LinkSalerBox.vue'
-  import { goLinkUser } from '~utils/baseUtils'
 
   export default {
     name: 'component-info',
@@ -56,7 +55,7 @@
     },
     methods: {
       goLink: function () {
-        goLinkUser(this, this.storeInfo.enUU)
+        this.baseUtils.goLinkUser(this, this.storeInfo.enUU)
       }
     }
   }

+ 2 - 3
components/store/RecommendProduct.vue

@@ -34,7 +34,6 @@
 </template>
 <script>
   import Buy from '~components/common/buyOrCar/buyComponent.vue'
-  import { enidfilter } from '~utils/baseUtils'
   export default {
     name: 'recommend-product',
     components: {
@@ -105,10 +104,10 @@
                         type: 'success'
                       })
                       window.setTimeout(function () {
-                        window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
+                        window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
                       }, 1000)
                     } else {
-                      window.location.href = '/user#/order/pay/' + enidfilter(response.data.data.orderid)
+                      window.location.href = '/user#/order/pay/' + this.baseUtils.enidfilter(response.data.data.orderid)
                     }
                   } else {
                     if (response.data.data && response.data.data.unvailable === 1) {

+ 1 - 2
components/store/common/StoreHeader.vue

@@ -98,7 +98,6 @@
 import Clipboard from 'clipboard'
 import SearchBox from '~components/main/Search.vue'
 import LinkSalerBox from '~components/common/LinkSalerBox.vue'
-import { goLinkUser } from '~utils/baseUtils'
 
 let QRCode = require('qrcode')
 
@@ -182,7 +181,7 @@ export default {
       }
     },
     goLink: function () {
-      goLinkUser(this, this.storeInfo.enUU)
+      this.baseUtils.goLinkUser(this, this.storeInfo.enUU)
     },
 //    goWebChat: function () {
 //      if (!this.user.logged) {

+ 2 - 3
components/supplier/details.vue

@@ -122,7 +122,6 @@
 </template>
 
 <script>
-  import {spliceStr, formatDate} from '~utils/baseUtils.js'
   export default {
     name: 'DetailsView',
     data () {
@@ -172,7 +171,7 @@
     },
     methods: {
       spliceString (str, length) {
-        return spliceStr(str, length)
+        return this.baseUtils.spliceStr(str, length)
       },
       // 弹出询价界面
       immediatelyClick () {
@@ -184,7 +183,7 @@
       },
       // 时间格式化
       setDeadLineValid: function () {
-        this.applyObj.deadline = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+        this.applyObj.deadline = this.baseUtils.formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
         this.validObj.deadline = true
       },
       // 检查单价预算

+ 2 - 3
components/supplier/resource.vue

@@ -169,7 +169,6 @@
 </template>
 
 <script>
-  import {spliceStr, formatDate} from '~utils/baseUtils.js'
   import Page from '~/components/common/page/pageComponent.vue'
   export default {
     name: 'ResourceView',
@@ -228,7 +227,7 @@
     methods: {
       // 格式化字符串长度
       spliceString (str, length) {
-        return str && str.length ? spliceStr(str, length) : '暂无信息'
+        return str && str.length ? this.baseUtils.spliceStr(str, length) : '暂无信息'
       },
       // 跳转到器件详情页面
       jumpDetail (id) {
@@ -265,7 +264,7 @@
       },
       // 时间格式化
       setDeadLineValid: function () {
-        this.applyObj.deadline = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+        this.applyObj.deadline = this.baseUtils.formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
         this.validObj.deadline = true
       },
       // 检查单价预算

+ 1 - 13
pages/mobile/center/vendor/productdetails.vue

@@ -129,18 +129,6 @@
 </template>
 
 <script>
-  function deepCopy(target) {
-    if (typeof target !== 'object') return
-    // 判断目标类型,来创建返回值
-    var newObj = target instanceof Array ? [] : {}
-    for (var item in target) {
-      // 只复制元素自身的属性,不复制原型链上的
-      if (target.hasOwnProperty(item)) {
-        newObj[item] = typeof target[item] === 'object' ? deepCopy(target[item]) : target[item]
-      }
-    }
-    return newObj
-  }
   import { RemindBox } from '~components/mobile/common'
   export default {
     name: 'productDetails',
@@ -162,7 +150,7 @@
       }
     },
     mounted() {
-      this.chooseItem = deepCopy(this.$store.state.product.brand.onSaleDetails.data)
+      this.chooseItem = this.baseUtils.deepCopy(this.$store.state.product.brand.onSaleDetails.data)
       this.chooseItem.storeInfoOms = this.chooseItem.storeid === '33069557578d44e69bd91ad12d28a8d4' ? '寄售' : '自营'
     },
     computed: {

+ 1 - 14
pages/mobile/wechat/index.vue

@@ -53,19 +53,6 @@
 <script>
   import { RemindBox } from '~components/mobile/common'
   import BScroll from 'better-scroll'
-  // 实现深拷贝
-  function deepCopy(target) {
-    if (typeof target !== 'object') return
-    // 判断目标类型,来创建返回值
-    var newObj = target instanceof Array ? [] : {}
-    for (var item in target) {
-      // 只复制元素自身的属性,不复制原型链上的
-      if (target.hasOwnProperty(item)) {
-        newObj[item] = typeof target[item] === 'object' ? deepCopy(target[item]) : target[item]
-      }
-    }
-    return newObj
-  }
   export default {
     name: 'wechatView',
     layout: 'mobileNoHeader',
@@ -103,7 +90,7 @@
     },
     methods: {
       clickItem(item) {
-        let userAccount = deepCopy(this.$store.state.option.wechatInfo.data.userAccount)
+        let userAccount = this.baseUtils.deepCopy(this.$store.state.option.wechatInfo.data.userAccount)
         userAccount.spaceUU = item.uu
         this.$http.get('/newLogin/other', {params: userAccount}).then(res => {
           this.$store.dispatch('loadUserInfo').then(() => {

+ 2 - 6
plugins/mixin.js

@@ -4,7 +4,7 @@
 */
 import BScroll from 'better-scroll'
 import Vue from 'vue'
-import {deepCopy, goLinkUser, filterStringEllipsis} from '~utils/baseUtils'
+import baseUtils from '~utils/baseUtils'
 // import { mapState } from 'vuex'
 
 Vue.mixin({
@@ -56,11 +56,7 @@ Vue.mixin({
       }
     },
     baseUtils () {
-      return {
-        deepCopy: deepCopy,
-        goLinkUser: goLinkUser,
-        filterStringEllipsis: filterStringEllipsis
-      }
+      return baseUtils
     }
   },
   methods: {

+ 76 - 34
utils/baseUtils.js

@@ -1,14 +1,13 @@
 
 const NULL_ARR = ['空', '没', '无', '-', '—', 'null', '#N/A']
 
-// 立即购买或加入购物车
 /*
  *  isBuy: 是否是立即购买
  *  event: 触发事件
  *  $this: 当前对象
  *  item: 操作对象
  * */
-const _buyNow = function (isBuy, event, $this, item) {
+const _buyOrCar = function (isBuy, event, $this, item) {
   if (event) event.stopPropagation()
   if (!$this.$store.state.option.user.logged) {
     $this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
@@ -96,7 +95,6 @@ const _buyNow = function (isBuy, event, $this, item) {
   // window.location.href = 'user#/order/pay/' + $this.enidfilter($this.buy_info.orderid)
 }
 
-// 订单号转换
 const _enidfilter = (str) => {
   if (str) {
     let encryptStr = '' // 最终返回的加密后的字符串
@@ -165,7 +163,9 @@ const _enidfilter = (str) => {
   }
 }
 
-// 获取字符串字符长度
+/*
+* @str 字符串
+* */
 const _getRealLen = function (str) {
   let len = 0
   for (let i = 0; i < str.length; i++) {
@@ -178,8 +178,10 @@ const _getRealLen = function (str) {
   return len
 }
 
-export const enidfilter = _enidfilter
-
+/*
+* @str 字符串
+* @length 需要剪切的字符长度
+* */
 const _cutOutString = (str, length) => {
   for (let i = 1; i <= str.length; i++) {
     if (_getRealLen(str.substr(0, i)) > length) {
@@ -190,14 +192,7 @@ const _cutOutString = (str, length) => {
   return str
 }
 
-// 获取字符串字符长度
-export const getRealLen = _getRealLen
-
-// 根据字符长度剪切字符
-export const cutOutString = _cutOutString
-
-// 根据字符长度剪切字符
-export const spliceStr = (str, length) => {
+const _spliceStr = (str, length) => {
   for (let i = 1; i <= str.length; i++) {
     if (_getRealLen(str.substr(0, i)) > length) {
       str = str.substr(0, i - 1) + '...'
@@ -207,8 +202,12 @@ export const spliceStr = (str, length) => {
   return str
 }
 
-// 格式化日期,返回字符串
-export const formatDate = (date, fmt) => {
+/*
+* @date 日期,既可以是Date格式,也可是字符串格式
+* @fmt 需要转换的格式,如 'yyyy-MM-dd hh:mm:ss'
+* return 转换后的字符串格式的日期
+* */
+const _formatDate = (date, fmt) => {
   if (!date) {
     return null
   }
@@ -235,8 +234,10 @@ export const formatDate = (date, fmt) => {
   return fmt
 }
 
-// 检查空字符串或规定状态下空字符
-export const checkNullStr = (str) => {
+/*
+* @str 传入的字符串
+* */
+const _checkNullStr = (str) => {
   // NULL_ARR.map(s => {
   //   if (str === s) {
   //     return false
@@ -250,8 +251,11 @@ export const checkNullStr = (str) => {
   return true
 }
 
-// 联系卖家
-export const goLinkUser = ($this, enuu) => {
+/*
+* @$this 当前上下文
+* @enuu 企业uu
+* */
+const _goLinkUser = ($this, enuu) => {
   if ($this.user.logged) {
     // $this.$http.get('/basic/enterprise/' + $this.storeInfo.enUU + '/info').then(response => {
     //   if (response.data.enTel) {
@@ -283,38 +287,46 @@ export const goLinkUser = ($this, enuu) => {
   }
 }
 
-// 判断字符串开头
-export const startWith = function (str, s) {
+/*
+* @str: 传入的字符串
+* @s: 需要判断的字符串
+* */
+const _startWith = (str, s) => {
   let reg = new RegExp('^' + s)
   return reg.test(str)
 }
 
-// 根据path文件名来判断文件是否是PDF文件
-export const judgeIsPdf = function (path) {
+/*
+* @path 文件路径地址
+* */
+const _judgeIsPdf = (path) => {
   if (path) {
     return path.slice(path.lastIndexOf('.')).toLowerCase() === '.pdf'
   } else {
     return false
   }
 }
-// 实现深拷贝
-export const deepCopy = function (target) {
+
+/*
+* @target 需要拷贝的对象
+* */
+const _deepCopy = (target) => {
   if (typeof target !== 'object') return
   // 判断目标类型,来创建返回值
   var newObj = target instanceof Array ? [] : {}
   for (var item in target) {
     // 只复制元素自身的属性,不复制原型链上的
     if (target.hasOwnProperty(item)) {
-      newObj[item] = typeof target[item] === 'object' ? deepCopy(target[item]) : target[item]
+      newObj[item] = typeof target[item] === 'object' ? _deepCopy(target[item]) : target[item]
     }
   }
   return newObj
 }
 
-export function whichTransitionEvent() {
-  var t
-  var el = document.createElement('fakeelement')
-  var transitions = {
+const _whichTransitionEvent = () => {
+  let t
+  let el = document.createElement('fakeelement')
+  let transitions = {
     transition: 'transitionend',
     OTransition: 'oTransitionEnd',
     MozTransition: 'transitionend',
@@ -327,8 +339,38 @@ export function whichTransitionEvent() {
   }
 }
 
-export const buyOrCar = _buyNow
-
-export const filterStringEllipsis = (str, len) => {
+/*
+*  @str 剪切的字符串
+*  @len 长度设置
+* */
+const _filterStringEllipsis = (str, len) => {
   return str ? _getRealLen(str) > len ? _cutOutString(str, len) + '...' : str : null
 }
+
+export default {
+  // 获取字符串字符长度
+  getRealLen: _getRealLen,
+  // 根据字符长度剪切字符
+  cutOutString: _cutOutString,
+  // 订单号转换
+  enidfilter: _enidfilter,
+  // 根据字符长度剪切字符串
+  spliceStr: _spliceStr,
+  // 格式化日期,返回字符串
+  formatDate: _formatDate,
+  // 检查空字符串或规定状态下空字符
+  checkNullStr: _checkNullStr,
+  // 联系卖家
+  goLinkUser: _goLinkUser,
+  // 判断字符串开头
+  startWith: _startWith,
+  // 根据path文件名来判断文件是否是PDF文件
+  judgeIsPdf: _judgeIsPdf,
+  // 深拷贝对象
+  deepCopy: _deepCopy,
+  whichTransitionEvent: _whichTransitionEvent,
+  // 立即购买或加入购物车
+  buyOrCar: _buyOrCar,
+  // 截取字符长度并补充省略号
+  filterStringEllipsis: _filterStringEllipsis
+}