Skip to content

Commit

Permalink
🐛 Fix isAllowCustomPrice option value for free books
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Feb 18, 2025
1 parent a48c47e commit 3c9496d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</h3>
</template>
<UFormGroup :label="`Price(USD) of this collection (Minimal ${MINIMAL_PRICE} or $0 (free)) / 版本定價(美金)`">
<UInput v-model="price" type="number" step="0.01" :min="MINIMAL_PRICE" />
<UInput v-model="price" type="number" step="0.01" :min="MINIMAL_PRICE" @input="onPriceInput"/>
</UFormGroup>
<UFormGroup :label="`Total number of NFT for sale of this collection / 此定價上架的數量`">
<UInput v-model="stock" type="number" step="1" :min="minStock" />
Expand Down Expand Up @@ -309,11 +309,13 @@ config({
}
})
watch(price, (newPrice, oldPrice) => {
function onPriceInput (input: any) {
const newPrice = input.target.value
const oldPrice = price.value
if (Number(oldPrice) !== 0 && Number(newPrice) === 0) {
isAllowCustomPrice.value = true
}
})
}
onMounted(async () => {
try {
Expand Down
8 changes: 5 additions & 3 deletions pages/nft-book-store/status/[classId]/edit/[editionIndex].vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</h3>
</template>
<UFormGroup :label="`Price(USD) of this ${priceItemLabel} (Minimal ${MINIMAL_PRICE} or $0 (free)) / 版本定價(美金)`">
<UInput v-model="price" type="number" step="0.01" :min="MINIMAL_PRICE" />
<UInput v-model="price" type="number" step="0.01" :min="MINIMAL_PRICE" @input="onPriceInput" />
</UFormGroup>
<UFormGroup :label="`Total number of NFT for sale of this ${priceItemLabel} / 此定價上架的數量`">
<UInput v-model="stock" type="number" step="1" :min="minStock" />
Expand Down Expand Up @@ -321,11 +321,13 @@ config({
}
})
watch(price, (newPrice, oldPrice) => {
function onPriceInput (input: any) {
const newPrice = input.target.value
const oldPrice = price.value
if (Number(oldPrice) !== 0 && Number(newPrice) === 0) {
isAllowCustomPrice.value = true
}
})
}
watch(isAutoDeliver, (newValue) => {
if (newValue) {
Expand Down

0 comments on commit 3c9496d

Please sign in to comment.