diff --git a/main.js b/main.js index 1a6bd7a..d93cc30 100644 --- a/main.js +++ b/main.js @@ -17,8 +17,10 @@ import { } from '@/config/app'; import skeleton from './components/skeleton/index.vue' import BaseMoney from './components/BaseMoney.vue'; +import loadmore from './components/loadmore'; Vue.component('skeleton', skeleton) Vue.component('BaseMoney', BaseMoney) +Vue.component('loadmore', loadmore) Vue.prototype.$util = util; Vue.prototype.$Cache = Cache; Vue.prototype.$eventHub = new Vue(); diff --git a/pages/cloud_warehouse/home/home.vue b/pages/cloud_warehouse/home/home.vue index 6ed5010..e22e257 100644 --- a/pages/cloud_warehouse/home/home.vue +++ b/pages/cloud_warehouse/home/home.vue @@ -43,7 +43,7 @@ } .wholeSale-con { - margin: 0 30rpx; + margin: 0 20rpx; .wholeSale-nav{ display: flex; @@ -96,38 +96,47 @@ margin-bottom: 20rpx; .category-wrap { - display: flex; - padding-bottom: 20rpx; - - .category-item { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - margin-right: 38rpx; - - text { - margin-top: 16rpx; - font-size: 24rpx; - color: #666666; - white-space: nowrap; - } - } - - .category-item-active { - position: relative; - - &::after { - content: ""; - display: inline-block; - position: absolute; - bottom: -6rpx; - width: 100%; - height: 6rpx; - background-color: #40AE36; - border-radius: 4rpx; - } - } + display: flex; + padding-bottom: 20rpx; + + .category-item { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-right: 38rpx; + + text { + margin-top: 16rpx; + font-size: 24rpx; + color: #666666; + white-space: nowrap; + } + + .category-item-text { + width: 120rpx; + text-align: center; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + } + + .category-item-active { + position: relative; + + .category-item-img { + border: 2px solid #40AE36; + border-radius: 50%; + } + + text { + background-color: #40AE36; + color: #fff; + padding: 2rpx 10rpx 6rpx 10rpx; + border-radius: 50rpx; + } + } } } @@ -190,10 +199,10 @@ } @@ -275,7 +285,8 @@ } from '@/libs/order.js' import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue' import { - getStoreCategory + getStoreCategory, + getProductslist } from "@/api/store.js" export default { components: { @@ -288,15 +299,23 @@ store_category_children: [], //商品小分类 cate_change: 0, cate_change_children: 0, + isLoading: 0, where:{ page: 1, limit: 20, - + mer_id: 259, + mer_cate_id: '', + keyword: '', + deduction_rate: '', //抵扣比例 } } }, onLoad(option){ this.getStoreCategory(); + this.getProductslist(true); + }, + onReachBottom() { + this.getProductslist(); }, methods: { navBack(){ @@ -307,19 +326,50 @@ }, changeCate(e){ this.cate_change = e; + this.store_category_children = []; + if(this.store_category[e].children) this.store_category_children = [...this.store_category[e].children]; + this.store_category_children.unshift({ + cate_name: '全部', + store_category_id: '' + }) this.cate_change_children = 0; + this.where.mer_cate_id = this.store_category[e].store_category_id; + this.getProductslist(true); }, changeChildrenCate(e){ this.cate_change_children = e; + this.where.mer_cate_id = this.store_category_children[e].store_category_id; + if(e==0) this.where.mer_cate_id = this.store_category[this.cate_change].store_category_id; // 如若选中全部, 则取父级id + this.getProductslist(true); }, getStoreCategory(){ getStoreCategory(259).then(res=>{ - this.store_category = res.data; + this.store_category = [{ + cate_name: '全部', + pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/de2be202312151001024597.png', + store_category_id: '' + }, ...res.data]; this.store_category_children = this.store_category[0].children || []; this.store_category_children.unshift({ - cate_name: '全部' + cate_name: '全部', + store_category_id: '' }) }) + }, + getProductslist(reLoad=false){ + if(reLoad){ + this.where.page = 1; + this.hostProduct = []; + this.isLoading = 0; + } + if(this.isLoading==-1)return; + this.isLoading = 1; + getProductslist(this.where).then(res=>{ + this.hostProduct = [...this.hostProduct, ...res.data.list]; + this.where.page++; + this.isLoading = 0; + if(res.data.list.length { diff --git a/pages/cloud_warehouse/market/market.vue b/pages/cloud_warehouse/market/market.vue index debf87f..a441bf0 100644 --- a/pages/cloud_warehouse/market/market.vue +++ b/pages/cloud_warehouse/market/market.vue @@ -1,306 +1,507 @@ \ No newline at end of file