myBill.js 4.34 KB
"use strict";
const common_vendor = require("../../common/vendor.js");
const myCenter_center_api = require("../center_api.js");
require("../../common/request.js");
require("../../common/login.js");
require("../../config.js");
require("../../common/aes.js");
if (!Array) {
  const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
  const _easycom_uni_tag2 = common_vendor.resolveComponent("uni-tag");
  const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
  (_easycom_uni_segmented_control2 + _easycom_uni_tag2 + _easycom_uni_popup2)();
}
const _easycom_uni_segmented_control = () => "../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js";
const _easycom_uni_tag = () => "../../uni_modules/uni-tag/components/uni-tag/uni-tag.js";
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
  (_easycom_uni_segmented_control + _easycom_uni_tag + _easycom_uni_popup)();
}
const _sfc_main = {
  __name: "myBill",
  setup(__props) {
    const app = getApp();
    const items = common_vendor.ref([
      "培训",
      "订单"
    ]);
    const current = common_vendor.ref(1);
    const bankShow = common_vendor.ref(null);
    const bankInfo = common_vendor.ref({});
    const list = common_vendor.ref([]);
    common_vendor.onShow(() => {
      if (app.globalData.isLogin) {
        init();
      } else {
        app.firstLoadCallback = () => {
          init();
        };
      }
    });
    function init() {
      myCenter_center_api.getMyOrder().then((res) => {
        list.value = res.rows;
      });
    }
    function onClickItem(e) {
      console.log(e);
      if (e.currentIndex == 0) {
        common_vendor.index.navigateTo({
          url: `/myCenter/mytrain/mytrain`
        });
      }
    }
    function goTrainDetail(id) {
      common_vendor.index.navigateTo({
        url: `/myCenter/mytrain/orderDetail?id=${id}`
      });
    }
    function showFeeInfo(item) {
      bankInfo.value = JSON.parse(item.receivingInfo);
      bankShow.value.open();
    }
    function copyPlat() {
      let str = `单位名称:${bankInfo.value.name};开户行:${bankInfo.value.bank};账户:${bankInfo.value.account};`;
      common_vendor.index.setClipboardData({
        data: str,
        success: function() {
          common_vendor.index.showToast({
            title: "已复制",
            icon: "none"
          });
        }
      });
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.o(onClickItem),
        b: common_vendor.p({
          current: current.value,
          styleType: "text",
          values: items.value,
          activeColor: "#AD181F"
        }),
        c: common_vendor.f(list.value, (n, k0, i0) => {
          var _a;
          return {
            a: common_vendor.t(n.name),
            b: common_vendor.f((_a = n.projectsStr) == null ? void 0 : _a.split(","), (p, k1, i1) => {
              return {
                a: p,
                b: "d125aa21-1-" + i0 + "-" + i1,
                c: common_vendor.p({
                  type: "warning",
                  inverted: true,
                  size: "small",
                  text: p
                })
              };
            }),
            c: common_vendor.t(n.signTimeRange),
            d: common_vendor.t(n.trainTimeRange),
            e: common_vendor.t(n.address),
            f: common_vendor.o(($event) => showFeeInfo(n), n.id),
            g: common_vendor.o(($event) => goTrainDetail(n.id), n.id),
            h: n.id
          };
        }),
        d: list.value.length == 0
      }, list.value.length == 0 ? {} : {}, {
        e: common_vendor.t(bankInfo.value.name),
        f: common_vendor.t(bankInfo.value.bank),
        g: common_vendor.t(bankInfo.value.account),
        h: common_vendor.o(copyPlat),
        i: common_vendor.o((...args) => _ctx.sure && _ctx.sure(...args)),
        j: common_vendor.sr(bankShow, "d125aa21-2", {
          "k": "bankShow"
        }),
        k: common_vendor.p({
          type: "bottom",
          ["background-color"]: "#fff"
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d125aa21"], ["__file", "/Users/yangyang/ztx_wx_minapp/myCenter/mytrain/myBill.vue"]]);
wx.createPage(MiniProgramPage);