This commit is contained in:
devil_gong 2018-11-23 18:30:49 +08:00
parent 3aaa31cc43
commit 2664cfe2b6
5 changed files with 46 additions and 40 deletions

View File

@ -1,5 +1,5 @@
{
"pages": ["pages/goods-search/goods-search",
"pages": [
"pages/index/index",
"pages/goods-category/goods-category",
"pages/cart/cart",
@ -8,7 +8,7 @@
"pages/login/login",
"pages/paytips/paytips",
"pages/goods-search/goods-search",
"pages/goods-detail/goods-detail",
"pages/goods-attribute/goods-attribute",
"pages/buy/buy",

View File

@ -1,6 +1,9 @@
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}
@ -72,19 +75,18 @@
* 排序导航
*/
.nav-sort-content .item {
height: 60rpx;
line-height: 60rpx;
height: 80rpx;
line-height: 80rpx;
width: 160rpx;
}
.nav-sort-content .item .icon {
width: 30rpx;
height: 30rpx;
vertical-align: middle;
}
.screening-submit {
width: 45rpx;
height: 45rpx;
width: 50rpx;
height: 50rpx;
position: absolute;
top: 10rpx;
top: 15rpx;
right: 20rpx;
}

View File

@ -11,23 +11,6 @@
<image class="screening-submit" src="/images/search-submit-icon.png" mode="aspectFill" onTap="popup_form_event_show" />
</view>
<!-- 筛选条件 popup -->
<popup show="{{is_show_popup_form}}" position="right" onClose="popup_form_event_close">
<form onSubmit="form_submit_event" class="popup-form oh bg-white">
<view class="item oh screening-price">
<view class="title cr-666">价格区间(元)</view>
<input type="digit" placeholder="最低价" name="min_price" class="br fl" />
<view class="cr-888 fl tc separator">~</view>
<input type="digit" placeholder="最高价" name="max_price" class="br fl" />
</view>
<view class="item keywords">
<view class="title cr-666">关键字</view>
<input type="text" placeholder="关键字" name="keywords" value="{{(params.keywords || '')}}" class="br" />
</view>
<button formType="submit" class="bg-main form-submit wh-auto" disabled="{{popup_form_loading_status}}" hover-class="none">确认</button>
</form>
</popup>
<!-- 列表 -->
<scroll-view scroll-y="{{true}}" class="scroll-box" onScrollToLower="scroll_lower" lower-threshold="30">
<view class="data-list">
@ -53,4 +36,25 @@
<import src="/pages/common/bottom_line.axml" />
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
</scroll-view>
</scroll-view>
<!-- 筛选条件 popup -->
<popup show="{{is_show_popup_form}}" position="right" onClose="popup_form_event_close">
<form onSubmit="form_submit_event" class="popup-form oh bg-white">
<view class="item oh screening-price">
<view class="title cr-666">价格区间(元)
</view>
<input type="digit" placeholder="最低价" name="min_price" class="br fl" />
<view class="cr-888 fl tc separator">~
</view>
<input type="digit" placeholder="最高价" name="max_price" class="br fl" />
</view>
<view class="item keywords">
<view class="title cr-666">关键字
</view>
<input type="text" placeholder="关键字" name="keywords" value="{{(params.keywords || '')}}" class="br" />
</view>
<button formType="submit" class="bg-main form-submit wh-auto" disabled="{{popup_form_loading_status}}" hover-class="none">确认
</button>
</form>
</popup>

View File

@ -62,7 +62,7 @@ Page({
my.httpRequest({
url: app.get_request_url("Index", "Search"),
method: "POST",
data: params,
data: this.data.post_data,
dataType: "json",
success: res => {
my.hideLoading();

View File

@ -89,19 +89,19 @@ class SearchService
$price = M('ScreeningPrice')->field('min_price,max_price')->where(['is_enable'=>1, 'id'=>intval($params['screening_price_id'])])->find();
$params['min_price'] = $price['min_price'];
$params['max_price'] = $price['max_price'];
if(!empty($params['min_price']) && !empty($params['max_price']))
{
$where['g.price'] = [
['EGT', $params['min_price']],
['LT', $params['max_price']],
];
} else if(!empty($params['min_price']))
{
$where['g.price'] = ['EGT', $params['min_price']];
} else if(!empty($params['max_price']))
{
$where['g.price'] = ['LT', $params['max_price']];
}
}
if(!empty($params['min_price']) && !empty($params['max_price']))
{
$where['g.price'] = [
['EGT', $params['min_price']],
['LT', $params['max_price']],
];
} else if(!empty($params['min_price']))
{
$where['g.price'] = ['EGT', $params['min_price']];
} else if(!empty($params['max_price']))
{
$where['g.price'] = ['LT', $params['max_price']];
}
// 获取商品总数