index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="car">
  3. <view class="cartop">
  4. <view class="tabtop flexc">
  5. <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
  6. </view>
  7. </view>
  8. <!-- 列表 -->
  9. <view class="carlists">
  10. <box-list :datainfo="list" :tsjyList="tsjyList" :wtdt="wtdt" type='complaint' @getDetail="getDetail" @getDelFn="getDelFn"></box-list>
  11. </view>
  12. <view class="rfbtn" @click="getAddFn">新增投诉建议</view>
  13. <loading></loading>
  14. </view>
  15. </template>
  16. <script>
  17. import config from '@/config'
  18. const baseUrl = config.baseUrl
  19. import boxList from "@/news/components/box/list.vue"
  20. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  21. import {getDictionaryFn} from "@/api/system/user.js"
  22. import {suggestionlList,suggestionlDel} from "@/api/work/news.js"
  23. export default{
  24. components:{boxList},
  25. data(){
  26. return{
  27. cxrq:"",
  28. text:'',
  29. list:[],
  30. pageSize: 10,
  31. pageNum: 1,
  32. reachflag: true,
  33. wtdt:'',
  34. tabval:'-1',
  35. tablist:[{tit:'全部',val:-1}],
  36. tsjyList:[]
  37. }
  38. },
  39. onUnload() {
  40. uni.$off('refSuggestion')
  41. },
  42. onLoad: function() {
  43. uni.$on('refSuggestion',(res)=>{
  44. this.getrefreshData()
  45. })
  46. this.init()
  47. this.getDataFn()
  48. },
  49. // 上拉触底加载更多触发事件
  50. onReachBottom() {
  51. if (this.reachflag) {
  52. this.pageNum++
  53. this.getDataFn()
  54. }
  55. },
  56. methods:{
  57. checkPermi, checkRole,
  58. init(){
  59. // 投诉建议类型
  60. getDictionaryFn('complaint_types').then(res=>{
  61. if(res.code==200){
  62. this.tsjyList = res.data.map(v => {
  63. var obj={
  64. tit: v.dictLabel,
  65. val: v.dictValue
  66. }
  67. this.tablist.push(obj)
  68. return {
  69. dictLabel: v.dictLabel,
  70. dictValue: v.dictValue
  71. }
  72. })
  73. }
  74. })
  75. },
  76. getDetail(id){
  77. this.$tab.navigateTo("/news/pages/complaint/detail?id="+id)
  78. },
  79. getAddFn(){
  80. this.$tab.navigateTo("/news/pages/complaint/add")
  81. },
  82. getConfirm(){
  83. this.getrefreshData()
  84. },
  85. getReset(){
  86. this.cxrq='';
  87. this.text='';
  88. this.getrefreshData()
  89. },
  90. getrefreshData(){
  91. this.pageNum=1;
  92. this.list=[];
  93. this.reachflag=true;
  94. this.getDataFn()
  95. },
  96. getTabFn(val){
  97. this.tabval=val;
  98. this.getrefreshData();
  99. },
  100. bindDateChangea(e){
  101. var val=e.detail.value;
  102. this.cxrq=val;
  103. },
  104. getDelFn(data){
  105. console.log(11)
  106. var that=this;
  107. suggestionlDel(data).then(res=>{
  108. if(res.code==200){
  109. this.$toast("删除成功");
  110. setTimeout(function(){
  111. that.getrefreshData()
  112. },1500)
  113. }
  114. })
  115. },
  116. getDataFn(){
  117. var params={
  118. pageSize:this.pageSize,
  119. pageNum: this.pageNum,
  120. isPublic:'Y'
  121. }
  122. if(this.tabval!=-1){
  123. params.status=this.tabval;
  124. }
  125. suggestionlList(params).then(res=>{
  126. if(res.code==200){
  127. if (res.rows.length < this.pageSize) {
  128. this.reachflag = false
  129. this.wtdt = '到底了~';
  130. } else {
  131. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  132. if (num < res.total) {
  133. this.reachflag = true
  134. this.wtdt = ''
  135. } else {
  136. this.reachflag = false
  137. this.wtdt = '到底了~';
  138. }
  139. }
  140. var newArr=JSON.parse(JSON.stringify(res.rows))
  141. newArr.forEach(ite=>{
  142. ite.right=0;
  143. })
  144. if (this.pageNum == 1) {
  145. this.list = newArr;
  146. } else {
  147. this.list = this.list.concat(newArr)
  148. }
  149. }else{
  150. this.$toast(res.msg)
  151. }
  152. })
  153. },
  154. }
  155. }
  156. </script>
  157. <style>
  158. page{background: #F3F3F0;}
  159. </style>
  160. <style lang="scss" scoped>
  161. .car{padding: 144rpx 0 110rpx;}
  162. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  163. .topa{padding: 20rpx ;
  164. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  165. .chekt{min-width: 180rpx;
  166. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  167. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  168. }
  169. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  170. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  171. input{flex: 1;font-size: 26rpx;color: #272727;}
  172. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  173. font-size: 26rpx;
  174. color: #FFFFFF;}
  175. }
  176. }
  177. .tabtop{padding-bottom: 40rpx;padding-top: 24rpx;
  178. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;
  179. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  180. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  181. }
  182. }
  183. }
  184. }
  185. .carlists{padding: 0 18rpx;}
  186. </style>