added new stuff
This commit is contained in:
parent
7105062073
commit
46005c648b
714
package-lock.json
generated
714
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ function defaultDataResponseProcessor(data) {
|
||||
export const API_PATH_MAIN = "https://hostapay.trade/api/v1/";
|
||||
export const API_PATH_TEST = "https://test.0x000f.ru/api/v1/";
|
||||
|
||||
export const API_PATH_VALUE = API_PATH_MAIN;
|
||||
export const API_PATH_VALUE = API_PATH_TEST;
|
||||
|
||||
async function makePost(
|
||||
url,
|
||||
@ -30,7 +30,7 @@ async function makePost(
|
||||
options = undefined,
|
||||
responseProcessor = defaultResponseProcessor,
|
||||
dataResponseProcessor = defaultDataResponseProcessor,
|
||||
errorProcessor = defaultErrorProcessor
|
||||
errorProcessor = defaultErrorProcessor,
|
||||
) {
|
||||
try {
|
||||
const res = await axios.post(API_PATH_VALUE + url, data, options);
|
||||
@ -45,7 +45,7 @@ async function makeGet(
|
||||
options = undefined,
|
||||
responseProcessor = defaultResponseProcessor,
|
||||
dataResponseProcessor = defaultDataResponseProcessor,
|
||||
errorProcessor = defaultErrorProcessor
|
||||
errorProcessor = defaultErrorProcessor,
|
||||
) {
|
||||
try {
|
||||
const res = await axios.get(API_PATH_VALUE + url, options);
|
||||
|
||||
@ -61,8 +61,11 @@
|
||||
<li><a href="/admin/currencies">Валюты</a></li>
|
||||
<li><a href="/admin/sms">СМС</a></li>
|
||||
<li><a href="/admin/withdrawals">Вывод средств</a></li>
|
||||
<li><a href="/admin/change-balance/0">Управление балансом</a></li>
|
||||
<li>
|
||||
<a href="/admin/change-balance/0">Управление балансом</a>
|
||||
</li>
|
||||
<li><a href="/admin/refs">Рефералы</a></li>
|
||||
<li><a href="/admin/finance">Финансовые события</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
@ -268,6 +271,21 @@
|
||||
<ChevronRightIcon />
|
||||
</div>
|
||||
</li>
|
||||
<div
|
||||
class="h-[1px] w-full bg-neutral flex-shrink-0 opacity-50 my-[5px]"
|
||||
></div>
|
||||
<li class="relative">
|
||||
<a
|
||||
class="text-lg"
|
||||
on:click={() => {
|
||||
showMenu = false;
|
||||
}}
|
||||
href="/admin/finance">Финансовые события</a
|
||||
>
|
||||
<div class="absolute right-0 top-[2px] pointer-events-none">
|
||||
<ChevronRightIcon />
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<div class="join">
|
||||
<button
|
||||
on:click={() => {
|
||||
if (currentPage === 1) return;
|
||||
if (currentPage <= 1) return;
|
||||
currentPage -= 1;
|
||||
pageChangedCallback(currentPage);
|
||||
}}
|
||||
@ -19,7 +19,7 @@
|
||||
<button class={"join-item btn " + css}>Страница №{currentPage}</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
if (currentPage === totalPages) return;
|
||||
if (currentPage >= totalPages) return;
|
||||
currentPage += 1;
|
||||
pageChangedCallback(currentPage);
|
||||
}}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
export const prerender = true;
|
||||
export const ssr = false;
|
||||
|
||||
console.log = () => {};
|
||||
// console.log = () => {};
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
const res = await makePost(
|
||||
"admin/deposit/search",
|
||||
sData,
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
@ -75,7 +75,7 @@
|
||||
id: uuid,
|
||||
summa: selectedDispute["summa"],
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (res.error) {
|
||||
// console.log(res);
|
||||
@ -106,7 +106,7 @@
|
||||
id: uuid,
|
||||
summa: newSum.toString(),
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (res.error) {
|
||||
if (res.status == 401) {
|
||||
@ -130,7 +130,7 @@
|
||||
id: uuid,
|
||||
summa: newSum.toString(),
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (res.error) {
|
||||
if (res.status == 401) {
|
||||
@ -156,7 +156,7 @@
|
||||
{
|
||||
uuid,
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (res.error) {
|
||||
if (res.status == 401) {
|
||||
@ -183,7 +183,7 @@
|
||||
deposit_id: uuid,
|
||||
token: newValue,
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (res.error) {
|
||||
sayError("Не удалось сменить команду");
|
||||
@ -224,7 +224,7 @@
|
||||
<div class="w-full flex flex-col p-4 rounded-box bg-base-300">
|
||||
<input
|
||||
bind:value={searchValue}
|
||||
placeholder="UUID, External UUID, Токен или External User ID"
|
||||
placeholder="UUID, External UUID, Токен, Имя мерчанта или External User ID"
|
||||
type="text"
|
||||
class="input input-bordered"
|
||||
/>
|
||||
@ -244,7 +244,9 @@
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
<div class="w-full flex flex-col p-4 rounded-box bg-base-300 overflow-x-auto">
|
||||
<div
|
||||
class="w-full flex flex-col p-4 rounded-box bg-base-300 overflow-x-auto"
|
||||
>
|
||||
<div class="flex w-full justify-center items-center">
|
||||
<button
|
||||
class="btn"
|
||||
@ -263,7 +265,8 @@
|
||||
<button
|
||||
class="btn"
|
||||
on:click={() => {
|
||||
if (currentDepositSearchPage >= maxDepositSearchPages) return;
|
||||
if (currentDepositSearchPage >= maxDepositSearchPages)
|
||||
return;
|
||||
currentDepositSearchPage += 1;
|
||||
findDeposit();
|
||||
}}
|
||||
@ -307,12 +310,18 @@
|
||||
</div>
|
||||
</button></td
|
||||
>
|
||||
<td class="px-4 py-2">{orderStatusMap[dep["status"]]}</td>
|
||||
<td class="px-4">{Number(dep["summa"])} {dep["currency_code"]}</td
|
||||
<td class="px-4 py-2"
|
||||
>{orderStatusMap[dep["status"]]}</td
|
||||
>
|
||||
<td class="px-4"
|
||||
>{Number(dep["summa"])}
|
||||
{dep["currency_code"]}</td
|
||||
>
|
||||
<td class="px-4">{dep["bank_name"]}</td>
|
||||
<td class="px-4">{dep["creationtime"]}</td>
|
||||
<td class="px-4">{dep["trader_name"]} {dep["surname"]}</td>
|
||||
<td class="px-4"
|
||||
>{dep["trader_name"]} {dep["surname"]}</td
|
||||
>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
@ -334,8 +343,10 @@
|
||||
<p class="font-semibold">{foundedDispute["id"]}</p> -->
|
||||
<p class="text-sm mt-3">ID клиента</p>
|
||||
<p class="font-semibold">{selectedDispute["external_user_id"]}</p>
|
||||
<p class="text-sm mt-3">External ID</p>
|
||||
<p class="text-sm mt-3">ID депозита мерчанта</p>
|
||||
<p class="font-semibold">{selectedDispute["external_uuid"]}</p>
|
||||
<p class="text-sm mt-3">Мерчант</p>
|
||||
<p class="font-semibold">{selectedDispute["merchant_name"]}</p>
|
||||
<p class="text-sm mt-3">Статус</p>
|
||||
<p class="">{orderStatusMap[selectedDispute["status"]]}</p>
|
||||
{#if selectedDispute["token"] !== ""}
|
||||
@ -344,7 +355,10 @@
|
||||
{/if}
|
||||
{#if selectedDispute["trader_name"] !== ""}
|
||||
<p class="text-sm mt-3">Трейдер</p>
|
||||
<p>{selectedDispute["trader_name"]} {selectedDispute["surname"]}</p>
|
||||
<p>
|
||||
{selectedDispute["trader_name"]}
|
||||
{selectedDispute["surname"]}
|
||||
</p>
|
||||
{/if}
|
||||
{#if selectedDispute["close_reason"] !== ""}
|
||||
<p class="text-sm mt-3">Причина отклонения</p>
|
||||
@ -400,7 +414,9 @@
|
||||
rollbackOrder(selectedDispute["uuid"]);
|
||||
};
|
||||
alertTraderName =
|
||||
selectedDispute["trader_name"] + " " + selectedDispute["surname"];
|
||||
selectedDispute["trader_name"] +
|
||||
" " +
|
||||
selectedDispute["surname"];
|
||||
}}
|
||||
class="btn btn-outline btn-info mt-4"
|
||||
>
|
||||
@ -474,7 +490,9 @@
|
||||
changeSum(selectedDispute["uuid"]);
|
||||
};
|
||||
alertTraderName =
|
||||
selectedDispute["trader_name"] + " " + selectedDispute["surname"];
|
||||
selectedDispute["trader_name"] +
|
||||
" " +
|
||||
selectedDispute["surname"];
|
||||
}}
|
||||
class="btn btn-outline btn-info"
|
||||
>
|
||||
@ -491,7 +509,9 @@
|
||||
changeSumWithoutBalance(selectedDispute["uuid"]);
|
||||
};
|
||||
alertTraderName =
|
||||
selectedDispute["trader_name"] + " " + selectedDispute["surname"];
|
||||
selectedDispute["trader_name"] +
|
||||
" " +
|
||||
selectedDispute["surname"];
|
||||
}}
|
||||
class="btn btn-outline btn-info"
|
||||
>
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
import { getAuthInfo, makeAuthHeaderForAxios } from "$lib/auth/Auth";
|
||||
import { makePost } from "$lib/tools/requests/requests";
|
||||
import { sayError, sayInfo } from "$lib/tools/toaster/Toaster";
|
||||
import Pagination from "$lib/ui-components/pagination.svelte";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
let referrerValue = "";
|
||||
let referralValue = "";
|
||||
@ -29,7 +31,7 @@
|
||||
bid_platform: bidPlatformValue,
|
||||
},
|
||||
// @ts-ignore
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
@ -40,6 +42,73 @@
|
||||
|
||||
inProcess = false;
|
||||
}
|
||||
|
||||
let loadRefReferralValue = "";
|
||||
let loadRefReferrerValue = "";
|
||||
|
||||
let loadReferralInProgress = false;
|
||||
|
||||
let foundReferrals = [];
|
||||
let totalPages = 1;
|
||||
let currentPage = 1;
|
||||
async function loadReferral() {
|
||||
if (loadReferralInProgress) return;
|
||||
|
||||
const referrer = loadRefReferrerValue.trim();
|
||||
const referral = loadRefReferrerValue.trim();
|
||||
|
||||
loadReferralInProgress = true;
|
||||
const res = await makePost(
|
||||
"admin/users/referral/load",
|
||||
{
|
||||
referrer: referrer === "" ? undefined : referrer,
|
||||
referral: referral === "" ? undefined : referral,
|
||||
page: currentPage,
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
sayError("Не удалось получить информацию");
|
||||
} else {
|
||||
foundReferrals = res.data.data;
|
||||
totalPages = res.data.pages;
|
||||
}
|
||||
loadReferralInProgress = false;
|
||||
}
|
||||
|
||||
let selectedReferral = {};
|
||||
let showChangeRef = false;
|
||||
let newRefBid = "";
|
||||
let newRefPlatformBid = "";
|
||||
let updateInProgress = false;
|
||||
|
||||
async function updateReferral(referral_code, bid, bid_platform) {
|
||||
if (updateInProgress) return;
|
||||
|
||||
updateInProgress = true;
|
||||
const res = await makePost(
|
||||
"admin/users/referral/update",
|
||||
{
|
||||
referral_code,
|
||||
bid: Number(bid),
|
||||
bid_platform: Number(bid_platform),
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
sayError("Не удалось обновить информацию");
|
||||
} else {
|
||||
loadReferral();
|
||||
showChangeRef = false;
|
||||
}
|
||||
updateInProgress = false;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
loadReferral();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="w-full flex flex-col gap-8">
|
||||
@ -49,7 +118,7 @@
|
||||
</div>
|
||||
<div class="w-full flex flex-col p-4 rounded-box bg-base-300">
|
||||
<label class={"input input-bordered flex items-center gap-2 "}>
|
||||
Реферер UUID
|
||||
Реферер UUID:
|
||||
<input
|
||||
bind:value={referrerValue}
|
||||
type="text"
|
||||
@ -57,7 +126,7 @@
|
||||
/>
|
||||
</label>
|
||||
<label class={"input input-bordered flex items-center gap-2 mt-2"}>
|
||||
Реферал UUID
|
||||
Реферал UUID:
|
||||
<input
|
||||
bind:value={referralValue}
|
||||
type="text"
|
||||
@ -65,11 +134,15 @@
|
||||
/>
|
||||
</label>
|
||||
<label class={"input input-bordered flex items-center gap-2 mt-2"}>
|
||||
Ставка
|
||||
<input bind:value={bidValue} type="text" class="grow text-lg text-info" />
|
||||
Ставка:
|
||||
<input
|
||||
bind:value={bidValue}
|
||||
type="text"
|
||||
class="grow text-lg text-info"
|
||||
/>
|
||||
</label>
|
||||
<label class={"input input-bordered flex items-center gap-2 mt-2"}>
|
||||
Ставка платформы
|
||||
Ставка платформы:
|
||||
<input
|
||||
bind:value={bidPlatformValue}
|
||||
type="text"
|
||||
@ -89,4 +162,146 @@
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-4">
|
||||
<div class="bg-accent rounded-[4px] w-[10px] h-full"></div>
|
||||
<h1 class="text-2xl font-semibold">Информация по рефералам</h1>
|
||||
</div>
|
||||
<div class="w-full flex flex-col p-4 rounded-box bg-base-300">
|
||||
<label class={"input input-bordered flex items-center gap-2 "}>
|
||||
Реферер UUID:
|
||||
<input
|
||||
bind:value={loadRefReferralValue}
|
||||
type="text"
|
||||
class="grow text-lg text-info"
|
||||
/>
|
||||
</label>
|
||||
<label class={"input input-bordered flex items-center gap-2 mt-2"}>
|
||||
Реферал UUID:
|
||||
<input
|
||||
bind:value={loadRefReferrerValue}
|
||||
type="text"
|
||||
class="grow text-lg text-info"
|
||||
/>
|
||||
</label>
|
||||
<button
|
||||
on:click={() => {
|
||||
currentPage = 1;
|
||||
totalPages = 1;
|
||||
loadReferral();
|
||||
}}
|
||||
class="btn btn-outline btn-info mt-4"
|
||||
>
|
||||
{#if inProcess}
|
||||
<span class="loading loading-md"></span>
|
||||
{:else}
|
||||
Найти
|
||||
{/if}
|
||||
</button>
|
||||
{#if loadReferralInProgress}
|
||||
<span class="loading loading-md self-center mt-4"></span>
|
||||
{:else}
|
||||
<div class="w-full flex flex-col justify-center items-center mt-4">
|
||||
<Pagination
|
||||
{totalPages}
|
||||
pageChangedCallback={(n) => {
|
||||
currentPage = n;
|
||||
loadReferral();
|
||||
}}
|
||||
disableButtons={loadReferralInProgress}
|
||||
css={"btn-neutral"}
|
||||
/>
|
||||
<p class="opacity-50 text-xs mt-1">
|
||||
Всего страниц: {totalPages}
|
||||
</p>
|
||||
</div>
|
||||
<div class="overflow-x-auto mt-4">
|
||||
<table class="table">
|
||||
<!-- head -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Имя реферала</th>
|
||||
<th>Имя реферера</th>
|
||||
<th>Ставка</th>
|
||||
<th>Ставка платформы</th>
|
||||
<th>Опции</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each foundReferrals as ref}
|
||||
<tr class="hover:bg-neutral group">
|
||||
<td class="">{ref["referral_name"]}</td>
|
||||
<td>{ref["referrer_name"]}</td>
|
||||
<td>{ref["bid"]}%</td>
|
||||
<td>{ref["bid_platform"]}%</td>
|
||||
<td>
|
||||
<button
|
||||
class="btn btn-info btn-xs"
|
||||
on:click={() => {
|
||||
selectedReferral = ref;
|
||||
newRefBid = ref["bid"];
|
||||
newRefPlatformBid =
|
||||
ref["bid_platform"];
|
||||
showChangeRef = true;
|
||||
}}
|
||||
>
|
||||
Изменить
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if showChangeRef}
|
||||
<div
|
||||
class="fixed inset-0 z-[1001] bg-black bg-opacity-50 flex justify-center items-center"
|
||||
>
|
||||
<div class="flex flex-col p-4 bg-base-100 rounded-md gap-1">
|
||||
<p class="font-bold text-lg">
|
||||
Изменение реферала {selectedReferral.referral_name}
|
||||
</p>
|
||||
<label class={"input input-bordered flex items-center gap-2 mt-4"}>
|
||||
Ставка:
|
||||
<input
|
||||
bind:value={newRefBid}
|
||||
type="text"
|
||||
class="grow text-lg text-info"
|
||||
/>
|
||||
</label>
|
||||
<label class={"input input-bordered flex items-center gap-2 mt-2"}>
|
||||
Ставка платформы:
|
||||
<input
|
||||
bind:value={newRefPlatformBid}
|
||||
type="text"
|
||||
class="grow text-lg text-info"
|
||||
/>
|
||||
</label>
|
||||
<button
|
||||
class="btn btn-outline btn-success mt-2"
|
||||
on:click={() => {
|
||||
updateReferral(
|
||||
selectedReferral.referral_code,
|
||||
newRefBid,
|
||||
newRefPlatformBid,
|
||||
);
|
||||
}}
|
||||
>
|
||||
Сохранить
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-outline"
|
||||
on:click={() => {
|
||||
showChangeRef = false;
|
||||
selectedReferral = {};
|
||||
}}
|
||||
>
|
||||
Закрыть
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
<script>
|
||||
import { browser } from "$app/environment";
|
||||
import { getAuthInfo, makeAuthHeaderForAxios } from "$lib/auth/Auth.js";
|
||||
import { makePost } from "$lib/tools/requests/requests.js";
|
||||
import { makeGet, makePost } from "$lib/tools/requests/requests.js";
|
||||
import { toValidNumberFormat } from "$lib/tools/strings/Strings.js";
|
||||
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 CopyButton from "$lib/ui-components/CopyButton.svelte";
|
||||
import Pagination from "$lib/ui-components/pagination.svelte";
|
||||
import { get } from "ol/proj.js";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
export let data;
|
||||
let { userData } = data;
|
||||
@ -26,7 +28,7 @@
|
||||
{
|
||||
token: token,
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (result.status === 401) {
|
||||
sayError("Данные авторизации устарели");
|
||||
@ -48,7 +50,7 @@
|
||||
{
|
||||
token: token,
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (userResult.status === 401) {
|
||||
userInfoReloading = false;
|
||||
@ -80,7 +82,7 @@
|
||||
// orderBy: "uuid",
|
||||
statuses_to_send: Number(ordersFilter),
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (result.status === 401) {
|
||||
sayError("Данные авторизации устарели");
|
||||
@ -112,7 +114,7 @@
|
||||
page: Number(reqsCurrentPage),
|
||||
token: token,
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (result.status === 401) {
|
||||
sayError("Данные авторизации устарели");
|
||||
@ -147,7 +149,7 @@
|
||||
token: token,
|
||||
page: 1,
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (result.status === 401) {
|
||||
sayError("Данные авторизации устарели");
|
||||
@ -183,7 +185,7 @@
|
||||
const res = await makePost(
|
||||
"admin/find",
|
||||
{},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a)
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
}
|
||||
showLoadingFind = false;
|
||||
@ -194,6 +196,72 @@
|
||||
};
|
||||
|
||||
let showAddRef = false;
|
||||
|
||||
let showAcceptTopup = false;
|
||||
let selectedTopupOrder = {};
|
||||
let acceptedTopupHash = "";
|
||||
let acceptedTopupRate = "";
|
||||
let acceptedTopupAmount = "";
|
||||
let acceptTopupInProgress = false;
|
||||
async function acceptTopupOrder(deposit_id, usdt_rate, tx_hash, amount) {
|
||||
if (typeof tx_hash !== "string" || tx_hash.length < 32) return;
|
||||
if (acceptTopupInProgress) return;
|
||||
acceptTopupInProgress = true;
|
||||
const res = await makePost(
|
||||
"admin/trader_transactions/accept",
|
||||
{
|
||||
deposit_id,
|
||||
usdt_rate,
|
||||
tx_hash,
|
||||
amount,
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
if (res.error) {
|
||||
sayError("Не удалось принять депозит");
|
||||
} else {
|
||||
sayInfo("Депозит успешно принят");
|
||||
}
|
||||
acceptTopupInProgress = false;
|
||||
getUserDeposits();
|
||||
showAcceptTopup = false;
|
||||
}
|
||||
|
||||
let loadingDeclineTopup = false;
|
||||
async function declineTopupOrder(deposit_id) {
|
||||
if (loadingDeclineTopup) return;
|
||||
loadingDeclineTopup = true;
|
||||
const res = await makePost(
|
||||
"admin/trader_transactions/decline",
|
||||
{
|
||||
deposit_id,
|
||||
},
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
sayError("Не удалось отклонить депозит");
|
||||
} else {
|
||||
sayInfo("Депозит успешно отклонён");
|
||||
}
|
||||
loadingDeclineTopup = false;
|
||||
getUserDeposits();
|
||||
}
|
||||
let rates = {};
|
||||
async function getRate() {
|
||||
const res = await makeGet(
|
||||
"rate",
|
||||
makeAuthHeaderForAxios(getAuthInfo()?.a),
|
||||
);
|
||||
console.log(res);
|
||||
if (res.data) {
|
||||
rates = res.data;
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
getRate();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="w-full flex flex-col gap-8">
|
||||
@ -208,7 +276,9 @@
|
||||
<div
|
||||
class="bg-base-300 rounded-t-box p-4 pb-2 border-2 border-b-0 border-base-300"
|
||||
>
|
||||
<p class="text-lg font-semibold leading-none">Основная информация</p>
|
||||
<p class="text-lg font-semibold leading-none">
|
||||
Основная информация
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="flex flex-col p-4 gap-2 border-2 border-t-0 rounded-b-box border-base-300"
|
||||
@ -229,7 +299,9 @@
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<p class="opacity-50 text-xs">Валюта</p>
|
||||
<p class="text-accent font-semibold">{userData?.code}</p>
|
||||
<p class="text-accent font-semibold">
|
||||
{userData?.code}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<p class="opacity-50 text-xs">Торговля</p>
|
||||
@ -238,7 +310,9 @@
|
||||
? "text-primary font-semibold"
|
||||
: "text-error font-semibold"}
|
||||
>
|
||||
{userData["can_trade"] === "t" ? "Активна" : "Отключена"}
|
||||
{userData["can_trade"] === "t"
|
||||
? "Активна"
|
||||
: "Отключена"}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
@ -276,7 +350,9 @@
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<p class="opacity-50 text-xs">Страховка</p>
|
||||
<p class="text-accent font-semibold">{userData?.insurance} USDT</p>
|
||||
<p class="text-accent font-semibold">
|
||||
{userData?.insurance} USDT
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<p class="opacity-50 text-xs">Ставка</p>
|
||||
@ -284,7 +360,9 @@
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<p class="opacity-50 text-xs">Ставка на выплаты</p>
|
||||
<p class="text-accent font-semibold">{userData.payout_bid}%</p>
|
||||
<p class="text-accent font-semibold">
|
||||
{userData.payout_bid}%
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<p class="opacity-50 text-xs">Кошелёк пополнения</p>
|
||||
@ -318,14 +396,16 @@
|
||||
>
|
||||
<a
|
||||
href={`/admin/change-balance/${token}`}
|
||||
class="btn btn-neutral btn-outline rounded-lg btn-sm">Изменить баланс</a
|
||||
class="btn btn-neutral btn-outline rounded-lg btn-sm"
|
||||
>Изменить баланс</a
|
||||
>
|
||||
<button
|
||||
on:click={() => {
|
||||
if (confirm("Вы уверены, что хотите удалить пользователя?"))
|
||||
deleteUser();
|
||||
}}
|
||||
class="btn btn-error btn-outline rounded-lg btn-sm">Удалить</button
|
||||
class="btn btn-error btn-outline rounded-lg btn-sm"
|
||||
>Удалить</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@ -427,7 +507,9 @@
|
||||
disableButtons={disablePagesUserOrders}
|
||||
css={"btn-neutral mt-2"}
|
||||
/>
|
||||
<p class="opacity-50 text-xs mt-1">Всего страниц: {numPagesUserOrders}</p>
|
||||
<p class="opacity-50 text-xs mt-1">
|
||||
Всего страниц: {numPagesUserOrders}
|
||||
</p>
|
||||
<select
|
||||
bind:value={ordersFilter}
|
||||
class="select select-bordered min-w-[230px] mt-2"
|
||||
@ -464,9 +546,14 @@
|
||||
<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["external_user_id"]}</td>
|
||||
<td class="font-semibold"
|
||||
>{order["external_user_id"]}</td
|
||||
>
|
||||
<td class="">{order["status"]}</td>
|
||||
<td>{toValidNumberFormat(order["summa"])} {userData?.code}</td>
|
||||
<td
|
||||
>{toValidNumberFormat(order["summa"])}
|
||||
{userData?.code}</td
|
||||
>
|
||||
<td>{orderTypesMap[order["order_type"]]}</td>
|
||||
<!-- <td>{order["rate"]} {userData?.code}</td> -->
|
||||
<!-- <td>{order["is_sbp"] === "t" ? "да" : "нет"}</td> -->
|
||||
@ -506,6 +593,9 @@
|
||||
Всего страниц: {numOfPagesUserDeposits}
|
||||
</p>
|
||||
</div>
|
||||
{#if disablePagesUserDeposits}
|
||||
<span class="loading loading-md self-center"></span>
|
||||
{:else}
|
||||
<div class="overflow-x-auto mt-4">
|
||||
<table class="table">
|
||||
<!-- head -->
|
||||
@ -514,25 +604,72 @@
|
||||
<th>Статус</th>
|
||||
<th>Сумма</th>
|
||||
<th>Время создания</th>
|
||||
<!-- <th>Опции</th> -->
|
||||
<th>Опции</th>
|
||||
<!-- <th></th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each userDeposits as depo}
|
||||
<tr class="hover:bg-neutral group">
|
||||
<td class="">{depoStatusMap[depo["pending"]]}</td>
|
||||
<td>{toValidNumberFormat(depo["amount"])} USDT</td>
|
||||
<td
|
||||
class={`${depo["pending"] === "0" ? "text-info" : depo["pending"] === "1" ? "text-success" : "text-error"}`}
|
||||
>{depoStatusMap[depo["pending"]]}</td
|
||||
>
|
||||
<td
|
||||
>{toValidNumberFormat(depo["amount"])} USDT</td
|
||||
>
|
||||
<td>{depo["creationtime"]}</td>
|
||||
<!-- <td class="flex gap-2">
|
||||
<a href="" class="btn btn-info">Изменить</a>
|
||||
<button class="btn btn-error">Удалить</button>
|
||||
</td> -->
|
||||
<td>
|
||||
<div class="flex gap-2">
|
||||
{#if depo.pending === "0"}
|
||||
<button
|
||||
on:click={() => {
|
||||
selectedTopupOrder = depo;
|
||||
acceptedTopupAmount =
|
||||
depo["amount"];
|
||||
try {
|
||||
acceptedTopupRate =
|
||||
rates[
|
||||
userData.code
|
||||
];
|
||||
} catch (e) {}
|
||||
showAcceptTopup = true;
|
||||
}}
|
||||
class="btn btn-success btn-xs min-w-20"
|
||||
>
|
||||
{#if acceptTopupInProgress}
|
||||
<span
|
||||
class="loading loading-sm"
|
||||
></span>
|
||||
{:else}
|
||||
Принять
|
||||
{/if}
|
||||
</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
declineTopupOrder(
|
||||
depo["uuid"],
|
||||
);
|
||||
}}
|
||||
class="btn btn-error btn-xs min-w-20"
|
||||
>
|
||||
{#if loadingDeclineTopup}
|
||||
<span
|
||||
class="loading loading-sm"
|
||||
></span>
|
||||
{:else}
|
||||
Отклонить
|
||||
{/if}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -543,6 +680,71 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if showAcceptTopup}
|
||||
<div class="fixed inset-0 bg-black opacity-60"></div>
|
||||
<div class="fixed inset-0 bg-transparent flex justify-center items-center">
|
||||
<div
|
||||
class="bg-base-300 rounded-md p-4 w-full max-w-[400px] flex flex-col gap-2"
|
||||
>
|
||||
<p class="font-bold text-lg">
|
||||
Принятие завяки {selectedTopupOrder.amount} USDT
|
||||
</p>
|
||||
<label class={"input input-bordered flex items-center gap-2 mt-4"}>
|
||||
Хэш:
|
||||
<input
|
||||
bind:value={acceptedTopupHash}
|
||||
type="text"
|
||||
class="grow text-info text-sm"
|
||||
/>
|
||||
</label>
|
||||
<label class={"input input-bordered flex items-center gap-2 mt-2"}>
|
||||
Курс USDT:
|
||||
<input
|
||||
bind:value={acceptedTopupRate}
|
||||
type="text"
|
||||
class="grow text-lg text-info"
|
||||
/>
|
||||
</label>
|
||||
<label class={"input input-bordered flex items-center gap-2 mt-2"}>
|
||||
Сумма USDT:
|
||||
<input
|
||||
bind:value={acceptedTopupAmount}
|
||||
type="text"
|
||||
class="grow text-lg text-info"
|
||||
/>
|
||||
</label>
|
||||
<div class="flex flex-col gap-1">
|
||||
<button
|
||||
class="btn btn-outline btn-success"
|
||||
on:click={() => {
|
||||
// selectedTopupOrder = {};
|
||||
// showAcceptTopup = false;
|
||||
acceptTopupOrder(
|
||||
selectedTopupOrder.uuid,
|
||||
acceptedTopupRate,
|
||||
acceptedTopupHash,
|
||||
acceptedTopupAmount,
|
||||
);
|
||||
}}
|
||||
>
|
||||
{#if acceptTopupInProgress}
|
||||
<span class="loading loading-sm"></span>
|
||||
{:else}
|
||||
Принять
|
||||
{/if}
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-outline"
|
||||
on:click={() => {
|
||||
selectedTopupOrder = {};
|
||||
showAcceptTopup = false;
|
||||
}}>Закрыть</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- {#if showFoundedOrderWindow}
|
||||
<div class="fixed z-[1000] inset-0 flex justify-center items-center bg-black bg-opacity-50">
|
||||
<div class="bg-base-100 rounded-md p-4 flex flex-col">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user