deming/pageE/tool/Manicure.vue

163 lines
4.0 KiB
Vue
Raw Normal View History

2020-06-04 08:21:34 +08:00
<template>
<view class="manicure">
<view>
2020-08-04 19:08:04 +08:00
<u-tabs-swiper ref="tabs" :list="list" :is-scroll="false" active-color="#FF780F" :current="current" font-size="32" :show-bar="false" @change="tabsChange" height="88"></u-tabs-swiper>
2020-06-04 08:21:34 +08:00
</view>
2020-08-04 19:08:04 +08:00
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }">
2020-06-04 08:21:34 +08:00
<swiper-item class="swiper-item">
2020-06-23 09:00:04 +08:00
<scroll-view scroll-y class="order-list" @scrolltolower="reachBottom">
2020-06-29 08:47:37 +08:00
<u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList.length"></u-empty>
2020-06-24 16:39:31 +08:00
<view v-else>
2020-06-23 09:00:04 +08:00
<view v-for="(item, index) in orderList" :key="index" class="order-item">
<view class="order-title">
<view class="order-text">订单</view>
2020-06-23 17:21:01 +08:00
<view class="order-status">{{ item.status }}</view>
2020-06-23 09:00:04 +08:00
</view>
2020-06-23 17:21:01 +08:00
<view class="order-name">美甲人姓名{{ item.manicure_name }}</view>
2020-08-04 19:08:04 +08:00
<view class="order-date">时间{{ item.manicure_time | date }}</view>
2020-06-04 08:21:34 +08:00
</view>
2020-08-01 16:36:48 +08:00
<u-loadmore :status="loadStatus" bgColor="#ECECEC" margin-bottom="20" v-if="orderList.length>=pageSize"></u-loadmore>
2020-06-04 08:21:34 +08:00
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y class="none-page">
<view></view>
</scroll-view>
</swiper-item>
</swiper>
</view>
</template>
<script>
export default {
data() {
return {
2020-08-01 16:36:48 +08:00
pageSize: 1,
2020-06-04 08:21:34 +08:00
list: [{
name: '我的订单'
}, {
name: '申请表'
}],
current: 0,
2020-06-23 09:00:04 +08:00
swiperCurrent: 0,
page: 1,
2020-06-23 17:21:01 +08:00
orderList: [],
2020-06-23 09:00:04 +08:00
loadStatus: 'loadmore',
2020-08-01 16:36:48 +08:00
timer: true,
2020-08-04 19:08:04 +08:00
swiperHeight: '',
2020-06-04 08:21:34 +08:00
}
},
2020-08-01 16:36:48 +08:00
onPullDownRefresh() {
this.getManicureList({ load: 'reload' });
},
2020-08-04 19:08:04 +08:00
onLoad() {
this.setViewHeight();
},
2020-06-04 08:21:34 +08:00
onShow() {
this.current = 0;
this.swiperCurrent = 0;
2020-08-01 16:36:48 +08:00
this.getManicureList({ load: 'reload' });
2020-06-23 17:21:01 +08:00
},
2020-06-04 08:21:34 +08:00
methods: {
2020-08-01 16:36:48 +08:00
async getManicureList({ load }) {
const res = await this.$u.api.getManicureList({
2020-06-23 09:00:04 +08:00
page: this.page
})
2020-08-01 16:36:48 +08:00
uni.stopPullDownRefresh();
this.timer = true;
2020-06-24 16:39:31 +08:00
if (res.errCode == 0) {
2020-08-01 16:36:48 +08:00
if(load == 'reload') this.orderList = res.data.list;
else if(load == 'loadmore') this.orderList.push(...res.data.list);
2020-06-24 16:39:31 +08:00
}
2020-08-01 16:36:48 +08:00
return res.data.list.length;
2020-06-23 09:00:04 +08:00
},
2020-07-06 17:32:29 +08:00
// 加载更多
2020-06-23 09:00:04 +08:00
reachBottom() {
2020-08-01 16:36:48 +08:00
if(!this.timer) return false;
2020-06-24 16:39:31 +08:00
this.loadStatus = "loading";
2020-06-23 09:00:04 +08:00
this.page++;
2020-08-01 16:36:48 +08:00
this.getManicureList({ load: 'loadmore' }).then(length => {
if(length == 0) {
2020-06-24 16:39:31 +08:00
this.page--;
2020-08-01 16:36:48 +08:00
this.loadStatus = 'nomore';
2020-06-24 16:39:31 +08:00
} else {
2020-08-01 16:36:48 +08:00
this.loadStatus = 'loading';
2020-06-24 16:39:31 +08:00
}
2020-08-01 16:36:48 +08:00
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
2020-06-24 16:39:31 +08:00
})
2020-06-23 09:00:04 +08:00
},
2020-08-04 19:08:04 +08:00
setViewHeight() {
const res = uni.getSystemInfoSync();
2020-08-09 18:39:35 +08:00
this.swiperHeight = res.windowHeight - (88 * (res.windowWidth / 750)) + 'px';
2020-08-04 19:08:04 +08:00
},
2020-06-04 08:21:34 +08:00
tabsChange(index) {
this.swiperCurrent = index;
2020-08-03 14:34:56 +08:00
// this.toApplyPage(index);
2020-06-04 08:21:34 +08:00
},
animationfinish(e) {
let current = e.detail.current;
this.swiperCurrent = current;
this.current = current;
this.toApplyPage(current);
},
toApplyPage(index) {
if(index == 1) {
uni.navigateTo({
2020-06-08 15:23:23 +08:00
url: '/pageE/tool/ManicureOrder'
2020-06-04 08:21:34 +08:00
});
}
}
},
};
</script>
<style lang="scss" scoped>
.manicure {
min-height: calc(100vh - var(--window-top));
background-color: #ECECEC;
display: flex;
flex-direction: column;
> uni-swiper {
flex: 1;
}
.swiper-item {
.order-list {
2020-06-09 10:12:32 +08:00
height:100%;
2020-06-08 15:23:23 +08:00
box-sizing: border-box;
padding: 20rpx 30rpx 0;
2020-06-04 08:21:34 +08:00
.order-item {
padding: 30rpx;
width:690rpx;
height: 229rpx;
background: rgba(255,255,255,1);
border-radius: 10rpx;
margin-bottom: 20rpx;
.order-title {
display: flex;
align-items: center;
justify-content: space-between;
.order-text {
font-size: 30rpx;
color: rgba(51,51,51,1);
}
.order-status {
font-size: 28rpx;
color: rgba(255,120,15,1);
}
}
.order-name {
font-size: 32rpx;
font-weight: 500;
color: rgba(51,51,51,1);
margin: 43rpx 0 45rpx;
}
.order-date {
font-size: 24rpx;
color: rgba(153,153,153,1);
}
}
}
}
}
</style>