Compare commits
6 Commits
d51655f15e
...
aca3767a24
Author | SHA1 | Date |
---|---|---|
|
aca3767a24 | |
![]() |
0aff527266 | |
![]() |
cea0887d90 | |
![]() |
d3f98ec9cb | |
![]() |
d8e75f299b | |
![]() |
256f65e370 |
|
@ -1,7 +1,7 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
async function getPointPolicyList(page) {
|
async function getPointPolicyList(page) {
|
||||||
return Vue.axios.get("/admin/point-policies?page=" + page + "&page_size=20")
|
return Vue.axios.get("/admin/point-policies?page=" + (page - 1) + "&page_size=20")
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createPointPolicyList(request) {
|
async function createPointPolicyList(request) {
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:item.policyType="{ item }">
|
||||||
|
{{ policy_type_map[item.policyType] }}
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-slot:item.actionType="{ item }">
|
<template v-slot:item.actionType="{ item }">
|
||||||
{{ action_type_map[item.actionType] }}
|
{{ action_type_map[item.actionType] }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -47,6 +51,10 @@
|
||||||
{{ item.threshold }} 번
|
{{ item.threshold }} 번
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:item.availableCount="{ item }">
|
||||||
|
{{ item.availableCount }} 번
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-slot:item.period="{ item }">
|
<template v-slot:item.period="{ item }">
|
||||||
{{ item.startDate }} ~ {{ item.endDate }}
|
{{ item.startDate }} ~ {{ item.endDate }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -101,6 +109,19 @@
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
<v-card-text v-if="selected_point_policy === null">
|
||||||
|
<v-radio-group
|
||||||
|
v-model="point_policy.policy_type"
|
||||||
|
label="지급 유형 선택"
|
||||||
|
>
|
||||||
|
<v-radio
|
||||||
|
v-for="item in policy_type_list"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</v-radio-group>
|
||||||
|
</v-card-text>
|
||||||
<v-card-text v-if="selected_point_policy === null">
|
<v-card-text v-if="selected_point_policy === null">
|
||||||
<v-radio-group
|
<v-radio-group
|
||||||
v-model="point_policy.action_type"
|
v-model="point_policy.action_type"
|
||||||
|
@ -128,6 +149,13 @@
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
<v-card-text v-if="selected_point_policy === null">
|
||||||
|
<v-text-field
|
||||||
|
v-model="point_policy.available_count"
|
||||||
|
label="참여 가능 횟수"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</v-card-text>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-row align="center">
|
<v-row align="center">
|
||||||
<v-col cols="4">
|
<v-col cols="4">
|
||||||
|
@ -210,24 +238,51 @@ export default {
|
||||||
show_write_dialog: false,
|
show_write_dialog: false,
|
||||||
|
|
||||||
action_type_list: [
|
action_type_list: [
|
||||||
{
|
|
||||||
name: '회원가입',
|
|
||||||
value: 'SIGN_UP'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: '본인인증',
|
name: '본인인증',
|
||||||
value: 'USER_AUTHENTICATION'
|
value: 'USER_AUTHENTICATION'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '콘텐츠 댓글',
|
||||||
|
value: 'CONTENT_COMMENT'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '구매한 콘텐츠 댓글',
|
||||||
|
value: 'ORDER_CONTENT_COMMENT'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '라이브 연속 청취 30분',
|
||||||
|
value: 'LIVE_CONTINUOUS_LISTEN_30'
|
||||||
|
},
|
||||||
],
|
],
|
||||||
action_type_map: {
|
action_type_map: {
|
||||||
'SIGN_UP': '회원가입',
|
'USER_AUTHENTICATION': '본인인증',
|
||||||
'USER_AUTHENTICATION': '본인인증'
|
'CONTENT_COMMENT': '콘텐츠 댓글',
|
||||||
|
'ORDER_CONTENT_COMMENT': '구매한 콘텐츠 댓글',
|
||||||
|
'LIVE_CONTINUOUS_LISTEN_30': '라이브 연속 청취 30분',
|
||||||
|
},
|
||||||
|
|
||||||
|
policy_type_list: [
|
||||||
|
{
|
||||||
|
name: '매일',
|
||||||
|
value: 'DAILY'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '전체',
|
||||||
|
value: 'TOTAL'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
policy_type_map: {
|
||||||
|
'DAILY': '매일',
|
||||||
|
'TOTAL': '전체',
|
||||||
},
|
},
|
||||||
|
|
||||||
point_policy: {
|
point_policy: {
|
||||||
title: '',
|
title: '',
|
||||||
|
policy_type: '',
|
||||||
action_type: '',
|
action_type: '',
|
||||||
threshold: 0,
|
threshold: 0,
|
||||||
|
available_count: 0,
|
||||||
point: 0,
|
point: 0,
|
||||||
start_date: '',
|
start_date: '',
|
||||||
end_date: ''
|
end_date: ''
|
||||||
|
@ -245,6 +300,12 @@ export default {
|
||||||
sortable: false,
|
sortable: false,
|
||||||
value: 'title',
|
value: 'title',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: '지급유형',
|
||||||
|
align: 'center',
|
||||||
|
sortable: false,
|
||||||
|
value: 'policyType',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: '액션',
|
text: '액션',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
@ -257,6 +318,12 @@ export default {
|
||||||
sortable: false,
|
sortable: false,
|
||||||
value: 'threshold',
|
value: 'threshold',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: '참여 가능 횟수',
|
||||||
|
align: 'center',
|
||||||
|
sortable: false,
|
||||||
|
value: 'availableCount',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: '기간',
|
text: '기간',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
@ -306,8 +373,10 @@ export default {
|
||||||
this.selected_point_policy = item;
|
this.selected_point_policy = item;
|
||||||
this.point_policy = {
|
this.point_policy = {
|
||||||
title: item.title,
|
title: item.title,
|
||||||
|
policy_type: item.policyType,
|
||||||
action_type: item.actionType,
|
action_type: item.actionType,
|
||||||
threshold: item.threshold,
|
threshold: item.threshold,
|
||||||
|
available_count: item.availableCount,
|
||||||
point: item.pointAmount,
|
point: item.pointAmount,
|
||||||
start_date: item.startDate,
|
start_date: item.startDate,
|
||||||
end_date: item.endDate,
|
end_date: item.endDate,
|
||||||
|
@ -322,18 +391,23 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.point_policy.policy_type.trim() === '') {
|
||||||
|
this.notifyError('지급유형을 선택하세요')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (this.point_policy.action_type.trim() === '') {
|
if (this.point_policy.action_type.trim() === '') {
|
||||||
this.notifyError('액션을 선택하세요')
|
this.notifyError('액션을 선택하세요')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNaN(this.point_policy.threshold)) {
|
if (isNaN(this.point_policy.threshold)) {
|
||||||
this.notifyError('참여 횟수는 숫자만 입력 가능합니다.')
|
this.notifyError('참여 해야하는 횟수는 숫자만 입력 가능합니다.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.point_policy.threshold <= 0) {
|
if (this.point_policy.threshold <= 0) {
|
||||||
this.notifyError('참여 횟수는 1이상 입력 가능합니다.')
|
this.notifyError('참여 해야하는 횟수는 1이상 입력 가능합니다.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +416,16 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isNaN(this.point_policy.available_count)) {
|
||||||
|
this.notifyError('참여 가능 횟수는 숫자만 입력 가능합니다.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.point_policy.available_count <= 0) {
|
||||||
|
this.notifyError('참여 가능 횟수는 1이상 입력 가능합니다.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (this.point_policy.start_date.trim() === '') {
|
if (this.point_policy.start_date.trim() === '') {
|
||||||
this.notifyError('정책 시작 날짜를 입력하세요')
|
this.notifyError('정책 시작 날짜를 입력하세요')
|
||||||
return
|
return
|
||||||
|
@ -351,33 +435,37 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.selected_charge_event = null;
|
|
||||||
this.point_policy = {
|
this.point_policy = {
|
||||||
title: '',
|
title: '',
|
||||||
|
policy_type: '',
|
||||||
action_type: '',
|
action_type: '',
|
||||||
threshold: 0,
|
threshold: 0,
|
||||||
|
available_count: 0,
|
||||||
point: 0,
|
point: 0,
|
||||||
start_date: '',
|
start_date: '',
|
||||||
end_date: ''
|
end_date: ''
|
||||||
}
|
}
|
||||||
this.show_write_dialog = false
|
this.show_write_dialog = false
|
||||||
|
this.selected_point_policy = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
if (this.is_loading) return;
|
if (this.is_loading) return;
|
||||||
|
|
||||||
this.is_loading = true
|
this.is_loading = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const request = {
|
const request = {
|
||||||
'title': this.point_policy.title,
|
'title': this.point_policy.title,
|
||||||
|
'policyType': this.point_policy.policy_type,
|
||||||
'actionType': this.point_policy.action_type,
|
'actionType': this.point_policy.action_type,
|
||||||
'threshold': this.point_policy.threshold,
|
'threshold': this.point_policy.threshold,
|
||||||
|
'availableCount': this.point_policy.available_count,
|
||||||
'pointAmount': this.point_policy.point,
|
'pointAmount': this.point_policy.point,
|
||||||
'startDate': this.point_policy.start_date,
|
'startDate': this.point_policy.start_date,
|
||||||
'endDate': this.point_policy.end_date
|
'endDate': this.point_policy.end_date
|
||||||
}
|
}
|
||||||
const res = await api.createPointPolicyList(request)
|
const res = await api.createPointPolicyList(request)
|
||||||
|
this.is_loading = false
|
||||||
|
|
||||||
if (res.status === 200 && res.data.success === true) {
|
if (res.status === 200 && res.data.success === true) {
|
||||||
this.cancel()
|
this.cancel()
|
||||||
|
@ -392,12 +480,11 @@ export default {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||||
}
|
}
|
||||||
|
|
||||||
this.is_loading = false
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async modify() {
|
async modify() {
|
||||||
if (this.is_loading) return;
|
if (this.is_loading) return;
|
||||||
|
this.is_loading = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const request = {}
|
const request = {}
|
||||||
|
@ -418,15 +505,13 @@ export default {
|
||||||
request.isActive = this.point_policy.is_active
|
request.isActive = this.point_policy.is_active
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(request);
|
|
||||||
|
|
||||||
const res = await api.updatePointPolicyList(this.selected_point_policy.id, request)
|
const res = await api.updatePointPolicyList(this.selected_point_policy.id, request)
|
||||||
|
this.is_loading = false
|
||||||
|
|
||||||
if (res.status === 200 && res.data.success === true) {
|
if (res.status === 200 && res.data.success === true) {
|
||||||
this.cancel()
|
this.cancel()
|
||||||
this.notifySuccess(res.data.message || '수정되었습니다.')
|
this.notifySuccess(res.data.message || '수정되었습니다.')
|
||||||
|
|
||||||
this.page = 1
|
|
||||||
this.point_policy_list = []
|
this.point_policy_list = []
|
||||||
await this.getPointPolicyList()
|
await this.getPointPolicyList()
|
||||||
} else {
|
} else {
|
||||||
|
@ -435,8 +520,6 @@ export default {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||||
}
|
}
|
||||||
|
|
||||||
this.is_loading = false
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async getPointPolicyList() {
|
async getPointPolicyList() {
|
||||||
|
@ -444,7 +527,7 @@ export default {
|
||||||
this.is_loading = true
|
this.is_loading = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await api.getPointPolicyList();
|
const res = await api.getPointPolicyList(this.page);
|
||||||
|
|
||||||
if (res.status === 200 && res.data.success === true) {
|
if (res.status === 200 && res.data.success === true) {
|
||||||
const data = res.data.data
|
const data = res.data.data
|
||||||
|
|
Loading…
Reference in New Issue