123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <view class="main pt0">
- <view class="tab">
- <u-tabs :list="tab" @click="tabClick"></u-tabs>
- <view class="filters" @click="show = true">
- <text class="icon"></text>
- <text>筛选</text>
- </view>
- </view>
- <view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/user/resume/application/receive/preview?id=' + item.id)">
- <view class="top">
- <image :src="ip + item.avatar" mode="widthFix" class="avatar"></image>
- <view class="state" style="color: #4caf50" v-if="item.isRead == 1">
- <text class="icon"></text>
- <text>已阅</text>
- </view>
- <view class="state" v-else>
- <text class="icon"></text>
- <text>未读</text>
- </view>
- <view class="con">
- <view class="name">{{ item.name }}</view>
- <text class="desc">{{ item.sex }} · {{ item.age }}岁</text>
- </view>
- </view>
- <view class="flex">
- <view class="f" v-if="item.state == 0">待处理</view>
- <view class="f" v-if="item.state == 1 && item.isAccept == 0 && item.isExpire == 0">等待对方同意接单 {{ item.countdown }}</view>
- <view class="f" v-if="item.state == 1 && item.isAccept == 0 && item.isExpire == 1">对方超时未操作(已过期)</view>
- <view class="f br" v-if="item.state == 1 && item.isAccept == 1">对方同意接单</view>
- <view class="f danger" v-if="item.state == 1 && item.isAccept == 2">对方已拒绝</view>
- </view>
- </view>
- <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
- <u-empty v-if="!loadMore && list.length == 0"></u-empty>
- <sift v-model="show" @confirm="confirm"></sift>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- ip: this.http.ip,
- tab: [
- { name: '全部', isRead: '' },
- { name: '已阅', isRead: 1 },
- { name: '未读', isRead: 0 }
- ],
- list: [],
- param: { pageNum: 1, pageSize: 10, type: 1 },
- loadMore: true,
- show: false
- };
- },
- onLoad(e) {
- this.param.positionId = e.id;
- this.getData();
- uni.$on('agreeApplication', (res) => {
- this.refresh();
- });
- setTimeout(() => {
- uni.setNavigationBarTitle({ title: e.title + '(' + e.total + ')' });
- }, 300);
- },
- methods: {
- getData() {
- this.http.request({
- url: '/app/deliver/receive/list',
- data: this.param,
- loading: 'false',
- success: (res) => {
- this.loadMore = res.data.pages > this.param.pageNum ? true : false;
- res.data.rows.forEach((item) => {
- if (item.isAccept == 0 && item.isExpire == 0 && item.state == 1) {
- const endTime = new Date(item.auditTime);
- endTime.setHours(endTime.getHours() + 1);
- item.countdown = '';
- item.timer = null;
- item.timer = this.util.startCountdown(endTime, (countdown) => {
- item.countdown = countdown;
- if (countdown == '已超时') {
- item.isExpire = 1;
- clearInterval(item.timer);
- }
- });
- }
- item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
- this.list.push(item);
- });
- }
- });
- },
- go(url) {
- uni.navigateTo({ url: url });
- },
- tabClick(e) {
- this.param.isRead = e.isRead;
- this.refresh();
- },
- confirm(e) {
- Object.assign(this.param, e);
- this.refresh();
- },
- //刷新数据
- refresh() {
- this.loadMore = true;
- this.param.pageNum = 1;
- this.list.forEach((item) => clearInterval(item.timer));
- this.list = [];
- this.getData();
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- setTimeout(() => {
- this.refresh();
- uni.stopPullDownRefresh();
- }, 1000);
- },
- //上拉加载
- onReachBottom() {
- if (this.loadMore) {
- this.param.pageNum++;
- this.getData();
- }
- },
- destroyed() {
- this.list.forEach((item) => clearInterval(item.timer));
- }
- };
- </script>
- <style lang="scss">
- .item {
- background-color: white;
- border-radius: 7px;
- padding: 15px;
- overflow: hidden;
- margin-bottom: 12px;
- .top {
- overflow: hidden;
- .avatar {
- float: left;
- width: 50px;
- height: 50px;
- border-radius: 50%;
- }
- .state {
- float: right;
- font-size: 14px;
- }
- .con {
- float: left;
- padding-left: 10px;
- .name {
- font-weight: bold;
- padding-bottom: 3px;
- }
- .desc {
- color: $font-c;
- font-size: 14px;
- }
- }
- }
- .flex {
- border-top: 1px solid $line;
- padding-top: 10px;
- font-size: 14px;
- margin-top: 13px;
- }
- }
- </style>
|