|
@@ -94,6 +94,9 @@
|
|
|
{{ (record.currentStockQty + record.freezeQty) || 0 }}
|
|
|
<span v-if="record.freezeQty">(冻结{{ record.freezeQty }})</span>
|
|
|
</template>
|
|
|
+ <template slot="currentStockCost" slot-scope="text, record">
|
|
|
+ {{ (Number(record.currentStockCost) + Number(record.freezeCost)) || 0 }}
|
|
|
+ </template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<a-button size="small" type="link" class="button-success" @click="goDetail(record)" id="inventoryQueryList-detail-btn">库存详情</a-button>
|
|
@@ -145,7 +148,7 @@ export default {
|
|
|
{ title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '产品品牌', dataIndex: 'productBrandName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '库存数量(个)', dataIndex: 'currentStockQty', scopedSlots: { customRender: 'currentStockQty' }, width: 165, align: 'center', sorter: true },
|
|
|
- { title: '库存成本(¥)', dataIndex: 'currentStockCost', width: 165, align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '库存成本(¥)', dataIndex: 'currentStockCost', scopedSlots: { customRender: 'currentStockCost' }, width: 165, align: 'center', sorter: true },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
@@ -185,22 +188,19 @@ export default {
|
|
|
},
|
|
|
openModal: false, // 查看库存详情 弹框
|
|
|
itemId: '', // 当前库存记录id
|
|
|
- currentStock: { // 合计信息
|
|
|
- currentStockQty: '',
|
|
|
- currentStockCost: ''
|
|
|
- }
|
|
|
+ currentStock: null
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
stockQty () { // 库存总数量 合计
|
|
|
- const currentStockQty = Number(this.currentStock.currentStockQty) || 0
|
|
|
- const freezeStockQty = Number(this.currentStock.freezeStockQty) || 0
|
|
|
- return currentStockQty + freezeStockQty
|
|
|
+ const currentStockQty = this.currentStock && this.currentStock.currentStockQty ? Number(this.currentStock.currentStockQty) : 0
|
|
|
+ const freezeQty = this.currentStock && this.currentStock.freezeQty ? Number(this.currentStock.freezeQty) : 0
|
|
|
+ return currentStockQty + freezeQty
|
|
|
},
|
|
|
stockCost () { // 库存总成本 合计
|
|
|
- const currentStockCost = Number(this.currentStock.currentStockCost) || 0
|
|
|
- const freezeStockCost = Number(this.currentStock.freezeStockCost) || 0
|
|
|
- return currentStockCost + freezeStockCost
|
|
|
+ const currentStockCost = this.currentStock && this.currentStock.currentStockCost ? Number(this.currentStock.currentStockCost) : 0
|
|
|
+ const freezeCost = this.currentStock && this.currentStock.freezeCost ? Number(this.currentStock.freezeCost) : 0
|
|
|
+ return (currentStockCost * 100 + freezeCost * 100) / 100
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -223,10 +223,7 @@ export default {
|
|
|
if (res.status == 200 && res.data) {
|
|
|
this.currentStock = res.data
|
|
|
} else {
|
|
|
- this.currentStock = { // 合计信息
|
|
|
- currentStockQty: '',
|
|
|
- currentStockCost: ''
|
|
|
- }
|
|
|
+ this.currentStock = null
|
|
|
}
|
|
|
})
|
|
|
},
|