From eb5e3f32dc2d0e8a5fd31b6f078d65783a580cbd Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Thu, 30 Jun 2022 23:54:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods-search/goods-search.vue | 70 ++++++++++++++--------- pages/plugins/realstore/detail/detail.vue | 25 +++++++- pages/plugins/shop/search/search.vue | 32 ++++++++--- 3 files changed, 89 insertions(+), 38 deletions(-) diff --git a/pages/goods-search/goods-search.vue b/pages/goods-search/goods-search.vue index a857d5a4..240f07f1 100644 --- a/pages/goods-search/goods-search.vue +++ b/pages/goods-search/goods-search.vue @@ -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); diff --git a/pages/plugins/realstore/detail/detail.vue b/pages/plugins/realstore/detail/detail.vue index 3963b9bc..1797bfe5 100644 --- a/pages/plugins/realstore/detail/detail.vue +++ b/pages/plugins/realstore/detail/detail.vue @@ -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; + } } } diff --git a/pages/plugins/shop/search/search.vue b/pages/plugins/shop/search/search.vue index c2634348..e6fa6904 100644 --- a/pages/plugins/shop/search/search.vue +++ b/pages/plugins/shop/search/search.vue @@ -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);