aboba
This commit is contained in:
parent
5b5dc15f5c
commit
0159fa07e9
BIN
public/hpp-hosta-fix-label.zip
Normal file
BIN
public/hpp-hosta-fix-label.zip
Normal file
Binary file not shown.
@ -32,17 +32,19 @@
|
||||
let invalidURL = true;
|
||||
async function getTokenFromURL() {
|
||||
const queryString = window.location.search;
|
||||
// console.log(queryString);
|
||||
// //console.log(queryString);
|
||||
// await delay(5000);
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
tokenURL = urlParams.get("token");
|
||||
console.log(tokenURL);
|
||||
//console.log(tokenURL);
|
||||
validateJWT(tokenURL);
|
||||
// console.log();
|
||||
// //console.log();
|
||||
if (invalidURL == true) {
|
||||
sayError("Неверный ID заявки");
|
||||
} else {
|
||||
await getOrderStatus();
|
||||
//console.log(orderStatus);
|
||||
|
||||
|
||||
switch (orderStatus) {
|
||||
case 1:
|
||||
@ -56,17 +58,20 @@
|
||||
break;
|
||||
case 4:
|
||||
getPaymentMethods();
|
||||
break;
|
||||
case 5:
|
||||
getPaymentMethods();
|
||||
break;
|
||||
case 6:
|
||||
showTimeout = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// getPaymentMethods();
|
||||
}
|
||||
// console.log(urlParams.get("token"));
|
||||
// //console.log(urlParams.get("token"));
|
||||
}
|
||||
getTokenFromURL();
|
||||
|
||||
@ -74,11 +79,11 @@
|
||||
try {
|
||||
let t = jwtDecode(token);
|
||||
orderID = t["order_id"];
|
||||
console.log(t);
|
||||
// //console.log(t);
|
||||
invalidURL = false;
|
||||
} catch (error) {
|
||||
invalidURL = true;
|
||||
console.log(error);
|
||||
// //console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,6 +91,8 @@
|
||||
let timeLeftInterval = -1;
|
||||
function calculateDate(src) {
|
||||
const originalDate = parseISO(src);
|
||||
//console.log(originalDate);
|
||||
|
||||
const newDate = addMinutes(originalDate, 10);
|
||||
timeLeftInterval = setInterval(() => {
|
||||
timeLeft = formatDistanceToNow(newDate, {
|
||||
@ -175,7 +182,7 @@
|
||||
"8d895e75b7a0def7699e6c4d7cd54c51d9844775bd5fd5e8e3d34748",
|
||||
);
|
||||
const captchaInput = form.querySelector("input");
|
||||
if (captchaInput.value !== "") {
|
||||
if (captchaInput?.value !== "") {
|
||||
captchaVerified = true;
|
||||
captchaValue = captchaInput.value;
|
||||
} else {
|
||||
@ -230,8 +237,8 @@
|
||||
},
|
||||
);
|
||||
requestingReqs = false;
|
||||
requisites = result.data;
|
||||
console.log(result);
|
||||
requisites = result.data["requisite"];
|
||||
// console.log(result);
|
||||
showReqs = true;
|
||||
calculateDate(result.data["requisite_creation_time"]);
|
||||
} catch (error) {
|
||||
@ -252,19 +259,24 @@
|
||||
},
|
||||
});
|
||||
orderStatus = result.data.status;
|
||||
console.log(result);
|
||||
// //console.log(result);
|
||||
if(orderStatus === 4)
|
||||
{
|
||||
selectedBank = result.data["bank_id"];
|
||||
selectedBank = result.data["bank_id"]+"";
|
||||
}
|
||||
else if (orderStatus === 5)
|
||||
{
|
||||
selectedBank = result.data["bank_id"];
|
||||
requisites = result.data["requisites"];
|
||||
calculateDate(requisites["requisite_creation_time"]);
|
||||
//console.log('hello!');
|
||||
|
||||
selectedBank = result.data["bank_id"] + "";
|
||||
requisites = result.data["requisite"];
|
||||
calculateDate(result.data["requisite_creation_time"]);
|
||||
disableGetReqBtn = true;
|
||||
showReqs = true;
|
||||
}
|
||||
} catch (error) {
|
||||
//console.log(error);
|
||||
|
||||
orderStatus=6;
|
||||
}
|
||||
|
||||
@ -281,7 +293,7 @@
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
console.log(result);
|
||||
// //console.log(result);
|
||||
}
|
||||
|
||||
async function createDispute() {
|
||||
@ -297,7 +309,7 @@
|
||||
},
|
||||
},
|
||||
);
|
||||
console.log(result);
|
||||
// //console.log(result);
|
||||
}
|
||||
|
||||
async function choosePaymentMethod() {
|
||||
@ -313,7 +325,7 @@
|
||||
},
|
||||
},
|
||||
);
|
||||
console.log(result);
|
||||
//console.log(result);
|
||||
}
|
||||
|
||||
async function cancelOrder() {
|
||||
@ -329,15 +341,15 @@
|
||||
},
|
||||
},
|
||||
);
|
||||
console.log(result);
|
||||
//console.log(result);
|
||||
}
|
||||
|
||||
async function copyToClipboard() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(requisites.requisite[1]);
|
||||
await navigator.clipboard.writeText(requisites[1]);
|
||||
sayInfo("Скопировано!");
|
||||
} catch (err) {
|
||||
console.error("Failed to copy: ", err);
|
||||
//console.error("Failed to copy: ", err);
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,7 +418,7 @@
|
||||
</div>
|
||||
<div class="flex flex-col w-full gap-8">
|
||||
{#if showBankSelection}
|
||||
<p class="text-3xl font-bold">Выбор банка</p>
|
||||
<p class="text-3xl font-bold">{selectedBank === "" ? "Выбор банка":(requisites.length < 1 ? "Запрос реквизитов":"Оплата заявки")}</p>
|
||||
{#each paymentMethods as pm}
|
||||
<div class="flex">
|
||||
<button
|
||||
@ -460,7 +472,7 @@
|
||||
<p class="text-lg">Номер карты для перевода</p>
|
||||
<div class="flex gap-4 items-center">
|
||||
<p class="text-2xl font-bold">
|
||||
{requisites.requisite[1]}
|
||||
{requisites[1]}
|
||||
</p>
|
||||
<button
|
||||
on:click={() => {
|
||||
@ -476,7 +488,7 @@
|
||||
></div>
|
||||
</button>
|
||||
</div>
|
||||
<p class="text-lg">Получатель: {requisites.requisite[0]}</p>
|
||||
<p class="text-lg">Получатель: {requisites[0]}</p>
|
||||
<p class="text-lg mt-4">
|
||||
Время на оплату: {timeLeft}
|
||||
</p>
|
||||
|
26
src/lib/loadingSpinner.svelte
Normal file
26
src/lib/loadingSpinner.svelte
Normal file
@ -0,0 +1,26 @@
|
||||
<script>
|
||||
|
||||
</script>
|
||||
|
||||
<div class="w-full flex justify-center items-center">
|
||||
<svg
|
||||
class={"animate-spin h-8 w-8 text-white"}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<circle
|
||||
class="opacity-25"
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="10"
|
||||
stroke="currentColor"
|
||||
stroke-width="4"
|
||||
></circle>
|
||||
<path
|
||||
class="opacity-75"
|
||||
fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
28
src/lib/toaster.js
Normal file
28
src/lib/toaster.js
Normal file
@ -0,0 +1,28 @@
|
||||
import { toast } from "@zerodevx/svelte-toast";
|
||||
//#FFBE00
|
||||
export function sayInfo(msg, duration = 3000) {
|
||||
toast.push(msg, {
|
||||
theme: {
|
||||
"--toastBackground": "#00B5FF"
|
||||
},
|
||||
duration: duration
|
||||
});
|
||||
}
|
||||
export function sayWarning(msg, duration = 3000) {
|
||||
toast.push(msg, {
|
||||
theme: {
|
||||
"--toastBackground": "#FFBE00",
|
||||
"--toastColor": "#000000"
|
||||
},
|
||||
duration: duration
|
||||
});
|
||||
}
|
||||
export function sayError(msg, duration = 3000) {
|
||||
toast.push(msg, {
|
||||
theme: {
|
||||
"--toastBackground": "#FF5861",
|
||||
"--toastColor": "#000000"
|
||||
},
|
||||
duration: duration
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user