搜索优化
parent
cedc41c0a7
commit
eb5e3f32dc
|
|
@ -172,7 +172,9 @@
|
||||||
is_show_popup_form: false,
|
is_show_popup_form: false,
|
||||||
popup_form_loading_status: false,
|
popup_form_loading_status: false,
|
||||||
// 自定义分享信息
|
// 自定义分享信息
|
||||||
share_info: {},
|
share_info: {},
|
||||||
|
// 排序导航
|
||||||
|
search_nav_sort_index: 0,
|
||||||
search_nav_sort_list: [
|
search_nav_sort_list: [
|
||||||
{ name: "综合", field: "default", sort: "asc", "icon": null },
|
{ name: "综合", field: "default", sort: "asc", "icon": null },
|
||||||
{ name: "销量", field: "sales_count", sort: "asc", "icon": "default" },
|
{ name: "销量", field: "sales_count", sort: "asc", "icon": "default" },
|
||||||
|
|
@ -442,7 +444,14 @@
|
||||||
}
|
}
|
||||||
post_data[temp_field[i]['form_key']] = app.globalData.get_length(temp) > 0 ? JSON.stringify(temp) : '';
|
post_data[temp_field[i]['form_key']] = app.globalData.get_length(temp) > 0 ? JSON.stringify(temp) : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
var temp_index = this.search_nav_sort_index;
|
||||||
|
var temp_search_nav_sort = this.search_nav_sort_list;
|
||||||
|
post_data['order_by_type'] = temp_search_nav_sort[temp_index]['sort'] == 'desc' ? 'asc' : 'desc';
|
||||||
|
post_data['order_by_field'] = temp_search_nav_sort[temp_index]['field'];
|
||||||
|
|
||||||
return post_data;
|
return post_data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -476,27 +485,25 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
// 排序事件
|
// 排序事件
|
||||||
nav_sort_event(e) {
|
nav_sort_event(e) {
|
||||||
var index = e.currentTarget.dataset.index || 0;
|
var index = e.currentTarget.dataset.index || 0;
|
||||||
var temp_post_data = this.post_data;
|
var temp_search_nav_sort = this.search_nav_sort_list;
|
||||||
var temp_search_nav_sort = this.search_nav_sort_list;
|
var temp_sort = temp_search_nav_sort[index]['sort'] == 'desc' ? 'asc' : 'desc';
|
||||||
var temp_sort = temp_search_nav_sort[index]['sort'] == 'desc' ? 'asc' : 'desc';
|
for (var i in temp_search_nav_sort) {
|
||||||
for (var i in temp_search_nav_sort) {
|
if (i != index) {
|
||||||
if (i != index) {
|
if (temp_search_nav_sort[i]['icon'] != null) {
|
||||||
if (temp_search_nav_sort[i]['icon'] != null) {
|
temp_search_nav_sort[i]['icon'] = 'default';
|
||||||
temp_search_nav_sort[i]['icon'] = 'default';
|
}
|
||||||
}
|
temp_search_nav_sort[i]['sort'] = 'desc';
|
||||||
temp_search_nav_sort[i]['sort'] = 'desc';
|
}
|
||||||
}
|
}
|
||||||
}
|
temp_search_nav_sort[index]['sort'] = temp_sort;
|
||||||
temp_search_nav_sort[index]['sort'] = temp_sort;
|
if (temp_search_nav_sort[index]['icon'] != null) {
|
||||||
if (temp_search_nav_sort[index]['icon'] != null) {
|
temp_search_nav_sort[index]['icon'] = temp_sort;
|
||||||
temp_search_nav_sort[index]['icon'] = temp_sort;
|
}
|
||||||
}
|
|
||||||
temp_post_data['order_by_field'] = temp_search_nav_sort[index]['field'];
|
this.setData({
|
||||||
temp_post_data['order_by_type'] = temp_sort;
|
search_nav_sort_index: index,
|
||||||
this.setData({
|
|
||||||
post_data: temp_post_data,
|
|
||||||
search_nav_sort_list: temp_search_nav_sort,
|
search_nav_sort_list: temp_search_nav_sort,
|
||||||
data_page: 1
|
data_page: 1
|
||||||
});
|
});
|
||||||
|
|
@ -532,10 +539,10 @@
|
||||||
map_remove_event(e) {
|
map_remove_event(e) {
|
||||||
var temp_list = this.search_map_list;
|
var temp_list = this.search_map_list;
|
||||||
var temp_post = this.post_data;
|
var temp_post = this.post_data;
|
||||||
|
|
||||||
// 关键字
|
// 关键字
|
||||||
temp_post['wd'] = '';
|
temp_post['wd'] = '';
|
||||||
|
|
||||||
// 品牌、分类、价格、属性、规格
|
// 品牌、分类、价格、属性、规格
|
||||||
for (var i in temp_list) {
|
for (var i in temp_list) {
|
||||||
if((temp_list[i] || null) != null && temp_list[i].length > 0) {
|
if((temp_list[i] || null) != null && temp_list[i].length > 0) {
|
||||||
|
|
@ -543,13 +550,22 @@
|
||||||
temp_list[i][k]['active'] = 0;
|
temp_list[i][k]['active'] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序导航
|
||||||
|
var temp_search_nav_sort = this.search_nav_sort_list;
|
||||||
|
for (var i in temp_search_nav_sort) {
|
||||||
|
temp_search_nav_sort[i]['sort'] = 'asc';
|
||||||
|
temp_search_nav_sort[i]['icon'] = (temp_search_nav_sort[i]['field'] == 'default') ? null : 'default';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关闭弹窗、分页恢复1页、重新获取数据
|
// 关闭弹窗、分页恢复1页、重新获取数据
|
||||||
this.setData({
|
this.setData({
|
||||||
search_map_list: temp_list,
|
search_map_list: temp_list,
|
||||||
post_data: temp_post,
|
post_data: temp_post,
|
||||||
is_show_popup_form: false,
|
is_show_popup_form: false,
|
||||||
|
search_nav_sort_list: temp_search_nav_sort,
|
||||||
|
search_nav_sort_index: 0,
|
||||||
data_page: 1
|
data_page: 1
|
||||||
});
|
});
|
||||||
this.get_data_list(1);
|
this.get_data_list(1);
|
||||||
|
|
|
||||||
|
|
@ -1017,8 +1017,18 @@
|
||||||
// 起步价
|
// 起步价
|
||||||
var starting_price = parseFloat(this.info.starting_price) || 0;
|
var starting_price = parseFloat(this.info.starting_price) || 0;
|
||||||
if(starting_price > 0 && this.cart.total_price < starting_price) {
|
if(starting_price > 0 && this.cart.total_price < starting_price) {
|
||||||
app.globalData.showToast("起步价"+starting_price+"元");
|
// 是否限制类型
|
||||||
return false;
|
var limit_type = this.info.starting_price_limit_type_list || [];
|
||||||
|
if(limit_type.length > 0) {
|
||||||
|
var buy_use_type = this.info.buy_use_type_list[this.buy_use_type_index];
|
||||||
|
if(limit_type.indexOf(buy_use_type['index']) != -1 || limit_type.indexOf(buy_use_type['index'].toString()) != -1) {
|
||||||
|
app.globalData.showToast(buy_use_type['name']+'起步价'+starting_price+'元');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
app.globalData.showToast('起步价'+starting_price+'元');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 进入订单确认页面
|
// 进入订单确认页面
|
||||||
|
|
@ -1149,7 +1159,16 @@
|
||||||
if(index === null || index === '') {
|
if(index === null || index === '') {
|
||||||
// 是否默认类型
|
// 是否默认类型
|
||||||
if(this.info.default_buy_use_type != undefined && this.info.default_buy_use_type != -1) {
|
if(this.info.default_buy_use_type != undefined && this.info.default_buy_use_type != -1) {
|
||||||
index = this.info.default_buy_use_type;
|
// 不在店铺设置的类型列表则默认0
|
||||||
|
var temp_index = null;
|
||||||
|
for(var i in this.info.buy_use_type_list) {
|
||||||
|
if(this.info.buy_use_type_list[i]['index'] == this.info.default_buy_use_type) {
|
||||||
|
temp_index = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(temp_index !== null) {
|
||||||
|
index = temp_index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,9 @@
|
||||||
post_data: {},
|
post_data: {},
|
||||||
shop: null,
|
shop: null,
|
||||||
is_show_popup_form: false,
|
is_show_popup_form: false,
|
||||||
popup_form_loading_status: false,
|
popup_form_loading_status: false,
|
||||||
|
// 排序导航
|
||||||
|
search_nav_sort_index: 0,
|
||||||
search_nav_sort_list: [
|
search_nav_sort_list: [
|
||||||
{ name: "综合", field: "default", sort: "asc", "icon": null },
|
{ name: "综合", field: "default", sort: "asc", "icon": null },
|
||||||
{ name: "销量", field: "sales_count", sort: "asc", "icon": "default" },
|
{ name: "销量", field: "sales_count", sort: "asc", "icon": "default" },
|
||||||
|
|
@ -348,7 +350,14 @@
|
||||||
}
|
}
|
||||||
post_data[temp_field[i]['form_key']] = app.globalData.get_length(temp) > 0 ? JSON.stringify(temp) : '';
|
post_data[temp_field[i]['form_key']] = app.globalData.get_length(temp) > 0 ? JSON.stringify(temp) : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
var temp_index = this.search_nav_sort_index;
|
||||||
|
var temp_search_nav_sort = this.search_nav_sort_list;
|
||||||
|
post_data['order_by_type'] = temp_search_nav_sort[temp_index]['sort'] == 'desc' ? 'asc' : 'desc';
|
||||||
|
post_data['order_by_field'] = temp_search_nav_sort[temp_index]['field'];
|
||||||
|
|
||||||
return post_data;
|
return post_data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -384,7 +393,6 @@
|
||||||
// 排序事件
|
// 排序事件
|
||||||
nav_sort_event(e) {
|
nav_sort_event(e) {
|
||||||
var index = e.currentTarget.dataset.index || 0;
|
var index = e.currentTarget.dataset.index || 0;
|
||||||
var temp_post_data = this.post_data;
|
|
||||||
var temp_search_nav_sort = this.search_nav_sort_list;
|
var temp_search_nav_sort = this.search_nav_sort_list;
|
||||||
var temp_sort = temp_search_nav_sort[index]['sort'] == 'desc' ? 'asc' : 'desc';
|
var temp_sort = temp_search_nav_sort[index]['sort'] == 'desc' ? 'asc' : 'desc';
|
||||||
for (var i in temp_search_nav_sort) {
|
for (var i in temp_search_nav_sort) {
|
||||||
|
|
@ -399,10 +407,9 @@
|
||||||
if (temp_search_nav_sort[index]['icon'] != null) {
|
if (temp_search_nav_sort[index]['icon'] != null) {
|
||||||
temp_search_nav_sort[index]['icon'] = temp_sort;
|
temp_search_nav_sort[index]['icon'] = temp_sort;
|
||||||
}
|
}
|
||||||
temp_post_data['order_by_field'] = temp_search_nav_sort[index]['field'];
|
|
||||||
temp_post_data['order_by_type'] = temp_sort;
|
this.setData({
|
||||||
this.setData({
|
search_nav_sort_index: index,
|
||||||
post_data: temp_post_data,
|
|
||||||
search_nav_sort_list: temp_search_nav_sort,
|
search_nav_sort_list: temp_search_nav_sort,
|
||||||
data_page: 1
|
data_page: 1
|
||||||
});
|
});
|
||||||
|
|
@ -449,13 +456,22 @@
|
||||||
temp_list[i][k]['active'] = 0;
|
temp_list[i][k]['active'] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序导航
|
||||||
|
var temp_search_nav_sort = this.search_nav_sort_list;
|
||||||
|
for (var i in temp_search_nav_sort) {
|
||||||
|
temp_search_nav_sort[i]['sort'] = 'asc';
|
||||||
|
temp_search_nav_sort[i]['icon'] = (temp_search_nav_sort[i]['field'] == 'default') ? null : 'default';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关闭弹窗、分页恢复1页、重新获取数据
|
// 关闭弹窗、分页恢复1页、重新获取数据
|
||||||
this.setData({
|
this.setData({
|
||||||
search_map_list: temp_list,
|
search_map_list: temp_list,
|
||||||
post_data: temp_post,
|
post_data: temp_post,
|
||||||
is_show_popup_form: false,
|
is_show_popup_form: false,
|
||||||
|
search_nav_sort_list: temp_search_nav_sort,
|
||||||
|
search_nav_sort_index: 0,
|
||||||
data_page: 1
|
data_page: 1
|
||||||
});
|
});
|
||||||
this.get_data_list(1);
|
this.get_data_list(1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue