api
This commit is contained in:
@@ -8,10 +8,11 @@
|
||||
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom">
|
||||
<view>
|
||||
<view class="item-container" v-for="order in orderList" :key="order.order_id">
|
||||
<OrderItem :current="index"></OrderItem>
|
||||
<OrderItem :order="order"></OrderItem>
|
||||
</view>
|
||||
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20" v-if="typeof orderList == Array ? (orderList.length >= 15) : (orderList >= 15)"></u-loadmore>
|
||||
</view>
|
||||
<u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList.length"></u-empty>
|
||||
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20" v-if="orderList.length >= 15"></u-loadmore>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
@@ -37,7 +38,7 @@ export default {
|
||||
}, {
|
||||
name: '售后'
|
||||
}],
|
||||
orderList: 15,
|
||||
orderList: [],
|
||||
loadStatus: ['loadmore','loadmore','loadmore','loadmore','loadmore','loadmore','loadmore'],
|
||||
page: 0,
|
||||
current: 0,
|
||||
@@ -52,19 +53,17 @@ export default {
|
||||
watch: {
|
||||
current() {
|
||||
this.page = 0;
|
||||
this.getOrderList();
|
||||
this.getOrderList('again');
|
||||
},
|
||||
},
|
||||
onLoad(option) {
|
||||
if(option.current) {
|
||||
this.current = Number(option.current);
|
||||
this.swiperCurrent = this.current;
|
||||
}
|
||||
this.getOrderList();
|
||||
const current = option.current ? Number(option.current) : 0;
|
||||
this.current = current;
|
||||
this.swiperCurrent = this.current;
|
||||
this.setViewHeight();
|
||||
},
|
||||
methods: {
|
||||
async getOrderList() {
|
||||
async getOrderList(reload = '') {
|
||||
let type;
|
||||
// state_type 订单状态:0:已取消 10:未付款 20:已付款 30:已发货 40:已收货
|
||||
switch (this.current) {
|
||||
@@ -94,15 +93,16 @@ export default {
|
||||
page: this.page,
|
||||
type: type,
|
||||
})
|
||||
this.timer = false;
|
||||
this.timer = true;
|
||||
if(res.errCode == 0) {
|
||||
if(res.data.length) this.orderList = this.orderList.concat(res.data);
|
||||
if(reload) this.orderList = res.data;
|
||||
else this.orderList.push(...res.data);
|
||||
}
|
||||
return res.data.length;
|
||||
},
|
||||
reachBottom() {
|
||||
return false;
|
||||
if(!this.timer) return false;
|
||||
this.timer = false;
|
||||
this.loadStatus.splice(this.current, 1, "loading");
|
||||
this.page++;
|
||||
this.getOrderList.then(length => {
|
||||
|
||||
Reference in New Issue
Block a user