feat(calculate): 크리에이터별 채널 후원 정산 페이지 개발 및 관련 API 수정 #92

Merged
klaus merged 1 commits from test into main 2026-03-03 05:57:30 +00:00
4 changed files with 287 additions and 6 deletions

View File

@@ -63,6 +63,18 @@ async function getCalculateChannelDonationByCreator(startDate, endDate, page, si
)
}
async function getCalculateChannelDonationByDate(startDate, endDate, page, size) {
return Vue.axios.get('/admin/calculate/channel-donation-by-date?startDateStr=' +
startDate + '&endDateStr=' + endDate + '&page=' + (page - 1) + '&size=' + size
)
}
async function downloadCalculateChannelDonationByCreatorExcel(startDate, endDate) {
return Vue.axios.get('/admin/calculate/channel-donation-by-creator/excel?startDateStr=' + startDate + '&endDateStr=' + endDate, {
responseType: 'blob'
});
}
async function updateCreatorSettlementRatio(creatorSettlementRatio) {
const request = {
memberId: creatorSettlementRatio.creator_id,
@@ -91,5 +103,7 @@ export {
getCalculateLiveByCreator,
getCalculateContentByCreator,
getCalculateCommunityByCreator,
getCalculateChannelDonationByCreator
getCalculateChannelDonationByCreator,
getCalculateChannelDonationByDate,
downloadCalculateChannelDonationByCreatorExcel
}

View File

@@ -215,6 +215,11 @@ const routes = [
name: 'CalculateChannelDonation',
component: () => import(/* webpackChunkName: "calculate" */ '../views/Calculate/CalculateChannelDonation.vue')
},
{
path: '/calculate/channel-donation-by-creator',
name: 'CalculateChannelDonationByCreator',
component: () => import(/* webpackChunkName: "calculate" */ '../views/Calculate/CalculateChannelDonationByCreator.vue')
},
{
path: '/notice',
name: 'NoticeView',

View File

@@ -38,7 +38,7 @@
color="#3bb9f1"
dark
depressed
@click="getCalculateChannelDonationByCreator"
@click="getCalculateChannelDonationByDate"
>
조회
</v-btn>
@@ -210,7 +210,7 @@ export default {
this.start_date = this.formatDate(firstDate)
this.end_date = this.formatDate(lastDate)
await this.getCalculateChannelDonationByCreator()
await this.getCalculateChannelDonationByDate()
},
methods: {
@@ -226,13 +226,13 @@ export default {
},
async next() {
await this.getCalculateChannelDonationByCreator()
await this.getCalculateChannelDonationByDate()
},
async getCalculateChannelDonationByCreator() {
async getCalculateChannelDonationByDate() {
this.is_loading = true
try {
const res = await api.getCalculateChannelDonationByCreator(
const res = await api.getCalculateChannelDonationByDate(
this.start_date.substring(0, 10),
this.end_date.substring(0, 10),
this.page,

View File

@@ -0,0 +1,262 @@
<template>
<div>
<v-toolbar dark>
<v-spacer />
<v-toolbar-title>크리에이터별 채널 후원 정산</v-toolbar-title>
<v-spacer />
</v-toolbar>
<br>
<v-container>
<v-row>
<v-col cols="2">
<datetime
v-model="start_date"
class="datepicker"
format="YYYY-MM-DD"
/>
</v-col>
<v-col cols="1">
~
</v-col>
<v-col cols="2">
<datetime
v-model="end_date"
class="datepicker"
format="YYYY-MM-DD"
/>
</v-col>
<v-col cols="1" />
<v-col cols="2">
<v-btn
block
color="#3bb9f1"
dark
depressed
@click="getCalculateChannelDonationByCreator"
>
조회
</v-btn>
</v-col>
<v-spacer />
<v-col cols="2">
<v-btn
block
color="#3bb9f1"
dark
depressed
@click="downloadExcel"
>
엑셀 다운로드
</v-btn>
</v-col>
</v-row>
<v-row>
<v-col>
<v-data-table
:headers="headers"
:items="items"
:loading="is_loading"
:items-per-page="-1"
class="elevation-1"
hide-default-footer
>
<template slot="body.prepend">
<tr v-if="total">
<td>
합계
</td>
<td class="text-center">
{{ total.count.toLocaleString() }}
</td>
<td class="text-center">
{{ total.totalCan.toLocaleString() }}
</td>
<td class="text-center">
{{ total.krw.toLocaleString() }}
</td>
<td class="text-center">
{{ total.fee.toLocaleString() }}
</td>
<td class="text-center">
{{ total.settlementAmount.toLocaleString() }}
</td>
<td class="text-center">
{{ total.withholdingTax.toLocaleString() }}
</td>
<td class="text-center">
{{ total.depositAmount.toLocaleString() }}
</td>
</tr>
</template>
<template v-slot:item.creator="{ item }">
{{ item.creator }}
</template>
<template v-slot:item.count="{ item }">
{{ item.count.toLocaleString() }}
</template>
<template v-slot:item.totalCan="{ item }">
{{ item.totalCan.toLocaleString() }}
</template>
<template v-slot:item.krw="{ item }">
{{ item.krw.toLocaleString() }}
</template>
<template v-slot:item.fee="{ item }">
{{ item.fee.toLocaleString() }}
</template>
<template v-slot:item.settlementAmount="{ item }">
{{ item.settlementAmount.toLocaleString() }}
</template>
<template v-slot:item.withholdingTax="{ item }">
{{ item.withholdingTax.toLocaleString() }}
</template>
<template v-slot:item.depositAmount="{ item }">
{{ item.depositAmount.toLocaleString() }}
</template>
</v-data-table>
</v-col>
</v-row>
<v-row>
<v-col>
<v-pagination
v-model="page"
:length="total_page"
:total-visible="7"
@input="next"
/>
</v-col>
</v-row>
</v-container>
</div>
</template>
<script>
import * as api from '@/api/calculate'
import datetime from 'vuejs-datetimepicker'
export default {
name: 'CalculateChannelDonationByCreator',
components: {
datetime
},
data() {
return {
start_date: '',
end_date: '',
is_loading: false,
items: [],
total: null,
page: 1,
page_size: 20,
total_page: 1,
headers: [
{ text: '크리에이터', align: 'center', sortable: false, value: 'creator' },
{ text: '건수', align: 'center', sortable: false, value: 'count' },
{ text: '캔', align: 'center', sortable: false, value: 'totalCan' },
{ text: '원화', align: 'center', sortable: false, value: 'krw' },
{ text: '수수료(6.6%)', align: 'center', sortable: false, value: 'fee' },
{ text: '정산금액', align: 'center', sortable: false, value: 'settlementAmount' },
{ text: '원천세(3.3%)', align: 'center', sortable: false, value: 'withholdingTax' },
{ text: '입금액', align: 'center', sortable: false, value: 'depositAmount' }
]
}
},
async created() {
const date = new Date()
const firstDate = new Date(date.getFullYear(), date.getMonth(), 1)
const lastDate = new Date(date.getFullYear(), date.getMonth() + 1, 0)
this.start_date = this.formatDate(firstDate)
this.end_date = this.formatDate(lastDate)
await this.getCalculateChannelDonationByCreator()
},
methods: {
formatDate(date) {
const year = date.getFullYear()
const month = ('0' + (date.getMonth() + 1)).slice(-2)
const day = ('0' + date.getDate()).slice(-2)
return `${year}-${month}-${day}`
},
notifyError(message) {
this.$dialog.notify.error(message)
},
async next() {
await this.getCalculateChannelDonationByCreator()
},
async getCalculateChannelDonationByCreator() {
this.is_loading = true
try {
const res = await api.getCalculateChannelDonationByCreator(
this.start_date.substring(0, 10),
this.end_date.substring(0, 10),
this.page,
this.page_size
)
if (res.status === 200 && res.data.success === true) {
const data = res.data.data
this.items = data.items
this.total = data.total
this.total_page = Math.ceil(data.totalCount / this.page_size) || 1
} else {
this.notifyError(res.data.message || '데이터를 불러오는 중 오류가 발생했습니다.')
}
} catch (e) {
this.notifyError('서버와의 통신 중 오류가 발생했습니다.')
} finally {
this.is_loading = false
}
},
async downloadExcel() {
try {
const res = await api.downloadCalculateChannelDonationByCreatorExcel(
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('엑셀 다운로드 중 오류가 발생했습니다.')
}
}
}
}
</script>
<style scoped>
.datepicker {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
</style>