fix crowdfund js

This commit is contained in:
Kukks
2021-10-15 12:22:57 +02:00
committed by Andrew Camilleri
parent 5176eaf4ba
commit 5ac4135a13
2 changed files with 10 additions and 8 deletions

View File

@@ -329,9 +329,11 @@
<template v-if="perk.price && perk.price.value">
{{perk.price.value.noExponents()}}
{{targetCurrency}}
<template v-if="perk.custom === 'true'">or more</template>
<template v-if="perk.price.type == 1">or more</template>
</template>
<template v-else-if="perk.custom === 'topup' || (!perk.price.value && perk.custom === 'true')">
{{}}
<template v-else-if="perk.price.type === 0 || (!perk.price.value && perk.price.type === 1)">
Any amount
</template>
</span>
@@ -340,9 +342,9 @@
<div class="input-group" style="max-width:500px;" v-if="expanded" :id="'perk-form'+ perk.id">
<input
v-if="perk.custom !== 'topup'"
v-if="perk.price.type !== 0"
:disabled="!active"
:readonly="perk.custom !== 'true'"
:readonly="perk.price.type !== 1"
class="form-control hide-number-spin"
type="number"
v-model="amount"
@@ -350,7 +352,7 @@
step="any"
placeholder="Contribution Amount"
required>
<span class="input-group-text" v-if="perk.custom !== 'topup'">{{targetCurrency}}</span>
<span class="input-group-text" v-if="perk.price.type !== 0">{{targetCurrency}}</span>
<button
class="btn btn-primary d-flex align-items-center"
v-bind:class="{ 'btn-disabled': loading}"

View File

@@ -25,7 +25,7 @@ document.addEventListener("DOMContentLoaded",function (ev) {
},
computed: {
canExpand: function(){
return !this.expanded && this.active && (this.perk.custom !== "fixed" || this.perk.price.value) && (this.perk.inventory==null || this.perk.inventory > 0)
return !this.expanded && this.active && (this.perk.price.type !== 2 || this.perk.price.value) && (this.perk.inventory==null || this.perk.inventory > 0)
}
},
methods: {
@@ -45,7 +45,7 @@ document.addEventListener("DOMContentLoaded",function (ev) {
}
},
setAmount: function (amount) {
this.amount = this.perk.custom === "topup"? null : (amount || 0).noExponents();
this.amount = this.perk.price.type === 0? null : (amount || 0).noExponents();
this.expanded = false;
}
@@ -56,7 +56,7 @@ document.addEventListener("DOMContentLoaded",function (ev) {
},
watch: {
perk: function (newValue, oldValue) {
if(newValue.custom === "topup"){
if(newValue.price.type ===0){
this.setAmount();
}else if (newValue.price.value != oldValue.price.value) {
this.setAmount(newValue.price.value);