var t; (t = getApp()), Page({ data: { showLetter: "", winHeight: 0, tHeight: 0, bHeight: 0, startPageY: 0, carList: [], isShowLetter: !1, scrollTop: 0, three_none: "none", two_none: "none", hasback: "none", car_series: [], car_ser: null, searchLetter: [ "*", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "W", "X", "Y", "Z", ], car_vend_ser: [], }, onLoad: function () { var e = this; wx.showLoading({ title: "请求中" }), t.getdata("", "carall").then((t) => { var a = t.data; console.log("回调数据汽车:", a), (a = JSON.parse(a)), e.crCarList(a.retdata); }); for ( var a = e.data.searchLetter, r = wx.getSystemInfoSync().windowHeight, n = r / a.length, o = [], s = 0; s < a.length; s++ ) { var i = {}; (i.name = a[s]), (i.tHeight = s * n), (i.bHeight = (s + 1) * n), o.push(i); } e.setData({ winHeight: r, itemH: n, searchLetter: o }); }, searchStart: function (t) { var e = t.currentTarget.dataset.letter, a = t.touches[0].pageY; this.setScrollTop(this, e), this.nowLetter(a, this), this.setData({ showLetter: e, startPageY: a, isShowLetter: !0 }); }, searchMove: function (t) { var e = t.touches[0].pageY, a = this.data.startPageY, r = this.data.tHeight, n = this.data.bHeight; console.log(e), a - e > 0 ? e < r && this.nowLetter(e, this) : e > n && this.nowLetter(e, this); }, searchEnd: function (t) { var e = this; setTimeout(function () { e.setData({ isShowLetter: !1 }); }, 1e3); }, nowLetter: function (t, e) { for ( var a = this.data.searchLetter, r = 0, n = 0, o = "", s = 0; s < a.length; s++ ) if (a[s].tHeight <= t && t <= a[s].bHeight) { (r = a[s].bHeight), (n = a[s].tHeight), (o = a[s].name); break; } this.setScrollTop(e, o), e.setData({ bHeight: r, tHeight: n, showLetter: o, startPageY: t }); }, setScrollTop: function (t, e) { for ( var a = 0, r = t.data.carList, n = 0, o = 0, s = 0; s < r.length; s++ ) { if (e == r[s].shou_zm) { a = 30 * o + 41 * n; break; } console.log("数字", s), console.log(r[s]), o++, (n += r[s].carInfo.length); } t.setData({ scrollTop: a }); }, btn_pinpai: function (e) { var a = this, r = { brandId: e.currentTarget.dataset.brand }; t.getdata(r, "carbrandId").then((t) => { var e = t.data; console.log("回调数据汽车:", e), (e = JSON.parse(e)), a.setData({ three_none: "none", two_none: "block", hasback: "block", car_series: e.retdata, }); }); }, btn_name: function (e) { var a = this, r = { familyid: e.currentTarget.dataset.familyid }; t.getdata(r, "caridcx").then((t) => { var e = t.data; console.log("回调数据汽车xiang:", e), (e = JSON.parse(e)), a.setData({ three_none: "block", hasback: "block", car_vend_ser: e.retdata, }); }); }, btn_sel_name: function (t) { var e = t.currentTarget.dataset.item; console.log(e), wx.setStorageSync("carvehicle", e), wx.navigateBack({ delta: 1 }); }, crCarList: function (t) { for (var e = this.data.searchLetter, a = [], r = 1; r < e.length; r++) { var n = e[r].name, o = [], s = {}; s.shou_zm = n; for (var i = 0; i < t.length; i++) n == t[i].car_char && o.push(t[i]); (s.carInfo = o), a.push(s); } this.setData({ carList: a }), wx.hideLoading(); }, crFamilyList: function (t) { var e = {}; for (var a in (console.log(t), t)) { var r = t[a].factory; null == e[r] ? (e[r] = [t[a]]) : e[r].push(t[a]); } console.log(e), this.setData({ car_series: e }); }, goback: function () { "block" == this.data.three_none ? this.setData({ three_none: "none" }) : "block" == this.data.two_none ? this.setData({ two_none: "none", hasback: "none" }) : this.setData({ hasback: "none" }); }, });