index.vue 4.8 KB

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