index.vue 4.9 KB

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