Selaa lähdekoodia

Merge remote-tracking branch 'origin/release-201827-wangcz' into release-201827-wangcz

shenjj 7 vuotta sitten
vanhempi
commit
333757c1bb

+ 84 - 14
components/mobile/center/outOfStorage/otherStorage.vue

@@ -24,9 +24,11 @@
         <div class="linetext width50 fl">物料名称: <span v-text="item.pcmpcode">21324</span></div>
         <div class="linetext width50 fl">规格: <span v-text="item.spec">21324</span></div>
         <div class="linetext width50 fl"><em>*</em>{{switchType === 'INBOUND' ? '入库数' : '出库数'}}(PCS): <span>
-          <input type="text" style="width:1rem;" v-model.number="item.qty">
+          <input type="text" style="width:1rem;" v-model="item.qty" @input="onAmountInput(item, index)">
+        </span></div>
+        <div class="linetext width50 fl">单价({{currency === 'RMB' ? '¥': '$'}}):<span>
+          <input type="text" style="width:2rem;" v-model="item.price" @blur="rMBPriceBlur(item, index)">
         </span></div>
-        <div class="linetext width50 fl">单价(¥):<span><input type="text" style="width:2rem;" v-model.number="item.price"></span></div>
         <div class="content-line" v-show="item.showSimilarCodeList && item.cmpCode">
           <ul class="similar">
             <li v-for="sCode in similarCode" @click.stop="setCode(sCode, index)">
@@ -53,6 +55,11 @@
         default: 'INBOUND'
       }
     },
+    fetch({route, store}) {
+      return Promise.all([
+        store.dispatch('loadCurrencyData')
+      ])
+    },
     data () {
       return {
         remindText: '',
@@ -79,6 +86,16 @@
       this.allObj.push(this.storageObj)
       document.body.onclick = function() {
         _this.allObj.forEach(val => {
+          if(!val.productId) {
+            val = {
+              cmpCode: '',
+              brand: '',
+              pcmpcode: '',
+              spec: '',
+              qty: '',
+              price: ''
+            }
+          }
           val.showSimilarCodeList = false
         })
       }
@@ -106,7 +123,15 @@
       initData () {
         this.enName = ''
         this.allObj = []
-        this.allObj.push(this.storageObj)
+        this.allObj.push({
+          cmpCode: '',
+          brand: '',
+          pcmpcode: '',
+          spec: '',
+          qty: '',
+          price: '',
+          showSimilarCodeList: false,
+        })
       },
       onCodeChange (type) {
         this.allObj[type].showSimilarCodeList = true
@@ -117,14 +142,13 @@
         if (this.allObj[type].cmpCode) {
           this.$http.get('/trade/products/code/keyword', {params: {keyword: this.allObj[type].cmpCode}})
             .then(response => {
-              if(response.data){
-                this.similarCode = response.data || []
+              if(response.data.length > 0){
+                this.similarCode = response.data
               } else {
                 this.onRemind('没有找到产品信息')
               }
               this.allObj[type].showSimilarCodeList = response.data.length > 0
             }).catch((err) => {
-              this.allObj[type].showSimilarCodeList = false
               this.similarCode = []
               this.onRemind('没有找到产品信息')
             })
@@ -156,21 +180,67 @@
           this.allObj.push(_item)
         }
       },
+      onAmountInput: function (item, index) {
+        if (!(/^[0-9]*$/).test(item.qty)) {
+          let chineseIndex = -1
+          for (let i = 0; i < item.qty.length; i++) {
+            if (!(/^[0-9]*$/).test(item.qty.charAt(i))) {
+              chineseIndex = i
+              break
+            }
+          }
+          this.allObj[index].qty = this.baseUtils.cutOutString(item.qty, chineseIndex)
+        } else if (item.qty.length > 9) {
+          this.onRemind ('数量不能高于1亿')
+          this.allObj[index].qty = this.baseUtils.cutOutString(item.qty, 9)
+        }
+      },
+      rMBPriceBlur(item) {
+        if (item.price === '' || !item.price) { return false }
+        if (!/^[0-9]+([.]{1}[0-9]{1,6})?$/.test(item.price)) {
+          this.onRemind('单价只能输入数字带6位小数')
+        } else if (Math.abs(item.price) === 0) {
+          return false
+        } else if (Math.abs(item.price) >= 10000) {
+          item.price = 9999
+          this.onRemind ('单价不能高于10000')
+          return false
+        }
+        item.price = item.price.toString()
+        let splits = item.price.split('.')
+        if (splits[0].length >= 4) {
+          splits[0] = splits[0].substr(0, 4)
+          item.price = splits[0]
+        }
+        if (splits[1]) {
+          item.price = splits[0] + '.' + splits[1]
+        }
+        if (splits[1] && splits[1].length > 6) {
+          splits[1] = splits[1].substr(0, 7)
+          let str = splits[1].substr(0, 6)
+          if (splits[1][splits[1].length - 1] >= 5) {
+            str = splits[1].substr(0, 6)
+            str = Math.abs(str) + 1
+          }
+          item.price = splits[0] + '.' + Math.ceil(str)
+        }
+      },
       saveClick (type) {
         if(type === 'clear') {
           this.initData()
         }else {
-          if(!this.enName) {
-            this.onRemind('请输入' + this.switchType === 'INBOUND' ? '请输入卖家名称' : '请输入买家名称')
-          } else {
-            let arr = []
-            this.allObj.forEach(val => {
-              if(!val.price && !val.qty && !val.productId) {
+          let arr = []
+          let falg = false;
+          this.allObj.forEach(val => {
+            if(val.productId) {
+              if(!val.price && !val.qty) {
                 this.onRemind('请将数据补充完整')
-                return
               }
+              falg = true;
               arr.push({price: val.price, productId: val.productId, qty:val.qty})
-            })
+            }
+          })
+          if(falg) {
             this.$http.post(`/CommodityInOutbound/${this.switchType === 'INBOUND'? 'inBound': 'outBound'}/other?enName=${this.enName}`, arr)
               .then(response => {
                 if(response.data.code === 1){

+ 17 - 12
components/register-saler/register/StepThird.vue

@@ -104,18 +104,6 @@
               <div class="add-brand row">
                 <a href="javascript:void(0)" title="增加品牌" @click="addBrand"><em><i class="fa fa-plus-circle"></i>增加品牌</em></a>
               </div>
-              <!--主营产品-->
-              <div class="row brand-type">
-                <div class="col-md-1" style="padding:0;">主营产品<em>*</em></div>
-                <div class="col-md-10">
-                  <textarea v-model="description"
-                            style="line-height: 20px;font-size: 14px;margin-top:25px;"
-                            rows="8"
-                            @blur.stop.prevent="onDescription()"
-                            class="form-control"
-                            placeholder="例:本店主营Panasonic、IT、三星等知名品牌的触控IC、显示驱动IC、液晶屏、功率模块类、电源芯片、高压熔断、被动器件等产品。"></textarea>
-                </div>
-              </div>
             </div>
             <!--原厂end-->
             <!--代理商 begin-->
@@ -228,6 +216,18 @@
               </div>
             </div>
             <!--经销商 end-->
+            <!--主营产品-->
+            <div class="row brand-type">
+              <div class="col-md-1" style="padding:0;">主营产品<em>*</em></div>
+              <div class="col-md-10">
+                  <textarea v-model="description"
+                            style="line-height: 20px;font-size: 14px;margin-top:25px;"
+                            rows="8"
+                            maxlength="500"
+                            class="form-control"
+                            placeholder="例:本店主营Panasonic、IT、三星等知名品牌的触控IC、显示驱动IC、液晶屏、功率模块类、电源芯片、高压熔断、被动器件等产品。"></textarea>
+              </div>
+            </div>
           </div>
           <!-- Submit button -->
          <!-- <div style="padding: 28px 40px;">
@@ -285,6 +285,7 @@
     data () {
       return {
         tab: 'ORIGINAL_FACTORY',
+        description:'',
         brands: [{
           type: 'BRAND',
           name: '',
@@ -469,6 +470,9 @@
         if (this.businessLicenseUrl === '') {
           this.$message.error('请上传营业执照')
           this.showLoading = false
+        } else if (this.description === '') {
+            this.$message.error('请填写主营产品信息')
+            this.showLoading = false
         } else {
           if (this.brands[0].name === '') {
             validCode = 1
@@ -505,6 +509,7 @@
             })
             // 申请开店
             this.$http.post('/store-service/applications', {
+              applyDescription: this.description,
               brands: tmpBrands,
               qualifications: qualifications,
               type: this.tab

+ 3 - 2
pages/mobile/center/vendor/outOfStorage/_id.vue

@@ -25,7 +25,7 @@
             <div class="linetext width50 fl">物料名称: <span v-text="item.kindName || '-'">21324</span></div>
             <div class="linetext width50 fl">规格: <span v-text="item.spec || '-'">21324</span></div>
             <div class="linetext width50 fl">{{storageList.type === 'INBOUND' ? '入库数' : '出库数'}}(PCS): <span v-text="item.qty || '-'">21324</span></div>
-            <div class="linetext width50 fl">单价(¥): <span class="base-color" v-text="item.price || '-'">21324</span></div>
+            <div class="linetext width50 fl">单价({{currency === 'RMB' ? '¥': '$'}}): <span class="base-color" v-text="item.price || '-'">21324</span></div>
           </li>
         </ul>
       </div>
@@ -40,7 +40,8 @@
     layout: 'mobile',
     fetch({route, store}) {
       return Promise.all([
-        store.dispatch('product/getLoadStorageId', {id:route.params.id})
+        store.dispatch('product/getLoadStorageId', {id:route.params.id}),
+        store.dispatch('loadCurrencyData')
       ])
     },
     data () {

+ 1 - 1
pages/mobile/center/vendor/outOfStorage/index.vue

@@ -14,7 +14,7 @@
         <div class="storage-record">
           <div class="search-content clearfix">
             <div class="search">
-              <input type="text" v-model="filterParams.keyword" :placeholder="switchType ==='OUTBOUND' ? '发货单/卖家' : '订单号/买家'" class="staff-search" @keyup.13="filterRecord">
+              <input type="text" v-model="filterParams.keyword" :placeholder="switchType ==='OUTBOUND' ? '订单号/买家名称' : (handleItem === 0 ? '入库订单/卖家名称':'发货单/卖家名称')" class="staff-search" @keyup.13="filterRecord">
               <span @click="filterRecord"><i class="iconfont icon-sousuo"></i></span>
             </div>
           </div>

+ 6 - 4
pages/mobile/center/vendor/outOfStorage/purchase/_storeid.vue

@@ -28,7 +28,7 @@
             <div class="linetext width50 fl">物料名称: <span v-text="item.kiName || '-'">21324</span></div>
             <div class="linetext width50 fl">规格: <span v-text="item.spec || '-'">21324</span></div>
             <div class="linetext width50 fl">入库数(PCS):<span v-text="item.qty || '-'">-</span></div>
-            <div class="linetext width50 fl">单价(¥): <span class="base-color" v-text="item.price || '-'">21324</span></div>
+            <div class="linetext width50 fl">单价({{currency === 'RMB' ? '¥': '$'}}): <span class="base-color" v-text="item.price || '-'">21324</span></div>
           </li>
         </ul>
       </div>
@@ -86,10 +86,12 @@
     layout: 'mobile',
     fetch({route, store}) {
       return route.query.type === 'INBOUND' ? Promise.all([
-        store.dispatch('product/getLoadEnterpriseId', {id:route.params.storeid})
+        store.dispatch('product/getLoadEnterpriseId', {id:route.params.storeid}),
+        store.dispatch('loadCurrencyData')
       ]) : Promise.all([
         store.dispatch('product/getLoadPurchaseId', {id:route.params.storeid}),
-        store.dispatch('product/getLoadLogistics', {count:30, page: 1})
+        store.dispatch('product/getLoadLogistics', {count:30, page: 1}),
+        store.dispatch('loadCurrencyData')
       ])
     },
     data () {
@@ -167,7 +169,7 @@
             let arr = []
             this.storageList.purchaseDetails.forEach(val => {
               if(val.qty) {
-                arr.push({id: val.id, qty: val.qty})
+                arr.push({id: val.id, qty: Number(val.qty)})
               }
             })
             if(arr.length <= 0) {

+ 3 - 3
pages/mobile/order/details.vue

@@ -668,7 +668,7 @@
                   this.showSend = true
                   // if (item.inid) {
                   //   this._id = EncryptionFilter(item.inid)
-                  //   this.$http.get(`/trade/inFpu/tobeshipped/${this._id}`).then(res => {
+                  //   this.$http.get(`/trade/invoice/inFpu/tobeshipped/${this._id}`).then(res => {
                   //     this.sendGoodsInfo = res.data[0]
                   //     this.sendGoodsInfo.area = JSON.parse(res.data[0].jsonSpAddress)
                   //     this.showSend = true
@@ -676,7 +676,7 @@
                   // } else {
                   //   this.$http.get(`/trade/purchase/vendor/tobeshiped/${item.id}`).then(res => {
                   //     this._id = EncryptionFilter(res.data.inId)
-                  //     this.$http.get(`/trade/inFpu/tobeshipped/${this._id}`).then(res => {
+                  //     this.$http.get(`/trade/invoice/inFpu/tobeshipped/${this._id}`).then(res => {
                   //       this.sendGoodsInfo = res.data[0]
                   //       this.sendGoodsInfo.area = JSON.parse(res.data[0].jsonSpAddress)
                   //       this.showSend = true
@@ -745,7 +745,7 @@
                 }
               }
               sendInfo.map = _obj
-              this.$http.post(`/trade/inFpu/save?id=${this.sendGoodsInfo.id}`, sendInfo).then(res => {
+              this.$http.post(`/trade/invoice/inFpu/save?id=${this.sendGoodsInfo.id}`, sendInfo).then(res => {
                 if (res.data.success) {
                   this.onMind('发货成功')
                   setTimeout(() => {

+ 2 - 2
pages/mobile/order/index.vue

@@ -523,7 +523,7 @@
                 // } else {
                 //   this.$http.get(`/trade/purchase/vendor/tobeshiped/${item.id}`).then(res => {
                 //     this._id = EncryptionFilter(res.data.inId)
-                //     this.$http.get(`/trade/inFpu/tobeshipped/${this._id}`).then(res => {
+                //     this.$http.get(`/trade/invoice/inFpu/tobeshipped/${this._id}`).then(res => {
                 //       this.sendGoodsInfo = res.data[0]
                 //       this.sendGoodsInfo.area = JSON.parse(res.data[0].jsonSpAddress)
                 //       this.showSend = true
@@ -592,7 +592,7 @@
               }
             }
             sendInfo.map = _obj
-            this.$http.post(`/trade/inFpu/save?id=${this.sendGoodsInfo.id}`, sendInfo).then(res => {
+            this.$http.post(`/trade/invoice/inFpu/save?id=${this.sendGoodsInfo.id}`, sendInfo).then(res => {
               if (res.data.success) {
                 this.onMind('发货成功')
                 setTimeout(() => {

+ 3 - 0
plugins/mixin.js

@@ -18,6 +18,9 @@ Vue.mixin({
     user() {
       return this.$store.state.option.user
     },
+    currency() {
+      return this.$store.state.option.currency
+    },
     isAdmin () {
       let isAdmin = null
       if (this.user.data.enterprise) {

+ 7 - 0
store/index.js

@@ -108,6 +108,13 @@ export const actions = {
         commit('option/REQUEST_COUNTER_FAILURE')
       })
   },
+  // 获取币别信息
+  loadCurrencyData ({commit}) {
+    return axios.get('basic/enterprise/currency')
+      .then(res => {
+        commit('option/SET_CURRENCY', res.data)
+      })
+  },
   // 获取楼层配置
   loadFloors({ commit }) {
     commit('floor/REQUEST_LIST')

+ 5 - 0
store/option.js

@@ -41,6 +41,8 @@ export const state = () => ({
     fetching: false,
     data: {}
   },
+  //币别
+  currency: '',
   messageType: '',
   showMobileFooter: true
 })
@@ -134,6 +136,9 @@ export const mutations = {
   REQUEST_WECHATINFO_STATUS_FAILURE (state) {
     state.wechatInfo.fetching = false
   },
+  SET_CURRENCY (state, result) {
+    state.currency = result.data ? result.data.data : 'RMB'
+  },
   GET_MESSAGETYPE (state, result) {
     state.messageType = result || ''
   },

+ 5 - 5
store/shop.js

@@ -44,17 +44,17 @@ export const actions = {
       .then(response => {
         commit('storeInfo/GET_COMMODITY_SUCCESS', response.data)
         let commodity = response.data || {}
-        if(commodity.uuid) {
-          commit('storeInfo/REQUEST_COMPONENT')
+        commit('storeInfo/REQUEST_COMPONENT')
+        if (commodity.uuid) {
           return axios.get(`/api/commodity/component/${commodity.uuid}`)
             .then(response => {
               commit('storeInfo/GET_COMPONENT_SUCCESS', response.data)
-              return Promise.all([
-                findStoreInfoFromUuid({ commit }, {uuid: commodity.storeid})
-              ])
+              return findStoreInfoFromUuid({ commit }, {uuid: commodity.storeid})
             }, err => {
               commit('storeInfo/GET_COMPONENT_FAILURE', err)
             })
+        } else {
+          return findStoreInfoFromUuid({ commit }, {uuid: commodity.storeid})
         }
       }, err => {
         commit('storeInfo/GET_COMMODITY_FAILURE', err)