크리에이터 라이브 정산 페이지 추가

This commit is contained in:
Yu Sung
2023-10-03 18:19:15 +09:00
parent a22fbca9fd
commit 9464bf55e0
3 changed files with 11 additions and 11 deletions

View File

@@ -0,0 +1,327 @@
<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="#9970ff"
dark
depressed
@click="getCalculateLive"
>
조회
</v-btn>
</v-col>
<v-spacer />
<v-col cols="2">
<vue-excel-xlsx
:data="items"
:columns="columns"
:file-name="'정산'"
:file-type="'xlsx'"
:sheet-name="'정산'"
>
<v-btn
block
color="#9970ff"
dark
depressed
>
엑셀 다운로드
</v-btn>
</vue-excel-xlsx>
</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 v-slot:item.email="{ item }">
{{ item.email }}
</template>
<template v-slot:item.nickname="{ item }">
{{ item.nickname }}
</template>
<template v-slot:item.date="{ item }">
{{ item.date }}
</template>
<template v-slot:item.title="{ item }">
{{ item.title }}
</template>
<template v-slot:item.entranceFee="{ item }">
{{ item.entranceFee.toLocaleString() }} 코인
</template>
<template v-slot:item.coinUsageStr="{ item }">
{{ item.coinUsageStr }}
</template>
<template v-slot:item.totalAmount="{ item }">
{{ item.totalAmount.toLocaleString() }} 코인
</template>
<template v-slot:item.totalKrw="{ item }">
{{ item.totalKrw.toLocaleString() }}
</template>
<template v-slot:item.paymentFee="{ item }">
{{ item.paymentFee.toLocaleString() }}
</template>
<template v-slot:item.settlementAmount="{ item }">
{{ item.settlementAmount.toLocaleString() }}
</template>
<template v-slot:item.tax="{ item }">
{{ item.tax.toLocaleString() }}
</template>
<template v-slot:item.depositAmount="{ item }">
{{ item.depositAmount.toLocaleString() }}
</template>
</v-data-table>
</v-col>
</v-row>
</v-container>
</div>
</template>
<script>
import * as api from "@/api/calculate";
import datetime from 'vuejs-datetimepicker';
export default {
name: "CalculateCounselor",
components: {datetime},
data() {
return {
is_loading: false,
start_date: null,
end_date: null,
items: [],
columns: [
{
label: "이메일",
field: "email",
},
{
label: "닉네임",
field: "nickname",
},
{
label: "날짜",
field: "date",
},
{
label: "라이브 제목",
field: "title",
},
{
label: "유료방 입장 금액(코인)",
field: "entranceFee",
},
{
label: "코인사용구분",
field: "coinUsageStr",
},
{
label: "합계(코인)",
field: "totalAmount",
},
{
label: "원화",
field: "totalKrw",
},
{
label: "결제수수료(4.4%)",
field: "paymentFee",
},
{
label: "정산금액",
field: "settlementAmount",
},
{
label: "원천세(3.3%)",
field: "tax",
},
{
label: "입금액",
field: "depositAmount",
},
],
headers: [
{
text: '이메일',
align: 'center',
sortable: false,
value: 'email',
},
{
text: '닉네임',
align: 'center',
sortable: false,
value: 'nickname',
},
{
text: '날짜',
align: 'center',
sortable: false,
value: 'date',
},
{
text: '라이브 제목',
sortable: false,
value: 'title',
},
{
text: '유료방 입장 금액(코인)',
align: 'center',
sortable: false,
value: 'entranceFee',
},
{
text: '코인사용구분',
align: 'center',
sortable: false,
value: 'coinUsageStr',
},
{
text: '합계(코인)',
align: 'center',
sortable: false,
value: 'totalAmount',
},
{
text: '원화',
align: 'center',
sortable: false,
value: 'totalKrw',
},
{
text: '결제수수료(4.4%)',
align: 'center',
sortable: false,
value: 'paymentFee',
},
{
text: '정산금액',
align: 'center',
sortable: false,
value: 'settlementAmount',
},
{
text: '원천세(3.3%)',
align: 'center',
sortable: false,
value: 'tax',
},
{
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);
let firstDateMonth = (firstDate.getMonth() + 1).toString()
if (firstDateMonth.length < 2) {
firstDateMonth = '0' + firstDateMonth
}
let lastDateMonth = (lastDate.getMonth() + 1).toString()
if (lastDateMonth.length < 2) {
lastDateMonth = '0' + lastDateMonth
}
this.start_date = firstDate.getFullYear() + '-' + firstDateMonth + '-0' + firstDate.getDate()
this.end_date = lastDate.getFullYear() + '-' + lastDateMonth + '-' + lastDate.getDate()
await this.getCalculateLive()
},
methods: {
notifyError(message) {
this.$dialog.notify.error(message)
},
notifySuccess(message) {
this.$dialog.notify.success(message)
},
async getCalculateLive() {
this.is_loading = true
try {
const res = await api.getCalculateLive(this.start_date, this.end_date)
if (res.status === 200 && res.data.success === true) {
this.items = res.data.data
} else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
this.is_loading = false
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
this.is_loading = false
}
}
}
}
</script>
<style scoped>
</style>