Compare commits
112 Commits
0d494d3482
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 17ff1b817d | |||
|
|
90377bdb3c | ||
|
|
a58a5cc0d1 | ||
|
|
e7c95ab91b | ||
|
|
ad4d498eeb | ||
|
|
c72e1c18df | ||
|
|
9435334734 | ||
|
|
f01f002614 | ||
| 6769d8d485 | |||
|
|
a833f0b6b8 | ||
| 860b3c7bab | |||
|
|
9b756cbaf1 | ||
| 7d694a4c36 | |||
|
|
de18086699 | ||
| cae9e9a430 | |||
|
|
2e499483dd | ||
|
|
ceee1681c9 | ||
| f90f8f6250 | |||
| abb15cb2c7 | |||
| b26837f258 | |||
| f42602886e | |||
| b8373829f0 | |||
| 2769c3c9f0 | |||
| 648d4d3a97 | |||
| 4baf253b7e | |||
| e0c63df2a6 | |||
| 892923becc | |||
| d3ea703204 | |||
| 70298b8f8f | |||
| 9fa9f3e699 | |||
| d82531583c | |||
| 6240a285c2 | |||
| f577ab575e | |||
| 0c3e3fc3fd | |||
| 6886c372aa | |||
| 8dd3dcb770 | |||
| 1a435b6074 | |||
| 492859dae3 | |||
| 18b59b5598 | |||
| 5fcdd7f06d | |||
| 1e149f7e41 | |||
| aca3767a24 | |||
| d51655f15e | |||
| 47dd32939f | |||
| 2e1891ab08 | |||
| 99d70cc8f7 | |||
| 9f1675e82d | |||
| c2838be2ed | |||
| b5c2941c0d | |||
| d5c01d8d23 | |||
| 7118b0649a | |||
| 8f5346581e | |||
| e43f2e30be | |||
| 397fd267e0 | |||
| fe4b88350b | |||
| 537474e162 | |||
| b5abdf3cf5 | |||
| a2e457b5e8 | |||
| 05ddd417cd | |||
| e70426af68 | |||
| 81b33e1322 | |||
| 588fcfbe90 | |||
| ff2c126382 | |||
| 702daca29f | |||
| 8e9008a3c1 | |||
| 5c0c00aad4 | |||
| e0949c6d73 | |||
| 0449bac8d5 | |||
| d412c15c9d | |||
| ed16a6ddad | |||
| f06e2d41e0 | |||
| 7505269db3 | |||
| 15eeb6943d | |||
| 7e7ed46cea | |||
| fd01786649 | |||
| c48c1c2f09 | |||
| 9bcf3a3cdb | |||
| 4c5b987d98 | |||
| f168403048 | |||
| 82ee1584e7 | |||
| 65cb918389 | |||
| 784baf9a2f | |||
| 7a85ac41cc | |||
| 9d4c9437cf | |||
| 68845aeae1 | |||
| bbdca29337 | |||
| c14c041daa | |||
| a515a144eb | |||
| 54a6773905 | |||
| d97087b4e9 | |||
| ddb2449053 | |||
| 8aca07cdf7 | |||
| 0ba845d95a | |||
| 64b1fd5395 | |||
| 639bea70fa | |||
| 6a89ba059b | |||
| ff83041585 | |||
| e660be0bf4 | |||
| 62cdd57069 | |||
| f8346ed5ef | |||
| 9656b9a9d1 | |||
| 97a58266bb | |||
| 8fc0cfa345 | |||
| 22f9c2287d | |||
| 9284f7d5c3 | |||
| e6f27a4529 | |||
| 6a33d1c024 | |||
| 3b83789c15 | |||
| 55f0ab9af3 | |||
| 9b168a6112 | |||
| c47937933e | |||
| 4744fe7d9a |
@@ -1,7 +1,7 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
async function login(email, password) {
|
async function login(email, password) {
|
||||||
return Vue.axios.post('/member/login', {
|
return Vue.axios.post('/admin/member/login', {
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
isAdmin: true,
|
isAdmin: true,
|
||||||
|
|||||||
37
src/api/original_series_settlement.js
Normal file
37
src/api/original_series_settlement.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import Vue from 'vue';
|
||||||
|
|
||||||
|
// 소지 유저 조회
|
||||||
|
async function getOwners() {
|
||||||
|
return Vue.axios.get('/admin/calculate/original-series/owners');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 정산 내역 조회 (page는 1부터 시작하는 UI 기준, 서버에는 0부터 전달)
|
||||||
|
async function getSettlementDetails({ startDate, endDate, creatorId, page = 1, size = 10 }) {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
// 서버 파라미터 스펙 변경: start_date, end_date, creator_id
|
||||||
|
if (startDate) params.append('start_date', startDate);
|
||||||
|
if (endDate) params.append('end_date', endDate);
|
||||||
|
if (creatorId != null) params.append("creator_id", creatorId);
|
||||||
|
params.append('page', Math.max(0, (page || 1) - 1));
|
||||||
|
params.append('size', size || 10);
|
||||||
|
|
||||||
|
return Vue.axios.get(`/admin/calculate/original-series/settlement-details?${params.toString()}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 엑셀 다운로드 (xlsx 바이너리)
|
||||||
|
async function downloadSettlementExcel({ startDate, endDate }) {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
// 서버 파라미터 스펙 변경: start_date, end_date
|
||||||
|
if (startDate) params.append('start_date', startDate);
|
||||||
|
if (endDate) params.append('end_date', endDate);
|
||||||
|
|
||||||
|
return Vue.axios.get(`/admin/calculate/original-series/settlement-details/excel?${params.toString()}` , {
|
||||||
|
responseType: 'blob'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
getOwners,
|
||||||
|
getSettlementDetails,
|
||||||
|
downloadSettlementExcel,
|
||||||
|
};
|
||||||
@@ -94,9 +94,16 @@ export default {
|
|||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
try {
|
try {
|
||||||
let res = await api.getMenus();
|
let res = await api.getMenus();
|
||||||
if (res.status === 200 && res.data.success === true && res.data.data.length > 0) {
|
if (res.status === 200 && res.data.success === true) {
|
||||||
this.items = res.data.data
|
// 기본 메뉴 설정 (API 결과가 비어있을 수 있음)
|
||||||
|
this.items = Array.isArray(res.data.data) ? res.data.data : []
|
||||||
|
|
||||||
|
// 현재 사용자 역할 확인
|
||||||
|
const role = (this.$store && this.$store.state && this.$store.state.accountStore && this.$store.state.accountStore.role)
|
||||||
|
|| localStorage.role
|
||||||
|
|
||||||
|
// ADMIN 권한 전용 추가 메뉴들
|
||||||
|
if (role === 'ADMIN') {
|
||||||
// '시리즈 관리' 메뉴에 '배너 등록' 하위 메뉴 추가
|
// '시리즈 관리' 메뉴에 '배너 등록' 하위 메뉴 추가
|
||||||
try {
|
try {
|
||||||
const seriesMenu = this.items.find(m => m && m.title === '시리즈 관리')
|
const seriesMenu = this.items.find(m => m && m.title === '시리즈 관리')
|
||||||
@@ -173,9 +180,9 @@ export default {
|
|||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
// 정산 관리 메뉴에 '채널 후원 정산' 추가
|
// 정산현황 메뉴에 '채널 후원 정산' 및 '오리지널 시리즈 정산' 추가
|
||||||
try {
|
try {
|
||||||
const calculateMenu = this.items.find(m => m && m.title === '정산 관리')
|
const calculateMenu = this.items.find(m => m && m.title === '정산현황')
|
||||||
if (calculateMenu) {
|
if (calculateMenu) {
|
||||||
if (!Array.isArray(calculateMenu.items)) {
|
if (!Array.isArray(calculateMenu.items)) {
|
||||||
calculateMenu.items = calculateMenu.items ? [].concat(calculateMenu.items) : []
|
calculateMenu.items = calculateMenu.items ? [].concat(calculateMenu.items) : []
|
||||||
@@ -188,10 +195,35 @@ export default {
|
|||||||
items: null
|
items: null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const existsOriginal = calculateMenu.items.some(ci => ci && ci.route === '/calculate/original-series')
|
||||||
|
if (!existsOriginal) {
|
||||||
|
calculateMenu.items.push({
|
||||||
|
title: '오리지널 시리즈 정산',
|
||||||
|
route: '/calculate/original-series',
|
||||||
|
items: null
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 조회한 메뉴가 비어 있고, 콘텐츠 매니저라면 기본 메뉴 추가
|
||||||
|
if (this.items.length === 0 && role === 'CONTENT_MANAGER') {
|
||||||
|
this.items.push({
|
||||||
|
title: '콘텐츠 리스트',
|
||||||
|
route: '/content/list',
|
||||||
|
items: null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 그래도 비어있다면 이전 동작과 동일하게 처리
|
||||||
|
if (this.items.length === 0) {
|
||||||
|
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
|
||||||
|
this.logout();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
|
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 로그인 해주세요!")
|
||||||
this.logout();
|
this.logout();
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ const routes = [
|
|||||||
component: () => import(/* webpackChunkName: "counselor" */ '../views/Creator/CreatorSettlementRatio.vue')
|
component: () => import(/* webpackChunkName: "counselor" */ '../views/Creator/CreatorSettlementRatio.vue')
|
||||||
},
|
},
|
||||||
// Agent Management
|
// Agent Management
|
||||||
|
{
|
||||||
|
path: '/calculate/original-series',
|
||||||
|
name: 'OriginalSeriesSettlement',
|
||||||
|
component: () => import(/* webpackChunkName: "calculate" */ '../views/Calculate/OriginalSeriesSettlement.vue')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/agent/list',
|
path: '/agent/list',
|
||||||
name: 'AgentList',
|
name: 'AgentList',
|
||||||
|
|||||||
@@ -12,17 +12,13 @@ enhanceAccessToken();
|
|||||||
const accountStore = {
|
const accountStore = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
userId: '',
|
|
||||||
nickname: '',
|
|
||||||
accessToken: '',
|
accessToken: '',
|
||||||
profileImage: '',
|
role: '',
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
isAuthenticated(state) {
|
isAuthenticated(state) {
|
||||||
state.userId = state.userId || localStorage.userId
|
|
||||||
state.nickname = state.nickname || localStorage.nickname
|
|
||||||
state.profileImage = state.profileImage || localStorage.profileImage
|
|
||||||
state.accessToken = state.accessToken || localStorage.accessToken
|
state.accessToken = state.accessToken || localStorage.accessToken
|
||||||
|
state.role = state.role || localStorage.role
|
||||||
|
|
||||||
return state.accessToken !== undefined &&
|
return state.accessToken !== undefined &&
|
||||||
state.accessToken !== null &&
|
state.accessToken !== null &&
|
||||||
@@ -31,27 +27,19 @@ const accountStore = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
LOGIN(state, {userId, nickname, token, profileImage}) {
|
LOGIN(state, {token, role}) {
|
||||||
state.userId = userId
|
|
||||||
localStorage.userId = userId
|
|
||||||
|
|
||||||
state.nickname = nickname
|
|
||||||
localStorage.nickname = nickname
|
|
||||||
|
|
||||||
state.profileImage = profileImage
|
|
||||||
localStorage.profileImage = profileImage
|
|
||||||
|
|
||||||
state.accessToken = token
|
state.accessToken = token
|
||||||
localStorage.accessToken = token
|
localStorage.accessToken = token
|
||||||
|
|
||||||
|
state.role = role
|
||||||
|
localStorage.role = role
|
||||||
|
|
||||||
Vue.axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
Vue.axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
LOGOUT(state) {
|
LOGOUT(state) {
|
||||||
state.userId = ''
|
|
||||||
state.nickname = ''
|
|
||||||
state.profileImage = ''
|
|
||||||
state.accessToken = ''
|
state.accessToken = ''
|
||||||
|
state.role = ''
|
||||||
|
|
||||||
localStorage.clear()
|
localStorage.clear()
|
||||||
if (location.pathname === '/') {
|
if (location.pathname === '/') {
|
||||||
|
|||||||
@@ -289,6 +289,8 @@ export default {
|
|||||||
searchQuery: '',
|
searchQuery: '',
|
||||||
searchItems: [],
|
searchItems: [],
|
||||||
searchLoading: false,
|
searchLoading: false,
|
||||||
|
// 디바운스 타이머 보관
|
||||||
|
searchDebounceTimer: null,
|
||||||
},
|
},
|
||||||
|
|
||||||
unassignDialog: {
|
unassignDialog: {
|
||||||
@@ -316,22 +318,50 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.fetchList(1)
|
this.fetchList(1)
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// 검색 디바운스 타이머 정리
|
||||||
|
if (this.assignDialog && this.assignDialog.searchDebounceTimer) {
|
||||||
|
clearTimeout(this.assignDialog.searchDebounceTimer)
|
||||||
|
this.assignDialog.searchDebounceTimer = null
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
notifyError(message) {
|
||||||
|
// vuetify-dialog 플러그인을 통해 오류 노출
|
||||||
|
if (this.$dialog && this.$dialog.notify && this.$dialog.notify.error) {
|
||||||
|
this.$dialog.notify.error(message)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getErrorMessage(e) {
|
||||||
|
const fallback = '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.'
|
||||||
|
try {
|
||||||
|
if (!e) return fallback
|
||||||
|
// axios 형태의 에러 응답을 우선 사용
|
||||||
|
const msg = (e.response && e.response.data && (e.response.data.message || e.response.data.error || e.response.data.msg))
|
||||||
|
|| e.message
|
||||||
|
return msg || fallback
|
||||||
|
} catch (_) {
|
||||||
|
return fallback
|
||||||
|
}
|
||||||
|
},
|
||||||
async fetchList(page = this.page) {
|
async fetchList(page = this.page) {
|
||||||
if (this.is_loading) return
|
if (this.is_loading) return
|
||||||
this.is_loading = true
|
this.is_loading = true
|
||||||
try {
|
try {
|
||||||
this.page = page
|
this.page = page
|
||||||
const res = await getAgentAssignedCreatorList(this.agentId, Math.max(1, this.page), this.page_size)
|
const res = await getAgentAssignedCreatorList(this.agentId, Math.max(1, this.page), this.page_size)
|
||||||
// ApiResponse<GetAdminAgentAssignedCreatorResponse>
|
if (res && res.status === 200 && res.data && res.data.success === true) {
|
||||||
let payload = res && res.data ? res.data : null
|
const data = (res.data && res.data.data) || { totalCount: 0, items: [] }
|
||||||
if (payload && payload.data) payload = payload.data
|
|
||||||
const data = payload || { totalCount: 0, items: [] }
|
|
||||||
this.totalCount = data.totalCount || 0
|
this.totalCount = data.totalCount || 0
|
||||||
this.items = Array.isArray(data.items) ? data.items : []
|
this.items = Array.isArray(data.items) ? data.items : []
|
||||||
|
} else {
|
||||||
|
const msg = res && res.data && (res.data.message || res.data.error || res.data.msg)
|
||||||
|
this.notifyError(msg || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.totalCount = 0
|
this.totalCount = 0
|
||||||
this.items = []
|
this.items = []
|
||||||
|
this.notifyError(this.getErrorMessage(e))
|
||||||
} finally {
|
} finally {
|
||||||
this.is_loading = false
|
this.is_loading = false
|
||||||
}
|
}
|
||||||
@@ -345,41 +375,81 @@ export default {
|
|||||||
},
|
},
|
||||||
closeAssignDialog() {
|
closeAssignDialog() {
|
||||||
this.assignDialog.visible = false
|
this.assignDialog.visible = false
|
||||||
|
// 다이얼로그 닫힐 때 디바운스 및 로딩 상태 초기화
|
||||||
|
if (this.assignDialog.searchDebounceTimer) {
|
||||||
|
clearTimeout(this.assignDialog.searchDebounceTimer)
|
||||||
|
this.assignDialog.searchDebounceTimer = null
|
||||||
|
}
|
||||||
|
this.assignDialog.searchLoading = false
|
||||||
},
|
},
|
||||||
async onSearchCreators(q) {
|
onSearchCreators(q) {
|
||||||
const query = (q || '').trim()
|
const query = (q || '').trim()
|
||||||
this.assignDialog.searchQuery = query
|
this.assignDialog.searchQuery = query
|
||||||
|
|
||||||
|
// 기존 타이머가 있으면 취소
|
||||||
|
if (this.assignDialog.searchDebounceTimer) {
|
||||||
|
clearTimeout(this.assignDialog.searchDebounceTimer)
|
||||||
|
this.assignDialog.searchDebounceTimer = null
|
||||||
|
}
|
||||||
|
|
||||||
if (!query) {
|
if (!query) {
|
||||||
|
// 검색어 없으면 결과/로딩 초기화
|
||||||
this.assignDialog.searchItems = []
|
this.assignDialog.searchItems = []
|
||||||
|
this.assignDialog.searchLoading = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 디바운스: 300ms 이후 최신 검색어로 요청
|
||||||
|
this.assignDialog.searchDebounceTimer = setTimeout(async () => {
|
||||||
|
// 요청 직전 로딩 시작
|
||||||
this.assignDialog.searchLoading = true
|
this.assignDialog.searchLoading = true
|
||||||
|
const currentQuery = this.assignDialog.searchQuery
|
||||||
try {
|
try {
|
||||||
const res = await searchAdminAgentAssignableCreators(query)
|
const res = await searchAdminAgentAssignableCreators(currentQuery)
|
||||||
let payload = res && res.data ? res.data : null
|
// 사용자가 그 사이에 검색어를 바꿨다면 이 응답은 무시
|
||||||
if (payload && payload.data) payload = payload.data
|
if (this.assignDialog.searchQuery !== currentQuery) return
|
||||||
const data = payload || { totalCount: 0, items: [] }
|
|
||||||
|
if (res && res.status === 200 && res.data && res.data.success === true) {
|
||||||
|
const data = (res.data && res.data.data) || { totalCount: 0, items: [] }
|
||||||
this.assignDialog.searchItems = Array.isArray(data.items) ? data.items : []
|
this.assignDialog.searchItems = Array.isArray(data.items) ? data.items : []
|
||||||
} catch (e) {
|
} else {
|
||||||
this.assignDialog.searchItems = []
|
this.assignDialog.searchItems = []
|
||||||
|
const msg = res && res.data && (res.data.message || res.data.error || res.data.msg)
|
||||||
|
this.notifyError(msg || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// 에러 시에도 최신 검색어와 일치할 때만 처리
|
||||||
|
if (this.assignDialog.searchQuery === currentQuery) {
|
||||||
|
this.assignDialog.searchItems = []
|
||||||
|
this.notifyError(this.getErrorMessage(e))
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
// 최신 검색어와 일치할 때만 로딩 해제
|
||||||
|
if (this.assignDialog.searchQuery === currentQuery) {
|
||||||
this.assignDialog.searchLoading = false
|
this.assignDialog.searchLoading = false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}, 300)
|
||||||
},
|
},
|
||||||
async onAssign() {
|
async onAssign() {
|
||||||
if (!this.canAssign) return
|
if (!this.canAssign) return
|
||||||
this.assignDialog.loading = true
|
this.assignDialog.loading = true
|
||||||
try {
|
try {
|
||||||
const assignedAt = `${this.assignDialog.assignedDate}T00:00:00`
|
const assignedAt = `${this.assignDialog.assignedDate}T00:00:00`
|
||||||
await assignAgentCreator({
|
const res = await assignAgentCreator({
|
||||||
agentId: Number(this.agentId),
|
agentId: Number(this.agentId),
|
||||||
creatorId: Number(this.assignDialog.selectedCreatorId),
|
creatorId: Number(this.assignDialog.selectedCreatorId),
|
||||||
assignedAt,
|
assignedAt,
|
||||||
})
|
})
|
||||||
|
if (res && res.status === 200 && res.data && res.data.success === true) {
|
||||||
this.closeAssignDialog()
|
this.closeAssignDialog()
|
||||||
this.fetchList(1)
|
this.fetchList(1)
|
||||||
|
} else {
|
||||||
|
const msg = res && res.data && (res.data.message || res.data.error || res.data.msg)
|
||||||
|
this.notifyError(msg || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// noop: 에러 토스트 자리는 프로젝트 전역 플러그인 유무에 따라 추가 가능
|
this.notifyError(this.getErrorMessage(e))
|
||||||
} finally {
|
} finally {
|
||||||
this.assignDialog.loading = false
|
this.assignDialog.loading = false
|
||||||
}
|
}
|
||||||
@@ -400,14 +470,19 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const time = this.unassignDialog.time || '00:00'
|
const time = this.unassignDialog.time || '00:00'
|
||||||
const unassignedAt = `${this.unassignDialog.date}T${time}:00`
|
const unassignedAt = `${this.unassignDialog.date}T${time}:00`
|
||||||
await removeAgentCreator({
|
const res = await removeAgentCreator({
|
||||||
creatorId: Number(this.unassignDialog.target.creatorId),
|
creatorId: Number(this.unassignDialog.target.creatorId),
|
||||||
unassignedAt,
|
unassignedAt,
|
||||||
})
|
})
|
||||||
|
if (res && res.status === 200 && res.data && res.data.success === true) {
|
||||||
this.closeUnassignDialog()
|
this.closeUnassignDialog()
|
||||||
this.fetchList(this.page)
|
this.fetchList(this.page)
|
||||||
|
} else {
|
||||||
|
const msg = res && res.data && (res.data.message || res.data.error || res.data.msg)
|
||||||
|
this.notifyError(msg || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// noop
|
this.notifyError(this.getErrorMessage(e))
|
||||||
} finally {
|
} finally {
|
||||||
this.unassignDialog.loading = false
|
this.unassignDialog.loading = false
|
||||||
}
|
}
|
||||||
|
|||||||
340
src/views/Calculate/OriginalSeriesSettlement.vue
Normal file
340
src/views/Calculate/OriginalSeriesSettlement.vue
Normal file
@@ -0,0 +1,340 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<v-toolbar dark>
|
||||||
|
<v-btn
|
||||||
|
icon
|
||||||
|
@click="$router.back()"
|
||||||
|
>
|
||||||
|
<v-icon>mdi-arrow-left</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
<v-toolbar-title>오리지널 시리즈 정산</v-toolbar-title>
|
||||||
|
<v-spacer />
|
||||||
|
<v-btn
|
||||||
|
color="primary"
|
||||||
|
:loading="excelLoading"
|
||||||
|
@click="onDownloadExcel"
|
||||||
|
>
|
||||||
|
엑셀 다운로드
|
||||||
|
</v-btn>
|
||||||
|
</v-toolbar>
|
||||||
|
|
||||||
|
<v-container>
|
||||||
|
<!-- 필터 영역 -->
|
||||||
|
<v-row
|
||||||
|
class="mt-2 mb-2"
|
||||||
|
align="center"
|
||||||
|
justify="end"
|
||||||
|
>
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="3"
|
||||||
|
>
|
||||||
|
<v-autocomplete
|
||||||
|
v-model="selectedCreatorId"
|
||||||
|
:items="ownerOptions"
|
||||||
|
:loading="ownersLoading"
|
||||||
|
item-text="nickname"
|
||||||
|
item-value="creatorId"
|
||||||
|
label="멤버 선택"
|
||||||
|
dense
|
||||||
|
clearable
|
||||||
|
hide-details
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="3"
|
||||||
|
>
|
||||||
|
<v-menu
|
||||||
|
v-model="menuStart"
|
||||||
|
:close-on-content-click="false"
|
||||||
|
transition="scale-transition"
|
||||||
|
offset-y
|
||||||
|
min-width="auto"
|
||||||
|
>
|
||||||
|
<template v-slot:activator="{ on, attrs }">
|
||||||
|
<v-text-field
|
||||||
|
v-bind="attrs"
|
||||||
|
label="시작일"
|
||||||
|
readonly
|
||||||
|
dense
|
||||||
|
:value="startDateStr"
|
||||||
|
v-on="on"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<v-date-picker
|
||||||
|
v-model="startDateStr"
|
||||||
|
scrollable
|
||||||
|
@input="menuStart = false"
|
||||||
|
/>
|
||||||
|
</v-menu>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="3"
|
||||||
|
>
|
||||||
|
<v-menu
|
||||||
|
v-model="menuEnd"
|
||||||
|
:close-on-content-click="false"
|
||||||
|
transition="scale-transition"
|
||||||
|
offset-y
|
||||||
|
min-width="auto"
|
||||||
|
>
|
||||||
|
<template v-slot:activator="{ on, attrs }">
|
||||||
|
<v-text-field
|
||||||
|
v-bind="attrs"
|
||||||
|
label="종료일"
|
||||||
|
readonly
|
||||||
|
dense
|
||||||
|
:value="endDateStr"
|
||||||
|
v-on="on"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<v-date-picker
|
||||||
|
v-model="endDateStr"
|
||||||
|
scrollable
|
||||||
|
@input="menuEnd = false"
|
||||||
|
/>
|
||||||
|
</v-menu>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="2"
|
||||||
|
>
|
||||||
|
<v-btn
|
||||||
|
color="primary"
|
||||||
|
:loading="isLoading"
|
||||||
|
@click="onSearch"
|
||||||
|
>
|
||||||
|
조회
|
||||||
|
</v-btn>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<!-- 테이블 영역 -->
|
||||||
|
<v-data-table
|
||||||
|
:headers="headers"
|
||||||
|
:items="items"
|
||||||
|
:loading="isLoading"
|
||||||
|
:items-per-page="pageSize"
|
||||||
|
class="elevation-1"
|
||||||
|
disable-pagination
|
||||||
|
hide-default-footer
|
||||||
|
>
|
||||||
|
<template v-slot:no-data>
|
||||||
|
<div class="text-center grey--text pa-6">
|
||||||
|
데이터가 없습니다.
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:item.price="{ item }">
|
||||||
|
<span>{{ numberFormat(item.price) }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-slot:item.totalCan="{ item }">
|
||||||
|
<span>{{ numberFormat(item.totalCan) }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-slot:item.totalPoint="{ item }">
|
||||||
|
<span>{{ numberFormat(item.totalPoint) }}</span>
|
||||||
|
</template>
|
||||||
|
</v-data-table>
|
||||||
|
|
||||||
|
<v-row
|
||||||
|
class="mt-4"
|
||||||
|
justify="center"
|
||||||
|
>
|
||||||
|
<v-pagination
|
||||||
|
v-model="page"
|
||||||
|
:length="totalPages"
|
||||||
|
:total-visible="7"
|
||||||
|
@input="fetchList"
|
||||||
|
/>
|
||||||
|
</v-row>
|
||||||
|
</v-container>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getOwners,
|
||||||
|
getSettlementDetails,
|
||||||
|
downloadSettlementExcel,
|
||||||
|
} from "@/api/original_series_settlement";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "OriginalSeriesSettlement",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 필터 상태
|
||||||
|
ownersLoading: false,
|
||||||
|
ownerOptions: [],
|
||||||
|
selectedCreatorId: null,
|
||||||
|
startDateStr: "",
|
||||||
|
endDateStr: "",
|
||||||
|
menuStart: false,
|
||||||
|
menuEnd: false,
|
||||||
|
|
||||||
|
// 목록 상태
|
||||||
|
isLoading: false,
|
||||||
|
items: [],
|
||||||
|
totalCount: 0,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
|
||||||
|
excelLoading: false,
|
||||||
|
|
||||||
|
headers: [
|
||||||
|
{ text: "시리즈 제목", value: "seriesTitle", align: "center" },
|
||||||
|
{ text: "콘텐츠 제목", value: "contentTitle", align: "center" },
|
||||||
|
{ text: "가격", value: "price", align: "center" },
|
||||||
|
{ text: "구분", value: "orderType", align: "center" },
|
||||||
|
{ text: "판매 수", value: "salesCount", align: "center" },
|
||||||
|
{ text: "합계(캔)", value: "totalCan", align: "center" },
|
||||||
|
{ text: "합계(포인트)", value: "totalPoint", align: "center" },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
totalPages() {
|
||||||
|
return Math.max(1, Math.ceil(this.totalCount / this.pageSize));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initDefaultDates();
|
||||||
|
this.loadOwners();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
numberFormat(v) {
|
||||||
|
if (v === null || v === undefined) return "-";
|
||||||
|
try {
|
||||||
|
return Number(v).toLocaleString();
|
||||||
|
} catch (e) {
|
||||||
|
return String(v);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
notifyError(message) {
|
||||||
|
this.$dialog.notify.error(message);
|
||||||
|
},
|
||||||
|
notifySuccess(message) {
|
||||||
|
this.$dialog.notify.success(message);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 이번 달 1일 ~ 오늘
|
||||||
|
initDefaultDates() {
|
||||||
|
const now = new Date();
|
||||||
|
const y = now.getFullYear();
|
||||||
|
const m = now.getMonth();
|
||||||
|
const first = new Date(y, m, 1);
|
||||||
|
const pad = (n) => (n < 10 ? "0" + n : "" + n);
|
||||||
|
this.startDateStr = `${first.getFullYear()}-${pad(
|
||||||
|
first.getMonth() + 1
|
||||||
|
)}-${pad(first.getDate())}`;
|
||||||
|
this.endDateStr = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(
|
||||||
|
now.getDate()
|
||||||
|
)}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
async loadOwners() {
|
||||||
|
this.ownersLoading = true;
|
||||||
|
try {
|
||||||
|
const res = await getOwners();
|
||||||
|
if (res.status === 200 && res.data && res.data.success) {
|
||||||
|
const list = Array.isArray(res.data.data) ? res.data.data : [];
|
||||||
|
this.ownerOptions = list;
|
||||||
|
// 가장 조회된 값 순서로 온다고 가정, 첫 번째를 기본 선택
|
||||||
|
if (list.length > 0) {
|
||||||
|
this.selectedCreatorId = list[0].creatorId;
|
||||||
|
}
|
||||||
|
// 초기 조회 (이번 달 범위, 기본 멤버)
|
||||||
|
this.page = 1;
|
||||||
|
await this.fetchList();
|
||||||
|
} else {
|
||||||
|
this.notifyError(
|
||||||
|
res.data && res.data.message
|
||||||
|
? res.data.message
|
||||||
|
: "소지 유저 조회 실패"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.notifyError("소지 유저 조회 중 오류가 발생했습니다.");
|
||||||
|
} finally {
|
||||||
|
this.ownersLoading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async onSearch() {
|
||||||
|
this.page = 1;
|
||||||
|
await this.fetchList();
|
||||||
|
},
|
||||||
|
|
||||||
|
async fetchList() {
|
||||||
|
if (!this.selectedCreatorId) {
|
||||||
|
this.items = [];
|
||||||
|
this.totalCount = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.isLoading = true;
|
||||||
|
try {
|
||||||
|
const res = await getSettlementDetails({
|
||||||
|
startDate: this.startDateStr,
|
||||||
|
endDate: this.endDateStr,
|
||||||
|
creatorId: this.selectedCreatorId,
|
||||||
|
page: this.page,
|
||||||
|
size: this.pageSize,
|
||||||
|
});
|
||||||
|
if (res.status === 200 && res.data) {
|
||||||
|
if (res.data.success) {
|
||||||
|
const data = res.data.data || { totalCount: 0, items: [] };
|
||||||
|
this.totalCount = data.totalCount || 0;
|
||||||
|
this.items = Array.isArray(data.items) ? data.items : [];
|
||||||
|
} else {
|
||||||
|
this.notifyError(res.data.message || "정산 내역 조회 실패");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.notifyError("정산 내역 조회 실패");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.notifyError("정산 내역 조회 중 오류가 발생했습니다.");
|
||||||
|
} finally {
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async onDownloadExcel() {
|
||||||
|
this.excelLoading = true;
|
||||||
|
try {
|
||||||
|
const res = await downloadSettlementExcel({
|
||||||
|
startDate: this.startDateStr,
|
||||||
|
endDate: this.endDateStr,
|
||||||
|
});
|
||||||
|
const blob = new Blob([res.data], {
|
||||||
|
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
|
});
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.setAttribute("download", "오리지널_시리즈_정산.xlsx");
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
link.parentNode.removeChild(link);
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
this.notifySuccess("엑셀 다운로드가 시작되었습니다.");
|
||||||
|
} catch (e) {
|
||||||
|
this.notifyError("엑셀 다운로드 중 오류가 발생했습니다.");
|
||||||
|
} finally {
|
||||||
|
this.excelLoading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 테이블 헤더/바디 모두 가운데 정렬 */
|
||||||
|
.v-data-table table thead th,
|
||||||
|
.v-data-table table tbody td {
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -135,7 +135,8 @@ export default {
|
|||||||
currency: 'KRW',
|
currency: 'KRW',
|
||||||
currencies: [
|
currencies: [
|
||||||
{ text: 'KRW (한국 원)', value: 'KRW' },
|
{ text: 'KRW (한국 원)', value: 'KRW' },
|
||||||
{ text: 'USD (미국 달러)', value: 'USD' }
|
{ text: 'USD (미국 달러)', value: 'USD' },
|
||||||
|
{ text: 'JPY (일본 엔)', value: 'JPY' }
|
||||||
],
|
],
|
||||||
headers: [
|
headers: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
>
|
>
|
||||||
<v-btn
|
<v-btn
|
||||||
slot="append"
|
slot="append"
|
||||||
color="#9970ff"
|
color="#3bb9f1"
|
||||||
dark
|
dark
|
||||||
@click="search"
|
@click="search"
|
||||||
>
|
>
|
||||||
@@ -96,7 +96,10 @@
|
|||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
오픈 예정일
|
오픈 예정일
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">
|
<th
|
||||||
|
v-if="isAdmin"
|
||||||
|
class="text-center"
|
||||||
|
>
|
||||||
관리
|
관리
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -214,7 +217,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ item.date }}</td>
|
<td>{{ item.date }}</td>
|
||||||
<td>{{ item.releaseDate }}</td>
|
<td>{{ item.releaseDate }}</td>
|
||||||
<td>
|
<td v-if="isAdmin">
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col>
|
<v-col>
|
||||||
<v-btn
|
<v-btn
|
||||||
@@ -527,6 +530,14 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
isAdmin() {
|
||||||
|
const role = (this.$store && this.$store.state && this.$store.state.accountStore && this.$store.state.accountStore.role)
|
||||||
|
|| (typeof localStorage !== 'undefined' ? localStorage.role : '');
|
||||||
|
return role === 'ADMIN';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
this.audio_content = {
|
this.audio_content = {
|
||||||
id: null,
|
id: null,
|
||||||
@@ -539,7 +550,10 @@ export default {
|
|||||||
is_settlement_ratio_deleted: false,
|
is_settlement_ratio_deleted: false,
|
||||||
settlement_ratio: "",
|
settlement_ratio: "",
|
||||||
};
|
};
|
||||||
|
// ADMIN 권한일 때만 테마 리스트 조회
|
||||||
|
if (this.isAdmin) {
|
||||||
await this.getAudioContentThemeList();
|
await this.getAudioContentThemeList();
|
||||||
|
}
|
||||||
await this.getAudioContent();
|
await this.getAudioContent();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
>
|
>
|
||||||
<v-btn
|
<v-btn
|
||||||
slot="append"
|
slot="append"
|
||||||
color="#9970ff"
|
color="#3bb9f1"
|
||||||
dark
|
dark
|
||||||
@click="search"
|
@click="search"
|
||||||
>
|
>
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-row align="center">
|
<v-row align="center">
|
||||||
<v-col cols="4">
|
<v-col cols="4">
|
||||||
사용 여부
|
권한
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="8">
|
<v-col cols="8">
|
||||||
<v-radio-group
|
<v-radio-group
|
||||||
@@ -191,6 +191,10 @@
|
|||||||
value="USER"
|
value="USER"
|
||||||
label="일반회원"
|
label="일반회원"
|
||||||
/>
|
/>
|
||||||
|
<v-radio
|
||||||
|
value="CONTENT_MANAGER"
|
||||||
|
label="콘텐츠 관리자"
|
||||||
|
/>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
</v-radio-group>
|
</v-radio-group>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -451,6 +455,8 @@ export default {
|
|||||||
this.user_type = 'CREATOR'
|
this.user_type = 'CREATOR'
|
||||||
} else if (member.userType === '에이전트') {
|
} else if (member.userType === '에이전트') {
|
||||||
this.user_type = 'AGENT'
|
this.user_type = 'AGENT'
|
||||||
|
} else if (member.userType === '콘텐츠 관리자') {
|
||||||
|
this.user_type = 'CONTENT_MANAGER'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.email = member.email
|
this.email = member.email
|
||||||
@@ -519,7 +525,8 @@ export default {
|
|||||||
if (
|
if (
|
||||||
(this.user_type === 'CREATOR' && this.member.userType === '크리에이터') ||
|
(this.user_type === 'CREATOR' && this.member.userType === '크리에이터') ||
|
||||||
(this.user_type === 'USER' && this.member.userType === '일반회원') ||
|
(this.user_type === 'USER' && this.member.userType === '일반회원') ||
|
||||||
(this.user_type === 'AGENT' && this.member.userType === '에이전트')
|
(this.user_type === 'AGENT' && this.member.userType === '에이전트') ||
|
||||||
|
(this.user_type === 'CONTENT_MANAGER' && this.member.userType === '콘텐츠 관리자')
|
||||||
) {
|
) {
|
||||||
this.notifyError("변경사항이 없습니다.")
|
this.notifyError("변경사항이 없습니다.")
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user