| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608 |
- <template>
- <view class="cate-list">
- <mescroll-uni :ref="'mescrollRef'+i" :top="positionTop" @init="mescrollInit"
- @down="downCallback" @up="upCallback" :up="upOption" :down="downOption" >
- <view class="content">
- <view style="margin: 0 20rpx" v-if="appConfig.cate_style == 3">
- <cate-nav :list="cateTwoList"></cate-nav>
- </view>
- <ad-swipers :pid="11" height="268rpx" padding="20rpx 20rpx 0" radius="10rpx">
- </ad-swipers>
- <view class="sort-nav-wrap">
- <sort-nav v-model="sortConfig"></sort-nav>
- </view>
- <view class="goods">
- <view v-show="sortConfig.goodsType == 'double'" class="double">
- <goods-list type="double" :list="goodsList"></goods-list>
- </view>
- <view v-show="sortConfig.goodsType == 'one'" class="one">
- <goods-list :list="goodsList" type="one"></goods-list>
- </view>
- </view>
- </view>
- </mescroll-uni>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
- import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
- import {
- getGoodsList,
- getListByLevelOne
- } from "@/api/store"
- import {
- mapGetters,
- mapActions
- } from 'vuex'
- const app = getApp()
- export default {
- mixins: [MescrollMixin, MescrollMoreItemMixin],
- name: "cate-list",
- props: {
- top: {
- type: [Number, String]
- },
- cate: {
- type: Object,
- default: () => ({})
- }
- },
- data() {
- return {
- goodsList: [],
- cateTwoList: [],
- upOption: {
- auto: false, // 不自动加载
- noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
- empty: {
- icon: '/static/images/goods_null.png',
- tip: '暂无商品~', // 提示
- }
- },
- sortConfig: {
- goodsType: 'double',
- priceSort: '',
- saleSort: '',
- },
- };
- },
- computed: {
- ...mapGetters(['appConfig']),
- positionTop() {
- return this.top
- }
- },
- methods: {
- onRefresh() {
- this.mescroll.resetUpScroll(true);
- },
- async downCallback() {
- await this.getListByLevelOneFun()
- this.mescroll.resetUpScroll();
- },
- upCallback(page) {
- const {sortConfig: {
- priceSort,
- saleSort,
- }} = this
- getGoodsList({
- page_size: page.size,
- page_no: page.num,
- platform_cate_id: this.cate.id,
- sort_by_price: priceSort,
- sort_by_sales: saleSort
- }).then(({
- data
- }) => {
- const curPageData = data.lists;
- const curPageLen = curPageData.length;
- const hasNext = !!data.more;
- if (page.num == 1) this.goodsList = [];
- this.goodsList = this.goodsList.concat(curPageData);
- this.mescroll.endSuccess(curPageLen, hasNext);
- })
- },
- async getListByLevelOneFun() {
- const {
- id
- } = this.cate
- const {
- code,
- data
- } = await getListByLevelOne({
- id
- })
- if (code == 1) {
- this.cateTwoList = data
- }
- }
- },
- watch: {
- 'sortConfig.saleSort'() {
- this.onRefresh()
- },
- 'sortConfig.priceSort'() {
- this.onRefresh()
- }
- }
- }
- </script>
- <style lang="scss">
- .cate-list {
- border-radius: 20rpx 20rpx 0 0;
- overflow: hidden;
- .contain {
- padding: 20rpx 30rpx 0;
- }
- .sort-nav-wrap {
- margin: 20rpx 20rpx 0;
- border-radius: 14rpx;
- overflow: hidden;
- }
- .title-img {
- width: 100%;
- height: 120rpx;
- }
- }
- </style>
- <template>
- <view class="cate-list">
- <mescroll-uni :ref="'mescrollRef'+i" :top="positionTop" @init="mescrollInit"
- @down="downCallback" @up="upCallback" :up="upOption" :down="downOption" >
- <view class="content">
- <view style="margin: 0 20rpx" v-if="appConfig.cate_style == 3">
- <cate-nav :list="cateTwoList"></cate-nav>
- </view>
- <ad-swipers :pid="11" height="268rpx" padding="20rpx 20rpx 0" radius="10rpx">
- </ad-swipers>
- <view class="sort-nav-wrap">
- <sort-nav v-model="sortConfig"></sort-nav>
- </view>
- <view class="goods">
- <view v-show="sortConfig.goodsType == 'double'" class="double">
- <goods-list type="double" :list="goodsList"></goods-list>
- </view>
- <view v-show="sortConfig.goodsType == 'one'" class="one">
- <goods-list :list="goodsList" type="one"></goods-list>
- </view>
- </view>
- </view>
- </mescroll-uni>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
- import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
- import {
- getGoodsList,
- getListByLevelOne
- } from "@/api/store"
- import {
- mapGetters,
- mapActions
- } from 'vuex'
- const app = getApp()
- export default {
- mixins: [MescrollMixin, MescrollMoreItemMixin],
- name: "cate-list",
- props: {
- top: {
- type: [Number, String]
- },
- cate: {
- type: Object,
- default: () => ({})
- }
- },
- data() {
- return {
- goodsList: [],
- cateTwoList: [],
- upOption: {
- auto: false, // 不自动加载
- noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
- empty: {
- icon: '/static/images/goods_null.png',
- tip: '暂无商品~', // 提示
- }
- },
- sortConfig: {
- goodsType: 'double',
- priceSort: '',
- saleSort: '',
- },
- };
- },
- computed: {
- ...mapGetters(['appConfig']),
- positionTop() {
- return this.top
- }
- },
- methods: {
- onRefresh() {
- this.mescroll.resetUpScroll(true);
- },
- async downCallback() {
- await this.getListByLevelOneFun()
- this.mescroll.resetUpScroll();
- },
- upCallback(page) {
- const {sortConfig: {
- priceSort,
- saleSort,
- }} = this
- getGoodsList({
- page_size: page.size,
- page_no: page.num,
- platform_cate_id: this.cate.id,
- sort_by_price: priceSort,
- sort_by_sales: saleSort
- }).then(({
- data
- }) => {
- const curPageData = data.lists;
- const curPageLen = curPageData.length;
- const hasNext = !!data.more;
- if (page.num == 1) this.goodsList = [];
- this.goodsList = this.goodsList.concat(curPageData);
- this.mescroll.endSuccess(curPageLen, hasNext);
- })
- },
- async getListByLevelOneFun() {
- const {
- id
- } = this.cate
- const {
- code,
- data
- } = await getListByLevelOne({
- id
- })
- if (code == 1) {
- this.cateTwoList = data
- }
- }
- },
- watch: {
- 'sortConfig.saleSort'() {
- this.onRefresh()
- },
- 'sortConfig.priceSort'() {
- this.onRefresh()
- }
- }
- }
- </script>
- <style lang="scss">
- .cate-list {
- border-radius: 20rpx 20rpx 0 0;
- overflow: hidden;
- .contain {
- padding: 20rpx 30rpx 0;
- }
- .sort-nav-wrap {
- margin: 20rpx 20rpx 0;
- border-radius: 14rpx;
- overflow: hidden;
- }
- .title-img {
- width: 100%;
- height: 120rpx;
- }
- }
- </style>
- <template>
- <view class="cate-list">
- <mescroll-uni :ref="'mescrollRef'+i" :top="positionTop" @init="mescrollInit"
- @down="downCallback" @up="upCallback" :up="upOption" :down="downOption" >
- <view class="content">
- <view style="margin: 0 20rpx" v-if="appConfig.cate_style == 3">
- <cate-nav :list="cateTwoList"></cate-nav>
- </view>
- <ad-swipers :pid="11" height="268rpx" padding="20rpx 20rpx 0" radius="10rpx">
- </ad-swipers>
- <view class="sort-nav-wrap">
- <sort-nav v-model="sortConfig"></sort-nav>
- </view>
- <view class="goods">
- <view v-show="sortConfig.goodsType == 'double'" class="double">
- <goods-list type="double" :list="goodsList"></goods-list>
- </view>
- <view v-show="sortConfig.goodsType == 'one'" class="one">
- <goods-list :list="goodsList" type="one"></goods-list>
- </view>
- </view>
- </view>
- </mescroll-uni>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
- import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
- import {
- getGoodsList,
- getListByLevelOne
- } from "@/api/store"
- import {
- mapGetters,
- mapActions
- } from 'vuex'
- const app = getApp()
- export default {
- mixins: [MescrollMixin, MescrollMoreItemMixin],
- name: "cate-list",
- props: {
- top: {
- type: [Number, String]
- },
- cate: {
- type: Object,
- default: () => ({})
- }
- },
- data() {
- return {
- goodsList: [],
- cateTwoList: [],
- upOption: {
- auto: false, // 不自动加载
- noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
- empty: {
- icon: '/static/images/goods_null.png',
- tip: '暂无商品~', // 提示
- }
- },
- sortConfig: {
- goodsType: 'double',
- priceSort: '',
- saleSort: '',
- },
- };
- },
- computed: {
- ...mapGetters(['appConfig']),
- positionTop() {
- return this.top
- }
- },
- methods: {
- onRefresh() {
- this.mescroll.resetUpScroll(true);
- },
- async downCallback() {
- await this.getListByLevelOneFun()
- this.mescroll.resetUpScroll();
- },
- upCallback(page) {
- const {sortConfig: {
- priceSort,
- saleSort,
- }} = this
- getGoodsList({
- page_size: page.size,
- page_no: page.num,
- platform_cate_id: this.cate.id,
- sort_by_price: priceSort,
- sort_by_sales: saleSort
- }).then(({
- data
- }) => {
- const curPageData = data.lists;
- const curPageLen = curPageData.length;
- const hasNext = !!data.more;
- if (page.num == 1) this.goodsList = [];
- this.goodsList = this.goodsList.concat(curPageData);
- this.mescroll.endSuccess(curPageLen, hasNext);
- })
- },
- async getListByLevelOneFun() {
- const {
- id
- } = this.cate
- const {
- code,
- data
- } = await getListByLevelOne({
- id
- })
- if (code == 1) {
- this.cateTwoList = data
- }
- }
- },
- watch: {
- 'sortConfig.saleSort'() {
- this.onRefresh()
- },
- 'sortConfig.priceSort'() {
- this.onRefresh()
- }
- }
- }
- </script>
- <style lang="scss">
- .cate-list {
- border-radius: 20rpx 20rpx 0 0;
- overflow: hidden;
- .contain {
- padding: 20rpx 30rpx 0;
- }
- .sort-nav-wrap {
- margin: 20rpx 20rpx 0;
- border-radius: 14rpx;
- overflow: hidden;
- }
- .title-img {
- width: 100%;
- height: 120rpx;
- }
- }
- </style>
- <template>
- <view class="cate-list">
- <mescroll-uni :ref="'mescrollRef'+i" :top="positionTop" @init="mescrollInit"
- @down="downCallback" @up="upCallback" :up="upOption" :down="downOption" >
- <view class="content">
- <view style="margin: 0 20rpx" v-if="appConfig.cate_style == 3">
- <cate-nav :list="cateTwoList"></cate-nav>
- </view>
- <ad-swipers :pid="11" height="268rpx" padding="20rpx 20rpx 0" radius="10rpx">
- </ad-swipers>
- <view class="sort-nav-wrap">
- <sort-nav v-model="sortConfig"></sort-nav>
- </view>
- <view class="goods">
- <view v-show="sortConfig.goodsType == 'double'" class="double">
- <goods-list type="double" :list="goodsList"></goods-list>
- </view>
- <view v-show="sortConfig.goodsType == 'one'" class="one">
- <goods-list :list="goodsList" type="one"></goods-list>
- </view>
- </view>
- </view>
- </mescroll-uni>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
- import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
- import {
- getGoodsList,
- getListByLevelOne
- } from "@/api/store"
- import {
- mapGetters,
- mapActions
- } from 'vuex'
- const app = getApp()
- export default {
- mixins: [MescrollMixin, MescrollMoreItemMixin],
- name: "cate-list",
- props: {
- top: {
- type: [Number, String]
- },
- cate: {
- type: Object,
- default: () => ({})
- }
- },
- data() {
- return {
- goodsList: [],
- cateTwoList: [],
- upOption: {
- auto: true, // 不自动加载
- noMoreSize: 1, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
- empty: {
- icon: '/static/images/goods_null.png',
- tip: '暂无商品~', // 提示
- }
- },
- sortConfig: {
- goodsType: 'double',
- priceSort: '',
- saleSort: '',
- },
- };
- },
- computed: {
- ...mapGetters(['appConfig']),
- positionTop() {
- return this.top
- }
- },
- methods: {
- onRefresh() {
- this.mescroll.resetUpScroll(true);
- },
- async downCallback() {
- await this.getListByLevelOneFun()
- this.mescroll.resetUpScroll();
- },
- upCallback(page) {
- const {sortConfig: {
- priceSort,
- saleSort,
- }} = this
- getGoodsList({
- page_size: page.size,
- page_no: page.num,
- platform_cate_id: 8,
- sort_by_price: priceSort,
- sort_by_sales: saleSort
- }).then(({
- data
- }) => {
- const curPageData = data.lists;
- const curPageLen = curPageData.length;
- const hasNext = !!data.more;
- if (page.num == 1) this.goodsList = [];
- this.goodsList = this.goodsList.concat(curPageData);
- this.mescroll.endSuccess(curPageLen, hasNext);
- })
- },
- async getListByLevelOneFun() {
- const {
- id
- } = this.cate
- const {
- code,
- data
- } = await getListByLevelOne({
- id
- })
- if (code == 1) {
- this.cateTwoList = data
- }
- }
- },
- watch: {
- 'sortConfig.saleSort'() {
- this.onRefresh()
- },
- 'sortConfig.priceSort'() {
- this.onRefresh()
- }
- }
- }
- </script>
- <style lang="scss">
- .cate-list {
- border-radius: 20rpx 20rpx 0 0;
- overflow: hidden;
- .contain {
- padding: 20rpx 30rpx 0;
- }
- .sort-nav-wrap {
- margin: 20rpx 20rpx 0;
- border-radius: 14rpx;
- overflow: hidden;
- }
- .title-img {
- width: 100%;
- height: 120rpx;
- }
- }
- </style>
|