<template>
  <view
    class="card-shadow bg-white rounded-19rpx p-base space-y-10rpx"
    @click="detail(item)"
  >
    <view class="flex items-center justify-between">
      <view class="text-30rpx"> {{ item.type?.name }} </view>
      <view
        :style="[
          {
            color: statusFun(
              item.workflow_check?.check_status,
              status || 'statusExpense',
              'color'
            ),
          },
        ]"
        class="text-24rpx"
        >{{ item.workflow_check?.check_status_text }}</view
      >
    </view>
    <view class="text-24rpx text-hex-999999 flex">
      <view class="w-140rpx">报销金额</view>
      <view class="text-primary">{{ item.expense }}</view>
    </view>
    <view class="text-24rpx text-hex-999999 flex">
      <view class="w-140rpx">报销时间</view>
      <view class="text-hex-333">{{ timeFormat(item.created_at) }}</view>
    </view>
    <view class="text-24rpx text-hex-999999">
      <view class="">
        <text class="w-140rpx inline-block">报销原因:</text>
        <text class="text-hex-333 leading-27rpx">{{ item.reason }}</text>
      </view>
    </view>
  </view>
</template>
<script setup>
import { timeFormat } from '@climblee/uv-ui/libs/function'
import statusFun from '@/utils/status'
const emits = defineEmits(['click'])

const props = defineProps({
  item: Object,
  type: String,
  status: String,
})

const detail = (item) => {
  let url
  if (props.type) {
    url = `/pages/audits/detail?id=${props.item.id}&type=${props.type}`
  } else {
    url = `/pages/expense-account/detail?id=${props.item.id}`
  }

  uni.navigateTo({
    url: url,
  })
}
</script>
