From d104286a3755b18462de96b47e6d7cb9fdcf17cb Mon Sep 17 00:00:00 2001 From: li Date: Sat, 14 Mar 2026 23:10:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20H5=20=E8=B4=A6=E6=88=B7=E4=BD=99?= =?UTF-8?q?=E9=A2=9D=E4=B8=8E=E6=8A=95=E8=AF=89=E6=8F=90=E4=BA=A4=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/api/index.js | 2 +- client/src/views/my/Account.vue | 4 ++-- client/src/views/my/Complaints.vue | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/client/src/api/index.js b/client/src/api/index.js index b03ab3e..bb7883a 100644 --- a/client/src/api/index.js +++ b/client/src/api/index.js @@ -24,7 +24,7 @@ export const mealApi = { } export const accountApi = { - index: () => clientRequest.get('/account/'), + index: () => clientRequest.get('/account'), transactions: (params) => clientRequest.get('/account/transactions', { params }), } diff --git a/client/src/views/my/Account.vue b/client/src/views/my/Account.vue index b8f5a40..a2ed298 100644 --- a/client/src/views/my/Account.vue +++ b/client/src/views/my/Account.vue @@ -26,12 +26,12 @@ onMounted(async () => {

现金余额

-

¥ {{ (account.cash_balance || 0).toFixed(2) }}

+

¥ {{ Number(account.cash_balance ?? 0).toFixed(2) }}

储值卡余额

-

¥ {{ (account.card_balance || 0).toFixed(2) }}

+

¥ {{ Number(account.card_balance ?? 0).toFixed(2) }}

diff --git a/client/src/views/my/Complaints.vue b/client/src/views/my/Complaints.vue index b2c9a29..8fa862a 100644 --- a/client/src/views/my/Complaints.vue +++ b/client/src/views/my/Complaints.vue @@ -17,8 +17,10 @@ const typeOptions = [ { text: '其他', value: '其他' }, ] -const statusLabel = { 1: '待处理', 2: '处理中', 3: '已解决' } -const statusColor = { 1: 'warning', 2: 'primary', 3: 'success' } +const statusLabel = { 0: '待处理', 1: '处理中', 2: '已解决', 3: '已关闭' } +const statusColor = { 0: 'warning', 1: 'primary', 2: 'success', 3: 'default' } + +const typeLabel = { 1: '服务质量', 2: '餐饮问题', 3: '环境卫生', 4: '其他' } onMounted(fetchList) @@ -37,7 +39,14 @@ async function submit() { } submitting.value = true try { - await complaintApi.create(form.value) + // 后端 complaints.type 是 tinyInteger,这里把中文选项映射为数字 + const typeMap = { '服务质量': 1, '餐饮问题': 2, '环境卫生': 3, '其他': 4 } + const payload = { + ...form.value, + type: typeMap[form.value.type] ?? form.value.type, + } + + await complaintApi.create(payload) showToast({ type: 'success', message: '提交成功' }) showForm.value = false form.value = { type: '', content: '' } @@ -60,7 +69,7 @@ async function submit() {
- {{ item.type }} + {{ typeLabel[item.type] || '其他' }} {{ statusLabel[item.status] || '待处理' }}

{{ item.content }}