mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-06-06 03:56:57 +08:00
小程序品牌开发、首页商品自动模式不需要推荐
This commit is contained in:
@ -166,22 +166,6 @@ class Goods
|
||||
'is_multiple' => 1,
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '首页推荐',
|
||||
'view_type' => 'status',
|
||||
'view_key' => 'is_home_recommended',
|
||||
'post_url' => MyUrl('admin/goods/statusupdate'),
|
||||
'align' => 'center',
|
||||
'is_sort' => 1,
|
||||
'search_config' => [
|
||||
'form_type' => 'select',
|
||||
'where_type' => 'in',
|
||||
'data' => lang('common_is_text_list'),
|
||||
'data_key' => 'id',
|
||||
'data_name' => 'name',
|
||||
'is_multiple' => 1,
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => '扣减库存',
|
||||
'view_type' => 'status',
|
||||
|
||||
@ -174,10 +174,6 @@
|
||||
<label class="block">上下架<span class="am-form-group-label-tips">下架后用户不可见</span></label>
|
||||
<input name="is_shelves" value="1" type="checkbox" data-off-text="下架" data-on-text="上架" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if (isset($data['is_shelves']) and $data['is_shelves'] eq 1) or empty($data)}}checked="true"{{/if}} />
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="block">首页推荐<span class="am-form-group-label-tips">推荐后在首页展示</span></label>
|
||||
<input name="is_home_recommended" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if isset($data['is_home_recommended']) and $data['is_home_recommended'] eq 1}}checked="true"{{/if}} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 规格 -->
|
||||
|
||||
@ -126,9 +126,8 @@ class Goods extends Common
|
||||
// 详情tab商品 猜你喜欢
|
||||
$params = [
|
||||
'where' => [
|
||||
'is_delete_time'=>0,
|
||||
'is_shelves'=>1,
|
||||
'is_home_recommended'=>1,
|
||||
'is_delete_time' => 0,
|
||||
'is_shelves' => 1,
|
||||
],
|
||||
'order_by' => 'sales_count desc',
|
||||
'field' => 'id,title,title_color,price,images',
|
||||
|
||||
@ -58,7 +58,7 @@ class Index extends Common
|
||||
// 楼层数据
|
||||
$this->assign('goods_floor_list', GoodsService::HomeFloorList());
|
||||
|
||||
// 新闻
|
||||
// 文章
|
||||
$params = [
|
||||
'where' => ['is_enable'=>1, 'is_home_recommended'=>1],
|
||||
'field' => 'id,title,title_color,article_category_id',
|
||||
|
||||
@ -264,9 +264,8 @@ class GoodsService
|
||||
|
||||
// 获取商品ids
|
||||
$where = [
|
||||
'gci.category_id' => $category_ids,
|
||||
'g.is_home_recommended' => 1,
|
||||
'g.is_shelves' => 1,
|
||||
'gci.category_id' => $category_ids,
|
||||
'g.is_shelves' => 1,
|
||||
];
|
||||
$v['goods_ids'] = Db::name('Goods')->alias('g')->join(['__GOODS_CATEGORY_JOIN__'=>'gci'], 'g.id=gci.goods_id')->where($where)->group('g.id')->order($order_by)->limit($goods_count)->column('g.id');
|
||||
}
|
||||
@ -1090,7 +1089,6 @@ class GoodsService
|
||||
'is_shelves' => isset($params['is_shelves']) ? intval($params['is_shelves']) : 0,
|
||||
'content_web' => $content_web,
|
||||
'photo_count' => count($photo['data']),
|
||||
'is_home_recommended' => isset($params['is_home_recommended']) ? intval($params['is_home_recommended']) : 0,
|
||||
'images' => $images,
|
||||
'brand_id' => isset($params['brand_id']) ? intval($params['brand_id']) : 0,
|
||||
'video' => $attachment['data']['video'],
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -138,6 +138,7 @@ textarea {
|
||||
min-height: 104rpx;
|
||||
line-height: 52rpx;
|
||||
font-size: 32rpx;
|
||||
white-space: initial;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -76,7 +76,8 @@
|
||||
"pages/plugins/signin/user-qrcode-detail/user-qrcode-detail",
|
||||
"pages/plugins/signin/user-qrcode-saveinfo/user-qrcode-saveinfo",
|
||||
"pages/plugins/signin/user-coming-list/user-coming-list",
|
||||
"pages/plugins/points/index/index"
|
||||
"pages/plugins/points/index/index",
|
||||
"pages/plugins/brand/index/index"
|
||||
],
|
||||
"window": {
|
||||
"defaultTitle": "{{application_title}}",
|
||||
|
||||
@ -13,6 +13,9 @@
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
.nav-sort-content .item text, .nav-sort-content .item image {
|
||||
vertical-align:middle;
|
||||
}
|
||||
.screening-submit {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
@ -55,46 +58,106 @@
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 条件
|
||||
*/
|
||||
.popup-form {
|
||||
height: calc(100vh - 20rpx);
|
||||
padding: 20rpx 20rpx 0 20rpx;
|
||||
.search-map {
|
||||
height: calc(100vh - 80rpx);
|
||||
width: 680rpx;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.popup-form input {
|
||||
.map-keywords {
|
||||
border-radius: 0 !important;
|
||||
padding: 0 10rpx;
|
||||
line-height: 66rpx;
|
||||
height: 66rpx;
|
||||
font-size: 26rpx;
|
||||
height: 60rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.map-nav {
|
||||
position: relative;
|
||||
}
|
||||
.map-nav .arrow-bottom {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 10rpx;
|
||||
padding-right: 46rpx;
|
||||
color: #999;
|
||||
}
|
||||
.map-item {
|
||||
background: #f0f0f0;
|
||||
line-height: 76rpx;
|
||||
}
|
||||
.map-base,
|
||||
.map-nav {
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.map-content {
|
||||
padding: 15rpx;
|
||||
line-height: 60rpx;
|
||||
background: #fbfbfb;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.screening-price input {
|
||||
width: calc(50% - 20px);
|
||||
.map-text-items view,
|
||||
.map-images-text-items view {
|
||||
padding: 0 15rpx;
|
||||
border-radius: 2px;
|
||||
margin: 15rpx;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.screening-price .separator {
|
||||
line-height: 50rpx;
|
||||
.map-images-text-items view {
|
||||
vertical-align: middle;
|
||||
border: 1px solid #eee;
|
||||
width: 150rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
.popup-form .item {
|
||||
width: 480rpx;
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
.map-images-text-items view image {
|
||||
width: 150rpx;
|
||||
height: calc(100% - 8rpx);
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
.popup-form .keywords input {
|
||||
width: calc(100% - 30rpx);
|
||||
.map-text-items view.active,
|
||||
.map-images-text-items view.active {
|
||||
border: 1px solid #e23f36;
|
||||
color: #e23f36;
|
||||
font-weight: bold;
|
||||
}
|
||||
.popup-form .item:not(:last-child) {
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
.popup-form .item .title {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.popup-form .form-submit {
|
||||
.search-map .search-submit {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.map-remove-submit {
|
||||
color: #e23f36;
|
||||
}
|
||||
|
||||
/**
|
||||
* 品牌基础信息
|
||||
*/
|
||||
.brand-info {
|
||||
padding: 35rpx 15rpx;
|
||||
}
|
||||
.brand-info image,
|
||||
.brand-info .info-logo-empty {
|
||||
width: 300rpx;
|
||||
height: 130rpx;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.brand-info .info-logo-empty {
|
||||
line-height: 130rpx;
|
||||
}
|
||||
.brand-info .info-right {
|
||||
width: calc(100% - 330rpx);
|
||||
}
|
||||
.brand-info .info-desc {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
@ -38,21 +38,97 @@
|
||||
</scroll-view>
|
||||
|
||||
<!-- 筛选条件 popup -->
|
||||
<component-popup prop-show="{{is_show_popup_form}}" prop-position="right" onClose="popup_form_event_close">
|
||||
<component-popup prop-show="{{is_show_popup_form}}" prop-position="left" 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>
|
||||
<view class="tc oh">
|
||||
<input type="digit" placeholder="最低价" name="min_price" class="br fl" />
|
||||
<text class="cr-888 separator">~</text>
|
||||
<input type="digit" placeholder="最高价" name="max_price" class="br fr" />
|
||||
<view class="search-map">
|
||||
<view class="map-item map-base">
|
||||
<text>筛选出</text>
|
||||
<text class="cr-main"> {{data_total}} </text>
|
||||
<text>条数据</text>
|
||||
<text class="map-remove-submit fr" onTap="map_remove_event">清除</text>
|
||||
</view>
|
||||
|
||||
<!-- 搜索关键字 -->
|
||||
<input type="text" placeholder="其实搜索很简单^_^ !" name="wd" value="{{(post_data.wd || '')}}" class="map-keywords wh-auto" placeholder-class="cr-ccc" />
|
||||
|
||||
<!-- 品牌 -->
|
||||
<view a:if="{{((brand_list || null) != null && brand_list.length > 0) || ((search_map_info.brand || null) != null)}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>品牌</text>
|
||||
<text class="arrow-bottom" a:if="{{brand_list.length > 3}}" onTap="more_event" data-value="brand_list">更多</text>
|
||||
</view>
|
||||
<view a:if="{{(search_map_info.brand || null) != null}}" class="map-content brand-info oh bg-white">
|
||||
<image a:if="{{(search_map_info.brand.logo || null) != null}}" src="{{search_map_info.brand.logo}}" mode="aspectFit" class="fl" />
|
||||
<view a:else class="info-logo-empty tc fl">{{search_map_info.brand.name}}</view>
|
||||
<view class="info-right fr">
|
||||
<view a:if="{{(search_map_info.brand.logo || null) != null}}" class="info-name">{{search_map_info.brand.name}}</view>
|
||||
<view a:if="{{(search_map_info.brand.describe || null) != null}}"class="info-desc multi-text">{{search_map_info.brand.describe}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view a:else class="map-content map-images-text-items map-brand-container oh bg-white" style="height:{{map_fields_list.brand_list.height}};">
|
||||
<block a:for="{{brand_list}}" a:key="key">
|
||||
<view class="fl tc single-text {{item.active == 1 ? 'active' : ''}}" onTap="map_item_event" data-index="{{index}}" data-field="brand_list">
|
||||
<image a:if="{{(item.logo || null) != null}}" src="{{item.logo}}" mode="aspectFit" />
|
||||
<text a:else>{{item.name}}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分类 -->
|
||||
<view a:if="{{(category_list || null) != null && category_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>分类</text>
|
||||
<text class="arrow-bottom" a:if="{{category_list.length > 3}}" onTap="more_event" data-value="category_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items map-category-container oh bg-white" style="height:{{map_fields_list.category_list.height}};">
|
||||
<block a:for="{{category_list}}" a:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" onTap="map_item_event" data-index="{{index}}" data-field="category_list">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 价格 -->
|
||||
<view a:if="{{(screening_price_list || null) != null && screening_price_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>价格</text>
|
||||
<text class="arrow-bottom" a:if="{{screening_price_list.length > 3}}" onTap="more_event" data-value="screening_price_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items screening-price-container oh bg-white" style="height:{{map_fields_list.screening_price_list.height}};">
|
||||
<block a:for="{{screening_price_list}}" a:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" onTap="map_item_event" data-index="{{index}}" data-field="screening_price_list">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 属性 -->
|
||||
<view a:if="{{(goods_params_list || null) != null && goods_params_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>属性</text>
|
||||
<text class="arrow-bottom" a:if="{{goods_params_list.length > 3}}" onTap="more_event" data-value="goods_params_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items goods-params-container oh bg-white" style="height:{{map_fields_list.goods_params_list.height}};">
|
||||
<block a:for="{{goods_params_list}}" a:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" onTap="map_item_event" data-index="{{index}}" data-field="goods_params_list">{{item.value}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 规格 -->
|
||||
<view a:if="{{(goods_spec_list || null) != null && goods_spec_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>规格</text>
|
||||
<text class="arrow-bottom" a:if="{{goods_spec_list.length > 3}}" onTap="more_event" data-value="goods_spec_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items goods-spec-container oh bg-white" style="height:{{map_fields_list.goods_spec_list.height}};">
|
||||
<block a:for="{{goods_spec_list}}" a:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" onTap="map_item_event" data-index="{{index}}" data-field="goods_spec_list">{{item.value}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button formType="submit" class="bg-main search-submit wh-auto" disabled="{{popup_form_loading_status}}" hover-class="none">确认</button>
|
||||
</view>
|
||||
<view class="item keywords">
|
||||
<view class="title cr-666">关键字</view>
|
||||
<input type="text" placeholder="关键字" name="wd" 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>
|
||||
</component-popup>
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ Page({
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
params: null,
|
||||
@ -20,6 +21,21 @@ Page({
|
||||
|
||||
// 基础配置
|
||||
currency_symbol: app.data.currency_symbol,
|
||||
|
||||
// 搜素条件
|
||||
search_map_info: [],
|
||||
brand_list: [],
|
||||
category_list: [],
|
||||
screening_price_list: [],
|
||||
goods_params_list: [],
|
||||
goods_spec_list: [],
|
||||
map_fields_list: {
|
||||
"brand_list": {"height":"100rpx", "default":"100rpx", "form_key":"brand_ids"},
|
||||
"category_list": {"height":"82rpx", "default":"82rpx", "form_key":"category_ids"},
|
||||
"screening_price_list": {"height":"82rpx", "default":"82rpx", "form_key":"screening_price_values"},
|
||||
"goods_params_list": {"height":"82rpx", "default":"82rpx", "form_key":"goods_params_values"},
|
||||
"goods_spec_list": {"height":"82rpx", "default":"82rpx", "form_key":"goods_spec_values"}
|
||||
},
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
@ -82,16 +98,9 @@ Page({
|
||||
|
||||
// 加载loding
|
||||
my.showLoading({ content: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 参数
|
||||
var params = this.data.params;
|
||||
var post_data = this.data.post_data;
|
||||
post_data['page'] = this.data.data_page;
|
||||
post_data['category_id'] = params['category_id'] || 0;
|
||||
post_data['brand_id'] = params['brand_id'] || 0;
|
||||
var post_data = this.request_map_handle();
|
||||
|
||||
// 获取数据
|
||||
my.request({
|
||||
@ -104,20 +113,36 @@ Page({
|
||||
my.hideLoading();
|
||||
my.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
var data = res.data.data;
|
||||
|
||||
// 仅首次请求赋值条件数据
|
||||
if(this.data.data_list_loding_status == 1)
|
||||
{
|
||||
this.setData({
|
||||
search_map_info: data.search_map_info || [],
|
||||
brand_list: data.brand_list || [],
|
||||
category_list: data.category_list || [],
|
||||
screening_price_list: data.screening_price_list || [],
|
||||
goods_params_list: data.goods_params_list || [],
|
||||
goods_spec_list: data.goods_spec_list || [],
|
||||
});
|
||||
}
|
||||
|
||||
// 列表数据处理
|
||||
if (data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
var temp_data_list = data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
var temp_data = data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_total: data.total,
|
||||
data_page_total: data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
@ -159,6 +184,55 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
// 搜索条件处理
|
||||
request_map_handle() {
|
||||
var params = this.data.params;
|
||||
var post_data = this.data.post_data;
|
||||
post_data['page'] = this.data.data_page;
|
||||
|
||||
// 指定分类、品牌
|
||||
post_data['category_id'] = params['category_id'] || 0;
|
||||
post_data['brand_id'] = params['brand_id'] || 0;
|
||||
|
||||
// 搜索条件
|
||||
var data = this.data;
|
||||
for(var i in data.map_fields_list)
|
||||
{
|
||||
if((data[i] != null) != null && data[i].length > 0)
|
||||
{
|
||||
var temp = {};
|
||||
var index = 0;
|
||||
for(var k in data[i])
|
||||
{
|
||||
if((data[i][k]['active'] || 0) == 1)
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
// 价格
|
||||
case 'screening_price_list' :
|
||||
temp[index] = data[i][k]['min_price']+'-'+data[i][k]['max_price'];
|
||||
break;
|
||||
|
||||
// 属性、规格
|
||||
case 'goods_params_list' :
|
||||
case 'goods_spec_list' :
|
||||
temp[index] = data[i][k]['value'];
|
||||
break;
|
||||
|
||||
// 默认取值id
|
||||
default :
|
||||
temp[index] = data[i][k]['id'];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
post_data[data.map_fields_list[i]['form_key']] = (app.get_length(temp) > 0) ? JSON.stringify(temp) : '';
|
||||
}
|
||||
}
|
||||
|
||||
return post_data;
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
@ -189,7 +263,7 @@ Page({
|
||||
this.setData({ is_show_popup_form: true });
|
||||
},
|
||||
|
||||
// 筛选
|
||||
// 排序事件
|
||||
nav_sort_event(e) {
|
||||
var index = e.target.dataset.index || 0;
|
||||
var temp_post_data = this.data.post_data;
|
||||
@ -220,15 +294,66 @@ Page({
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 条件-更多数据展示事件
|
||||
more_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
var temp_more = this.data.map_fields_list;
|
||||
if(value != null && (temp_more[value] || null) != null)
|
||||
{
|
||||
temp_more[value]['height'] = (temp_more[value]['height'] == 'auto') ? temp_more[value]['default'] : 'auto';
|
||||
this.setData({map_fields_list: temp_more});
|
||||
}
|
||||
},
|
||||
|
||||
// 条件-选择事件
|
||||
map_item_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var field = e.currentTarget.dataset.field;
|
||||
var data = this.data;
|
||||
if((data[field] || null) != null && (data[field][index] || null) != null)
|
||||
{
|
||||
data[field][index]['active'] = ((data[field][index]['active'] || 0) == 0) ? 1 : 0;
|
||||
this.setData(data);
|
||||
}
|
||||
},
|
||||
|
||||
// 条件-清空
|
||||
map_remove_event(e) {
|
||||
var data = this.data;
|
||||
// 关键字
|
||||
data['post_data']['wd'] = '';
|
||||
|
||||
// 品牌、分类、价格、属性、规格
|
||||
for(var i in data.map_fields_list)
|
||||
{
|
||||
if((data[i] != null) != null && data[i].length > 0)
|
||||
{
|
||||
for(var k in data[i])
|
||||
{
|
||||
data[i][k]['active'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭条件弹层
|
||||
data['is_show_popup_form'] = false;
|
||||
|
||||
// 分页恢复1页、重新获取数据
|
||||
data['data_page'] = 1;
|
||||
this.setData(data);
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
var category_id = this.data.params['category_id'] || 0;
|
||||
var brand_id = this.data.params['brand_id'] || 0;
|
||||
var keywords = this.data.params['keywords'] || '';
|
||||
return {
|
||||
title: app.data.application_title,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&keywords='+keywords
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&brand_id='+brand_id+'&keywords='+keywords
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@ -157,7 +157,7 @@
|
||||
}
|
||||
.limitedtimediscount .goods-list .item {
|
||||
width: 460rpx;
|
||||
height: 605rpx;
|
||||
height: 670rpx;
|
||||
border: 1px solid #f5f5f5;
|
||||
background: white;
|
||||
display: inline-block;
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 分类导航
|
||||
*/
|
||||
.nav-list {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.nav-list .item {
|
||||
padding: 20rpx 30rpx;
|
||||
border-bottom: 3px solid #f0f0f0;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.nav-list .active {
|
||||
border-bottom: 3px solid #d2364c;
|
||||
color: #d2364c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
.data-list .items {
|
||||
width: calc(50% - 5rpx);
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.data-list .items:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.data-list .items:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.data-list .items image {
|
||||
width: 100%;
|
||||
height: 160rpx !important;
|
||||
}
|
||||
.data-list .items .base {
|
||||
padding-top: 20rpx;
|
||||
margin: 20rpx;
|
||||
}
|
||||
.data-list .items .desc {
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<view a:if="{{(data_base || null) != null}}">
|
||||
<!-- 分类 -->
|
||||
<scroll-view a:if="{{(brand_category_list || null) != null && brand_category_list.length > 0}}" class="nav-list bg-white tc oh" scroll-x="true">
|
||||
<view class="item cr-888 {{nav_active_value == 0 ? 'active' : ''}}" onTap="nav_event" data-value="0">全部</view>
|
||||
<block a:for="{{brand_category_list}}" a:key="key">
|
||||
<view class="item cr-888 {{nav_active_value == item.id ? 'active' : ''}}" onTap="nav_event" data-value="{{item.id}}">{{item.name}}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 品牌列表 -->
|
||||
<view a:if="{{(brand_list || null) != null && brand_list.length > 0}}" class="data-list oh spacing-mt">
|
||||
<block a:for="{{brand_list}}" a:key="key">
|
||||
<view a:if="{{(item.is_not_show || 0) == 0}}" class="items bg-white">
|
||||
<navigator url="/pages/goods-search/goods-search?brand_id={{item.id}}" hover-class="none">
|
||||
<image src="{{item.logo}}" mode="aspectFit" />
|
||||
<view class="base br-t-dashed">
|
||||
<view class="single-text name tc">{{item.name}}</view>
|
||||
<view class="multi-text desc">{{item.describe}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<import src="/pages/common/bottom_line.axml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</view>
|
||||
<view a:if="{{data_list_loding_status != 3}}">
|
||||
<import src="/pages/common/nodata.axml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
||||
129
sourcecode/alipay/default/pages/plugins/brand/index/index.js
Normal file
129
sourcecode/alipay/default/pages/plugins/brand/index/index.js
Normal file
@ -0,0 +1,129 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
data_base: null,
|
||||
brand_list: [],
|
||||
brand_category_list: [],
|
||||
nav_active_value: 0,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params,
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.get_data();
|
||||
|
||||
// 显示分享菜单
|
||||
app.show_share_menu();
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
var self = this;
|
||||
my.request({
|
||||
url: app.get_request_url("index", "index", "brand"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
my.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
data_base: data.base || null,
|
||||
brand_list: data.brand_list || [],
|
||||
brand_category_list: data.brand_category_list || [],
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: ((data.brand_list || []).length > 0) ? 3 : 0,
|
||||
data_bottom_line_status: ((data.brand_list || []).length > 0),
|
||||
});
|
||||
|
||||
// 选中处理
|
||||
self.nav_active_handle();
|
||||
} else {
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
my.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
nav_event(e) {
|
||||
this.setData({
|
||||
nav_active_value: e.currentTarget.dataset.value || 0,
|
||||
});
|
||||
this.nav_active_handle();
|
||||
},
|
||||
|
||||
// 导航选中处理
|
||||
nav_active_handle() {
|
||||
var value = this.data.nav_active_value;
|
||||
var temp_brand_list = this.data.brand_list;
|
||||
var count = 0;
|
||||
for(var i in temp_brand_list)
|
||||
{
|
||||
if(value == 0)
|
||||
{
|
||||
temp_brand_list[i]['is_not_show'] = 0;
|
||||
count++;
|
||||
} else {
|
||||
var is_not_show = (temp_brand_list[i]['brand_category_ids'].indexOf(value) == -1) ? 1 : 0;
|
||||
temp_brand_list[i]['is_not_show'] = is_not_show;
|
||||
if(is_not_show == 0)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
brand_list: temp_brand_list,
|
||||
data_list_loding_status: (count > 0) ? 3 : 0,
|
||||
data_bottom_line_status: (count > 0),
|
||||
});
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data_base.seo_title || '品牌 - '+app.data.application_title,
|
||||
desc: this.data.data_base.seo_desc || app.data.application_describe,
|
||||
path: '/pages/plugins/brand/index/index?referrer=' + user_id
|
||||
};
|
||||
},
|
||||
|
||||
// 分享朋友圈
|
||||
onShareTimeline() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data_base.seo_title || '品牌 - '+app.data.application_title,
|
||||
query: 'referrer=' + user_id,
|
||||
imageUrl: this.data.data_base.right_images || ''
|
||||
};
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"pullRefresh": true,
|
||||
"defaultTitle": "品牌"
|
||||
}
|
||||
@ -145,6 +145,7 @@ textarea {
|
||||
min-height: 104rpx;
|
||||
line-height: 52rpx;
|
||||
font-size: 32rpx;
|
||||
white-space: initial;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -54,7 +54,8 @@
|
||||
"pages/plugins/signin/user-qrcode-detail/user-qrcode-detail",
|
||||
"pages/plugins/signin/user-qrcode-saveinfo/user-qrcode-saveinfo",
|
||||
"pages/plugins/signin/user-coming-list/user-coming-list",
|
||||
"pages/plugins/points/index/index"
|
||||
"pages/plugins/points/index/index",
|
||||
"pages/plugins/brand/index/index"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTitleText": "{{application_title}}",
|
||||
|
||||
@ -61,40 +61,102 @@
|
||||
/**
|
||||
* 条件
|
||||
*/
|
||||
.popup-form {
|
||||
height: 100vh;
|
||||
.search-map {
|
||||
height: calc(100vh - 80rpx);
|
||||
width: 680rpx;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.popup-form input {
|
||||
.map-keywords {
|
||||
border-radius: 0 !important;
|
||||
padding: 0 10rpx;
|
||||
line-height: 66rpx;
|
||||
height: 66rpx;
|
||||
font-size: 26rpx;
|
||||
height: 60rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.map-nav {
|
||||
position: relative;
|
||||
}
|
||||
.map-nav .arrow-bottom {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 10rpx;
|
||||
padding-right: 46rpx;
|
||||
color: #999;
|
||||
}
|
||||
.map-item {
|
||||
background: #f0f0f0;
|
||||
line-height: 76rpx;
|
||||
}
|
||||
.map-base,
|
||||
.map-nav {
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.map-content {
|
||||
padding: 15rpx;
|
||||
line-height: 60rpx;
|
||||
background: #fbfbfb;
|
||||
border-radius: 6rpx;
|
||||
padding: 0 6rpx;
|
||||
}
|
||||
.screening-price input {
|
||||
width: calc(50% - 20px);
|
||||
.map-text-items view,
|
||||
.map-images-text-items view {
|
||||
padding: 0 15rpx;
|
||||
border-radius: 2px;
|
||||
margin: 15rpx;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.screening-price .separator {
|
||||
line-height: 50rpx;
|
||||
.map-images-text-items view {
|
||||
vertical-align: middle;
|
||||
border: 1px solid #eee;
|
||||
width: 150rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
.popup-form .item {
|
||||
width: 480rpx;
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
.map-images-text-items view image {
|
||||
width: 150rpx;
|
||||
height: calc(100% - 8rpx);
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
.popup-form .item:not(:last-child) {
|
||||
margin-bottom: 30rpx;
|
||||
.map-text-items view.active,
|
||||
.map-images-text-items view.active {
|
||||
border: 1px solid #e23f36;
|
||||
color: #e23f36;
|
||||
font-weight: bold;
|
||||
}
|
||||
.popup-form .item .title {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.popup-form .form-submit {
|
||||
.search-map .search-submit {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.map-remove-submit {
|
||||
color: #e23f36;
|
||||
}
|
||||
|
||||
/**
|
||||
* 品牌基础信息
|
||||
*/
|
||||
.brand-info {
|
||||
padding: 35rpx 15rpx;
|
||||
}
|
||||
.brand-info image,
|
||||
.brand-info .info-logo-empty {
|
||||
width: 300rpx;
|
||||
height: 130rpx;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.brand-info .info-logo-empty {
|
||||
line-height: 130rpx;
|
||||
}
|
||||
.brand-info .info-right {
|
||||
width: calc(100% - 330rpx);
|
||||
}
|
||||
.brand-info .info-desc {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
@ -20,6 +20,21 @@ Page({
|
||||
|
||||
// 基础配置
|
||||
currency_symbol: app.data.currency_symbol,
|
||||
|
||||
// 搜素条件
|
||||
search_map_info: [],
|
||||
brand_list: [],
|
||||
category_list: [],
|
||||
screening_price_list: [],
|
||||
goods_params_list: [],
|
||||
goods_spec_list: [],
|
||||
map_fields_list: {
|
||||
"brand_list": {"height":"100rpx", "default":"100rpx", "form_key":"brand_ids"},
|
||||
"category_list": {"height":"82rpx", "default":"82rpx", "form_key":"category_ids"},
|
||||
"screening_price_list": {"height":"82rpx", "default":"82rpx", "form_key":"screening_price_values"},
|
||||
"goods_params_list": {"height":"82rpx", "default":"82rpx", "form_key":"goods_params_values"},
|
||||
"goods_spec_list": {"height":"82rpx", "default":"82rpx", "form_key":"goods_spec_values"}
|
||||
},
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
@ -82,16 +97,9 @@ Page({
|
||||
|
||||
// 加载loding
|
||||
swan.showLoading({ title: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 参数
|
||||
var params = this.data.params;
|
||||
var post_data = this.data.post_data;
|
||||
post_data['page'] = this.data.data_page;
|
||||
post_data['category_id'] = params['category_id'] || 0;
|
||||
post_data['brand_id'] = params['brand_id'] || 0;
|
||||
var post_data = this.request_map_handle();
|
||||
|
||||
// 获取数据
|
||||
swan.request({
|
||||
@ -104,52 +112,63 @@ Page({
|
||||
swan.hideLoading();
|
||||
swan.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
var data = res.data.data;
|
||||
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
} else {
|
||||
this.setData({ data_bottom_line_status: false });
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
if (this.data.data_page <= 1) {
|
||||
this.setData({
|
||||
data_list: [],
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 页面信息设置
|
||||
if(post_data['page'] == 1) {
|
||||
this.set_page_info();
|
||||
}
|
||||
} else {
|
||||
// 仅首次请求赋值条件数据
|
||||
if(this.data.data_list_loding_status == 1)
|
||||
{
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
search_map_info: data.search_map_info || [],
|
||||
brand_list: data.brand_list || [],
|
||||
category_list: data.category_list || [],
|
||||
screening_price_list: data.screening_price_list || [],
|
||||
goods_params_list: data.goods_params_list || [],
|
||||
goods_spec_list: data.goods_spec_list || [],
|
||||
});
|
||||
}
|
||||
|
||||
// 列表数据处理
|
||||
if (data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: data.total,
|
||||
data_page_total: data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
|
||||
app.showToast(res.data.msg);
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total)
|
||||
{
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
} else {
|
||||
this.setData({data_bottom_line_status: false});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
});
|
||||
if (this.data.data_page <= 1) {
|
||||
this.setData({
|
||||
data_list: [],
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
@ -164,6 +183,55 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
// 搜索条件处理
|
||||
request_map_handle() {
|
||||
var params = this.data.params;
|
||||
var post_data = this.data.post_data;
|
||||
post_data['page'] = this.data.data_page;
|
||||
|
||||
// 指定分类、品牌
|
||||
post_data['category_id'] = params['category_id'] || 0;
|
||||
post_data['brand_id'] = params['brand_id'] || 0;
|
||||
|
||||
// 搜索条件
|
||||
var data = this.data;
|
||||
for(var i in data.map_fields_list)
|
||||
{
|
||||
if((data[i] != null) != null && data[i].length > 0)
|
||||
{
|
||||
var temp = {};
|
||||
var index = 0;
|
||||
for(var k in data[i])
|
||||
{
|
||||
if((data[i][k]['active'] || 0) == 1)
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
// 价格
|
||||
case 'screening_price_list' :
|
||||
temp[index] = data[i][k]['min_price']+'-'+data[i][k]['max_price'];
|
||||
break;
|
||||
|
||||
// 属性、规格
|
||||
case 'goods_params_list' :
|
||||
case 'goods_spec_list' :
|
||||
temp[index] = data[i][k]['value'];
|
||||
break;
|
||||
|
||||
// 默认取值id
|
||||
default :
|
||||
temp[index] = data[i][k]['id'];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
post_data[data.map_fields_list[i]['form_key']] = (app.get_length(temp) > 0) ? JSON.stringify(temp) : '';
|
||||
}
|
||||
}
|
||||
|
||||
return post_data;
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
@ -194,7 +262,7 @@ Page({
|
||||
this.setData({ is_show_popup_form: true });
|
||||
},
|
||||
|
||||
// 筛选
|
||||
// 排序事件
|
||||
nav_sort_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var temp_post_data = this.data.post_data;
|
||||
@ -225,6 +293,56 @@ Page({
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 条件-更多数据展示事件
|
||||
more_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
var temp_more = this.data.map_fields_list;
|
||||
if(value != null && (temp_more[value] || null) != null)
|
||||
{
|
||||
temp_more[value]['height'] = (temp_more[value]['height'] == 'auto') ? temp_more[value]['default'] : 'auto';
|
||||
this.setData({map_fields_list: temp_more});
|
||||
}
|
||||
},
|
||||
|
||||
// 条件-选择事件
|
||||
map_item_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var field = e.currentTarget.dataset.field;
|
||||
var data = this.data;
|
||||
if((data[field] || null) != null && (data[field][index] || null) != null)
|
||||
{
|
||||
data[field][index]['active'] = ((data[field][index]['active'] || 0) == 0) ? 1 : 0;
|
||||
this.setData(data);
|
||||
}
|
||||
},
|
||||
|
||||
// 条件-清空
|
||||
map_remove_event(e) {
|
||||
var data = this.data;
|
||||
// 关键字
|
||||
data['post_data']['wd'] = '';
|
||||
|
||||
// 品牌、分类、价格、属性、规格
|
||||
for(var i in data.map_fields_list)
|
||||
{
|
||||
if((data[i] != null) != null && data[i].length > 0)
|
||||
{
|
||||
for(var k in data[i])
|
||||
{
|
||||
data[i][k]['active'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭条件弹层
|
||||
data['is_show_popup_form'] = false;
|
||||
|
||||
// 分页恢复1页、重新获取数据
|
||||
data['data_page'] = 1;
|
||||
this.setData(data);
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// web页面信息设置
|
||||
set_page_info() {
|
||||
swan.setPageInfo({
|
||||
@ -239,11 +357,12 @@ Page({
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
var category_id = this.data.params['category_id'] || 0;
|
||||
var brand_id = this.data.params['brand_id'] || 0;
|
||||
var keywords = this.data.params['keywords'] || '';
|
||||
return {
|
||||
title: app.data.application_title,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&keywords='+keywords
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&brand_id='+brand_id+'&keywords='+keywords
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
@ -37,21 +37,97 @@
|
||||
</scroll-view>
|
||||
|
||||
<!-- 筛选条件 popup -->
|
||||
<component-popup status="{{is_show_popup_form}}" position="right" bindonclose="popup_form_event_close">
|
||||
<component-popup status="{{is_show_popup_form}}" position="left" bindonclose="popup_form_event_close">
|
||||
<form bindsubmit="form_submit_event" class="popup-form oh bg-white">
|
||||
<view class="item oh screening-price">
|
||||
<view class="title cr-666">价格区间(元)</view>
|
||||
<view class="tc oh">
|
||||
<input type="digit" placeholder="最低价" name="min_price" class="br fl" />
|
||||
<text class="cr-888 separator">~</text>
|
||||
<input type="digit" placeholder="最高价" name="max_price" class="br fr" />
|
||||
<view class="search-map">
|
||||
<view class="map-item map-base">
|
||||
<text>筛选出</text>
|
||||
<text class="cr-main"> {{data_total}} </text>
|
||||
<text>条数据</text>
|
||||
<text class="map-remove-submit fr" bindtap="map_remove_event">清除</text>
|
||||
</view>
|
||||
|
||||
<!-- 搜索关键字 -->
|
||||
<input type="text" placeholder="其实搜索很简单^_^ !" name="wd" value="{=(post_data.wd || '')=}" class="map-keywords wh-auto" placeholder-class="cr-ccc" />
|
||||
|
||||
<!-- 品牌 -->
|
||||
<view s-if="((brand_list || null) != null && brand_list.length > 0) || ((search_map_info.brand || null) != null)" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>品牌</text>
|
||||
<text class="arrow-bottom" s-if="brand_list.length > 3" bindtap="more_event" data-value="brand_list">更多</text>
|
||||
</view>
|
||||
<view s-if="(search_map_info.brand || null) != null" class="map-content brand-info oh bg-white">
|
||||
<image s-if="(search_map_info.brand.logo || null) != null" src="{{search_map_info.brand.logo}}" mode="aspectFit" class="fl" />
|
||||
<view s-else class="info-logo-empty tc fl">{{search_map_info.brand.name}}</view>
|
||||
<view class="info-right fr">
|
||||
<view s-if="(search_map_info.brand.logo || null) != null" class="info-name">{{search_map_info.brand.name}}</view>
|
||||
<view s-if="(search_map_info.brand.describe || null) != null" class="info-desc multi-text">{{search_map_info.brand.describe}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view s-else class="map-content map-images-text-items map-brand-container oh bg-white" style="height:{{map_fields_list.brand_list.height}};">
|
||||
<block s-for="item, index in brand_list" s-key="key">
|
||||
<view class="fl tc single-text {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="brand_list">
|
||||
<image s-if="(item.logo || null) != null" src="{{item.logo}}" mode="aspectFit" />
|
||||
<text s-else>{{item.name}}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分类 -->
|
||||
<view s-if="(category_list || null) != null && category_list.length > 0" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>分类</text>
|
||||
<text class="arrow-bottom" s-if="category_list.length > 3" bindtap="more_event" data-value="category_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items map-category-container oh bg-white" style="height:{{map_fields_list.category_list.height}};">
|
||||
<block s-for="item, index in category_list" s-key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="category_list">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 价格 -->
|
||||
<view s-if="(screening_price_list || null) != null && screening_price_list.length > 0" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>价格</text>
|
||||
<text class="arrow-bottom" s-if="screening_price_list.length > 3" bindtap="more_event" data-value="screening_price_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items screening-price-container oh bg-white" style="height:{{map_fields_list.screening_price_list.height}};">
|
||||
<block s-for="item, index in screening_price_list" s-key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="screening_price_list">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 属性 -->
|
||||
<view s-if="(goods_params_list || null) != null && goods_params_list.length > 0" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>属性</text>
|
||||
<text class="arrow-bottom" s-if="goods_params_list.length > 3" bindtap="more_event" data-value="goods_params_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items goods-params-container oh bg-white" style="height:{{map_fields_list.goods_params_list.height}};">
|
||||
<block s-for="item, index in goods_params_list" s-key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="goods_params_list">{{item.value}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 规格 -->
|
||||
<view s-if="(goods_spec_list || null) != null && goods_spec_list.length > 0" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>规格</text>
|
||||
<text class="arrow-bottom" s-if="goods_spec_list.length > 3" bindtap="more_event" data-value="goods_spec_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items goods-spec-container oh bg-white" style="height:{{map_fields_list.goods_spec_list.height}};">
|
||||
<block s-for="item, index in goods_spec_list" s-key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="goods_spec_list">{{item.value}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button formType="submit" class="bg-main search-submit wh-auto" disabled="{{popup_form_loading_status}}" hover-class="none">确认</button>
|
||||
</view>
|
||||
<view class="item keywords">
|
||||
<view class="title cr-666">关键字</view>
|
||||
<input type="text" placeholder="关键字" name="wd" 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>
|
||||
</component-popup>
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
.search {
|
||||
left: 0;
|
||||
top: 20rpx;
|
||||
box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
padding: 20rpx;
|
||||
background: #d2364c;
|
||||
}
|
||||
@ -157,7 +157,7 @@
|
||||
}
|
||||
.limitedtimediscount .goods-list .item {
|
||||
width: 460rpx;
|
||||
height: 610rpx;
|
||||
height: 670rpx;
|
||||
border: 1px solid #f5f5f5;
|
||||
background: white;
|
||||
display: inline-block;
|
||||
|
||||
48
sourcecode/baidu/default/pages/plugins/brand/index/index.css
Normal file
48
sourcecode/baidu/default/pages/plugins/brand/index/index.css
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 分类导航
|
||||
*/
|
||||
.nav-list {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.nav-list .item {
|
||||
padding: 20rpx 30rpx;
|
||||
border-bottom: 3px solid #f0f0f0;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.nav-list .active {
|
||||
border-bottom: 3px solid #d2364c;
|
||||
color: #d2364c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
.data-list .items {
|
||||
width: calc(50% - 5rpx);
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.data-list .items:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.data-list .items:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.data-list .items image {
|
||||
width: 100%;
|
||||
height: 160rpx !important;
|
||||
}
|
||||
.data-list .items .base {
|
||||
padding-top: 20rpx;
|
||||
margin: 20rpx;
|
||||
}
|
||||
.data-list .items .desc {
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
131
sourcecode/baidu/default/pages/plugins/brand/index/index.js
Normal file
131
sourcecode/baidu/default/pages/plugins/brand/index/index.js
Normal file
@ -0,0 +1,131 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
data_base: null,
|
||||
brand_list: [],
|
||||
brand_category_list: [],
|
||||
nav_active_value: 0
|
||||
},
|
||||
|
||||
onReady() {},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.get_data(); // 显示分享菜单
|
||||
|
||||
app.show_share_menu();
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
var self = this;
|
||||
swan.request({
|
||||
url: app.get_request_url("index", "index", "brand"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
swan.stopPullDownRefresh();
|
||||
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
data_base: data.base || null,
|
||||
brand_list: data.brand_list || [],
|
||||
brand_category_list: data.brand_category_list || [],
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: (data.brand_list || []).length > 0 ? 3 : 0,
|
||||
data_bottom_line_status: (data.brand_list || []).length > 0
|
||||
}); // 选中处理
|
||||
|
||||
self.nav_active_handle();
|
||||
} else {
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
swan.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错'
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
nav_event(e) {
|
||||
this.setData({
|
||||
nav_active_value: e.currentTarget.dataset.value || 0
|
||||
});
|
||||
this.nav_active_handle();
|
||||
},
|
||||
|
||||
// 导航选中处理
|
||||
nav_active_handle() {
|
||||
var value = this.data.nav_active_value;
|
||||
var temp_brand_list = this.data.brand_list;
|
||||
var count = 0;
|
||||
|
||||
for (var i in temp_brand_list) {
|
||||
if (value == 0) {
|
||||
temp_brand_list[i]['is_not_show'] = 0;
|
||||
count++;
|
||||
} else {
|
||||
var is_not_show = temp_brand_list[i]['brand_category_ids'].indexOf(value) == -1 ? 1 : 0;
|
||||
temp_brand_list[i]['is_not_show'] = is_not_show;
|
||||
|
||||
if (is_not_show == 0) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
brand_list: temp_brand_list,
|
||||
data_list_loding_status: count > 0 ? 3 : 0,
|
||||
data_bottom_line_status: count > 0
|
||||
});
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data_base.seo_title || '品牌 - ' + app.data.application_title,
|
||||
desc: this.data.data_base.seo_desc || app.data.application_describe,
|
||||
path: '/pages/plugins/brand/index/index?referrer=' + user_id
|
||||
};
|
||||
},
|
||||
|
||||
// 分享朋友圈
|
||||
onShareTimeline() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data_base.seo_title || '品牌 - ' + app.data.application_title,
|
||||
query: 'referrer=' + user_id,
|
||||
imageUrl: this.data.data_base.right_images || ''
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "品牌"
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<view s-if="(data_base || null) != null">
|
||||
<!-- 分类 -->
|
||||
<scroll-view s-if="(brand_category_list || null) != null && brand_category_list.length > 0" class="nav-list bg-white tc oh" scroll-x="true">
|
||||
<view class="item cr-888 {{nav_active_value == 0 ? 'active' : ''}}" bindtap="nav_event" data-value="0">全部</view>
|
||||
<block s-for="item, index in brand_category_list" s-key="key">
|
||||
<view class="item cr-888 {{nav_active_value == item.id ? 'active' : ''}}" bindtap="nav_event" data-value="{{item.id}}">{{item.name}}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 品牌列表 -->
|
||||
<view s-if="(brand_list || null) != null && brand_list.length > 0" class="data-list oh spacing-mt">
|
||||
<block s-for="item, index in brand_list" s-key="key">
|
||||
<view s-if="(item.is_not_show || 0) == 0" class="items bg-white">
|
||||
<navigator url="/pages/goods-search/goods-search?brand_id={{item.id}}" hover-class="none">
|
||||
<image src="{{item.logo}}" mode="aspectFit" />
|
||||
<view class="base br-t-dashed">
|
||||
<view class="single-text name tc">{{item.name}}</view>
|
||||
<view class="multi-text desc">{{item.describe}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<import src="/pages/common/bottom_line.swan" />
|
||||
<template is="bottom_line" data="{{{status: data_bottom_line_status}}}"></template>
|
||||
</view>
|
||||
<view s-if="data_list_loding_status != 3">
|
||||
<import src="/pages/common/nodata.swan" />
|
||||
<template is="nodata" data="{{{status: data_list_loding_status, msg: data_list_loding_msg}}}"></template>
|
||||
</view>
|
||||
@ -54,7 +54,8 @@
|
||||
"pages/plugins/signin/user-qrcode-detail/user-qrcode-detail",
|
||||
"pages/plugins/signin/user-qrcode-saveinfo/user-qrcode-saveinfo",
|
||||
"pages/plugins/signin/user-coming-list/user-coming-list",
|
||||
"pages/plugins/points/index/index"
|
||||
"pages/plugins/points/index/index",
|
||||
"pages/plugins/brand/index/index"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTitleText": "{{application_title}}",
|
||||
|
||||
@ -145,6 +145,7 @@ textarea {
|
||||
min-height: 104rpx;
|
||||
line-height: 52rpx;
|
||||
font-size: 32rpx;
|
||||
white-space: initial;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ Page({
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
params: null,
|
||||
@ -20,6 +21,21 @@ Page({
|
||||
|
||||
// 基础配置
|
||||
currency_symbol: app.data.currency_symbol,
|
||||
|
||||
// 搜素条件
|
||||
search_map_info: [],
|
||||
brand_list: [],
|
||||
category_list: [],
|
||||
screening_price_list: [],
|
||||
goods_params_list: [],
|
||||
goods_spec_list: [],
|
||||
map_fields_list: {
|
||||
"brand_list": {"height":"100rpx", "default":"100rpx", "form_key":"brand_ids"},
|
||||
"category_list": {"height":"82rpx", "default":"82rpx", "form_key":"category_ids"},
|
||||
"screening_price_list": {"height":"82rpx", "default":"82rpx", "form_key":"screening_price_values"},
|
||||
"goods_params_list": {"height":"82rpx", "default":"82rpx", "form_key":"goods_params_values"},
|
||||
"goods_spec_list": {"height":"82rpx", "default":"82rpx", "form_key":"goods_spec_values"}
|
||||
},
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
@ -82,16 +98,9 @@ Page({
|
||||
|
||||
// 加载loding
|
||||
qq.showLoading({title: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 参数
|
||||
var params = this.data.params;
|
||||
var post_data = this.data.post_data;
|
||||
post_data['page'] = this.data.data_page;
|
||||
post_data['category_id'] = params['category_id'] || 0;
|
||||
post_data['brand_id'] = params['brand_id'] || 0;
|
||||
var post_data = this.request_map_handle();
|
||||
|
||||
// 获取数据
|
||||
qq.request({
|
||||
@ -104,20 +113,36 @@ Page({
|
||||
qq.hideLoading();
|
||||
qq.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
var data = res.data.data;
|
||||
|
||||
// 仅首次请求赋值条件数据
|
||||
if(this.data.data_list_loding_status == 1)
|
||||
{
|
||||
this.setData({
|
||||
search_map_info: data.search_map_info || [],
|
||||
brand_list: data.brand_list || [],
|
||||
category_list: data.category_list || [],
|
||||
screening_price_list: data.screening_price_list || [],
|
||||
goods_params_list: data.goods_params_list || [],
|
||||
goods_spec_list: data.goods_spec_list || [],
|
||||
});
|
||||
}
|
||||
|
||||
// 列表数据处理
|
||||
if (data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
var temp_data_list = data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
var temp_data = data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_total: data.total,
|
||||
data_page_total: data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
@ -144,7 +169,6 @@ Page({
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
@ -160,6 +184,55 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
// 搜索条件处理
|
||||
request_map_handle() {
|
||||
var params = this.data.params;
|
||||
var post_data = this.data.post_data;
|
||||
post_data['page'] = this.data.data_page;
|
||||
|
||||
// 指定分类、品牌
|
||||
post_data['category_id'] = params['category_id'] || 0;
|
||||
post_data['brand_id'] = params['brand_id'] || 0;
|
||||
|
||||
// 搜索条件
|
||||
var data = this.data;
|
||||
for(var i in data.map_fields_list)
|
||||
{
|
||||
if((data[i] != null) != null && data[i].length > 0)
|
||||
{
|
||||
var temp = {};
|
||||
var index = 0;
|
||||
for(var k in data[i])
|
||||
{
|
||||
if((data[i][k]['active'] || 0) == 1)
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
// 价格
|
||||
case 'screening_price_list' :
|
||||
temp[index] = data[i][k]['min_price']+'-'+data[i][k]['max_price'];
|
||||
break;
|
||||
|
||||
// 属性、规格
|
||||
case 'goods_params_list' :
|
||||
case 'goods_spec_list' :
|
||||
temp[index] = data[i][k]['value'];
|
||||
break;
|
||||
|
||||
// 默认取值id
|
||||
default :
|
||||
temp[index] = data[i][k]['id'];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
post_data[data.map_fields_list[i]['form_key']] = (app.get_length(temp) > 0) ? JSON.stringify(temp) : '';
|
||||
}
|
||||
}
|
||||
|
||||
return post_data;
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
@ -190,7 +263,7 @@ Page({
|
||||
this.setData({ is_show_popup_form: true });
|
||||
},
|
||||
|
||||
// 筛选
|
||||
// 排序事件
|
||||
nav_sort_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var temp_post_data = this.data.post_data;
|
||||
@ -221,15 +294,66 @@ Page({
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 条件-更多数据展示事件
|
||||
more_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
var temp_more = this.data.map_fields_list;
|
||||
if(value != null && (temp_more[value] || null) != null)
|
||||
{
|
||||
temp_more[value]['height'] = (temp_more[value]['height'] == 'auto') ? temp_more[value]['default'] : 'auto';
|
||||
this.setData({map_fields_list: temp_more});
|
||||
}
|
||||
},
|
||||
|
||||
// 条件-选择事件
|
||||
map_item_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var field = e.currentTarget.dataset.field;
|
||||
var data = this.data;
|
||||
if((data[field] || null) != null && (data[field][index] || null) != null)
|
||||
{
|
||||
data[field][index]['active'] = ((data[field][index]['active'] || 0) == 0) ? 1 : 0;
|
||||
this.setData(data);
|
||||
}
|
||||
},
|
||||
|
||||
// 条件-清空
|
||||
map_remove_event(e) {
|
||||
var data = this.data;
|
||||
// 关键字
|
||||
data['post_data']['wd'] = '';
|
||||
|
||||
// 品牌、分类、价格、属性、规格
|
||||
for(var i in data.map_fields_list)
|
||||
{
|
||||
if((data[i] != null) != null && data[i].length > 0)
|
||||
{
|
||||
for(var k in data[i])
|
||||
{
|
||||
data[i][k]['active'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭条件弹层
|
||||
data['is_show_popup_form'] = false;
|
||||
|
||||
// 分页恢复1页、重新获取数据
|
||||
data['data_page'] = 1;
|
||||
this.setData(data);
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
var category_id = this.data.params['category_id'] || 0;
|
||||
var brand_id = this.data.params['brand_id'] || 0;
|
||||
var keywords = this.data.params['keywords'] || '';
|
||||
return {
|
||||
title: app.data.application_title,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&keywords='+keywords
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&brand_id='+brand_id+'&keywords='+keywords
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@ -37,21 +37,97 @@
|
||||
</scroll-view>
|
||||
|
||||
<!-- 筛选条件 popup -->
|
||||
<component-popup prop-show="{{is_show_popup_form}}" prop-position="right" bindonclose="popup_form_event_close">
|
||||
<component-popup prop-show="{{is_show_popup_form}}" prop-position="left" bindonclose="popup_form_event_close">
|
||||
<form bindsubmit="form_submit_event" class="popup-form oh bg-white">
|
||||
<view class="item oh screening-price">
|
||||
<view class="title cr-666">价格区间(元)</view>
|
||||
<view class="tc oh">
|
||||
<input type="digit" placeholder="最低价" name="min_price" class="br fl" />
|
||||
<text class="cr-888 separator">~</text>
|
||||
<input type="digit" placeholder="最高价" name="max_price" class="br fr" />
|
||||
<view class="search-map">
|
||||
<view class="map-item map-base">
|
||||
<text>筛选出</text>
|
||||
<text class="cr-main"> {{data_total}} </text>
|
||||
<text>条数据</text>
|
||||
<text class="map-remove-submit fr" bindtap="map_remove_event">清除</text>
|
||||
</view>
|
||||
|
||||
<!-- 搜索关键字 -->
|
||||
<input type="text" placeholder="其实搜索很简单^_^ !" name="wd" value="{{(post_data.wd || '')}}" class="map-keywords wh-auto" placeholder-class="cr-ccc" />
|
||||
|
||||
<!-- 品牌 -->
|
||||
<view qq:if="{{((brand_list || null) != null && brand_list.length > 0) || ((search_map_info.brand || null) != null)}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>品牌</text>
|
||||
<text class="arrow-bottom" qq:if="{{brand_list.length > 3}}" bindtap="more_event" data-value="brand_list">更多</text>
|
||||
</view>
|
||||
<view qq:if="{{(search_map_info.brand || null) != null}}" class="map-content brand-info oh bg-white">
|
||||
<image qq:if="{{(search_map_info.brand.logo || null) != null}}" src="{{search_map_info.brand.logo}}" mode="aspectFit" class="fl" />
|
||||
<view qq:else class="info-logo-empty tc fl">{{search_map_info.brand.name}}</view>
|
||||
<view class="info-right fr">
|
||||
<view qq:if="{{(search_map_info.brand.logo || null) != null}}" class="info-name">{{search_map_info.brand.name}}</view>
|
||||
<view qq:if="{{(search_map_info.brand.describe || null) != null}}"class="info-desc multi-text">{{search_map_info.brand.describe}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view qq:else class="map-content map-images-text-items map-brand-container oh bg-white" style="height:{{map_fields_list.brand_list.height}};">
|
||||
<block qq:for="{{brand_list}}" qq:key="key">
|
||||
<view class="fl tc single-text {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="brand_list">
|
||||
<image qq:if="{{(item.logo || null) != null}}" src="{{item.logo}}" mode="aspectFit" />
|
||||
<text qq:else>{{item.name}}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分类 -->
|
||||
<view qq:if="{{(category_list || null) != null && category_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>分类</text>
|
||||
<text class="arrow-bottom" qq:if="{{category_list.length > 3}}" bindtap="more_event" data-value="category_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items map-category-container oh bg-white" style="height:{{map_fields_list.category_list.height}};">
|
||||
<block qq:for="{{category_list}}" qq:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="category_list">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 价格 -->
|
||||
<view qq:if="{{(screening_price_list || null) != null && screening_price_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>价格</text>
|
||||
<text class="arrow-bottom" qq:if="{{screening_price_list.length > 3}}" bindtap="more_event" data-value="screening_price_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items screening-price-container oh bg-white" style="height:{{map_fields_list.screening_price_list.height}};">
|
||||
<block qq:for="{{screening_price_list}}" qq:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="screening_price_list">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 属性 -->
|
||||
<view qq:if="{{(goods_params_list || null) != null && goods_params_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>属性</text>
|
||||
<text class="arrow-bottom" qq:if="{{goods_params_list.length > 3}}" bindtap="more_event" data-value="goods_params_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items goods-params-container oh bg-white" style="height:{{map_fields_list.goods_params_list.height}};">
|
||||
<block qq:for="{{goods_params_list}}" qq:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="goods_params_list">{{item.value}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 规格 -->
|
||||
<view qq:if="{{(goods_spec_list || null) != null && goods_spec_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>规格</text>
|
||||
<text class="arrow-bottom" qq:if="{{goods_spec_list.length > 3}}" bindtap="more_event" data-value="goods_spec_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items goods-spec-container oh bg-white" style="height:{{map_fields_list.goods_spec_list.height}};">
|
||||
<block qq:for="{{goods_spec_list}}" qq:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="goods_spec_list">{{item.value}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button formType="submit" class="bg-main search-submit wh-auto" disabled="{{popup_form_loading_status}}" hover-class="none">确认</button>
|
||||
</view>
|
||||
<view class="item keywords">
|
||||
<view class="title cr-666">关键字</view>
|
||||
<input type="text" placeholder="关键字" name="wd" 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>
|
||||
</component-popup>
|
||||
|
||||
|
||||
@ -61,40 +61,102 @@
|
||||
/**
|
||||
* 条件
|
||||
*/
|
||||
.popup-form {
|
||||
height: 100vh;
|
||||
.search-map {
|
||||
height: calc(100vh - 80rpx);
|
||||
width: 680rpx;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.popup-form input {
|
||||
.map-keywords {
|
||||
border-radius: 0 !important;
|
||||
padding: 0 10rpx;
|
||||
line-height: 66rpx;
|
||||
height: 66rpx;
|
||||
font-size: 26rpx;
|
||||
height: 60rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.map-nav {
|
||||
position: relative;
|
||||
}
|
||||
.map-nav .arrow-bottom {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 10rpx;
|
||||
padding-right: 46rpx;
|
||||
color: #999;
|
||||
}
|
||||
.map-item {
|
||||
background: #f0f0f0;
|
||||
line-height: 76rpx;
|
||||
}
|
||||
.map-base,
|
||||
.map-nav {
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.map-content {
|
||||
padding: 15rpx;
|
||||
line-height: 60rpx;
|
||||
background: #fbfbfb;
|
||||
border-radius: 6rpx;
|
||||
padding: 0 6rpx;
|
||||
}
|
||||
.screening-price input {
|
||||
width: calc(50% - 20px);
|
||||
.map-text-items view,
|
||||
.map-images-text-items view {
|
||||
padding: 0 15rpx;
|
||||
border-radius: 2px;
|
||||
margin: 15rpx;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.screening-price .separator {
|
||||
line-height: 50rpx;
|
||||
.map-images-text-items view {
|
||||
vertical-align: middle;
|
||||
border: 1px solid #eee;
|
||||
width: 150rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
.popup-form .item {
|
||||
width: 480rpx;
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
.map-images-text-items view image {
|
||||
width: 150rpx;
|
||||
height: calc(100% - 8rpx);
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
.popup-form .item:not(:last-child) {
|
||||
margin-bottom: 30rpx;
|
||||
.map-text-items view.active,
|
||||
.map-images-text-items view.active {
|
||||
border: 1px solid #e23f36;
|
||||
color: #e23f36;
|
||||
font-weight: bold;
|
||||
}
|
||||
.popup-form .item .title {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.popup-form .form-submit {
|
||||
.search-map .search-submit {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.map-remove-submit {
|
||||
color: #e23f36;
|
||||
}
|
||||
|
||||
/**
|
||||
* 品牌基础信息
|
||||
*/
|
||||
.brand-info {
|
||||
padding: 35rpx 15rpx;
|
||||
}
|
||||
.brand-info image,
|
||||
.brand-info .info-logo-empty {
|
||||
width: 300rpx;
|
||||
height: 130rpx;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.brand-info .info-logo-empty {
|
||||
line-height: 130rpx;
|
||||
}
|
||||
.brand-info .info-right {
|
||||
width: calc(100% - 330rpx);
|
||||
}
|
||||
.brand-info .info-desc {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
@ -157,7 +157,7 @@
|
||||
}
|
||||
.limitedtimediscount .goods-list .item {
|
||||
width: 460rpx;
|
||||
height: 605rpx;
|
||||
height: 670rpx;
|
||||
border: 1px solid #f5f5f5;
|
||||
background: white;
|
||||
display: inline-block;
|
||||
|
||||
129
sourcecode/qq/default/pages/plugins/brand/index/index.js
Normal file
129
sourcecode/qq/default/pages/plugins/brand/index/index.js
Normal file
@ -0,0 +1,129 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
data_base: null,
|
||||
brand_list: [],
|
||||
brand_category_list: [],
|
||||
nav_active_value: 0,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params,
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.get_data();
|
||||
|
||||
// 显示分享菜单
|
||||
app.show_share_menu();
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
var self = this;
|
||||
qq.request({
|
||||
url: app.get_request_url("index", "index", "brand"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
qq.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
data_base: data.base || null,
|
||||
brand_list: data.brand_list || [],
|
||||
brand_category_list: data.brand_category_list || [],
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: ((data.brand_list || []).length > 0) ? 3 : 0,
|
||||
data_bottom_line_status: ((data.brand_list || []).length > 0),
|
||||
});
|
||||
|
||||
// 选中处理
|
||||
self.nav_active_handle();
|
||||
} else {
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
qq.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
nav_event(e) {
|
||||
this.setData({
|
||||
nav_active_value: e.currentTarget.dataset.value || 0,
|
||||
});
|
||||
this.nav_active_handle();
|
||||
},
|
||||
|
||||
// 导航选中处理
|
||||
nav_active_handle() {
|
||||
var value = this.data.nav_active_value;
|
||||
var temp_brand_list = this.data.brand_list;
|
||||
var count = 0;
|
||||
for(var i in temp_brand_list)
|
||||
{
|
||||
if(value == 0)
|
||||
{
|
||||
temp_brand_list[i]['is_not_show'] = 0;
|
||||
count++;
|
||||
} else {
|
||||
var is_not_show = (temp_brand_list[i]['brand_category_ids'].indexOf(value) == -1) ? 1 : 0;
|
||||
temp_brand_list[i]['is_not_show'] = is_not_show;
|
||||
if(is_not_show == 0)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
brand_list: temp_brand_list,
|
||||
data_list_loding_status: (count > 0) ? 3 : 0,
|
||||
data_bottom_line_status: (count > 0),
|
||||
});
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data_base.seo_title || '品牌 - '+app.data.application_title,
|
||||
desc: this.data.data_base.seo_desc || app.data.application_describe,
|
||||
path: '/pages/plugins/brand/index/index?referrer=' + user_id
|
||||
};
|
||||
},
|
||||
|
||||
// 分享朋友圈
|
||||
onShareTimeline() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data_base.seo_title || '品牌 - '+app.data.application_title,
|
||||
query: 'referrer=' + user_id,
|
||||
imageUrl: this.data.data_base.right_images || ''
|
||||
};
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "品牌"
|
||||
}
|
||||
32
sourcecode/qq/default/pages/plugins/brand/index/index.qml
Normal file
32
sourcecode/qq/default/pages/plugins/brand/index/index.qml
Normal file
@ -0,0 +1,32 @@
|
||||
<view qq:if="{{(data_base || null) != null}}">
|
||||
<!-- 分类 -->
|
||||
<scroll-view qq:if="{{(brand_category_list || null) != null && brand_category_list.length > 0}}" class="nav-list bg-white tc oh" scroll-x="true">
|
||||
<view class="item cr-888 {{nav_active_value == 0 ? 'active' : ''}}" bindtap="nav_event" data-value="0">全部</view>
|
||||
<block qq:for="{{brand_category_list}}" qq:key="key">
|
||||
<view class="item cr-888 {{nav_active_value == item.id ? 'active' : ''}}" bindtap="nav_event" data-value="{{item.id}}">{{item.name}}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 品牌列表 -->
|
||||
<view qq:if="{{(brand_list || null) != null && brand_list.length > 0}}" class="data-list oh spacing-mt">
|
||||
<block qq:for="{{brand_list}}" qq:key="key">
|
||||
<view qq:if="{{(item.is_not_show || 0) == 0}}" class="items bg-white">
|
||||
<navigator url="/pages/goods-search/goods-search?brand_id={{item.id}}" hover-class="none">
|
||||
<image src="{{item.logo}}" mode="aspectFit" />
|
||||
<view class="base br-t-dashed">
|
||||
<view class="single-text name tc">{{item.name}}</view>
|
||||
<view class="multi-text desc">{{item.describe}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<import src="/pages/common/bottom_line.qml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</view>
|
||||
<view qq:if="{{data_list_loding_status != 3}}">
|
||||
<import src="/pages/common/nodata.qml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
||||
48
sourcecode/qq/default/pages/plugins/brand/index/index.qss
Normal file
48
sourcecode/qq/default/pages/plugins/brand/index/index.qss
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 分类导航
|
||||
*/
|
||||
.nav-list {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.nav-list .item {
|
||||
padding: 20rpx 30rpx;
|
||||
border-bottom: 3px solid #f0f0f0;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.nav-list .active {
|
||||
border-bottom: 3px solid #d2364c;
|
||||
color: #d2364c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
.data-list .items {
|
||||
width: calc(50% - 5rpx);
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.data-list .items:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.data-list .items:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.data-list .items image {
|
||||
width: 100%;
|
||||
height: 160rpx !important;
|
||||
}
|
||||
.data-list .items .base {
|
||||
padding-top: 20rpx;
|
||||
margin: 20rpx;
|
||||
}
|
||||
.data-list .items .desc {
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
@ -73,7 +73,8 @@
|
||||
"pages/plugins/signin/user-qrcode-detail/user-qrcode-detail",
|
||||
"pages/plugins/signin/user-qrcode-saveinfo/user-qrcode-saveinfo",
|
||||
"pages/plugins/signin/user-coming-list/user-coming-list",
|
||||
"pages/plugins/points/index/index"
|
||||
"pages/plugins/points/index/index",
|
||||
"pages/plugins/brand/index/index"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTitleText": "{{application_title}}",
|
||||
|
||||
@ -146,6 +146,7 @@ textarea {
|
||||
min-height: 104rpx;
|
||||
line-height: 52rpx;
|
||||
font-size: 32rpx;
|
||||
white-space: initial;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -20,6 +20,21 @@ Page({
|
||||
|
||||
// 基础配置
|
||||
currency_symbol: app.data.currency_symbol,
|
||||
|
||||
// 搜素条件
|
||||
search_map_info: [],
|
||||
brand_list: [],
|
||||
category_list: [],
|
||||
screening_price_list: [],
|
||||
goods_params_list: [],
|
||||
goods_spec_list: [],
|
||||
map_fields_list: {
|
||||
"brand_list": {"height":"100rpx", "default":"100rpx", "form_key":"brand_ids"},
|
||||
"category_list": {"height":"82rpx", "default":"82rpx", "form_key":"category_ids"},
|
||||
"screening_price_list": {"height":"82rpx", "default":"82rpx", "form_key":"screening_price_values"},
|
||||
"goods_params_list": {"height":"82rpx", "default":"82rpx", "form_key":"goods_params_values"},
|
||||
"goods_spec_list": {"height":"82rpx", "default":"82rpx", "form_key":"goods_spec_values"}
|
||||
},
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
@ -82,16 +97,9 @@ Page({
|
||||
|
||||
// 加载loding
|
||||
tt.showLoading({title: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 参数
|
||||
var params = this.data.params;
|
||||
var post_data = this.data.post_data;
|
||||
post_data['page'] = this.data.data_page;
|
||||
post_data['category_id'] = params['category_id'] || 0;
|
||||
post_data['brand_id'] = params['brand_id'] || 0;
|
||||
var post_data = this.request_map_handle();
|
||||
|
||||
// 获取数据
|
||||
tt.request({
|
||||
@ -104,20 +112,36 @@ Page({
|
||||
tt.hideLoading();
|
||||
tt.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
var data = res.data.data;
|
||||
|
||||
// 仅首次请求赋值条件数据
|
||||
if(this.data.data_list_loding_status == 1)
|
||||
{
|
||||
this.setData({
|
||||
search_map_info: data.search_map_info || [],
|
||||
brand_list: data.brand_list || [],
|
||||
category_list: data.category_list || [],
|
||||
screening_price_list: data.screening_price_list || [],
|
||||
goods_params_list: data.goods_params_list || [],
|
||||
goods_spec_list: data.goods_spec_list || [],
|
||||
});
|
||||
}
|
||||
|
||||
// 列表数据处理
|
||||
if (data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
var temp_data_list = data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
var temp_data = data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_total: data.total,
|
||||
data_page_total: data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
@ -144,7 +168,6 @@ Page({
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
@ -160,6 +183,55 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
// 搜索条件处理
|
||||
request_map_handle() {
|
||||
var params = this.data.params;
|
||||
var post_data = this.data.post_data;
|
||||
post_data['page'] = this.data.data_page;
|
||||
|
||||
// 指定分类、品牌
|
||||
post_data['category_id'] = params['category_id'] || 0;
|
||||
post_data['brand_id'] = params['brand_id'] || 0;
|
||||
|
||||
// 搜索条件
|
||||
var data = this.data;
|
||||
for(var i in data.map_fields_list)
|
||||
{
|
||||
if((data[i] != null) != null && data[i].length > 0)
|
||||
{
|
||||
var temp = {};
|
||||
var index = 0;
|
||||
for(var k in data[i])
|
||||
{
|
||||
if((data[i][k]['active'] || 0) == 1)
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
// 价格
|
||||
case 'screening_price_list' :
|
||||
temp[index] = data[i][k]['min_price']+'-'+data[i][k]['max_price'];
|
||||
break;
|
||||
|
||||
// 属性、规格
|
||||
case 'goods_params_list' :
|
||||
case 'goods_spec_list' :
|
||||
temp[index] = data[i][k]['value'];
|
||||
break;
|
||||
|
||||
// 默认取值id
|
||||
default :
|
||||
temp[index] = data[i][k]['id'];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
post_data[data.map_fields_list[i]['form_key']] = (app.get_length(temp) > 0) ? JSON.stringify(temp) : '';
|
||||
}
|
||||
}
|
||||
|
||||
return post_data;
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
@ -190,7 +262,7 @@ Page({
|
||||
this.setData({ is_show_popup_form: true });
|
||||
},
|
||||
|
||||
// 筛选
|
||||
// 排序事件
|
||||
nav_sort_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var temp_post_data = this.data.post_data;
|
||||
@ -221,15 +293,66 @@ Page({
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 条件-更多数据展示事件
|
||||
more_event(e) {
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
var temp_more = this.data.map_fields_list;
|
||||
if(value != null && (temp_more[value] || null) != null)
|
||||
{
|
||||
temp_more[value]['height'] = (temp_more[value]['height'] == 'auto') ? temp_more[value]['default'] : 'auto';
|
||||
this.setData({map_fields_list: temp_more});
|
||||
}
|
||||
},
|
||||
|
||||
// 条件-选择事件
|
||||
map_item_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var field = e.currentTarget.dataset.field;
|
||||
var data = this.data;
|
||||
if((data[field] || null) != null && (data[field][index] || null) != null)
|
||||
{
|
||||
data[field][index]['active'] = ((data[field][index]['active'] || 0) == 0) ? 1 : 0;
|
||||
this.setData(data);
|
||||
}
|
||||
},
|
||||
|
||||
// 条件-清空
|
||||
map_remove_event(e) {
|
||||
var data = this.data;
|
||||
// 关键字
|
||||
data['post_data']['wd'] = '';
|
||||
|
||||
// 品牌、分类、价格、属性、规格
|
||||
for(var i in data.map_fields_list)
|
||||
{
|
||||
if((data[i] != null) != null && data[i].length > 0)
|
||||
{
|
||||
for(var k in data[i])
|
||||
{
|
||||
data[i][k]['active'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭条件弹层
|
||||
data['is_show_popup_form'] = false;
|
||||
|
||||
// 分页恢复1页、重新获取数据
|
||||
data['data_page'] = 1;
|
||||
this.setData(data);
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
var category_id = this.data.params['category_id'] || 0;
|
||||
var brand_id = this.data.params['brand_id'] || 0;
|
||||
var keywords = this.data.params['keywords'] || '';
|
||||
return {
|
||||
title: app.data.application_title,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&keywords='+keywords
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&brand_id='+brand_id+'&keywords='+keywords
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@ -37,21 +37,97 @@
|
||||
</scroll-view>
|
||||
|
||||
<!-- 筛选条件 popup -->
|
||||
<component-popup prop-show="{{is_show_popup_form}}" prop-position="right" bindonclose="popup_form_event_close">
|
||||
<component-popup prop-show="{{is_show_popup_form}}" prop-position="left" bindonclose="popup_form_event_close">
|
||||
<form bindsubmit="form_submit_event" class="popup-form oh bg-white">
|
||||
<view class="item oh screening-price">
|
||||
<view class="title cr-666">价格区间(元)</view>
|
||||
<view class="tc oh">
|
||||
<input type="digit" placeholder="最低价" name="min_price" class="br fl" />
|
||||
<text class="cr-888 separator">~</text>
|
||||
<input type="digit" placeholder="最高价" name="max_price" class="br fr" />
|
||||
<view class="search-map">
|
||||
<view class="map-item map-base">
|
||||
<text>筛选出</text>
|
||||
<text class="cr-main"> {{data_total}} </text>
|
||||
<text>条数据</text>
|
||||
<text class="map-remove-submit fr" bindtap="map_remove_event">清除</text>
|
||||
</view>
|
||||
|
||||
<!-- 搜索关键字 -->
|
||||
<input type="text" placeholder="其实搜索很简单^_^ !" name="wd" value="{{(post_data.wd || '')}}" class="map-keywords wh-auto" placeholder-class="cr-ccc" />
|
||||
|
||||
<!-- 品牌 -->
|
||||
<view tt:if="{{((brand_list || null) != null && brand_list.length > 0) || ((search_map_info.brand || null) != null)}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>品牌</text>
|
||||
<text class="arrow-bottom" tt:if="{{brand_list.length > 3}}" bindtap="more_event" data-value="brand_list">更多</text>
|
||||
</view>
|
||||
<view tt:if="{{(search_map_info.brand || null) != null}}" class="map-content brand-info oh bg-white">
|
||||
<image tt:if="{{(search_map_info.brand.logo || null) != null}}" src="{{search_map_info.brand.logo}}" mode="aspectFit" class="fl" />
|
||||
<view tt:else class="info-logo-empty tc fl">{{search_map_info.brand.name}}</view>
|
||||
<view class="info-right fr">
|
||||
<view tt:if="{{(search_map_info.brand.logo || null) != null}}" class="info-name">{{search_map_info.brand.name}}</view>
|
||||
<view tt:if="{{(search_map_info.brand.describe || null) != null}}"class="info-desc multi-text">{{search_map_info.brand.describe}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view tt:else class="map-content map-images-text-items map-brand-container oh bg-white" style="height:{{map_fields_list.brand_list.height}};">
|
||||
<block tt:for="{{brand_list}}" tt:key="key">
|
||||
<view class="fl tc single-text {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="brand_list">
|
||||
<image tt:if="{{(item.logo || null) != null}}" src="{{item.logo}}" mode="aspectFit" />
|
||||
<text tt:else>{{item.name}}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分类 -->
|
||||
<view tt:if="{{(category_list || null) != null && category_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>分类</text>
|
||||
<text class="arrow-bottom" tt:if="{{category_list.length > 3}}" bindtap="more_event" data-value="category_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items map-category-container oh bg-white" style="height:{{map_fields_list.category_list.height}};">
|
||||
<block tt:for="{{category_list}}" tt:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="category_list">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 价格 -->
|
||||
<view tt:if="{{(screening_price_list || null) != null && screening_price_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>价格</text>
|
||||
<text class="arrow-bottom" tt:if="{{screening_price_list.length > 3}}" bindtap="more_event" data-value="screening_price_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items screening-price-container oh bg-white" style="height:{{map_fields_list.screening_price_list.height}};">
|
||||
<block tt:for="{{screening_price_list}}" tt:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="screening_price_list">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 属性 -->
|
||||
<view tt:if="{{(goods_params_list || null) != null && goods_params_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>属性</text>
|
||||
<text class="arrow-bottom" tt:if="{{goods_params_list.length > 3}}" bindtap="more_event" data-value="goods_params_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items goods-params-container oh bg-white" style="height:{{map_fields_list.goods_params_list.height}};">
|
||||
<block tt:for="{{goods_params_list}}" tt:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="goods_params_list">{{item.value}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 规格 -->
|
||||
<view tt:if="{{(goods_spec_list || null) != null && goods_spec_list.length > 0}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>规格</text>
|
||||
<text class="arrow-bottom" tt:if="{{goods_spec_list.length > 3}}" bindtap="more_event" data-value="goods_spec_list">更多</text>
|
||||
</view>
|
||||
<view class="map-content map-text-items goods-spec-container oh bg-white" style="height:{{map_fields_list.goods_spec_list.height}};">
|
||||
<block tt:for="{{goods_spec_list}}" tt:key="key">
|
||||
<view class="fl {{item.active == 1 ? 'active' : ''}}" bindtap="map_item_event" data-index="{{index}}" data-field="goods_spec_list">{{item.value}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button formType="submit" class="bg-main search-submit wh-auto" disabled="{{popup_form_loading_status}}" hover-class="none">确认</button>
|
||||
</view>
|
||||
<view class="item keywords">
|
||||
<view class="title cr-666">关键字</view>
|
||||
<input type="text" placeholder="关键字" name="wd" 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>
|
||||
</component-popup>
|
||||
|
||||
|
||||
@ -61,40 +61,102 @@
|
||||
/**
|
||||
* 条件
|
||||
*/
|
||||
.popup-form {
|
||||
height: 100vh;
|
||||
.search-map {
|
||||
height: calc(100vh - 80rpx);
|
||||
width: 680rpx;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.popup-form input {
|
||||
.map-keywords {
|
||||
border-radius: 0 !important;
|
||||
padding: 0 10rpx;
|
||||
line-height: 66rpx;
|
||||
height: 66rpx;
|
||||
font-size: 26rpx;
|
||||
height: 60rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.map-nav {
|
||||
position: relative;
|
||||
}
|
||||
.map-nav .arrow-bottom {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 10rpx;
|
||||
padding-right: 46rpx;
|
||||
color: #999;
|
||||
}
|
||||
.map-item {
|
||||
background: #f0f0f0;
|
||||
line-height: 76rpx;
|
||||
}
|
||||
.map-base,
|
||||
.map-nav {
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.map-content {
|
||||
padding: 15rpx;
|
||||
line-height: 60rpx;
|
||||
background: #fbfbfb;
|
||||
border-radius: 6rpx;
|
||||
padding: 0 6rpx;
|
||||
}
|
||||
.screening-price input {
|
||||
width: calc(50% - 20px);
|
||||
.map-text-items view,
|
||||
.map-images-text-items view {
|
||||
padding: 0 15rpx;
|
||||
border-radius: 2px;
|
||||
margin: 15rpx;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.screening-price .separator {
|
||||
line-height: 50rpx;
|
||||
.map-images-text-items view {
|
||||
vertical-align: middle;
|
||||
border: 1px solid #eee;
|
||||
width: 150rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
.popup-form .item {
|
||||
width: 480rpx;
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
.map-images-text-items view image {
|
||||
width: 150rpx;
|
||||
height: calc(100% - 8rpx);
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
.popup-form .item:not(:last-child) {
|
||||
margin-bottom: 30rpx;
|
||||
.map-text-items view.active,
|
||||
.map-images-text-items view.active {
|
||||
border: 1px solid #e23f36;
|
||||
color: #e23f36;
|
||||
font-weight: bold;
|
||||
}
|
||||
.popup-form .item .title {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.popup-form .form-submit {
|
||||
.search-map .search-submit {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.map-remove-submit {
|
||||
color: #e23f36;
|
||||
}
|
||||
|
||||
/**
|
||||
* 品牌基础信息
|
||||
*/
|
||||
.brand-info {
|
||||
padding: 35rpx 15rpx;
|
||||
}
|
||||
.brand-info image,
|
||||
.brand-info .info-logo-empty {
|
||||
width: 300rpx;
|
||||
height: 130rpx;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
.brand-info .info-logo-empty {
|
||||
line-height: 130rpx;
|
||||
}
|
||||
.brand-info .info-right {
|
||||
width: calc(100% - 330rpx);
|
||||
}
|
||||
.brand-info .info-desc {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
@ -157,7 +157,7 @@
|
||||
}
|
||||
.limitedtimediscount .goods-list .item {
|
||||
width: 460rpx;
|
||||
height: 605rpx;
|
||||
height: 670rpx;
|
||||
border: 1px solid #f5f5f5;
|
||||
background: white;
|
||||
display: inline-block;
|
||||
|
||||
129
sourcecode/toutiao/default/pages/plugins/brand/index/index.js
Normal file
129
sourcecode/toutiao/default/pages/plugins/brand/index/index.js
Normal file
@ -0,0 +1,129 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
data_base: null,
|
||||
brand_list: [],
|
||||
brand_category_list: [],
|
||||
nav_active_value: 0,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
this.setData({
|
||||
params: params,
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.get_data();
|
||||
|
||||
// 显示分享菜单
|
||||
app.show_share_menu();
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data() {
|
||||
var self = this;
|
||||
tt.request({
|
||||
url: app.get_request_url("index", "index", "brand"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
tt.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
data_base: data.base || null,
|
||||
brand_list: data.brand_list || [],
|
||||
brand_category_list: data.brand_category_list || [],
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: ((data.brand_list || []).length > 0) ? 3 : 0,
|
||||
data_bottom_line_status: ((data.brand_list || []).length > 0),
|
||||
});
|
||||
|
||||
// 选中处理
|
||||
self.nav_active_handle();
|
||||
} else {
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
tt.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
nav_event(e) {
|
||||
this.setData({
|
||||
nav_active_value: e.currentTarget.dataset.value || 0,
|
||||
});
|
||||
this.nav_active_handle();
|
||||
},
|
||||
|
||||
// 导航选中处理
|
||||
nav_active_handle() {
|
||||
var value = this.data.nav_active_value;
|
||||
var temp_brand_list = this.data.brand_list;
|
||||
var count = 0;
|
||||
for(var i in temp_brand_list)
|
||||
{
|
||||
if(value == 0)
|
||||
{
|
||||
temp_brand_list[i]['is_not_show'] = 0;
|
||||
count++;
|
||||
} else {
|
||||
var is_not_show = (temp_brand_list[i]['brand_category_ids'].indexOf(value) == -1) ? 1 : 0;
|
||||
temp_brand_list[i]['is_not_show'] = is_not_show;
|
||||
if(is_not_show == 0)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
brand_list: temp_brand_list,
|
||||
data_list_loding_status: (count > 0) ? 3 : 0,
|
||||
data_bottom_line_status: (count > 0),
|
||||
});
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data_base.seo_title || '品牌 - '+app.data.application_title,
|
||||
desc: this.data.data_base.seo_desc || app.data.application_describe,
|
||||
path: '/pages/plugins/brand/index/index?referrer=' + user_id
|
||||
};
|
||||
},
|
||||
|
||||
// 分享朋友圈
|
||||
onShareTimeline() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.data_base.seo_title || '品牌 - '+app.data.application_title,
|
||||
query: 'referrer=' + user_id,
|
||||
imageUrl: this.data.data_base.right_images || ''
|
||||
};
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "品牌"
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<view tt:if="{{(data_base || null) != null}}">
|
||||
<!-- 分类 -->
|
||||
<scroll-view tt:if="{{(brand_category_list || null) != null && brand_category_list.length > 0}}" class="nav-list bg-white tc oh" scroll-x="true">
|
||||
<view class="item cr-888 {{nav_active_value == 0 ? 'active' : ''}}" bindtap="nav_event" data-value="0">全部</view>
|
||||
<block tt:for="{{brand_category_list}}" tt:key="key">
|
||||
<view class="item cr-888 {{nav_active_value == item.id ? 'active' : ''}}" bindtap="nav_event" data-value="{{item.id}}">{{item.name}}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 品牌列表 -->
|
||||
<view tt:if="{{(brand_list || null) != null && brand_list.length > 0}}" class="data-list oh spacing-mt">
|
||||
<block tt:for="{{brand_list}}" tt:key="key">
|
||||
<view tt:if="{{(item.is_not_show || 0) == 0}}" class="items bg-white">
|
||||
<navigator url="/pages/goods-search/goods-search?brand_id={{item.id}}" hover-class="none">
|
||||
<image src="{{item.logo}}" mode="aspectFit" />
|
||||
<view class="base br-t-dashed">
|
||||
<view class="single-text name tc">{{item.name}}</view>
|
||||
<view class="multi-text desc">{{item.describe}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<import src="/pages/common/bottom_line.ttml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</view>
|
||||
<view tt:if="{{data_list_loding_status != 3}}">
|
||||
<import src="/pages/common/nodata.ttml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
</view>
|
||||
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 分类导航
|
||||
*/
|
||||
.nav-list {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.nav-list .item {
|
||||
padding: 20rpx 30rpx;
|
||||
border-bottom: 3px solid #f0f0f0;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.nav-list .active {
|
||||
border-bottom: 3px solid #d2364c;
|
||||
color: #d2364c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
.data-list .items {
|
||||
width: calc(50% - 5rpx);
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.data-list .items:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.data-list .items:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.data-list .items image {
|
||||
width: 100%;
|
||||
height: 160rpx !important;
|
||||
}
|
||||
.data-list .items .base {
|
||||
padding-top: 20rpx;
|
||||
margin: 20rpx;
|
||||
}
|
||||
.data-list .items .desc {
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
min-height: 80rpx;
|
||||
}
|
||||
@ -145,6 +145,7 @@ textarea {
|
||||
min-height: 104rpx;
|
||||
line-height: 52rpx;
|
||||
font-size: 32rpx;
|
||||
white-space: initial;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -117,6 +117,21 @@ Page({
|
||||
wx.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
|
||||
// 仅首次请求赋值条件数据
|
||||
if(this.data.data_list_loding_status == 1)
|
||||
{
|
||||
this.setData({
|
||||
search_map_info: data.search_map_info || [],
|
||||
brand_list: data.brand_list || [],
|
||||
category_list: data.category_list || [],
|
||||
screening_price_list: data.screening_price_list || [],
|
||||
goods_params_list: data.goods_params_list || [],
|
||||
goods_spec_list: data.goods_spec_list || [],
|
||||
});
|
||||
}
|
||||
|
||||
// 列表数据处理
|
||||
if (data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = data.data;
|
||||
@ -127,21 +142,6 @@ Page({
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// 仅首次请求赋值条件数据
|
||||
if(this.data.data_list_loding_status == 1)
|
||||
{
|
||||
this.setData({
|
||||
search_map_info: data.search_map_info || [],
|
||||
brand_list: data.brand_list || [],
|
||||
category_list: data.category_list || [],
|
||||
screening_price_list: data.screening_price_list || [],
|
||||
goods_params_list: data.goods_params_list || [],
|
||||
goods_spec_list: data.goods_spec_list || [],
|
||||
});
|
||||
}
|
||||
|
||||
// 公共基础数据
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: data.total,
|
||||
@ -172,14 +172,12 @@ Page({
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
@ -340,7 +338,7 @@ Page({
|
||||
}
|
||||
|
||||
// 关闭条件弹层
|
||||
this.popup_form_event_close();
|
||||
data['is_show_popup_form'] = false;
|
||||
|
||||
// 分页恢复1页、重新获取数据
|
||||
data['data_page'] = 1;
|
||||
@ -352,11 +350,12 @@ Page({
|
||||
onShareAppMessage() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
var category_id = this.data.params['category_id'] || 0;
|
||||
var brand_id = this.data.params['brand_id'] || 0;
|
||||
var keywords = this.data.params['keywords'] || '';
|
||||
return {
|
||||
title: app.data.application_title,
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&keywords='+keywords
|
||||
path: '/pages/goods-search/goods-search?referrer=' + user_id+'&category_id='+category_id+'&brand_id='+brand_id+'&keywords='+keywords
|
||||
};
|
||||
},
|
||||
|
||||
@ -364,10 +363,11 @@ Page({
|
||||
onShareTimeline() {
|
||||
var user_id = app.get_user_cache_info('id', 0) || 0;
|
||||
var category_id = this.data.params['category_id'] || 0;
|
||||
var brand_id = this.data.params['brand_id'] || 0;
|
||||
var keywords = this.data.params['keywords'] || '';
|
||||
return {
|
||||
title: app.data.application_title,
|
||||
query: 'referrer=' + user_id+'&category_id='+category_id+'&keywords='+keywords
|
||||
query: 'referrer=' + user_id+'&category_id='+category_id+'&brand_id='+brand_id+'&keywords='+keywords
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@ -48,10 +48,10 @@
|
||||
</view>
|
||||
|
||||
<!-- 搜索关键字 -->
|
||||
<input type="text" placeholder="其实搜索很简单^_^ !" name="wd" value="{{(post_data.wd || '')}}" class="map-keywords" placeholder-class="cr-ccc" />
|
||||
<input type="text" placeholder="其实搜索很简单^_^ !" name="wd" value="{{(post_data.wd || '')}}" class="map-keywords wh-auto" placeholder-class="cr-ccc" />
|
||||
|
||||
<!-- 品牌 -->
|
||||
<view wx:if="{{(brand_list || null) != null && brand_list.length > 0}}" class="map-item">
|
||||
<view wx:if="{{((brand_list || null) != null && brand_list.length > 0) || ((search_map_info.brand || null) != null)}}" class="map-item">
|
||||
<view class="map-nav tc">
|
||||
<text>品牌</text>
|
||||
<text class="arrow-bottom" wx:if="{{brand_list.length > 3}}" bindtap="more_event" data-value="brand_list">更多</text>
|
||||
@ -128,8 +128,6 @@
|
||||
|
||||
<button formType="submit" class="bg-main search-submit wh-auto" disabled="{{popup_form_loading_status}}" hover-class="none">确认</button>
|
||||
</view>
|
||||
|
||||
|
||||
</form>
|
||||
</component-popup>
|
||||
|
||||
|
||||
@ -72,9 +72,8 @@
|
||||
padding: 0 10rpx;
|
||||
line-height: 66rpx;
|
||||
height: 66rpx;
|
||||
border-color: #e8e8e8;
|
||||
border-width: 1px 0;
|
||||
border-style: solid;
|
||||
font-size: 26rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.map-nav {
|
||||
position: relative;
|
||||
@ -135,7 +134,6 @@
|
||||
}
|
||||
.map-remove-submit {
|
||||
color: #e23f36;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -157,7 +157,7 @@
|
||||
}
|
||||
.limitedtimediscount .goods-list .item {
|
||||
width: 460rpx;
|
||||
height: 605rpx;
|
||||
height: 670rpx;
|
||||
border: 1px solid #f5f5f5;
|
||||
background: white;
|
||||
display: inline-block;
|
||||
|
||||
Reference in New Issue
Block a user