first commit

This commit is contained in:
Yu Sung
2023-08-04 23:02:15 +09:00
commit c60930a566
83 changed files with 38615 additions and 0 deletions

168
src/views/Can/CanCharge.vue Normal file
View File

@@ -0,0 +1,168 @@
<template>
<div>
<v-toolbar dark>
<v-spacer />
<v-toolbar-title>코인 충전</v-toolbar-title>
<v-spacer />
</v-toolbar>
<br>
<v-container>
<v-text-field
v-model="account_id"
label="회원번호"
outlined
required
/>
<v-text-field
v-model="method"
label="기록 내용"
outlined
required
/>
<v-text-field
v-model="coin"
label="지급할 코인 수"
outlined
required
/>
<v-row>
<v-col cols="10" />
<v-col>
<v-btn
block
color="#9970ff"
dark
depressed
@click="confirm"
>
코인 지급
</v-btn>
</v-col>
</v-row>
<v-row>
<v-dialog
v-model="show_confirm"
max-width="400px"
persistent
>
<v-card>
<v-card-title>코인 지급 확인</v-card-title>
<v-card-text>
회원번호: {{ account_id }}
</v-card-text>
<v-card-text>
기록내용: {{ method }}
</v-card-text>
<v-card-text>
지급할 코인 : {{ coin }}코인
</v-card-text>
<v-card-actions v-show="!isLoading">
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="submit"
>
코인 지급
</v-btn>
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="cancel"
>
취소
</v-btn>
<v-spacer />
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</v-container>
</div>
</template>
<script>
import * as api from '@/api/coin'
export default {
name: "CoinCharge",
data() {
return {
show_confirm: false,
isLoading: false,
account_id: '',
method: '',
coin: ''
}
},
methods: {
notifyError(message) {
this.$dialog.notify.error(message)
},
notifySuccess(message) {
this.$dialog.notify.success(message)
},
confirm() {
if (this.account_id.trim() === '' || isNaN(this.account_id)) {
return this.notifyError('코인을 지급할 회원의 회원번호를 입력하세요.')
}
if (this.method.trim() === '') {
return this.notifyError('기록할 내용을 입력하세요')
}
if (isNaN(this.coin)) {
return this.notifyError('코인은 숫자만 넣을 수 있습니다.')
}
if (!this.isLoading) {
this.show_confirm = true
}
},
cancel() {
this.show_confirm = false
},
async submit() {
if (!this.isLoading) {
this.isLoading = true
try {
this.show_confirm = false
const res = await api.paymentCoin(Number(this.coin), this.method, this.account_id)
if (res.status === 200 && res.data.success === true) {
this.notifySuccess('코인이 지급되었습니다.')
this.account_id = ''
this.method = ''
this.coin = ''
this.is_loading = false
} else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
this.is_loading = false
}
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
this.is_loading = false
} finally {
this.is_loading = false
}
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,282 @@
<template>
<div>
<v-toolbar dark>
<v-spacer />
<v-toolbar-title>코인 환율관리</v-toolbar-title>
<v-spacer />
</v-toolbar>
<br>
<v-row>
<v-dialog
v-model="show_dialog"
max-width="400px"
persistent
>
<template v-slot:activator="{ on, attrs }">
<v-container>
<v-row>
<v-col cols="10" />
<v-col>
<v-btn
block
color="#9970ff"
dark
depressed
v-bind="attrs"
v-on="on"
>
코인등록
</v-btn>
</v-col>
</v-row>
<v-row>
<v-col>
<v-data-table
:headers="headers"
:items="coins"
class="elevation-1"
hide-default-footer
>
<template v-slot:item.price="{ item }">
{{ item.price.toLocaleString('en-US') }}
</template>
<template v-slot:item.coin="{ item }">
{{ item.coin.toLocaleString('en-US') }}코인
</template>
<template v-slot:item.rewardCoin="{ item }">
{{ item.rewardCoin.toLocaleString('en-US') }}코인
</template>
<template v-slot:item.management="{ item }">
<v-btn
:disabled="isLoading"
@click="showModifyCoinDialog(item)"
>
수정
</v-btn>
&nbsp;&nbsp;
<v-btn
:disabled="isLoading"
@click="deleteCoin(item)"
>
삭제
</v-btn>
</template>
</v-data-table>
</v-col>
</v-row>
</v-container>
</template>
<v-card>
<v-card-title>코인 등록</v-card-title>
<v-card-text>
<v-text-field
v-model="price"
label="원화"
required
/>
</v-card-text>
<v-card-text>
<v-text-field
v-model="coin"
label="코인"
required
/>
</v-card-text>
<v-card-text>
<v-text-field
v-model="reward_coin"
label="리워드 코인"
required
/>
</v-card-text>
<v-card-actions v-show="!isLoading">
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="cancel"
>
취소
</v-btn>
<v-btn
v-if="selected_coin !== null"
color="blue darken-1"
text
@click="modify"
>
수정
</v-btn>
<v-btn
v-else
color="blue darken-1"
text
@click="submit"
>
등록
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</div>
</template>
<script>
import * as api from '@/api/coin'
export default {
name: "CoinView",
data() {
return {
isLoading: false,
show_dialog: false,
selected_coin: null,
price: null,
coin: null,
reward_coin: null,
headers: [
{
text: '원화(VAT포함)',
align: 'center',
sortable: false,
value: 'price',
},
{
text: '충전코인',
align: 'center',
sortable: false,
value: 'coin',
},
{
text: '리워드코인',
align: 'center',
sortable: false,
value: 'rewardCoin',
},
{
text: '관리',
align: 'center',
sortable: false,
value: 'management'
},
],
coins: [],
}
},
async created() {
await this.getCoins()
},
methods: {
notifyError(message) {
this.$dialog.notify.error(message)
},
notifySuccess(message) {
this.$dialog.notify.success(message)
},
cancel() {
this.show_dialog = false
this.coin = null
this.price = null
this.reward_coin = null
this.selected_coin = null
},
showModifyCoinDialog(item) {
this.selected_coin = item
this.price = item.price
this.coin = item.coin
this.reward_coin = item.rewardCoin
this.show_dialog = true
},
async getCoins() {
this.isLoading = true
try {
let res = await api.getCoins();
this.coins = res.data.data
} catch (e) {
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
} finally {
this.isLoading = false
}
},
async deleteCoin(item) {
this.isLoading = true
let res = await api.deleteCoin(item.id)
if (res.status === 200 && res.data.success === true) {
this.notifySuccess(res.data.message || '삭제되었습니다.')
this.coins = []
await this.getCoins()
} else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
},
async modify() {
this.isLoading = true
try {
const res = await api.modifyCoin(this.selected_coin.id, this.coin, this.reward_coin, this.price)
if (res.status === 200 && res.data.success === true) {
this.show_dialog = false
this.coin = null
this.price = null
this.reward_coin = null
this.selected_coin = null
this.notifySuccess(res.data.message || '수정되었습니다.')
this.coins = []
await this.getCoins()
} else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
} catch (e) {
this.notifyError("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
} finally {
this.isLoading = false
}
},
async submit() {
this.isLoading = true
const res = await api.insertCoin(this.coin, this.reward_coin, this.price)
if (res.status === 200 && res.data.success === true) {
this.show_dialog = false
this.coin = null
this.price = null
this.reward_coin = null
this.selected_coin = null
this.notifySuccess(res.data.message || '등록되었습니다.')
this.coins = []
await this.getCoins()
} else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
this.isLoading = false
},
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,13 @@
<template>
<div>회원별 코인관리</div>
</template>
<script>
export default {
name: "CoinByUser"
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,285 @@
<template>
<div>
<v-toolbar dark>
<v-spacer />
<v-toolbar-title>코인 충전 현황</v-toolbar-title>
<v-spacer />
</v-toolbar>
<br>
<v-container>
<v-row>
<v-spacer />
<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="getChargeStatus"
>
조회
</v-btn>
</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
@click:row="getChargeStatusDetail"
>
<template v-slot:item.date="{ item }">
{{ item.date }}
</template>
<template v-slot:item.chargeAmount="{ item }">
{{ item.chargeAmount.toLocaleString() }}
</template>
<template v-slot:item.chargeCount="{ item }">
{{ item.chargeCount }}
</template>
<template v-slot:item.pg="{ item }">
{{ item.pg }}
</template>
</v-data-table>
</v-col>
</v-row>
<v-row>
<v-dialog
v-model="show_popup_dialog"
max-width="1000px"
persistent
>
<v-card>
<v-data-table
:headers="detail_headers"
:items="detail_items"
:loading="is_loading"
:items-per-page="-1"
class="elevation-1"
hide-default-footer
>
<template v-slot:item.accountId="{ item }">
{{ item.accountId }}
</template>
<template v-slot:item.nickname="{ item }">
{{ item.nickname }}
</template>
<template v-slot:item.method="{ item }">
{{ item.method }}
</template>
<template v-slot:item.amount="{ item }">
{{ item.amount.toLocaleString() }}
</template>
<template v-slot:item.datetime="{ item }">
{{ item.datetime }}
</template>
</v-data-table>
<v-card-actions v-show="!is_loading">
<v-spacer />
<v-btn
color="blue darken-1"
text
@click="cancel"
>
확인
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</v-container>
</div>
</template>
<script>
import * as api from "@/api/charge_status";
import datetime from 'vuejs-datetimepicker';
export default {
name: "CoinStatus",
components: {datetime},
data() {
return {
is_loading: false,
start_date: null,
end_date: null,
items: [],
detail_items: null,
show_popup_dialog: false,
detail_headers: [
{
text: 'no',
align: 'center',
sortable: false,
value: 'accountId',
},
{
text: '닉네임',
align: 'center',
sortable: false,
value: 'nickname',
},
{
text: '결제수단',
align: 'center',
sortable: false,
value: 'method',
},
{
text: '가격',
align: 'center',
sortable: false,
value: 'amount',
},
{
text: '날짜',
align: 'center',
sortable: false,
value: 'datetime',
},
],
headers: [
{
text: '날짜',
align: 'center',
sortable: false,
value: 'date',
},
{
text: '충전금액',
align: 'center',
sortable: false,
value: 'chargeAmount',
},
{
text: '충전횟수',
align: 'center',
sortable: false,
value: 'chargeCount',
},
{
text: 'PG',
sortable: false,
value: 'pg',
}
]
}
},
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.getChargeStatus()
},
methods: {
notifyError(message) {
this.$dialog.notify.error(message)
},
notifySuccess(message) {
this.$dialog.notify.success(message)
},
cancel() {
this.show_popup_dialog = false
},
async getChargeStatus() {
this.is_loading = true
try {
const res = await api.getChargeStatus(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
}
},
async getChargeStatusDetail(value) {
if (value.date !== '합계') {
this.is_loading = true
try {
const res = await api.getChargeStatusDetail(value.date, value.pg)
if (res.status === 200 && res.data.success === true) {
this.detail_items = res.data.data
this.show_popup_dialog = true
} else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}
this.is_loading = false
} catch (e) {
this.notifyError('알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
this.is_loading = false
}
}
}
}
}
</script>
<style scoped>
</style>