PaymentShow.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="PaymentShow"
  3. :style="localOptions.style">
  4. <div class="flex justify-end">
  5. <q-btn flat
  6. color="grey"
  7. @click="$router.go(-1)">
  8. بازگشت
  9. >
  10. </q-btn>
  11. </div>
  12. <entity-show v-if="mounted"
  13. ref="entityEdit"
  14. v-model:value="inputs"
  15. title="تراکنش کیف پول"
  16. :api="api"
  17. :entity-id-key="entityIdKey"
  18. :index-route-name="'UserPanel.Wallet'"
  19. :show-close-button="false"
  20. :show-edit-button="false"
  21. :show-expand-button="false"
  22. :show-save-button="false"
  23. :show-reload-button="false"
  24. :redirect-after-edit="false"
  25. :show-index-button="false"
  26. :after-load-input-data="afterLoadInputData">
  27. <template #after-form-builder>
  28. <q-btn v-if="payment.invoice_info?.id"
  29. class="full-width q-mt-md"
  30. color="primary"
  31. @click="showInvoice">
  32. مشاهده سفارش
  33. </q-btn>
  34. <div v-if="payment.description"
  35. class="q-my-md">
  36. توضیحات:
  37. <div v-html="payment.description" />
  38. </div>
  39. <div v-if="payment.receipt || payment.IBAN">
  40. <div class="row q-col-gutter-md q-mt-lg">
  41. <div class="col-md-6 col-12">
  42. رسید پرداخت:
  43. <div>
  44. <q-img :src="payment.receipt" />
  45. </div>
  46. </div>
  47. <div class="col-md-6 col-12">
  48. شماره شبا:
  49. {{ payment.IBAN }}
  50. </div>
  51. </div>
  52. </div>
  53. </template>
  54. </entity-show>
  55. </div>
  56. </template>
  57. <script>
  58. import { EntityShow } from 'quasar-crud'
  59. import { Payment } from 'src/models/Payment.js'
  60. import { mixinWidget } from 'src/mixin/Mixins.js'
  61. import { APIGateway } from 'src/api/APIGateway.js'
  62. export default {
  63. name: 'PaymentShow',
  64. components: {
  65. EntityShow
  66. },
  67. mixins: [mixinWidget],
  68. data: () => {
  69. return {
  70. mounted: false,
  71. entityLoading: true,
  72. api: null,
  73. payment: new Payment(),
  74. entityIdKey: 'id',
  75. entityParamKey: 'id',
  76. showRouteName: 'Admin.Content.Show',
  77. indexRouteName: 'Admin.Content.List',
  78. inputs: [
  79. // { type: 'separator', name: 'space', label: 'مشخصات حساب', className: 'custom-separator', col: 'col-12' },
  80. { type: 'input', name: 'id', responseKey: 'id', label: 'شناسه', placeholder: ' ', col: 'col-md-2 col-12' },
  81. { type: 'dateTime', name: 'creation_time', responseKey: 'creation_time', outsideLabel: 'تاریخ ثبت', col: 'col-md-4 col-12' },
  82. {
  83. type: 'select',
  84. name: 'type',
  85. responseKey: 'type',
  86. label: 'نوع درخواست',
  87. options: (new Payment()).typeEnums,
  88. placeholder: ' ',
  89. col: 'col-md-3 col-12'
  90. },
  91. { type: 'input', name: 'amount', responseKey: 'amount', label: 'مبلغ کل(ریال)', placeholder: ' ', col: 'col-md-3 col-12' }
  92. // { type: 'input', name: 'IBAN', responseKey: 'IBAN', label: 'شماره شبا', placeholder: ' ', col: 'col-md-6 col-12' },
  93. // { type: 'input', name: 'receipt', responseKey: 'receipt', label: 'رسید پرداخت', placeholder: ' ', col: 'col-md-6 col-12' }
  94. ]
  95. }
  96. },
  97. created() {
  98. this.api = APIGateway.payment.APIAdresses.byId(this.$route.params.id)
  99. },
  100. mounted() {
  101. this.mounted = true
  102. },
  103. methods: {
  104. showInvoice () {
  105. const routeData = this.$router.resolve({ name: 'UserPanel.Invoice.Show', params: { id: this.payment.invoice_info.id } })
  106. window.open(routeData.href, '_blank')
  107. },
  108. setActionBtn () {
  109. this.inputs.forEach((item, index) => {
  110. if (item.name === 'btn') {
  111. this.inputs[index].atClick = this.edit
  112. }
  113. })
  114. },
  115. afterLoadInputData (data) {
  116. this.payment = new Payment(data)
  117. this.entityLoading = false
  118. },
  119. edit() {
  120. this.entityLoading = true
  121. this.$refs.entityEdit.editEntity(false)
  122. .then(() => {
  123. this.$refs.entityEdit.getData()
  124. this.entityLoading = false
  125. })
  126. .catch(() => {
  127. this.$refs.entityEdit.getData()
  128. this.entityLoading = false
  129. })
  130. }
  131. }
  132. }
  133. </script>
  134. <style scoped lang="scss">
  135. .PaymentShow {
  136. .title {
  137. font-style: normal;
  138. font-weight: 700;
  139. font-size: 24px;
  140. line-height: 140%;
  141. color: #424242;
  142. margin-bottom: 27px;
  143. display: flex;
  144. flex-flow: row;
  145. position: relative;
  146. .static-title {
  147. }
  148. .dynamic-title {
  149. }
  150. .back-action {
  151. position: absolute;
  152. right: 0;
  153. top: 0;
  154. }
  155. }
  156. :deep(.form) {
  157. padding: 24px;
  158. }
  159. }
  160. </style>