搜索优化

master
gongfuxiang 2022-06-30 23:54:51 +08:00
parent cedc41c0a7
commit eb5e3f32dc
3 changed files with 89 additions and 38 deletions

View File

@ -172,7 +172,9 @@
is_show_popup_form: false,
popup_form_loading_status: false,
//
share_info: {},
share_info: {},
//
search_nav_sort_index: 0,
search_nav_sort_list: [
{ name: "综合", field: "default", sort: "asc", "icon": null },
{ 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) : '';
}
}
}
//
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;
},
@ -476,27 +485,25 @@
},
//
nav_sort_event(e) {
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_sort = temp_search_nav_sort[index]['sort'] == 'desc' ? 'asc' : 'desc';
for (var i in temp_search_nav_sort) {
if (i != index) {
if (temp_search_nav_sort[i]['icon'] != null) {
temp_search_nav_sort[i]['icon'] = 'default';
}
temp_search_nav_sort[i]['sort'] = 'desc';
}
}
temp_search_nav_sort[index]['sort'] = temp_sort;
if (temp_search_nav_sort[index]['icon'] != null) {
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({
post_data: temp_post_data,
nav_sort_event(e) {
var index = e.currentTarget.dataset.index || 0;
var temp_search_nav_sort = this.search_nav_sort_list;
var temp_sort = temp_search_nav_sort[index]['sort'] == 'desc' ? 'asc' : 'desc';
for (var i in temp_search_nav_sort) {
if (i != index) {
if (temp_search_nav_sort[i]['icon'] != null) {
temp_search_nav_sort[i]['icon'] = 'default';
}
temp_search_nav_sort[i]['sort'] = 'desc';
}
}
temp_search_nav_sort[index]['sort'] = temp_sort;
if (temp_search_nav_sort[index]['icon'] != null) {
temp_search_nav_sort[index]['icon'] = temp_sort;
}
this.setData({
search_nav_sort_index: index,
search_nav_sort_list: temp_search_nav_sort,
data_page: 1
});
@ -532,10 +539,10 @@
map_remove_event(e) {
var temp_list = this.search_map_list;
var temp_post = this.post_data;
//
temp_post['wd'] = '';
//
for (var i in temp_list) {
if((temp_list[i] || null) != null && temp_list[i].length > 0) {
@ -543,13 +550,22 @@
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
this.setData({
search_map_list: temp_list,
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
});
this.get_data_list(1);

View File

@ -1017,8 +1017,18 @@
//
var starting_price = parseFloat(this.info.starting_price) || 0;
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(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;
}
}
}

View File

@ -95,7 +95,9 @@
post_data: {},
shop: null,
is_show_popup_form: false,
popup_form_loading_status: false,
popup_form_loading_status: false,
//
search_nav_sort_index: 0,
search_nav_sort_list: [
{ name: "综合", field: "default", sort: "asc", "icon": null },
{ 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) : '';
}
}
}
//
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;
},
@ -384,7 +393,6 @@
//
nav_sort_event(e) {
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_sort = temp_search_nav_sort[index]['sort'] == 'desc' ? 'asc' : 'desc';
for (var i in temp_search_nav_sort) {
@ -399,10 +407,9 @@
if (temp_search_nav_sort[index]['icon'] != null) {
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({
post_data: temp_post_data,
this.setData({
search_nav_sort_index: index,
search_nav_sort_list: temp_search_nav_sort,
data_page: 1
});
@ -449,13 +456,22 @@
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
this.setData({
search_map_list: temp_list,
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
});
this.get_data_list(1);