<template>
  <uv-scroll-list
    :indicator="true"
    indicatorColor="#fff0f0"
    indicatorActiveColor="#f56c6c"
  >
    <view>
      <template v-for="(item, i) in list" :key="i">
        <view v-if="i == 0" class="flex items-center w-full text-24rpx b-solid b-b-1px">
          <view class="w-140rpx text-center flex-none"> 日期 </view>
          <view class="w-300rpx text-center leading-60rpx flex-none b-r-solid b-r-1px b-l-solid b-l-1px">
            <view class="h-60rpx b-b-solid b-1px">总账</view>
            <view class="h-60rpx grid grid-cols-3">
              <view>销售</view>
              <view>支出</view>
              <view>新增客户</view>
            </view>
          </view>
          <view
            class="text-center leading-60rpx w-140rpx flex-none"
            v-for="(ty, j) in item.lottery_types"
            :key="j"
          >
            <view class="b-b-solid b-1px">{{ ty.name }}</view>
            <view class="grid grid-cols-2">
              <view>{{ ty.sales }}</view>
              <view>{{ ty.expenditure }}</view>
            </view>
          </view>
        </view>

        <view
          class="flex justify-between text-center text-24rpx items-center card-shadow bg-white rounded-19rpx h-80rpx"
        >
          <view class="flex-1 w-140rpx flex-none">{{
            timeFormat(item.date, 'mm-dd')
          }}</view>
          <!-- 总账 -->
          <view class="flex-1">{{ item.ledger.sales }}</view>
          <view class="flex-1">{{ item.ledger.expenditure }}</view>
          <view class="flex-1">{{ item.ledger.new_customers }}</view>
          <!-- 种类 -->
          <template v-for="(ty, j) in item.lottery_types" :key="j">
            <view class="flex-1">{{ ty.sales }}</view>
            <view class="flex-1">{{ ty.expenditure }}</view>
          </template>
        </view>
      </template>
    </view>
  </uv-scroll-list>
</template>

<script setup>
import { timeFormat } from '@climblee/uv-ui/libs/function'
const props = defineProps({
  list: {
    type: Array,
    default: () => [],
  },
})
</script>
