123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <view class="car">
- <view class="cartop">
- <view class="tabtop flexc">
- <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
- </view>
- </view>
- <!-- 列表 -->
- <view class="carlists">
- <box-list :datainfo="list" :tsjyList="tsjyList" :wtdt="wtdt" type='complaint' @getDetail="getDetail" @getDelFn="getDelFn"></box-list>
- </view>
- <view class="rfbtn" @click="getAddFn">新增投诉建议</view>
- <loading></loading>
- </view>
- </template>
- <script>
- import config from '@/config'
- const baseUrl = config.baseUrl
- import boxList from "@/news/components/box/list.vue"
- import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
- import {getDictionaryFn} from "@/api/system/user.js"
- import {suggestionlList,suggestionlDel} from "@/api/work/news.js"
- export default{
- components:{boxList},
- data(){
- return{
- cxrq:"",
- text:'',
- list:[],
- pageSize: 10,
- pageNum: 1,
- reachflag: true,
- wtdt:'',
- tabval:'-1',
- tablist:[{tit:'全部',val:-1}],
- tsjyList:[],
- userId:this.$store.state.user.userId,
- }
- },
- onUnload() {
- uni.$off('refSuggestion')
- },
- onLoad: function() {
- uni.$on('refSuggestion',(res)=>{
- this.getrefreshData()
- })
- this.init()
- this.getDataFn()
- },
- // 上拉触底加载更多触发事件
- onReachBottom() {
- if (this.reachflag) {
- this.pageNum++
- this.getDataFn()
- }
- },
- methods:{
- checkPermi, checkRole,
- init(){
- // 投诉建议类型
- getDictionaryFn('complaint_types').then(res=>{
- if(res.code==200){
- this.tsjyList = res.data.map(v => {
- var obj={
- tit: v.dictLabel,
- val: v.dictValue
- }
- this.tablist.push(obj)
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- }
- })
- },
- getDetail(id){
- this.$tab.navigateTo("/news/pages/complaint/detail?id="+id)
- },
- getAddFn(){
- this.$tab.navigateTo("/news/pages/complaint/add")
- },
- getConfirm(){
- this.getrefreshData()
- },
- getReset(){
- this.cxrq='';
- this.text='';
- this.getrefreshData()
- },
- getrefreshData(){
- this.pageNum=1;
- this.list=[];
- this.reachflag=true;
- this.getDataFn()
- },
- getTabFn(val){
- this.tabval=val;
- this.getrefreshData();
- },
- bindDateChangea(e){
- var val=e.detail.value;
- this.cxrq=val;
- },
- getDelFn(data){
- console.log(11)
- var that=this;
- suggestionlDel(data).then(res=>{
- if(res.code==200){
- this.$toast("删除成功");
- setTimeout(function(){
- that.getrefreshData()
- },1500)
- }
- })
- },
- getDataFn(){
- var params={
- pageSize:this.pageSize,
- pageNum: this.pageNum,
- isPublic:'Y',
- userId:this.userId
- }
- if(this.tabval!=-1){
- params.status=this.tabval;
- }
- suggestionlList(params).then(res=>{
- if(res.code==200){
- if (res.rows.length < this.pageSize) {
- this.reachflag = false
- this.wtdt = '到底了~';
- } else {
- var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
- if (num < res.total) {
- this.reachflag = true
- this.wtdt = ''
- } else {
- this.reachflag = false
- this.wtdt = '到底了~';
- }
- }
- var newArr=JSON.parse(JSON.stringify(res.rows))
- newArr.forEach(ite=>{
- ite.right=0;
- })
- if (this.pageNum == 1) {
- this.list = newArr;
- } else {
- this.list = this.list.concat(newArr)
- }
- }else{
- this.$toast(res.msg)
- }
- })
-
- },
- }
- }
- </script>
- <style>
- page{background: #F3F3F0;}
- </style>
- <style lang="scss" scoped>
- .car{padding: 144rpx 0 110rpx;}
- .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
- .topa{padding: 20rpx ;
- .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
- .chekt{min-width: 180rpx;
- view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
- image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
- }
- .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
- image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
- input{flex: 1;font-size: 26rpx;color: #272727;}
- .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
- font-size: 26rpx;
- color: #FFFFFF;}
- }
- }
- .tabtop{padding-bottom: 40rpx;padding-top: 24rpx;
- .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;
- &.act{font-weight: bold;font-size: 32rpx;color: #272727;
- &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
- }
- }
- }
- }
- .carlists{padding: 0 18rpx;}
- </style>
|