1
3 hours ago eeb8f18b48989bac5eb5847a51359496956c5339
src/page/user/compontents/cash-list.vue
@@ -1,191 +1,325 @@
<template>
  <div class="wrapper">
    <div v-if="list.length<=0" class="empty text-center">
      暂无提现信息!
    <div v-if="list.length <= 0" class="empty text-center">
      {{ $t("hj162e") }}!
    </div>
    <div v-else>
      <ul
        class="table-list"
        v-infinite-scroll="loadMore"
        infinite-scroll-disabled="loading"
      <ul class="table-list" v-infinite-scroll="loadMore" infinite-scroll-disabled="loading"
        infinite-scroll-distance="10">
        <li class="list-body" v-for="(item) in list" :key="item.key">
        <li class="list-body" v-for="(item, index) in list" :key="index">
          <div class="order-info-box">
            <div class="order-title">
                    <span class="main">
                        提现至银行卡
                    </span>
              <span class="payNumber">¥{{item.withAmt}}</span>
              <span class="red pull-right">
                        {{item.withStatus == 1?'提现成功':item.withStatus == 2?'提现失败':item.withStatus == 3?'订单取消':'审核中'}}
                        <i v-if="item.withStatus == 1" class="iconfont icon-tongguo4 animated bounceIn"></i>
                        <i v-if="item.withStatus==0" class="iconfont icon-dengdai animated bounceInDown"></i>
                        <i v-if="item.withStatus == 2" class="iconfont icon-failure animated bounceInDown"></i>
                        <i v-if="item.withStatus == 3"
                           class="iconfont icon-iconfontweitongguo animated bounceInDown"></i>
                    </span>
              <!-- <span class="secondary ">123456789</span> -->
            <div class="order-title" @click="openDetail(item)">
              <span class="main"> {{ $t("hjtxyhk") }} </span>
              <span class="payNumber">
                {{ item.withAmt | _toLocaleString }}
              </span>
              <span class="pull-right" :class="getWithdrawStatusClass(item.withStatus)">
                {{ getWithdrawStatusText(item.withStatus) }}
                <i class="iconfont animated" :class="getWithdrawStatusIconClass(item.withStatus)"></i>
              </span>
            </div>
            <div class="order-info">
              <p class="clearfix">
                <span class="col-xs-6">手续费:<b class="space">¥{{item.withFee}}</b></span>
                <!-- <span class="col-xs-6">实际到账金额:<b class="space" style="font-size:0.26rem">{{item.withAmt - item.withFee}}</b>元</span>                         -->
              </p>
              <p class="clearfix">
                <span class="col-xs-12">银行卡:<b class="space">{{item.bankName}}-{{item.bankAddress}}</b></span>
              </p>
              <p class="clearfix">
                <span class="col-xs-12">卡号:<b class="space">{{item.bankNo}}</b></span>
              </p>
              <p v-if="item.withStatus == 3" class="clearfix">
                <span class="col-xs-12">取消原因:<b class="space">{{item.withMsg}}</b></span>
              </p>
              <p v-if="item.withStatus == 2" class="clearfix">
                <span class="col-xs-12">失败原因:<b class="space">{{item.withMsg}}</b></span>
              </p>
              <p class="clearfix">
                        <span class="secondary col-xs-6">时间:
                            <b v-if="item.applyTime">{{new Date(item.applyTime) | timeFormat}}</b>
                            <b v-else></b>
                        </span>
              </p>
            </div>
            <div v-if="item.withStatus == 0" class="order-foot clearfix">
              <div @click="cancle(item.id)" class="foot-btn">
                <i class='font-icon'></i>
                取消提现
              </div>
            </div>
          </div>
          <!-- <div class="capital">
              <div class="pro">
                  股票:300092/开山股份 <span class="pull-right">金额:50.241</span>
              </div>
              <div class=" clearfix">
                  <div class="col-xs-8">01-21 13:22</div>
                  <div class="col-xs-4 ">
                      <span class="pull-right">交易状态</span>
                  </div>
              </div>
          </div> -->
        </li>
      </ul>
      <div v-show="loading" class="load-all text-center">
        <mt-spinner type="fading-circle"></mt-spinner>
        加载中...
        loading...
      </div>
      <div v-show="!loading" class="load-all text-center">
        已全部加载
        {{ $t("hj236") }}
      </div>
    </div>
    <van-popup v-model="detailVisible" position="bottom" round closeable :style="{ maxHeight: '75%' }"
      class="withdraw-detail-popup">
      <div class="detail-popup-inner">
        <div class="detail-popup-title">{{ $t("hj238") }}</div>
        <div class="detail-popup-body">
          <div v-for="row in detailRows" :key="row.key" class="detail-row">
            <span class="detail-label">{{ row.label }}</span>
            <span class="detail-value">{{ row.value }}</span>
          </div>
        </div>
      </div>
    </van-popup>
  </div>
</template>
<script>
import { Toast } from 'mint-ui'
import * as api from '@/axios/api'
import { Toast } from "mint-ui";
import * as api from "@/axios/api";
import { _toLocaleString } from "@/utils/filter";
export default {
  components: {},
  props: {},
  data () {
  data() {
    return {
      loading: false,
      list: [],
      pageNum: 1,
      pageSize: 15
      pageSize: 15,
      detailVisible: false,
      detailItem: null
    };
  },
  computed: {
    detailRows() {
      return this.buildDetailRows(this.detailItem);
    }
  },
  watch: {},
  computed: {},
  created () {},
  mounted () {
    this.getListDetail()
  created() { },
  mounted() {
    this.getListDetail();
  },
  methods: {
    async getListDetail () {
    getWithdrawStatusClass(status) {
      return status == 1 ? "green" : "red";
    },
    getWithdrawStatusIconClass(status) {
      if (status == 1) return "icon-tongguo4 bounceIn";
      if (status == 2) return "icon-failure bounceInDown";
      if (status == 3) return "icon-iconfontweitongguo bounceInDown";
      return "icon-dengdai bounceInDown";
    },
    getWithdrawStatusText(status) {
      if (status == 1) return this.$t("hjtxcg");
      if (status == 2) return this.$t("hjtxsb");
      if (status == 3) return this.$t("hjddqx");
      return this.$t("hjshz");
    },
    openDetail(item) {
      this.detailItem = item ? { ...item } : null;
      this.detailVisible = true;
    },
    /** 与精简前列表展示字段一致,不包含其它接口字段 */
    buildDetailRows(item) {
      if (!item || typeof item !== "object") return [];
      const dash = "—";
      const amt =
        item.withAmt !== undefined && item.withAmt !== null && item.withAmt !== ""
          ? _toLocaleString(item.withAmt)
          : dash;
      const fee =
        item.withFee !== undefined && item.withFee !== null && item.withFee !== ""
          ? _toLocaleString(item.withFee)
          : dash;
      const bankParts = [item.bankName, item.bankAddress].filter(
        v => v !== undefined && v !== null && String(v).trim() !== ""
      );
      const bankLine = bankParts.length ? bankParts.join("-") : dash;
      const bankNo =
        item.bankNo !== undefined &&
          item.bankNo !== null &&
          String(item.bankNo).trim() !== ""
          ? String(item.bankNo)
          : dash;
      let timeStr = dash;
      if (item.applyTime) {
        timeStr = this.$moment(item.applyTime).format("DD-MM-YYYY hh:mm:ss A");
      }
      const rows = [
        {
          key: "withAmt",
          label: this.$t("hjtxyhk"),
          value: amt
        },
        {
          key: "withStatus",
          label: this.$t("状态"),
          value: this.getWithdrawStatusText(item.withStatus)
        },
        {
          key: "withFee",
          label: this.$t("hj44"),
          value: fee
        },
        {
          key: "bank",
          label: this.$t("hj247"),
          value: bankLine
        },
        {
          key: "bankNo",
          label: this.$t("hjkh"),
          value: bankNo
        }
      ];
      if (item.withStatus == 3) {
        rows.push({
          key: "withMsg-cancel",
          label: this.$t("hjqxyy"),
          value:
            item.withMsg !== undefined &&
              item.withMsg !== null &&
              String(item.withMsg).trim() !== ""
              ? String(item.withMsg)
              : dash
        });
      }
      if (item.withStatus == 2) {
        rows.push({
          key: "withMsg-fail",
          label: this.$t("hj201"),
          value:
            item.withMsg !== undefined &&
              item.withMsg !== null &&
              String(item.withMsg).trim() !== ""
              ? String(item.withMsg)
              : dash
        });
      }
      rows.push({
        key: "applyTime",
        label: this.$t("sj"),
        value: timeStr
      });
      return rows;
    },
    async getListDetail() {
      let opt = {
        withStatus: '', // 提现状态 0已提交,1转账成功,2转账失败
        withStatus: "",
        pageNum: this.pageNum,
        pageSize: 15
      }
      let data = await api.withdrawList(opt)
      };
      let data = await api.withdrawList(opt);
      if (data.status === 0) {
        data.data.list.forEach(element => {
          this.list.push(element)
        })
          this.list.push(element);
        });
      } else {
        Toast(data.msg)
        Toast(data.msg);
      }
    },
    async loadMore () {
    async loadMore() {
      if (this.list.length < 10) {
        return
        return;
      }
      this.loading = true
      // 加载下一页
      this.pageNum++
      await this.getListDetail()
      this.loading = false
      this.loading = true;
      this.pageNum++;
      await this.getListDetail();
      this.loading = false;
    },
    async cancle (val) {
      // 取消提现
      // MessageBox.confirm('您确定要平仓吗?').then(async action => {
    async cancle(val) {
      let opt = {
        withId: val
      }
      let data = await api.canceloutMoney(opt)
      };
      let data = await api.canceloutMoney(opt);
      if (data.status === 0) {
        this.list = []
        Toast(data.msg)
        this.getListDetail()
        this.list = [];
        Toast(data.msg);
        this.getListDetail();
      } else {
        Toast(data.msg)
        Toast(data.msg);
      }
      // });
    }
  }
};
</script>
<style lang="less" scoped>
.wrapper {
  background-color: #fff !important;
  height: 95vh;
}
.payNumber {
  font-size: 0.3rem;
  color: #ff8000;
}
.order-info--compact {
  padding-bottom: 0;
}
.detail-btn-wrap {
  padding: 0.12rem 0.2rem 0.2rem;
}
.detail-btn {
  font-size: 0.26rem;
}
/deep/ .withdraw-detail-popup .van-popup__close-icon {
  color: #666;
}
.detail-popup-inner {
  padding: 0.36rem 0.32rem 0.48rem;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.detail-popup-title {
  font-size: 0.34rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.28rem;
  color: #14181f;
}
.detail-popup-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.22rem 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.28rem;
  line-height: 1.45;
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-label {
  color: #888;
  flex: 0 0 38%;
  padding-right: 0.2rem;
  word-break: break-word;
}
.detail-value {
  color: #333;
  flex: 1;
  text-align: right;
  word-break: break-word;
}
.table-list {
  padding: 0.2rem 0;
  .list-body {
    padding: 0.1rem 0.2rem;
    .capital:nth-child(1) {
      border-top: 0.01rem solid #3f444a;
    }
    .capital {
      padding: 0.2rem;
      border-bottom: 0.01rem solid #3f444a;
      div {
        line-height: 0.4rem;
      }
      .col-xs-4 {
        padding-left: 0;
        padding-right: 0;
      }
      .pro {
        color: #999;
      }
    }
  }
}
</script>
<style lang="less" scoped>
  .wrapper {
    // padding-top: 0.9rem;
  }
  .payNumber {
    font-size: 0.3rem;
    color: #ff8000;
  }
  .table-list {
    padding: 0.2rem 0;
    .list-body {
      padding: 0.1rem 0.2rem;
      .capital:nth-child(1) {
        border-top: 0.01rem solid #3f444a;
      }
      .capital {
        padding: 0.2rem;
        // border-radius: 0.2rem;
        border-bottom: 0.01rem solid #3f444a;
        div {
          line-height: 0.4rem;
        }
        .col-xs-4 {
          padding-left: 0;
          padding-right: 0;
        }
        .pro {
          color: #999;
        }
      }
    }
  }
</style>