123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <view class="car">
- <!-- 列表 -->
- <view class="carlists">
- <car-list :datainfo="list" :fwlxList="fwlxList" :wtdt="wtdt" type='feeset' @getDetail="getDetail" @getDelFn="getDelFn"></car-list>
- </view>
- <block v-if="checkPermi(['wuYe:feeSettings:add'])">
- <view style="height: 100rpx;"></view>
- <view class="rfbtn" @click="getFeeSetFn">添加设置</view>
- </block>
- <loading></loading>
- </view>
- </template>
- <script>
- import config from '@/config'
- const baseUrl = config.baseUrl
- import carList from "@/work/components/car/list.vue"
- import {getDictionaryFn} from "@/api/system/user.js"
- import {feesetList,feesetDel} from "@/api/work/manage.js"
- import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
- export default{
- components:{carList},
- data(){
- return{
- list:[],
- pageSize: 10,
- pageNum: 1,
- reachflag: true,
- wtdt:'',
- fwlxList:[]
- }
- },
- onUnload() {
- uni.$off('refsetList')
- },
- onLoad: function() {
- uni.$on('refsetList',(res)=>{
- this.getrefreshData()
- })
- this.init()
- this.getDataFn()
- },
- // 上拉触底加载更多触发事件
- onReachBottom() {
- if (this.reachflag) {
- this.pageNum++
- this.getDataFn()
- }
- },
- methods:{
- checkPermi, checkRole,
- init(){
- // 房屋类型
- getDictionaryFn('house_type').then(res=>{
- if(res.code==200){
- this.fwlxList = res.data.map(v => {
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- }
- })
- },
- getDetail(id){
- this.$tab.navigateTo("/work/pages/fee/set?id="+id)
- },
- getFeeSetFn(){
- this.$tab.navigateTo("/work/pages/fee/set")
- },
- getAddFn(){
-
- },
- getrefreshData(){
- this.pageNum=1;
- this.list=[];
- this.reachflag=true;
- this.getDataFn()
- },
- getDelFn(data){
- var that=this;
- feesetDel(data).then(res=>{
- if(res.code==200){
- this.$toast("删除成功");
- setTimeout(function(){
- that.getrefreshData()
- },1500)
- }
- })
- },
- getDataFn(){
- var params={
- pageSize:this.pageSize,
- pageNum: this.pageNum,
- }
- feesetList(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: 24rpx 0 10rpx;}
- .carlists{padding: 0 18rpx;}
- </style>
|