!(function () { var e = getApp(), t = getApp(); !(function (e) { e && e.__esModule; })(require("../../utils/apis.js")); Page({ change: function (e) { var t = this.data.query, a = e.detail.value, c = this.trim(a); (t.cardNo = c), this.setData({ query: t }); }, name: function (e) { var t = this.data.query, a = e.detail.value; (t.name = a), this.setData({ query: t }); }, start_date: function (e) { var t = this.data.query, a = e.detail.value, c = this.trim(a); (t.start_date = c), this.setData({ query: t }); }, end_date: function (e) { var t = this.data.query, a = e.detail.value, c = this.trim(a); (t.end_date = c), this.setData({ query: t }); }, trim: function (e) { return (e = (e = e.replace(/\s+/gi, "")).replace( /\W+/, "" )).toUpperCase(); }, selectResult: function (e, t, a) { if (a) switch (a) { case 1: 1 == t ? this.setData({ "query.cardNo_code": e.title }) : this.setData({ "query.province_small": e.province_small }); break; case 2: this.setData({ "query.cardNo_type": e.id, cardNo_type: e.title, }); break; case 3: this.setData({ "query.hot_type": e.id, hot_type: e.title }); } }, isGDCar: function (e) { var t = this.data, a = t.pickerArray, c = t.letter; try { -1 != a[0][e].province_small.indexOf("粤") ? (c = c.filter(function (e) { return "X" != e.title && "Y" != e.title; })) : "Y" != c[c.length - 1].title && (c = c.concat([ { checked: !1, title: "X" }, { checked: !1, title: "Y" }, ])); } catch (e) { "Y" != c[c.length - 1].title && (c = c.concat([ { checked: !1, title: "X" }, { checked: !1, title: "Y" }, ])); } (a[1] = c), this.setData({ letter: c, pickerArray: a }); }, onChange: function (e) { var t = e.detail.value[0]; 1 == this.data.typeName.num && this.isGDCar(t), this.setData({ piclerNum: e.detail.value }); }, openPick: function (e) { var t = this, a = this.data, c = a.carHeadList, i = a.letter, d = a.carKind, n = a.rules, l = a.piclerNum, r = a.typeName; if (e.currentTarget.dataset.index) { var o, s = parseInt(e.currentTarget.dataset.index); switch (((o = 4 == s ? this.data.pickerArray : []), s)) { case 1: (r.title = "选择车牌前缀"), (r.num = s), o.push(c), o.push(i); break; case 2: (r.title = "选择车牌种类"), (r.num = s), o.push(d); break; case 3: (r.title = "选择查找规则"), (r.num = s), o.push(n); break; case 4: o.forEach(function (e) { e.forEach(function (e) { e.checked = !1; }); }), l.forEach(function (e, a) { (o[a][e].checked = !0), t.selectResult(o[a][e], a, r.num); }); } var p = []; o.forEach(function (e, t) { (p[t] = 0), e.forEach(function (e, a) { e.checked && (p[t] = a); }); }), this.setData({ pickerArray: o, piclerNum: p, typeName: r }), 1 == s && this.isGDCar(p[0]); } this.setData({ pickerBol: !this.data.pickerBol }); }, mileageChanage: function (e) { this.setData({ mileage: e.detail.value }); }, sumbin: function () { // this.tongzhi(); var t = this.data.query; if (t.cardNo) if (18 == t.cardNo.length) if (t.name) if ("iosb" == e.getSystemPlatform()) wx.showModal({ title: "温馨提示", content: "iOS不支持小程序,请使用公众号查询", success: function (e) { e.confirm ? wx.navigateTo({ url: "/pages/website/website?url=https://mp.weixin.qq.com/s?__biz=MzIwOTYxMTI2Nw==&mid=2247483888&idx=1&sn=1f5deda3e1a2d5e109dfaf8000520030&chksm=97707e9ca007f78a7ade8b1b57eda40183c6de47a6a115836fdb77748fc248c320a29e3309c6&token=1742855998&lang=zh_CN#rd&img=" + wx.getStorageSync("gzhurl"), }) : console.log("点击取消回调"); }, }); else { var a = this, c = { content: a.data.query.name + a.data.query.cardNo + a.data.query.start_date + a.data.query.end_date, }; e.getdata(c, "checkContent").then((e) => { console.log("文本回调数据:", e), 200 == e.code ? a.queryVin() : wx.showModal({ title: "温馨提示", content: "你输入的文本检测存在违规,请检测文本内容后重新输入。", success: function (e) { e.confirm || console.log("点击取消回调"); }, }); }); } else wx.showToast({ title: "请输入姓名", icon: "none", duration: 2e3, }); else wx.showToast({ title: "身份证号码长度错误", icon: "none", duration: 2e3, }); else wx.showToast({ title: "请输入身份证号码", icon: "none", duration: 2e3, }); }, orderid: function () { let e = ""; for (var t = 0; t < 8; t++) e += Math.floor(10 * Math.random()); (e = "D" + new Date().getTime() + e), this.setData({ orderid: e }); }, queryVin: function () { if (wx.getStorageSync("uid")) { var e = this; e.orderid(), wx.getStorageSync("uid") ? (console.log(wx.getStorageSync("uid")), t.util.request({ url: "tool/sfzhy/createOrder", method: "post", dataType: "json", data: { orderid: e.data.orderid, uid: wx.getStorageSync("uid"), data: e.data.query, }, success: function (a) { if (a.data && a.data.data) { if (a.data.data.ispay && a.data.data.ispay == 1) { e.getDetailpay(); return true; } a.data.data.config && wx.requestPayment({ timeStamp: a.data.data.config.timeStamp, nonceStr: a.data.data.config.nonceStr, package: a.data.data.config.package, signType: a.data.data.config.signType, paySign: a.data.data.config.paySign, success: function (c) { t.util.request({ url: "tool/pay/callback", data: { uid: wx.getStorageSync("uid"), orderid: a.data.data.orderid, }, success: function (t) { e.setData({ weizhang_num: 1 * e.data.weizhang_num + 10 }), wx.showModal({ content: t.data.message }), e.getDetailpay(); }, }); }, }); return true; } wx.showModal({ content: a.data.message }); }, })) : wx.showModal({ title: "温馨提醒", content: "使用本功能请先登录后在使用~", showCancel: !1, success: function (e) { e.confirm && wx.reLaunch({ url: "/pages/mine/index" }); }, }); } else wx.showModal({ title: "温馨提示", content: "请去个人中心授权登录用户信息", success: function (e) { e.confirm ? wx.reLaunch({ url: "/pages/mine/index" }) : console.log("点击取消回调"); }, }); }, getDetailpay: function () { var t = this; this.setData({ "query.uid": wx.getStorageSync("uid"), "query.orderid": t.data.orderid, "query.name": t.data.name, }); var a = this.data.query; e.getdata(a, "sfzhy").then((e) => { console.log("年检回调数据:", e.data), wx.navigateTo({ url: "../sfzhy/carcxjl?orderid=" + t.data.orderid }), (e = e.data).data && t.setData({ order: e.data.result }); }); }, tongzhi: function (t) { e.getdata({ type: "4" }, "getdyxx").then((t) => { wx.requestSubscribeMessage({ tmplIds: [t.data], success(a) { "accept" == a[t.data] ? (wx.showToast({ title: "订阅成功" }), e.util.request({ url: "entry/wxapp/addtemplateid", data: { templateid: t.data, uid: wx.getStorageSync("uid") }, header: { "content-type": "application/json" }, success: function (e) { console.log(e); }, })) : wx.showToast({ title: "订阅失败" }); }, }); }); }, toDetailExample: function () { wx.navigateTo({ url: "../sfzhy/carcxjl?orderid=demo" }); }, toSelectCar: function () { wx.navigateTo({ url: "/pages/selectCar/selectCar" }); }, toSelectCity: function () { wx.navigateTo({ url: "/pages/selectCity/selectCity" }); }, toSelectTime: function () { wx.navigateTo({ url: "/pages/selectTime/selectTime" }); }, saoys: function (e) { wx.navigateTo({ url: "../xszsb/xszsb?type=2" }); }, onLoad: function (e) { wx.getStorageSync("uid") || getApp().wxlogin(), wx.removeStorageSync("cardata"), this.orderid(), wx.removeStorageSync("carvehicle"), wx.removeStorageSync("carprov"), wx.removeStorageSync("carcity"), wx.removeStorageSync("cartime"), wx.removeStorageSync("cardatawx"); }, onReady: function () { }, onShow: function () { e.appdengl(), this.getDetail(1); var t = wx.getStorageSync("cardata"); if ((console.log("行驶证数据", t), t)) { this.setData({ "query.province_small": t.号牌号码.words.substring(0, 1), "query.cardNo_code": t.号牌号码.words.substring(1, 2), "query.cardNo": t.号牌号码.words.substring(2, 8), }); for ( var a = t.车辆类型.words, c = this.data.carKind, i = 0; i < c.length; ++i ) c[i].title == a && this.setData({ cardNo_type: c[i].title, "query.cardNo_type": c[i].id, }); } var d = wx.getStorageSync("carvehicle"), n = wx.getStorageSync("carprov"), l = wx.getStorageSync("carcity"), r = wx.getStorageSync("cartime"), o = ""; "" != l && null != l && (o = n.name + "-" + l.name), console.log("" == d), "" != d && "" != r && parseInt(r.split("-")[0]) < parseInt(d.makeyear) && (r = ""), this.setData({ carName: d.salesdesc, cityName: o, regdate: r, cityid: l.id, provid: n.id, carId: d.autohomeid, }); }, data: { page: 1, type: "21", regdate: "", mileage: "", carName: "", cityName: "", cityid: 0, provid: 0, carId: 0, banner: [], cardNo_type: "", pickerArray: [], pickerBol: !1, piclerNum: [], query: { name: "", cardNo: "", start_date: "", end_date: "", }, typeName: { num: 0, title: "" }, }, onPullDownRefresh: function () { this.clearCache(), this.getArticles(1); }, onReachBottom: function () { // console.log("加上"), this.getDetail(this.data.page); }, clearCache: function () { this.setData({ repairList: [], page: 1 }); }, getDetail: function (t) { var a = this, c = { uid: wx.getStorageSync("uid"), type: a.data.type, page: t }; e.getdata(c, "sfzhy").then((e) => { if ((console.log("回调数据:", e), e.data && 200 == e.code)) a.setData({ repairList: e.data, page: a.data.page + 1 }); }); }, onHide: function () { }, onUnload: function () { }, onShareAppMessage: function () { }, showRenMsg: function () { wx.showToast({ title: "人工查询中,请稍等", icon: "none", duration: 3e3, }); }, showGaoMsg: function () { wx.showToast({ title: "查不到记录,建议使用高级出险查询。", icon: "none", duration: 3e3, }); }, getDangerDetail: function (e) { var t = e.currentTarget.dataset.orderid; wx.navigateTo({ url: "/packageA/pages/sfzhy/carcxjl?orderid=" + t, success: function () { }, }); }, }); })();