fix(register): hide or require referral from settings like other apps

Also keep exact trade grams from rial and poll colleague wait every 10s.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-09 21:03:32 +03:30
co-authored by Cursor
parent 0f6d8b37f4
commit c2f6f9d226
6 changed files with 132 additions and 19 deletions
+33 -4
View File
@@ -84,7 +84,7 @@
<BasicInput v-model:value="goldValueInput" :addon-before="weightUnit" :addon-bg-color="colors.primary"
addon-text-color="white"
:place-holder="amountFieldLabel"
size="large" type="text" inputmode="decimal" />
size="large" type="text" inputmode="decimal" @focus="startGramDraft" @blur="commitGramDraft" />
</a-form-item>
<div v-if="cashValidationMessage" class="text-red-700 text-xs font-bold mt-2">
{{ cashValidationMessage }}
@@ -289,7 +289,10 @@ import {
calcTradeTargetCash,
buildTradeConfirmBreakdown,
formatTradeGramDisplay,
tradeGramInputDisplay,
tradeGramFieldText,
tradeGramTypedDisplay,
sanitizeTradeGramTypingText,
tradeGramInputEditText,
exactGoldFromWalletPercent,
goldFromGramInputDisplay,
loadServiceFeeFromSettings,
@@ -441,13 +444,36 @@ const displayTradeGoldAmount = computed(() =>
formatTradeGramDisplay(orderGoldAmount.value)
)
const gramInputDraft = ref<string | null>(null)
function commitGramDraft() {
gramInputDraft.value = null
}
function startGramDraft() {
if (gramInputDraft.value !== null) return
gramInputDraft.value = inputLock.value === 'rial'
? tradeGramInputEditText(form.value.goldValue)
: tradeGramTypedDisplay(form.value.goldValue)
}
const goldValueInput = computed({
get() {
const display = tradeGramInputDisplay(form.value.goldValue)
const display = tradeGramFieldText(form.value.goldValue, inputLock.value, gramInputDraft.value)
return display === '' ? undefined : display
},
set(raw: string | number | null | undefined) {
const next = goldFromGramInputDisplay(raw, form.value.goldValue)
if (raw === '' || raw == null) {
gramInputDraft.value = ''
form.value.goldValue = undefined
form.value.goldCash = undefined
form.value.percentWallet = 0
inputLock.value = null
return
}
const text = sanitizeTradeGramTypingText(raw)
gramInputDraft.value = text
const next = goldFromGramInputDisplay(text, form.value.goldValue)
form.value.goldValue = next
if (next == null) {
form.value.goldCash = undefined
@@ -645,6 +671,7 @@ onMounted(() => {
})
function percentChange(val: number) {
commitGramDraft()
if (val !== 0) {
if (isBuy.value) {
form.value.goldCash = unitCashCalculator.value * val
@@ -711,6 +738,7 @@ function calculateCash(val: number) {
}
function calculateGold(val: number) {
commitGramDraft()
inputLock.value = 'rial'
const unit = unitPrice.value
if (!unit || Number.isNaN(unit)) return
@@ -748,6 +776,7 @@ function setIsBuy(val: boolean) {
form.value.goldCash = undefined
form.value.percentWallet = 0
inputLock.value = null
commitGramDraft()
// console.log(bganim.value.classList)
// bganim?.value?.classList.add(val?'right':'left')
// bganim?.value?.style.transform = `translateX(${val ? '0' : '-100'});`