2025-11-03 14:24:10 +01:00
|
|
|
import { computed, defineComponent, onMounted, PropType, ref, watch } from 'vue';
|
|
|
|
|
|
|
|
|
|
import { ICalcStat, IOperators } from '../../model';
|
|
|
|
|
import { useUserStore } from '../../store/UserStore';
|
|
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
import { useGlobalStore } from '../../store/globalStore';
|
|
|
|
|
import { useCircuitStore } from '../../store/CircuitStore';
|
|
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
|
|
|
|
|
|
import { shared_consts } from '@src/common/shared_vuejs';
|
|
|
|
|
import { costanti, IMainCard } from '@store/Modules/costanti';
|
|
|
|
|
|
|
|
|
|
import { CMyUser } from '../CMyUser';
|
|
|
|
|
import { CTitleBanner } from '../CTitleBanner';
|
|
|
|
|
import { CMyGroup } from '../CMyGroup';
|
|
|
|
|
import { CCopyBtnSmall } from '../CCopyBtnSmall';
|
|
|
|
|
import { CContactUser } from '../CContactUser';
|
|
|
|
|
import { CQRCode } from '../CQRCode';
|
|
|
|
|
import { CFindUsers } from '../CFindUsers';
|
|
|
|
|
import { CUserInfoAccount } from '../CUserInfoAccount';
|
|
|
|
|
import { tools } from '@tools';
|
|
|
|
|
import { useQuasar } from 'quasar';
|
2023-03-11 01:01:23 +01:00
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
name: 'CSendRISTo',
|
|
|
|
|
props: {},
|
2024-10-02 03:46:40 +02:00
|
|
|
components: {
|
2025-11-03 14:24:10 +01: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) {
|
2025-11-03 14:24:10 +01:00
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const globalStore = useGlobalStore();
|
|
|
|
|
const circuitStore = useCircuitStore();
|
|
|
|
|
const { t } = useI18n();
|
|
|
|
|
const $q = useQuasar();
|
|
|
|
|
const $router = useRouter();
|
2023-03-11 01:01:23 +01:00
|
|
|
|
2025-11-03 14:24:10 +01:00
|
|
|
const showSendCoin = ref(false);
|
|
|
|
|
const showReceiveCoin = ref(false);
|
|
|
|
|
const receiveType = ref('link');
|
|
|
|
|
const riscallrec = ref(<string>'');
|
2023-03-11 01:01:23 +01:00
|
|
|
|
2025-11-03 14:24:10 +01:00
|
|
|
const btnInviaRIS = ref(null);
|
2024-10-11 02:29:29 +02:00
|
|
|
|
|
|
|
|
const optionsReceive = ref([
|
|
|
|
|
{
|
|
|
|
|
label: 'Condividi il tuo Link',
|
|
|
|
|
value: 'link',
|
|
|
|
|
},
|
2025-01-09 15:17:21 +01:00
|
|
|
/*{
|
2024-10-11 02:29:29 +02:00
|
|
|
label: 'Rendi visibile il tuo profilo per 8 ore',
|
|
|
|
|
value: 'showonlist',
|
2025-01-09 15:17:21 +01:00
|
|
|
},*/
|
2024-10-11 02:29:29 +02:00
|
|
|
{
|
|
|
|
|
label: 'Genera il QR Code',
|
|
|
|
|
value: 'qrcode',
|
|
|
|
|
},
|
2025-11-03 14:24:10 +01:00
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const tipoConto = ref(shared_consts.AccountType.USER);
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
const miolink = ref('');
|
|
|
|
|
const sendRIS = ref('');
|
|
|
|
|
const qtyRIS = ref('');
|
|
|
|
|
const causal = ref('');
|
2023-11-30 01:48:29 +01:00
|
|
|
const circuitpath = computed(() => {
|
2025-11-03 14:24:10 +01:00
|
|
|
const circ = circuitStore.getCircuitByProvinceAndCard(
|
|
|
|
|
userStore.my.profile.resid_province,
|
|
|
|
|
userStore.my.profile.resid_card
|
|
|
|
|
);
|
|
|
|
|
return circ && circ.path ? circ.path : '';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-10-11 02:29:29 +02:00
|
|
|
|
2025-11-03 14:24:10 +01:00
|
|
|
const showonreclist = ref(false);
|
2024-10-11 02:29:29 +02:00
|
|
|
|
2025-11-03 14:24:10 +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'),
|
2025-03-26 23:23:35 +01:00
|
|
|
value: shared_consts.AccountType.CONTO_DI_GRUPPO,
|
2025-11-03 14:24:10 +01:00
|
|
|
},
|
|
|
|
|
]);
|
2023-03-11 01:01:23 +01:00
|
|
|
|
2024-10-11 02:29:29 +02:00
|
|
|
function mounted() {
|
2025-11-03 14:24:10 +01:00
|
|
|
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
|
|
|
|
2025-11-03 14:24:10 +01:00
|
|
|
qtyRIS.value = qtyRIS.value.replace(',', '.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scrollaBottone() {
|
|
|
|
|
const btnInviaRIS = document.getElementById('btnInviaRIS');
|
|
|
|
|
if (btnInviaRIS) {
|
|
|
|
|
const offset = 30; // spazio desiderato in pixel sopra il bottone
|
|
|
|
|
const y = btnInviaRIS.getBoundingClientRect().top + window.scrollY - offset;
|
|
|
|
|
window.scrollTo({ top: y, behavior: 'smooth' });
|
|
|
|
|
}
|
2023-03-11 01:01:23 +01:00
|
|
|
}
|
|
|
|
|
|
2025-01-09 15:17:21 +01:00
|
|
|
function clickInviaRIS() {
|
2025-11-03 14:24:10 +01:00
|
|
|
scrollaBottone();
|
|
|
|
|
|
|
|
|
|
showSendCoin.value = !showSendCoin.value;
|
|
|
|
|
if (showSendCoin.value) showReceiveCoin.value = !showSendCoin.value;
|
2025-01-09 15:17:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function clickriceviRIS() {
|
2025-11-03 14:24:10 +01:00
|
|
|
scrollaBottone();
|
2025-01-09 15:17:21 +01:00
|
|
|
|
|
|
|
|
showReceiveCoin.value = !showReceiveCoin.value;
|
2025-11-03 14:24:10 +01:00
|
|
|
if (showReceiveCoin.value) showSendCoin.value = !showReceiveCoin.value;
|
|
|
|
|
if (showReceiveCoin.value) clickAddtoRecList();
|
2025-01-09 15:17:21 +01:00
|
|
|
}
|
|
|
|
|
|
2024-10-11 02:29:29 +02:00
|
|
|
async function clickAddtoRecList() {
|
2025-11-03 14:24:10 +01:00
|
|
|
const risultato = await tools.addToTemporaryReceiverRIS(t);
|
2024-10-11 02:29:29 +02:00
|
|
|
if (risultato) {
|
2025-11-03 14:24:10 +01:00
|
|
|
riscallrec.value = risultato.msg;
|
|
|
|
|
showonreclist.value = risultato.ris;
|
2024-10-11 02:29:29 +02:00
|
|
|
}
|
2024-10-02 03:46:40 +02:00
|
|
|
}
|
|
|
|
|
|
2025-11-03 14:24:10 +01:00
|
|
|
onMounted(mounted);
|
2024-10-11 02:29:29 +02:00
|
|
|
|
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,
|
2025-01-09 15:17:21 +01:00
|
|
|
clickInviaRIS,
|
|
|
|
|
clickriceviRIS,
|
2025-11-03 14:24:10 +01:00
|
|
|
btnInviaRIS,
|
|
|
|
|
};
|
2023-03-11 01:01:23 +01:00
|
|
|
},
|
2025-11-03 14:24:10 +01:00
|
|
|
});
|