Transaction result as component

This commit is contained in:
Moriz Wahl 2021-05-12 02:32:35 +02:00
parent b6aaa69bea
commit 897c185ba6
3 changed files with 50 additions and 34 deletions

View File

@ -14,51 +14,25 @@
@send-transaction="sendTransaction"
@on-reset="onReset"
></transaction-confirmation>
<b-row v-show="row_thx">
<b-col>
<b-card class="p-0 p-md-3" style="background-color: #ebebeba3 !important">
<div class="display-2 p-4">
{{ $t('form.thx') }}
<hr />
{{ $t('form.send_transaction_success') }}
</div>
<p class="text-center">
<b-button variant="success" @click="onReset">{{ $t('form.close') }}</b-button>
</p>
</b-card>
</b-col>
</b-row>
<b-row v-show="row_error">
<b-col>
<b-card class="p-0 p-md-3" style="background-color: #ebebeba3 !important">
<div class="display-2 p-4">
{{ $t('form.sorry') }}
<hr />
{{ $t('form.send_transaction_error') }}
</div>
<p class="text-center">
<b-button variant="success" @click="onReset">{{ $t('form.close') }}</b-button>
</p>
</b-card>
</b-col>
</b-row>
<transaction-result
v-if="row_thx || row_error"
:error="error"
@on-reset="onReset"
></transaction-result>
</div>
</template>
<script>
// import { QrcodeDropZone } from 'vue-qrcode-reader'
import TransactionForm from './GddSend/TransactionForm.vue'
import TransactionConfirmation from './GddSend/TransactionConfirmation.vue'
import TransactionResult from './GddSend/TransactionResult.vue'
import communityAPI from '../../../apis/communityAPI.js'
export default {
name: 'GddSend',
components: {
// QrcodeDropZone,
TransactionForm,
TransactionConfirmation,
// QrCode,
TransactionResult,
},
props: {
balance: { type: Number, default: 0 },
@ -72,7 +46,7 @@ export default {
target_date: '',
memo: '',
},
send: false,
error: false,
row_check: false,
row_thx: false,
row_error: false,
@ -98,12 +72,14 @@ export default {
this.row_check = false
this.row_thx = true
this.row_error = false
this.error = false
this.$emit('update-balance', { ammount: this.transactionData.amount })
} else {
this.$emit('toggle-show-list', true)
this.row_check = false
this.row_thx = false
this.row_error = true
this.error = true
}
},
onReset() {

View File

@ -125,6 +125,7 @@
</template>
<script>
// import QrCode from './QrCode'
// import { QrcodeDropZone } from 'vue-qrcode-reader'
import { BIcon } from 'bootstrap-vue'
export default {
@ -132,6 +133,7 @@ export default {
components: {
BIcon,
// QrCode,
// QrcodeDropZone,
},
props: {
balance: { type: Number, default: 0 },

View File

@ -0,0 +1,38 @@
<template>
<b-row v-if="!error">
<b-col>
<b-card class="p-0 p-md-3" style="background-color: #ebebeba3 !important">
<div class="display-2 p-4">
{{ $t('form.thx') }}
<hr />
{{ $t('form.send_transaction_success') }}
</div>
<p class="text-center">
<b-button variant="success" @click="$emit('on-reset')">{{ $t('form.close') }}</b-button>
</p>
</b-card>
</b-col>
</b-row>
<b-row v-else>
<b-col>
<b-card class="p-0 p-md-3" style="background-color: #ebebeba3 !important">
<div class="display-2 p-4">
{{ $t('form.sorry') }}
<hr />
{{ $t('form.send_transaction_error') }}
</div>
<p class="text-center">
<b-button variant="success" @click="$emit('on-reset')">{{ $t('form.close') }}</b-button>
</p>
</b-card>
</b-col>
</b-row>
</template>
<script>
export default {
name: 'TransactionResult',
props: {
error: { type: Boolean, default: true },
},
}
</script>