<template>
  <view class="finance-capital-flow">
    <!-- 头部筛选区 -->
    <view class="filter-card border-shadow">
      <view class="filter-row">
        <view class="filter-item">
          <text class="filter-label">订单时间:</text>
          <view class="date-picker-wrap">
            <text class="calendar-icon">📅</text>
            <text class="date-placeholder">开始日期 - 结束日期</text>
          </view>
        </view>
        <view class="filter-item">
          <text class="filter-label">交易类型:</text>
          <view class="select-box">
            <text class="select-txt">请选择</text>
            <text class="arrow-down">▼</text>
          </view>
        </view>
        <view class="filter-item search-wrap">
          <text class="filter-label">流水搜索:</text>
          <input class="search-input" placeholder="订单号/昵称/电话/用户ID" />
        </view>
        <view class="btn-query">
          <text class="btn-txt">查询</text>
        </view>
      </view>
    </view>

    <!-- 数据表格 (Flex 模拟) -->
    <view class="table-container border-shadow">
      <view class="table-header">
        <view class="th col-flow"><text class="th-txt">交易单号</text></view>
        <view class="th col-order"><text class="th-txt">关联订单</text></view>
        <view class="th col-time"><text class="th-txt">交易时间</text></view>
        <view class="th col-amount"><text class="th-txt">交易金额</text></view>
        <view class="th col-user"><text class="th-txt">交易用户</text></view>
        <view class="th col-method"><text class="th-txt">支付方式</text></view>
        <view class="th col-remark"><text class="th-txt">备注</text></view>
        <view class="th col-ops"><text class="th-txt">操作</text></view>
      </view>

      <view class="table-body">
        <view class="table-row" v-for="item in tableData" :key="item.flowNo">
          <view class="td col-flow"><text class="td-txt">{{ item.flowNo }}</text></view>
          <view class="td col-order text-left"><text class="td-txt">{{ item.orderNo }}</text></view>
          <view class="td col-time"><text class="td-txt">{{ item.time }}</text></view>
          <view class="td col-amount"><text class="td-txt red-txt">{{ item.amount }}</text></view>
          <view class="td col-user"><text class="td-txt">{{ item.user }}</text></view>
          <view class="td col-method"><text class="td-txt">{{ item.method }}</text></view>
          <view class="td col-remark"><text class="td-txt">{{ item.remark }}</text></view>
          <view class="td col-ops">
            <text class="op-link">备注</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup lang="uts">
import { ref } from 'vue'

interface FlowRecord {
  flowNo: string
  orderNo: string
  time: string
  amount: string
  user: string
  method: string
  remark: string
}

const tableData = ref<FlowRecord[]>([
  {
    flowNo: 'ZJ202602031258428744',
    orderNo: 'hy541422245264752640',
    time: '2026-02-03 00:58:42',
    amount: '+0.00',
    user: 'J.',
    method: '微信',
    remark: ''
  },
  {
    flowNo: 'ZJ202602011056592117',
    orderNo: 'hy541029224517992448',
    time: '2026-02-01 22:56:59',
    amount: '+0.00',
    user: 'dev 王鑫',
    method: '微信',
    remark: ''
  },
  {
    flowNo: 'ZJ202602010513443817',
    orderNo: 'hy540942844546777088',
    time: '2026-02-01 17:13:44',
    amount: '+0.00',
    user: 'Sunshine',
    method: '微信',
    remark: ''
  },
  {
    flowNo: 'ZJ202602010127248683',
    orderNo: 'hy540885887420989440',
    time: '2026-02-01 13:27:24',
    amount: '+0.00',
    user: '132****8769',
    method: '微信',
    remark: ''
  },
  {
    flowNo: 'ZJ202602011215407366',
    orderNo: 'hy540686639874179072',
    time: '2026-02-01 00:15:40',
    amount: '+0.00',
    user: '177****9187',
    method: '微信',
    remark: ''
  },
  {
    flowNo: 'ZJ202601301026512881',
    orderNo: 'hy540296867267739648',
    time: '2026-01-30 22:26:51',
    amount: '+0.00',
    user: '暂未成功人士',
    method: '微信',
    remark: ''
  },
  {
    flowNo: 'ZJ202601300534267557',
    orderNo: 'hy540223279126806528',
    time: '2026-01-30 17:34:26',
    amount: '+0.00',
    user: 'b342865d2077',
    method: '微信',
    remark: ''
  }
])
</script>

<style scoped lang="scss">
.finance-capital-flow {
  padding: 20px;
  background-color: #f5f7fa;
  min-height: 100vh;
}

.border-shadow {
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}

/* 筛选卡片 */
.filter-card {
  padding: 20px 24px;
  margin-bottom: 20px;
}

.filter-row {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.filter-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-right: 28px;
}

.filter-label {
  font-size: 14px;
  color: #333;
  margin-right: 10px;
  white-space: nowrap;
}

.date-picker-wrap {
  width: 220px;
  height: 32px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 12px;
}

.calendar-icon {
  font-size: 12px;
  margin-right: 8px;
}

.date-placeholder {
  font-size: 13px;
  color: #c0c4cc;
}

.select-box {
  width: 200px;
  height: 32px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.select-txt {
  font-size: 13px;
  color: #606266;
}

.arrow-down {
  font-size: 8px;
  color: #c0c4cc;
}

.search-wrap {
  flex: 1;
}

.search-input {
  flex: 1;
  height: 32px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-query {
  background-color: #1890ff;
  border-radius: 4px;
  height: 32px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
}

.btn-txt {
  color: #fff;
  font-size: 14px;
}

/* 表格 */
.table-container {
  display: flex;
  flex-direction: column;
}

.table-header {
  background-color: #f8f9fb;
  display: flex;
  flex-direction: row;
  border-bottom: 1px solid #ebeef5;
}

.th {
  padding: 15px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.th-txt {
  font-size: 14px;
  font-weight: 600;
  color: #909399;
}

.table-row {
  display: flex;
  flex-direction: row;
  border-bottom: 1px solid #ebeef5;
}

.td {
  padding: 15px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.td-txt {
  font-size: 13px;
  color: #606266;
}

.col-flow { width: 200px; }
.col-order { width: 220px; }
.col-time { width: 180px; }
.col-amount { width: 120px; }
.col-user { width: 150px; }
.col-method { width: 120px; }
.col-remark { flex: 1; min-width: 100px; }
.col-ops { width: 100px; }

.text-left {
  justify-content: flex-start;
}

.red-txt {
  color: #f56c6c;
}

.op-link {
  font-size: 13px;
  color: #1890ff;
}
</style>
