feat(can): 캔 등록시 결제 화폐단위 추가

This commit is contained in:
Yu Sung
2025-10-01 21:32:34 +09:00
parent 3c28367be9
commit fd9ea2f5bb
2 changed files with 21 additions and 7 deletions

View File

@@ -8,8 +8,8 @@ async function getCans() {
return Vue.axios.get('/can'); return Vue.axios.get('/can');
} }
async function insertCan(can, rewardCan, price) { async function insertCan(can, rewardCan, price, currency) {
const request = {can: can, rewardCan: rewardCan, price: price} const request = {can: can, rewardCan: rewardCan, price: price, currency}
return Vue.axios.post('/admin/can', request); return Vue.axios.post('/admin/can', request);
} }

View File

@@ -21,7 +21,7 @@
<v-col> <v-col>
<v-btn <v-btn
block block
color="#9970ff" color="#3bb9f1"
dark dark
depressed depressed
v-bind="attrs" v-bind="attrs"
@@ -40,7 +40,8 @@
hide-default-footer hide-default-footer
> >
<template v-slot:item.price="{ item }"> <template v-slot:item.price="{ item }">
{{ item.price.toLocaleString('en-US') }} <span v-if="item.currency === 'KRW'"> {{ item.price.toLocaleString('en-US') }}</span>
<span v-else>$ {{ item.price.toLocaleString('en-US') }}</span>
</template> </template>
<template v-slot:item.can="{ item }"> <template v-slot:item.can="{ item }">
@@ -70,7 +71,13 @@
<v-card-text> <v-card-text>
<v-text-field <v-text-field
v-model="price" v-model="price"
label="원화" label="가격"
required
/>
<v-select
v-model="currency"
:items="currencies"
label="화폐 단위"
required required
/> />
</v-card-text> </v-card-text>
@@ -125,9 +132,14 @@ export default {
price: null, price: null,
can: null, can: null,
reward_can: null, reward_can: null,
currency: 'KRW',
currencies: [
{ text: 'KRW (한국 원)', value: 'KRW' },
{ text: 'USD (미국 달러)', value: 'USD' }
],
headers: [ headers: [
{ {
text: '원화(VAT포함)', text: '가격(VAT포함)',
align: 'center', align: 'center',
sortable: false, sortable: false,
value: 'price', value: 'price',
@@ -173,6 +185,7 @@ export default {
this.can = null this.can = null
this.price = null this.price = null
this.reward_can = null this.reward_can = null
this.currency = 'KRW'
this.selected_can = null this.selected_can = null
}, },
@@ -204,13 +217,14 @@ export default {
async submit() { async submit() {
this.isLoading = true 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) { if (res.status === 200 && res.data.success === true) {
this.show_dialog = false this.show_dialog = false
this.can = null this.can = null
this.price = null this.price = null
this.reward_can = null this.reward_can = null
this.currency = 'KRW'
this.selected_can = null this.selected_can = null
this.notifySuccess(res.data.message || '등록되었습니다.') this.notifySuccess(res.data.message || '등록되었습니다.')