index.js
4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
function t(t, a, e) {
return a in t ? Object.defineProperty(t, a, {
value: e,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[a] = e, t;
}
var a, e = require("../../../utils/util"),
o = require("../../restapi"),
d = getApp();
Page((a = {
data: {
searchText: "",
historyList: [],
queryCondition: {},
list: [],
spaProductCode: "",
code: "",
yearActive: "",
yearList: [],
modelList: [],
checkList: [],
maxNumber: 9999,
showPopup: !1,
popupTitle: "",
secondTitle: "",
popupId: "",
popupHeight: "0%",
showNodata: !1
},
onLoad: function (t) {
wx.setNavigationBarTitle({
title: "搜索"
}), this.setData({
code: t.code,
audiId: t.audiId,
motorcycle: t.motorcycle
});
},
onReady: function () {},
onShow: function () {
var t = wx.getStorageSync("history") || [];
this.setData({
historyList: t
});
},
clearHistory: function () {
this.setData({
historyList: []
}), wx.removeStorageSync("history");
},
onChange: function (t) {
this.setData({
spaProductCode: t.detail
});
},
getParams: function () {
var t = d.globalData.userInfo,
a = {};
return a.merchantCode = t.merchant.merchantId, a;
},
onSearch: function () {
var t = this,
a = wx.getStorageSync("history") || [],
e = t.data.spaProductCode,
o = t.data.queryCondition || {};
if (!e) return !1;
a.findIndex(function (t) {
return t == e;
}) < 0 && a.push(e), t.data.audiId && "undefined" != t.data.audiId && (o.audiId = t.data.audiId),
t.data.motorcycle && "undefined" != t.data.motorcycle && (o.motorcycle = t.data.motorcycle),
console.log(o), wx.setStorageSync("history", a), t.setData({
spaProductCode: e,
queryCondition: o
}), this.getType();
}
}, t(a, "getParams", function () {
var t = d.globalData.userInfo,
a = {};
return a.merchantCode = t.merchant.merchantId, a.spaProductCode = this.data.spaProductCode,
a;
}), t(a, "inputEvent", function (t) {
var a = {};
a[t.currentTarget.id] = t.detail.value, this.setData(a);
}), t(a, "clickEvent", function (t) {
var a = t.currentTarget.dataset.name,
e = this.data.queryCondition || {};
this.data.audiId && "undefined" != this.data.audiId && (e.audiId = this.data.audiId),
this.data.motorcycle && "undefined" != this.data.motorcycle && (e.motorcycle = this.data.motorcycle),
this.setData({
spaProductCode: a,
queryCondition: e
}), this.getType();
}), t(a, "openShoppingCar", function (t) {
var a = t.currentTarget.id,
e = t.currentTarget.dataset.code,
o = t.currentTarget.dataset.config,
d = t.currentTarget.dataset.id,
i = t.currentTarget.dataset.name;
this.setData({
showPopup: !0,
popupTitle: i,
secondTitle: d,
popupId: a,
glsxProductCode: e,
productConfigCode: o
});
}), t(a, "closeDialog", function () {
this.setData({
showPopup: !1
});
}), t(a, "configChange", function (t) {
var a = t.detail,
e = 0 != a.close;
a && this.setData({
showPopup: e
});
}), t(a, "batchAddEvent", function () {
var t = this.data.popupId;
"car" != t && this.selectComponent("#" + t).addEvent();
}), t(a, "getType", function () {
var t = this,
a = {},
d = t.getParams();
t.data.audiId && "undefined" != t.data.audiId && (d.audiId = t.data.audiId), t.data.motorcycle && "undefined" != t.data.motorcycle && (d.motorcycle = t.data.motorcycle),
a.pageSize = 1e6, a.pageNo = 1, a.queryCondition = d, (0, o.PAGEPRODUCTBYSPACODE)(a, function (a) {
if (console.log(a), 0 != a.returnCode) return (0, e.showToast)(a.message), !1;
var o = ((a.data || {}).listGhProductConfig || [])[0] || {},
d = "";
if (!o.categoryId) return (0, e.showToast)("暂无产品信息"), !1;
"N" == o.displayConfig && (d = "setting"), "C" == o.displayConfig && (d = "setting"),
"Y" == o.displayConfig && (d = "model"), console.log("555555555555"), t.setData({
popupId: d,
showPopup: !0,
productConfigCode: o.productConfigCode,
displayConfig: o.displayConfig,
popupTitle: o.spaProductName,
secondTitle: o.spaProductCode,
showNodata: !o.categoryId
});
});
}), a));