diff --git a/src/api/calculate.js b/src/api/calculate.js
index 96632c4..8cd7573 100644
--- a/src/api/calculate.js
+++ b/src/api/calculate.js
@@ -24,7 +24,7 @@ async function getCalculateCommunityPost(startDate, endDate, page, size) {
}
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) {
@@ -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 {
getCalculateLive,
getCalculateContent,
@@ -65,6 +80,8 @@ export {
getCalculateCommunityPost,
getSettlementRatio,
createCreatorSettlementRatio,
+ updateCreatorSettlementRatio,
+ deleteCreatorSettlementRatio,
getCalculateLiveByCreator,
getCalculateContentByCreator,
getCalculateCommunityByCreator
diff --git a/src/api/can.js b/src/api/can.js
index 8580630..67c96b3 100644
--- a/src/api/can.js
+++ b/src/api/can.js
@@ -5,11 +5,11 @@ async function deleteCan(id) {
}
async function getCans() {
- return Vue.axios.get('/can');
+ return Vue.axios.get('/admin/can');
}
-async function insertCan(can, rewardCan, price) {
- const request = {can: can, rewardCan: rewardCan, price: price}
+async function insertCan(can, rewardCan, price, currency) {
+ const request = {can: can, rewardCan: rewardCan, price: price, currency}
return Vue.axios.post('/admin/can', request);
}
diff --git a/src/views/Can/CanManagement.vue b/src/views/Can/CanManagement.vue
index 6aba112..8c44243 100644
--- a/src/views/Can/CanManagement.vue
+++ b/src/views/Can/CanManagement.vue
@@ -21,7 +21,7 @@
-
- {{ item.price.toLocaleString('en-US') }} 원
+
+ {{ formatMoney(item.price, item.currency) }}
- {{ item.can.toLocaleString('en-US') }} 캔
+ {{ formatNumber(item.can) }} 캔
- {{ item.rewardCan.toLocaleString('en-US') }} 캔
+ {{ formatNumber(item.rewardCan) }} 캔
@@ -70,7 +70,13 @@
+
@@ -125,12 +131,17 @@ export default {
price: null,
can: null,
reward_can: null,
+ currency: 'KRW',
+ currencies: [
+ { text: 'KRW (한국 원)', value: 'KRW' },
+ { text: 'USD (미국 달러)', value: 'USD' }
+ ],
headers: [
{
- text: '원화(VAT포함)',
+ text: '가격(VAT포함)',
align: 'center',
sortable: false,
- value: 'price',
+ value: 'priceStr',
},
{
text: '충전캔',
@@ -173,9 +184,26 @@ export default {
this.can = null
this.price = null
this.reward_can = null
+ this.currency = 'KRW'
this.selected_can = null
},
+ formatMoney(priceStr, currencyCode, locale = navigator.language) {
+ const price = Number(priceStr);
+ const formatted = new Intl.NumberFormat(locale, {
+ style: 'currency',
+ currency: currencyCode
+ }).format(price);
+
+ return formatted.replace(/([^\d\s])(\d)/, '$1 $2');
+ },
+
+ formatNumber(num) {
+ return new Intl.NumberFormat(navigator.language, {
+ style: 'decimal'
+ }).format(num);
+ },
+
async getCans() {
this.isLoading = true
try {
@@ -204,13 +232,14 @@ export default {
async submit() {
this.isLoading = true
- const res = await api.insertCan(this.can, this.reward_can, this.price)
+ const res = await api.insertCan(this.can, this.reward_can, this.price, this.currency)
if (res.status === 200 && res.data.success === true) {
this.show_dialog = false
this.can = null
this.price = null
this.reward_can = null
+ this.currency = 'KRW'
this.selected_can = null
this.notifySuccess(res.data.message || '등록되었습니다.')
diff --git a/src/views/Creator/CreatorSettlementRatio.vue b/src/views/Creator/CreatorSettlementRatio.vue
index 56f0fc2..e889ef8 100644
--- a/src/views/Creator/CreatorSettlementRatio.vue
+++ b/src/views/Creator/CreatorSettlementRatio.vue
@@ -53,6 +53,24 @@
{{ item.communitySettlementRatio }}%
+
+
+ 수정
+
+
+ 삭제
+
+
@@ -73,13 +91,20 @@
persistent
>
- 크리에이터 정산비율
-
+ {{ is_edit ? '크리에이터 정산비율 수정' : '크리에이터 정산비율' }}
+
+
+
+
- 등록하기
+ {{ is_edit ? '수정하기' : '등록하기' }}
@@ -142,6 +167,8 @@ export default {
items: [],
creator_settlement_ratio: {},
show_write_dialog: false,
+ is_edit: false,
+ editing_item_id: null,
headers: [
{
text: '닉네임',
@@ -173,6 +200,12 @@ export default {
sortable: false,
value: 'communitySettlementRatio',
},
+ {
+ text: '관리',
+ align: 'center',
+ sortable: false,
+ value: 'actions',
+ },
],
}
},
@@ -191,11 +224,16 @@ export default {
},
showWriteDialog() {
+ this.is_edit = false
+ this.editing_item_id = null
+ this.creator_settlement_ratio = {}
this.show_write_dialog = true
},
cancel() {
this.creator_settlement_ratio = {}
+ this.is_edit = false
+ this.editing_item_id = null
this.show_write_dialog = false
},
@@ -225,7 +263,11 @@ export default {
return
}
- this.createCreatorSettlementRatio();
+ if (this.is_edit) {
+ this.updateCreatorSettlementRatio();
+ } else {
+ this.createCreatorSettlementRatio();
+ }
},
async createCreatorSettlementRatio() {
@@ -253,6 +295,71 @@ export default {
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() {
this.is_loading = true
@@ -279,10 +386,6 @@ export default {
},
async next() {
- if (this.search_word.length < 2) {
- this.search_word = ''
- }
-
await this.getSettlementRatio()
},
},