Authored by huangyCode

列表和搜索和筛选上报

... ... @@ -45,6 +45,9 @@ import {Scroll} from 'cube-ui';
export default {
name: 'Filtrate',
components: {ImgSize, Scroll},
props: {
yasParams: Object,
},
data() {
return {
showType: false,
... ... @@ -130,9 +133,39 @@ export default {
params[row.filterId] = row.itemList[0].itemId;
}
});
let ENT_PARAMS = {}, ENT_ID = [], ENT_NAME = [];
for (let key in params) {
if (key === 'sort' && params[key]) {
ENT_PARAMS.category = params[key];
ENT_ID.push(params[key]);
ENT_NAME.push('品类');
}
if (key === 'brand' && params[key]) {
ENT_PARAMS.brand = params[key];
ENT_ID.push(params[key]);
ENT_NAME.push('品牌');
}
if (key === 'size' && params[key]) {
ENT_PARAMS.size = params[key];
ENT_ID.push(params[key]);
ENT_NAME.push('尺寸');
}
if (key === 'gender' && params[key]) {
ENT_PARAMS.sex = params[key];
ENT_ID.push(params[key]);
ENT_NAME.push('性别');
}
}
this.yasParams.ENT_PARAMS = JSON.stringify(ENT_PARAMS);
this.yasParams.ENT_ID = ENT_ID.toString();
this.yasParams.ENT_NAME = ENT_NAME.toString();
params.isReset = true;
this.yas(this.yasParams)
this.$parent.fetchList(params);
this.$parent.$refs.scroll.scrollTo(0, 0, 300)
this.$parent.$refs.scroll.scrollTo(0, 0, 300);
this.hide();
},
... ... @@ -178,6 +211,14 @@ export default {
},
hide() {
this.showType = false;
},
yas(param) {
this.$store.dispatch('reportYas', {
params: {
param,
appop: 'XY_UFO_PRD_LIST_SCREEN_C'
}
});
}
}
};
... ...
... ... @@ -29,7 +29,7 @@
<EmptyList class="empty-wrapper product-list" :tip="`暂无数据`" v-show="productList.isEmpty">
</EmptyList>
</LayoutApp>
<Filtrate ref="filtrate"></Filtrate>
<Filtrate ref="filtrate" :yasParams="yasParams"></Filtrate>
</div>
</template>
<script>
... ... @@ -102,13 +102,13 @@ export default {
this.changeArrow();
let params = {...this.$route.query};
this.setYasParam({param: params, tab: {index: 1, name: '人气'}});
if (params.title) {
this.title = params.title;
delete params.title;
} else {
this.title = '商品列表';
}
this.setYasParam({param: params, tab: {index: 1, name: '人气'}});
!params.order && (params.order = 'sale_desc');
await this.fetchList({...params, isReset: true});
this.yasShowPage();
... ... @@ -235,7 +235,7 @@ export default {
},
setYasParam: function({param, tab}) {
if (param && typeof param === 'object' && Object.keys(param).length) {
let P_NAME = 'XY_UFOSearchList', TYPE_ID = 1;
let P_NAME = 'XY_UFOSearchList', TYPE_ID = 1, P_PARAM = [];
for (let key in param) {
if (key === 'brand' && param[key] && param.type !== 6) {
... ... @@ -253,10 +253,11 @@ export default {
if (!param[key]) {
delete param[key];
}
P_PARAM.push(param[key]);
}
Object.assign(this.yasParams, {
P_NAME,
P_PARAM: JSON.stringify(param),
P_PARAM: P_PARAM.toString(),
TYPE_ID,
TAB_ID: this.tabIndex || '',
TAB_NAME: this.tabName || ''
... ...
... ... @@ -3,7 +3,7 @@
<form action="javascript:void(0)">
<div class="search-header middle">
<div class="search-img"></div>
<input class="search-input" type="search" v-model="query" placeholder="Search" @input="suggest"
<input class="search-input" type="search" v-model="query" placeholder="Search" @input="suggest" @focus="yasFocus"
@keyup.13="searchGoods"/>
<div class="search-clear" :class="query && 'search-clear-img'" @click="clear()"></div>
</div>
... ... @@ -11,7 +11,7 @@
<Scroll v-show="!query.length" :options="scrollOptions">
<div class="recent title middle" v-if="searchWord && searchWord.length">热门推荐</div>
<div class="content middle">
<div class="item" v-if="searchWord && searchWord.length" v-for="item of searchWord" @click="goSearch({query : item.search_word})">
<div class="item" v-if="searchWord && searchWord.length" v-for="item of searchWord" @click="goSearch({query : item.search_word} ,2)">
{{item.search_word}}
</div>
</div>
... ... @@ -20,12 +20,12 @@
<div class="search-clear search-clear-img" @click="clearLocalHistory()"></div>
</div>
<div class="content middle">
<div class="item" v-if="localHistory && localHistory.length" v-for="item of localHistory" @click="goSearch({query : item})">{{item}}
<div class="item" v-if="localHistory && localHistory.length" v-for="item of localHistory" @click="goSearch({query : item} ,1)">{{item}}
</div>
</div>
</Scroll>
<Scroll v-show="query.length" :options="scrollOptions" :data="searchSuggestList">
<div class="item-line middle" v-if="searchSuggestList.length" v-for="item of searchSuggestList" @click="goSearch({query : item.item})">
<div class="item-line middle" v-if="searchSuggestList.length" v-for="item of searchSuggestList" @click="goSearch({query : item.item} ,0)">
{{item.item}}
</div>
</Scroll>
... ... @@ -70,6 +70,7 @@ export default {
},
searchGoods: function() {
this.addLocalWord();
this.yasInput(0);
this.$router.push({
name: 'List',
query: {
... ... @@ -81,9 +82,10 @@ export default {
suggest: function() {
this.fetchSearchSuggest(this.query);
},
goSearch: function(parameters) {
goSearch: function(parameters, type) {
let query = parameters.query;
this.yasInput(type);
this.$router.push({
name: 'List',
query: {
... ... @@ -118,6 +120,28 @@ export default {
localStorage.setItem('@YohoUFOStore:searchHistory', this.query);
}
}
},
yasFocus() {
this.$store.dispatch('reportYas', {
params: {
param: {SEARCH_POS: 3},
appop: 'XY_UFO_SEARCH_CLICK'
}
});
},
yasInput: function(type) {
this.$store.dispatch('reportYas', {
params: {
param: {
SEARCH_POS: 3,
KEYWORD: this.query,
POS_ID: type,
TYPE_ID: type,
FLR_INDEX: type,
},
appop: 'XY_UFO_HOME_KEYWORD_SEARCH_C'
}
});
}
}
};
... ...