品牌列表开发
parent
83548819fe
commit
07eb2c5349
|
|
@ -0,0 +1,29 @@
|
||||||
|
/**
|
||||||
|
* 分类导航
|
||||||
|
*/
|
||||||
|
.nav-list {
|
||||||
|
height: 80rpx;
|
||||||
|
}
|
||||||
|
.nav-list .item {
|
||||||
|
padding: 20rpx;
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据列表
|
||||||
|
*/
|
||||||
|
.data-list .item {
|
||||||
|
width: calc(50% - 10rpx);
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
.data-list .item:nth-child(2n) {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.data-list .item:nth-child(2n+1) {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.data-list .item image {
|
||||||
|
width: 100%;
|
||||||
|
height: 160rpx !important;
|
||||||
|
}
|
||||||
|
|
@ -1,249 +1,183 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view v-if="(data_base || null) != null">
|
<view v-if="(data_base || null) != null">
|
||||||
<!-- 分类 -->
|
<!-- 分类 -->
|
||||||
<scroll-view v-if="(brand_category_list || null) != null && brand_category_list.length > 0" class="nav-list bg-white tc oh" scroll-x="true">
|
<scroll-view v-if="(brand_category_list || null) != null && brand_category_list.length > 0"
|
||||||
<view :class="'item cr-gray ' + (nav_active_value == 0 ? 'active' : '')" @tap="nav_event" data-value="0">全部</view>
|
class="nav-list scroll-view-horizontal bg-white tc oh" scroll-x="true">
|
||||||
<block v-for="(item, index) in brand_category_list" :key="index">
|
<view :class="'item cr-gray ' + (nav_active_value == 0 ? 'cr-main' : '')" @tap="nav_event"
|
||||||
<view :class="'item cr-gray ' + (nav_active_value == item.id ? 'active' : '')" @tap="nav_event" :data-value="item.id">{{item.name}}</view>
|
data-value="0">全部</view>
|
||||||
</block>
|
<block v-for="(item, index) in brand_category_list" :key="index">
|
||||||
</scroll-view>
|
<view :class="'item cr-gray ' + (nav_active_value == item.id ? 'cr-main' : '')" @tap="nav_event" :data-value="item.id">{{item.name}}</view>
|
||||||
|
</block>
|
||||||
<!-- 品牌列表 -->
|
</scroll-view>
|
||||||
<view v-if="(brand_list || null) != null && brand_list.length > 0" class="data-list oh spacing-mt">
|
|
||||||
<block v-for="(item, index) in brand_list" :key="index">
|
<!-- 品牌列表 -->
|
||||||
<view v-if="(item.is_not_show || 0) == 0" class="items bg-white">
|
<view v-if="(brand_list || null) != null && brand_list.length > 0" class="data-list padding-horizontal-main padding-top-main oh">
|
||||||
<navigator :url="'/pages/goods-search/goods-search?brand_id=' + item.id" hover-class="none">
|
<block v-for="(item, index) in brand_list" :key="index">
|
||||||
<image :src="item.logo" mode="aspectFit"></image>
|
<view v-if="(item.is_not_show || 0) == 0" class="item border-radius-main bg-white spacing-mb">
|
||||||
<view class="base br-t-dashed">
|
<navigator :url="'/pages/goods-search/goods-search?brand_id=' + item.id" hover-class="none">
|
||||||
<view class="single-text name tc">{{item.name}}</view>
|
<image :src="item.logo" mode="aspectFit"></image>
|
||||||
<view class="multi-text desc">{{item.describe}}</view>
|
<view class="padding-main tc">
|
||||||
|
<view class="single-text fw-b cr-base">{{item.name}}</view>
|
||||||
|
<view class="multi-text cr-grey margin-top-sm">{{item.describe}}</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</navigator>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 结尾 -->
|
<!-- 提示信息 -->
|
||||||
<!--<import src="/pages/common/bottom_line.wxml"></import>-->
|
<component-no-data :prop-status="data_list_loding_status"></component-no-data>
|
||||||
<block data-type="template" data-is="bottom_line" data-attr="status: data_bottom_line_status">
|
|
||||||
<view v-if="(status || false)" class="data-bottom-line">
|
|
||||||
<view class="left fl"></view>
|
<!-- 结尾 -->
|
||||||
<view class="msg fl">我是有底线的</view>
|
<component-bottom-line :prop-status="data_bottom_line_status"></component-bottom-line>
|
||||||
<view class="right fr"></view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</template>
|
||||||
</view>
|
<script>
|
||||||
<view v-if="data_list_loding_status != 3">
|
const app = getApp();
|
||||||
<!--<import src="/pages/common/nodata.wxml"></import>-->
|
import componentNoData from "../../../../components/no-data/no-data";
|
||||||
<block data-type="template" data-is="nodata" data-attr="status: data_list_loding_status, msg: data_list_loding_msg">
|
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
|
||||||
<!-- 1 加载中 -->
|
|
||||||
<view v-if="0 == 1" class="no-data-loding tc">
|
export default {
|
||||||
<text>加载中...</text>
|
data() {
|
||||||
</view>
|
return {
|
||||||
|
data_bottom_line_status: false,
|
||||||
<!-- 2 处理错误 -->
|
data_list_loding_status: 1,
|
||||||
<view v-else-if="0 == 2" class="no-data-box tc">
|
data_list_loding_msg: '',
|
||||||
<image src="/static/images/error.png" mode="widthFix"></image>
|
params: null,
|
||||||
<view class="no-data-tips">{{msg || '处理错误'}}</view>
|
data_base: null,
|
||||||
</view>
|
brand_list: [],
|
||||||
|
brand_category_list: [],
|
||||||
<!-- 0 默认没有数据 -->
|
nav_active_value: 0
|
||||||
<view v-else-if="0 == 0" class="no-data-box tc">
|
};
|
||||||
<image src="/static/images/empty.png" mode="widthFix"></image>
|
},
|
||||||
<view class="no-data-tips">{{msg || '没有相关数据'}}</view>
|
|
||||||
</view>
|
components: {
|
||||||
</block>
|
componentNoData,
|
||||||
</view>
|
componentBottomLine,
|
||||||
</view>
|
},
|
||||||
</template>
|
props: {},
|
||||||
|
|
||||||
<script>
|
onLoad(params) {
|
||||||
const app = getApp();
|
this.setData({
|
||||||
|
params: params
|
||||||
export default {
|
});
|
||||||
data() {
|
},
|
||||||
return {
|
|
||||||
data_bottom_line_status: false,
|
onShow() {
|
||||||
data_list_loding_status: 1,
|
this.get_data();
|
||||||
data_list_loding_msg: '',
|
|
||||||
params: null,
|
// 显示分享菜单
|
||||||
data_base: null,
|
app.globalData.show_share_menu();
|
||||||
brand_list: [],
|
},
|
||||||
brand_category_list: [],
|
|
||||||
nav_active_value: 0
|
// 下拉刷新
|
||||||
};
|
onPullDownRefresh() {
|
||||||
},
|
this.get_data();
|
||||||
|
},
|
||||||
components: {},
|
|
||||||
props: {},
|
// 自定义分享
|
||||||
|
onShareAppMessage() {
|
||||||
onLoad(params) {
|
var user_id = app.globalData.get_user_cache_info('id', 0) || 0;
|
||||||
this.setData({
|
return {
|
||||||
params: params
|
title: this.data_base.seo_title || '品牌 - ' + app.globalData.data.application_title,
|
||||||
});
|
desc: this.data_base.seo_desc || app.globalData.data.application_describe,
|
||||||
},
|
path: '/pages/plugins/brand/index/index?referrer=' + user_id
|
||||||
|
};
|
||||||
onShow() {
|
},
|
||||||
this.get_data(); // 显示分享菜单
|
|
||||||
|
// 分享朋友圈
|
||||||
app.globalData.show_share_menu();
|
onShareTimeline() {
|
||||||
},
|
var user_id = app.globalData.get_user_cache_info('id', 0) || 0;
|
||||||
|
return {
|
||||||
// 下拉刷新
|
title: this.data_base.seo_title || '品牌 - ' + app.globalData.data.application_title,
|
||||||
onPullDownRefresh() {
|
query: 'referrer=' + user_id,
|
||||||
this.get_data();
|
imageUrl: this.data_base.right_images || ''
|
||||||
},
|
};
|
||||||
|
},
|
||||||
// 自定义分享
|
|
||||||
onShareAppMessage() {
|
methods: {
|
||||||
var user_id = app.globalData.get_user_cache_info('id', 0) || 0;
|
// 获取数据
|
||||||
return {
|
get_data() {
|
||||||
title: this.data_base.seo_title || '品牌 - ' + app.globalData.data.application_title,
|
var self = this;
|
||||||
desc: this.data_base.seo_desc || app.globalData.data.application_describe,
|
uni.request({
|
||||||
path: '/pages/plugins/brand/index/index?referrer=' + user_id
|
url: app.globalData.get_request_url("index", "index", "brand"),
|
||||||
};
|
method: "POST",
|
||||||
},
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
// 分享朋友圈
|
success: res => {
|
||||||
onShareTimeline() {
|
uni.stopPullDownRefresh();
|
||||||
var user_id = app.globalData.get_user_cache_info('id', 0) || 0;
|
if (res.data.code == 0) {
|
||||||
return {
|
var data = res.data.data;
|
||||||
title: this.data_base.seo_title || '品牌 - ' + app.globalData.data.application_title,
|
var brand_list = data.brand_list || [];
|
||||||
query: 'referrer=' + user_id,
|
self.setData({
|
||||||
imageUrl: this.data_base.right_images || ''
|
data_base: data.base || null,
|
||||||
};
|
brand_list: brand_list,
|
||||||
},
|
brand_category_list: data.brand_category_list || [],
|
||||||
|
data_list_loding_msg: '',
|
||||||
methods: {
|
data_list_loding_status: brand_list.length > 0 ? 3 : 0,
|
||||||
// 获取数据
|
data_bottom_line_status: brand_list.length > 0
|
||||||
get_data() {
|
});
|
||||||
var self = this;
|
|
||||||
uni.request({
|
// 导航选中处理
|
||||||
url: app.globalData.get_request_url("index", "index", "brand"),
|
self.nav_active_handle();
|
||||||
method: "POST",
|
} else {
|
||||||
data: {},
|
self.setData({
|
||||||
dataType: "json",
|
data_bottom_line_status: false,
|
||||||
success: res => {
|
data_list_loding_status: 2,
|
||||||
uni.stopPullDownRefresh();
|
data_list_loding_msg: res.data.msg
|
||||||
|
});
|
||||||
if (res.data.code == 0) {
|
}
|
||||||
var data = res.data.data;
|
},
|
||||||
self.setData({
|
fail: () => {
|
||||||
data_base: data.base || null,
|
uni.stopPullDownRefresh();
|
||||||
brand_list: data.brand_list || [],
|
self.setData({
|
||||||
brand_category_list: data.brand_category_list || [],
|
data_bottom_line_status: false,
|
||||||
data_list_loding_msg: '',
|
data_list_loding_status: 2,
|
||||||
data_list_loding_status: (data.brand_list || []).length > 0 ? 3 : 0,
|
data_list_loding_msg: '服务器请求出错'
|
||||||
data_bottom_line_status: (data.brand_list || []).length > 0
|
});
|
||||||
}); // 选中处理
|
app.globalData.showToast("服务器请求出错");
|
||||||
|
}
|
||||||
self.nav_active_handle();
|
});
|
||||||
} else {
|
},
|
||||||
self.setData({
|
|
||||||
data_bottom_line_status: false,
|
// 导航事件
|
||||||
data_list_loding_status: 2,
|
nav_event(e) {
|
||||||
data_list_loding_msg: res.data.msg
|
this.setData({
|
||||||
});
|
nav_active_value: e.currentTarget.dataset.value || 0
|
||||||
}
|
});
|
||||||
},
|
this.nav_active_handle();
|
||||||
fail: () => {
|
},
|
||||||
uni.stopPullDownRefresh();
|
|
||||||
self.setData({
|
// 导航选中处理
|
||||||
data_bottom_line_status: false,
|
nav_active_handle() {
|
||||||
data_list_loding_status: 2,
|
var value = this.nav_active_value;
|
||||||
data_list_loding_msg: '服务器请求出错'
|
var temp_brand_list = this.brand_list;
|
||||||
});
|
var count = 0;
|
||||||
app.globalData.showToast("服务器请求出错");
|
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;
|
||||||
nav_event(e) {
|
temp_brand_list[i]['is_not_show'] = is_not_show;
|
||||||
this.setData({
|
if (is_not_show == 0) {
|
||||||
nav_active_value: e.currentTarget.dataset.value || 0
|
count++;
|
||||||
});
|
}
|
||||||
this.nav_active_handle();
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
// 导航选中处理
|
this.setData({
|
||||||
nav_active_handle() {
|
brand_list: temp_brand_list,
|
||||||
var value = this.nav_active_value;
|
data_list_loding_status: count > 0 ? 3 : 0,
|
||||||
var temp_brand_list = this.brand_list;
|
data_bottom_line_status: count > 0
|
||||||
var count = 0;
|
});
|
||||||
|
}
|
||||||
for (var i in temp_brand_list) {
|
}
|
||||||
if (value == 0) {
|
};
|
||||||
temp_brand_list[i]['is_not_show'] = 0;
|
</script>
|
||||||
count++;
|
<style>
|
||||||
} else {
|
@import './index.css';
|
||||||
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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
/**
|
|
||||||
* 分类导航
|
|
||||||
*/
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue