Browse Source

处理出入库

wangcz 7 years ago
parent
commit
38ac827db9

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

@@ -14,11 +14,11 @@
       <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 v-text="item.buyentername || item.buyername || '-'">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>
         <div class="look-btn">
-          <span @click="loadAllInfo(item.purchaseid, 1)" v-text="switchType === 'INBOUND' ? '收货入库' : '发货出库'"></span>
+          <span @click="loadAllInfo(item, 1)" v-text="switchType === 'INBOUND' ? '收货入库' : '发货出库'"></span>
         </div>
       </li>
     </ul>
@@ -60,7 +60,11 @@
         if(i === 0) {
           this.$router.push('/mobile/center/vendor/outOfStorage/' + type)
         } else if(i === 1){
-          this.$router.push('/mobile/center/vendor/outOfStorage/purchase/' + this.baseUtils.enidfilter(type))
+          if(this.switchType === 'INBOUND') {
+            this.$router.push(`/mobile/center/vendor/outOfStorage/purchase/${type.id}?type=INBOUND`)
+          } else {
+            this.$router.push(`/mobile/center/vendor/outOfStorage/purchase/${this.baseUtils.enidfilter(type.purchaseid)}?type=OUTBOUND`)
+          }
         }
       }
     }

+ 1 - 2
components/mobile/center/outOfStorage/otherStorage.vue

@@ -106,7 +106,7 @@
       initData () {
         this.enName = ''
         this.allObj = []
-        this.allObj.push(this.storageList)
+        this.allObj.push(this.storageObj)
       },
       onCodeChange (type) {
         this.allObj[type].showSimilarCodeList = true
@@ -158,7 +158,6 @@
       },
       saveClick (type) {
         if(type === 'clear') {
-          console.log('clear')
           this.initData()
         }else {
           if(!this.enName) {

+ 0 - 1
pages/mobile/center/vendor/outOfStorage/_id.vue

@@ -56,7 +56,6 @@
     },
     computed: {
       storageList () {
-        console.log(this.$store.state.product.storage.detail.data)
         return this.$store.state.product.storage.detail.data
       }
     },

+ 48 - 7
pages/mobile/center/vendor/outOfStorage/index.vue

@@ -58,7 +58,7 @@
         remindText: '',
         timeoutCount: 0,
         switchType: 'INBOUND',
-        handleItem:0,
+        handleItem: 0,
         filterOptions: [
           {
             title: '交易时间',
@@ -79,7 +79,7 @@
             defaultVal: 1
           }
         ],
-        page: 0,
+        page: 1,
         isChange: false,
         storageList: [],
         filterParams:{
@@ -101,10 +101,44 @@
       OtherStorage
     },
     created () {
+      this.switchType = this.$route.query.type ? this.$route.query.type : 'INBOUND'
+      this.handleItem = this.$route.query.handleItem ? Number(this.$route.query.handleItem) : 0
       let currentTime = this.baseUtils.getClearDay(new Date())
       let fromDate = currentTime - 29 * 24 * 60 * 60 * 1000
       let toDate = currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000
-      this.$store.dispatch('product/getLoadStorageData', {count: 10, page: 1, fromDate: fromDate, toDate: toDate, type: 'INBOUND'})
+      if(this.handleItem === 0) {
+        this.$store.dispatch('product/getLoadStorageData', {
+          count: 10,
+          page: 1,
+          fromDate: fromDate,
+          toDate: toDate,
+          type: this.switchType
+        })
+      } else if(this.handleItem === 2) {
+        if(this.switchType === 'INBOUND') {
+          this.filterParams.type = null
+          this.$store.dispatch('product/getLoadEnterpriseData', {
+            count: 10,
+            page: 1,
+            fromDate: fromDate,
+            toDate: toDate
+          })
+        } else if(this.switchType === 'OUTBOUND'){
+          this.$store.dispatch('product/getLoadPurchaseData', {
+            count: 10,
+            page: 1,
+            startMils: fromDate,
+            endMils: toDate,
+            type: this.switchType,
+            sorting: {"createtime":"DESC"},
+            status: '502-406'
+          })
+        } else {
+          this.$router.push('/mobile/center/vendor/outOfStorage?providerType=person')
+        }
+      } else {
+        this.$router.push('/mobile/center/vendor/outOfStorage?providerType=person')
+      }
     },
     watch: {
       'storageData': {
@@ -140,14 +174,16 @@
         this.timeoutCount++
       },
       onPullUpAction () {
-        this.filterParams.page++
-        this.filter.page++
+        this.page++
+        this.filterParams.page = this.page
+        this.filter.page = this.page
         this.reloadList()
       },
       setSwitchType (type) {
         if(type !== this.switchType) {
           this.switchType = type
           this.filterParams.type = type
+          this.page = 1
           this.filterParams.page = 1
           this.filter.page = 1
           this.isChange = true
@@ -160,6 +196,7 @@
           if(type !== 1) {
             this.filterParams.page = 1
             this.filter.page = 1
+            this.page = 1
             this.isChange = true
             this.reloadList()
           }
@@ -189,7 +226,6 @@
           keyword: '',
           fromDate: '',
           toDate: '',
-          currencyName: '',
           type: ''
         },
           this.filter = {
@@ -212,7 +248,12 @@
         if(this.handleItem === 0) {
           this.$store.dispatch('product/getLoadStorageData', this.filterParams)
         } else if(this.handleItem === 2) {
-          this.$store.dispatch('product/getLoadPurchaseData', this.filter)
+          if(this.switchType === 'INBOUND') {
+            this.filterParams.type = null
+            this.$store.dispatch('product/getLoadEnterpriseData', this.filterParams)
+          } else {
+            this.$store.dispatch('product/getLoadPurchaseData', this.filter)
+          }
         }
       },
     }

+ 68 - 43
pages/mobile/center/vendor/outOfStorage/purchase/_storeid.vue

@@ -2,32 +2,58 @@
   <div class="storage">
     <div class="com-mobile-header mobile-center-header">
       <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
-      <p v-text="storageList.type === 'INBOUND' ? '采购入库' : '销售出库'"></p>
+      <p v-text="switchType === 'INBOUND' ? '采购入库' : '销售出库'"></p>
       <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
     </div>
     <div class="mobile-fix-content mobile-centerfix-content" id="mobile-storage-center">
-      <div class="storage-record">
+      <div class="storage-record" v-if="switchType === 'INBOUND'">
         <div class="btn-click">
-          <span class="base-color" @click="saveClick()">保存</span>
+          <span class="base-color" @click="saveClick('INBOUND')">保存</span>
+          <span class="clear" @click="saveClick('clear')">取消</span>
+        </div>
+        <div class="storage-info">
+          <div class="linetext">入库单: <span>系统自动生成</span></div>
+          <div class="linetext">卖家名称: <span v-text="storageList.buyentername || storageList.buyername">21324</span></div>
+          <div class="linetext">所属订单: <span v-text="storageList.purchaseid || '-'">21324</span></div>
+          <div class="linetext" v-if="allObj.logistics">物流公司:<span v-text="allObj.logistics.companyName"></span></div>
+          <div class="linetext" v-if="allObj.logistics">物流单号:<span v-text="allObj.logistics.number"></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>
+        <ul class="list-unstyled" v-if="storageList.invoiceDetails" style="margin-bottom:.8rem;">
+          <li class="info-list clearfix" v-for="(item, index) in storageList.invoiceDetails">
+            <span class="super"><em v-text="index + 1">1</em></span>
+            <div class="linetext width50 fl">型号: <span v-text="item.cmpCode || '-'">21324</span></div>
+            <div class="linetext width50 fl">品牌: <span v-text="item.brandNameEn || '-'">21324</span></div>
+            <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>
+          </li>
+        </ul>
+      </div>
+      <div class="storage-record" v-if="switchType === 'OUTBOUND'">
+        <div class="btn-click">
+          <span class="base-color" @click="saveClick('OUTBOUND')">保存</span>
           <span class="clear" @click="saveClick('clear')">取消</span>
         </div>
         <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)">
+              <li v-for="sCode in logisticsCode.content" @click.stop="setLogisticsCode(sCode.companyName)">
                 <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 v-text="storageList.buyentername || storageList.buyername">21324</span></div>
+          <div class="linetext">出库单: <span>系统自动生成</span></div>
+          <div class="linetext">买家名称: <span v-text="storageList.buyentername || storageList.buyername">21324</span></div>
           <div class="linetext">所属订单: <span v-text="storageList.purchaseid || '-'">21324</span></div>
           <div class="linetext"><em>*</em>物流公司:<span>
-            <input type="text" readonly v-model="allObj.logisticsInfo.companyName" @click.stop="showLogistics = !showLogistics">
+            <input style="width:3rem;" type="text" readonly placeholder="请选择物流公司" 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">
+            <input style="width:3rem;" 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.createtime ? baseUtils.formatDate(new Date(storageList.createtime), 'yyyy-MM-dd hh:mm:ss') : '-'">21324</span></div>
@@ -41,7 +67,7 @@
             <div class="linetext width50 fl">规格: <span v-text="item.spec || '-'">21324</span></div>
             <div class="linetext width50 fl">应出库(PCS): <span v-text="item.number || '-'">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">出库数(PCS):
               <span v-if="item.qty === item.number">-</span>
               <input style="width:1.2rem;" v-else type="text" v-model="item.qty" @blur="ChangeSendCount(item, item.qty)">
             </div>
@@ -59,7 +85,9 @@
     middleware: 'authenticated',
     layout: 'mobile',
     fetch({route, store}) {
-      return Promise.all([
+      return route.query.type === 'INBOUND' ? Promise.all([
+        store.dispatch('product/getLoadEnterpriseId', {id:route.params.storeid})
+      ]) : Promise.all([
         store.dispatch('product/getLoadPurchaseId', {id:route.params.storeid}),
         store.dispatch('product/getLoadLogistics', {count:30, page: 1})
       ])
@@ -68,6 +96,7 @@
       return {
         remindText: '',
         timeoutCount: 0,
+        switchType: this.$route.query.type,
         storageList: {},
         showLogistics: false,
         allObj:{
@@ -82,7 +111,6 @@
       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
@@ -92,7 +120,6 @@
     },
     computed: {
       logisticsCode () {
-        console.log('logistics', this.$store.state.product.storage.logistics.data)
         return this.$store.state.product.storage.logistics.data
       }
     },
@@ -124,15 +151,18 @@
         }
         type.qty = val
       },
+      setLogisticsCode (val) {
+        this.showLogistics = false
+        this.allObj.logisticsInfo.companyName = val
+      },
       saveClick (type) {
         if(type === 'clear') {
-          console.log('clear')
-          this.initData()
-        }else {
+          this.$router.push(`/mobile/center/vendor/outOfStorage?providerType=person&handleItem=2&type=${this.$route.query.type}`)
+        }else if(type === 'OUTBOUND'){
           if(!this.allObj.logisticsInfo.companyName) {
             this.onRemind('请先选择物流公司')
           } else if(!this.allObj.logisticsInfo.number) {
-              this.onRemind('请先选择物流公司')
+              this.onRemind('请填写物流单号')
           } else {
             let arr = []
             this.storageList.purchaseDetails.forEach(val => {
@@ -153,6 +183,13 @@
                 })
             }
           }
+        } else if(type === 'INBOUND') {
+          this.$http.put(`/trade/order/signReceive?_status=ensureaccept&invoiceId=${this.storageList.invoiceid}`)
+            .then(response => {
+              if(response.data.code === 1){
+                this.onRemind('保存信息成功')
+              }
+            })
         }
       }
     }
@@ -199,35 +236,17 @@
       background: #fff;
       margin-bottom:.2rem;
       .logistics-line{
-        position:absolute;
-        top:2rem;
-        left:2rem;
-        z-index:100;
+        position: absolute;
+        top: 2.6rem;
+        left: 1.75rem;
+        border: 1px solid $base-color;
+        border-radius: .04rem;
+        width: 3rem;
         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;
-        }
+        z-index: 1;
+        max-height: 3.96rem;
+        overflow-y: auto;
         .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;
@@ -257,6 +276,12 @@
         border: 1px solid #d2d2d2;
         padding: 0 .1rem;
       }
+      input[readonly] {
+        padding: 0 .2rem;
+        background: url('/images/mobile/select-arrow.png') no-repeat;
+        background-size: .24rem .15rem;
+        background-position: 2.6rem .2rem;
+      }
       span{
         color:#333;
         &.base-color{

+ 22 - 2
store/product.js

@@ -254,6 +254,26 @@ export const actions = {
         commit('storage/GET_DETAIL_FAILURE', err)
       })
   },
+  // 获取采购入库所有记录数据
+  getLoadEnterpriseData({commit}, params = {}) {
+    commit('storage/REQUEST_LIST')
+    return axios.get('/trade/invoice/enterprise/inbound', {params: params})
+      .then(res => {
+        commit('storage/GET_LIST_SUCCESS', res.data)
+      }, err => {
+        commit('storage/GET_LIST_FAILURE', err)
+      })
+  },
+  // 获取采购入库单条记录数据
+  getLoadEnterpriseId({commit}, params = {}) {
+    commit('storage/REQUEST_DETAIL')
+    return axios.get(`/trade/invoice/${params.id}/find`)
+      .then(res => {
+        commit('storage/GET_DETAIL_SUCCESS', res.data)
+      }, err => {
+        commit('storage/GET_DETAIL_FAILURE', err)
+      })
+  },
   // 获取销售出库所有记录数据
   getLoadPurchaseData({commit}, params = {}) {
     commit('storage/REQUEST_LIST')
@@ -264,7 +284,7 @@ export const actions = {
         commit('storage/GET_LIST_FAILURE', err)
       })
   },
-  // 获取出库单条记录数据
+  // 获取销售出库单条记录数据
   getLoadPurchaseId({commit}, params = {}) {
     commit('storage/REQUEST_DETAIL')
     return axios.get('/trade/purchase/purchaseId/' + params.id)
@@ -274,7 +294,7 @@ export const actions = {
         commit('storage/GET_DETAIL_FAILURE', err)
       })
   },
-  // 获取出入库单条记录数据
+  // 获取销售出库物流信息
   getLoadLogistics({commit}, params = {}) {
     commit('storage/REQUEST_LOGISTICS')
     return axios.get('/kdn/logistics/page', { params })