deming/pageE/tool/Manicure.vue
2020-08-03 14:34:56 +08:00

165 lines
4.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="manicure">
<view>
<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>
</view>
<swiper :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
<scroll-view scroll-y class="order-list" @scrolltolower="reachBottom">
<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>
<view class="order-status">{{ item.status }}</view>
</view>
<view class="order-name">美甲人姓名{{ item.manicure_name }}</view>
<view class="order-date">时间{{ item.manicure_time | dateFormat }}</view>
</view>
<u-loadmore :status="loadStatus" bgColor="#ECECEC" margin-bottom="20" v-if="orderList.length>=pageSize"></u-loadmore>
</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 {
pageSize: 1,
list: [{
name: '我的订单'
}, {
name: '申请表'
}],
current: 0,
swiperCurrent: 0,
page: 1,
orderList: [],
loadStatus: 'loadmore',
timer: true,
}
},
onPullDownRefresh() {
this.getManicureList({ load: 'reload' });
},
onShow() {
this.current = 0;
this.swiperCurrent = 0;
this.getManicureList({ load: 'reload' });
},
filters: {
dateFormat(value) {
let date = new Date(value * 1000);
let year, month, day;
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
return year + "-" + month + "-" + day;
}
},
methods: {
async getManicureList({ load }) {
const res = await this.$u.api.getManicureList({
page: this.page
})
uni.stopPullDownRefresh();
this.timer = true;
if (res.errCode == 0) {
if(load == 'reload') this.orderList = res.data.list;
else if(load == 'loadmore') this.orderList.push(...res.data.list);
}
return res.data.list.length;
},
// 加载更多
reachBottom() {
if(!this.timer) return false;
this.loadStatus = "loading";
this.page++;
this.getManicureList({ load: 'loadmore' }).then(length => {
if(length == 0) {
this.page--;
this.loadStatus = 'nomore';
} else {
this.loadStatus = 'loading';
}
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
})
},
tabsChange(index) {
this.swiperCurrent = index;
// this.toApplyPage(index);
},
animationfinish(e) {
let current = e.detail.current;
this.swiperCurrent = current;
this.current = current;
this.toApplyPage(current);
},
toApplyPage(index) {
if(index == 1) {
uni.navigateTo({
url: '/pageE/tool/ManicureOrder'
});
}
}
},
};
</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 {
height:100%;
box-sizing: border-box;
padding: 20rpx 30rpx 0;
.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>