쿠폰 자동 입력 사이트 작성
배포 완료. 이제 쿠폰 코드만 입력하면 되고, 목록에도 코드만 표시됩니다.
This commit is contained in:
parent
14956ac9ec
commit
d8fc77789c
@ -6,9 +6,8 @@
|
||||
</div>
|
||||
|
||||
<div class="add-form">
|
||||
<input v-model="newName" type="text" placeholder="쿠폰 이름 (예: 5월 이벤트)" class="input" />
|
||||
<input v-model="newCode" type="text" placeholder="쿠폰 코드" class="input code-input" />
|
||||
<button class="btn btn-add" @click="add" :disabled="!newName || !newCode">추가</button>
|
||||
<button class="btn btn-add" @click="add" :disabled="!newCode">추가</button>
|
||||
</div>
|
||||
|
||||
<div class="coupon-list" v-if="store.coupons.length > 0">
|
||||
@ -19,7 +18,6 @@
|
||||
:class="{ inactive: !c.is_active, expired: c.is_expired }"
|
||||
>
|
||||
<div class="coupon-info">
|
||||
<span class="coupon-name">{{ c.name }}</span>
|
||||
<span class="coupon-code">{{ c.code }}</span>
|
||||
</div>
|
||||
<div class="coupon-actions">
|
||||
@ -44,15 +42,14 @@ import { ref, computed } from 'vue';
|
||||
import { useWosStore } from '../stores/wos.store';
|
||||
|
||||
const store = useWosStore();
|
||||
const newName = ref('');
|
||||
const newCode = ref('');
|
||||
|
||||
const activeCoupons = computed(() => store.coupons.filter((c) => c.is_active && !c.is_expired).length);
|
||||
|
||||
async function add() {
|
||||
if (!newName.value.trim() || !newCode.value.trim()) return;
|
||||
await store.addCoupon(newName.value.trim(), newCode.value.trim().toUpperCase());
|
||||
newName.value = '';
|
||||
if (!newCode.value.trim()) return;
|
||||
const code = newCode.value.trim().toUpperCase();
|
||||
await store.addCoupon(code, code);
|
||||
newCode.value = '';
|
||||
}
|
||||
</script>
|
||||
@ -102,8 +99,7 @@ async function add() {
|
||||
.coupon-item.inactive { border-left-color: #334155; opacity: 0.6; }
|
||||
.coupon-item.expired { border-left-color: #7c3aed; opacity: 0.5; }
|
||||
.coupon-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
|
||||
.coupon-name { color: #f1f5f9; font-size: 0.9rem; font-weight: 500; }
|
||||
.coupon-code { color: #60a5fa; font-family: monospace; font-size: 0.82rem; }
|
||||
.coupon-code { color: #60a5fa; font-family: monospace; font-size: 0.9rem; }
|
||||
.coupon-actions { display: flex; gap: 6px; align-items: center; }
|
||||
.btn-toggle {
|
||||
padding: 3px 10px;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user