2024-01-22 23:40:19 +08:00

461 lines
16 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var a, t;
(a = getApp()),
(t = getApp()).util.url("entry/wxapp/Api", {
m: "monai_market",
uid: wx.getStorageSync("uid"),
r: "Upimg",
}),
Page({
data: { postData: [], page: 1, type: 26, carsimgs: [] },
saoys: function (a) {
console.log(a);
var t = a.currentTarget.dataset.name;
wx.navigateTo({ url: "../xszsb/xszsb?type=1&name=" + t });
},
openPick: function (a) {
var t = this,
e = this.data,
i = e.carHeadList,
n = e.letter,
o = e.carKind,
s = e.rules,
r = e.piclerNum,
d = e.typeName;
if (a.currentTarget.dataset.index) {
var c,
g = parseInt(a.currentTarget.dataset.index);
switch (((c = 4 == g ? this.data.pickerArray : []), g)) {
case 1:
(d.title = "选择车牌前缀"), (d.num = g), c.push(i), c.push(n);
break;
case 2:
(d.title = "选择车牌种类"), (d.num = g), c.push(o);
break;
case 3:
(d.title = "选择查找规则"), (d.num = g), c.push(s);
break;
case 4:
c.forEach(function (a) {
a.forEach(function (a) {
a.checked = !1;
});
}),
r.forEach(function (a, e) {
(c[e][a].checked = !0), t.selectResult(c[e][a], e, d.num);
});
}
var u = [];
c.forEach(function (a, t) {
(u[t] = 0),
a.forEach(function (a, e) {
a.checked && (u[t] = e);
});
}),
this.setData({ pickerArray: c, piclerNum: u, typeName: d }),
1 == g && this.isGDCar(u[0]);
}
this.setData({ pickerBol: !this.data.pickerBol });
},
formSubmit: function (a) {
console.log("form发生了submit事件携带数据为", a.detail.value);
var t = this.data.postData,
e = a.detail.value;
for (var i in e) t.hasOwnProperty(i) && (t[i] = e[i]);
this.setData({ postData: t }), console.log(t), this.queryVolation();
},
delcarsimgs: function (a) {
var e = this,
i = a.currentTarget.dataset.index,
n = e.data.carsimgs;
if (0 == i && n.length > 1 && ("" != n[i].img || "" != n[i].intro))
return (
"" != n[i].img &&
t.util.request({
url: "entry/wxapp/Api",
data: {
m: "monai_market",
uid: t.getuid(),
imgurl: n[i].img,
r: "Upimg.delImg",
},
}),
n.splice(i, 1),
void e.setData({ carsimgs: n })
);
0 != i &&
("" != n[i].img &&
t.util.request({
url: "entry/wxapp/Api",
data: {
m: "monai_market",
uid: t.getuid(),
imgurl: n[i].img,
r: "Upimg.delImg",
},
}),
n.splice(i, 1),
e.setData({ carsimgs: n }));
},
upcarsimgs: function (a) {
var e = this;
wx.setStorageSync("dukeyname", a.currentTarget.dataset.name);
var i = wx.getStorageSync("dukeyname"),
n = e.data.postData[i];
n || this.postDatanew("dukeyname", []),
n.length >= 9
? t.util.message({ title: "您添加的图片已经很多了", type: "error" })
: t.upimgs({
scannums: 9,
filename: "cars",
success: function (a) {
for (var t in a) e.addinimgs(a[t]);
},
});
},
addinimgs: function (a) {
var t = wx.getStorageSync("dukeyname"),
e = this.data.postData[t],
i = { img: a.all, imgshort: a.short };
e.push(i), this.postDatanew("dukeyname", e);
},
postDatanew: function (a, t) {
var e = wx.getStorageSync(a);
if (e) {
console.log(e);
var i = this.data.postData;
for (var a in i) a == e && (i[a] = t);
this.setData({ postData: i });
}
},
showimgs: function (a) {
var t = a.currentTarget.dataset.index,
e = this.data.carsimgs;
wx.previewImage({ current: e[t].img, urls: [e[t].img] });
},
upthiscarsimgs: function (a) {
console.log(a),
wx.setStorageSync("dukeyname", a.currentTarget.dataset.name);
var e = a.currentTarget.dataset.index,
i = wx.getStorageSync("dukeyname"),
n = this.data.postData[i];
t.util.request({
url: "entry/wxapp/Api",
data: {
m: "monai_market",
uid: t.getuid(),
imgurl: n[e].img,
r: "Upimg.delImg",
},
}),
n.splice(e, 1),
this.postDatanew("dukeyname", n);
},
addcarsimgs: function () {
var a = this.data.carsimgs;
a.push({ img: "", intro: "", imgshort: "" }),
this.setData({ carsimgs: a });
},
upimg: function () {
var a = this,
e = wx.getStorageSync("dukeyname"),
i = a.data.postData[e];
i.length >= 9
? t.util.message({ title: "您上传的图片已经很多了", type: "error" })
: (i.length,
t.upimgs({
scannums: 1,
filename: "cars",
success: function (t) {
var e = i.concat(t);
a.postDatanew("dukeyname", e);
},
}));
},
delimg: function (a) {
console.log(a.currentTarget.dataset.index);
var e = a.currentTarget.dataset.index,
i = this.data.carimgs,
n = i[e].all;
t.util.request({
url: "entry/wxapp/Api",
data: {
m: "monai_market",
uid: t.getuid(),
imgurl: n,
r: "Upimg.delImg",
},
}),
i.splice(e, 1),
this.setData({ carimgs: i }),
this.postDatanew("dukeyname", this.data.carsimgs);
},
queryVolation: function () {
if (wx.getStorageSync("uid")) {
var t = this;
if ((this.tongzhi(), "iosb" == a.getSystemPlatform()))
wx.showModal({
title: "温馨提示",
content: "iOS不支持小程序请使用公众号查询",
success: function (a) {
a.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 e = this,
i = {
content:
e.data.mileage +
e.data.engine +
e.data.chepai +
e.data.name +
e.data.phone,
};
a.getdata(i, "checkContent").then((a) => {
console.log("文本回调数据:", a),
0 == a.errcode
? t.queryVin()
: wx.showModal({
title: "温馨提示",
content:
"你输入的文本检测存在违规,请检测文本内容后重新输入。",
success: function (a) {
a.confirm || console.log("点击取消回调");
},
});
});
}
} else
wx.showModal({
title: "温馨提示",
content: "请去个人中心授权登录用户信息",
success: function (a) {
a.confirm
? wx.reLaunch({ url: "/pages/mine/index" })
: console.log("点击取消回调");
},
});
},
orderid: function () {
let a = "";
for (var t = 0; t < 8; t++) a += Math.floor(10 * Math.random());
(a = "D" + new Date().getTime() + a), this.setData({ orderid: a });
},
queryVin: function () {
if (wx.getStorageSync("uid")) {
var t = this;
t.orderid(),
console.log(wx.getStorageSync("uid")),
wx.getStorageSync("uid")
? (console.log(wx.getStorageSync("uid")),
a.util.request({
url: "entry/wxapp/paynumwn",
method: "post",
dataType: "json",
data: {
m: "monai_market",
orderid: t.data.orderid,
cxid: t.data.id,
uid: wx.getStorageSync("uid"),
postcardata: JSON.stringify(t.data),
postData: JSON.stringify(t.data.postData),
},
success: function (e) {
e.data && e.data.data && 1e3 == e.data.message
? a.util.request({
url: "entry/wxapp/Api",
data: {
m: "monai_market",
uid: wx.getStorageSync("uid"),
r: "home.weizhang.paynum",
orderid: e.data.data.orderid,
},
success: function (a) {
wx.showModal({ content: a.data.message }),
t.setData({
weizhang_num: 1 * t.data.weizhang_num + 10,
}),
t.getDetailpay();
},
})
: e.data &&
e.data.data &&
e.data.code!=200 &&
wx.requestPayment({
timeStamp: e.data.data.timeStamp,
nonceStr: e.data.data.nonceStr,
package: e.data.data.package,
signType: "MD5",
paySign: e.data.data.paySign,
success: function (i) {
a.util.request({
url: "entry/wxapp/Api",
data: {
m: "monai_market",
uid: wx.getStorageSync("uid"),
r: "home.weizhang.paynum",
orderid: e.data.data.orderid,
},
success: function (a) {
t.setData({
weizhang_num: 1 * t.data.weizhang_num + 10,
}),
wx.showModal({ content: a.data.message }),
t.getDetailpay();
},
});
},
});
},
}))
: wx.showModal({
title: "温馨提醒",
content: "使用本功能请先登录后在使用~",
showCancel: !1,
success: function (a) {
a.confirm && wx.reLaunch({ url: "/pages/mine/index" });
},
});
} else
wx.showModal({
title: "温馨提示",
content: "请去个人中心授权登录用户信息",
success: function (a) {
a.confirm
? wx.reLaunch({ url: "/pages/mine/index" })
: console.log("点击取消回调");
},
});
},
getDetailpay: function () {
wx.navigateTo({ url: "carcxjl?orderid=" + this.data.orderid });
},
tongzhi: function (t) {
a.getdata({ type: "4" }, "getdyxx").then((t) => {
console.log(t.data),
wx.requestSubscribeMessage({
tmplIds: [t.data],
success(e) {
"accept" == e[t.data]
? (wx.showToast({ title: "订阅成功" }),
a.util.request({
url: "entry/wxapp/addtemplateid",
data: { templateid: t.data, uid: wx.getStorageSync("uid") },
header: { "content-type": "application/json" },
success: function (a) {
console.log(a);
},
}))
: wx.showToast({ title: "订阅失败" });
},
});
});
},
toDetailExample: function () {
var a = this.data.dh.id;
wx.navigateTo({
url: "carcxjl?id=" + a + "&orderid=" + this.data.dh.ysbg,
});
},
onLoad: function (a) {
wx.getStorageSync("uid") || getApp().wxlogin(),
this.orderid(),
wx.removeStorageSync("cardata"),
wx.removeStorageSync("carvehicle"),
wx.removeStorageSync("carprov"),
wx.removeStorageSync("carcity"),
wx.removeStorageSync("cartime"),
wx.removeStorageSync("cardatawx"),
this.setData({ id: a.id }),
this.getid();
},
getid: function () {
var t = { id: this.data.id };
a.getdata(t, "dhid").then((a) => {
if ((console.log("页面回调数据:", a.data), a.data)) {
this.setData({ dh: a.data, type: a.data.type });
var t = [];
for (let e = 0; e < a.data.dhbd.length; e++)
(t[e] = a.data.dhbd[e].name),
wx.setStorageSync(a.data.dhbd[e].name, "");
let e = t.reduce((a, t) => ((a[t] = ""), a), {});
this.setData({ postData: e }), console.log("post", e);
}
});
},
onReady: function () {},
onShow: function () {
this.getDetail(1),
a.appdengl(),
this.postDatanew("keyname", wx.getStorageSync("xszimgurl"));
var t = wx.getStorageSync("cardata");
if (
(console.log("行驶证数据", t),
console.log("行驶证照片", wx.getStorageSync("xszimgurl")),
t)
) {
var e = this.data.postData;
for (var i in (console.log(this.data.postData), e))
console.log(i),
"vin" == i && (e[i] = t.车辆识别代号.words),
"plate" == i && (e[i] = t.号牌号码.words),
"engine" == i && (e[i] = t.发动机号码.words),
"name" == i && (e[i] = t.所有人.words);
this.setData({ postData: e });
}
},
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 e = this,
i = {
uid: wx.getStorageSync("uid"),
type: e.data.type,
cxid: e.data.id,
page: t,
};
a.getdata(i, "wncxlist").then((a) => {
if ((console.log("回调数据:", a), a.data && 200 == a.code))
if (1 == t) e.setData({ repairList: a.data, page: e.data.page + 1 });
else {
var i = e.data.repairList;
i.push.apply(i, a.data),
e.setData({ repairList: i, page: e.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 (a) {
var t = a.currentTarget.dataset.orderid;
wx.navigateTo({ url: "carcxjl?orderid=" + t, success: function () {} });
},
});