feat(i18n): 添加交易相关的本地化支持,包括订单确认、撤单和交易方式等翻译
This commit is contained in:
@@ -8,6 +8,7 @@ type Item = Treaty.Data<typeof client.api.spot_order.list.get>["data"][number];
|
||||
|
||||
const props = defineProps<{ item: Item; showCancel?: boolean }>();
|
||||
const emit = defineEmits<{ refresh: [] }>();
|
||||
const { t } = useI18n();
|
||||
|
||||
const currentTradeWay = computed(() => {
|
||||
return tradeWayConfig.find(item => item.value === props.item.orderType);
|
||||
@@ -15,15 +16,15 @@ const currentTradeWay = computed(() => {
|
||||
|
||||
async function cancelOrder(orderId: string) {
|
||||
const alert = await alertController.create({
|
||||
header: "取消订单",
|
||||
message: "确定要取消该订单吗?",
|
||||
header: t("trade.orders.cancelConfirm"),
|
||||
message: t("trade.orders.cancelMessage"),
|
||||
buttons: [
|
||||
{
|
||||
text: "取消",
|
||||
text: t("trade.orders.cancel"),
|
||||
role: "cancel",
|
||||
},
|
||||
{
|
||||
text: "确定",
|
||||
text: t("common.confirm"),
|
||||
role: "destructive",
|
||||
handler: async () => {
|
||||
await safeClient(client.api.spot_order.cancel.post({ orderId }));
|
||||
@@ -31,7 +32,7 @@ async function cancelOrder(orderId: string) {
|
||||
await alert.dismiss();
|
||||
const toast = await toastController
|
||||
.create({
|
||||
message: "订单已取消",
|
||||
message: t("trade.orders.cancelSuccess"),
|
||||
duration: 2000,
|
||||
position: "bottom",
|
||||
color: "success",
|
||||
@@ -55,11 +56,11 @@ async function cancelOrder(orderId: string) {
|
||||
? 'bg-success/10 text-(--ion-color-success)'
|
||||
: 'bg-danger/10 text-(--ion-color-danger)'"
|
||||
>
|
||||
{{ item.side === 'buy' ? '买入' : '卖出' }}
|
||||
{{ item.side === 'buy' ? t('trade.buy') : t('trade.sell') }}
|
||||
</span>
|
||||
<span class="text-sm font-medium">{{ item.symbol }}</span>
|
||||
<ion-badge :color="orderStatusMap[item.status].color" class="text-[10px] px-1.5 py-0.5">
|
||||
{{ orderStatusMap[item.status].text }}
|
||||
{{ t(`trade.status.${item.status === 'partial_filled' ? 'partialFilled' : item.status}`) }}
|
||||
</ion-badge>
|
||||
</div>
|
||||
<button
|
||||
@@ -67,25 +68,25 @@ async function cancelOrder(orderId: string) {
|
||||
class="px-3 py-1 bg-transparent border border-(--ion-color-danger) text-(--ion-color-danger) rounded-md text-xs transition-all active:bg-(--ion-color-danger) active:text-white"
|
||||
@click="cancelOrder(item.id)"
|
||||
>
|
||||
撤单
|
||||
{{ t('trade.orders.cancel') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-2 mb-2">
|
||||
<div class="flex justify-between text-xs">
|
||||
<span class="text-(--ion-text-color-step-400)">{{ currentTradeWay?.name }}</span>
|
||||
<span class="text-(--ion-text-color-step-400)">{{ t(`trade.orderType.${currentTradeWay?.value}`) }}</span>
|
||||
<span class="text-(--ion-text-color) font-medium">{{ item.orderType === 'limit' ? Number(item.price).toString() : '-' }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-xs">
|
||||
<span class="text-(--ion-text-color-step-400)">数量</span>
|
||||
<span class="text-(--ion-text-color-step-400)">{{ t('trade.confirm.quantity') }}</span>
|
||||
<span class="text-(--ion-text-color) font-medium">{{ Number(item.quantity).toString() }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-xs">
|
||||
<span class="text-(--ion-text-color-step-400)">成交</span>
|
||||
<span class="text-(--ion-text-color-step-400)">{{ t('trade.orders.filled') }}</span>
|
||||
<span class="text-(--ion-text-color) font-medium">{{ Number(item.price).toString() }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-xs">
|
||||
<span class="text-(--ion-text-color-step-400)">总额</span>
|
||||
<span class="text-(--ion-text-color-step-400)">{{ t('trade.orders.total') }}</span>
|
||||
<span class="text-(--ion-text-color) font-medium">{{ Number(item.totalAmount).toString() }} USDT</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user