index.vue 5.1 KB

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