diff --git a/src/api/can.js b/src/api/can.js new file mode 100644 index 0000000..1ba3c44 --- /dev/null +++ b/src/api/can.js @@ -0,0 +1,21 @@ +import Vue from 'vue'; + +async function deleteCan(id) { + return Vue.axios.delete('/admin/can/' + id); +} + +async function getCans() { + return Vue.axios.get('/can'); +} + +async function insertCan(can, rewardCan, price) { + const request = {can: can, rewardCan: rewardCan, price: price} + return Vue.axios.post('/admin/can', request); +} + +async function paymentCan(can, method, member_id) { + const request = {memberId: member_id, method: method, can: can} + return Vue.axios.post('/admin/can/charge', request) +} + +export {getCans, insertCan, deleteCan, paymentCan} diff --git a/src/api/coin.js b/src/api/coin.js deleted file mode 100644 index 0ceba2f..0000000 --- a/src/api/coin.js +++ /dev/null @@ -1,27 +0,0 @@ -import Vue from 'vue'; - -async function deleteCoin(id) { - return Vue.axios.delete('/coin/' + id); -} - -async function modifyCoin(id, coin, rewardCoin, price) { - const request = {id: id, coin: coin, rewardCoin: rewardCoin, price: price} - return Vue.axios.put('/coin', request); -} - - -async function getCoins() { - return Vue.axios.get('/coin'); -} - -async function insertCoin(coin, rewardCoin, price) { - const request = {coin: coin, rewardCoin: rewardCoin, price: price} - return Vue.axios.post('/coin', request); -} - -async function paymentCoin(coin, method, account_id) { - const request = {accountId: account_id, method: method, coin: coin} - return Vue.axios.post('/admin/coin/charge', request) -} - -export {getCoins, insertCoin, modifyCoin, deleteCoin, paymentCoin} diff --git a/src/router/index.js b/src/router/index.js index 43cd725..fe84ba3 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -108,7 +108,7 @@ const routes = [ { path: '/can/status', name: 'CoinStatus', - component: () => import(/* webpackChunkName: "coin" */ '../views/Can/CoinStatus.vue') + component: () => import(/* webpackChunkName: "coin" */ '../views/Can/CanStatus.vue') }, { path: '/calculate/creator', diff --git a/src/views/Can/CanCharge.vue b/src/views/Can/CanCharge.vue index 5284821..49ce3df 100644 --- a/src/views/Can/CanCharge.vue +++ b/src/views/Can/CanCharge.vue @@ -2,7 +2,7 @@ <div> <v-toolbar dark> <v-spacer /> - <v-toolbar-title>코인 충전</v-toolbar-title> + <v-toolbar-title>캔 충전</v-toolbar-title> <v-spacer /> </v-toolbar> @@ -23,8 +23,8 @@ /> <v-text-field - v-model="coin" - label="지급할 코인 수" + v-model="can" + label="지급할 캔 수" outlined required /> @@ -39,7 +39,7 @@ depressed @click="confirm" > - 코인 지급 + 캔 지급 </v-btn> </v-col> </v-row> @@ -50,7 +50,7 @@ persistent > <v-card> - <v-card-title>코인 지급 확인</v-card-title> + <v-card-title>캔 지급 확인</v-card-title> <v-card-text> 회원번호: {{ account_id }} </v-card-text> @@ -58,7 +58,7 @@ 기록내용: {{ method }} </v-card-text> <v-card-text> - 지급할 코인 수: {{ coin }}코인 + 지급할 캔 수: {{ can }} 캔 </v-card-text> <v-card-actions v-show="!isLoading"> <v-spacer /> @@ -67,7 +67,7 @@ text @click="submit" > - 코인 지급 + 캔 지급 </v-btn> <v-spacer /> <v-btn @@ -87,10 +87,10 @@ </template> <script> -import * as api from '@/api/coin' +import * as api from '@/api/can' export default { - name: "CoinCharge", + name: "CanCharge", data() { return { @@ -98,7 +98,7 @@ export default { isLoading: false, account_id: '', method: '', - coin: '' + can: '' } }, @@ -113,15 +113,15 @@ export default { confirm() { if (this.account_id.trim() === '' || isNaN(this.account_id)) { - return this.notifyError('코인을 지급할 회원의 회원번호를 입력하세요.') + return this.notifyError('캔을 지급할 회원의 회원번호를 입력하세요.') } if (this.method.trim() === '') { return this.notifyError('기록할 내용을 입력하세요') } - if (isNaN(this.coin)) { - return this.notifyError('코인은 숫자만 넣을 수 있습니다.') + if (isNaN(this.can)) { + return this.notifyError('캔은 숫자만 넣을 수 있습니다.') } if (!this.isLoading) { @@ -140,12 +140,12 @@ export default { try { this.show_confirm = false - const res = await api.paymentCoin(Number(this.coin), this.method, this.account_id) + const res = await api.paymentCan(Number(this.can), this.method, this.account_id) if (res.status === 200 && res.data.success === true) { - this.notifySuccess('코인이 지급되었습니다.') + this.notifySuccess('캔이 지급되었습니다.') this.account_id = '' this.method = '' - this.coin = '' + this.can = '' this.is_loading = false } else { this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') diff --git a/src/views/Can/CanManagement.vue b/src/views/Can/CanManagement.vue index 594dcdf..6aba112 100644 --- a/src/views/Can/CanManagement.vue +++ b/src/views/Can/CanManagement.vue @@ -2,7 +2,7 @@ <div> <v-toolbar dark> <v-spacer /> - <v-toolbar-title>코인 환율관리</v-toolbar-title> + <v-toolbar-title>캔 환율관리</v-toolbar-title> <v-spacer /> </v-toolbar> @@ -27,7 +27,7 @@ v-bind="attrs" v-on="on" > - 코인등록 + 캔등록 </v-btn> </v-col> </v-row> @@ -35,33 +35,26 @@ <v-col> <v-data-table :headers="headers" - :items="coins" + :items="cans" class="elevation-1" hide-default-footer > <template v-slot:item.price="{ item }"> - {{ item.price.toLocaleString('en-US') }}원 + {{ item.price.toLocaleString('en-US') }} 원 </template> - <template v-slot:item.coin="{ item }"> - {{ item.coin.toLocaleString('en-US') }}코인 + <template v-slot:item.can="{ item }"> + {{ item.can.toLocaleString('en-US') }} 캔 </template> - <template v-slot:item.rewardCoin="{ item }"> - {{ item.rewardCoin.toLocaleString('en-US') }}코인 + <template v-slot:item.rewardCan="{ item }"> + {{ item.rewardCan.toLocaleString('en-US') }} 캔 </template> <template v-slot:item.management="{ item }"> <v-btn :disabled="isLoading" - @click="showModifyCoinDialog(item)" - > - 수정 - </v-btn> - - <v-btn - :disabled="isLoading" - @click="deleteCoin(item)" + @click="deleteCan(item)" > 삭제 </v-btn> @@ -73,7 +66,7 @@ </template> <v-card> - <v-card-title>코인 등록</v-card-title> + <v-card-title>캔 등록</v-card-title> <v-card-text> <v-text-field v-model="price" @@ -83,15 +76,15 @@ </v-card-text> <v-card-text> <v-text-field - v-model="coin" - label="코인" + v-model="can" + label="캔" required /> </v-card-text> <v-card-text> <v-text-field - v-model="reward_coin" - label="리워드 코인" + v-model="reward_can" + label="리워드 캔" required /> </v-card-text> @@ -105,15 +98,6 @@ 취소 </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" @@ -128,19 +112,19 @@ </template> <script> -import * as api from '@/api/coin' +import * as api from '@/api/can' export default { - name: "CoinView", + name: "CanView", data() { return { isLoading: false, show_dialog: false, - selected_coin: null, + selected_can: null, price: null, - coin: null, - reward_coin: null, + can: null, + reward_can: null, headers: [ { text: '원화(VAT포함)', @@ -149,16 +133,16 @@ export default { value: 'price', }, { - text: '충전코인', + text: '충전캔', align: 'center', sortable: false, - value: 'coin', + value: 'can', }, { - text: '리워드코인', + text: '리워드캔', align: 'center', sortable: false, - value: 'rewardCoin', + value: 'rewardCan', }, { text: '관리', @@ -167,12 +151,12 @@ export default { value: 'management' }, ], - coins: [], + cans: [], } }, async created() { - await this.getCoins() + await this.getCans() }, methods: { @@ -186,26 +170,17 @@ export default { cancel() { this.show_dialog = false - this.coin = null + this.can = null this.price = null - this.reward_coin = null - this.selected_coin = null + this.reward_can = null + this.selected_can = 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() { + async getCans() { this.isLoading = true try { - let res = await api.getCoins(); - this.coins = res.data.data + let res = await api.getCans(); + this.cans = res.data.data } catch (e) { this.notifyError("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.") } finally { @@ -213,60 +188,34 @@ export default { } }, - async deleteCoin(item) { + async deleteCan(item) { this.isLoading = true - let res = await api.deleteCoin(item.id) + let res = await api.deleteCan(item.id) if (res.status === 200 && res.data.success === true) { this.notifySuccess(res.data.message || '삭제되었습니다.') - this.coins = [] - await this.getCoins() + this.cans = [] + await this.getCans() } 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) + const res = await api.insertCan(this.can, this.reward_can, this.price) if (res.status === 200 && res.data.success === true) { this.show_dialog = false - this.coin = null + this.can = null this.price = null - this.reward_coin = null - this.selected_coin = null + this.reward_can = null + this.selected_can = null this.notifySuccess(res.data.message || '등록되었습니다.') - this.coins = [] - await this.getCoins() + this.cans = [] + await this.getCans() } else { this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.') } diff --git a/src/views/Can/CoinStatus.vue b/src/views/Can/CanStatus.vue similarity index 98% rename from src/views/Can/CoinStatus.vue rename to src/views/Can/CanStatus.vue index eeabdc1..4636bc5 100644 --- a/src/views/Can/CoinStatus.vue +++ b/src/views/Can/CanStatus.vue @@ -2,7 +2,7 @@ <div> <v-toolbar dark> <v-spacer /> - <v-toolbar-title>코인 충전 현황</v-toolbar-title> + <v-toolbar-title>캔 충전 현황</v-toolbar-title> <v-spacer /> </v-toolbar> @@ -132,7 +132,7 @@ import * as api from "@/api/charge_status"; import datetime from 'vuejs-datetimepicker'; export default { - name: "CoinStatus", + name: "CanStatus", components: {datetime}, data() { diff --git a/src/views/Can/CoinByUser.vue b/src/views/Can/CoinByUser.vue deleted file mode 100644 index b07584e..0000000 --- a/src/views/Can/CoinByUser.vue +++ /dev/null @@ -1,13 +0,0 @@ -<template> - <div>회원별 코인관리</div> -</template> - -<script> -export default { - name: "CoinByUser" -} -</script> - -<style scoped> - -</style>