var t, a;
(t = getApp()),
  (a = getApp()),
  Page({
    data: {
      winWidth: 0,
      winHeight: 0,
      currentTab: 0,
      autoplay: !1,
      circular: !0,
      indicatorDots: !0,
      scrollTop: "",
      navFixed: !1,
      currentData: 888,
      repairList: [],
      dangerList: [],
      detailList: [],
      valutionList: [],
      theInterval: null,
      type: 888,
      page: 1,
      inputValue: "",
      inputVal: "",
      animationData: {},
      tipText: "",
      showPrivacy: !1,
    },
    onLoad: function (t) {
      t.type
        ? (this.setData({ currentData: t.type, type: t.type }),
          this.getDetail())
        : this.getDetail(0),
        this._notice();
    },
    info_notice: function (t) {
      this.setData({ showPrivacy: !0 });
    },
    info_off: function (t) {
      this.setData({ showPrivacy: !1 });
    },
    bindKeyInput: function (t) {
      var a = t.detail.value;
      this.setData({ inputVal: a });
    },
    clickcx: function (a) {
      if (this.data.inputVal) {
        this.setData({ repairList: [], page: 1 });
        var e = this,
          n = { content: this.data.inputVal };
        t.getdata(n, "checkContent").then((t) => {
          if ((console.log("文本回调数据：", t), 0 != t.errcode))
            return (
              e.setData({ inputVal: "" }),
              void wx.showModal({
                title: "温馨提示",
                content: "你输入的文本检测存在违规，请检测文本内容后重新输入。",
                success: function (t) {
                  t.confirm || console.log("点击取消回调");
                },
              })
            );
          e.getDetail();
        });
      } else
        wx.showToast({
          title: "请输入车架号查询",
          icon: "none",
          duration: 3e3,
        });
    },
    zrg: function (t) {
      var a = this;
      wx.showModal({
        title: "温馨提示",
        content: "此订单查询太久是否转人工。",
        success: function (e) {
          e.confirm ? a.zrgpost(t) : console.log("点击取消回调");
        },
      });
    },
    zrgpost: function (a) {
      var e = this,
        n = { orderid: a.currentTarget.dataset.orderid };
      t.getdata(n, "zrg").then((t) => {
        console.log("文本回调数据：", t),
          repairList,
          e.setData({ repairList: [] }),
          e.getDetail();
      });
    },
    _notice: function () {
      var t = this;
      a.util.request({
        url: "entry/wxapp/Api",
        data: {  r: "home.index.home" },
        cachetime: "0",
        success: function (a) {
          console.log(a),
            a.data.data.info_name.name &&
              wx.setNavigationBarTitle({
                title: a.data.data.info_name.name + "",
              }),
            t.setData({
              banner: a.data.data.banner,
              market: a.data.data.market,
              brand: a.data.data.brand,
              textJson: a.data.data.notice,
              info_name: a.data.data.info_name.name,
              recom: a.data.data.info_name.recom,
            });
        },
      });
    },
    showModal: function (t) {
      wx.getStorageSync("showModal"),
        console.log("phone", this.data.uesrdata.phone),
        this.data.uesrdata.phone ||
          wx.showModal({
            title: "温馨提示",
            content:
              "绑定手机号码后，查询完成将收到短信通知，否则查询完成后无法通知，绑定成功后不再提醒",
            showCancel: !0,
            cancelText: "我知道了",
            confirmText: "立即设置",
            success: function (t) {
              t.cancel
                ? (console.log("您点击了取消"),
                  wx.setStorageSync("showModal", 1))
                : t.confirm && wx.navigateTo({ url: "/pages/mine/info/index" });
            },
          });
    },
    previewImage: function (t) {
      console.log(t),
        wx.showToast({
          title: "长按图片保存截图",
          icon: "none",
          duration: 3e3,
        }),
        wx.previewImage({
          current: t.currentTarget.dataset.id,
          urls: [t.currentTarget.dataset.id],
        });
    },
    previewImageb: function (t) {
      console.log(t),
        wx.showToast({
          title: "长按图片保存截图",
          icon: "none",
          duration: 3e3,
        }),
        wx.previewImage({
          current: JSON.parse(t.currentTarget.dataset.id)[0],
          urls: [JSON.parse(t.currentTarget.dataset.id)[0]],
        });
    },
    checkCurrent: function (a) {
      if (
        (t.appdengl(),
        console.log("点击切换"),
        console.log(a.target.dataset.current),
        this.data.currentData === a.target.dataset.current)
      )
        return !1;
      var e = a.target.dataset.current;
      this.setData({
        currentData: a.target.dataset.current,
        type: e,
        repairList: [],
        inputVal: "",
        page: 1,
      }),
        a.currentTarget.dataset.current,
        wx.createAnimation({ duration: 100, timingFunction: "ease" }),
        this.getDetail();
    },
    onReachBottom: function () {
      console.log("加上"),
        888 != this.data.type
          ? this.getDetail()
          : wx.showToast({
              title: "查看更多请点击分类",
              icon: "none",
              duration: 3e3,
            });
    },
    getDetail: function () {
      var a = this.data.type,
        e = this,
        n = {
          uid: wx.getStorageSync("uid"),
          type: a,
          page: this.data.page,
          keyword: this.data.inputVal,
        };
      t.getdata(n, "carqxcx").then((t) => {
        if ((console.log("回调数据：", t), t.data)) {
          if (1 == e.data.page) var a = t.data;
          else
            e.data.repairList.length > 1 && (a = e.data.repairList),
              t.data.length > 1 && a.push.apply(a, t.data);
          e.setData({ repairList: a, page: e.data.page + 1 });
        }
      });
    },
    layoutScroll: function (t) {
      (this.data.scrollTop = 1 * this.data.scrollTop + 1 * t.detail.deltaY),
        this.data.scrollTop <= -160
          ? this.setData({ navFixed: !0 })
          : this.setData({ navFixed: !1 });
    },
    tongzhi: function (a) {
      t.getdata({ type: "4" }, "getdyxx").then((a) => {
        console.log(a.data),
          wx.requestSubscribeMessage({
            tmplIds: [a.data],
            success(e) {
              "accept" == e[a.data]
                ? (wx.showToast({ title: "订阅成功" }),
                  t.util.request({
                    url: "entry/wxapp/addtemplateid",
                    data: { templateid: a.data, uid: wx.getStorageSync("uid") },
                    header: { "content-type": "application/json" },
                    success: function (t) {
                      console.log(t);
                    },
                  }))
                : wx.showToast({ title: "订阅失败" });
            },
          });
      });
    },
    showRenMsg: function () {
      this.tongzhi();
      var t = this;
      wx.showModal({
        title: "温馨提示",
        content:
          "人工查询时间：早上9点-晚上10点-20分钟左右出结果，其他时间第二天早上9点出结果，绑定手机号后获得查询通知",
        success: function (a) {
          a.confirm
            ? (console.log("点击确认回调"),
              t.data.uesrdata.phone ||
                wx.navigateTo({ url: "/pages/mine/info/index" }))
            : console.log("点击取消回调");
        },
      });
    },
    showGaoMsg: function () {
      wx.showToast({
        title: "查不到记录，建议使用高级出险查询。",
        icon: "none",
        duration: 3e3,
      });
    },
    getgscx: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/gscx/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getvin: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carvin/carvin?orderid=" + a,
        success: function () {},
      });
    },
    getcpcx: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/cpcx/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getjqx: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carjqx/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getsyx: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carsyx/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    njcx: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carnj/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    wzcx: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/cphy/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    dcbg: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/dcbg/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getRepairDetail: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carwbjzb/carwxjl?orderid=" + a,
        success: function () {},
      });
    },
    getDangerDetail: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carcx/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getdzbdDetail: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/cardzbd/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getcarclztDetail: function (t) {
      var a = t.currentTarget.dataset.orderid;
      wx.navigateTo({
        url: "/packageA/pages/carclzt/carcxjl?orderid=" + a,
        success: function () {},
      });
    },
    getBaseDetail: function (t) {
      var a = t.currentTarget.dataset.vin,
        e = t.currentTarget.dataset.logo,
        n = t.currentTarget.dataset.time,
        r = t.currentTarget.dataset.brand;
      t.currentTarget.dataset.version,
        wx.navigateTo({
          url:
            "/pages/carinfoDetail/carinfoDetail?vin=" +
            a +
            "&logo=" +
            e +
            "&brand=" +
            r +
            "&time=" +
            n,
          success: function () {},
        });
    },
    getallDetail: function (t) {
      var a = t.currentTarget.dataset.page;
      wx.navigateTo({ url: a, success: function () {} });
    },
    getValuationDetail: function (t) {
      var a = t.currentTarget.dataset.id;
      wx.navigateTo({
        url: "/packageA/pages/caresgz/carpg/carpg?orderid=" + a,
        success: function () {},
      });
    },
    toRepairExample: function () {
      wx.navigateTo({
        url: "/packageA/pages/carwbjzb/carwxjl?orderid=D167578460646744394799",
        success: function () {},
      });
    },
    toDangerExample: function () {
      wx.navigateTo({
        url: "/packageA/pages/carcx/carcxjl?orderid=D166847888078046949494",
        success: function () {},
      });
    },
    toBaseExample: function () {
      wx.navigateTo({
        url: "/pages/carinfoDetail/carinfoDetail",
        success: function () {},
      });
    },
    toValuationExample: function () {
      wx.navigateTo({ url: "/pages/carpg/carpg", success: function () {} });
    },
    onReady: function () {},
    onShow: function () {
      var t = this;
      wx.getSystemInfo({
        success: function (a) {
          t.setData({
            pixelRatio: a.pixelRatio,
            winHeight: a.windowHeight,
            winWidth: a.windowWidth,
            page: 1,
          });
        },
      }),
        this.userdata(),
        this.getDetail();
    },
    userdata: function () {
      var a = this;
      t.util.getUserInfo(function (t) {
        console.log("yh", t),
          t.memberInfo
            ? (a.setData({ memberInfo: t.memberInfo }),
              wx.setStorageSync("uid", t.memberInfo.uid),
              a.firstin(t.memberInfo, 0))
            : a.setData({ isShow: !0 });
      });
    },
    firstin: function (a, e) {
      var n = this;
      console.log("提交数据", a),
        t.util.request({
          url: "entry/wxapp/Api",
          data: {

            r: "me.detail",
            uid: a.uid,
            type: e,
            head_image: a.avatar,
            nickname: a.nickname,
          },
          success: function (t) {
            console.log(t),
              n.setData({
                detail: t.data.data,
                admin: t.data.data.user.is_admin,
                uesrdata: t.data.data.user,
              }),
              n.showModal();
          },
        });
    },
    copyText: function (t) {
      console.log(t),
        wx.setClipboardData({
          data: t.currentTarget.dataset.text,
          success: function (t) {
            wx.getClipboardData({
              success: function (t) {
                wx.showToast({ title: "订单号复制成功" });
              },
            });
          },
        });
    },
    onHide: function () {
      clearInterval(this.data.theInterval);
    },
    onUnload: function () {
      clearInterval(this.data.theInterval);
    },
    onPullDownRefresh: function () {
      this.onShow();
    },
    onShareAppMessage: function () {},
  });
