<route lang="json">
{
  "style": {
    "navigationBarTitleText": "",
    "navigationBarBackgroundColor": "#fff"
  }
}
</route>
<script setup lang="ts">
import { success } from '../../../../../core/libs/svgs'
import { useUserStore } from '../../../../../store'
import { useRouter } from '../../../../../core/utils/router'

const userStore = useUserStore()
const router = useRouter()
const handle2Orders = () => {
  router.replace('/pages/mine/orders/index')
}
const handle2Mall = () => {
  const pages = getCurrentPages()
  const mallIndex = pages.findIndex((it) => it.route === 'pages/home/mall/index')
  if (mallIndex > -1) {
    console.log(pages.length - mallIndex - 1)
    router.back(pages.length - mallIndex - 1)
  } else {
    router.replace('/pages/home/mall/index')
  }
}
onLoad(() => {})
</script>
<template>
  <div class="flex-grow flex flex-col px-3.5 justify-center items-center gap-7 bg-white">
    <wd-img width="60" height="60" :src="success" custom-class="mb-4.5"></wd-img>
    <div class="mb-10 text-black/90 text-xl font-normal font-['PingFang_SC'] leading-none">
      兑换成功
    </div>
    <div class="w-full">
      <wd-button block :round="false" @click="handle2Orders">查看订单</wd-button>
    </div>
    <div class="w-full">
      <wd-button block :round="false" @click="handle2Mall">返回商城</wd-button>
    </div>
  </div>
</template>
