Browse Source

fixed #30

ali 3 years ago
parent
commit
49e4e2b8c1
2 changed files with 35 additions and 1 deletions
  1. 2 1
      src/components/Widgets/Payment/PaymentList/PaymentList.vue
  2. 33 0
      src/models/Payment.js

+ 2 - 1
src/components/Widgets/Payment/PaymentList/PaymentList.vue

@@ -44,6 +44,7 @@
 import { shallowRef } from 'vue'
 import Assist from 'assets/js/Assist.js'
 import { EntityIndex } from 'quasar-crud'
+import { Payment } from 'src/models/Payment.js'
 import { Invoice } from 'src/models/Invoice.js'
 import { mixinWidget } from 'src/mixin/Mixins.js'
 import { APIGateway } from 'src/api/APIGateway.js'
@@ -106,7 +107,7 @@ export default {
             required: true,
             label: 'نوع تراکنش',
             align: 'left',
-            field: row => (row.type === 'WITHDRAW') ? 'برداشت' : 'واریز'
+            field: row => (new Payment(row)).type_info.label
           },
           {
             name: 'invoice_info.status',

+ 33 - 0
src/models/Payment.js

@@ -35,6 +35,39 @@ class Payment extends Model {
       { key: 'is_active' },
       { key: 'is_deleted' }
     ])
+
+    this.typeEnums = [
+      {
+        label: 'برداشت',
+        value: 'WITHDRAW'
+      },
+      {
+        label: 'درخواست برداشت',
+        value: 'WITHDRAW_REQUEST'
+      },
+      {
+        label: 'برداشت رد شده',
+        value: 'WITHDRAW_REJECT'
+      },
+      {
+        label: 'واریز',
+        value: 'DEPOSIT'
+      }
+    ]
+
+    this.loadTypeInfo()
+  }
+
+  loadTypeInfo () {
+    const target = this.typeEnums.find(type => type.value === this.type)
+    if (!target) {
+      this.type_info = {
+        label: null,
+        value: null
+      }
+    } else {
+      this.type_info = target
+    }
   }
 }