jiangping
2025-06-06 a2299a6d4a6f99e9c11132138f5d3e9ec68f03ea
admin/src/views/finance/bull.vue
@@ -3,162 +3,216 @@
    <QueryForm v-model="filters" :query-form-config="queryFormConfig" @handleQuery="getList(1)" @clear="clear" />
    <div class="df_sb mt20">
      <div class="tabs">
        <div class="tab" :class="{ active: activeTabs == 0 }" @click="tabsClick(0)">收款账单</div>
        <div class="tab" :class="{ active: activeTabs == 1 }" @click="tabsClick(1)">付款账单</div>
        <div class="tab" :class="{ active: billType === 0 }" @click="tabsClick(0)">收款账单</div>
        <div class="tab" :class="{ active: billType === 1 }" @click="tabsClick(1)">付款账单</div>
      </div>
      <div class="btns">
        <el-button type="primary" @click="handleEdit()" icon="el-icon-plus"
        <el-button type="primary" @click="addOpen" icon="el-icon-plus"
          v-permissions="['business:ywpatrolline:create']">新建</el-button>
        <el-button @click="handleEx" v-permissions="['business:ywpatrolline:create']">导出</el-button>
<!--        <el-button @click="handleDetail" v-permissions="['business:ywpatrolline:create']">导出</el-button>-->
      </div>
    </div>
    <el-table v-loading="loading" :data="list" stripe>
      <el-table-column prop="" label="运维人" min-width="100" show-overflow-tooltip />
      <el-table-column prop="code" label="设备编号" min-width="100" show-overflow-tooltip />
      <el-table-column prop="name" label="设备名称" min-width="100" show-overflow-tooltip />
      <el-table-column prop="stautsName" label="设备状态" min-width="100" show-overflow-tooltip />
      <el-table-column prop="remark" label="运维备注" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="创建时间" min-width="100" show-overflow-tooltip />
      <el-table-column prop="customerName" label="客户名称" min-width="100" show-overflow-tooltip />
      <el-table-column label="房间" min-width="170" show-overflow-tooltip>
        <template slot-scope="{row}">
          <div style="display: flex; flex-direction: column;" v-if="row.roomPathName">
            <span v-for="(item, index) in row.roomPathName.split(';')" :key="index">{{item}}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="contractCode" label="合同编号" min-width="100" show-overflow-tooltip />
      <el-table-column label="结清状态" min-width="100" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span v-if="row.payStatus === 0">待收款</span>
          <span v-if="row.payStatus === 1">已结清</span>
          <span v-if="row.payStatus === 2">部分结清</span>
          <span v-if="row.payStatus === 3">待付款</span>
          <span v-if="row.payStatus === 4">待退款</span>
          <span v-if="row.payStatus === 5">已关闭</span>
        </template>
      </el-table-column>
      <el-table-column prop="totleFee" label="账单金额" min-width="100" show-overflow-tooltip />
      <el-table-column prop="receivableFee" :label="`应${billType === 0 ? '收' : '付'}金额`" min-width="100" show-overflow-tooltip />
      <el-table-column prop="actReceivableFee" :label="`实${billType === 0 ? '收' : '付'}金额`" min-width="100" show-overflow-tooltip />
      <el-table-column :label="`需收/付金额`" min-width="100" show-overflow-tooltip>
        <template slot-scope="{row}">
          {{Math.abs(row.needReceivableFee)}}
        </template>
      </el-table-column>
      <el-table-column label="费用类型" min-width="100" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span v-if="row.costType === 0">租赁费</span>
          <span v-if="row.costType === 1">物业费</span>
          <span v-if="row.costType === 2">租赁押金</span>
          <span v-if="row.costType === 3">物业押金</span>
          <span v-if="row.costType === 4">水电费</span>
          <span v-if="row.costType === 5">杂项费</span>
          <span v-if="row.costType === 6">其它</span>
          <span v-if="row.costType === 7">保证金</span>
        </template>
      </el-table-column>
      <el-table-column label="是否逾期" min-width="100" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span v-if="row.isOverdue === 0">未逾期</span>
          <span v-if="row.isOverdue === 1" style="color: red;">已逾期</span>
        </template>
      </el-table-column>
      <el-table-column label="计费周期" min-width="200" show-overflow-tooltip>
        <template slot-scope="{row}">
          {{ row.startDate }} ~ {{ row.endDate }}
        </template>
      </el-table-column>
      <el-table-column prop="planPayDate" :label="`应${billType === 0 ? '收' : '付'}日期`" min-width="100" show-overflow-tooltip />
      <el-table-column label="账单来源" min-width="100" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span v-if="row.type === 0">合同账单</span>
          <span v-if="row.type === 1">自建账单</span>
        </template>
      </el-table-column>
      <el-table-column label="账单状态" min-width="100" fixed="right" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span v-if="row.status === 0">开启</span>
          <span v-if="row.status === 1" style="color: red;">关闭</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" min-width="120" fixed="right">
        <template slot-scope="{row}">
          <el-button type="text" @click="handleDetail(row)" icon="el-icon-edit"
            v-permissions="['business:category:update']">查看</el-button>
          <el-button type="text" @click="handleDetail(row)" icon="el-icon-edit" v-permissions="['business:category:update']">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="mt20">
      <Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
    </div>
    <Edit v-if="showEdit" ref="EditRef" @success="getList" @close="showEdit = false" />
    <Edit ref="EditRef" @success="getList" />
    <Detail ref="DetailRef" @success="getList" />
    <BullEditFu ref="BullEditFu" @success="getList" />
  </div>
</template>
<script>
import Pagination from '@/components/common/Pagination'
import QueryForm from '@/components/common/QueryForm'
import Edit from './components/deviceEdit.vue'
import { fetchList, deleteById } from '@/api/Inspection/device'
import Edit from './components/bullEdit.vue'
import BullEditFu from './components/bullEditFu.vue'
import Detail from './components/bullDetail.vue'
import { fetchList } from '@/api/bill'
export default {
  components: {
    Pagination,
    QueryForm,
    Edit
    Edit,
    Detail,
    BullEditFu
  },
  data() {
  data () {
    return {
      loading: false,
      showEdit: false,
      pagination: {
        pageSize: 10,
        page: 1,
        total: 0
      },
      activeTabs: 0,
      filters: {},
      billType: 0,
      filters: {
        status: 0
      },
      list: [],
      total: 0,
      statusMap: [
        { value: 0, label: '待收款' },
        { value: 1, label: '已结算' },
        { value: 2, label: '部分结清' },
        { value: 3, label: '待退款' },
        { value: 4, label: '待付款' },
      ],
      queryFormConfig: {
        formItems: [
          {
            filed: 'name',
            filed: 'customerName',
            type: 'input',
            label: '客户名称',
            label: '客户名称'
          },
          {
            filed: 'contractCode',
            type: 'input',
            label: '合同编号'
          },
          {
            filed: 'status',
            type: 'select',
            label: '账单状态',
            options: [
              { value: '0', label: '开启' },
              { value: '1', label: '关闭' },
              { value: 0, label: '开启' },
              { value: 1, label: '关闭' }
            ]
          },
          {
            filed: 'status',
            filed: 'payStatus',
            type: 'select',
            label: '结清状态',
            options: this.statusMap
            options: [
              { value: 0, label: '待收款' },
              { value: 1, label: '已结清' },
              { value: 2, label: '部分结清' },
              { value: 3, label: '待付款' },
              { value: 4, label: '待退款' }
            ]
          },
          {
            filed: 'selDate',
            type: 'daterange',
            label: '应收/付日期'
          },
        ],
        online: true
          }
        ]
      }
    }
  },
  created() {
  created () {
    this.getList()
  },
  methods: {
    getList(page) {
    addOpen () {
      if (this.billType === 0) {
        this.$refs.EditRef.open('创建收款账单')
      } else {
        this.$refs.BullEditFu.open('创建付款账单')
      }
    },
    getList (page) {
      const { pagination, filters } = this
      let form = JSON.parse(JSON.stringify(filters))
      if (form && form.selDate && form.selDate.length > 0) {
        form.planPayDateStart = form.payDate[0]
        form.planPayDateEnd = form.payDate[1]
      }
      this.loading = true
      fetchList({
        model: {
          ...filters,
          billType: this.billType
        },
        capacity: pagination.pageSize,
        page: page || pagination.page,
        page: page || pagination.page
      }).then(res => {
        this.loading = false
        this.list = res.records || []
        this.list.forEach(item => {
          item.stautsName = item.status == 0 ? '正常' : item.status == 1 ? '损坏' : '报废'
          item.statusName = item.status === 1 ? '损坏' : item.status === 2 ? '报废' : '正常'
        })
        this.pagination.total = res.total || 0
      }, () => {
        this.loading = false
      })
    },
    handleEx() {
    tabsClick (val) {
      this.billType = val
      this.getList()
    },
    tabsClick(val) {
      this.activeTabs = val
    handleDetail (row) {
      this.$refs.DetailRef.open('账单详情', row.id)
    },
    handleEdit(row) {
      this.showEdit = true
      this.$nextTick(() => {
        this.$refs.EditRef.isShowModal = true
        if (row && row.id) {
          this.$refs.EditRef.getDetail(row.id)
        }
      })
    },
    handleDetail() {
    },
    handleDel(row) {
      let message = `确认删除该记录吗?`
      this.$dialog.deleteConfirm(message)
        .then(() => {
          this.isWorking.delete = true
          deleteById(row.id)
            .then(() => {
              this.$tip.apiSuccess('删除成功')
              this.getList()
            })
        })
        .catch(() => { })
    },
    clear() {
    clear () {
      this.filters = {}
      this.pagination.pageSize = 10
      this.pagination.page = 1
      this.getList()
    },
    handleSizeChange(capacity) {
    handleSizeChange (capacity) {
      this.pagination.pageSize = capacity
      this.getList()
    }
@@ -170,10 +224,8 @@
@import '@/assets/style/variables.scss';
.tabs {
  border-bottom: 1px solid #DFE2E8;
  display: flex;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  .tab {