mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
trransactionlist object to array funtion
This commit is contained in:
commit
1231984057
@ -22,7 +22,7 @@ export const store = new Vuex.Store({
|
||||
session_id: '',
|
||||
email: '',
|
||||
amount: 0,
|
||||
target_date: '2021-02-19T13:25:36+00:00',
|
||||
target_date: '',
|
||||
memo: '',
|
||||
auto_sign: true,
|
||||
},
|
||||
@ -141,8 +141,17 @@ export const store = new Vuex.Store({
|
||||
},
|
||||
ajaxCreate: async ({ dispatch, state }) => {
|
||||
//console.log('action: ajaxCreate')
|
||||
|
||||
state.ajaxCreateData.amount = state.ajaxCreateData.amount * 10000
|
||||
const result = await communityAPI.create($cookies.get('gdd_session_id', email, amount, memo))
|
||||
|
||||
const result = await communityAPI.create(
|
||||
state.session_id,
|
||||
state.ajaxCreateData.email,
|
||||
state.ajaxCreateData.amount,
|
||||
state.ajaxCreateData.memo,
|
||||
)
|
||||
|
||||
return result
|
||||
//console.log(result)
|
||||
},
|
||||
ajaxListTransactions: async ({ commit, dispatch, state }) => {
|
||||
@ -157,8 +166,8 @@ export const store = new Vuex.Store({
|
||||
// commit('session_id', $cookies.get("gdd_session_id"))
|
||||
// commit('email', $cookies.get("gdd_u"))
|
||||
const result = await communityAPI.balance($cookies.get('gdd_session_id'))
|
||||
//console.log('accountBalance result', result)
|
||||
//console.log('aresult.result.data.balance', result.result.data.balance)
|
||||
//console.log("accountBalance result", result)
|
||||
//console.log("aresult.result.data.balance", result.result.data.balance)
|
||||
if (result.success) {
|
||||
commit('user_balance', result.result.data.balance)
|
||||
} else {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-row>
|
||||
<b-row v-show="row_form">
|
||||
<b-col xl="12" md="12">
|
||||
<b-alert variant="warning" show dismissible>
|
||||
<strong>Achtung!</strong>
|
||||
@ -17,9 +17,7 @@
|
||||
<img src="/img/icons/gradido/qr-scan-pure.png" height="50" @click="scan = true" />
|
||||
</b-col>
|
||||
<b-alert v-show="scan" show variant="warning">
|
||||
<span class="alert-text" @click="scan = false">
|
||||
<strong>schließen!</strong>
|
||||
</span>
|
||||
<span class="alert-text" @click="scan = false"><strong>schließen!</strong></span>
|
||||
</b-alert>
|
||||
<div v-if="scan">
|
||||
<!-- <b-row>
|
||||
@ -142,11 +140,51 @@
|
||||
</b-card>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row v-show="row_thx">
|
||||
<b-col>
|
||||
<div class="display-1 p-4">
|
||||
Danke
|
||||
<hr />
|
||||
Deine Zahlung wurde erfolgreich versendet.
|
||||
</div>
|
||||
|
||||
<b-button variant="success" @click="onReset">schließen</b-button>
|
||||
<hr />
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row v-show="row_check">
|
||||
<b-col>
|
||||
<div class="display-4 p-4">Bestätige deine Zahlung. Prüfe bitte nochmal alle Daten!</div>
|
||||
|
||||
<b-list-group>
|
||||
<b-list-group-item href="javascript:;" active>Meine Zahlung</b-list-group-item>
|
||||
<b-list-group-item class="d-flex justify-content-between align-items-center">
|
||||
{{ $store.state.ajaxCreateData.email }}
|
||||
<b-badge variant="primary" pill>Empfänger</b-badge>
|
||||
</b-list-group-item>
|
||||
|
||||
<b-list-group-item class="d-flex justify-content-between align-items-center">
|
||||
{{ $store.state.ajaxCreateData.amount }} GDD
|
||||
<b-badge variant="primary" pill>Betrag</b-badge>
|
||||
</b-list-group-item>
|
||||
|
||||
<b-list-group-item class="d-flex justify-content-between align-items-center">
|
||||
{{ $store.state.ajaxCreateData.memo }}
|
||||
<b-badge variant="primary" pill>Nachricht</b-badge>
|
||||
</b-list-group-item>
|
||||
<b-list-group-item class="d-flex justify-content-between align-items-center">
|
||||
{{ $moment($store.state.ajaxCreateData.target_date).format('DD.MM.YYYY - HH:mm:ss') }}
|
||||
<b-badge variant="primary" pill>Datum</b-badge>
|
||||
</b-list-group-item>
|
||||
</b-list-group>
|
||||
<b-button variant="success" @click="sendTransaction">jetzt versenden</b-button>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { QrcodeStream, QrcodeDropZone /*, QrcodeCapture*/ } from 'vue-qrcode-reader'
|
||||
import { QrcodeStream, QrcodeDropZone } from 'vue-qrcode-reader'
|
||||
import { BIcon } from 'bootstrap-vue'
|
||||
|
||||
export default {
|
||||
@ -154,7 +192,6 @@ export default {
|
||||
components: {
|
||||
QrcodeStream,
|
||||
QrcodeDropZone,
|
||||
// QrcodeCapture,
|
||||
BIcon,
|
||||
},
|
||||
data() {
|
||||
@ -167,57 +204,12 @@ export default {
|
||||
amount: '',
|
||||
memo: '',
|
||||
},
|
||||
sent: false,
|
||||
send: false,
|
||||
row_form: true,
|
||||
row_check: false,
|
||||
row_thx: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
sendbutton() {
|
||||
this.sent = true
|
||||
},
|
||||
async onDecode(decodedString) {
|
||||
//console.log('onDecode JSON.parse(decodedString)', JSON.parse(decodedString))
|
||||
const arr = JSON.parse(decodedString)
|
||||
//console.log('qr-email', arr[0].email)
|
||||
//console.log('qr-amount', arr[0].amount)
|
||||
|
||||
this.form.email = arr[0].email
|
||||
this.form.amount1 = arr[0].amount
|
||||
},
|
||||
async onDetect(promise) {
|
||||
try {
|
||||
const {
|
||||
imageData, // raw image data of image/frame
|
||||
content, // decoded String
|
||||
location, // QR code coordinates
|
||||
} = await promise
|
||||
// console.log('onDetect promise',promise)
|
||||
//console.log('JSON.parse(decodedString)',JSON.parse(promise) )
|
||||
const arr = JSON.parse(decodedString)
|
||||
} catch (error) {
|
||||
// ...
|
||||
}
|
||||
},
|
||||
async onSubmit() {
|
||||
//event.preventDefault()
|
||||
//console.log("onSubmit", this.form)
|
||||
this.$store.state.ajaxCreateData.session_id = this.$cookies.get('gdd_session_id')
|
||||
this.$store.state.ajaxCreateData.email = this.form.email
|
||||
this.$store.state.ajaxCreateData.amount = this.form.amount
|
||||
this.$store.state.ajaxCreateData.memo = this.form.memo
|
||||
this.$store.state.ajaxCreateData.target_date = Date.now()
|
||||
|
||||
this.$store.dispatch('ajaxCreate')
|
||||
},
|
||||
onReset(event) {
|
||||
event.preventDefault()
|
||||
this.form.email = ''
|
||||
this.form.amount = ''
|
||||
this.show = false
|
||||
this.$nextTick(() => {
|
||||
this.show = true
|
||||
})
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
state() {
|
||||
return this.name.length >= 4
|
||||
@ -229,6 +221,49 @@ export default {
|
||||
return 'Bitte geben Sie eine GDD Adresse ein.'
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async onDecode(decodedString) {
|
||||
//console.log('onDecode JSON.parse(decodedString)', JSON.parse(decodedString))
|
||||
const arr = JSON.parse(decodedString)
|
||||
//console.log('qr-email', arr[0].email)
|
||||
//console.log('qr-amount', arr[0].amount)
|
||||
|
||||
this.row_form = false
|
||||
this.row_check = true
|
||||
this.row_thx = false
|
||||
},
|
||||
async onSubmit() {
|
||||
//event.preventDefault()
|
||||
//console.log("onSubmit", this.form)
|
||||
this.$store.state.ajaxCreateData.session_id = this.$cookies.get('gdd_session_id')
|
||||
this.$store.state.ajaxCreateData.email = this.form.email
|
||||
this.$store.state.ajaxCreateData.amount = this.form.amount
|
||||
this.$store.state.ajaxCreateData.memo = this.form.memo
|
||||
this.$store.state.ajaxCreateData.target_date = Date.now()
|
||||
|
||||
this.row_form = false
|
||||
this.row_check = true
|
||||
this.row_thx = false
|
||||
},
|
||||
sendTransaction() {
|
||||
this.$store.dispatch('ajaxCreate')
|
||||
this.row_form = false
|
||||
this.row_check = false
|
||||
this.row_thx = true
|
||||
},
|
||||
onReset(event) {
|
||||
event.preventDefault()
|
||||
this.form.email = ''
|
||||
this.form.amount = ''
|
||||
this.show = false
|
||||
this.$nextTick(() => {
|
||||
this.show = true
|
||||
})
|
||||
this.row_form = true
|
||||
this.row_check = false
|
||||
this.row_thx = false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
@ -111,12 +111,20 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filteredItems(a) {
|
||||
// console.log("filteredItems date",a.items)
|
||||
return a.items
|
||||
filteredItems() {
|
||||
return this.ojectToArray(this.items).reverse()
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
ojectToArray(obj) {
|
||||
let result = new Array(Object.keys(obj).length)
|
||||
Object.entries(obj).forEach((entry) => {
|
||||
const [key, value] = entry
|
||||
result[key] = value
|
||||
})
|
||||
return result
|
||||
},
|
||||
|
||||
rowClass(item, type) {
|
||||
if (!item || type !== 'row') return
|
||||
if (item.type === 'receive') return 'table-success'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user