<template>
  <view class="finance-commission">
    <!-- 筛选卡片 -->
    <view class="filter-card border-shadow">
      <view class="filter-row">
        <view class="filter-item">
          <text class="filter-label">昵称/手机号/分销商ID:</text>
          <input class="search-input" placeholder="请输入昵称搜索" />
        </view>
        <view class="btn-query">
          <text class="btn-txt">查询</text>
        </view>
      </view>
    </view>

    <!-- 列表表格 -->
    <view class="table-card border-shadow">
      <view class="action-bar">
        <view class="btn-export">
          <text class="export-txt">导出</text>
        </view>
      </view>

      <view class="table-container">
        <view class="table-header">
          <view class="th col-user"><text class="th-txt">用户信息</text></view>
          <view class="th col-total"><text class="th-txt">总佣金金额</text></view>
          <view class="th col-account"><text class="th-txt">账户佣金</text></view>
          <view class="th col-withdraw"><text class="th-txt">提现佣金</text></view>
        </view>

        <view class="table-body">
          <view class="table-row" v-for="item in tableData" :key="item.uid">
            <view class="td col-user">
              <text class="td-txt">{{ item.userInfo }}</text>
            </view>
            <view class="td col-total">
              <text class="td-txt">{{ item.totalAmount }}</text>
            </view>
            <view class="td col-account">
              <text class="td-txt">{{ item.accountAmount }}</text>
            </view>
            <view class="td col-withdraw">
              <text class="td-txt">{{ item.withdrawAmount }}</text>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

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

interface CommissionSummary {
  uid: string
  userInfo: string
  totalAmount: string
  accountAmount: string
  withdrawAmount: string
}

const tableData = ref<CommissionSummary[]>([
  {
    uid: '77418',
    userInfo: '张迪 | 155****5525 | 77418',
    totalAmount: '11.00',
    accountAmount: '11.00',
    withdrawAmount: '0'
  },
  {
    uid: '69696',
    userInfo: "I'm yours - | 69696",
    totalAmount: '0.40',
    accountAmount: '0.40',
    withdrawAmount: '0'
  },
  {
    uid: '68582',
    userInfo: 'guan | 68582',
    totalAmount: '140.80',
    accountAmount: '140.80',
    withdrawAmount: '0'
  },
  {
    uid: '65258',
    userInfo: '纯爱战神别名王富贵儿 | 158****4881 | 65258',
    totalAmount: '11.00',
    accountAmount: '11.00',
    withdrawAmount: '0'
  },
  {
    uid: '66265',
    userInfo: '王伟兴 | 66265',
    totalAmount: '11.99',
    accountAmount: '11.99',
    withdrawAmount: '0'
  },
  {
    uid: '65270',
    userInfo: '199****1781 | 199****1781 | 65270',
    totalAmount: '31.60',
    accountAmount: '31.60',
    withdrawAmount: '0'
  },
  {
    uid: '64572',
    userInfo: '洒笾菂艸 | 188****2434 | 64572',
    totalAmount: '0.20',
    accountAmount: '0.20',
    withdrawAmount: '0'
  },
  {
    uid: '47952',
    userInfo: '那小子 | 134****3573 | 47952',
    totalAmount: '19.80',
    accountAmount: '19.80',
    withdrawAmount: '0'
  }
])
</script>

<style scoped lang="scss">
.finance-commission {
  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: 24px;
  margin-bottom: 20px;
}

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

.filter-label {
  font-size: 14px;
  color: #333;
  margin-right: 12px;
}

.search-input {
  width: 240px;
  height: 36px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 14px;
}

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

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

/* 表格区域 */
.table-card {
  padding: 0;
}

.action-bar {
  padding: 15px 20px;
}

.btn-export {
  width: 60px;
  height: 32px;
  background-color: #e6f7ff;
  border: 1px solid #91d5ff;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-txt {
  color: #1890ff;
  font-size: 14px;
}

.table-container {
  display: flex;
  flex-direction: column;
}

.table-header {
  background-color: #e6f0ff; /* 淡蓝色表头 */
  display: flex;
  flex-direction: row;
}

.th {
  padding: 14px 20px;
  display: flex;
  align-items: center;
}

.th-txt {
  font-size: 14px;
  font-weight: 500;
  color: #606266;
}

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

.table-row:hover {
  background-color: #fafafa;
}

.td {
  padding: 16px 20px;
  display: flex;
  align-items: center;
}

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

/* 列宽分配 */
.col-user { flex: 2; min-width: 300px; justify-content: flex-start; }
.col-total { flex: 1; justify-content: flex-start; }
.col-account { flex: 1; justify-content: flex-start; }
.col-withdraw { flex: 1; justify-content: flex-start; }
</style>

<style scoped lang="scss">
.finance-commission {
  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;
}

.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; }

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

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

.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-id { width: 80px; }
.col-user { width: 180px; justify-content: flex-start; }
.col-order { width: 180px; }
.col-amount { width: 120px; }
.col-type { width: 120px; }
.col-time { width: 180px; }
.col-status { width: 100px; }

.avatar { width: 32px; height: 32px; border-radius: 16px; margin-right: 10px; }
.user-name { font-size: 13px; color: #606266; }
.green-txt { color: #67c23a; font-weight: bold; }

.status-dot-active {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background-color: #67c23a;
  margin-right: 6px;
}
</style>
