Browse Source

处理BUG

wangcz 7 years ago
parent
commit
9f8c0aed33

+ 3 - 3
components/mobile/center/outOfStorage/StorageList.vue

@@ -2,7 +2,7 @@
   <div class="storage">
     <ul class="list-unstyled">
       <li v-for="item in listData" v-if="handleItem === 0">
-        <div class="linetext">{{switchType === 'INBOUND' ? '入库单' : '出库单'}}: <span v-text="item.inOutId || '-'">21324</span></div>
+        <div class="linetext">{{switchType === 'INBOUND' ? '入库单' : '出库单'}}: <span v-text="item.inOutId || '-'">21324</span></div>
         <div class="linetext">{{switchType === 'INBOUND' ? '卖家名称' : '买家名称'}}: <span v-text="item.affiliatedEnterprise || '-'">21324</span></div>
         <div class="linetext">类型: <span v-text="setFilterType(item.opertatorType)">21324</span></div>
         <div class="linetext">录入人: <span v-text="item.operaterUserName || '-'">21324</span></div>
@@ -12,8 +12,8 @@
         </div>
       </li>
       <li v-for="item in listData" v-if="handleItem === 2">
-        <div class="linetext">{{switchType === 'INBOUND' ? '入库单' : '出库单'}}: <span>系统自动生成</span></div>
-        <div class="linetext">订单号: <span v-text="item.purchaseid || '-'">21324</span></div>
+        <div class="linetext">{{switchType === 'INBOUND' ? '入库单' : '出库单'}}: <span>系统自动生成</span></div>
+        <div class="linetext">{{switchType === 'INBOUND' ? '发货单' : '订单号'}}: <span v-text="item.orderid || '-'">21324</span></div>
         <div class="linetext">{{switchType === 'INBOUND' ? '卖家名称' : '买家名称'}}: <span v-text="item.buyentername || item.buyerentername || item.buyername || '-'">21324</span></div>
         <div class="linetext">录入人: <span v-text="item.sellername || '-'">21324</span></div>
         <div class="linetext">录入时间: <span v-text="item.createtime ? baseUtils.formatDate(new Date(item.createtime), 'yyyy-MM-dd hh:mm:ss') : '-'">21324</span></div>

+ 60 - 17
components/mobile/center/outOfStorage/otherStorage.vue

@@ -23,11 +23,12 @@
         <div class="linetext width50 fl">品牌: <span v-text="item.brand">21324</span></div>
         <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">库存数: <span v-text="item.erpReserve">21324</span></div>
         <div class="linetext width50 fl"><em>*</em>{{switchType === 'INBOUND' ? '入库数' : '出库数'}}(PCS): <span>
-          <input type="text" style="width:1rem;" v-model="item.qty" @input="onAmountInput(item, index)">
+          <input type="text" style="width:1.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)">
+        <div class="linetext width50 fl">{{switchType === 'INBOUND' ? '采购单价' : '销售单价'}}({{currency === 'RMB' ? '¥': '$'}}):<span>
+          <input type="text" style="width:1.2rem;" v-model="item.price" @blur="rMBPriceBlur(item, index)">
         </span></div>
         <div class="content-line" v-show="item.showSimilarCodeList && item.cmpCode">
           <ul class="similar">
@@ -145,12 +146,23 @@
               if(response.data.length > 0){
                 this.similarCode = response.data
               } else {
-                this.onRemind('没有找到产品信息')
+                this.similarCode = []
+                this.allObj[type].cmpCode = ''
+                this.allObj[type].brand = ''
+                this.allObj[type].pcmpcode = ''
+                this.allObj[type].spec = ''
+                this.allObj[type].productId = ''
+                this.onRemind('产品库中没有找到相应产品信息')
               }
               this.allObj[type].showSimilarCodeList = response.data.length > 0
             }).catch((err) => {
               this.similarCode = []
-              this.onRemind('没有找到产品信息')
+              this.allObj[type].cmpCode = ''
+              this.allObj[type].brand = ''
+              this.allObj[type].pcmpcode = ''
+              this.allObj[type].spec = ''
+              this.allObj[type].productId = ''
+              this.onRemind('产品库中没有找到相应产品信息')
             })
         } else {
           this.allObj[type].showSimilarCodeList = false
@@ -162,7 +174,11 @@
         this.allObj[type].pcmpcode = data.kind
         this.allObj[type].spec = data.spec
         this.allObj[type].productId = data.id
+        this.allObj[type].erpReserve = data.erpReserve
         this.allObj[type].showSimilarCodeList = false
+        if(data.erpReserve <= 0 && this.switchType === 'OUTBOUND') {
+          this.onRemind('当前产品库存为0,不能出库!')
+        }
       },
       addClick (type) {
         if(type) {
@@ -230,24 +246,50 @@
           this.initData()
         }else {
           let arr = []
-          let falg = false;
+          let flag = 0;
           this.allObj.forEach(val => {
             if(val.productId) {
-              if(!val.price && !val.qty) {
-                this.onRemind('请将数据补充完整')
+              if((val.erpReserve <= 0) && this.switchType === 'OUTBOUND'){
+                flag = 1
+              } else if((val.erpReserve < val.qty) && this.switchType === 'OUTBOUND') {
+                flag = 2
+              } else if(val.qty) {
+                val.price ?
+                  arr.push({price: Number(val.price), productId: val.productId, qty:Number(val.qty)}) :
+                  arr.push({productId: val.productId, qty:Number(val.qty)})
+              } else {
+                flag = 3
               }
-              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){
-                  this.onRemind('保存信息成功')
-                }
-              })
+          if(flag === 1) {
+            this.onRemind('产品库中库存数量为0将不能出库!')
+            return;
+          }
+          if(flag === 2) {
+            this.onRemind('出库量数量不能大于库存数!')
+            return;
+          }
+          if(flag === 3) {
+            this.onRemind('请填写数量!')
+            return;
+          }
+          if(arr.length <= 0) {
+            this.onRemind('至少填写一条数据!')
+            return;
           }
+          this.$http.post(`/CommodityInOutbound/${this.switchType === 'INBOUND'? 'inBound': 'outBound'}/other?enName=${this.enName}`, arr)
+            .then(response => {
+              if(response.data.code === 1){
+                this.onRemind('保存信息成功')
+                this.initData()
+              } else {
+                this.onRemind(response.data)
+              }
+            })
+            .catch(err => {
+              this.onRemind('保存信息失败')
+            })
         }
       }
     }
@@ -266,6 +308,7 @@
       bottom: 1rem;
       left: 0;
       right: 0;
+      z-index:100;
       text-align: center;
       span{
         display:inline-block;

+ 3 - 5
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' ? '订单号/买家名称' : (handleItem === 0 ? '入库单/卖家名称':'发货单/卖家名称')" class="staff-search" @keyup.13="filterRecord">
+              <input type="text" v-model="filterParams.keyword" :placeholder="switchType ==='OUTBOUND' ? (handleItem === 0 ? '出库单号/买家名称':'订单号/买家名称') : (handleItem === 0 ? '入库单/卖家名称':'发货单/卖家名称')" class="staff-search" @keyup.13="filterRecord">
               <span @click="filterRecord"><i class="iconfont icon-sousuo"></i></span>
             </div>
           </div>
@@ -35,10 +35,8 @@
             </base-filter>
           </div>
           <div class="list-content">
-            <keep-alive>
-              <storage-list :listData="storageList" :switchType="switchType" :handleItem="handleItem" v-if="handleItem !== 1"></storage-list>
-              <other-storage :switchType="switchType" v-else></other-storage>
-            </keep-alive>
+            <storage-list :listData="storageList" :switchType="switchType" :handleItem="handleItem" v-if="handleItem !== 1"></storage-list>
+            <other-storage :switchType="switchType" v-else></other-storage>
           </div>
           <empty-status  v-if="isEmpty && handleItem !== 1" :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'"></empty-status>
           <pull-up :fixId="'mobile-storage-center'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>

+ 17 - 2
pages/mobile/center/vendor/outOfStorage/purchase/_storeid.vue

@@ -175,15 +175,23 @@
             if(arr.length <= 0) {
               this.onRemind('最少填写一个发货数量')
             } else {
-              this.allObj.sendType = type.sendType
+              console.log(type)
+              this.allObj.sendType = this.storageList.sendType
               this.allObj.map = arr
               this.allObj.jsonSdAddress = this.storageList.jsonAddress
               this.$http.post(`/trade/invoice/inFpu/save?id=${this.storageList.id}`, this.allObj)
                 .then(response => {
                   if(response.data.code === 1){
                     this.onRemind('保存信息成功')
+                    setTimeout(() => {
+                      this.$router.push(`/mobile/center/vendor/outOfStorage?providerType=person&handleItem=2&type=${this.$route.query.type}`)
+                    }, 1000)
+                  } else {
+                    this.onRemind('保存信息失败')
                   }
-                })
+                }).catch(err => {
+                  this.onRemind('保存信息失败')
+              })
             }
           }
         } else if(type === 'INBOUND') {
@@ -191,7 +199,14 @@
             .then(response => {
               if(response.data.code === 1){
                 this.onRemind('保存信息成功')
+                setTimeout(() => {
+                  this.$router.push(`/mobile/center/vendor/outOfStorage?providerType=person&handleItem=2&type=${this.$route.query.type}`)
+                }, 1000)
+              } else {
+                this.onRemind('保存信息失败')
               }
+            }).catch(err => {
+              this.onRemind('保存信息失败')
             })
         }
       }