123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <template>
- <view class="content">
- <view v-if="type == 1" class="pageThr"><hotgods :flag="1" :list="classList"></hotgods></view>
- <view v-if="type == 2" class="pageCon"><collage-list :flag="1" :list="classList"></collage-list></view>
- <view v-if="type == 3" class="pageCon"><skill-list :flag="1" :list="classList"></skill-list></view>
- </view>
- </template>
- <script>
- import collageList from '../components/collageMall.vue';
- import skillList from '../components/skillList.vue';
- import hotgods from './componets/hotgodlist.vue';
- export default {
- components: {
- collageList,
- skillList,
- hotgods
- },
- data() {
- return {
- flag:1,
- keyword: '',
- cat_id: '', //分类id
- type: 1, // 1普通订单 2拼团订单 3秒杀订单
- classList: [
- // { image: '/static/img/pro/indnotice.png', name: '知识过关', path: '/pages/knowledge/knowledge' },
- // { image: '/static/img/pro/indnotice.png', name: '知识过关', path: '/pages/knowledge/knowledge' },
- ],
- status: 'loadmore',
- page: 1,
- pagenum: 6
- };
- },
- onPullDownRefresh() {
- setTimeout(res => {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onReachBottom() {
- if (this.status == 'nomore') return;
- this.status = 'loadmore';
- this.page = ++this.page;
- this.getInfoList();
- },
- onLoad(opt) {
- this.flag = opt.flag || 1;
- this.type = opt.type || 1;
- this.cat_id = opt.id || '';
- this.keyword = opt.keyword || '';
- if (this.type == 1) {
- uni.setNavigationBarTitle({
- title: '热门资料'
- });
- } else if (this.type == 2) {
- uni.setNavigationBarTitle({
- title: '拼团'
- });
- } else {
- uni.setNavigationBarTitle({
- title: '秒杀'
- });
- }
- this.getInfoList();
- },
- methods: {
- getInfoList() {
- this.status = 'loadmore';
- let url = this.type == 1 ? 'goods/goods_list' : this.type == 2 ? 'grouporder/group_lists' : 'seckillorder/seckill_lists';
- this.$api
- .request(url, {
- type:this.flag||"",
- cat_id: this.cat_id || '',
- keyword: this.keyword || '',
- page: this.page,
- pagenum: this.pagenum
- })
- .then(data => {
- console.log(data);
- if (data.code == 200) {
- if(this.type==1){
- let list = data.data.goods;
- this.classList = this.classList.concat(list);
- if (list.length < this.pagenum) {
- this.status = 'nomore';
- }
- }else{
- let list = data.data;
- this.classList = this.classList.concat(list);
- if (list.length < this.pagenum) {
- this.status = 'nomore';
- }
- }
- } else {
- this.$api.toast(data.msg);
- }
- });
- },
- toNext(url) {
- uni.navigateTo({
- url: url
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .pageCon {
- padding: 20rpx 30rpx;
- }
- .pageThr {
- padding: 20rpx 0;
- }
- </style>
|