From 0e4b38ce3e7e0900f7c80aee544e8dea70136e47 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Thu, 5 Mar 2026 18:13:41 +0900 Subject: [PATCH] =?UTF-8?q?feat(charge-refund):=20=EC=BA=94=20=ED=99=98?= =?UTF-8?q?=EB=B6=88=20=ED=94=84=EB=A1=9C=EC=84=B8=EC=8A=A4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/charge_status.js | 6 +++- src/views/Can/CanStatus.vue | 67 +++++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/src/api/charge_status.js b/src/api/charge_status.js index 6859cac..dbde882 100644 --- a/src/api/charge_status.js +++ b/src/api/charge_status.js @@ -11,4 +11,8 @@ async function getChargeStatusDetail(startDate, paymentGateway, currency) { ); } -export { getChargeStatus, getChargeStatusDetail } +async function refundCharge(chargeId) { + return Vue.axios.post('/admin/charge/refund', { chargeId }); +} + +export { getChargeStatus, getChargeStatusDetail, refundCharge } diff --git a/src/views/Can/CanStatus.vue b/src/views/Can/CanStatus.vue index def15eb..ff45f8d 100644 --- a/src/views/Can/CanStatus.vue +++ b/src/views/Can/CanStatus.vue @@ -94,10 +94,6 @@ class="elevation-1" hide-default-footer > - - @@ -113,6 +109,16 @@ + + @@ -146,14 +152,9 @@ export default { end_date: null, items: [], detail_items: null, + selected_date_item: null, show_popup_dialog: false, detail_headers: [ - { - text: 'no', - align: 'center', - sortable: false, - value: 'accountId', - }, { text: '닉네임', align: 'center', @@ -184,6 +185,12 @@ export default { sortable: false, value: 'datetime', }, + { + text: '환불', + align: 'center', + sortable: false, + value: 'refund', + }, ], headers: [ { @@ -284,6 +291,7 @@ export default { async getChargeStatusDetail(value) { if (value.date !== '합계') { this.is_loading = true + this.selected_date_item = value try { const res = await api.getChargeStatusDetail(value.date, value.pg, value.currency) @@ -300,6 +308,45 @@ export default { this.is_loading = false } } + }, + + async confirmRefund(item) { + let canText = `${item.chargeCan}캔` + if (item.rewardCan > 0) { + canText += ` + ${item.rewardCan}캔` + } + + const confirm = await this.$dialog.confirm({ + title: '환불 확인', + text: `${item.nickname}님의 ${canText}을 환불하시겠습니까?`, + actions: { + false: '취소', + true: '환불' + } + }) + + if (confirm) { + await this.refundCharge(item.chargeId) + } + }, + + async refundCharge(chargeId) { + this.is_loading = true + + try { + const res = await api.refundCharge(chargeId) + if (res.status === 200 && res.data.success === true) { + this.notifySuccess('환불이 완료되었습니다.') + await this.getChargeStatusDetail(this.selected_date_item) + await this.getChargeStatus() + } else { + this.notifyError(res.data.message || '환불 처리 중 오류가 발생했습니다.') + } + } catch (e) { + this.notifyError('환불 처리 중 오류가 발생했습니다.') + } finally { + this.is_loading = false + } } } }