Compare commits
2 Commits
1a435b6074
...
test
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3c28367be9 | ||
![]() |
8f0958848d |
@@ -24,7 +24,7 @@ async function getCalculateCommunityPost(startDate, endDate, page, size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getSettlementRatio(page) {
|
async function getSettlementRatio(page) {
|
||||||
return Vue.axios.get('/admin/calculate/ratio?page=' + (page - 1) + "&size=20'");
|
return Vue.axios.get('/admin/calculate/ratio?page=' + (page - 1) + "&size=20");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createCreatorSettlementRatio(creatorSettlementRatio) {
|
async function createCreatorSettlementRatio(creatorSettlementRatio) {
|
||||||
@@ -57,6 +57,21 @@ async function getCalculateCommunityByCreator(startDate, endDate, page, size) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function updateCreatorSettlementRatio(creatorSettlementRatio) {
|
||||||
|
const request = {
|
||||||
|
memberId: creatorSettlementRatio.creator_id,
|
||||||
|
subsidy: creatorSettlementRatio.subsidy,
|
||||||
|
liveSettlementRatio: creatorSettlementRatio.liveSettlementRatio,
|
||||||
|
contentSettlementRatio: creatorSettlementRatio.contentSettlementRatio,
|
||||||
|
communitySettlementRatio: creatorSettlementRatio.communitySettlementRatio
|
||||||
|
};
|
||||||
|
return Vue.axios.post('/admin/calculate/ratio/update', request);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteCreatorSettlementRatio(memberId) {
|
||||||
|
return Vue.axios.post('/admin/calculate/ratio/delete/' + memberId);
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getCalculateLive,
|
getCalculateLive,
|
||||||
getCalculateContent,
|
getCalculateContent,
|
||||||
@@ -65,6 +80,8 @@ export {
|
|||||||
getCalculateCommunityPost,
|
getCalculateCommunityPost,
|
||||||
getSettlementRatio,
|
getSettlementRatio,
|
||||||
createCreatorSettlementRatio,
|
createCreatorSettlementRatio,
|
||||||
|
updateCreatorSettlementRatio,
|
||||||
|
deleteCreatorSettlementRatio,
|
||||||
getCalculateLiveByCreator,
|
getCalculateLiveByCreator,
|
||||||
getCalculateContentByCreator,
|
getCalculateContentByCreator,
|
||||||
getCalculateCommunityByCreator
|
getCalculateCommunityByCreator
|
||||||
|
@@ -53,6 +53,24 @@
|
|||||||
<template v-slot:item.communitySettlementRatio="{ item }">
|
<template v-slot:item.communitySettlementRatio="{ item }">
|
||||||
{{ item.communitySettlementRatio }}%
|
{{ item.communitySettlementRatio }}%
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:item.actions="{ item }">
|
||||||
|
<v-btn
|
||||||
|
small
|
||||||
|
color="primary"
|
||||||
|
text
|
||||||
|
@click="openEdit(item)"
|
||||||
|
>
|
||||||
|
수정
|
||||||
|
</v-btn>
|
||||||
|
<v-btn
|
||||||
|
small
|
||||||
|
color="red"
|
||||||
|
text
|
||||||
|
@click="confirmDelete(item)"
|
||||||
|
>
|
||||||
|
삭제
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -73,13 +91,20 @@
|
|||||||
persistent
|
persistent
|
||||||
>
|
>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title>크리에이터 정산비율</v-card-title>
|
<v-card-title>{{ is_edit ? '크리에이터 정산비율 수정' : '크리에이터 정산비율' }}</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text v-show="!is_edit">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="creator_settlement_ratio.creator_id"
|
v-model="creator_settlement_ratio.creator_id"
|
||||||
label="크리에이터 번호"
|
label="크리에이터 번호"
|
||||||
/>
|
/>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
<v-card-text v-show="is_edit">
|
||||||
|
<v-text-field
|
||||||
|
v-model="creator_settlement_ratio.nickname"
|
||||||
|
disabled
|
||||||
|
label="크리에이터 닉네임"
|
||||||
|
/>
|
||||||
|
</v-card-text>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="creator_settlement_ratio.subsidy"
|
v-model="creator_settlement_ratio.subsidy"
|
||||||
@@ -118,7 +143,7 @@
|
|||||||
text
|
text
|
||||||
@click="validate"
|
@click="validate"
|
||||||
>
|
>
|
||||||
등록하기
|
{{ is_edit ? '수정하기' : '등록하기' }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
@@ -142,6 +167,8 @@ export default {
|
|||||||
items: [],
|
items: [],
|
||||||
creator_settlement_ratio: {},
|
creator_settlement_ratio: {},
|
||||||
show_write_dialog: false,
|
show_write_dialog: false,
|
||||||
|
is_edit: false,
|
||||||
|
editing_item_id: null,
|
||||||
headers: [
|
headers: [
|
||||||
{
|
{
|
||||||
text: '닉네임',
|
text: '닉네임',
|
||||||
@@ -173,6 +200,12 @@ export default {
|
|||||||
sortable: false,
|
sortable: false,
|
||||||
value: 'communitySettlementRatio',
|
value: 'communitySettlementRatio',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: '관리',
|
||||||
|
align: 'center',
|
||||||
|
sortable: false,
|
||||||
|
value: 'actions',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -191,11 +224,16 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
showWriteDialog() {
|
showWriteDialog() {
|
||||||
|
this.is_edit = false
|
||||||
|
this.editing_item_id = null
|
||||||
|
this.creator_settlement_ratio = {}
|
||||||
this.show_write_dialog = true
|
this.show_write_dialog = true
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.creator_settlement_ratio = {}
|
this.creator_settlement_ratio = {}
|
||||||
|
this.is_edit = false
|
||||||
|
this.editing_item_id = null
|
||||||
this.show_write_dialog = false
|
this.show_write_dialog = false
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -225,7 +263,11 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.createCreatorSettlementRatio();
|
if (this.is_edit) {
|
||||||
|
this.updateCreatorSettlementRatio();
|
||||||
|
} else {
|
||||||
|
this.createCreatorSettlementRatio();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async createCreatorSettlementRatio() {
|
async createCreatorSettlementRatio() {
|
||||||
@@ -253,6 +295,71 @@ export default {
|
|||||||
this.is_loading = false
|
this.is_loading = false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async updateCreatorSettlementRatio() {
|
||||||
|
if (this.is_loading) return;
|
||||||
|
this.is_loading = true
|
||||||
|
try {
|
||||||
|
// 수정은 생성과 동일한 파라미터를 전송 (memberId 기준)
|
||||||
|
const payload = { ...this.creator_settlement_ratio }
|
||||||
|
const res = await api.updateCreatorSettlementRatio(payload)
|
||||||
|
if (res.status === 200 && res.data.success === true) {
|
||||||
|
this.cancel()
|
||||||
|
this.notifySuccess(res.data.message || '수정되었습니다.')
|
||||||
|
this.items = []
|
||||||
|
await this.getSettlementRatio()
|
||||||
|
} else {
|
||||||
|
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
} finally {
|
||||||
|
this.is_loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
openEdit(item) {
|
||||||
|
this.is_edit = true
|
||||||
|
this.editing_item_id = null
|
||||||
|
this.creator_settlement_ratio = {
|
||||||
|
creator_id: item.memberId,
|
||||||
|
nickname: item.nickname,
|
||||||
|
subsidy: item.subsidy,
|
||||||
|
liveSettlementRatio: item.liveSettlementRatio,
|
||||||
|
contentSettlementRatio: item.contentSettlementRatio,
|
||||||
|
communitySettlementRatio: item.communitySettlementRatio,
|
||||||
|
}
|
||||||
|
this.show_write_dialog = true
|
||||||
|
},
|
||||||
|
|
||||||
|
async confirmDelete(item) {
|
||||||
|
try {
|
||||||
|
const ok = await this.$dialog.confirm({ text: '삭제하시겠습니까?', title: '확인', actions: { false: '취소', true: '삭제' } })
|
||||||
|
if (!ok) return
|
||||||
|
} catch (e) {
|
||||||
|
// 일부 구현체는 confirm이 boolean이 아닌 경우가 있음
|
||||||
|
}
|
||||||
|
this.deleteCreatorSettlementRatio(item)
|
||||||
|
},
|
||||||
|
|
||||||
|
async deleteCreatorSettlementRatio(item) {
|
||||||
|
if (this.is_loading) return;
|
||||||
|
this.is_loading = true
|
||||||
|
try {
|
||||||
|
const memberId = item.memberId
|
||||||
|
const res = await api.deleteCreatorSettlementRatio(memberId)
|
||||||
|
if (res.status === 200 && res.data.success === true) {
|
||||||
|
this.notifySuccess(res.data.message || '삭제되었습니다.')
|
||||||
|
this.items = this.items.filter(x => (x.memberId) !== memberId)
|
||||||
|
} else {
|
||||||
|
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
} finally {
|
||||||
|
this.is_loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async getSettlementRatio() {
|
async getSettlementRatio() {
|
||||||
this.is_loading = true
|
this.is_loading = true
|
||||||
|
|
||||||
@@ -279,10 +386,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async next() {
|
async next() {
|
||||||
if (this.search_word.length < 2) {
|
|
||||||
this.search_word = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.getSettlementRatio()
|
await this.getSettlementRatio()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user