feat(user): gift card FAB, menu order, wallet deposit status

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-09 11:25:42 +03:30
co-authored by Cursor
parent 036184c68b
commit 2977b479dd
6 changed files with 189 additions and 60 deletions
+72 -9
View File
@@ -1,16 +1,17 @@
<template>
<div >
<div class="flex">
<div :class="isUp? 'bg-green-50':'bg-red-50'" class="rounded-lg p-4 h-fit w-fit flex justify-center items-center">
<Icon :class="isUp? 'text-green-600':'text-red-600'"
:icon="`vuesax-linear:${isUp? 'tick-circle':'close-circle'}`"/>
<div :class="statusIconWrapClass" class="rounded-lg p-4 h-fit w-fit flex justify-center items-center">
<Icon :class="statusIconClass" :icon="`vuesax-linear:${statusIconName}`"/>
</div>
<div class=" w-full mr-2 ">
<div class="flex w-full text-xs ">{{item.note ?? '-'}}</div>
<div class="flex mt-1 text-xs">
<div class="flex mt-1 text-xs items-center gap-1 flex-wrap">
<div>وضعیت:</div>
<div :class="'text-green-600'" class="mr-1" v-if="item.transaction[0]">موفق</div>
<div :class="'text-red-600'" class="mr-1" v-else>ناموفق</div>
<ATag v-if="statusLabel" :color="statusTagColor" class="!py-0 !px-2 !ml-0 !text-xs !leading-5">
{{ statusLabel }}
</ATag>
<span v-else class="text-gray-500 mr-1">—</span>
</div>
<div class="flex mt-1 text-xs ">
<div class="w-4rem">کد پیگیری: </div>
@@ -134,9 +135,10 @@
<script lang="ts" setup>
import Icon from "@/components/BasicPacks/BasicIcon.vue";
import {formatGoldAmount, getTransactionTradePrice, usePriceWithoutType} from "../../../../utils/usePrice";
import {formatGoldAmount, getTransactionTradePrice, resolveTransactionStatusLabel, usePriceWithoutType} from "../../../../utils/usePrice";
import BasicActionSheet from "@/components/BasicPacks/BasicActionSheet.vue";
import {computed, ref} from "vue";
import { Tag as ATag } from 'ant-design-vue'
import BasicButton from "@/components/BasicPacks/BasicButton.vue";
import type {Transaction} from "@/models/transaction";
import {getCashWalletLabel, getGoldWalletLabel, getMetalTypeTradeLabel, getTradePriceUnitLabel, getWeightUnit} from '@/utils/productDealMethod'
@@ -149,8 +151,69 @@ interface Prop {
}
const props = withDefaults(defineProps<Prop>(), {})
// const isUp = computed(() => props.item.type === 3 || props.item.type === 1)
const isUp = computed(() => props.item.transaction[0])
type WalletStatusTone = 'success' | 'pending' | 'failed' | 'unknown'
function walletItemSts(item: Transaction): number | null {
const raw = item.withdraw?.sts ?? item.order?.sts ?? (item as Transaction & { sts?: number }).sts
if (raw == null) return null
const sts = Number(raw)
return Number.isFinite(sts) ? sts : null
}
const statusLabel = computed(() => {
const label = resolveTransactionStatusLabel(props.item)
if (label) return label
const legacy = (props.item as Transaction & { transaction?: unknown[] }).transaction
return legacy?.[0] ? 'موفق' : 'ناموفق'
})
const legacySucceeded = computed(
() => Boolean((props.item as Transaction & { transaction?: unknown[] }).transaction?.[0]),
)
const statusTone = computed<WalletStatusTone>(() => {
const sts = walletItemSts(props.item)
if (sts === 1 || sts === 50) return 'pending'
if (sts === 2 || sts === 51 || sts === 4 || sts === 5 || sts === 9) return 'success'
if (sts === 3 || sts === 52) return 'failed'
const label = statusLabel.value
if (label === 'در انتظار تایید' || label === 'در انتظار ارسال') return 'pending'
if (label === 'موفق' || label === 'انجام شد' || label === 'ارسال شده') return 'success'
if (label === 'ناموفق' || label === 'لغو شده') return 'failed'
if (legacySucceeded.value) return 'success'
return 'unknown'
})
const statusTagColor = computed(() => {
if (statusTone.value === 'pending') return 'processing'
if (statusTone.value === 'failed') return 'error'
if (statusTone.value === 'success') return 'success'
return 'default'
})
const statusIconWrapClass = computed(() => {
if (statusTone.value === 'pending') return 'bg-sky-50'
if (statusTone.value === 'failed') return 'bg-red-50'
if (statusTone.value === 'success') return 'bg-green-50'
return legacySucceeded.value ? 'bg-green-50' : 'bg-red-50'
})
const statusIconClass = computed(() => {
if (statusTone.value === 'pending') return 'text-sky-600'
if (statusTone.value === 'failed') return 'text-red-600'
if (statusTone.value === 'success') return 'text-green-600'
return legacySucceeded.value ? 'text-green-600' : 'text-red-600'
})
const statusIconName = computed(() => {
if (statusTone.value === 'pending') return 'clock'
if (statusTone.value === 'failed') return 'close-circle'
if (statusTone.value === 'success') return 'tick-circle'
return legacySucceeded.value ? 'tick-circle' : 'close-circle'
})
const isGold = computed(() => props.item.type === 1 || props.item.type === 2 || props.item.type === 10)
/*const title = computed(() => {
if (isUp.value) {