diff --git a/src/api/calculate.js b/src/api/calculate.js index d530512..9493d23 100644 --- a/src/api/calculate.js +++ b/src/api/calculate.js @@ -1,19 +1,19 @@ import Vue from 'vue'; -async function getCalculateLive(startDate, endDate) { - return Vue.axios.get('/admin/calculate/live?startDateStr=' + startDate + '&endDateStr=' + endDate); +async function getCalculateLive(startDate, endDate, page, size) { + return Vue.axios.get('/admin/calculate/live?startDateStr=' + startDate + '&endDateStr=' + endDate + '&page=' + (page - 1) + '&size=' + size); } -async function getCalculateContent(startDate, endDate) { - return Vue.axios.get('/admin/calculate/content-list?startDateStr=' + startDate + '&endDateStr=' + endDate); +async function getCalculateContent(startDate, endDate, page, size) { + return Vue.axios.get('/admin/calculate/content-list?startDateStr=' + startDate + '&endDateStr=' + endDate + '&page=' + (page - 1) + '&size=' + size); } async function getCumulativeSalesByContent(page, size) { return Vue.axios.get('/admin/calculate/cumulative-sales-by-content?page=' + (page - 1) + "&size=" + size); } -async function getCalculateContentDonation(startDate, endDate) { - return Vue.axios.get('/admin/calculate/content-donation-list?startDateStr=' + startDate + '&endDateStr=' + endDate); +async function getCalculateContentDonation(startDate, endDate, page, size) { + return Vue.axios.get('/admin/calculate/content-donation-list?startDateStr=' + startDate + '&endDateStr=' + endDate + '&page=' + (page - 1) + '&size=' + size); } async function getCalculateCommunityPost(startDate, endDate, page, size) { @@ -75,6 +75,54 @@ async function downloadCalculateChannelDonationByCreatorExcel(startDate, endDate }); } +async function downloadCalculateLiveExcel(startDate, endDate) { + return Vue.axios.get('/admin/calculate/live/excel?startDateStr=' + startDate + '&endDateStr=' + endDate, { + responseType: 'blob' + }); +} + +async function downloadCalculateContentExcel(startDate, endDate) { + return Vue.axios.get('/admin/calculate/content-list/excel?startDateStr=' + startDate + '&endDateStr=' + endDate, { + responseType: 'blob' + }); +} + +async function downloadCalculateContentDonationExcel(startDate, endDate) { + return Vue.axios.get('/admin/calculate/content-donation-list/excel?startDateStr=' + startDate + '&endDateStr=' + endDate, { + responseType: 'blob' + }); +} + +async function downloadCalculateCommunityPostExcel(startDate, endDate) { + return Vue.axios.get('/admin/calculate/community-post/excel?startDateStr=' + startDate + '&endDateStr=' + endDate, { + responseType: 'blob' + }); +} + +async function downloadCalculateLiveByCreatorExcel(startDate, endDate) { + return Vue.axios.get('/admin/calculate/live-by-creator/excel?startDateStr=' + startDate + '&endDateStr=' + endDate, { + responseType: 'blob' + }); +} + +async function downloadCalculateContentByCreatorExcel(startDate, endDate) { + return Vue.axios.get('/admin/calculate/content-by-creator/excel?startDateStr=' + startDate + '&endDateStr=' + endDate, { + responseType: 'blob' + }); +} + +async function downloadCalculateCommunityByCreatorExcel(startDate, endDate) { + return Vue.axios.get('/admin/calculate/community-by-creator/excel?startDateStr=' + startDate + '&endDateStr=' + endDate, { + responseType: 'blob' + }); +} + +async function downloadCalculateChannelDonationByDateExcel(startDate, endDate) { + return Vue.axios.get('/admin/calculate/channel-donation-by-date/excel?startDateStr=' + startDate + '&endDateStr=' + endDate, { + responseType: 'blob' + }); +} + async function updateCreatorSettlementRatio(creatorSettlementRatio) { const request = { memberId: creatorSettlementRatio.creator_id, @@ -105,5 +153,13 @@ export { getCalculateCommunityByCreator, getCalculateChannelDonationByCreator, getCalculateChannelDonationByDate, - downloadCalculateChannelDonationByCreatorExcel + downloadCalculateChannelDonationByCreatorExcel, + downloadCalculateLiveExcel, + downloadCalculateContentExcel, + downloadCalculateContentDonationExcel, + downloadCalculateCommunityPostExcel, + downloadCalculateLiveByCreatorExcel, + downloadCalculateContentByCreatorExcel, + downloadCalculateCommunityByCreatorExcel, + downloadCalculateChannelDonationByDateExcel } 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/api/member.js b/src/api/member.js index ba5c420..8796589 100644 --- a/src/api/member.js +++ b/src/api/member.js @@ -52,6 +52,11 @@ async function resetPassword(id) { return Vue.axios.post("/admin/member/password/reset", request) } +async function blockMember(memberId, reason) { + const request = {memberId, reason} + return Vue.axios.post("/admin/member/block", request) +} + /** * 닉네임으로 회원 검색 API * - 서버 구현 차이를 흡수하기 위해 nickname, search_word 두 파라미터 모두 전송 @@ -84,8 +89,9 @@ export { searchMember, getCreatorList, searchCreator, - updateMember, - getCreatorAllList, - resetPassword, - searchMembersByNickname + updateMember, + getCreatorAllList, + resetPassword, + blockMember, + searchMembersByNickname } diff --git a/src/views/Calculate/CalculateChannelDonation.vue b/src/views/Calculate/CalculateChannelDonation.vue index ca7077a..097c96d 100644 --- a/src/views/Calculate/CalculateChannelDonation.vue +++ b/src/views/Calculate/CalculateChannelDonation.vue @@ -47,22 +47,15 @@ - - - 엑셀 다운로드 - - + 엑셀 다운로드 + @@ -187,17 +180,6 @@ export default { { text: '정산금액', align: 'center', sortable: false, value: 'settlementAmount' }, { text: '원천세(3.3%)', align: 'center', sortable: false, value: 'withholdingTax' }, { text: '입금액', align: 'center', sortable: false, value: 'depositAmount' } - ], - excelColumns: [ - { label: '날짜', field: 'date' }, - { label: '크리에이터', field: 'creator' }, - { label: '건수', field: 'count' }, - { label: '캔', field: 'totalCan' }, - { label: '원화', field: 'krw' }, - { label: '수수료(6.6%)', field: 'fee' }, - { label: '정산금액', field: 'settlementAmount' }, - { label: '원천세(3.3%)', field: 'withholdingTax' }, - { label: '입금액', field: 'depositAmount' } ] } }, @@ -252,6 +234,24 @@ export default { } finally { this.is_loading = false } + }, + + async downloadExcel() { + try { + const res = await api.downloadCalculateChannelDonationByDateExcel( + this.start_date.substring(0, 10), + this.end_date.substring(0, 10) + ) + const url = window.URL.createObjectURL(new Blob([res.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', '채널후원정산.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } catch (e) { + this.notifyError('엑셀 다운로드 중 오류가 발생했습니다.') + } } } } diff --git a/src/views/Calculate/CalculateCommunityByCreator.vue b/src/views/Calculate/CalculateCommunityByCreator.vue index 8bcd22f..1b43f99 100644 --- a/src/views/Calculate/CalculateCommunityByCreator.vue +++ b/src/views/Calculate/CalculateCommunityByCreator.vue @@ -47,22 +47,15 @@ - - - 엑셀 다운로드 - - + 엑셀 다운로드 + @@ -156,40 +149,6 @@ export default { page_size: 20, total_page: 0, items: [], - columns: [ - { - label: "이메일", - field: "email", - }, - { - label: "크리에이터", - field: "nickname", - }, - { - label: "합계(캔)", - field: "totalCan", - }, - { - label: "원화", - field: "totalKrw", - }, - { - label: "결제수수료(6.6%)", - field: "paymentFee", - }, - { - label: "정산금액", - field: "settlementAmount", - }, - { - label: "원천세(3.3%)", - field: "tax", - }, - { - label: "입금액", - field: "depositAmount", - }, - ], headers: [ { text: '이메일', @@ -309,6 +268,21 @@ export default { } finally { this.is_loading = false } + }, + + async downloadExcel() { + try { + const res = await api.downloadCalculateCommunityByCreatorExcel(this.start_date, this.end_date) + const url = window.URL.createObjectURL(new Blob([res.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', '크리에이터별_커뮤니티정산.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } catch (e) { + this.notifyError('엑셀 다운로드 중 오류가 발생했습니다.') + } } } } diff --git a/src/views/Calculate/CalculateCommunityPost.vue b/src/views/Calculate/CalculateCommunityPost.vue index 3fda528..5e5c7c0 100644 --- a/src/views/Calculate/CalculateCommunityPost.vue +++ b/src/views/Calculate/CalculateCommunityPost.vue @@ -35,7 +35,7 @@ - - - 엑셀 다운로드 - - + 엑셀 다운로드 + @@ -136,52 +129,6 @@ export default { page_size: 20, total_page: 0, items: [], - columns: [ - { - label: '날짜', - field: 'date', - }, - { - label: '크리에이터', - field: 'nickname', - }, - { - label: '내용(앞 10글자)', - field: 'title' - }, - { - label: '판매금액(캔)', - field: 'can', - }, - { - label: '구매유저수', - field: 'numberOfPurchase', - }, - { - label: '합계(캔)', - field: 'totalCan', - }, - { - label: '원화', - field: 'totalKrw', - }, - { - label: '수수료\n(6.6%)', - field: 'paymentFee', - }, - { - label: '정산금액', - field: 'settlementAmount', - }, - { - label: '원천세\n(3.3%)', - field: 'tax', - }, - { - label: '입금액', - field: 'depositAmount', - } - ], headers: [ { text: '날짜', @@ -309,6 +256,21 @@ export default { this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') this.is_loading = false } + }, + + async downloadExcel() { + try { + const res = await api.downloadCalculateCommunityPostExcel(this.start_date, this.end_date) + const url = window.URL.createObjectURL(new Blob([res.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', '커뮤니티-정산.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } catch (e) { + this.notifyError('엑셀 다운로드 중 오류가 발생했습니다.') + } } } } diff --git a/src/views/Calculate/CalculateContent.vue b/src/views/Calculate/CalculateContent.vue index ce16f42..7b379e8 100644 --- a/src/views/Calculate/CalculateContent.vue +++ b/src/views/Calculate/CalculateContent.vue @@ -35,7 +35,7 @@ - - - 엑셀 다운로드 - - + 엑셀 다운로드 + @@ -126,6 +119,16 @@ + + + + + @@ -143,61 +146,10 @@ export default { is_loading: false, start_date: null, end_date: null, + page: 1, + page_size: 20, + total_page: 0, items: [], - columns: [ - { - label: '판매일', - field: 'saleDate', - }, - { - label: '크리에이터', - field: 'nickname', - }, - { - label: '제목', - field: 'title', - }, - { - label: '구분', - field: 'orderType', - }, - { - label: '판매금액(캔)', - field: 'orderPrice', - }, - { - label: '판매수', - field: 'numberOfPeople', - }, - { - label: '합계(캔)', - field: 'totalCan', - }, - { - label: '원화', - field: 'totalKrw', - }, - { - label: '수수료\n(6.6%)', - field: 'paymentFee', - }, - { - label: '정산금액', - field: 'settlementAmount', - }, - { - label: '원천세\n(3.3%)', - field: 'tax', - }, - { - label: '입금액', - field: 'depositAmount', - }, - { - label: '등록일', - field: 'registrationDate', - }, - ], headers: [ { text: '판매일', @@ -321,9 +273,10 @@ export default { this.is_loading = true try { - const res = await api.getCalculateContent(this.start_date, this.end_date) + const res = await api.getCalculateContent(this.start_date, this.end_date, this.page, this.page_size) if (res.status === 200 && res.data.success === true) { - this.items = res.data.data + this.items = res.data.data.items + this.total_page = Math.ceil(res.data.data.totalCount / this.page_size) } else { this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') } @@ -333,6 +286,25 @@ export default { this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') this.is_loading = false } + }, + + next() { + this.getCalculateContent() + }, + + async downloadExcel() { + try { + const res = await api.downloadCalculateContentExcel(this.start_date, this.end_date) + const url = window.URL.createObjectURL(new Blob([res.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', '콘텐츠정산.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } catch (e) { + this.notifyError('엑셀 다운로드 중 오류가 발생했습니다.') + } } } } diff --git a/src/views/Calculate/CalculateContentByCreator.vue b/src/views/Calculate/CalculateContentByCreator.vue index 5a6117d..d4ed59d 100644 --- a/src/views/Calculate/CalculateContentByCreator.vue +++ b/src/views/Calculate/CalculateContentByCreator.vue @@ -47,22 +47,15 @@ - - - 엑셀 다운로드 - - + 엑셀 다운로드 + @@ -156,40 +149,6 @@ export default { page_size: 20, total_page: 0, items: [], - columns: [ - { - label: "이메일", - field: "email", - }, - { - label: "크리에이터", - field: "nickname", - }, - { - label: "합계(캔)", - field: "totalCan", - }, - { - label: "원화", - field: "totalKrw", - }, - { - label: "결제수수료(6.6%)", - field: "paymentFee", - }, - { - label: "정산금액", - field: "settlementAmount", - }, - { - label: "원천세(3.3%)", - field: "tax", - }, - { - label: "입금액", - field: "depositAmount", - }, - ], headers: [ { text: '이메일', @@ -309,6 +268,21 @@ export default { } finally { this.is_loading = false } + }, + + async downloadExcel() { + try { + const res = await api.downloadCalculateContentByCreatorExcel(this.start_date, this.end_date) + const url = window.URL.createObjectURL(new Blob([res.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', '크리에이터별_콘텐츠정산.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } catch (e) { + this.notifyError('엑셀 다운로드 중 오류가 발생했습니다.') + } } } } diff --git a/src/views/Calculate/CalculateContentDonation.vue b/src/views/Calculate/CalculateContentDonation.vue index ca8b18a..b8e1cfa 100644 --- a/src/views/Calculate/CalculateContentDonation.vue +++ b/src/views/Calculate/CalculateContentDonation.vue @@ -35,7 +35,7 @@ - - - 엑셀 다운로드 - - + 엑셀 다운로드 + @@ -118,6 +111,16 @@ + + + + + @@ -135,57 +138,10 @@ export default { is_loading: false, start_date: null, end_date: null, + page: 1, + page_size: 20, + total_page: 0, items: [], - columns: [ - { - label: '후원날짜', - field: 'donationDate', - }, - { - label: '크리에이터', - field: 'nickname', - }, - { - label: '콘텐츠 제목', - field: 'title', - }, - { - label: '구분', - field: 'paidOrFree', - }, - { - label: '후원수', - field: 'numberOfDonation', - }, - { - label: '합계(캔)', - field: 'totalCan', - }, - { - label: '원화', - field: 'totalKrw', - }, - { - label: '수수료\n(6.6%)', - field: 'paymentFee', - }, - { - label: '정산금액', - field: 'settlementAmount', - }, - { - label: '원천세\n(3.3%)', - field: 'tax', - }, - { - label: '입금액', - field: 'depositAmount', - }, - { - label: '콘텐츠 등록일', - field: 'registrationDate', - }, - ], headers: [ { text: '후원날짜', @@ -303,9 +259,10 @@ export default { this.is_loading = true try { - const res = await api.getCalculateContentDonation(this.start_date, this.end_date) + const res = await api.getCalculateContentDonation(this.start_date, this.end_date, this.page, this.page_size) if (res.status === 200 && res.data.success === true) { - this.items = res.data.data + this.items = res.data.data.items + this.total_page = Math.ceil(res.data.data.totalCount / this.page_size) } else { this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') } @@ -315,6 +272,25 @@ export default { this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') this.is_loading = false } + }, + + next() { + this.getCalculateContentDonation() + }, + + async downloadExcel() { + try { + const res = await api.downloadCalculateContentDonationExcel(this.start_date, this.end_date) + const url = window.URL.createObjectURL(new Blob([res.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', '콘텐츠후원정산.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } catch (e) { + this.notifyError('엑셀 다운로드 중 오류가 발생했습니다.') + } } } } diff --git a/src/views/Calculate/CalculateLive.vue b/src/views/Calculate/CalculateLive.vue index e5bd94d..cffb922 100644 --- a/src/views/Calculate/CalculateLive.vue +++ b/src/views/Calculate/CalculateLive.vue @@ -35,7 +35,7 @@ - - - 엑셀 다운로드 - - + 엑셀 다운로드 + @@ -126,6 +119,16 @@ + + + + + @@ -143,61 +146,10 @@ export default { is_loading: false, start_date: null, end_date: null, + page: 1, + page_size: 20, + total_page: 0, items: [], - columns: [ - { - label: "이메일", - field: "email", - }, - { - label: "크리에이터", - field: "nickname", - }, - { - label: "날짜", - field: "date", - }, - { - label: "제목", - field: "title", - }, - { - label: "구분", - field: "canUsageStr", - }, - { - label: "입장캔", - field: "entranceFee", - }, - { - label: "인원", - field: "numberOfPeople", - }, - { - label: "합계(캔)", - field: "totalAmount", - }, - { - label: "원화", - field: "totalKrw", - }, - { - label: "결제수수료(6.6%)", - field: "paymentFee", - }, - { - label: "정산금액", - field: "settlementAmount", - }, - { - label: "원천세(3.3%)", - field: "tax", - }, - { - label: "입금액", - field: "depositAmount", - }, - ], headers: [ { text: '이메일', @@ -315,9 +267,10 @@ export default { this.is_loading = true try { - const res = await api.getCalculateLive(this.start_date, this.end_date) + const res = await api.getCalculateLive(this.start_date, this.end_date, this.page, this.page_size) if (res.status === 200 && res.data.success === true) { - this.items = res.data.data + this.items = res.data.data.items + this.total_page = Math.ceil(res.data.data.totalCount / this.page_size) } else { this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') } @@ -327,6 +280,25 @@ export default { this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') this.is_loading = false } + }, + + next() { + this.getCalculateLive() + }, + + async downloadExcel() { + try { + const res = await api.downloadCalculateLiveExcel(this.start_date, this.end_date) + const url = window.URL.createObjectURL(new Blob([res.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', '라이브정산.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } catch (e) { + this.notifyError('엑셀 다운로드 중 오류가 발생했습니다.') + } } } } diff --git a/src/views/Calculate/CalculateLiveByCreator.vue b/src/views/Calculate/CalculateLiveByCreator.vue index 1acb535..c4b302e 100644 --- a/src/views/Calculate/CalculateLiveByCreator.vue +++ b/src/views/Calculate/CalculateLiveByCreator.vue @@ -47,22 +47,15 @@ - - - 엑셀 다운로드 - - + 엑셀 다운로드 + @@ -156,40 +149,6 @@ export default { page_size: 20, total_page: 0, items: [], - columns: [ - { - label: "이메일", - field: "email", - }, - { - label: "크리에이터", - field: "nickname", - }, - { - label: "합계(캔)", - field: "totalCan", - }, - { - label: "원화", - field: "totalKrw", - }, - { - label: "결제수수료(6.6%)", - field: "paymentFee", - }, - { - label: "정산금액", - field: "settlementAmount", - }, - { - label: "원천세(3.3%)", - field: "tax", - }, - { - label: "입금액", - field: "depositAmount", - }, - ], headers: [ { text: '이메일', @@ -309,6 +268,21 @@ export default { } finally { this.is_loading = false } + }, + + async downloadExcel() { + try { + const res = await api.downloadCalculateLiveByCreatorExcel(this.start_date, this.end_date) + const url = window.URL.createObjectURL(new Blob([res.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', '크리에이터별_라이브정산.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } catch (e) { + this.notifyError('엑셀 다운로드 중 오류가 발생했습니다.') + } } } } 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 + } } } } diff --git a/src/views/Member/MemberList.vue b/src/views/Member/MemberList.vue index ffec5dd..07dfac1 100644 --- a/src/views/Member/MemberList.vue +++ b/src/views/Member/MemberList.vue @@ -193,6 +193,14 @@ + + 차단 + + 비밀번호 재설정 - + + + + + 차단(탈퇴) 사유 입력 + + + + + + + 차단 + + + 취소 + + + + + + + + + + + '{{ nickname }}' 계정과 본인인증 정보, 같은 본인인증 정보를 사용하는 모든 계정을 차단합니다. + + + + + 차단 + + + 취소 + + + + + @@ -274,6 +349,9 @@ export default { user_type: null, show_popup_dialog: false, show_confirm_reset_password_dialog: false, + show_block_reason_dialog: false, + show_confirm_block_dialog: false, + block_reason: '', } }, @@ -382,6 +460,51 @@ export default { this.user_type = null this.show_popup_dialog = false this.show_confirm_reset_password_dialog = false + this.show_block_reason_dialog = false + this.show_confirm_block_dialog = false + this.block_reason = '' + }, + + showBlockReasonDialog() { + this.show_popup_dialog = false + this.show_block_reason_dialog = true + }, + + cancelBlock() { + this.show_block_reason_dialog = false + this.show_confirm_block_dialog = false + this.block_reason = '' + this.show_popup_dialog = true + }, + + confirmBlock() { + if (this.block_reason.length === 0) { + this.notifyError('차단 사유를 입력해주세요.') + return + } + this.show_block_reason_dialog = false + this.show_confirm_block_dialog = true + }, + + async blockMember() { + this.is_loading = true + try { + const res = await api.blockMember(this.member.id, this.block_reason) + if (res.status === 200 && res.data.success === true) { + this.notifySuccess('차단되었습니다.') + this.cancel() + + this.page = 1 + await this.getMemberList() + } else { + this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + } + + this.is_loading = false + } catch (e) { + this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') + this.is_loading = false + } }, async modify() {