diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json
index 0ba04a7..64b5340 100644
--- a/src/locales/zh-CN.json
+++ b/src/locales/zh-CN.json
@@ -149,6 +149,60 @@
},
"trade": {
"title": "交易",
+ "spot": "现货",
+ "buy": "买入",
+ "sell": "卖出",
+ "signIn": "请先登录",
+ "form": {
+ "price": "价格",
+ "quantity": "数量",
+ "amount": "金额",
+ "enterPrice": "请输入价格",
+ "enterQuantity": "请输入交易数量",
+ "enterAmount": "请输入交易金额"
+ },
+ "orderType": {
+ "baseOrder": "基础委托",
+ "limit": "限价委托",
+ "limitDesc": "以指定价格买入或卖出",
+ "market": "市价委托",
+ "marketDesc": "以市场价格买入或卖出",
+ "moreTypes": "更多委托类型,敬请期待"
+ },
+ "confirm": {
+ "title": "下单确认",
+ "orderPrice": "委托价格",
+ "quantity": "数量",
+ "amount": "金额",
+ "type": "类型",
+ "confirm": "确认下单",
+ "success": "订单提交成功"
+ },
+ "orders": {
+ "current": "当前委托",
+ "history": "历史记录",
+ "cancel": "撤单",
+ "cancelConfirm": "取消订单",
+ "cancelMessage": "确定要取消该订单吗?",
+ "cancelSuccess": "订单已取消",
+ "filled": "成交",
+ "total": "总额"
+ },
+ "status": {
+ "pending": "待处理",
+ "open": "已挂单",
+ "partialFilled": "部分成交",
+ "filled": "已完成",
+ "cancelled": "已取消",
+ "rejected": "已拒绝"
+ },
+ "validation": {
+ "quantityRequired": "请输入有效的数量",
+ "quantityMin": "数量必须大于0",
+ "priceRequired": "请输入有效的价格",
+ "priceMin": "价格必须大于0",
+ "orderTypeRequired": "请选择有效的交易方式"
+ },
"settings": {
"bankManagement": "银行卡管理",
"mySubscribe": "我的申购",
@@ -443,7 +497,9 @@
"files": "个文件",
"today": "今天",
"yesterday": "昨天",
- "items": "项"
+ "items": "项",
+ "confirm": "确定",
+ "cancel": "取消"
},
"fileUpload": {
"uploadFile": "上传文件",
diff --git a/src/views/trade/components/confirm-order.vue b/src/views/trade/components/confirm-order.vue
index a7cf026..bad5f66 100644
--- a/src/views/trade/components/confirm-order.vue
+++ b/src/views/trade/components/confirm-order.vue
@@ -9,6 +9,7 @@ import { tradeWayConfig } from "../config";
const props = defineProps<{
form: SpotOrderBody & { amount: string };
}>();
+const { t } = useI18n();
const currentTradeWay = computed(() => {
return tradeWayConfig.find(item => item.value === props.form.orderType);
});
@@ -27,7 +28,7 @@ async function onConfirm() {
}));
tradeEvent.trigger();
const toast = await toastController.create({
- message: "订单提交成功",
+ message: t("trade.confirm.success"),
duration: 2000,
position: "top",
color: "success",
@@ -41,7 +42,7 @@ async function onConfirm() {
- 下单确认
+ {{ t('trade.confirm.title') }}
@@ -51,13 +52,13 @@ async function onConfirm() {
{{ form.symbol }}
- {{ form.side === 'buy' ? '买入' : '卖出' }}
+ {{ form.side === 'buy' ? t('trade.buy') : t('trade.sell') }}
- 委托价格
+ {{ t('trade.confirm.orderPrice') }}
{{ form.price }} USDT
@@ -65,7 +66,7 @@ async function onConfirm() {
- 数量
+ {{ t('trade.confirm.quantity') }}
{{ form.quantity }}
@@ -73,7 +74,7 @@ async function onConfirm() {
- 金额
+ {{ t('trade.confirm.amount') }}
{{ form.amount }} USDT
@@ -81,10 +82,10 @@ async function onConfirm() {
- 类型
+ {{ t('trade.confirm.type') }}
- {{ currentTradeWay?.name }}
+ {{ t(`trade.orderType.${currentTradeWay?.value}`) }}
@@ -92,7 +93,7 @@ async function onConfirm() {
- 委托价格
+ {{ t('trade.confirm.orderPrice') }}
{{ form.price }} USDT
@@ -100,7 +101,7 @@ async function onConfirm() {
- 数量
+ {{ t('trade.confirm.quantity') }}
{{ form.quantity }}
@@ -111,7 +112,7 @@ async function onConfirm() {
- 确认下单
+ {{ t('trade.confirm.confirm') }}
diff --git a/src/views/trade/components/order-card.vue b/src/views/trade/components/order-card.vue
index 2b70c3a..dab2ffc 100644
--- a/src/views/trade/components/order-card.vue
+++ b/src/views/trade/components/order-card.vue
@@ -8,6 +8,7 @@ type Item = Treaty.Data
["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') }}
{{ item.symbol }}
- {{ orderStatusMap[item.status].text }}
+ {{ t(`trade.status.${item.status === 'partial_filled' ? 'partialFilled' : item.status}`) }}
- {{ currentTradeWay?.name }}
+ {{ t(`trade.orderType.${currentTradeWay?.value}`) }}
{{ item.orderType === 'limit' ? Number(item.price).toString() : '-' }}
- 数量
+ {{ t('trade.confirm.quantity') }}
{{ Number(item.quantity).toString() }}
- 成交
+ {{ t('trade.orders.filled') }}
{{ Number(item.price).toString() }}
- 总额
+ {{ t('trade.orders.total') }}
{{ Number(item.totalAmount).toString() }} USDT
diff --git a/src/views/trade/components/orders-panel.vue b/src/views/trade/components/orders-panel.vue
index d8529ed..00836e6 100644
--- a/src/views/trade/components/orders-panel.vue
+++ b/src/views/trade/components/orders-panel.vue
@@ -4,17 +4,17 @@ import OrderList from "./order-list.vue";
type TabType = "current" | "history";
const props = defineProps<{ symbol: string }>();
-
+const { t } = useI18n();
const activeTab = ref("current");
-
+
-
+
diff --git a/src/views/trade/components/trade-switch.vue b/src/views/trade/components/trade-switch.vue
index e658118..cf784f5 100644
--- a/src/views/trade/components/trade-switch.vue
+++ b/src/views/trade/components/trade-switch.vue
@@ -4,15 +4,16 @@ import type { PropType } from "vue";
type Active = "buy" | "sell";
const active = defineModel
("active", { type: String as PropType, default: "buy" });
+const { t } = useI18n();
- 买入
+ {{ t('trade.buy') }}
- 卖出
+ {{ t('trade.sell') }}
diff --git a/src/views/trade/components/trade-way.vue b/src/views/trade/components/trade-way.vue
index de30de2..9b344d3 100644
--- a/src/views/trade/components/trade-way.vue
+++ b/src/views/trade/components/trade-way.vue
@@ -7,6 +7,7 @@ import { caretDownOutline } from "ionicons/icons";
import { tradeWayConfig } from "../config";
const model = defineModel({ type: Object as PropType, required: true });
+const { t } = useI18n();
const currentTradeWay = computed(() => {
return tradeWayConfig.find(item => item.value === model.value.orderType);
});
@@ -29,7 +30,7 @@ function onSelectTradeWay(item: TradeWayConfig) {
- 基础委托
+ {{ t('trade.orderType.baseOrder') }}
@@ -37,10 +38,10 @@ function onSelectTradeWay(item: TradeWayConfig) {
- {{ item.name }}
+ {{ t(`trade.orderType.${item.value}`) }}
- {{ item.description }}
+ {{ t(`trade.orderType.${item.value}Desc`) }}
@@ -55,7 +56,7 @@ function onSelectTradeWay(item: TradeWayConfig) {
- 更多委托类型,敬请期待
+ {{ t('trade.orderType.moreTypes') }}
diff --git a/src/views/trade/index.vue b/src/views/trade/index.vue
index bc0a5fd..9555091 100644
--- a/src/views/trade/index.vue
+++ b/src/views/trade/index.vue
@@ -30,6 +30,7 @@ const tradingViewInst = useTemplateRef
("tradingViewInst");
const confirmModalInst = useTemplateRef("confirmModalInst");
const userStore = useUserStore();
const router = useRouter();
+const { t } = useI18n();
const [form, reset] = useResetRef({
orderType: TradeWayValueEnum.LIMIT,
@@ -136,7 +137,7 @@ function signIn() {
{{ symbol }}
- 现货
+ {{ t('trade.spot') }}
@@ -158,31 +159,28 @@ function signIn() {
form.side = val" />
-
+
USDT
-
+
{{ symbol }}
-
+
USDT
-
-
+
{{ symbol }}
- {{ mode === TradeTypeEnum.BUY ? '买入' : '卖出' }}
+ {{ mode === TradeTypeEnum.BUY ? t('trade.buy') : t('trade.sell') }}
- 请先登录
+ {{ t('trade.signIn') }}