2024-10-11 02:29:29 +02:00
|
|
|
import { computed, defineComponent, onMounted, PropType, ref, watch } from 'vue'
|
2023-03-11 01:01:23 +01:00
|
|
|
|
|
|
|
|
import { ICalcStat, IOperators } from '../../model'
|
|
|
|
|
import { useUserStore } from '../../store/UserStore'
|
|
|
|
|
import { useRouter } from 'vue-router'
|
|
|
|
|
import { useGlobalStore } from '../../store/globalStore'
|
2023-11-30 01:48:29 +01:00
|
|
|
import { useCircuitStore } from '../../store/CircuitStore'
|
2023-03-11 01:01:23 +01:00
|
|
|
import { useI18n } from '../../boot/i18n'
|
|
|
|
|
|
|
|
|
|
import { shared_consts } from '@src/common/shared_vuejs'
|
|
|
|
|
import { costanti, IMainCard } from '@store/Modules/costanti'
|
|
|
|
|
|
|
|
|
|
import { CMyUser } from '../CMyUser'
|
2024-10-02 03:46:40 +02:00
|
|
|
import { CTitleBanner } from '../CTitleBanner'
|
2023-03-11 01:01:23 +01:00
|
|
|
import { CMyGroup } from '../CMyGroup'
|
2024-10-11 02:29:29 +02:00
|
|
|
import { CCopyBtnSmall } from '../CCopyBtnSmall'
|
2024-10-02 03:46:40 +02:00
|
|
|
import { CContactUser } from '../CContactUser'
|
2024-10-11 02:29:29 +02:00
|
|
|
import { CQRCode } from '../CQRCode'
|
|
|
|
|
import { CFindUsers } from '../CFindUsers'
|
2023-03-17 19:07:43 +01:00
|
|
|
import { CUserInfoAccount } from '../CUserInfoAccount'
|
2023-03-11 01:01:23 +01:00
|
|
|
import { tools } from '@store/Modules/tools'
|
|
|
|
|
import { useQuasar } from 'quasar'
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
name: 'CSendRISTo',
|
|
|
|
|
props: {},
|
2024-10-02 03:46:40 +02:00
|
|
|
components: {
|
2024-10-11 02:29:29 +02:00
|
|
|
CMyUser, CMyGroup, CUserInfoAccount, CCopyBtnSmall,
|
|
|
|
|
CTitleBanner, CContactUser, CFindUsers, CQRCode
|
2024-10-02 03:46:40 +02:00
|
|
|
},
|
2023-03-11 01:01:23 +01:00
|
|
|
setup(props) {
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const globalStore = useGlobalStore()
|
2023-11-30 01:48:29 +01:00
|
|
|
const circuitStore = useCircuitStore()
|
2023-03-11 01:01:23 +01:00
|
|
|
const { t } = useI18n()
|
|
|
|
|
const $q = useQuasar()
|
|
|
|
|
const $router = useRouter()
|
|
|
|
|
|
2024-10-11 02:29:29 +02:00
|
|
|
const showSendCoin = ref(false)
|
|
|
|
|
const showReceiveCoin = ref(false)
|
|
|
|
|
const receiveType = ref('link')
|
|
|
|
|
const riscallrec = ref(<string>'')
|
|
|
|
|
|
|
|
|
|
const optionsReceive = ref([
|
|
|
|
|
{
|
|
|
|
|
label: 'Condividi il tuo Link',
|
|
|
|
|
value: 'link',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Rendi visibile il tuo profilo per 8 ore',
|
|
|
|
|
value: 'showonlist',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Genera il QR Code',
|
|
|
|
|
value: 'qrcode',
|
|
|
|
|
},
|
|
|
|
|
])
|
2023-03-11 01:01:23 +01:00
|
|
|
|
|
|
|
|
|
2024-09-26 02:14:50 +02:00
|
|
|
const tipoConto = ref(shared_consts.AccountType.USER)
|
2023-03-11 01:01:23 +01:00
|
|
|
const loading = ref(false)
|
2024-10-02 03:46:40 +02:00
|
|
|
const miolink = ref('')
|
|
|
|
|
const sendRIS = ref(false)
|
2024-10-11 02:29:29 +02:00
|
|
|
const qtyRIS = ref('')
|
|
|
|
|
const causal = ref('')
|
2023-11-30 01:48:29 +01:00
|
|
|
const circuitpath = computed(() => {
|
|
|
|
|
const circ = circuitStore.getCircuitByProvinceAndCard(userStore.my.profile.resid_province, userStore.my.profile.resid_card)
|
|
|
|
|
return circ && circ.path ? circ.path : ''
|
|
|
|
|
})
|
2023-03-17 19:07:43 +01:00
|
|
|
|
2024-10-11 02:29:29 +02:00
|
|
|
watch(() => qtyRIS.value, (to: any, from: any) => {
|
|
|
|
|
limitQuantity()
|
|
|
|
|
miolink.value = userStore.getLinkProfileAndRIS('', qtyRIS.value, causal.value)
|
|
|
|
|
})
|
|
|
|
|
watch(() => causal.value, (to: any, from: any) => {
|
|
|
|
|
miolink.value = userStore.getLinkProfileAndRIS('', qtyRIS.value, causal.value)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const showonreclist = ref(false)
|
|
|
|
|
|
2023-03-17 19:07:43 +01:00
|
|
|
const contact = computed(() => userStore.my)
|
2023-03-11 01:01:23 +01:00
|
|
|
|
|
|
|
|
const arrTypesAccounts = ref(<any>[
|
|
|
|
|
{
|
|
|
|
|
label: t('circuit.user'),
|
2024-09-26 02:14:50 +02:00
|
|
|
value: shared_consts.AccountType.USER,
|
2023-03-11 01:01:23 +01:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: t('circuit.conticollettivi'),
|
2024-09-26 02:14:50 +02:00
|
|
|
value: shared_consts.AccountType.COLLECTIVE_ACCOUNT,
|
2023-03-11 01:01:23 +01:00
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
|
2024-10-11 02:29:29 +02:00
|
|
|
function mounted() {
|
|
|
|
|
miolink.value = userStore.getLinkProfileAndRIS('', qtyRIS.value)
|
2023-03-11 01:01:23 +01:00
|
|
|
}
|
|
|
|
|
|
2024-10-11 02:29:29 +02:00
|
|
|
function limitQuantity() {
|
|
|
|
|
// Converte qtyRIS in stringa per verificare la lunghezza
|
|
|
|
|
if (qtyRIS.value.length > 5) {
|
|
|
|
|
qtyRIS.value = qtyRIS.value.substring(0, 5); // Limita a 5 caratteri
|
|
|
|
|
}
|
2023-03-11 01:01:23 +01:00
|
|
|
|
2024-10-11 02:29:29 +02:00
|
|
|
qtyRIS.value = qtyRIS.value.replace(',', '.')
|
2023-03-11 01:01:23 +01:00
|
|
|
}
|
|
|
|
|
|
2024-10-11 02:29:29 +02:00
|
|
|
async function clickAddtoRecList() {
|
|
|
|
|
const risultato = await tools.addToTemporaryReceiverRIS(t)
|
|
|
|
|
if (risultato) {
|
|
|
|
|
riscallrec.value = risultato.msg
|
|
|
|
|
showonreclist.value = risultato.ris
|
|
|
|
|
}
|
2024-10-02 03:46:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-10-11 02:29:29 +02:00
|
|
|
onMounted(mounted)
|
|
|
|
|
|
|
|
|
|
|
2023-03-11 01:01:23 +01:00
|
|
|
return {
|
|
|
|
|
userStore,
|
|
|
|
|
tools,
|
|
|
|
|
costanti,
|
|
|
|
|
shared_consts,
|
|
|
|
|
arrTypesAccounts,
|
|
|
|
|
tipoConto,
|
|
|
|
|
loading,
|
2023-03-17 19:07:43 +01:00
|
|
|
contact,
|
|
|
|
|
circuitpath,
|
2024-10-02 03:46:40 +02:00
|
|
|
sendRIS,
|
|
|
|
|
miolink,
|
2024-10-11 02:29:29 +02:00
|
|
|
qtyRIS,
|
|
|
|
|
t,
|
|
|
|
|
causal,
|
|
|
|
|
limitQuantity,
|
|
|
|
|
showSendCoin,
|
|
|
|
|
optionsReceive,
|
|
|
|
|
receiveType,
|
|
|
|
|
showReceiveCoin,
|
|
|
|
|
showonreclist,
|
|
|
|
|
riscallrec,
|
|
|
|
|
clickAddtoRecList,
|
2023-03-11 01:01:23 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|