"use strict";
const common_vendor = require("../../../../common/vendor.js");
const hook_useOnLoad_index = require("../../../../hook/use-on-load/index.js");
const utils_index = require("../../../../utils/index.js");
require("../../../../config/globalData.js");
const config_menu = require("../../../../config/menu.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "transferPage",
  setup(__props) {
    const app = getApp();
    const main = async (options = {}) => {
      var _a, _b;
      let menuList = common_vendor.isEmpty(common_vendor.index.getStorageSync("menuList")) ? await common_vendor.useSetMenuList(config_menu.menu) : common_vendor.index.getStorageSync("menuList");
      let skipWay = "redirectTo";
      let url = "";
      if (options.q) {
        let url_q = decodeURIComponent(options.q);
        url_q.replace(/([^?&=]+)=([^&]+)/g, (_, k, v) => options[k] = v);
        if (url_q && ((_a = url_q == null ? void 0 : url_q.split("?")[1]) == null ? void 0 : _a.split("=")[0]) == "OrderId") {
          options.type = "pay";
          options.orderId = (_b = url_q == null ? void 0 : url_q.split("?")[1]) == null ? void 0 : _b.split("=")[1];
        }
      }
      if (common_vendor.isNotEmpty(options.type)) {
        if (options.type == 0) {
          skipWay = "reLaunch";
          url = `/pages/st1/business/tabbar/homePage/homePage`;
          options.isViewMenu && await common_vendor.useLoadViewMenu();
        } else if (options.type == 1) {
          skipWay = "reLaunch";
          url = `/pages/st1/business/tabbar/netHosIndex/netHosIndex`;
        } else if (options.type == 2) {
          skipWay = "reLaunch";
          url = `/pages/st1/business/tabbar/MsgContent/MsgContent`;
        } else if (options.type == 3) {
          skipWay = "reLaunch";
          url = `/pages/st1/business/tabbar/personalCenter/personalCenter`;
        } else if (options.type == 4) {
          url = `/pagesPatient/st1/business/pay/payState/payState?orderId=${options.orderId}`;
        } else if (options.type == 5) {
          let queryBean2 = {
            DeptCode: options.deptCode,
            DeptName: decodeURIComponent(options.deptName)
          };
          url = `/pagesPatient/st1/business/yygh/yyghDoctorList/yyghDoctorList?queryBean=${JSON.stringify(
            queryBean2
          )}`;
        } else if (options.type == "satisfactionQuestions") {
          url = `/pagesAdmin/satisfaction/satisfactionQuestions/satisfactionQuestions?subjectId=${options.subjectId}`;
        } else if (options.type == "articleDetail") {
          url = `/pagesAdmin/article/business/article/detail/detail?id=${options.articleId}&msgId=${options.msgId}`;
        } else if (options.type == "fuchat") {
          const chatData = await this.getMemberChatList(options);
          if (!chatData)
            return;
          app.globalData.currentUser = { memberId: chatData.MemberId };
          url = `/pagesCrm/st1/business/myFollowUp/followUpList/followUpList?type=${chatData.Type}&roomId=${chatData.Id}&deptName=${chatData.DeptName}&doctorSn=${chatData.Doctorsn}`;
        } else if (options.type == "fuvisit") {
          const roomIdData = await this.getRoomId(options);
          options.roomId = roomIdData.RoomId;
          const chatData = await this.getMemberChatList(options);
          if (!chatData)
            return;
          app.globalData.currentUser = { memberId: chatData.MemberId };
          url = `/pagesCrm/st1/business/myFollowUp/followUpList/followUpList?type=${chatData.Type}&roomId=${chatData.Id}&deptName=${chatData.DeptName}&doctorSn=${chatData.Doctorsn}`;
        } else if (options.type == "article") {
          url = `/pagesAdmin/teamYy/st1/business/disease/articlenInfo/articlenInfo?heaId=${ata.heaId}`;
        } else if (options.type == "pay") {
          url = `/pagesPatient/st1/business/pay/payMent/payMent?orderId=${options.orderId}`;
        } else if (options.type == "myddc") {
          let subjectId = options.subjectId;
          let taskId = options.taskId;
          url = `/pagesAdmin/satisfaction/business/satisfactionQuestions/satisfactionQuestions?subjectId=${subjectId}&taskId=${taskId}`;
        } else if (options.type == "overduePerson") {
          let overdueOptions = common_vendor.isJSON(common_vendor.index.getStorageSync("overdueOptions")) ? JSON.parse(common_vendor.index.getStorageSync("overdueOptions")) : common_vendor.index.getStorageSync("overdueOptions");
          const options2 = overdueOptions.options;
          if (overdueOptions.route.indexOf("yyghClinicMsg") != -1) {
            app.globalData.queryBean = overdueOptions.options.queryBean;
          }
          overdueOptions.options.queryBean = common_vendor.isJSON(overdueOptions.options.queryBean) ? overdueOptions.options.queryBean : JSON.stringify(overdueOptions.options.queryBean);
          const queryString = Object.keys(options2).map((key) => `${key}=${options2[key]}`).join("&");
          url = `/${overdueOptions.route}?${queryString}`;
          await checkAuthAndDefaultMember(url);
          common_vendor.index.setStorageSync("overdueOptions", "");
        } else {
          const childArray = this.getAllChildren(menuList.map((item) => item.Children));
          let menuItem = childArray.filter((item) => item.MenuName == options.type);
          if (common_vendor.isNotEmpty(menuItem)) {
            menuItem = menuItem[0];
            utils_index.menuClick(menuItem, this, skipWay);
            return;
          }
        }
      }
      if (common_vendor.isEmpty(url)) {
        common_vendor.showModal(`<<${options.type}>>跳转地址为空，请联系管理员`, () => {
          common_vendor.goToUrl(`/pages/st1/business/tabbar/homePage/homePage`, {
            skipWay: "reLaunch"
          });
        });
        return;
      }
      common_vendor.goToUrl(url, {
        skipWay
      });
    };
    const checkAuthAndDefaultMember = async (url) => {
      if (common_vendor.useIsToAuthPage()) {
        return;
      }
      let lastOperatorResp = await common_vendor.useGetDefaultMember({
        cardType: "1",
        url,
        isKeepPage: true,
        pageType: "doctorYygh"
        //个性化预约挂号
      });
      if (lastOperatorResp === null)
        return;
      if (common_vendor.isEmpty(lastOperatorResp)) {
        app.globalData.toUrl = url;
        app.globalData.cardType = app.globalData.withoutCard ? "" : "1";
        url = `/pagesPersonal/st1/business/patientManagement/addMember/addMember`;
      }
    };
    hook_useOnLoad_index.useOnLoad((options) => {
      common_vendor.index.showLoading();
      main(options);
    });
    return (_ctx, _cache) => {
      return {};
    };
  }
});
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/pages/business/tabbar/transferPage/transferPage.js.map
