소스 검색

[FIX] handle null customer value on pos summary display

Gogs 7 년 전
부모
커밋
8fea638c25
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      src/components/SummaryDisplay.vue

+ 6 - 2
src/components/SummaryDisplay.vue

@@ -1,7 +1,7 @@
 <template lang="pug">
     .summary
         h2 {{ getTotal() }}
-        h3 {{ customer.name }}
+        //- h3 {{ customer.name }}
 </template>
 
 <script>
@@ -10,11 +10,15 @@
     export default {
         computed: mapGetters({
             total: 'getTotal',
-            customer: 'getSelectedCustomer'
+            customer: 'getSelectedCustomer',
+            hasSelectedCustomer: 'hasSelectedCustomer'
         }),
         methods: {
             getTotal() {
                 return accounting.formatMoney(this.total, '₲', 0, '.', ',')
+            },
+            getCustomer() {
+                return this.hasSelectedCustomer ? this.customer : {}
             }
         }