403 lines
13 KiB
JavaScript
403 lines
13 KiB
JavaScript
var e, t;
|
||
(e = getApp()),
|
||
(t = getApp()),
|
||
Page({
|
||
change: function (e) {
|
||
var t = this.data.query,
|
||
a = e.detail.value,
|
||
i = this.trim(a);
|
||
(t.license_plate = i), this.setData({ query: t });
|
||
},
|
||
name: function (e) {
|
||
var t = e.detail.value;
|
||
this.setData({ name: 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.license_plate_code": e.title })
|
||
: this.setData({ "query.province_small": e.province_small });
|
||
break;
|
||
case 2:
|
||
this.setData({
|
||
"query.license_plate_type": e.id,
|
||
license_plate_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,
|
||
i = t.letter;
|
||
try {
|
||
-1 != a[0][e].province_small.indexOf("粤")
|
||
? (i = i.filter(function (e) {
|
||
return "X" != e.title && "Y" != e.title;
|
||
}))
|
||
: "Y" != i[i.length - 1].title &&
|
||
(i = i.concat([
|
||
{ checked: !1, title: "X" },
|
||
{ checked: !1, title: "Y" },
|
||
]));
|
||
} catch (e) {
|
||
"Y" != i[i.length - 1].title &&
|
||
(i = i.concat([
|
||
{ checked: !1, title: "X" },
|
||
{ checked: !1, title: "Y" },
|
||
]));
|
||
}
|
||
(a[1] = i), this.setData({ letter: i, 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,
|
||
i = a.carHeadList,
|
||
n = a.letter,
|
||
r = a.carKind,
|
||
c = a.rules,
|
||
o = a.piclerNum,
|
||
s = a.typeName;
|
||
if (e.currentTarget.dataset.index) {
|
||
var d,
|
||
l = parseInt(e.currentTarget.dataset.index);
|
||
switch (((d = 4 == l ? this.data.pickerArray : []), l)) {
|
||
case 1:
|
||
(s.title = "选择车牌前缀"), (s.num = l), d.push(i), d.push(n);
|
||
break;
|
||
case 2:
|
||
(s.title = "选择车牌种类"), (s.num = l), d.push(r);
|
||
break;
|
||
case 3:
|
||
(s.title = "选择查找规则"), (s.num = l), d.push(c);
|
||
break;
|
||
case 4:
|
||
d.forEach(function (e) {
|
||
e.forEach(function (e) {
|
||
e.checked = !1;
|
||
});
|
||
}),
|
||
o.forEach(function (e, a) {
|
||
(d[a][e].checked = !0), t.selectResult(d[a][e], a, s.num);
|
||
});
|
||
}
|
||
var u = [];
|
||
d.forEach(function (e, t) {
|
||
(u[t] = 0),
|
||
e.forEach(function (e, a) {
|
||
e.checked && (u[t] = a);
|
||
});
|
||
}),
|
||
this.setData({ pickerArray: d, piclerNum: u, typeName: s }),
|
||
1 == l && this.isGDCar(u[0]);
|
||
}
|
||
this.setData({ pickerBol: !this.data.pickerBol });
|
||
},
|
||
mileageChanage: function (e) {
|
||
this.setData({ mileage: e.detail.value });
|
||
},
|
||
sumbin: function () {
|
||
if ((this.tongzhi(), this.data.query, this.data.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 t = this,
|
||
a = {
|
||
content:
|
||
t.data.mileage + t.data.engine + t.data.chepai + t.data.name,
|
||
};
|
||
e.getdata(a, "checkContent").then((e) => {
|
||
console.log("文本回调数据:", e),
|
||
0 == e.errcode
|
||
? t.queryVin()
|
||
: wx.showModal({
|
||
title: "温馨提示",
|
||
content:
|
||
"你输入的文本检测存在违规,请检测文本内容后重新输入。",
|
||
success: function (e) {
|
||
e.confirm || console.log("点击取消回调");
|
||
},
|
||
});
|
||
});
|
||
}
|
||
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(),
|
||
console.log(wx.getStorageSync("uid")),
|
||
wx.getStorageSync("uid")
|
||
? (console.log(wx.getStorageSync("uid")),
|
||
t.util.request({
|
||
url: "entry/wxapp/paynum",
|
||
method: "post",
|
||
dataType: "json",
|
||
data: {
|
||
m: "monai_market",
|
||
type: "gslxcx_money",
|
||
orderid: e.data.orderid,
|
||
uid: wx.getStorageSync("uid"),
|
||
postcardata: JSON.stringify(e.data),
|
||
},
|
||
success: function (a) {
|
||
a.data && a.data.data && 1e3 == a.data.message
|
||
? t.util.request({
|
||
url: "entry/wxapp/Api",
|
||
data: {
|
||
m: "monai_market",
|
||
uid: wx.getStorageSync("uid"),
|
||
r: "home.weizhang.paynum",
|
||
orderid: a.data.data.orderid,
|
||
},
|
||
success: function (t) {
|
||
wx.showModal({ content: t.data.message }),
|
||
e.setData({
|
||
weizhang_num: 1 * e.data.weizhang_num + 10,
|
||
}),
|
||
e.getDetailpay();
|
||
},
|
||
})
|
||
: a.data &&
|
||
a.data.data &&
|
||
a.data.code!=200 &&
|
||
wx.requestPayment({
|
||
timeStamp: a.data.data.timeStamp,
|
||
nonceStr: a.data.data.nonceStr,
|
||
package: a.data.data.package,
|
||
signType: "MD5",
|
||
paySign: a.data.data.paySign,
|
||
success: function (i) {
|
||
t.util.request({
|
||
url: "entry/wxapp/Api",
|
||
data: {
|
||
m: "monai_market",
|
||
uid: wx.getStorageSync("uid"),
|
||
r: "home.weizhang.paynum",
|
||
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();
|
||
},
|
||
});
|
||
},
|
||
});
|
||
},
|
||
}))
|
||
: 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 () {
|
||
wx.navigateTo({ url: "carcxjl?orderid=" + this.data.orderid });
|
||
},
|
||
tongzhi: function (t) {
|
||
e.getdata({ type: "4" }, "getdyxx").then((t) => {
|
||
console.log(t.data),
|
||
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: "carcxjl?orderid=D169469407882624922365" });
|
||
},
|
||
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.license_plate_code": t.号牌号码.words.substring(1, 2),
|
||
"query.license_plate": t.号牌号码.words.substring(2, 8),
|
||
});
|
||
for (
|
||
var a = t.车辆类型.words, i = this.data.carKind, n = 0;
|
||
n < i.length;
|
||
++n
|
||
)
|
||
i[n].title == a &&
|
||
this.setData({
|
||
license_plate_type: i[n].title,
|
||
"query.license_plate_type": i[n].id,
|
||
});
|
||
}
|
||
var r = wx.getStorageSync("carvehicle"),
|
||
c = wx.getStorageSync("carprov"),
|
||
o = wx.getStorageSync("carcity"),
|
||
s = wx.getStorageSync("cartime"),
|
||
d = "";
|
||
"" != o && null != o && (d = c.name + "-" + o.name),
|
||
console.log("" == r),
|
||
"" != r &&
|
||
"" != s &&
|
||
parseInt(s.split("-")[0]) < parseInt(r.makeyear) &&
|
||
(s = ""),
|
||
this.setData({
|
||
carName: r.salesdesc,
|
||
cityName: d,
|
||
regdate: s,
|
||
cityid: o.id,
|
||
provid: c.id,
|
||
carId: r.autohomeid,
|
||
});
|
||
},
|
||
data: {
|
||
page: 1,
|
||
type: "25",
|
||
regdate: "",
|
||
mileage: "",
|
||
carName: "",
|
||
cityName: "",
|
||
cityid: 0,
|
||
provid: 0,
|
||
carId: 0,
|
||
banner: [],
|
||
circular: 1500,
|
||
conditions: [{ checked: !1, title: "不含4" }],
|
||
hot_type: "任意号码",
|
||
isAuthorized: !0,
|
||
isHighBol: !1,
|
||
license_plate_type: "",
|
||
pickerArray: [],
|
||
pickerBol: !1,
|
||
piclerNum: [],
|
||
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,
|
||
i = { uid: wx.getStorageSync("uid"), type: a.data.type, page: t };
|
||
e.getdata(i, "carqxcx").then((e) => {
|
||
if ((console.log("回调数据:", e), e.data && 200 == e.code))
|
||
if (1 == t) a.setData({ repairList: e.data, page: a.data.page + 1 });
|
||
else {
|
||
var i = a.data.repairList;
|
||
i.push.apply(i, e.data),
|
||
a.setData({ repairList: i, 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: "carcxjl?orderid=" + t, success: function () {} });
|
||
},
|
||
});
|