ver 0.5.51
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { computed, defineComponent, onMounted, PropType, ref, watch } from 'vue'
|
||||
|
||||
import { IAccount, ICircuit, IOperators, ISendCoin, ISpecialField, IUserFields } from '../../model'
|
||||
import { IAccount, ICircuit, IMyGroup, IOperators, ISendCoin, ISpecialField, IUserFields } from '../../model'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { CSaldo } from '@/components/CSaldo'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
@@ -24,7 +24,18 @@ export default defineComponent({
|
||||
},
|
||||
to_user: {
|
||||
type: Object as PropType<IUserFields>,
|
||||
required: true,
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
to_group: {
|
||||
type: Object as PropType<IMyGroup>,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
from_group: {
|
||||
type: Object as PropType<IMyGroup>,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
components: { CSaldo, CMyUserOnlyView },
|
||||
@@ -36,10 +47,9 @@ export default defineComponent({
|
||||
const userStore = useUserStore()
|
||||
const circuitStore = useCircuitStore()
|
||||
|
||||
|
||||
const from_username = ref(userStore.my.username)
|
||||
const circuitsel = ref('')
|
||||
const qty = ref(<string|number>'')
|
||||
const qty = ref(<string | number>'')
|
||||
const causal = ref('')
|
||||
const bothcircuits = ref(<any>[])
|
||||
|
||||
@@ -111,7 +121,25 @@ export default defineComponent({
|
||||
// ....
|
||||
if (props.to_user) {
|
||||
console.log('user', props.to_user)
|
||||
bothcircuits.value = userStore.IsMyCircuitByUser(props.to_user)
|
||||
bothcircuits.value = userStore.getMyCircuitsInCommonByUser(props.to_user)
|
||||
|
||||
if (props.circuitname) {
|
||||
circuitsel.value = props.circuitname
|
||||
} else {
|
||||
circuitsel.value = tools.getCookie(tools.CIRCUIT_USE, bothcircuits.value[0])
|
||||
}
|
||||
if (!userStore.IsMyCircuitByName(circuitsel.value)) {
|
||||
circuitsel.value = bothcircuits.value[0]
|
||||
}
|
||||
|
||||
aggiorna()
|
||||
|
||||
show.value = true
|
||||
}
|
||||
|
||||
if (props.to_group) {
|
||||
console.log('group', props.to_group)
|
||||
bothcircuits.value = userStore.getMyCircuitsInCommonByGroup(props.to_group)
|
||||
|
||||
if (props.circuitname) {
|
||||
circuitsel.value = props.circuitname
|
||||
@@ -133,16 +161,25 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function sendCoin() {
|
||||
console.log('sendcoin', qty.value, props.to_user.username)
|
||||
console.log('sendcoin', qty.value, props.to_group ? props.to_group.groupname : props.to_user.username)
|
||||
|
||||
if (props.to_user.username && qty.value && circuitloaded.value) {
|
||||
const myrecsendcoin: ISendCoin = {
|
||||
let ok = (props.to_user && props.to_user.username) || (props.to_group && props.to_group.groupname)
|
||||
|
||||
if (ok && qty.value && circuitloaded.value) {
|
||||
let myrecsendcoin: ISendCoin = {
|
||||
qty: tools.convstrToNum(qty.value),
|
||||
dest: props.to_user.username,
|
||||
dest: '',
|
||||
groupdest: '',
|
||||
grouporig: '',
|
||||
circuitname: circuitsel.value,
|
||||
causal: causal.value,
|
||||
symbol: circuitloaded.value.symbol,
|
||||
}
|
||||
|
||||
myrecsendcoin.groupdest = props.to_group ? props.to_group.groupname : ''
|
||||
myrecsendcoin.dest = props.to_user ? props.to_user.username : ''
|
||||
myrecsendcoin.grouporig = props.from_group ? props.from_group.groupname : ''
|
||||
|
||||
if (myrecsendcoin) {
|
||||
tools.sendCoinsByCircuit($q, circuitloaded.value, myrecsendcoin)
|
||||
.then((ris: any) => {
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<q-btn
|
||||
v-if="circuitloaded"
|
||||
:disable="qtyRef ? (qtyRef.hasError || !circuitloaded.transactionsEnabled) : false"
|
||||
:label="$t('circuit.sendcoinsto', {qty, coin: circuitsel, dest: to_user.username })" color="positive"
|
||||
:label="$t('circuit.sendcoinsto', {qty, coin: circuitsel, dest: to_group ? to_group.groupname : to_user.username })" color="positive"
|
||||
@click="sendCoin()"></q-btn>
|
||||
<q-btn flat :label="$t('dialog.cancel')" color="primary" v-close-popup></q-btn>
|
||||
</q-card-actions>
|
||||
|
||||
Reference in New Issue
Block a user