<template>
  <div class="container">
    <!-- 导航栏 -->
    <div class="nav-bar">
      <div class="back-btn" @click="$router.back()">
        <i class="arrow-left"></i>
      </div>
      <div class="title">提现记录</div>
    </div>

    <!-- 记录列表 -->
    <div class="record-list">
      <div class="listItem" v-for="(item, index) in records" :key="index">
        <div class="flex listItemC">
          <div>详细</div>
          <div class="tr4">金额</div>
          <div class="right">日期</div>
        </div>
        <div class="flex listItemB">
          <div>{{ item.memo }}</div>
          <div class="tr4">{{ item.money }}</div>
          <div class="right gggg">{{ item.addtime }}</div>
        </div>
        <div class="flex listItemB status-row">
          <div class="status-text">{{ getStatusText(item.status) }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getUserInfo } from '@/api/home';
import { getWithdrawRecords } from '@/api/profile';

export default {
  name: 'OrderList',
  data() {
    return {
      userInfo: {},
      records: []
    }
  },
  created() {
    this.getUserInfo();
    this.getRecords();
  },
  methods: {
    async getUserInfo() {
      try {
        const res = await getUserInfo();
        this.userInfo = res.data;
      } catch (error) {
        console.error('获取用户信息失败:', error);
      }
    },
    async getRecords() {
      try {
        const res = await getWithdrawRecords();
        this.records = res.data || [];
      } catch (error) {
        console.error('获取提现记录失败:', error);
      }
    },
    getStatusText(status) {
      const statusMap = {
        1: '提现成功，已打款到账联名账户',
        2: '提现失败请核对银行卡信息',
        3: '提现申请审核中',
        4: '已取消',
        5: '审核已通过，打款中'
      };
      return statusMap[status] || '审核中';
    }
  }
}
</script>

<style scoped>
.container {
  min-height: 100vh;
  background: #f5f5f5;
}

.nav-bar {
  height: 44px;
  background-color: #fff;
  color: #000;
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 15px;
  font-weight: bold;
}

.back-btn {
  width: 24px;
  height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.arrow-left {
  width: 12px;
  height: 12px;
  border-left: 2px solid #000;
  border-bottom: 2px solid #000;
  transform: rotate(45deg);
}

.title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
}

.record-list {
  padding: 15px;
}

.listItem {
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
}

.flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.listItemC {
  color: #999;
  font-size: 14px;
  margin-bottom: 10px;
}

.listItemB {
  color: #333;
  font-size: 14px;
  margin-bottom: 5px;
}

.tr4 {
  flex: 0 0 100px;
  text-align: center;
}

.right {
  flex: 0 0 150px;
  text-align: right;
}

.gggg {
  color: #999;
}

.status-row {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}

.status-text {
  color: #666;
  font-size: 14px;
}
</style> 