public-opinion/pagesA/my-opinion-list/my-opinion-list.vue

145 lines
4.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view>
<statusContainer titlet="我的民意提交" :ifReturn="false">
<view slot="content">
<view class="bacf disja pad-sx20 fon30" :style="{top:newtop+42+'px'}" style="margin: -20rpx -20rpx 0 -20rpx;position: sticky;z-index: 10;">
<view @tap="switchEv(0)" class="pad-sx20 disjcac radius20" :style="switchIndex==0?'background-color:#39d091;color:#FFFFFF;':''" style="width: 288rpx;">已发起</view>
<view @tap="switchEv(1)" class="pad-sx20 disjcac radius20" :style="switchIndex==1?'background-color:#39d091;color:#FFFFFF;':''" style="width: 288rpx;">已办理</view>
</view>
<view class="mar-s20 radius20 fon24 bacf posir" v-for="(item,index) in dataList" :key="index">
<view class="pad-sx20 pad-zy50 status-box">{{['待处理','已办理'][switchIndex]}}</view>
<view class="pad20 bbot line-h46 pad-x40">
<view class="fon30">{{item.coding}}</view>
<view class="">用户名{{item.u_name || '匿名提交'}}</view>
<view class="">{{item.community.name}}{{item.village.name}}</view>
<view class="">反馈问题{{item.description}}</view>
</view>
<view class="dis fon30">
<view @tap="goDetail(item.id)" class="width50 pad-sx30 disjcac border-r">
<image class="mar-y20" src="/static/icon/icon-check.png" mode="" style="width: 34rpx;height: 34rpx;"></image>查看
</view>
<view v-if="switchIndex==0" @tap="returnEv(item.id,index)" class="width50 pad-sx30 disjcac">
<image class="mar-y20" src="/static/icon/icon-revoke.png" mode="" style="width: 34rpx;height: 34rpx;"></image>
撤诉
</view>
<view @tap="goFeedback(item.id)" v-if="switchIndex==1" class="width50 pad-sx30 disjcac">
<image class="mar-y20" src="/static/icon/icon-feedback.png" mode="" style="width: 34rpx;height: 34rpx;"></image>
反馈
</view>
</view>
</view>
<view class="" v-if="total==dataList.length && total">
<pitera textStr="到底啦o(╥﹏╥)o"></pitera>
</view>
<view class="posixzy disjcac bacf pad-sx20" style="box-shadow: 0rpx -4rpx 30rpx rgba(0, 0, 0, .2);">
<view class="disjcac enter-btn" style="margin: 0;" @tap="goOpinionSubmit">民意提交</view>
</view>
</view>
</statusContainer>
<view class="" v-if="!total">
<nothing-page content="暂无数据"></nothing-page>
</view>
</view>
</template>
<script>
import statusContainer from '@/components/containers/status-container.vue';
import nothingPage from '@/components/nothing/nothing-page.vue';
import pitera from '@/components/nothing/pitera.vue';
export default {
components:{
statusContainer,
nothingPage,
pitera
},
data() {
return {
switchIndex:0,
newtop:uni.getSystemInfoSync().statusBarHeight,
dataList:[],
page:1,
size:4,
state:0,
total:0
}
},
onShow() {
this.getList();
},
onLoad() {
},
onReachBottom() {
if(this.total != this.dataList.length){
this.page++;
this.getList();
}
},
methods: {
// 切换事件
switchEv(index){
console.log(index);
this.switchIndex = index;
this.state = index;
this.page = 1;
this.dataList = [];
this.getList();
},
// 我的民意列表
getList(){
let params = {
page:this.page,
size:this.size,
state:this.state
}
this.$toolAll.tools.showToast('加载中...');
this.$requst.get('user/my-table',params).then(res=>{
if(res.code==0){
if(this.page==1){
this.dataList = [];
}
this.total = res.data.total;
this.dataList = [...this.dataList,...res.data.list];
uni.hideToast();
}
})
},
// 撤销民意
returnEv(id,index){
this.$toolAll.tools.showToast('正在撤销...');
this.$requst.post('user/revoke-opinion',{id}).then(res=>{
if(res.code==0){
this.$toolAll.tools.showToast('撤销成功');
this.dataList.splice(index,1);
}
})
},
// 前往提交页面
goOpinionSubmit(){
uni.navigateTo({
url:'/pagesA/passageway/passageway'
})
},
// 前往详情页
goDetail(id){
uni.navigateTo({
url:`/pagesA/detail/detail?id=${id}&manager=2`
})
},
// 前往反馈页面
goFeedback(id){
uni.navigateTo({
url:`/pagesA/feedback/feedback?id=${id}`
})
}
}
}
</script>
<style>
page{
background-color: #f5f5f5;
}
.status-box{position: absolute;right: 0;top: 0;background-color: #39d091;border-radius: 0 0 0 30rpx;}
</style>