"use strict";
const common_vendor = require("../../../../common/vendor.js");
const common_js_net_UserApi = require("../../../../common/js/net/UserApi.js");
const common_js_conver = require("../../../../common/js/conver.js");
const ContainerLoading = () => "../../../../components/container-loading.js";
const _sfc_main = {
  components: {
    ContainerLoading
  },
  setup() {
    const globalData = common_vendor.inject("globalData");
    return {
      globalData
    };
  },
  data() {
    return {
      recordList: [],
      //订单列表
      appTitle: this.globalData.appTitle,
      pageData: {
        page: 1,
        rows: 10,
        keywords: "",
        startTime: "",
        endTime: ""
      },
      //检索参数
      loadingState: "loading",
      //加载状态
      listRefreshTrig: false,
      //list刷新状态
      isLoadMore: false,
      //加载更多的状态
      hasMore: "more",
      //是否有更多数据
      keywords: "",
      //搜索关键字
      startDate: "",
      endDate: ""
    };
  },
  onLoad(options) {
    common_vendor.index.setNavigationBarTitle({
      title: "资金流水"
    });
    common_vendor.index.setNavigationBarColor({
      frontColor: "#000000",
      backgroundColor: "#F0F0F0",
      animation: {
        duration: 500,
        timingFunc: "easeIn"
      }
    });
    this.doRefreshList();
  },
  methods: {
    payTypeColor: common_js_conver.payTypeColor,
    payType: common_js_conver.payType,
    payTypeSign: common_js_conver.payTypeSign,
    inputKeywords(e) {
      this.keywords = e.detail.value;
    },
    doSearchKeyWord() {
      this.doRefreshList();
    },
    clearSearch() {
      this.keywords = "";
      this.doRefreshList();
    },
    selectStartDate(e) {
      common_vendor.index.__f__("log", "at pages/mine/mineAccount/minePayRecord/minePayRecord.vue:147", "开始时间", e);
      this.startDate = e;
      this.doRefreshList();
    },
    selectEndDate(e) {
      common_vendor.index.__f__("log", "at pages/mine/mineAccount/minePayRecord/minePayRecord.vue:152", "结束时间", e);
      this.endDate = e;
      this.doRefreshList();
    },
    clearStart() {
      this.startDate = "";
      this.doRefreshList();
    },
    clearEnd() {
      this.endDate = "";
      this.doRefreshList();
    },
    doRefreshList() {
      common_vendor.index.__f__("log", "at pages/mine/mineAccount/minePayRecord/minePayRecord.vue:165", "正在刷新...");
      const _self = this;
      _self.loadingState = "loading";
      _self.hasMore = "more";
      _self.pageData.page = 1;
      _self.pageData.keywords = _self.keywords;
      _self.pageData.startTime = _self.startDate;
      _self.pageData.endTime = _self.endDate;
      _self.isLoadMore = false;
      _self.doGetMinePayRecord(true);
    },
    doLoadMore() {
      const _self = this;
      if (_self.isLoadMore || _self.hasMore == "noMore") {
        return;
      }
      _self.isLoadMore = true;
      _self.hasMore = "loading";
      _self.pageData.page = ++_self.pageData.page;
      _self.pageData.keywords = _self.keywords;
      _self.pageData.startTime = _self.startDate;
      _self.pageData.endTime = _self.endDate;
      _self.doGetMinePayRecord(false);
    },
    //获取列表
    doGetMinePayRecord(isRefresh) {
      const _self = this;
      _self.recordList = isRefresh ? [] : _self.recordList;
      _self.loadingState = isRefresh ? "loading" : "";
      common_js_net_UserApi.UserApi.doGetMinePayRecord(_self.pageData).then((res) => {
        var status = "success";
        status = res.rows && res.rows.length > 0 ? "success" : "empty";
        _self.loadingState = isRefresh ? status : "";
        _self.recordList = _self.recordList.concat(res.rows);
        _self.isLoadMore = false;
        _self.hasMore = _self.recordList.length < res.total ? "more" : "noMore";
      }).catch((err) => {
        _self.loadingState = "error";
        _self.isLoadMore = false;
        _self.hasMore = "more";
      });
    }
  },
  onPullDownRefresh() {
    common_vendor.index.stopPullDownRefresh();
  }
};
if (!Array) {
  const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
  const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  const _component_ContainerLoading = common_vendor.resolveComponent("ContainerLoading");
  (_easycom_uni_datetime_picker2 + _easycom_uni_load_more2 + _component_ContainerLoading)();
}
const _easycom_uni_datetime_picker = () => "../../../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
const _easycom_uni_load_more = () => "../../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
if (!Math) {
  (_easycom_uni_datetime_picker + _easycom_uni_load_more)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: $data.keywords,
    b: common_vendor.o((...args) => $options.inputKeywords && $options.inputKeywords(...args)),
    c: common_vendor.o((...args) => $options.doSearchKeyWord && $options.doSearchKeyWord(...args)),
    d: $data.keywords != ""
  }, $data.keywords != "" ? {
    e: common_vendor.o((...args) => $options.clearSearch && $options.clearSearch(...args))
  } : {}, {
    f: common_vendor.t($data.startDate == "" ? "请选择开始时间" : $data.startDate),
    g: common_vendor.j({
      "change": common_vendor.o($options.selectStartDate),
      "updateModelValue": common_vendor.o(($event) => $data.startDate = $event)
    }),
    h: common_vendor.p({
      type: "date",
      modelValue: $data.startDate
    }),
    i: $data.startDate == ""
  }, $data.startDate == "" ? {} : {
    j: common_vendor.o((...args) => $options.clearStart && $options.clearStart(...args))
  }, {
    k: common_vendor.t($data.endDate == "" ? "请选择结束时间" : $data.endDate),
    l: common_vendor.j({
      "change": common_vendor.o($options.selectEndDate),
      "updateModelValue": common_vendor.o(($event) => $data.endDate = $event)
    }),
    m: common_vendor.p({
      type: "date",
      modelValue: $data.endDate
    }),
    n: $data.endDate == ""
  }, $data.endDate == "" ? {} : {
    o: common_vendor.o((...args) => $options.clearEnd && $options.clearEnd(...args))
  }, {
    p: common_vendor.f($data.recordList, (item, index, i0) => {
      return common_vendor.e({
        a: index,
        b: common_vendor.t($options.payType(item.type)),
        c: common_vendor.n($options.payTypeColor(item.type)),
        d: item.orderId != ""
      }, item.orderId != "" ? {
        e: common_vendor.t($data.appTitle),
        f: common_vendor.t(item.orderId)
      } : {}, {
        g: common_vendor.t($options.payTypeSign(item.type)),
        h: common_vendor.t(item.accountMoney / 100),
        i: common_vendor.t(item.accountAfterMoney / 100),
        j: common_vendor.t(item.description),
        k: common_vendor.t(item.accountBeforeMoney / 100),
        l: common_vendor.t(item.gmtCreate)
      });
    }),
    q: common_vendor.p({
      status: $data.hasMore
    }),
    r: common_vendor.o((...args) => $options.doLoadMore && $options.doLoadMore(...args)),
    s: common_vendor.j({
      "doRefresh": common_vendor.o($options.doRefreshList)
    }),
    t: common_vendor.p({
      loadingVisible: $data.loadingState
    })
  });
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0de21671"]]);
swan.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../../.sourcemap/mp-baidu/pages/mine/mineAccount/minePayRecord/minePayRecord.js.map
