Browse Source

处理出入库

wangcz 7 years ago
parent
commit
7fb39ea382

+ 7 - 3
components/mobile/center/outOfStorage/otherStorage.vue

@@ -17,13 +17,15 @@
         <span class="super"><em v-text="index + 1">1</em></span>
         <span class="super"><em v-text="index + 1">1</em></span>
         <div class="linetext width50 fl">型号:
         <div class="linetext width50 fl">型号:
           <span>
           <span>
-            <input type="text" style="width:2rem;" v-model="item.cmpCode" @input="onCodeChange(index)" placeholder="">
+            <input type="text" style="width:2rem;" v-model="item.cmpCode" @input="onCodeChange(index)">
           </span>
           </span>
         </div>
         </div>
         <div class="linetext width50 fl">品牌: <span v-text="item.brand">21324</span></div>
         <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.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.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"></span></div>
+        <div class="linetext width50 fl"><em>*</em>{{switchType === 'INBOUND' ? '入库数' : '出库数'}}(PCS): <span>
+          <input type="text" style="width:1rem;" v-model.number="item.qty">
+        </span></div>
         <div class="linetext width50 fl">单价(¥):<span><input type="text" style="width:2rem;" v-model.number="item.price"></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">
         <div class="content-line" v-show="item.showSimilarCodeList && item.cmpCode">
           <ul class="similar">
           <ul class="similar">
@@ -76,7 +78,9 @@
       let _this = this
       let _this = this
       this.allObj.push(this.storageObj)
       this.allObj.push(this.storageObj)
       document.body.onclick = function() {
       document.body.onclick = function() {
-        _this.showSimilarCodeList = false
+        _this.allObj.forEach(val => {
+          val.showSimilarCodeList = false
+        })
       }
       }
     },
     },
     methods: {
     methods: {

+ 2 - 1
nuxt.config.js

@@ -1,7 +1,7 @@
 const path = require('path')
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
 // b2c后台
 // b2c后台
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://192.168.253.3:36002/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://10.1.51.88:8080/')
 // 公共询价
 // 公共询价
 const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
 const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
 // 公共物料
 // 公共物料
@@ -161,6 +161,7 @@ module.exports = {
     '/static/**': baseUrl,
     '/static/**': baseUrl,
     '/vendor**': baseUrl,
     '/vendor**': baseUrl,
     '/trade/**': baseUrl,
     '/trade/**': baseUrl,
+    '/CommodityInOutbound/**': baseUrl,
     '/recommendation/**': baseUrl,
     '/recommendation/**': baseUrl,
     '/store-service/**': baseUrl,
     '/store-service/**': baseUrl,
     '/basic/**': baseUrl,
     '/basic/**': baseUrl,

+ 109 - 21
pages/mobile/center/vendor/outOfStorage/purchase/_storeid.vue

@@ -12,11 +12,23 @@
           <span class="clear" @click="saveClick('clear')">取消</span>
           <span class="clear" @click="saveClick('clear')">取消</span>
         </div>
         </div>
         <div class="storage-info">
         <div class="storage-info">
+          <div class="logistics-line" v-show="showLogistics && logisticsCode.content">
+            <ul class="similar">
+              <li v-for="sCode in logisticsCode.content" @click.stop="setCode(sCode, index)">
+                <span v-text="sCode.companyName"></span>
+              </li>
+              <li v-if="logisticsCode.content.length <= 0"><span>请去PC端物流管理维护物流信息</span></li>
+            </ul>
+          </div>
           <div class="linetext">{{storageList.type === 'INBOUND' ? '入库单' : '出库单'}}: <span>系统自动生成</span></div>
           <div class="linetext">{{storageList.type === 'INBOUND' ? '入库单' : '出库单'}}: <span>系统自动生成</span></div>
           <div class="linetext">{{storageList.type === 'INBOUND' ? '卖家名称' : '买家名称'}}: <span v-text="storageList.buyentername || storageList.buyername">21324</span></div>
           <div class="linetext">{{storageList.type === 'INBOUND' ? '卖家名称' : '买家名称'}}: <span v-text="storageList.buyentername || storageList.buyername">21324</span></div>
           <div class="linetext">所属订单: <span v-text="storageList.purchaseid || '-'">21324</span></div>
           <div class="linetext">所属订单: <span v-text="storageList.purchaseid || '-'">21324</span></div>
-          <div class="linetext" v-if="storageList.logistics">物流公司: <span v-text="storageList.logistics ? storageList.logistics.companyName : '-'">323425</span></div>
-          <div class="linetext" v-if="storageList.logistics">物流单号:<span v-text="storageList.logistics ? storageList.logistics.number : '-'">34254</span></div>
+          <div class="linetext"><em>*</em>物流公司:<span>
+            <input type="text" readonly v-model="allObj.logisticsInfo.companyName" @click.stop="showLogistics = !showLogistics">
+          </span></div>
+          <div class="linetext"><em>*</em>物流单号:<span>
+            <input type="text" v-model="allObj.logisticsInfo.number">
+          </span></div>
           <div class="linetext">录入人: <span v-text="storageList.sellername || '-'">21324</span></div>
           <div class="linetext">录入人: <span v-text="storageList.sellername || '-'">21324</span></div>
           <div class="linetext">录入时间: <span v-text="storageList.createtime ? baseUtils.formatDate(new Date(storageList.createtime), 'yyyy-MM-dd hh:mm:ss') : '-'">21324</span></div>
           <div class="linetext">录入时间: <span v-text="storageList.createtime ? baseUtils.formatDate(new Date(storageList.createtime), 'yyyy-MM-dd hh:mm:ss') : '-'">21324</span></div>
         </div>
         </div>
@@ -31,7 +43,7 @@
             <div class="linetext width50 fl">已出库(PCS): <span v-text="item.shipQty || '-'">21324</span></div>
             <div class="linetext width50 fl">已出库(PCS): <span v-text="item.shipQty || '-'">21324</span></div>
             <div class="linetext width50 fl">{{storageList.type === 'INBOUND' ? '入库数' : '出库数'}}(PCS):
             <div class="linetext width50 fl">{{storageList.type === 'INBOUND' ? '入库数' : '出库数'}}(PCS):
               <span v-if="item.qty === item.number">-</span>
               <span v-if="item.qty === item.number">-</span>
-              <input style="width:1.2rem;" v-else type="text" v-model="item.qty">
+              <input style="width:1.2rem;" v-else type="text" v-model="item.qty" @blur="ChangeSendCount(item, item.qty)">
             </div>
             </div>
             <div class="linetext width50 fl">单价(¥): <span class="base-color" v-text="item.price || '-'">21324</span></div>
             <div class="linetext width50 fl">单价(¥): <span class="base-color" v-text="item.price || '-'">21324</span></div>
           </li>
           </li>
@@ -48,13 +60,20 @@
     layout: 'mobile',
     layout: 'mobile',
     fetch({route, store}) {
     fetch({route, store}) {
       return Promise.all([
       return Promise.all([
-        store.dispatch('product/getLoadPurchaseId', {id:route.params.storeid})
+        store.dispatch('product/getLoadPurchaseId', {id:route.params.storeid}),
+        store.dispatch('product/getLoadLogistics', {count:30, page: 1})
       ])
       ])
     },
     },
     data () {
     data () {
       return {
       return {
         remindText: '',
         remindText: '',
-        timeoutCount: 0
+        timeoutCount: 0,
+        storageList: {},
+        showLogistics: false,
+        allObj:{
+          logisticsInfo: {},
+          map: []
+        }
       }
       }
     },
     },
     components: {
     components: {
@@ -62,10 +81,19 @@
       PullUp,
       PullUp,
       EmptyStatus
       EmptyStatus
     },
     },
+    mounted () {
+      console.log(this.$store.state.product.storage.detail.data)
+      let data = this.$store.state.product.storage.detail.data
+      this.storageList = data ? JSON.parse(JSON.stringify(this.$store.state.product.storage.detail.data)) : {}
+      let _this = this
+      document.body.onclick = function() {
+        _this.showLogistics = false
+      }
+    },
     computed: {
     computed: {
-      storageList () {
-        console.log(this.$store.state.product.storage.detail.data)
-        return this.$store.state.product.storage.detail.data
+      logisticsCode () {
+        console.log('logistics', this.$store.state.product.storage.logistics.data)
+        return this.$store.state.product.storage.logistics.data
       }
       }
     },
     },
     methods: {
     methods: {
@@ -88,28 +116,42 @@
         }
         }
         return bound
         return bound
       },
       },
+      ChangeSendCount (type, val) {
+        let newShipQty = type.shipQty ? type.shipQty : 0
+        if (val > type.number - newShipQty) {
+          this.onRemind('本次发货数量不能大于已剩数量')
+          val = type.number - newShipQty
+        }
+        type.qty = val
+      },
       saveClick (type) {
       saveClick (type) {
         if(type === 'clear') {
         if(type === 'clear') {
           console.log('clear')
           console.log('clear')
           this.initData()
           this.initData()
         }else {
         }else {
-          if(!this.enName) {
-            this.onRemind('请输入' + this.switchType === 'INBOUND' ? '请输入卖家名称' : '请输入买家名称')
+          if(!this.allObj.logisticsInfo.companyName) {
+            this.onRemind('请先选择物流公司')
+          } else if(!this.allObj.logisticsInfo.number) {
+              this.onRemind('请先选择物流公司')
           } else {
           } else {
             let arr = []
             let arr = []
-            this.allObj.forEach(val => {
-              if(!val.price && !val.qty && !val.productId) {
-                this.onRemind('请将数据补充完整')
-                return
+            this.storageList.purchaseDetails.forEach(val => {
+              if(val.qty) {
+                arr.push({id: val.id, qty: val.qty})
               }
               }
-              arr.push({price: val.price, productId: val.productId, qty:val.qty})
             })
             })
-            this.$http.post(`/CommodityInOutbound/${this.switchType === 'INBOUND'? 'inBound': 'outBound'}/other?enName=${this.enName}`, arr)
-              .then(response => {
-                if(response.data.code === 1){
-                  this.onRemind('保存信息成功')
-                }
-              })
+            if(arr.length <= 0) {
+              this.onRemind('最少填写一个发货数量')
+            } else {
+              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('保存信息成功')
+                  }
+                })
+            }
           }
           }
         }
         }
       }
       }
@@ -119,6 +161,7 @@
 <style lang="scss" scoped>
 <style lang="scss" scoped>
   $base-color: #3f84f6;
   $base-color: #3f84f6;
   $title-color: #ffa200;
   $title-color: #ffa200;
+  $red-color: #ff0000;
   #mobile-storage-center {
   #mobile-storage-center {
     padding-bottom: .5rem;
     padding-bottom: .5rem;
     margin: 0 auto;
     margin: 0 auto;
@@ -151,9 +194,51 @@
       }
       }
     }
     }
     .storage-info{
     .storage-info{
+      position:relative;
       padding: 0.24rem 0.24rem;
       padding: 0.24rem 0.24rem;
       background: #fff;
       background: #fff;
       margin-bottom:.2rem;
       margin-bottom:.2rem;
+      .logistics-line{
+        position:absolute;
+        top:2rem;
+        left:2rem;
+        z-index:100;
+        background: #fff;
+        input[type='text'] {
+          width: 3.59rem;
+          height: .56rem;
+          font-size: .24rem;
+          border-radius: .04rem;
+          border: 1px solid #d2d2d2;
+          padding: 0 .2rem;
+        }
+        input[readonly] {
+          background: url('/images/mobile/select-arrow.png') no-repeat;
+          background-size: .24rem .15rem;
+          background-position: 3.1rem .2rem;
+        }
+        .similar {
+          position: absolute;
+          left: 2.5rem;
+          border: 1px solid $base-color;
+          border-radius: .04rem;
+          top: .56rem;
+          width: 3.59rem;
+          background: #fff;
+          z-index: 1;
+          max-height: 3.96rem;
+          overflow-y: auto;
+          li {
+            height: .66rem;
+            line-height: .66rem;
+            padding: 0 .19rem;
+            font-size: .24rem;
+            &:active, &:focus {
+              background: #f7f7f7;
+            }
+          }
+        }
+      }
     }
     }
     .linetext{
     .linetext{
       color:#666;
       color:#666;
@@ -162,6 +247,9 @@
       -o-text-overflow: ellipsis;
       -o-text-overflow: ellipsis;
       text-overflow: ellipsis;
       text-overflow: ellipsis;
       white-space: nowrap;
       white-space: nowrap;
+      em{
+        color:$red-color;
+      }
       input{
       input{
         height: .5rem;
         height: .5rem;
         font-size: .24rem;
         font-size: .24rem;

+ 10 - 0
store/product.js

@@ -269,5 +269,15 @@ export const actions = {
       }, err => {
       }, err => {
         commit('storage/GET_DETAIL_FAILURE', err)
         commit('storage/GET_DETAIL_FAILURE', err)
       })
       })
+  },
+  // 获取出入库单条记录数据
+  getLoadLogistics({commit}, params = {}) {
+    commit('storage/REQUEST_LOGISTICS')
+    return axios.get('/kdn/logistics/page', { params })
+      .then(res => {
+        commit('storage/GET_LOGISTICS_SUCCESS', res.data)
+      }, err => {
+        commit('storage/GET_LOGISTICS_FAILURE', err)
+      })
   }
   }
 }
 }

+ 14 - 0
store/product/storage.js

@@ -6,6 +6,10 @@ export const state = () => ({
   detail: {
   detail: {
     fetching: false,
     fetching: false,
     data:[]
     data:[]
+  },
+  logistics: {
+    fetching: false,
+    data: []
   }
   }
 })
 })
 
 
@@ -29,5 +33,15 @@ export const mutations = {
   },
   },
   GET_DETAIL_FAILURE(state) {
   GET_DETAIL_FAILURE(state) {
     state.detail.fetching = false
     state.detail.fetching = false
+  },
+  REQUEST_LOGISTICS (state) {
+    state.logistics.fetching = true
+  },
+  GET_LOGISTICS_SUCCESS(state, result) {
+    state.logistics.data = result
+    state.logistics.fetching = false
+  },
+  GET_LOGISTICS_FAILURE(state) {
+    state.logistics.fetching = false
   }
   }
 }
 }