Authored by huangyi

Merge branch 'develop' of http://git.yoho.cn/mobile/tt-yoho-app into develop

Component({
properties: {
data: {
type: null,
},
onlyTextBrand: {//纯文本展示品牌 '0' 图文品牌 '1' 纯文字品牌
type: String,
value: '0'
}
},
data: {
textBrandKey:[],
textBrandData:[]
},
ready: function () {
//头条列表渲染不支持字典循环,故转换成数组 2018/12/7
if (this.properties.onlyTextBrand == '1') {
let textBrandKey = [];
let textBrandData = [];
for (const iterator of Object.keys(this.properties.data)) {
textBrandData.push(this.properties.data[iterator]);
textBrandKey.push(iterator);
}
this.setData({
textBrandData,
textBrandKey
})
}
},
methods: {
brandItemTapped: function(event) {
this.triggerEvent('brandItemTapped', event);
}
}
})
... ...
<block tt:if="{{onlyTextBrand == '0'}}">
<view class='rowType2'>
<block tt:for="{{data}}" tt:key="{{index}}" tt:for-item="item">
<view class='item' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">
<image src="{{item.brand_ico}}" class="item_img" mode="aspectFit"></image>
<text class='item_title'>{{item.brand_name}}</text>
</view>
</block>
</view>
</block>
<block tt:if="{{onlyTextBrand == '1'}}">
<view class='rowType'>
<block tt:for="{{textBrandData}}" tt:key="{{index}}" tt:for-item="item">
<view id="{{textBrandKey[index] == '0-9' ? 'last' : textBrandKey[index]}}" class='sessionTitle'>
<text class='sessionText'>{{textBrandKey[index] == '0-9' ? '0' : textBrandKey[index]}}</text>
</view>
<block tt:for="{{item}}" tt:key="{{unique}}" tt:for-item="item">
<view class='row' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">
<view class='rowContent'>
<text class='title'>{{item.brand_name}}</text>
<view class='new' tt:if="{{item.is_show_new == 'Y'}}">
<text class='text'>NEW</text>
</view>
<view class='hot' tt:if="{{item.is_hot == 'Y'}}">
<text class='text'>HOT</text>
</view>
</view>
<view class='spaceLine'/>
</view>
</block>
</block>
</view>
</block>
... ...
.rowType .sessionTitle {
display: flex;
align-items: center;
height: 58rpx;
width: 100%;
background: #F0F0F0;
}
.rowType .sessionTitle .sessionText {
text-align: left;
margin-left: 30rpx;
font-weight: bold;
font-family: PingFang SC;
font-size: 28rpx;
color: #B0B0B0;
letter-spacing: -0.39px;
}
.row {
height: 88rpx;
width: 100%;
background-color-color: white;
}
.row .rowContent {
display: flex;
align-items: center;
height: 86rpx;
width: 92%;
margin-left: 4%;
flex-direction: row;
background-color: white;
}
.row .spaceLine {
height: 2rpx;
width: 92%;
margin-left: 4%;
background-color: #F0F0F0;
}
.row .rowContent .title {
text-align: left;
max-width: 500rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-family: PingFang SC;
font-size: 28rpx;
color: #444444;
letter-spacing: -0.39px;
}
.row .rowContent .hot {
display: flex;
align-items: center;
height: 30rpx;
width: 76rpx;
margin-left: 40rpx;
justify-content: center;
background-color: #D0021B;
border-radius: 104rpx;
font-family: PingFang SC;
}
.row .rowContent .new {
display: flex;
align-items: center;
height: 30rpx;
width: 76rpx;
background-color: green;
margin-left: 40rpx;
justify-content: center;
border-radius: 104rpx;
font-family: PingFang SC;
}
.row .rowContent .hot .text {
text-align: left;
font-family: PingFang SC Medium;
font-size: 24rpx;
color: #FFFFFF;
letter-spacing: -0.33px;
}
.row .rowContent .new .text {
text-align: left;
font-family: PingFang SC Medium;
font-size: 24rpx;
color: #FFFFFF;
letter-spacing: -0.33px;
}
.rowType2 {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.rowType2 .item {
width: 224rpx;
height: 210rpx;
margin-left: 20rpx;
display: flex;
flex-direction: column;
}
.rowType2 .item .item_img{
width: 224rpx;
height: 100rpx;
margin-top: 41rpx;
}
.rowType2 .item .item_title{
width: 224rpx;
height: 30rpx;
text-align: center;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-family: PingFang SC;
font-size: 24rpx;
color: #B0B0B0;
letter-spacing: -0.33px;
margin-top: 20rpx;
}
\ No newline at end of file
... ...
... ... @@ -7,14 +7,6 @@ Component({
data: {
},
// attached: function () {
// try {
// console.log('===========Component================');
// console.log(this.properties.data);
// console.log('====================================');
// } catch(e) {
// }
// },
methods: {
onButtonTapped: function (event) {
this.triggerEvent('tapOperationBar', event);
... ...
... ... @@ -7,7 +7,16 @@ Component({
backgroudImage: "../../../images/filteritem-normal@2x.png",
},
attached: function () {
let isSelected = this.data.item.isSelected;
let backgroudImage = this.data.backgroudImage;
if(isSelected){
backgroudImage = "../../../images/filteritem-higjlight@2x.png";
}else {
backgroudImage = "../../../images/filteritem-normal@2x.png";
}
this.setData({
backgroudImage: backgroudImage,
});
},
methods: {
... ...
... ... @@ -41,8 +41,7 @@ Page({
duration: 1000,
banner: [],
custom_brands: '',
brandsTextFilter: [],
currentBrandFliter: 0,
switchData:{},
all_list: [],
hot_list: [],
... ... @@ -59,8 +58,7 @@ Page({
cacheBrandResourceDataForKid: '',
hotKeyword: {},
searching: false,
switchData:{}
searching: false
},
/**
... ... @@ -105,10 +103,15 @@ Page({
},
onReachBottom: function () {
},
switchBrandFliter: function (event) {
let currentBrandFliter = event.detail.currentTarget.dataset.brandFliter;
let brandsTextFilter = this.data.switchData.brandsTextFilter;
this.setData({
currentBrandFliter,
switchData:{brandsTextFilter,currentBrandFliter}
});
},
... ... @@ -165,9 +168,6 @@ Page({
new_list,
all_list_key,
});
console.log('============3=======================');
console.log(brandListData);
console.log('====================================');
} else {
this.fetchBrandList();
}
... ... @@ -180,8 +180,6 @@ Page({
this.setData({
banner,
custom_brands,
brandsTextFilter,
currentBrandFliter,
switchData:{brandsTextFilter,currentBrandFliter}
});
} else {
... ... @@ -203,19 +201,12 @@ Page({
api.get({data:param})
.then(data => {
let json = parseListResources(data.data);
console.log('===============1====================');
console.log(json);
console.log('====================================');
let all_list = json.all_list;
let hot_list = json.hot_list;
let new_list = json.new_list;
let all_list_key = json.all_list_key;
//记录缓存数据
let key = that.data.currentChannelId;
console.log('===============&&&====================');
console.log(key);
console.log('====================================');
if (key == 1) {
that.setData({
cacheBrandListDataForMen: json,
... ... @@ -240,6 +231,7 @@ Page({
console.log('============2=======================');
console.log(this.data.all_list);
console.log(all_list);
console.log(all_list_key);
console.log('====================================');
})
.catch(error => {
... ... @@ -292,8 +284,6 @@ Page({
that.setData({
banner,
custom_brands,
brandsTextFilter,
currentBrandFliter,
switchData:{brandsTextFilter,currentBrandFliter}
});
})
... ... @@ -343,7 +333,7 @@ Page({
},
brandItemTapped: function(event) {
let brandItem = event.currentTarget.dataset.brandItem;
let brandItem = event.detail.currentTarget.dataset.brandItem;
let shop_id = brandItem.shop_id;
if (shop_id) {
... ... @@ -374,7 +364,11 @@ Page({
handlerAlphaTap(e) {
let { ap } = e.target.dataset;
let ap = e.target.dataset.ap;
console.log('====================================');
console.log(e);
console.log(ap);
console.log('====================================');
this.setData({ scrollToView: ap });
},
... ... @@ -406,24 +400,18 @@ function parseListResources(json) {
let reg = /^[a-zA-Z]*$/;
let all_list = {};
let otherList = [];
let all_list_key = {};
let all_list_key = [];
for (let k in all_list_old) {
all_list_key.push(k);
if (reg.test(k)) {
all_list_key[k] = {
key: k,
};
all_list[k] = all_list_old[k];
} else {
Array.prototype.push.apply(otherList, all_list_old[k]);
}
}
all_list['0-9'] = otherList;
all_list_key['0-9'] = {
key: '0-9',
};
for (var i = 0; i < hot_list.length; i++) {
let item = hot_list[i];
... ... @@ -434,17 +422,12 @@ function parseListResources(json) {
let item = new_list[i];
item.brand_ico = item.brand_ico.replace(/{width}/g, 368).replace(/{height}/g, 184).replace('{mode}', 2);
}
console.log('============4=======================');
console.log(all_list);
console.log('====================================');
return {
all_list,
hot_list,
new_list,
all_list_key,
};
}
function parseResourceResources(json) {
... ...
... ... @@ -3,6 +3,7 @@
"usingComponents": {
"brandSearch": "../../components/category/brandSearch/brandSearch",
"brandSwitcher": "../../components/category/brandSwitcher/brandSwitcher",
"genderSwitcher": "../../components/category/gender-switcher/gender-switcher"
"genderSwitcher": "../../components/category/gender-switcher/gender-switcher",
"allBrandsComponent": "../../components/category/allBrands/allBrands"
}
}
\ No newline at end of file
... ...
... ... @@ -37,57 +37,20 @@
<brandSwitcher data='{{switchData}}' catchswitchBrandFliter="switchBrandFliter"></brandSwitcher>
<view>{{currentBrandFliter}}</view>
<view>{{all_list.length}}</view>
<block tt:if="{{currentBrandFliter == 0}}">
<view>{{all_list.length}}</view>
<block tt:for="{{all_list}}" tt:key="{{index}}" tt:for-item="item">
<view id="{{index == '0-9' ? 'last' : index}}" class='sessionTitle'>
<text class='sessionText'>{{index == '0-9' ? '0' : index}}</text>
</view>
<block tt:for="{{item}}" tt:key="{{unique}}" tt:for-item="item">
<view class='row' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">
<view class='rowContent'>
<text class='title'>{{item.brand_name}}</text>
<view class='new' tt:if="{{item.is_show_new == 'Y'}}">
<text class='text'>NEW</text>
</view>
<view class='hot' tt:if="{{item.is_hot == 'Y'}}">
<text class='text'>HOT</text>
</view>
</view>
<view class='spaceLine'/>
</view>
<block tt:if="{{switchData.currentBrandFliter == 0}}">
<allBrandsComponent data="{{all_list}}" onlyTextBrand="1" bindbrandItemTapped="brandItemTapped"></allBrandsComponent>
</block>
<block tt:elif="{{switchData.currentBrandFliter == 1}}">
<allBrandsComponent data="{{new_list}}" bindbrandItemTapped="brandItemTapped"></allBrandsComponent>
</block>
</block>
<block tt:elif="{{currentBrandFliter == 1}}">
<view class='rowType2'>
<block tt:for="{{new_list}}" tt:key="{{index}}" tt:for-item="item">
<view class='item' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">
<image src="{{item.brand_ico}}" class="item_img" mode="aspectFit"></image>
<text class='item_title'>{{item.brand_name}}</text>
</view>
</block>
</view>
</block>
<block tt:elif="{{currentBrandFliter == 2}}">
<view class='rowType2'>
<block tt:for="{{hot_list}}" tt:key="{{index}}" tt:for-item="item">
<view class='item' tt:if="{{item.type == 2}}" bindtap="brandItemTapped" data-brand-item="{{item}}" data-F_ID="{{1003}}" data-F_INDEX="{{3}}" data-I_INDEX="{{index}}">
<image src="{{item.brand_ico}}" class="item_img" mode="aspectFit"></image>
<text class='item_title'>{{item.brand_name}}</text>
</view>
</block>
</view>
<block tt:elif="{{switchData.currentBrandFliter == 2}}">
<allBrandsComponent data="{{hot_list}}" bindbrandItemTapped="brandItemTapped"></allBrandsComponent>
</block>
</scroll-view>
<view class="alphanet-selector" data-id="selector" catchtouchstart="handlerAlphaTap" catchtouchmove="handlerMove" tt:if="{{currentBrandFliter == 0}}">
<view class="selector-one" data-ap="{{item.key=='0-9' ? 'last' : item.key}}" tt:for="{{all_list_key}}" tt:key="unique">
{{item.key=="0-9" ? '0' : item.key}}
<view class="alphanet-selector" data-id="selector" catchtouchstart="handlerAlphaTap" catchtouchmove="handlerMove" tt:if="{{switchData.currentBrandFliter == 0}}">
<view class="selector-one" data-ap="{{item.key=='0-9' ? 'last' : item}}" tt:for="{{all_list_key}}" tt:key="unique">
{{(item=="0-9" || item=="0~9") ? '0' : item}}
</view>
</view>
</view>
... ...
... ... @@ -91,134 +91,6 @@
margin-top: 10rpx;
}
.sessionTitle {
display: flex;
align-items: center;
height: 58rpx;
width: 100%;
background: #F0F0F0;
}
.sessionTitle .sessionText {
text-align: left;
margin-left: 30rpx;
font-weight: bold;
font-family: PingFang SC;
font-size: 28rpx;
color: #B0B0B0;
letter-spacing: -0.39px;
}
.row {
height: 88rpx;
width: 100%;
background: white;
}
.row .rowContent {
display: flex;
align-items: center;
height: 86rpx;
width: 92%;
margin-left: 4%;
flex-direction: row;
background: white;
}
.row .spaceLine {
height: 2rpx;
width: 92%;
margin-left: 4%;
background: #F0F0F0;
}
.row .rowContent .title {
text-align: left;
max-width: 500rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-family: PingFang SC;
font-size: 28rpx;
color: #444444;
letter-spacing: -0.39px;
}
.row .rowContent .hot {
display: flex;
align-items: center;
height: 30rpx;
width: 76rpx;
margin-left: 40rpx;
justify-content: center;
background: #D0021B;
border-radius: 104rpx;
}
.row .rowContent .new {
display: flex;
align-items: center;
height: 30rpx;
width: 76rpx;
background: green;
margin-left: 40rpx;
justify-content: center;
border-radius: 104rpx;
}
.row .rowContent .hot .text {
text-align: left;
font-family: PingFang SC Medium;
font-size: 24rpx;
color: #FFFFFF;
letter-spacing: -0.33px;
}
.row .rowContent .new .text {
text-align: left;
font-family: PingFang SC Medium;
font-size: 24rpx;
color: #FFFFFF;
letter-spacing: -0.33px;
}
.rowType2 {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.rowType2 .item {
width: 224rpx;
height: 210rpx;
margin-left: 20rpx;
display: flex;
flex-direction: column;
}
.rowType2 .item .item_img{
width: 224rpx;
height: 100rpx;
margin-top: 41rpx;
}
.rowType2 .item .item_title{
width: 224rpx;
height: 30rpx;
text-align: center;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-family: PingFang SC;
font-size: 24rpx;
color: #B0B0B0;
letter-spacing: -0.33px;
margin-top: 20rpx;
}
.alphanet-selector {
position: absolute;
top: 0px;
... ... @@ -241,7 +113,7 @@
font-style: normal;
font-stretch: normal;
text-align: center;
font-family: PingFang SC Medium;
font-family: PingFang SC;
font-size: 22rpx;
color: #444444;
letter-spacing: 0.79px;
... ...
... ... @@ -242,7 +242,7 @@ Page({
// }
// logEvent(YB_CATEGORY_FL,param);
tt.navigateTo({
url: '../goodsList/goodsList' + queryString
url: '../productList/index' + queryString
});
},
... ...
... ... @@ -248,7 +248,7 @@ Page(extend({}, Actionsheet,{
msort: msort,
misort: misort,
page_name: this.data.current_page_name,
sharePath: '/pages/goodsList/goodsList?union_type=' + app.globalData.user_union_type + "&" + params,
sharePath: '/pages/productList/index?union_type=' + app.globalData.user_union_type + "&" + params,
sort: this.data.sort,
categoryID: this.data.current_page_param,
}
... ...
... ... @@ -48,19 +48,28 @@ Page({
},
onLoad: function (option) {
try{
console.log('====================================');
console.log(option);
console.log('====================================');
if(option){
let categoryId = option.categoryId;
let firstProductSkn = option.firstProductSkn;
// let navigate = option.navigate;
let sort = option.sort;
let subCategoryId = option.subCategoryId;
let title = option.title;
let firstProductSkn = option.firstProductSkn ? option.firstProductSkn : '';
let sort = option.sort ? option.sort : '';
let subCategoryId = option.subCategoryId ? option.subCategoryId : '';
let title = option.title ? option.title : '';
let gender = option.gender ? option.gender : '';
console.log("categoryId:"+categoryId+"==subCategoryId:"+subCategoryId+"==sort:"+sort+"==firstProductSkn:"+firstProductSkn);
this.data.categoryId = option.categoryId;
this.data.subCategoryId = option.subCategoryId;
this.data.sort = option.sort;
this.data.firstProductSkn = option.firstProductSkn;
this.data.categoryId = categoryId;
this.data.subCategoryId = subCategoryId;
this.data.sort = sort;
this.data.firstProductSkn = firstProductSkn;
this.data.title = title;
this.data.gender = gender;
tt.setNavigationBarTitle({
title: title
});
}
let systemInfo = tt.getSystemInfoSync();
let contentWidth = systemInfo.screenWidth;
... ... @@ -77,7 +86,7 @@ Page({
let tab = this.data.tabs[0];
// let filterParams = this.data.filterParams;
this.fechProductList(tab,1);
this.fechFilter();
// this.fechFilter();
},
onShow: function () {
if(this.data.isRefresh){
... ... @@ -95,7 +104,6 @@ Page({
let tab = this.data.tabs[current];
this.fechProductList(tab,1);
}
}
},
onTabClick: function (e) {
... ... @@ -119,7 +127,6 @@ Page({
if(tabData && tabData.page){
page = tabData.page;
}
// let filterParams = {};
this.fechProductList(tab,page);
}
... ... @@ -130,7 +137,6 @@ Page({
let orderType = tab.iconType;
let iconUrl = tab.iconUrl;
let order = "s_p_desc";
// console.log("id:"+id+"===orderType:"+orderType);
//设置是否显示加载中
let thatTabs = this.data.tabs;
... ... @@ -159,16 +165,18 @@ Page({
let categoryId = that.data.categoryId;
let subCategoryId = that.data.subCategoryId;
let firstProductSkn = that.data.firstProductSkn;
let title = that.data.title;
let gender = that.data.gender;
let param = {
method: "app.search.category",
firstProductSkn: firstProductSkn,
gender:"1,3",
limit: 10,
gender,
limit: 60,
page: currentPage,
sort: sort,
subCategoryId: subCategoryId,
title: "POLO",
order: order,
categoryId,
subCategoryId,
title
}
let params = Object.assign(filterParams, param);
api.get({data: params})
... ... @@ -219,126 +227,4 @@ Page({
}
},
fechFilter: function() {
let that = this;
let sort = that.data.sort;
let categoryId = that.data.categoryId;
let subCategoryId = that.data.subCategoryId;
let firstProductSkn = that.data.firstProductSkn;
let params = {
categoryId: categoryId,
firstProductSkn: firstProductSkn,
limit: 20,
method: "app.search.category.filter",
new_filter: 1,
// order: "",
page: 1,
sort: sort,
subCategoryId: subCategoryId,
}
api.get({data: params})
.then(data => {
let filter = data.data.filter;
let newFilter = this.parseFilter(filter);
that.setData({
filter: newFilter,
});
});
},
parseFilter: function (filter){
let newFilter = [];
for(var i = 0; i < filter.length; i++){
let itemList = filter[i].itemList;
// let newItemList = [];
for(var j = 0; j < itemList.length; j++){
let item = itemList[j];
let columnIndex = j % 3;
item.columnIndex = columnIndex;
item.subItemIndex = j;
item.itemIndex = i;
// newItemList.push(item)
}
// newFilter.push(newItemList);
}
let new_filter = filter;
return new_filter
},
onItemClick: function(e) {
let subItem = e.detail;
if(subItem){
let subItemIndex = subItem.subItemIndex;
let itemIndex = subItem.itemIndex;
let itemId = subItem.itemId;
let itemName = subItem.itemName;
let itemIsSelected = subItem.isSelected;
let filter = this.data.filter;
let itemInfo = filter[itemIndex];
//已经选择的信息。默认为undefind
let itemSelectedName = itemInfo.selectedName;
let itemSelectedId = itemInfo.selectedId;
//当前选择的信息
let currentSelectedName = subItem.itemName+",";
let currentSelectedId = subItem.itemId+",";
//即将选择的信息
let futureSelectedId = "";
let futureSelectedName = "";
//已经有选择项
if(itemSelectedId) {
//取消该选择项
if(!itemIsSelected) {
futureSelectedId = itemSelectedId.replace(currentSelectedId,"");
futureSelectedName = itemSelectedName.replace(currentSelectedName,"");
}else {//添加该选项
futureSelectedId = itemSelectedId+currentSelectedId;
futureSelectedName = itemSelectedName+currentSelectedName;
}
}else {
futureSelectedId = currentSelectedId;
futureSelectedName = currentSelectedName;
}
console.log("itemIsSelected:"+itemIsSelected+"==futureSelectedId:"+futureSelectedId)
itemInfo.itemList[subItemIndex] = subItem;
itemInfo.selectedName = futureSelectedName;
itemInfo.selectedId = futureSelectedId;
//用于搜索
itemInfo.selectedIdParam = futureSelectedId.substring(0, futureSelectedId.lastIndexOf(','));
//用于显示
itemInfo.selectedNameStr = futureSelectedName.substring(0, futureSelectedName.lastIndexOf(','));
filter[itemIndex] = itemInfo;
this.setData({
filter: filter,
});
console.log(itemId)
}
},
onShowItem: function(e) {
let detail = e.detail;
console.log("itemIndex:"+itemIndex);
let itemIndex = detail.itemIndex;
let filter = this.data.filter;
let itemInfo = filter[itemIndex];
let isShowItem = itemInfo.isShowItem;
if(isShowItem){
itemInfo.isShowItem = false;
}else {
itemInfo.isShowItem = true;
}
this.setData({
filter: filter,
});
},
})
\ No newline at end of file
... ...
... ... @@ -4,23 +4,56 @@ Page({
filter: []
},
onLoad: function (option) {
if(option){
this.data.categoryId = option.categoryId;
this.data.subCategoryId = option.subCategoryId;
this.data.sort = option.sort;
this.data.firstProductSkn = option.firstProductSkn;
}
//获取已经选择的筛选数据
let pages = getCurrentPages();
let length =pages.length;
let selectedFilter = [];
if(length > 1){
let lastPageData = pages[length - 2].data;
let filter = lastPageData.filter;
let newFilter = this.parseFilter(filter);
selectedFilter = lastPageData.filter;
}
//有筛选数据使用筛选数据,没有筛选数据使用接口请求的数据
if(selectedFilter && selectedFilter.length > 0){
this.setData({
filter: newFilter,
filter: selectedFilter,
});
}else {
if(option){
this.fechFilter(option);
}
}
},
fechFilter: function(option) {
console.log('====================================');
console.log(option);
console.log('====================================');
let that = this;
let sort = option.sort ? option.sort : '';
let categoryId = option.categoryId ? option.categoryId : '';
let subCategoryId = option.subCategoryId ? option.subCategoryId : '';
let firstProductSkn = option.firstProductSkn ? option.firstProductSkn : '';
let query = option.query ? option.query : '';
let method = option.method ? option.method : "app.search.category.filter";
let params = {
categoryId,
firstProductSkn,
method,
query,
new_filter: 1,
// order: "",
sort,
subCategoryId,
}
api.get({data: params})
.then(data => {
let filter = data.data.filter;
let newFilter = this.parseFilter(filter);
that.setData({
filter: newFilter,
});
});
},
parseFilter: function (filter){
... ... @@ -35,7 +68,6 @@ Page({
item.itemIndex = i;
}
}
let new_filter = filter;
return new_filter
},
... ... @@ -93,6 +125,11 @@ Page({
let pages = getCurrentPages();
let length =pages.length;
if(length > 1){
let filterParams = pages[length - 2].data.filterParams;
let itemId = itemInfo.filterId;
let selectedIdParam = itemInfo.selectedIdParam;
filterParams[itemId] = selectedIdParam;
pages[length - 2].data.filterParams = filterParams;
pages[length - 2].data.filter = filter;
}
}
... ... @@ -121,6 +158,8 @@ Page({
let actionId = detail.actionId;
//取消
let pages = getCurrentPages();
let length =pages.length;
if(actionId === 2){
let filterparams = {}
let filter = this.data.filter;
... ... @@ -132,13 +171,15 @@ Page({
filterparams[filterId] = filterValue;
}
}
let pages = getCurrentPages();
let length =pages.length;
if(length > 1){
pages[length - 2].data.isRefresh = true;
}
}else {
this.data.filterParams = {};
if(length > 1){
pages[length - 2].data.filterParams = {};
}
}
//返回上一页
tt.navigateBack({
... ...
{
"navigationBarTitleText": "筛选",
"usingComponents": {
"proFilter": "../../components/productFilter/proFilter",
"filter-item": "../../components/productFilter/item/filter-item",
"filter-title": "../../components/productFilter/item/filter-title"
}
}
\ No newline at end of file
... ...
... ... @@ -558,11 +558,8 @@ Page(extend({}, Actionsheet,{
},
jumpToFilterPage: function () {
let params = Object.assign({ method: 'miniapp.search.fuzzy.filter' }, this.data.keyword_param);
let storageKey = this.data.filterStorageKey;
let paramString = JSON.stringify(params);
tt.navigateTo({
url: '../goodsList/productListFilterPage?storageKey=' + storageKey + '&params=' + paramString
url: '../productListFilter/filter?storageKey=' + this.data.filterStorageKey + '&method=' + 'miniapp.search.fuzzy.filter' + '&query=' + this.data.keyword
})
},
... ...
... ... @@ -6,7 +6,7 @@ import router from './router';
const ACTION_TYPE = {
h5: 'go.h5',
goodsList: 'go.list',
productList: 'go.list',
brandStore: 'go.shop',
}
... ... @@ -63,13 +63,13 @@ export default {
this.go('webview', yohobuy);
break;
}
case ACTION_TYPE.goodsList: {
case ACTION_TYPE.productList: {
let yohobuy = {
...yoho.params,
url: yoho.params.url,
action: yoho.action
}
this.go('goodsList', yohobuy);
this.go('productList', yohobuy);
break;
}
case ACTION_TYPE.brandStore: {
... ...
... ... @@ -2,8 +2,8 @@ export default {
home: {
path: '../index/index'
},
goodsList: {
path: '../goodsList/goodsList'
productList: {
path: '../productList/index'
},
brandStore: {
path: '../goodsList/brandStore'
... ...