fix:개발비/월구독료 입력필드 콤마 포맷팅 적용 (소수점 제거)
This commit is contained in:
@@ -118,15 +118,19 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:rin
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">개발비 (가입비)</label>
|
||||
<input type="number" x-model="productForm.development_fee"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500"
|
||||
min="0" step="1000000" required>
|
||||
<input type="text"
|
||||
:value="formatNumber(productForm.development_fee)"
|
||||
x-on:input="productForm.development_fee = parseNumber($event.target.value); $event.target.value = formatNumber(productForm.development_fee)"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 text-right"
|
||||
placeholder="0" required>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">월 구독료</label>
|
||||
<input type="number" x-model="productForm.subscription_fee"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500"
|
||||
min="0" step="10000" required>
|
||||
<input type="text"
|
||||
:value="formatNumber(productForm.subscription_fee)"
|
||||
x-on:input="productForm.subscription_fee = parseNumber($event.target.value); $event.target.value = formatNumber(productForm.subscription_fee)"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 text-right"
|
||||
placeholder="0" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
@@ -370,6 +374,16 @@ function productManager() {
|
||||
|
||||
formatCurrency(value) {
|
||||
return '₩' + Number(value).toLocaleString();
|
||||
},
|
||||
|
||||
formatNumber(value) {
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
return Math.floor(Number(value)).toLocaleString('ko-KR');
|
||||
},
|
||||
|
||||
parseNumber(value) {
|
||||
if (!value) return 0;
|
||||
return parseInt(String(value).replace(/[^\d]/g, ''), 10) || 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user