chenrui 4 yıl önce
ebeveyn
işleme
630b688df8

+ 9 - 0
src/api/stockFlow.js

@@ -11,3 +11,12 @@ export const stockFlowList = (params) => {
     method: 'post'
   })
 }
+
+//  库存流水(出入库明细)  合计
+export const stockFlowCount = (params) => {
+  return axios({
+    url: '/stockFlow/queryPageCount',
+    data: params,
+    method: 'post'
+  })
+}

+ 6 - 16
src/views/inventoryManagement/inventoryQuery/warehouseDetail.vue

@@ -72,7 +72,7 @@
       </div>
       <!-- 合计 -->
       <a-alert type="info" showIcon style="margin-bottom:15px">
-        <div class="ftext" slot="message">当前库存总数量(个):<strong>{{ productTotal.stockQty }}</strong>;当前库存总成本(¥):<strong>{{ productTotal.stockCost }}</strong>。</div>
+        <div class="ftext" slot="message">当前库存总数量(个):<strong>{{ (productTotal&&productTotal.totalQty) ? productTotal.totalQty : 0 }}</strong>;当前库存总成本(¥):<strong>{{ (productTotal&&productTotal.totalCost) ? productTotal.totalCost : 0 }}</strong>。</div>
       </a-alert>
       <!-- 列表 -->
       <s-table
@@ -99,8 +99,7 @@
 <script>
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
-import { stockFlowList } from '@/api/stockFlow'
-import { stockByProductSn } from '@/api/stock'
+import { stockFlowList, stockFlowCount } from '@/api/stockFlow'
 import { warehouseAllList } from '@/api/warehouse'
 export default {
   components: { STable, VSelect },
@@ -161,10 +160,7 @@ export default {
         })
       },
       warehouseList: [], //  仓库  下拉数据
-      productTotal: {
-        stockQty: 0,
-        stockCost: 0
-      } //  合计
+      productTotal: null //  合计
     }
   },
   methods: {
@@ -174,17 +170,11 @@ export default {
     },
     // 合计
     getTotal (param) {
-      stockByProductSn(param).then(res => {
+      stockFlowCount(param).then(res => {
         if (res.status == 200 && res.data) {
-          this.productTotal = {
-            stockQty: (Number(res.data.currentStockQty) + Number(res.data.freezeQty)) || 0,
-            stockCost: (Number(res.data.currentStockCost) + Number(res.data.freezeCost)) || 0
-          }
+          this.productTotal = res.data
         } else {
-          this.productTotal = {
-            stockQty: 0,
-            stockCost: 0
-          }
+          this.productTotal = null
         }
       })
     },