Browse Source

调回管理接口对接

zhangdan 3 years ago
parent
commit
2d1e45560d

+ 3 - 4
src/api/shelfRecall.js

@@ -53,11 +53,10 @@ export const shelfRecallStateCount = (params) => {
     method: 'post'
     method: 'post'
   })
   })
 }
 }
-// 删除仓位
-export const warehouseLocDel = params => {
+// 获取调回单详情
+export const shelfRecallDetail = params => {
   return axios({
   return axios({
-    url: `/warehouseLoc/delete/${params.id}`,
-    data: {},
+    url: `/shelfRecall/findBySn/${params.recallSn}`,
     method: 'get'
     method: 'get'
   })
   })
 }
 }

+ 59 - 45
src/views/numsGoodsShelves/recallManagement/list.vue

@@ -43,18 +43,9 @@
           </a-row>
           </a-row>
         </a-form>
         </a-form>
       </div>
       </div>
-      <a-tabs v-model="activeKey" type="card" size="small" @change="tabChange">
-        <a-tab-pane :key="0" tab="全部">
-        </a-tab-pane>
-        <a-tab-pane :key="1">
-          <span slot="tab">
-            待退库
-            <a-badge count="5" :offset="[0,-20]"/>
-          </span>
-        </a-tab-pane>
-        <a-tab-pane :key="2" tab="已完成">
-        </a-tab-pane>
-        <a-tab-pane :key="3" tab="已取消">
+      <a-tabs type="card" v-model="queryParam.billState" @change="tabChange" class="replenishmentManagementList-tabs ">
+        <a-tab-pane v-for="item in tabsList" :key="item.code">
+          <p slot="tab">{{ item.name }}<span v-if="item.countNum&&item.code=='WAIT_CONFIRM'" style="color:red">({{ item.countNum }})</span></p>
         </a-tab-pane>
         </a-tab-pane>
       </a-tabs>
       </a-tabs>
       <s-table
       <s-table
@@ -86,13 +77,14 @@
             id="shelfMonitoringList-warehousing-btn">取消调回单</a-button>
             id="shelfMonitoringList-warehousing-btn">取消调回单</a-button>
         </template>
         </template>
         <a-table
         <a-table
+          v-if="innerData&&innerData[index]"
           size="small"
           size="small"
           class="inner-table"
           class="inner-table"
-          slot-scope="record"
+          slot-scope="record,index"
           slot="expandedRowRender"
           slot="expandedRowRender"
           :rowKey="(rec) => rec.id"
           :rowKey="(rec) => rec.id"
           :columns="innerColumns"
           :columns="innerColumns"
-          :data-source="record.innerData"
+          :data-source="innerData[index].innerData"
           :pagination="false"
           :pagination="false"
         >
         >
         </a-table>
         </a-table>
@@ -111,7 +103,7 @@ import { STable } from '@/components'
 import recallModal from './recallModal.vue'
 import recallModal from './recallModal.vue'
 import getDate from '@/libs/getDate.js'
 import getDate from '@/libs/getDate.js'
 import shelfList from '@/views/common/shelfList.vue'
 import shelfList from '@/views/common/shelfList.vue'
-import { shelfRecallList, shelfRecallDetailList, shelfRecallCancel } from '@/api/shelfRecall.js'
+import { shelfRecallList, shelfRecallDetailList, shelfRecallCancel, shelfRecallStateCount } from '@/api/shelfRecall.js'
 export default {
 export default {
   components: { STable, recallModal, rangeDate, shelfList },
   components: { STable, recallModal, rangeDate, shelfList },
   mixins: [commonMixin],
   mixins: [commonMixin],
@@ -124,7 +116,7 @@ export default {
       advanced: false,
       advanced: false,
       currentData: null,
       currentData: null,
       activeKey: 0, // 默认的tab
       activeKey: 0, // 默认的tab
-      tabsList: [{ code: 0, name: '全部' }, { code: 1, name: '待退库' }, { code: 2, name: '已完成' }, { code: 3, name: '已取消' }],
+      tabsList: [],
       time: [
       time: [
         getDate.getCurrMonthDays().starttime,
         getDate.getCurrMonthDays().starttime,
         getDate.getCurrMonthDays().endtime
         getDate.getCurrMonthDays().endtime
@@ -133,31 +125,37 @@ export default {
         beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
         beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
         endDate: getDate.getCurrMonthDays().endtime, // 结束时间
         endDate: getDate.getCurrMonthDays().endtime, // 结束时间
         recallBillNo: '',
         recallBillNo: '',
-        shelfSn: '' // 数字货架sn
+        shelfSn: '', // 数字货架sn
+        billState: 'ALL'
       },
       },
       columns: [
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '创建时间', dataIndex: 'createDate', width: '15%', align: 'center' },
-        { title: '调回单号', dataIndex: 'recallBillNo', width: '20%', align: 'center' },
-        { title: '货架名称', dataIndex: 'remarks', width: '25%', align: 'left', scopedSlots: { customRender: 'remarks' } },
-        { title: '状态', dataIndex: 'state', width: '7%', align: 'center' },
-        { title: '调回总量', dataIndex: 'totalQty', width: '9%', align: 'center' },
-        { title: '实退总量', dataIndex: 'totalConfirmQty', width: '9%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调回单号', dataIndex: 'recallBillNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '货架名称', dataIndex: 'shelfInfo.shelfName', width: '25%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '状态', dataIndex: 'state', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调回总量', dataIndex: 'totalQty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '实退总量', dataIndex: 'totalConfirmQty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', width: '10%', align: 'left', scopedSlots: { customRender: 'action' } }
         { title: '操作', width: '10%', align: 'left', scopedSlots: { customRender: 'action' } }
       ],
       ],
       innerColumns: [
       innerColumns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center' },
-        { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'left' },
-        { title: '调回数量', dataIndex: 'qty', width: '15%', align: 'center' },
-        { title: '实退数量', dataIndex: 'confirmQty', width: '15%', align: 'center' },
-        { title: '单位', dataIndex: 'unit', width: '15%', align: 'center' }
+        { title: '产品编码', dataIndex: 'product.code', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '30%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '调回数量', dataIndex: 'qty', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '实退数量', dataIndex: 'confirmQty', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'product.unit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       ],
+      innerData: [],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.disabled = true
         this.disabled = true
         this.spinning = true
         this.spinning = true
-        return shelfRecallList(Object.assign(parameter, this.queryParam)).then(res => {
+        const params = this.queryParam
+        if (params.billState == 'ALL') {
+          params.billState = ''
+        }
+        return shelfRecallList(Object.assign(parameter, params)).then(res => {
           let data
           let data
           if (res.status == 200) {
           if (res.status == 200) {
             data = res.data
             data = res.data
@@ -166,6 +164,7 @@ export default {
               data.list[i].no = no + i + 1
               data.list[i].no = no + i + 1
               data.list[i].innerData = []
               data.list[i].innerData = []
             }
             }
+            this.innerData = data.list || []
             this.disabled = false
             this.disabled = false
           }
           }
           this.spinning = false
           this.spinning = false
@@ -176,8 +175,8 @@ export default {
   },
   },
   methods: {
   methods: {
     // 选择货架
     // 选择货架
-    shelfChange (data) {
-
+    shelfChange (obj) {
+      this.queryParam.shelfSn = obj.key || undefined
     },
     },
     // 时间改变
     // 时间改变
     dateChange (date) {
     dateChange (date) {
@@ -195,6 +194,21 @@ export default {
       this.queryParam.billState = key
       this.queryParam.billState = key
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
+    // 获取各类型下的数量
+    getSumByType () {
+      shelfRecallStateCount({}).then(res => {
+        if (res.status == 200) {
+          this.tabsList = [
+            { code: 'ALL', name: '全部', countNum: 0 }, { code: 'WAIT_CONFIRM', name: '待退库', countNum: 0 }, { code: 'FINISH', name: '已完成', countNum: 0 }, { code: 'CANCEL', name: '已取消', countNum: 0 }
+          ]
+          this.queryParam.billState = 'ALL'
+          this.tabsList[1].countNum = res.data.WAIT_CONFIRM || 0
+          this.tabsList[2].countNum = res.data.FINISH || 0
+          this.tabsList[3].countNum = res.data.CANCEL || 0
+          this.$refs.table.refresh()
+        }
+      })
+    },
     // 点击行或图标触发接口
     // 点击行或图标触发接口
     expand (expanded, record) {
     expand (expanded, record) {
       if (expanded) {
       if (expanded) {
@@ -204,34 +218,33 @@ export default {
     // 获取子表格数据
     // 获取子表格数据
     getinnerData (record) {
     getinnerData (record) {
       this.spinning = true
       this.spinning = true
-      shelfRecallDetailList({ shelfSn: record.shelfSn }).then(res => {
-        if (res.status == 200) {
-          record.innerData = res.data.data
-          const no = 0
-          for (var i = 0; i < this.innerData.length; i++) {
-            record.innerData[i].no = no + i + 1
+      shelfRecallDetailList({ recallBillSn: record.recallBillSn }).then(res => {
+        const ind = this.innerData.findIndex(item => item.id == record.id)
+        if (ind >= 0) {
+          if (res.status == 200 && res.data && res.data.length) {
+            res.data.map((item, index) => {
+              item.no = index + 1
+            })
+            this.innerData[ind].innerData = res.data
+          } else {
+            this.innerData[ind].innerData = []
           }
           }
-        } else {
-          record.innerData = []
         }
         }
         this.spinning = false
         this.spinning = false
       })
       })
     },
     },
     // 重置
     // 重置
     resetSearchForm () {
     resetSearchForm () {
-      this.time = [getDate.getCurrMonthDays().starttime, getDate.getCurrMonthDays().endtime]
+      this.$refs.rangeDate.resetDate(this.time)
       this.queryParam = {
       this.queryParam = {
         beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
         beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
         endDate: getDate.getCurrMonthDays().endtime, // 结束时间
         endDate: getDate.getCurrMonthDays().endtime, // 结束时间
         recallBillNo: '', // 调回单号
         recallBillNo: '', // 调回单号
-        shelfSn: '' // 数字货架sn
+        shelfSn: '', // 数字货架sn
+        billState: 'ALL'
       }
       }
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
-    // 申请提现
-    handleTX () {
-      this.showModal = true
-    },
     // 退库
     // 退库
     handleRecall (row) {
     handleRecall (row) {
       this.showModal = true
       this.showModal = true
@@ -267,6 +280,7 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
         _this.setTableH()
       })
       })
+      this.getSumByType()
     }
     }
   },
   },
   mounted () {
   mounted () {

+ 27 - 12
src/views/numsGoodsShelves/recallManagement/recallModal.vue

@@ -24,13 +24,13 @@
         :scroll="{ y:500 }"
         :scroll="{ y:500 }"
         :pagination="false"
         :pagination="false"
         bordered>
         bordered>
-        <template slot="thNum" slot-scope="text, record">
+        <template slot="confirmQty" slot-scope="text, record">
           <a-input-number
           <a-input-number
             id="inputNumber"
             id="inputNumber"
             v-model="record.confirmQty"
             v-model="record.confirmQty"
             :precision="0"
             :precision="0"
             :min="0"
             :min="0"
-            :max="record.dhNum"
+            :max="record.qty"
             placeholder="请输入"
             placeholder="请输入"
           />
           />
         </template>
         </template>
@@ -73,19 +73,18 @@ export default {
       spinning: false,
       spinning: false,
       rules: [],
       rules: [],
       columns: [
       columns: [
-        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center' },
-        { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'left' },
-        { title: '调回数量', dataIndex: 'qty', width: '10%', align: 'center' },
-        { title: '实际退库数量', width: '10%', align: 'center', scopedSlots: { customRender: 'thNum' } },
-        { title: '单位', dataIndex: 'danwei', width: '10%', align: 'center' }
+        { title: '产品编码', dataIndex: 'product.code', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '30%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '调回数量', dataIndex: 'qty', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '实退数量', width: '15%', align: 'center', scopedSlots: { customRender: 'confirmQty' } },
+        { title: '单位', dataIndex: 'product.unit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       ],
       list: []
       list: []
     }
     }
   },
   },
   computed: {
   computed: {
     title () {
     title () {
-      return '调回单退库' + ' —— ' + (this.currentData && this.currentData.createDate ? this.currentData.createDate : '')
+      return '调回单退库' + ' —— ' + (this.currentData && this.currentData.shelfInfo ? this.currentData.shelfInfo.shelfName : '')
     }
     }
   },
   },
 
 
@@ -98,9 +97,25 @@ export default {
         content: '调回产品将退回至经销商仓库,确认退库吗?',
         content: '调回产品将退回至经销商仓库,确认退库吗?',
         centered: true,
         centered: true,
         onOk () {
         onOk () {
-          _this.$emit('close')
+          // _this.$emit('close')
           _this.spinning = true
           _this.spinning = true
-          warehouseCascadeList({ recallBillSn: _this.currentData.recallBillSn }).then(res => {
+          const arr = []
+          _this.list.map((item, index) => {
+            if (item.confirmQty || item.confirmQty == 0) {
+              arr.push({
+                productSn: item.productSn,
+                confirmQty: item.confirmQty,
+                recallBillDetailSn: item.recallBillDetailSn
+              })
+            }
+          })
+          const params = {
+            shelfSn: _this.list[0].shelfSn,
+            recallBillSn: _this.list.recallBillSn,
+            recallBillNo: _this.list[0].recallBillNo,
+            detailList: arr
+          }
+          warehouseCascadeList(params).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$message.success(res.message)
               _this.spinning = false
               _this.spinning = false
@@ -117,7 +132,7 @@ export default {
       this.spinning = true
       this.spinning = true
       shelfRecallDetailList({ recallBillSn: this.currentData.recallBillSn }).then(res => {
       shelfRecallDetailList({ recallBillSn: this.currentData.recallBillSn }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
-          this.list = res.data.data
+          this.list = res.data
           const no = 0
           const no = 0
           for (var i = 0; i < this.list.length; i++) {
           for (var i = 0; i < this.list.length; i++) {
             this.list[i].no = no + i + 1
             this.list[i].no = no + i + 1