品牌增强

This commit is contained in:
Devil
2021-01-11 22:38:52 +08:00
parent b21d8c116a
commit a5cb32fe95
25 changed files with 275 additions and 74 deletions

View File

@ -91,6 +91,7 @@ Page({
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;
// 获取数据
my.request({

View File

@ -66,9 +66,6 @@ button.login-submit {
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}

View File

@ -110,9 +110,6 @@
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}

View File

@ -91,6 +91,7 @@ Page({
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;
// 获取数据
swan.request({

View File

@ -66,9 +66,6 @@ button.login-submit {
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}

View File

@ -110,9 +110,6 @@
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}

View File

@ -91,6 +91,7 @@ Page({
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;
// 获取数据
qq.request({

View File

@ -66,9 +66,6 @@ button.login-submit {
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}

View File

@ -110,9 +110,6 @@
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}

View File

@ -91,6 +91,7 @@ Page({
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;
// 获取数据
tt.request({

View File

@ -66,9 +66,6 @@ button.login-submit {
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}

View File

@ -110,9 +110,6 @@
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}

View File

@ -79,7 +79,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"
],
"permission": {
"scope.userLocation": {

View File

@ -94,6 +94,7 @@ Page({
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;
// 获取数据
wx.request({

View 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;
wx.request({
url: app.get_request_url("index", "index", "brand"),
method: "POST",
data: {},
dataType: "json",
success: res => {
wx.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: () => {
wx.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 || ''
};
},
});

View File

@ -0,0 +1,4 @@
{
"enablePullDownRefresh": true,
"navigationBarTitleText": "品牌"
}

View File

@ -0,0 +1,32 @@
<view wx:if="{{(data_base || null) != null}}">
<!-- 分类 -->
<scroll-view wx: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 wx:for="{{brand_category_list}}" wx: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 wx:if="{{(brand_list || null) != null && brand_list.length > 0}}" class="data-list oh spacing-mt">
<block wx:for="{{brand_list}}" wx:key="key">
<view wx: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.wxml" />
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
</view>
<view wx:if="{{data_list_loding_status != 3}}">
<import src="/pages/common/nodata.wxml" />
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
</view>

View File

@ -0,0 +1,45 @@
/**
* 分类导航
*/
.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;
}

View File

@ -66,9 +66,6 @@ button.login-submit {
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}

View File

@ -110,9 +110,6 @@
/**
* 商品列表
*/
.scroll-box {
height: calc(100vh - 80rpx);
}
.data-list {
overflow: hidden;
}