소스 검색

bug修复

chenrui 4 년 전
부모
커밋
edbdddcb0e
2개의 변경된 파일13개의 추가작업 그리고 16개의 파일을 삭제
  1. 1 1
      src/views/inventoryManagement/inventoryQuery/detailModal.vue
  2. 12 15
      src/views/inventoryManagement/inventoryQuery/list.vue

+ 1 - 1
src/views/inventoryManagement/inventoryQuery/detailModal.vue

@@ -97,7 +97,7 @@ export default {
     stockCost () { //  库存总成本 合计
       const currentStockCost = Number(this.currentStock.currentStockCost) || 0
       const freezeStockCost = Number(this.currentStock.freezeStockCost) || 0
-      return currentStockCost + freezeStockCost
+      return (currentStockCost * 100 + freezeStockCost * 100) / 100
     }
   },
   methods: {

+ 12 - 15
src/views/inventoryManagement/inventoryQuery/list.vue

@@ -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
         }
       })
     },