Authored by 肖亚东

文件调整删除无用文件等处理 — review by 黄敬囿

Showing 55 changed files with 38 additions and 1076 deletions
... ... @@ -6,20 +6,18 @@
"pages/userCenter/userCenter",
"pages/productList/index",
"pages/productListFilter/filter",
"pages/goodsList/goodsList",
"pages/webview/webview",
"pages/category/brands",
"pages/goodsList/brandStore",
"pages/brandStore/brandStore",
"pages/search/search",
"pages/goodsList/productListFilterPage",
"pages/goodsList/brand",
"pages/brandStore/brand",
"pages/userCenter/serviceFeedBack/serviceFeedBack",
"pages/userCenter/addressManager/addressManager",
"pages/userCenter/addressManager/addressEditer/addressEditer",
"pages/orders/orders",
"pages/orders/antifraud/antifraud",
"pages/orders/orderDetail/orderDetail",
"pages/goodsList/newArrival",
"pages/orders/newArrival",
"pages/goodsDetail/goodsDetail",
"pages/shopCart/giftPage"
... ... @@ -47,7 +45,7 @@
"pagePath": "pages/category/category",
"iconPath": "images/tabbar_bl_n@3x.png",
"selectedIconPath": "images/tabbar_bl_h@3x.png",
"text": "类"
"text": "类"
}, {
"pagePath": "pages/shopCart/shopCart",
"iconPath": "images/tabbar_gwc_n@2x.png",
... ...
... ... @@ -105,7 +105,7 @@ Component({
this.triggerEvent('dismissSearchView', {});
// console.log(event.currentTarget.dataset)
tt.navigateTo({
url: '../goodsList/brand?brandId=' + brandItem.brandId + '&brandName=' + brandItem.brandName + '&page_name=' + 'brands' + '&page_param=' + ''
url: '../brandStore/brand?brandId=' + brandItem.brandId + '&brandName=' + brandItem.brandName + '&page_name=' + 'brands' + '&page_param=' + ''
});
},
... ... @@ -115,7 +115,7 @@ Component({
this.triggerEvent('dismissSearchView', {});
// console.log(event.currentTarget.dataset)
tt.navigateTo({
url: '../goodsList/brandStore?shop_id=' + brandItem.shop_id + '&shop_name' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + ''
url: '../brandStore/brandStore?shop_id=' + brandItem.shop_id + '&shop_name' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + ''
});
},
... ... @@ -160,7 +160,7 @@ Component({
this.triggerEvent('dismissSearchView', {});
tt.navigateTo({
url: '../goodsList/brandStore?shop_id=' + brandItem.shop_id + '&shop_name' + brandItem.brand_name
url: '../brandStore/brandStore?shop_id=' + brandItem.shop_id + '&shop_name' + brandItem.brand_name
});
},
}
... ...
// pages/goodsList/FilterComponent.js
// import { postFormId } from '../../libs/formIdCollectRequest.js'
Component({
... ...
<!--pages/goodsList/FilterComponent.wxml-->
<form bindsubmit="formSubmit" report-submit='true'>
<view class="container" catchtouchmove="touchMove">
... ...
/* pages/goodsList/FilterComponent.wxss */
.container {
width: 100%;
height: 90rpx;
... ...
// pages/goodsList/productListFilterItemsComponent.js
Component({
/**
* 组件的属性列表
... ...
<!--pages/goodsList/productListFilterItemsComponent.wxml-->
<view class="container">
<view class="items-content">
<block tt:for="{{list}}" tt:key="filter-items">
... ...
/* pages/goodsList/productListFilterItemsComponent.wxss */
.container {
width: 100%;
}
... ...
// pages/goodsList/brandshop.js
import api from '../../common/api.js';
import { getShopID } from '../../utils/util';
... ... @@ -362,7 +362,7 @@ Page(extend({}, Actionsheet, {
default_image,
page_name: this.data.current_page_name,
shop_id: this.data.shop_id,
sharePath: '/pages/goodsList/brandStore?shopId=' + that.data.shop_id + '&union_type=' + app.globalData.user_union_type,//联盟分享页面 分享路径
sharePath: '/pages/brandStore/brandStore?shopId=' + that.data.shop_id + '&union_type=' + app.globalData.user_union_type,//联盟分享页面 分享路径
}
let params = {
... ... @@ -401,7 +401,7 @@ Page(extend({}, Actionsheet, {
SHARE_RESUIL: 0,
TITLE: that.data.shop_name,
DESC: '我在有货发现了一个不错的店铺,赶快来看看吧!',
PATH: '/pages/goodsList/brandStore?shopId=' + that.data.shop_id,
PATH: '/pages/brandStore/brandStore?shopId=' + that.data.shop_id,
}
// 用户点击右上角分享
... ...
... ... @@ -332,12 +332,12 @@ Page({
let shop_id = brandItem.shop_id;
if (shop_id) {
tt.navigateTo({
url: '../goodsList/brandStore?shop_id=' + shop_id + '&shop_name' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + ''
url: '../brandStore/brandStore?shop_id=' + shop_id + '&shop_name' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + ''
});
}else{
shop_id = brandItem.id;
tt.navigateTo({
url: '../goodsList/brand?brandId=' + shop_id + '&brandName=' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + ''
url: '../brandStore/brand?brandId=' + shop_id + '&brandName=' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + ''
});
}
... ... @@ -350,7 +350,7 @@ Page({
// F_INDEX,
// I_INDEX,
// BRD_CATE: this.data.currentBrandFliter,
// F_URL: '../goodsList/brandStore?shop_id=' + shop_id + '&shop_name' + brandItem.brand_name,
// F_URL: '../brandStore/brandStore?shop_id=' + shop_id + '&shop_name' + brandItem.brand_name,
// SHOP_ID: shop_id,
// };
// logEvent(YB_BRAND_FLR_C, params);
... ...
<!-- 点击分类侧边栏的品牌加载页面 -->
<view tt:if="{{searching}}">
<brandSearch id="brandSearch" all_list="{{all_list}}" hotKeyword="{{hotKeyword}}" bind:dismissSearchView="dismissSearchView"></brandSearch>
</view>
... ...
... ... @@ -347,11 +347,11 @@ Page({
// logEvent(YB_CATEGORY_FL, param);
if (data && data.shop_id) {
tt.navigateTo({
url: '../goodsList/brandStore?shopId=' + data.shop_id + '&shopName=' + data.brand_name
url: '../brandStore/brandStore?shopId=' + data.shop_id + '&shopName=' + data.brand_name
});
} else {
tt.navigateTo({
url: '../goodsList/brand?brandId=' + data.id + '&brandName=' + data.brand_name
url: '../brandStore/brand?brandId=' + data.id + '&brandName=' + data.brand_name
});
}
... ...
import api from '../../common/api.js';
import { parseBrandListData } from '../../utils/productListUtil';
import { shouldDiscardTap } from '../../utils/util';
import queryString from '../../vendors/query-string';
const { Actionsheet, extend } = require('../../vendors/zanui/index');
import { getQRCodeSource } from '../../utils/miniQRCodeRoute.js'
// import { jumpByUrl } from '../../libs/urlRoute';
// import {
// logEvent,
// YB_PAGE_OPEN_L,
// YB_SHARE_RESULT_L
// } from '../../libs/analytics.js'
//获取应用实例
let app = getApp();
const screenHeight = app.globalData.systemInfo.screenHeight;
const windowWidth = app.globalData.systemInfo.windowWidth;
const windowHeight = app.globalData.systemInfo.windowHeight;
let PV_ID = new Date().getTime() + '';
Page(extend({}, Actionsheet,{
data:{
lastTapTimeStamp: 0,
screenHeight,
windowHeight,
from_page_name: '',
from_page_param: '',
current_page_name: 'goodsList',
current_page_param: '',
title: '',
page_param: {},
origin_param: {},
list: {
isLoading: false,
error: null,
data: null,
pageSize: 60,
currentPage: 0,
pageCount: 0,
total: 0,
endReached: false,
},
isShowIndicator: false,
scrollTop: 0,
filterStorageKey: '',
isUnionShare: false,
msort: '',
misort: '',
sort: '',
isShowSnapshoot: false,
snapshootShareData: {},
actionsheet: {
componentId: 'shareActionSheet',
show: false,
closeOnClickOverlay: true,
isNewShareStyle: true,
cancelText: '取消',
actions: []
},
},
onLoad:function(options){
if (options && options.scene && options.scene.length == 32) {
let code = options.scene;
getQRCodeSource(code).then(json => {
if (json) {
this.loadElement(json);
}
})
.catch(error => {
});
}else {
this.loadElement(options);
}
},
onReady:function(){
// 生命周期函数--监听页面初次渲染完成
tt.setNavigationBarTitle({
title: this.data.title,
});
},
onShow:function(){
// 生命周期函数--监听页面显示
},
onHide:function(){
// 生命周期函数--监听页面隐藏
},
onUnload:function(){
// 生命周期函数--监听页面卸载
var key = this.data.filterStorageKey;
tt.removeStorage({
key: key,
success: function(res) {
},
})
},
onPullDownRefresh: function() {
// 页面相关事件处理函数--监听用户下拉动作
// let params = {
// PAGE_NAME: this.data.current_page_name,
// PAGE_PARAM: this.data.current_page_param,
// FROM_PAGE_NAME: this.data.from_page_name,
// FROM_PAGE_PARAM: this.data.from_page_param,
// PV_ID: PV_ID,
// };
// logEvent(YB_PAGE_OPEN_L, params);
},
loadMore: function() {
// 页面上拉触底事件的处理函数
this.fetchListData();
},
loadElement(options){
// 生命周期函数--监听页面加载
// console.log('before',options)
if(options.gender){
options.gender = decodeURIComponent(options.gender);
}
if(options.title){
options.title = decodeURIComponent(options.title);
}
let title = options.title;
let page_param = options;
let from_page_name = options.page_name ? options.page_name : '';
let from_page_param = options.page_param ? options.page_param : '';
let current_page_param = options.categoryId ? options.categoryId:'';
let cagetoryID = options.categoryId ? options.categoryId : options.msort + options.misort;
let filterStorageKey = 'category_storageKey_' + cagetoryID
let isUnionShare = app.globalData.user_union_type ? true : false;//user_union_type 有值 需要显示 联盟share按钮
let msort = options.msort ? options.msort : '';
let misort = options.misort ? options.misort : '';
let sort = options.sort ? options.sort : '';
//解析渠道号
let unionType = options.union_type ? options.union_type : '';
if (unionType) {
app.updateUnionType(unionType);
}
// console.log(options)
// console.log('goodsList')
if (page_param.sort) {
delete page_param["misort"];
delete page_param["msort"];
}
this.setData({
title,
page_param,
origin_param: { ...options },
from_page_name,
from_page_param,
current_page_param,
filterStorageKey,
isUnionShare,
msort,
misort,
sort,
});
var pages = getCurrentPages()
var currentPage = pages[pages.length - 1]
var url = currentPage.route
// let params = {
// PAGE_NAME: this.data.current_page_name,
// PAGE_PARAM: this.data.current_page_param,
// FROM_PAGE_NAME: this.data.from_page_name,
// FROM_PAGE_PARAM: this.data.from_page_param,
// PV_ID: PV_ID,
// PAGE_PATH: url
// };
// logEvent(YB_PAGE_OPEN_L, params);
this.fetchListData();
tt.setNavigationBarTitle({
title: this.data.title,
});
this.setShareSettingDatafunction();
},
setShareSettingDatafunction(){
if (app.globalData.user_union_type) {//user_union_type_imageUrl
let actionsheet = this.data.actionsheet;
let actionsheetParam = [
{
name: '分享给朋友',
className: 'action-class',
loading: false,
openType: 'share',
image_src: '../../images/share_union_wechat@2x.png'
},
{
// name: '生成卡片并分享',
name: '生成海报分享',
className: 'action-class',
loading: false,
image_src: '../../images/share_union_wxpeng@2x.png'
}
];
actionsheet.unionUserImageUrl = app.globalData.user_union_type_imageUrl
actionsheet.actions = actionsheetParam;
this.setData({
actionsheet,
})
this.setUnionShareSnapData();
}
},
//设置生成快照的数据
setUnionShareSnapData:function(){
let params = queryString.stringify(this.data.page_param, { encode: false });
let shareInfo = app.globalData.shareInfo;
let user_union_type = app.globalData.user_union_type ? app.globalData.user_union_type : '';
let title = shareInfo ? shareInfo.title : '';
let misort = this.data.misort ? this.data.misort : '';
let msort = this.data.msort ? this.data.msort : '';
var default_image = '';
let page_param = this.data.page_param;
page_param['union_type'] = user_union_type;
// console.log('zjj',shareInfo)
let union_qrCode = API_HOST + '/wechat/miniapp/img-check.jpg?param=' + encodeURIComponent(JSON.stringify(page_param)) + '&miniQrType=6';
var shareData = {
title: title,
goodListName: this.data.title,
content: shareInfo ? shareInfo.content : '',
default_image: shareInfo ? shareInfo.bigImage : '',
union_qrCode,
msort: msort,
misort: misort,
page_name: this.data.current_page_name,
sharePath: '/pages/productList/index?union_type=' + app.globalData.user_union_type + "&" + params,
sort: this.data.sort,
categoryID: this.data.current_page_param,
}
this.setData({
snapshootShareData:shareData
})
},
onShareAppMessage: function (res) {
let param = {
FROM: res.from,
SHARE_RESUIL: 0,
TITLE: '创建推广',
DESC: this.data.snapshootShareData.content,
PATH: this.data.snapshootShareData.sharePath,
SHARE_TYPE: 1,
}
return {
title: this.data.title ? this.data.title : this.data.snapshootShareData.title ? this.data.snapshootShareData.title:param.TITLE, // 分享标题
imageUrl: this.data.snapshootShareData.default_image,
desc: this.data.snapshootShareData.content, // 分享描述
path: this.data.snapshootShareData.sharePath, // 分享路径
success: function (res) {
// param.SHARE_RESUIL = 1
// logEvent(YB_SHARE_RESULT_L, param);
},
fail: function (res) {
// param.SHARE_RESUIL = 2
// logEvent(YB_SHARE_RESULT_L, param);
}
}
},
//品牌商品列表
fetchListData: function() {
if (this.data.list.isLoading || this.data.list.endReached) {
return;
}
let page = this.data.list.currentPage + 1;
let param = {
method: 'app.search.category',
page,
limit: this.data.list.pageSize
}
Object.assign(param, this.data.page_param);
let list = Object.assign(this.data.list, {isLoading: true,});
this.setData({list});
api.get({data:param})
.then(json => {
if (!json || !json.code || json.code != 200) {
let list = Object.assign(this.data.list, {isLoading: false, error: {code: json.code, message: json.message}});
this.setData({list});
return;
}
json = json.data;
let currentPage = json && json.page ? json.page : 1;
let pageCount = json && json.page_total ? json.page_total : 0;
let total = json && json.total ? json.total : 0;
let endReached = currentPage == pageCount;
let data = json.product_list;
data = parseBrandListData(data);
if (currentPage > 1) {
let oldList = this.data.list.data;
data = [...oldList, ...data];
}
let newList = {
isLoading: false,
data,
currentPage,
pageCount,
total,
endReached,
};
let list = Object.assign(this.data.list, newList);
this.setData({list});
})
.catch(error => {
let list = Object.assign(this.data.list, {isLoading: false, error,});
this.setData({list});
});
},
//点击筛选
updateProductList: function(event) {
var order = event.detail.order;
var param = {
order
}
this.updateProductListWithFilterParam(param);
},
jumpToFilterPage: function() {
let params = Object.assign({method: 'app.search.category.filter'},this.data.origin_param);
let storageKey = this.data.filterStorageKey;
let paramString = JSON.stringify(params);
tt.navigateTo({
url: './productListFilterPage?storageKey=' + storageKey + '&params=' + paramString
})
},
updateProductListWithFilterParam: function(param) {
let page_param = this.data.page_param;
page_param = Object.assign(page_param, param);
let newList = Object.assign(this.data.list, { currentPage: 0, pageCount: 0, total: 0, endReached: false, });
this.setData({
page_param,
list: newList
});
this.fetchListData();
},
onScroll: function(e) {
var { scrollTop } = e.detail;
var isShow = scrollTop > windowHeight * 2 ? true : false;
if (isShow != this.data.isShowIndicator) {
this.setData({
isShowIndicator: isShow
});
}
},
backToTop: function () {
this.setData({
scrollTop: 0
})
},
hiddenSheet: function () {
this.setData({
isShowSnapshoot: false
})
},
handleZanActionsheetCancel({ componentId }) {
this.setData({
'actionsheet.show': false
})
},
handlerJumpToUnionUrl() {
// this.setData({
// 'actionsheet.show': false
// })
// jumpByUrl("https://activity.yoho.cn/feature/2213.html?title=说明详情&openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"title\":\"说明详情\",\"url\":\"https://activity.yoho.cn/feature/2213.html\"}}", this.data.current_page_name)
},
// 当行动按钮中有一个被点击时触发
// index 代表被点击按钮在传入参数 actions 中的位置
handleZanActionsheetClick({ componentId, index }) {
this.setData({
'actionsheet.show': false
})
if (index === 1) {
this.setData({
isShowSnapshoot: true
})
}
},
//进入创建联盟分享页面
unionShare: function() {
this.setData({
'actionsheet.show': true
})
// let params = queryString.stringify(this.data.page_param, { encode: false });
// let shareInfo = app.globalData.shareInfo;
// let user_union_type = app.globalData.user_union_type ? app.globalData.user_union_type : '';
// let title = shareInfo ? shareInfo.title : '';
// let misort = this.data.misort ? this.data.misort : '';
// let msort = this.data.msort ? this.data.msort : '';
// var default_image = '';
// let page_param = this.data.page_param;
// page_param['union_type'] = user_union_type;
// let union_qrCode = API_HOST + '/wechat/miniapp/img-check.jpg?param=' + encodeURIComponent(JSON.stringify(page_param)) + '&miniQrType=6';
// var shareData = {
// title: title,
// goodListName: this.data.title,
// content: shareInfo ? shareInfo.content : '',
// default_image: shareInfo ? shareInfo.bigImage : '',
// union_qrCode,
// msort: msort,
// misort: misort,
// page_name: this.data.current_page_name,
// sharePath: '/pages/goodsList/goodsList?union_type=' + app.globalData.user_union_type + "&" + params,
// sort: this.data.sort,
// categoryID: this.data.current_page_param,
// }
// var timestamp = Date.parse(new Date());
// try {
// tt.setStorageSync(timestamp + '', shareData);
// } catch (e) {
// }
// tt.navigateTo({
// url: '../../page/subPackage/pages/unionShare/unionShare?timestamp=' + timestamp + '&page_name=' + this.data.current_page_name + '&page_param=' + this.data.current_page_param,
// })
}
}))
\ No newline at end of file
{
"navigationBarTitleText": " ",
"usingComponents": {
"filterComponent": "../../components/category/filterComponent/filterComponent",
"productCell": "../../components/productList/productCell"
}
}
\ No newline at end of file
<scroll-view scroll-y style="height: {{screenHeight - 50}}px;" bindscrolltolower="loadMore" bindscroll="onScroll" scroll-top="{{scrollTop}}" enable-back-to-top="true">
<view class="fixedFilter">
<filterComponent id='filterComponent' bind:updateProductList="updateProductList" bind:jumpToFilterPage="jumpToFilterPage"></filterComponent>
</view>
<block tt:if="{{list.data&&list.data.length == 0}}">
<view class='noContentClass'>
<image class='nosearch-ic' src="../search/images/nosearch-ic@3x.png"></image>
<view class='noContent'>未找到符合条件的商品</view>
</view>
</block>
<view class="productListContainer">
<block tt:for="{{list.data}}" tt:key="{{index}}">
<productCell item="{{item}}" page-name="{{current_page_name}}"></productCell>
</block>
</view>
<view class="loadMore" tt:if="{{list.data.length > 0 && list.isLoading && !list.endReached}}">
<text class="loadText">加载中...</text>
</view>
<view class="loadMore" tt:if="{{list.endReached}}">
<text class="loadText">没有更多了</text>
</view>
<loading tt:if="{{list.currentPage == 0 && list.isLoading}}">加载中</loading>
</scroll-view>
<!-- <quickNavigation id="quickNavigation" isShowIndicator="{{isShowIndicator}}" isUnionShare="{{isUnionShare}}" bind:unionShare="unionShare" bind:backToTop="backToTop"></quickNavigation>
<template is="zan-actionsheet" data="{{...actionsheet}}" />
<snapshootShare id="snapshootShare" isShow="{{isShowSnapshoot}}" sourceType="list_union" shareData="{{snapshootShareData}}" bind:hiddenSheet="hiddenSheet"></snapshootShare> -->
.productListContainer {
/*position: absolute;*/
/*top: 90rpx;*/
margin-top: 90rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
background-color: white;
}
.fixedFilter {
position: fixed;
top: -1rpx;
left: 0rx;
height: 90rpx;
width: 100%;
background-color: white;
z-index: 999;
border-bottom: 1rpx #e5e5e5 solid;
}
.loadMore {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
width: 100%;
height: 88rpx;
}
.loadText {
margin-left: 10;
color: #b1b1b1;
text-align: center;
font-size: 28rpx;
}
.noContentClass{
display: flex;
flex-direction: column;
align-items: center;
width:100%;
margin-top: 158rpx;
}
.noContentClass .nosearch-ic {
width:204rpx;
height:204rpx;
margin-top:200rpx
}
.noContentClass .noContent{
font-size:24rpx;
text-align:center;
margin-top:21rpx;
color: #444444;
}
import api from '../../common/api.js';
let app = getApp();
const screenHeight = app.globalData.systemInfo.screenHeight;
const windowWidth = app.globalData.systemInfo.windowWidth;
const windowHeight = app.globalData.systemInfo.windowHeight;
Page({
/**
* 页面的初始数据
*/
data: {
windowWidth,
windowHeight,
screenHeight,
storageKey: '', //缓存数据key
originalFilter: {}, //页面初始筛选项
selectFilter: {}, //已选择的筛选数据
filterData: [], //全部筛选信息
isLoading: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var params = options.params ? options.params : {};
params = JSON.parse(params);
var storageKey = options.storageKey ? options.storageKey : '';
this.setData({
storageKey,
originalFilter: params
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
var that = this;
var storageKey = this.data.storageKey;
//取筛选缓存信息,取到则不请求新的筛选信息,否则请求新的筛选信息
tt.getStorage({
key: storageKey,
success: function (res) {
var filter = res.data;
if (filter) {
that.preprocessorFilterData (filter);
that.setData({
filterData: filter
})
} else {
that.fetchFilterData();
}
},
fail: function (error) {
that.fetchFilterData();
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
// onShareAppMessage: function () {
// },
//请求筛选数据
fetchFilterData: function () {
if (this.data.isLoading) {
return;
}
var that = this;
var params = this.data.originalFilter;
params.new_filter = '1';
let storageKey = this.data.storageKey;
this.setData({
isLoading: true
})
api.get({data:params})
.then(json => {
that.setData({
isLoading: false
})
if(json.code&&json.code==200){
var filter = json.data.filter ? json.data.filter : [];
filter = that.praseFilterData(filter);
that.setData({
filterData: filter
})
tt.setStorage({
key: storageKey,
data: filter
})
}
})
.catch(error => {
this.setData({
isLoading: false
})
})
},
praseFilterData: function (filter){
let newFilter = [];
filter && filter.map((item, index) => {
if (item.expanse) {
item.expanseInitState = true;
}
var itemList = item.itemList ? item.itemList : [];
var allItemList = item.allItemList ? item.allItemList : [];
if (allItemList.length > 0) {
var allItems = {
filterId: item.filterId,
filterName: item.filterName,
isAll: true
};
itemList.push(allItems);
}
item.itemList = itemList;
newFilter.push(item);
})
return newFilter;
},
preprocessorFilterData: function(filterData) {
filterData && filterData.map((item, index) => {
item.itemList && item.itemList.map((subItem, subIndex) => {
subItem.isSelected = false;
item.selectedItems && item.selectedItems.map((selectedItem, n) => {
if (subItem.itemId === selectedItem.itemId) {
subItem.isSelected = true;
}
})
})
})
},
//Methods
filterExpanseStatusChange: function(e) {
var item = e.currentTarget.dataset.item;
var index = e.currentTarget.dataset.index;
var filterData = this.data.filterData;
if (filterData && index < filterData.length) {
var filterItem = filterData[index];
filterItem.expanseInitState = !filterItem.expanseInitState;
}
this.setData({
filterData
})
let storageKey = this.data.storageKey;
tt.setStorage({
key: storageKey,
data: filterData
})
},
jumpToSubFilterPage: function (e) {
let storageKey = this.data.storageKey;
var selectObject = e.detail;
var filterItem = selectObject.filterItem;
var index = selectObject.index;
var filterId = filterItem.filterId ? filterItem.filterId : '';
var url = '';
if (filterId === 'brand') {
url = "./alphabetBrandList?storageKey=" + storageKey + "&filterId=" + filterId + "&index=" + index;
}else if(filterId === 'size') {
url = "./sizesList?storageKey=" + storageKey + "&filterId=" + filterId + "&index=" + index;
}else if(filterId === 'sort') {
url = "./categoryList?storageKey=" + storageKey + "&filterId=" + filterId + "&index=" + index;
}
tt.navigateTo({
url: url,
})
},
filterItemDidSelected: function (e) {
var selectObject = e.detail;
var currentFilterItem = selectObject.filterItem;
var filterIndex = selectObject.index;
var selectedItem = selectObject.subItem;
var selectedItems = currentFilterItem.selectedItems ? currentFilterItem.selectedItems : [];
if (currentFilterItem) {
if (currentFilterItem.multiSelect){
currentFilterItem.selectedItems = this.checkFilterSubItemIsSelected(currentFilterItem, selectedItem);
}else {
selectedItem.isSelected = true;
if (selectedItems.length == 0) {
selectedItems.push(selectedItem);
this.updateItemListStatus(currentFilterItem, selectedItem);
}else {
var st = selectedItems[0];
st.isSelected = false;
this.updateItemListStatus(currentFilterItem, st);
selectedItems.splice(0, selectedItems.length);
if (st.itemId != selectedItem.itemId) {
selectedItems.push(selectedItem);
this.updateItemListStatus(currentFilterItem, selectedItem);
}
}
currentFilterItem.selectedItems = selectedItems;
}
var selectItemsName = '';
var selectItemsIds = '';
currentFilterItem.selectedItems && currentFilterItem.selectedItems.map((item, index) => {
selectItemsName = selectItemsName + item.itemName + ',';
selectItemsIds = selectItemsIds + item.itemId + ',';
})
selectItemsName = selectItemsName.slice(0, selectItemsName.length-1);
selectItemsIds = selectItemsIds.slice(0, selectItemsIds.length-1);
currentFilterItem.selectItemsName = selectItemsName;
currentFilterItem.selectItemsIds = selectItemsIds;
var filterData = this.data.filterData;
filterData.splice(filterIndex, 1, currentFilterItem);
this.setData({
filterData
})
let storageKey = this.data.storageKey;
tt.setStorage({
key: storageKey,
data: filterData
})
}
},
//判断是否已经选过,选过则删除,没选过添加
checkFilterSubItemIsSelected: function (currentFilterItem, subItem) {
let newFilterItem = [];
var selectedItems = currentFilterItem.selectedItems ? currentFilterItem.selectedItems : [];
selectedItems && selectedItems.map((item, index) => {
if (item.itemId != subItem.itemId) {
newFilterItem.push(item);
}
})
if (selectedItems && selectedItems.length <= newFilterItem.length) {
subItem.isSelected = true;
newFilterItem.push(subItem);
}else {
subItem.isSelected = false;
}
this.updateItemListStatus(currentFilterItem, subItem);
return newFilterItem;
},
updateItemListStatus: function (currentFilterItem, subItem) {
var itemList = currentFilterItem.itemList ? currentFilterItem.itemList : [];
itemList && itemList.map((item, index) => {
if (item.itemId == subItem.itemId) {
item.isSelected = subItem.isSelected;
}
})
},
clearAllFilter: function () {
var filterData = this.data.filterData;
filterData&&filterData.map((item, index)=>{
item.itemList && item.itemList.map((subItem, index)=> {
subItem.isSelected = false;
})
item.selectedItems = [];
item.selectItemsName = '';
item.selectItemsIds = '';
item.expanseInitState = false;
})
this.setData({
filterData
})
let storageKey = this.data.storageKey;
tt.setStorage({
key: storageKey,
data: filterData
})
},
submitFilter: function () {
var that = this;
var params = {};
var filterData = this.data.filterData;
var originalFilter = this.data.originalFilter;
filterData && filterData.map((item, index) => {
let itemParam = {
[item.filterId]: that.praseFinalFilterParam(item, originalFilter),
}
params = Object.assign(params, itemParam);
})
let prePage = getCurrentPages();
if (prePage.length > 1 && prePage[prePage.length - 2].updateProductListWithFilterParam != undefined) {
prePage[prePage.length - 2].updateProductListWithFilterParam(params);
}
tt.navigateBack({
delta: 1
})
},
praseFinalFilterParam: function (item, originalParam) {
if (item.selectItemsIds && item.selectItemsIds.length > 0) {
return item.selectItemsIds;
}else {
return originalParam[item.filterId] ? originalParam[item.filterId] : '';
}
}
})
\ No newline at end of file
{
"navigationBarTitleText": "筛选",
"usingComponents": {
"productListFilterItemsComponent": "../../components/category/productListFilterItemsComponent/productListFilterItemsComponent"
}
}
\ No newline at end of file
<view class="container" style="width: {{windowWidth}}px; height: {{screenHeight-64}}px">
<scroll-view class="scroll-container" scroll-y style="height: {{screenHeight-64-45}}px">
<block tt:for="{{filterData}}" tt:key="filter">
<view class="filter-floor-container" tt:if="{{item.filterId != 'promotion'}}">
<view class="filter-top" bindtap="filterExpanseStatusChange" data-item="{{item}}" data-index="{{index}}">
<text class="filter-title">{{item.filterName}}</text>
<text class="filter-selected-text">{{item.selectItemsName}}</text>
<image class="filter-indicator" src="{{item.expanseInitState ? '../../images/filter-upIc@2x.png' : '../../images/filter-downIc@2x.png'}}"></image>
</view>
<view class="filter-items" tt:if="{{item.expanseInitState}}">
<productListFilterItemsComponent id="productListFilterItemsComponent" filterItem="{{item}}" index="{{index}}" bind:filterItemDidSelected="filterItemDidSelected" bind:jumpToSubFilterPage="jumpToSubFilterPage"></productListFilterItemsComponent>
</view>
</view>
</block>
<view class="separator-bottom"></view>
</scroll-view>
<view class="bottom-function">
<text class="filter-bottom-text" bindtap="clearAllFilter">清空</text>
<view class="filter-separator"></view>
<text class="filter-bottom-text" bindtap="submitFilter">确定</text>
</view>
</view>
<loading tt:if="{{isLoading}}">加载中</loading>
.container {
display: flex;
flex-direction: column;
}
.scroll-container {
width: 100%;
display: flex;
flex-direction: column;
}
.filter-floor-container {
display: flex;
width: 100%;
flex-direction: column;
}
.filter-top {
height: 88rpx;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
border-top: 1rpx solid #e1e1e1
}
.filter-title {
margin-left: 30rpx;
margin-right: 30rpx;
width: 150rpx;
font-size: 26rpx;
font-family: PingFang SC;
color: #808080;
text-align: left;
/* background-color: blue; */
}
.filter-selected-text {
font-family: PingFang SC;
font-size: 24rpx;
text-align: right;
color: #d0021b;
height: 30rpx;
width: 445rpx;
line-height:30rpx;
white-space: nowrap;
text-overflow:ellipsis;
display: block;
overflow: hidden;
/* background-color: red */
}
.filter-indicator {
margin-right: 30rpx;
margin-left: 38rpx;
width: 25rpx;
height: 14rpx;
}
.filter-items {
width: 100%;
}
.bottom-function {
position: fixed;
height: 45px;
bottom: 0;
width: 100%;
background-color: #444444;
display: flex;
flex-direction: row;
align-items: center;
}
.filter-bottom-text {
width: 50%;
font-family: PingFang SC;
font-size: 26rpx;
text-align: center;
color: #ffffff;
}
.filter-separator {
width: 1rpx;
height: 100%;
background-color: #b0b0b0;
}
.separator-bottom {
width: 100%;
height: 1rpx;
background-color: #e1e1e1;
}
\ No newline at end of file
... ... @@ -71,7 +71,7 @@ Page({
let brandName = e.brandName;
if (brandId != '' && brandName != '')
tt.navigateTo({
url: '../goodsList/brand?brandId=' + brandId + '&brandName=' + brandName + '&page_name=' + 'home' + '&page_param=' + ''
url: '../brandStore/brand?brandId=' + brandId + '&brandName=' + brandName + '&page_name=' + 'home' + '&page_param=' + ''
});
} else if (jumpType == JUMP_DETAIL) {
let productSkn = e.productSkn;
... ... @@ -80,14 +80,15 @@ Page({
url: '../goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + 'home' + '&page_param=' + ''
});
}
} else if (jumpType == JUMP_PRODUCTPOOL) {
let productPool = e.productPool;
if (productPool != '') {
tt.navigateTo({
url: '../goodsList/productPool?productPool=' + productPool + '&page_name=' + 'home' + '&page_param=' + ''
});
}
}
}
// else if (jumpType == JUMP_PRODUCTPOOL) {
// let productPool = e.productPool;
// if (productPool != '') {
// tt.navigateTo({
// url: '../goodsList/productPool?productPool=' + productPool + '&page_name=' + 'home' + '&page_param=' + ''
// });
// }
// }
},
onShareAppMessage: function (res) {
... ... @@ -491,7 +492,7 @@ Page({
});
} else if (url.startsWith('https://m.yohobuy.com/shop') || url.startsWith('http://m.yohobuy.com/shop')) {
tt.navigateTo({
url: '/pages/goodsList/brandStore?q=' + url
url: '/pages/brandStore/brandStore?q=' + url
});
}
} else {
... ...
... ... @@ -604,7 +604,7 @@ Page({
*/
goBackToTab:function() {
tt.navigateTo({
url: '../goodsList/newArrival' + '?page_name=' + this.data.current_page_name + '&page_param=' + this.data.current_page_param
url: './newArrival' + '?page_name=' + this.data.current_page_name + '&page_param=' + this.data.current_page_param
})
},
goTODefraudPage: function () {
... ...
<!--search.wxml-->
<import src="../goodsList/categoryProductListFilter.ttml"/>
<import src="../brandStore/categoryProductListFilter.ttml"/>
<!-- <import src="../../vendors/zanui/actionsheet/index.ttml"/> -->
<view class="sContainer">
... ...
@import "../goodsList/categoryProductListFilter.ttss";
@import "../brandStore/categoryProductListFilter.ttss";
@import '../../vendors/zanui/actionsheet/index.ttss';
.sContainer {
position: relative;
... ...
... ... @@ -4,7 +4,7 @@
<text tt="service-text">更多优质服务,您可以选择:\n1.关注微信服务号“ YOHOBUY有货”咨询在线客服</text>
<view tt='phonenum'>
<text tt="service-text">2.拨打</text>
<text tt='phone-txt' bindtap='phoneCall'>\t400-889-9646\t</text>
<text tt='phone-txt' bindtap='phoneCall'>400-889-9646</text>
<text tt="service-text"> 电话客服</text>
</view>
</view>
... ...
... ... @@ -6,7 +6,7 @@ export default {
path: '../productList/index'
},
brandStore: {
path: '../goodsList/brandStore'
path: '../brandStore/brandStore'
},
webview: {
path: '../webview/webview'
... ...