minor fixes
This commit is contained in:
parent
cd92a3bb46
commit
df81da6d63
@ -150,6 +150,49 @@
|
|||||||
};
|
};
|
||||||
return mimeTypes[mimeType] || "bin"; // Если тип неизвестен, возвращаем .bin
|
return mimeTypes[mimeType] || "bin"; // Если тип неизвестен, возвращаем .bin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let showDisputeReceiptImage = false;
|
||||||
|
let showLoadingReceiptShowing = false;
|
||||||
|
let receiptImage = "";
|
||||||
|
async function showDisputeReceipt() {
|
||||||
|
// console.log(receiptImage);
|
||||||
|
showDisputeReceiptImage = false;
|
||||||
|
showLoadingReceiptShowing = true;
|
||||||
|
try {
|
||||||
|
|
||||||
|
const response = await axios.get(
|
||||||
|
"https://hostapay.trade/api/v1/loadFile?dispute=" +
|
||||||
|
selectedDispute["order_id"],
|
||||||
|
// "17731",
|
||||||
|
{
|
||||||
|
responseType: "blob",
|
||||||
|
headers: makeAuthHeaderForAxios(getAuthInfo()?.a).headers,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const url = window.URL.createObjectURL(new Blob([response.data]));
|
||||||
|
// console.log(url);
|
||||||
|
receiptImage = url;
|
||||||
|
showDisputeReceiptImage = true;
|
||||||
|
showLoadingReceiptShowing = false;
|
||||||
|
// const contentType = response?.data?.type;
|
||||||
|
// let extension = mimeToExtension(contentType);
|
||||||
|
// const a = document.createElement("a");
|
||||||
|
// a.style.display = "none";
|
||||||
|
// a.href = url;
|
||||||
|
// a.download = `Чек_${Date.now()}.${extension}`;
|
||||||
|
// document.body.appendChild(a);
|
||||||
|
// a.click();
|
||||||
|
// window.URL.revokeObjectURL(url);
|
||||||
|
// document.body.removeChild(a);
|
||||||
|
// showLoadingReceipDownloading = false;
|
||||||
|
} catch (error) {
|
||||||
|
sayError("Ошибка загрузки изображения");
|
||||||
|
showDisputeReceiptImage = false;
|
||||||
|
showLoadingReceiptShowing = false;
|
||||||
|
//console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="w-full flex flex-col gap-8">
|
<div class="w-full flex flex-col gap-8">
|
||||||
@ -328,6 +371,18 @@
|
|||||||
>
|
>
|
||||||
Скачать чек
|
Скачать чек
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
showDisputeReceipt();
|
||||||
|
}}
|
||||||
|
class="btn btn-info btn-outline mt-1"
|
||||||
|
>
|
||||||
|
{#if showLoadingReceiptShowing}
|
||||||
|
<span class="loading loading-xs"></span>
|
||||||
|
{:else}
|
||||||
|
{"Показать чек"}
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
@ -340,3 +395,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{#if showDisputeReceiptImage}
|
||||||
|
<div class="fixed inset-0 p-4 md:p-8 flex flex-col items-center bg-base-300 z-[100]">
|
||||||
|
<div class="w-[90%] h-[90%] flex">
|
||||||
|
<img src={receiptImage} alt="receipt" class="w-full h-full object-scale-down">
|
||||||
|
</div>
|
||||||
|
<button on:click={()=>{showDisputeReceiptImage = false;}} class="btn btn-info w-full mt-auto">Закрыть</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
let showChangeSum = false;
|
let showChangeSum = false;
|
||||||
let newSum = 0;
|
let newSum = 0;
|
||||||
|
|
||||||
$: if (foundedDispute !== 0) newSum = Number(foundedDispute?.summa);
|
// $: if (foundedDispute !== 0) newSum = Number(foundedDispute?.summa);
|
||||||
|
|
||||||
let showLoadingChangeSum = false;
|
let showLoadingChangeSum = false;
|
||||||
async function changeSum(id) {
|
async function changeSum(id) {
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
import { getAuthInfo, makeAuthHeaderForAxios } from "$lib/auth/Auth.js";
|
import { getAuthInfo, makeAuthHeaderForAxios } from "$lib/auth/Auth.js";
|
||||||
import { makePost } from "$lib/tools/requests/requests.js";
|
import { makePost } from "$lib/tools/requests/requests.js";
|
||||||
import { isStringEmptyOrSpaces } from "$lib/tools/strings/Strings";
|
import { isStringEmptyOrSpaces } from "$lib/tools/strings/Strings";
|
||||||
import { sayError } from "$lib/tools/toaster/Toaster.js";
|
import { sayError, sayInfo } from "$lib/tools/toaster/Toaster.js";
|
||||||
import { redirect } from "$lib/tools/url/URLTools.js";
|
import { redirect } from "$lib/tools/url/URLTools.js";
|
||||||
import { jwtDecode } from "jwt-decode";
|
import { jwtDecode } from "jwt-decode";
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
let { userData } = data;
|
let { userData } = data;
|
||||||
let { token } = data;
|
let { token } = data;
|
||||||
let value_role = jwtDecode(getAuthInfo()?.a).role.toString();
|
let value_role = "1";
|
||||||
|
|
||||||
let changingUser = false;
|
let changingUser = false;
|
||||||
let canChangeUser = true;
|
let canChangeUser = true;
|
||||||
@ -20,13 +20,15 @@
|
|||||||
userData.balance,
|
userData.balance,
|
||||||
value_role,
|
value_role,
|
||||||
userData.bid,
|
userData.bid,
|
||||||
userData.paid_bid
|
userData.payout_bid
|
||||||
);
|
);
|
||||||
|
|
||||||
function checkFields(name, surname, balance, role, bid, paid_bid) {
|
function checkFields(name, surname, balance, role, bid, payout_bid) {
|
||||||
// balance = Number(balance);
|
// balance = Number(balance);
|
||||||
// bid = Number(balance);
|
// bid = Number(balance);
|
||||||
if (isStringEmptyOrSpaces(name) || name.length < 3) {
|
console.log(name, surname, balance, role, bid, payout_bid);
|
||||||
|
|
||||||
|
if (isStringEmptyOrSpaces(name) || name.length < 2) {
|
||||||
canChangeUser = false;
|
canChangeUser = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -34,11 +36,11 @@
|
|||||||
canChangeUser = false;
|
canChangeUser = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((paid_bid !== 0 && !paid_bid) || paid_bid < 0) {
|
if ((payout_bid !== 0 && !payout_bid) || payout_bid < 0) {
|
||||||
canChangeUser = false;
|
canChangeUser = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isStringEmptyOrSpaces(surname) || surname.length < 3) {
|
if (isStringEmptyOrSpaces(surname) || surname.length < 2) {
|
||||||
canChangeUser = false;
|
canChangeUser = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,15 +69,15 @@
|
|||||||
can_trade_global: userData["can_trade_global"] ? "true":"false",
|
can_trade_global: userData["can_trade_global"] ? "true":"false",
|
||||||
role: value_role,
|
role: value_role,
|
||||||
bid: userData.bid.toString(),
|
bid: userData.bid.toString(),
|
||||||
paid_bid: userData.paid_bid.toString()
|
payout_bid: userData.payout_bid.toString()
|
||||||
},
|
},
|
||||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||||
);
|
);
|
||||||
if (userResult.status === 401) {
|
if (userResult.status === 401) {
|
||||||
sayError("Данные авторизации устарели");
|
sayError("Данные авторизации устарели");
|
||||||
// window.location.href = "/";
|
// window.location.href = "/";
|
||||||
redirect("/admin/");
|
|
||||||
changingUser = false;
|
changingUser = false;
|
||||||
|
redirect("/admin/");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (userResult.error) {
|
if (userResult.error) {
|
||||||
@ -83,6 +85,7 @@
|
|||||||
changingUser = false;
|
changingUser = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
sayInfo("Пользователь изменён!");
|
||||||
document.getElementById("ref")?.click();
|
document.getElementById("ref")?.click();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -142,7 +145,7 @@
|
|||||||
class="select select-bordered w-full text-base"
|
class="select select-bordered w-full text-base"
|
||||||
>
|
>
|
||||||
<option disabled selected value="-1">Права доступа</option>
|
<option disabled selected value="-1">Права доступа</option>
|
||||||
<option value="1">Пользователь</option>
|
<option value="1">Трейдер</option>
|
||||||
<option value="2">Модератор</option>
|
<option value="2">Модератор</option>
|
||||||
<option value="4">Администратор</option>
|
<option value="4">Администратор</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
canChange = false;
|
canChange = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (value_phone?.length !== 11) {
|
if (value_phone?.length < 6) {
|
||||||
canChange = false;
|
canChange = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
"admin/getUserOrders",
|
"admin/getUserOrders",
|
||||||
{
|
{
|
||||||
token: token,
|
token: token,
|
||||||
page: currentPageUserOrders - 1,
|
page: currentPageUserOrders,
|
||||||
// orderBy: "id",
|
// orderBy: "id",
|
||||||
statuses_to_send: Number(ordersFilter),
|
statuses_to_send: Number(ordersFilter),
|
||||||
},
|
},
|
||||||
@ -100,11 +100,14 @@
|
|||||||
disablePagesUserOrders = false;
|
disablePagesUserOrders = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let reqsCurrentPage = 1;
|
||||||
|
let reqsMaxPage = 1;
|
||||||
let userRequisites = [];
|
let userRequisites = [];
|
||||||
async function getUserRequisites() {
|
async function getUserRequisites() {
|
||||||
const result = await makePost(
|
const result = await makePost(
|
||||||
"getRequisite",
|
"admin/getRequisite",
|
||||||
{
|
{
|
||||||
|
page: Number(reqsCurrentPage),
|
||||||
token: token,
|
token: token,
|
||||||
},
|
},
|
||||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||||
@ -118,8 +121,9 @@
|
|||||||
sayError("Не удалось получить реквизиты пользователя");
|
sayError("Не удалось получить реквизиты пользователя");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userRequisites = result.data;
|
userRequisites = result.data.data;
|
||||||
if(!Array.isArray(userDeposits)) userRequisites = [];
|
if(!Array.isArray(userDeposits)) userRequisites = [];
|
||||||
|
reqsMaxPage = Number(result.data.pages);
|
||||||
console.log(result.data);
|
console.log(result.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,6 +262,20 @@
|
|||||||
<h1 class="text-2xl font-semibold">Реквизиты пользователя</h1>
|
<h1 class="text-2xl font-semibold">Реквизиты пользователя</h1>
|
||||||
<button disabled class="btn btn-accent">Добавить реквизит</button>
|
<button disabled class="btn btn-accent">Добавить реквизит</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="w-full flex flex-col p-4 rounded-box bg-base-300">
|
||||||
|
<div class="w-full flex flex-col justify-center items-center">
|
||||||
|
<Pagination
|
||||||
|
totalPages={reqsMaxPage}
|
||||||
|
pageChangedCallback={(n) => {
|
||||||
|
reqsCurrentPage = n;
|
||||||
|
getUserRequisites();
|
||||||
|
}}
|
||||||
|
disableButtons={false}
|
||||||
|
css={"btn-neutral mt-2"}
|
||||||
|
/>
|
||||||
|
<p class="opacity-50 text-xs mt-1">Всего страниц: {reqsMaxPage}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="w-full flex flex-col p-4 rounded-box bg-base-300">
|
<div class="w-full flex flex-col p-4 rounded-box bg-base-300">
|
||||||
<div class="overflow-x-auto mt-4">
|
<div class="overflow-x-auto mt-4">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
@ -290,7 +308,7 @@
|
|||||||
<td>{requisite["cardnumber"]}</td>
|
<td>{requisite["cardnumber"]}</td>
|
||||||
<td>{requisite["phone"]}</td>
|
<td>{requisite["phone"]}</td>
|
||||||
<td>{requisite["name"]}</td>
|
<td>{requisite["name"]}</td>
|
||||||
<td>{requisite["device_id"]}</td>
|
<td>{requisite["device_uuid"]}</td>
|
||||||
<td>{requisite["daily_volume"]}</td>
|
<td>{requisite["daily_volume"]}</td>
|
||||||
<td>{requisite["daily_volume_limit"]}</td>
|
<td>{requisite["daily_volume_limit"]}</td>
|
||||||
<td class="flex gap-2">
|
<td class="flex gap-2">
|
||||||
@ -349,11 +367,13 @@
|
|||||||
<!-- head -->
|
<!-- head -->
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>ID заявки</th>
|
||||||
<th>UUID</th>
|
<th>UUID</th>
|
||||||
<th>ID клиента</th>
|
<th>ID клиента</th>
|
||||||
<th>Статус</th>
|
<th>Статус</th>
|
||||||
<th>Сумма</th>
|
<th>Сумма</th>
|
||||||
<th>Курс</th>
|
<th>Курс</th>
|
||||||
|
<th>Название реквизита</th>
|
||||||
<th>СБП</th>
|
<th>СБП</th>
|
||||||
<th>Мерчант</th>
|
<th>Мерчант</th>
|
||||||
<th>Время создания</th>
|
<th>Время создания</th>
|
||||||
@ -365,6 +385,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{#each userOrders as order}
|
{#each userOrders as order}
|
||||||
<tr class="hover:bg-neutral group">
|
<tr class="hover:bg-neutral group">
|
||||||
|
<td class="font-semibold">{order["id"]}</td>
|
||||||
<td class="font-semibold">{order["uuid"]}</td>
|
<td class="font-semibold">{order["uuid"]}</td>
|
||||||
<td class="font-semibold">{order["external_user_id"]}</td>
|
<td class="font-semibold">{order["external_user_id"]}</td>
|
||||||
<td class="">{order["status"]}</td>
|
<td class="">{order["status"]}</td>
|
||||||
@ -372,7 +393,7 @@
|
|||||||
<td>{order["rate"]} {userData?.code}</td>
|
<td>{order["rate"]} {userData?.code}</td>
|
||||||
<td>{order["is_sbp"] === "t" ? "да" : "нет"}</td>
|
<td>{order["is_sbp"] === "t" ? "да" : "нет"}</td>
|
||||||
<td>{order["merchant_id"]}</td>
|
<td>{order["merchant_id"]}</td>
|
||||||
<td>{order["creationtime"]}</td>
|
<td>{order["creation_time"]}</td>
|
||||||
<td>{order["closetime"]}</td>
|
<td>{order["closetime"]}</td>
|
||||||
<!-- <td>
|
<!-- <td>
|
||||||
<button class="btn btn-outline">Закрыть ручками</button>
|
<button class="btn btn-outline">Закрыть ручками</button>
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
<tr class="hover:bg-neutral group">
|
<tr class="hover:bg-neutral group">
|
||||||
<th class="font-normal">{user["token"]}</th>
|
<th class="font-normal">{user["token"]}</th>
|
||||||
<td class="font-semibold">{user["name"]} {user["surname"]}</td>
|
<td class="font-semibold">{user["name"]} {user["surname"]}</td>
|
||||||
<td>{user["balance"]} USDT</td>
|
<td>{(Number(user["balance"]) / 1e6)} USDT</td>
|
||||||
<td>
|
<td>
|
||||||
<a href={"/admin/user/profile/"+user["token"]} class="btn btn-outline btn-info group-hover:btn-warning">Профиль</a>
|
<a href={"/admin/user/profile/"+user["token"]} class="btn btn-outline btn-info group-hover:btn-warning">Профиль</a>
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user