From 666f205f16ab16b820019d38da9519dbcae5af4f Mon Sep 17 00:00:00 2001 From: zhangrenyuan <18990852002@163.com> Date: Wed, 10 Dec 2025 09:34:27 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD=E5=8F=8A?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/language/languageTranslate.vue | 108 +++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 35 deletions(-) diff --git a/src/views/language/languageTranslate.vue b/src/views/language/languageTranslate.vue index e1c92e0..113f471 100644 --- a/src/views/language/languageTranslate.vue +++ b/src/views/language/languageTranslate.vue @@ -19,7 +19,7 @@
添加 - + 批量导入
@@ -148,16 +148,9 @@
- +
@@ -167,9 +160,7 @@ + :close-on-click-modal="false" style="background-color: rgb(243,250,254);"> @@ -206,21 +197,16 @@ - -
- 下载导入模板: - 中文/英文/泰语/繁体中文/马来语/越南语模板 -
- - + +
将文件拖到此处,或点击上传
@@ -273,7 +259,9 @@ const editForm = ref({ configTime: new Date() }) - +// 导入相关变量 +const uploadFile = ref(null) +const importLoading = ref(false) // 方法定义 防御性编程:函数内部再次检查可以确保即使在其他调用场景中也能正确处理数据 const truncateText = (text) => { @@ -472,22 +460,72 @@ const handleBatchImport = () => { showImportDialog.value = true } -// 下载模板 -const downloadTemplate = () => { - // 这里实现下载模板的逻辑 - ElMessage.info('模板下载功能待实现') -} - // 文件变化处理 const handleFileChange = (file) => { - // 这里处理文件上传逻辑 - console.log('文件变化:', file) + // 验证文件类型 + if (file.raw.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' && + file.raw.type !== 'application/vnd.ms-excel') { + ElMessage.error('只能上传Excel文件') + return + } + // 验证文件大小(限制为5MB) + if (file.raw.size > 5 * 1024 * 1024) { + ElMessage.error('文件大小不能超过5MB') + return + } + // 存储文件 + uploadFile.value = file.raw + ElMessage.success('文件选择成功') } +// 添加文件超出限制的处理函数 +const handleExceed = (files, fileList) => { + ElMessage.warning('最多只能上传一个文件'); +}; + // 导入处理 -const handleImport = () => { - // 这里实现导入逻辑 - ElMessage.info('导入功能待实现') +const handleImport = async () => { + if (!uploadFile.value) { + ElMessage.warning('请先选择要导入的文件') + return + } + + importLoading.value = true + + try { + const formData = new FormData() + formData.append('file', uploadFile.value) + + const res = await request({ + url: '/language/batchImport', + method: 'POST', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' // 重要:设置正确的请求头 + } + }) + + if (res.code === 200) { + ElMessage.success(`导入成功`) + // 刷新菜单树(与保存、删除操作保持一致) + await getMenuTree() + // 触发页面刷新以重新加载数据 + setTimeout(() => { + window.location.reload() + }, 500) + // 关闭导入对话框 + showImportDialog.value = false + // 清空上传文件 + uploadFile.value = null + } else { + ElMessage.error(res.msg || '导入失败') + } + } catch (error) { + console.error('导入失败:', error) + ElMessage.error('导入失败,请检查网络或文件格式') + } finally { + importLoading.value = false + } } // 分页处理 From 8390e117c3d48bf25d27e03215fbcd8e1b5593a1 Mon Sep 17 00:00:00 2001 From: zhangrenyuan <18990852002@163.com> Date: Wed, 10 Dec 2025 14:22:23 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BA=A2=E5=8C=85=E4=BD=BF=E7=94=A8=E9=80=89=E9=A1=B9=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BE=93=E5=85=A5=E9=AA=8C=E8=AF=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/consume/gold/addCoinConsume.vue | 51 ++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/src/views/consume/gold/addCoinConsume.vue b/src/views/consume/gold/addCoinConsume.vue index a300c4e..57735ca 100644 --- a/src/views/consume/gold/addCoinConsume.vue +++ b/src/views/consume/gold/addCoinConsume.vue @@ -64,7 +64,8 @@ const addConsume = ref({ taskGold: null, // 任务金币 remark: "",//备注 adminId: null,// 当前管理员id - adminName: adminData.value.adminName + adminName: adminData.value.adminName, + redMoney: 1 // 是否使用红包:1-使用,0-不使用 }) const Ref = ref(null) const rules = reactive({ @@ -163,11 +164,16 @@ function validateInput() { // 验证金币总和 const totalAvailableGold = (user.value.nowSumGold) + // 如果未勾选使用红包,则只校验消耗金币数是否超过可用金币数 if (user.value.jwcode && sumGold > totalAvailableGold) { - ElMessage.error(t('elmessage.limitExceeded')); - // 将sumGold设置为null - addConsume.value.sumGold = null; - return false; + // 如果未勾选使用红包,直接提示金币不足 + if (addConsume.value.redMoney == 0) { + ElMessage.error(t('elmessage.limitExceeded')); + // 将sumGold设置为null + addConsume.value.sumGold = null; + return false; + } + // 如果勾选使用红包,且不满足原价条件,则会在validateRedLimit中提示 } return true; @@ -183,9 +189,12 @@ function validateRedLimit() { ElMessage.error(t('elmessage.noEmptySumGold')); return false; } - if (sumGold + redMax < price) { - ElMessage.error(t('elmessage.limitRedAmount')); - return false; + // 如果勾选使用红包,才需要校验消耗金币数 + 红包抵扣金额 ≥ 原价 + if (addConsume.value.redMoney == 1) { + if (sumGold + redMax < price) { + ElMessage.error(t('elmessage.limitRedAmount')); + return false; + } } } return true; @@ -267,14 +276,15 @@ const add = async function () { permanentGold: addConsume.value.permanentGold * 100, goodsName: addConsume.value.goodsName.value, remark: addConsume.value.remark, - adminName: adminData.value.adminName + adminName: adminData.value.adminName, + redMoney: Number(addConsume.value.redMoney) // 1-使用红包,0-不使用红包 } }) addDisabled.value = false console.log("add请求", result); // 处理响应 handleResponse(result); -// 重置表单 + // 重置表单 resetForm(); } catch (error) { @@ -319,6 +329,7 @@ function resetForm() { remark: "", adminId: adminData.value.id, adminName: adminData.value.adminName, + redMoney: 1 // 默认使用红包 } console.log("重置表单") @@ -592,9 +603,14 @@ onMounted(async function () { - + + + + 使用红包 + 不使用红包 @@ -623,10 +639,10 @@ onMounted(async function () { {{ t('common.reset') - }} + }} {{ t('common.submit') - }} + }}
@@ -674,7 +690,7 @@ onMounted(async function () {

({{ $t('common_add_user.onlyStatisticsDataAfter20250101') - }}) + }})

@@ -767,8 +783,8 @@ onMounted(async function () { - +
@@ -819,7 +835,8 @@ onMounted(async function () {

{{ $t('common_add.similarRechargeRecords') }}

- · {{ ReadCookiesTime }} {{ $t('common_add.buy') }} 【{{ addConsume.goodsName.value }}】({{ $t('common_add.operator') }}: {{ adminData.adminName }}) + · {{ ReadCookiesTime }} {{ $t('common_add.buy') }} 【{{ addConsume.goodsName.value }}】({{ + $t('common_add.operator') }}: {{ adminData.adminName }})

{{ $t('common_add.continueOperation') }}

From ecd77996d50d4255b992d0847c925d0d2fed6a48 Mon Sep 17 00:00:00 2001 From: zhangrenyuan <18990852002@163.com> Date: Wed, 10 Dec 2025 18:50:17 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E2=9C=A8=20feat:=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=94=AF=E6=8C=81=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=B7=A5=E4=BD=9C=E5=8F=B0=E7=BB=84=E4=BB=B6=E6=96=87?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/locales/lang/zh-CN.js | 82 +++++++++++++++++++++++++++ src/components/workspace/CashManagement.vue | 46 ++++++++------- src/components/workspace/GoldGraph.vue | 73 ++++++++++++------------ src/components/workspace/GoldGraphMarkets.vue | 57 ++++++++++--------- src/components/workspace/GoldManagement.vue | 56 +++++++++--------- src/views/workspace/index.vue | 7 ++- 6 files changed, 210 insertions(+), 111 deletions(-) diff --git a/src/components/locales/lang/zh-CN.js b/src/components/locales/lang/zh-CN.js index 734d19f..22f0350 100644 --- a/src/components/locales/lang/zh-CN.js +++ b/src/components/locales/lang/zh-CN.js @@ -150,6 +150,10 @@ export default { executed: '执行完成', errorExecution: '执行出错', unknownStatus: '未知状态', + // 获取 + getMarketListFailed: '获取市场列表失败,请稍后重试', + getChartDataFailed: '获取图表数据失败,请稍后重试', + renderChartFailed: '图表渲染失败,请稍后重试', }, // 通用列表字段组 @@ -425,4 +429,82 @@ export default { refund: '退款', } }, + + // 工作台组 + workbench: { + // 头部 + dataOverview: '数据总览', + loading: '加载中...', + // 现金管理 + cashManagement: '现金管理', + dataExplanationTitle: '数据说明', + dataExplanationContent: '此数据实时计算,存在误差,请勿作为最终数据使用。', + totalRevenue: '总营收', + SGD: '新币', + collect: '代收', + Singapore: '新加坡', + Malaysia: '马来西亚', + HongKong: '香港', + Thailand: '泰国', + VietnamHCM: '越南HCM', + Canada: '加拿大', + MYR: '马币', + HKD: '港币', + CAD: '加币', + THB: '泰铢', + VND: '越南盾', + // 金币管理 + goldManagement: '金币管理', + lastUpdateTime: '最后更新时间:', + noData: '该地区暂无数据', + // card1 + currentGoldBalance: '当前金币余量', + compareToPreviousDay: '较前一日', + permanentGold: '永久金币', + freeGold: '免费金币', + taskGold: '任务金币', + goldExpireIn6Months: '6月到期:', + goldExpireIn12Months: '12月到期:', + // card2 + annualCumulativeRecharge: '全年累计充值金币数:', + convertedSGDCumulativeAmount: '折合新币累计金额:', + yesterdayNew: '昨日新增金币:', + wherePermanentGold: '其中永久金币:', + // card3 + annualCumulativeConsume: '全年累计消费金币数:', + consume: '消耗:', + refund: '退款:', + yesterdayNewAll: '昨日新增消费:', + yesterdayNewConsume: '昨日新增消耗:', + yesterdayNewRefund: '昨日新增退款:', + // card4 + annualCumulativeRechargePeople: '全年累计充值人头数:', + weekYearOnYear: '周同比:', + dayYearOnYear: '日同比:', + yesterdayRechargePeople: '昨日充值人数:', + whereFirstRecharge: '其中首充:', + // 总部/研发部,地区表 + coinRecharge: '金币充值', + coinConsume: '金币消费', + total: '合计:', + yesterday: '昨天', + today: '今天', + thisWeek: '本周', + thisMonth: '本月', + thisYear: '本年', + startTime: '开始时间', + endTime: '结束时间', + query: '查询', + // 筛选统计表 + gold: '金币', + recharge: '充值', + consume: '消费', + rank: '排名', + allTypes: '全部类型', + region: '地区', + goldCount: '金币数量', + all: '总', + marketTitle: '数据说明', + marketContent: '若统计周期跨越 40 天以上,将展示月份维度的数据。', + } } \ No newline at end of file diff --git a/src/components/workspace/CashManagement.vue b/src/components/workspace/CashManagement.vue index b488801..bb397dc 100644 --- a/src/components/workspace/CashManagement.vue +++ b/src/components/workspace/CashManagement.vue @@ -2,16 +2,16 @@
- 现金管理 + {{ t('workbench.cashManagement') }}