|
|
@@ -0,0 +1,207 @@
|
|
|
+<config>
|
|
|
+{
|
|
|
+'navigationBarTitleText': '',
|
|
|
+'navigationStyle':'custom',
|
|
|
+'navigationBarTextStyle':'black',
|
|
|
+'backgroundColorBottom': '#f5f7fa',
|
|
|
+'backgroundColorTop': '#fff',
|
|
|
+}
|
|
|
+</config>
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <div :style="{ height: barHeight + 'px' }">
|
|
|
+ <search-bar v-model="searchKey" :dark="false" :ratio="ratio" @search="submitSearch"></search-bar>
|
|
|
+ </div>
|
|
|
+ <div class="main" id="main">
|
|
|
+ <van-sticky :container="main" :offset-top="barHeight">
|
|
|
+ <filter-sort-bar
|
|
|
+ :sort="sort"
|
|
|
+ :showType="showType"
|
|
|
+ @showFilter="showFilter"
|
|
|
+ @changeSort="changeSort"
|
|
|
+ @changeShowType="changeShowType"
|
|
|
+ >
|
|
|
+ <span slot="filter1">
|
|
|
+ <product-category-filter
|
|
|
+ size="small"
|
|
|
+ v-model="categoryIds"
|
|
|
+ @input="refreash"
|
|
|
+ ></product-category-filter>
|
|
|
+ </span>
|
|
|
+ <span slot="filter2">
|
|
|
+ <country-filter
|
|
|
+ size="small"
|
|
|
+ v-model="continent"
|
|
|
+ :country.sync="countries"
|
|
|
+ @input="refreash"
|
|
|
+ ></country-filter>
|
|
|
+ </span>
|
|
|
+ <span slot="filter3">
|
|
|
+ <product-brand-filter size="small" v-model="brand" @input="refreash"></product-brand-filter>
|
|
|
+ </span>
|
|
|
+ </filter-sort-bar>
|
|
|
+ </van-sticky>
|
|
|
+
|
|
|
+ <sort-list :empty="empty" emptyText="敬请期待" :loading="loading" :finish="finish" top="172rpx">
|
|
|
+ <div class="product-list" v-if="showType === 'grid'">
|
|
|
+ <div class="clo-2" v-for="item in list" :key="item.id">
|
|
|
+ <product-grid :info="item"></product-grid>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="product-list2" v-else>
|
|
|
+ <product-row v-for="item in list" :key="item.id" :info="item"></product-row>
|
|
|
+ </div>
|
|
|
+ </sort-list>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import SearchBar from '../components/bar/SearchBarWithValue';
|
|
|
+import searchList from '../mixins/searchList';
|
|
|
+import FilterSortBar from '../components/bar/FilterSortBar';
|
|
|
+import SortList from '../components/SortList';
|
|
|
+import ProductGrid from '../components/product/GridNormal';
|
|
|
+import ProductBrandFilter from '../components/filter/ProductBrand';
|
|
|
+import ProductCategoryFilter from '../components/filter/ProductCategory';
|
|
|
+import CountryFilter from '../components/filter/Country';
|
|
|
+import ProductRow from '../components/product/RowNormal.vue';
|
|
|
+import { mapState } from 'vuex';
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ banners: [],
|
|
|
+ categoryIds: '',
|
|
|
+ countries: '',
|
|
|
+ continent: '',
|
|
|
+ brand: '',
|
|
|
+ url: '/product/show',
|
|
|
+ tagIds: '',
|
|
|
+ applicationField: '',
|
|
|
+ main: null,
|
|
|
+ ratio: 1,
|
|
|
+ vendorInfoId: '',
|
|
|
+ defaultCategoryId: ''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mixins: [searchList],
|
|
|
+ computed: {
|
|
|
+ ...mapState(['barTop', 'barHeight']),
|
|
|
+ firstLevels() {
|
|
|
+ const list = [...this.productCategories];
|
|
|
+ return list.filter(item => {
|
|
|
+ return !item.parentId;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ listQuery() {
|
|
|
+ return {
|
|
|
+ productSort: this.sort,
|
|
|
+ categoryIds: this.categoryIds || '',
|
|
|
+ countries: this.countries,
|
|
|
+ tagIds: this.tagIds,
|
|
|
+ applicationField: this.applicationField,
|
|
|
+ query: JSON.stringify({
|
|
|
+ vendorInfoId: this.vendorInfoId
|
|
|
+ })
|
|
|
+ };
|
|
|
+ },
|
|
|
+ filterQuery() {
|
|
|
+ return {
|
|
|
+ pageType: 'product',
|
|
|
+ categoryIds: this.categoryIds,
|
|
|
+ countries: this.countries,
|
|
|
+ continent: this.continent,
|
|
|
+ searchTop: this.searchTop,
|
|
|
+ tagIds: this.tagIds,
|
|
|
+ applicationField: this.applicationField,
|
|
|
+ brand: this.brand
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ console.log(options);
|
|
|
+ if (options.categoryIds) {
|
|
|
+ this.categoryIds = options.categoryIds;
|
|
|
+ }
|
|
|
+ // if (options.defaultCategoryId) {
|
|
|
+ // this.defaultCategoryId = options.defaultCategoryId;
|
|
|
+ // }
|
|
|
+ if (options.applicationField) {
|
|
|
+ this.applicationField = options.applicationField;
|
|
|
+ }
|
|
|
+ if (options.search) {
|
|
|
+ this.search = options.search;
|
|
|
+ this.searchKey = options.search;
|
|
|
+ }
|
|
|
+ if (options.vendorId) {
|
|
|
+ this.vendorInfoId = options.vendorId;
|
|
|
+ }
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ if (!this.loading && !this.finish) {
|
|
|
+ this.page++;
|
|
|
+ this.getData();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ FilterSortBar,
|
|
|
+ SortList,
|
|
|
+ ProductGrid,
|
|
|
+ ProductBrandFilter,
|
|
|
+ ProductCategoryFilter,
|
|
|
+ CountryFilter,
|
|
|
+ SearchBar,
|
|
|
+ ProductRow
|
|
|
+ }
|
|
|
+ // watch: {
|
|
|
+ // defaultCategoryId() {
|
|
|
+ // this.categoryIds = '';
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.refreash();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+.tab-content {
|
|
|
+ background: @prim;
|
|
|
+ .van-tabs__scroll {
|
|
|
+ background: @prim;
|
|
|
+ .van-tab {
|
|
|
+ color: #fff;
|
|
|
+ &.van-tab--active {
|
|
|
+ color: @warn;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .van-tabs__line {
|
|
|
+ bottom: 8px;
|
|
|
+ left: 7.5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.banner-box {
|
|
|
+ padding: 16px 16px 4px;
|
|
|
+}
|
|
|
+.top {
|
|
|
+ height: 44px;
|
|
|
+}
|
|
|
+
|
|
|
+.product-list {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ padding: 0 10px;
|
|
|
+ .clo-2 {
|
|
|
+ width: 50%;
|
|
|
+ padding: 6px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.product-list2 {
|
|
|
+ padding: 10px 16px;
|
|
|
+}
|
|
|
+</style>
|