123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375 |
- <template>
- <view class="content">
- <view class="navbar">
- <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
- </view>
- <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" @change="changeTab">
- <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
- <scroll-view scroll-y="true" class="list-scroll-content" :style="{ height: height }" @scrolltolower='loadData()'>
- <!-- 申请列表 -->
- <!-- 空白页 -->
- <!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
- <view class="apply-box" v-for="item in tabItem.orderList">
- <view class="box-top">
- <image :src="item.user_info.avatar" mode="" class="user-img"></image>
- <view class="user-info">
- <view class="user-name clamp">{{ item.user_info.nickname }}</view>
- <view class="user-phone">{{ item.user_info.mobile }}</view>
- </view>
- </view>
- <view class="apply-info flex">
- <view class="img-wrap"><image :src="imgitem" mode="" class="upimg" v-for="imgitem in item.voucherimages" @click="open(imgitem)"></image></view>
- <view class="btn-wrap flex" v-if="tabCurrentIndex == 0 && item.voucherimages != null">
- <view class="btn btn-reject" @click="cancelApply(item)">{{ $t('hea.jj') }}</view>
- <view class="btn btn-pass" @click="passApply(item)">{{ $t('hea.ty') }}</view>
- </view>
- <view class="btn-wrap" v-if="tabCurrentIndex == 1">{{ item.status == 1 ? $t('hea.ytg') : $t('hea.wtg') }}</view>
- </view>
- </view>
- <uni-load-more :status="tabItem.loadingType"></uni-load-more>
- </scroll-view>
- </swiper-item>
- </swiper>
- <uni-popup ref="popup" type="center">
- <movable-area class="popup-box">
- <movable-view class="popup-item" :scale="true" direction="all"><image :src="img" mode=""></image></movable-view>
- </movable-area>
- </uni-popup>
- <u-tabbar :list="tabbar" bg-color="#000" active-color="#FAD6B0" inactive-color="#71614f" change="change"></u-tabbar>
- </view>
- </template>
- <script>
- import uniPopup from '@/components/uni-popup/uni-popup.vue';
- import { getApplyList, passApply, cancelApply } from '../../api/apply.js';
- import empty from '@/components/empty';
- import { tabbar } from '@/components/tabbar/tabbar.js';
- import { mapState, mapMutations } from 'vuex';
- export default {
- components: {
- empty,
- uniPopup
- },
- data() {
- return {
- img: '', //图片
- height: '',
- tabCurrentIndex: 0,
- tabbar: [
- {
- iconPath: '../../static/tabBar/home.png',
- selectedIconPath: '../../static/tabBar/home-action.png',
- text: this.$t('hea.sy'),
- pagePath: '/pages/index/index'
- },
- {
- iconPath: '../../static/tabBar/center.png',
- selectedIconPath: '../../static/tabBar/center-action.png',
- text: this.$t('hea.shlb'),
- pagePath: '/pages/user/applyList'
- },
- {
- iconPath: '../../static/tabBar/user.png',
- selectedIconPath: '../../static/tabBar/user-action.png',
- text: this.$t('hea.wd'),
- pagePath: '/pages/user/user'
- }
- ],
- navList: [
- {
- state: 0,
- text: this.$t('hea.wsh'),
- loadingType: 'more',
- orderList: [],
- page: 1,
- limit: 10
- },
- {
- state: 1,
- text: this.$t('hea.ysh'),
- loadingType: 'more',
- orderList: [],
- page: 1,
- limit: 10
- }
- ]
- };
- },
- onReady(res) {
- var obj = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper-box').boundingClientRect();
- query.exec(function(res) {
- console.log(res, 'ddddddddddddd');
- obj.height = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', obj.height);
- });
- },
- fail: res => {}
- });
- },
- computed: {
- ...mapState(['lang'])
- },
- watch: {
- lang(val) {
- this.$set(this.navList[0], 'text', this.$t('hea.wsh'));
- this.$set(this.navList[1], 'text', this.$t('hea.ysh'));
- this.$set(this.tabbar[0], 'text', this.$t('hea.sy'));
- this.$set(this.tabbar[1], 'text', this.$t('hea.shlb'));
- this.$set(this.tabbar[2], 'text', this.$t('hea.wd'));
- }
- },
- onShow() {
- uni.setNavigationBarTitle({
- title: this.$t('foo.shlb')
- });
- this.navList[0].orderList = [];
- this.navList[0].page = 1;
- this.navList[0].loadingType = 'more';
- this.navList[0].loaded = false;
- this.navList[1].orderList = [];
- this.navList[1].page = 1;
- this.navList[1].loadingType = 'more';
- this.navList[1].loaded = false;
- this.loadData();
- },
-
- methods: {
- //顶部tab点击
- tabClick(index) {
- this.tabCurrentIndex = index;
- },
- changeTab(e) {
- this.tabCurrentIndex = e.target.current;
- this.loadData('tabChange');
- },
- loadData(source,show) {
- console.log('swiper');
- let index = this.tabCurrentIndex;
- let navItem = this.navList[index];
- let state = navItem.state;
- if (source === 'tabChange' && navItem.loaded === true) {
- //tab切换只有第一次需要加载数据
- return;
- }
- if (navItem.loadingType === 'noMore') {
- return;
- }
- if (navItem.loadingType === 'loading') {
- //防止重复加载
- return;
- }
- //修改当前对象状态为加载中
- navItem.loadingType = 'loading';
- getApplyList({
- page: navItem.page,
- limit: navItem.limit,
- status: state
- }).then(({ data }) => {
- let arr = data.list.map(item => {
- if (item.voucherimages) {
- let arr = item.voucherimages.split(',');
- console.log(arr, 'ddddddddddddddddddddddd');
- item.voucherimages = arr;
- }else {
- item.voucherimages = null
- }
- return item;
- });
- navItem.orderList = navItem.orderList.concat(arr);
- if (data.list.length == navItem.limit) {
- navItem.page++;
- navItem.loadingType = 'more';
- } else {
- navItem.loadingType = 'noMore';
- }
- this.$set(navItem, 'loaded', true);
- });
- },
- cancelApply(item) {
- const obj = this;
- console.log(item, 'cancelApply');
- cancelApply({}, item.id)
- .then(res => {
- console.log(res);
- let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(item);
- obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
- uni.showToast({
- title: '审核成功',
- duration: 2000
- });
- })
- .catch(err => {
- console.log(err);
- });
- },
- passApply(item) {
- let obj = this;
- console.log('passApply');
- passApply({}, item.id)
- .then(res => {
- console.log(res);
- let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(item);
- obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
- uni.showToast({
- title: '审核成功',
- duration: 2000
- });
- })
- .catch(err => {
- console.log(err);
- });
- },
- open(option) {
- this.img = option;
- console.log('点击出现弹窗');
- this.$refs.popup.open();
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .navbar {
- display: flex;
- height: 40px;
- padding: 0 5px;
- background: #000;
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
- position: relative;
- z-index: 10;
- .nav-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- font-size: 15px;
- color: #999999;
- position: relative;
- &.current {
- color: $base-color;
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 44px;
- height: 0;
- border-bottom: 2px solid $base-color;
- }
- }
- }
- }
- .swiper-box {
- background-color: #15130f;
- .apply-box {
- height: 317rpx;
- width: 702rpx;
- // background-color: red;
- margin: 0 auto;
- border-bottom: 1px solid #6c6a68;
- padding-top: 30rpx;
- .box-top {
- height: 80rpx;
- // background-color: #bfa;
- display: flex;
- justify-content: flex-start;
- .user-img {
- width: 80rpx;
- height: 80rpx;
- background-color: #eee;
- margin-right: 20rpx;
- flex-shrink: 0;
- border-radius: 50%;
- }
- .user-name {
- max-width: 500rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #ffffff;
- }
- .user-phone {
- padding-top: 10rpx;
- font-size: 22rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #ffffff;
- }
- }
- .apply-info {
- padding: 25rpx 0 0 100rpx;
- justify-content: space-between;
- .img-wrap {
- .upimg {
- width: 153rpx;
- height: 152rpx;
- border-radius: 10rpx;
- background-color: #999;
- margin-left: 10rpx;
- }
- }
- .btn-wrap {
- align-self: flex-end;
- color: #fad6b0;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #fad6b0;
- .btn {
- width: 98rpx;
- line-height: 47rpx;
- text-align: center;
- }
- .btn-reject {
- border: 1px solid #fad6b0;
- border-radius: 5rpx;
- color: #fad6b0;
- }
- .btn-pass {
- background: linear-gradient(-74deg, #ce9c6d, #ffecd6);
- border-image: linear-gradient(115deg, #feebd5, #ffffff, #e1ad7d) 1 1;
- box-shadow: 3rpx 4rpx 5rpx 0rpx rgba(151, 118, 74, 0.5);
- border-radius: 5rpx;
- color: #874b19;
- margin-left: 10rpx;
- }
- }
- }
- }
- }
- .popup-box {
- width: 522rpx;
- height: 605rpx;
- border-radius: 20rpx;
- position: relative;
- .popup-item {
- width: 100%;
- height: 100%;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- </style>
|