This commit is contained in:
2020-06-24 16:39:31 +08:00
parent 8c993da2cd
commit 28e80b49ff
14 changed files with 132 additions and 54 deletions

View File

@@ -6,7 +6,8 @@
<swiper :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
<scroll-view scroll-y class="order-list" @scrolltolower="reachBottom">
<view>
<u-empty text="订单为空" mode="order" color="#000000" v-if="!orderList.length"></u-empty>
<view v-else>
<view v-for="(item, index) in orderList" :key="index" class="order-item">
<view class="order-title">
<view class="order-text">订单</view>
@@ -46,7 +47,13 @@ export default {
onShow() {
this.current = 0;
this.swiperCurrent = 0;
this.getManicureList();
this.getManicureList().then(order => {
// console.log(order);
this.orderList = this.orderList.concat(order);
// console.log(this.orderList);
});
},
filters: {
dateFormat(value) {
@@ -59,26 +66,27 @@ export default {
}
},
methods: {
getManicureList() {
this.$u.api.getManicureList({
async getManicureList() {
let res = await this.$u.api.getManicureList({
page: this.page
}).then((res)=>{
if (res.errCode == 0) {
this.orderList = res.data.list;
}
})
if (res.errCode == 0) {
return res.data.list;
}
},
reachBottom() {
// console.log(this.page);
if(this.page >= 3) return;
// 修改当前的 loadStatus
console.log(this.loadStatus);
this.loadStatus.splice(this.current, 1, "loading");
this.loadStatus = "loading";
this.page++;
setTimeout(() => {
this.orderList += 5;
this.loadStatus.splice(this.current, 1, "nomore");
}, 1200);
this.getManicureList().then(order => {
if (!order.length) {
// 如果没有数据page-1
this.page--;
this.loadStatus = "nomore";
} else {
this.orderList = this.orderList.concat(order);
}
})
},
tabsChange(index) {
this.swiperCurrent = index;

View File

@@ -55,8 +55,15 @@ export default {
name: this.name,
time: new Date(this.time)
}).then((res)=>{
let type = res.errCode == 0 ? 'success' : 'error';
this.showToast(res.message, type);
if(res.errCode == 0) {
this.$refs.uToast.show({
title: res.message,
type: 'success',
url: '/pageE/tool/Manicure'
})
} else {
this.showToast(res.message, 'error');
}
})
},
chooseDate(e) {