123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <template>
- <view class="container">
- <view class="swiper-box">
- <scroll-view class="cate-list">
- <view class="nodata" v-if="list.length == 0"><image src="/static/img/img011.png"></image></view>
- <view v-for="(item, index) in list" class="content-box">
- <view class="flex">
- <view class="item">
- <view class="name" v-if="item.status == 0 || item.status == 2">救援者姓名:救援者{{ item.helper }}</view>
- <view class="name" v-if="item.status == 1 || item.status == 3">救援者姓名:{{ item.helper_nickname }}</view>
- <view class="phone" v-if="item.status == 1 || item.status == 3">手机号:{{ item.helper_mobile }}</view>
- <view class="time">救援时间:{{ item.createtime }}</view>
- </view>
- <view class="call-btn" v-if="item.status == 1" @click.stop="Tocall(item)"><image src="/static/img/img016.png"></image></view>
- </view>
- <view class="tpl">{{ item.status_text }}</view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- import { mapState, mapMutations } from 'vuex';
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import empty from '@/components/empty';
- import { mySosList, accessSos, refuseSos } from '@/api/record.js';
- import { getTime } from '@/utils/rocessor.js';
- export default {
- components: {
- uniLoadMore,
- empty
- },
- data() {
- return {
- userInfo: '', //用户信息
- list: [],
- list1: [],
- limit: 100, //每次加载数据条数
- page: 1, //当前页数
- loadingType: 'more', //加载更多状态
- loading: 0
- };
- },
- onLoad() {},
- onShow() {
- this.loadData('refresh');
- },
- //下拉刷新
- onPullDownRefresh() {
- this.page = 1;
- this.loadData('refresh');
- },
- methods: {
- async loadData(type) {
- //这里是将订单挂载到tab列表下
- let obj = this;
- if (type != 'refresh') {
- //没有更多数据直接跳出方法
- if (obj.loadingType === 'nomore') {
- return;
- } else {
- // 设置当前为数据载入中
- obj.loadingType = 'loading';
- }
- } else {
- //当重新加载数据时更新状态为可继续添加数据
- obj.loadingType = 'more';
- }
- mySosList({
- status: -1,
- page: obj.page,
- limit: obj.limit
- })
- .then(({ data }) => {
- if (type === 'refresh') {
- obj.list1 = [];
- }
- let arr = data.map(e => {
- e.createtime = getTime(e.createtime);
- return e;
- });
- obj.list = obj.list.concat(arr);
- //判断是否还有下一页,有是more 没有是nomore
- if (obj.limit == obj.list.length) {
- obj.page++;
- obj.loadingType = 'more';
- } else {
- obj.loadingType = 'nomore';
- }
- // 判断是否为刷新数据
- if (type == 'refresh') {
- // 判断是否为点击搜索按钮跳转加载
- if (obj.loading == 1) {
- uni.hideLoading();
- } else {
- uni.stopPullDownRefresh();
- }
- }
- })
- .catch(e => {
- obj.loadingType = 'nomore';
- uni.hideLoading();
- });
- },
- //拨打电话
- Tocall(item) {
- uni.makePhoneCall({
- phoneNumber: item.helper_mobile
- });
- },
- navTo(url) {
- uni.navigateTo({
- url
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background: #f8f6f6;
- height: 100%;
- .container {
- width: 100%;
- height: 100%;
- .swiper-box {
- height: 90%;
- padding-top: 25rpx;
- }
- }
- }
- .nodata {
- width: 430rpx;
- margin: 0rpx auto;
- padding-top: 80rpx;
- image {
- width: 430rpx;
- height: 337rpx;
- }
- .text {
- text-align: center;
- color: #999999;
- font-size: 26rpx;
- }
- }
- .swiper-box {
- height: calc(100% - 40px);
- }
- .list-scroll-content {
- height: 100%;
- }
- .navbar {
- overflow: hidden;
- white-space: nowrap;
- background: #fff;
- padding: 0rpx 25rpx;
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
- .nav-item {
- text-align: center;
- display: inline-block;
- height: 100%;
- font-size: 28rpx;
- color: $font-color-dark;
- position: relative;
- width: 25%;
- padding: 25rpx 0rpx;
- &.current {
- color: #ff6666;
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 35px;
- height: 0;
- border-bottom: 2px solid #ff6666;
- }
- }
- }
- }
- .call-btn {
- image {
- width: 100rpx;
- height: 100rpx;
- }
- }
- .content-box {
- width: 90%;
- margin: 0rpx auto;
- background-color: #ffffff;
- border-radius: 15rpx;
- padding: 47rpx 30rpx;
- font-size: 24rpx;
- line-height: 60rpx;
- color: #666666;
- margin-bottom: 25rpx;
- }
- .item {
- .name {
- font-size: 28rpx;
- color: #333333;
- font-weight: 500;
- }
- }
- .call-btn {
- image {
- width: 100rpx;
- height: 100rpx;
- }
- }
- .box-btn {
- width: 80%;
- margin: 0rpx auto;
- margin-top: 30rpx;
- text-align: center;
- .accept {
- background: #ff4f4f;
- color: #ffffff;
- padding: 0rpx 30rpx;
- width: 35%;
- }
- .refuse {
- background: #f3f3f3;
- width: 35%;
- padding: 0rpx 30rpx;
- }
- }
- .tpl {
- font-size: 28rpx;
- font-weight: bold;
- color: rgba(255, 79, 79, 1);
- }
- </style>
|