<template>
  <view class="app-container">
    <uv-navbar
      title="提现明细"
      placeholder
      autoBack
      bgColor="#f7f7f7"
    ></uv-navbar>
    <view class="container-top">
      <view class="iconfont">&#xe676;</view>
      <text class="text" v-if="info.status == 1">待审核</text>
      <text class="text" v-if="info.status == 3">已到账</text>
      <text class="text" v-if="info.status == 2">提现失败</text>
    </view>
    <view class="main-list">
      <view class="main-list-item u-flex-center-sb">
        <text class="lable">提现明细</text>
        <text class="value">{{ info.createTime || "--" }}</text>
      </view>
      <view class="main-list-item u-flex-center-sb">
        <text class="lable">提现金额</text>
        <text class="num">￥{{ info.amount || 0 }}</text>
      </view>
      <view class="main-list-item u-flex-center-sb">
        <text class="lable">提现手续费</text>
        <text class="num">￥{{ info.fee || 0 }}</text>
      </view>
      <view class="main-list-item u-flex-center-sb">
        <text class="lable">提现方式</text>
        <text class="value" v-if="info.withdrawalMethod == 1">支付宝</text>
        <text class="value" v-if="info.withdrawalMethod == 2">微信</text>
      </view>
      <view class="main-list-item u-flex-center-sb">
        <text class="lable">提现账号</text>
        <text class="value">{{ info.accountInfo || "--" }}</text>
      </view>
      <view class="main-list-item u-flex-center-sb" v-if="info.status == 2">
        <text class="lable">驳回理由</text>
        <text class="value">{{ info.auditResult || "--" }}</text>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { withdrawalInfo_Api } from "@/api/userInfo.js";
import { agentWithdrawalInfo_Api } from "@/api/agencyCenter.js";
const pageType = ref("1"); // 1:用户 2:代理商
const info = ref({});

const getInfo = (id) => {
  uni.showLoading({ title: "加载中...", mask: true });
  let url =
    pageType.value == "1" ? withdrawalInfo_Api : agentWithdrawalInfo_Api;
  url(id)
    .then((res) => {
      uni.hideLoading();
      if (res && res.code == 200) {
        info.value = res.data || {};
      }
    })
    .catch((err) => {
      console.log(err);
      uni.hideLoading();
    });
};

onLoad((options) => {
  if (options.pageType) {
    pageType.value = options.pageType;
  }
  if (options.id) {
    getInfo(options.id);
  }
});
</script>

<style lang="scss" scoped>
.app-container {
  .container-top {
    padding: 54rpx 0 90rpx 0;
    text-align: center;
    background-color: #f7f7f7;
    .iconfont {
      font-size: 100rpx;
      color: #08be5d;
    }
    .text {
      font-size: 38rpx;
      font-weight: 700;
      color: #1a1a1a;
      margin-top: 10rpx;
    }
  }
  .main-list {
    margin-top: -40rpx;
    padding: 30rpx;
    background-color: #ffffff;
    border-radius: 40rpx 40rpx 0px 0px;
    .main-list-item {
      padding: 10rpx 0 20rpx 0;
      font-size: 28rpx;
      .value {
        color: #808080;
      }
      .num {
        color: #da4f4f;
      }
    }
  }
}
</style>
