Blame view

src/components/owner/ownerDetailAccountReceipt.vue 4.88 KB
c85e0853   wuxw   业主详情开发完成
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  <template>
    <div>
      <el-row class="margin-top-lg">
        <el-col :span="12"></el-col>
        <el-col :span="12" class="text-right">
          <el-button type="primary" size="small" @click="_printFeeAccountReceipt" style="margin-left:10px">
            {{$t('ownerDetailAccountReceipt.print')}}
          </el-button>
          <el-button type="primary" size="small" @click="_printFeeSmallAccountReceipt" style="margin-left:10px">
            {{$t('ownerDetailAccountReceipt.printSmall')}}
          </el-button>
        </el-col>
      </el-row>
      <div class="margin-top">
        <el-table
          :data="ownerDetailAccountReceiptInfo.feeReceipts"
          style="width: 100%; margin-top: 10px"
          border
          stripe
        >
          <el-table-column width="50" align="center">
            <template slot-scope="scope">
              <el-checkbox 
                v-model="scope.row.checked"
                @change="handleCheckChange(scope.row)"
              ></el-checkbox>
            </template>
          </el-table-column>
          <el-table-column prop="acctName" :label="$t('ownerDetailAccountReceipt.accountName')" align="center"></el-table-column>
          <el-table-column prop="acctTypeName" :label="$t('ownerDetailAccountReceipt.accountType')" align="center"></el-table-column>
          <el-table-column prop="ownerName" :label="$t('ownerDetailAccountReceipt.owner')" align="center"></el-table-column>
          <el-table-column prop="receivedAmount" :label="$t('ownerDetailAccountReceipt.prestoreAmount')" align="center"></el-table-column>
          <el-table-column prop="primeRateName" :label="$t('ownerDetailAccountReceipt.prestoreMethod')" align="center"></el-table-column>
          <el-table-column prop="amount" :label="$t('ownerDetailAccountReceipt.totalAmount')" align="center"></el-table-column>
          <el-table-column prop="createTime" :label="$t('ownerDetailAccountReceipt.prestoreTime')" align="center"></el-table-column>
          <el-table-column prop="arId" :label="$t('ownerDetailAccountReceipt.receiptId')" align="center"></el-table-column>
        </el-table>
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="pageSize"
          layout="total, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
    </div>
  </template>
  
  <script>
  import { listAccountReceipt } from '@/api/owner/ownerDetailAccountReceiptApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'OwnerDetailAccountReceipt',
    data() {
      return {
        ownerDetailAccountReceiptInfo: {
          feeReceipts: [],
          ownerId: '',
          total: 0,
          records: 0,
          selectReceipts: []
        },
        currentPage: 1,
        pageSize: 10,
        total: 0,
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
    },
    methods: {
      open(ownerId) {
        this.ownerDetailAccountReceiptInfo.ownerId = ownerId
        this._listOwnerDetailAccountReceipt(this.currentPage, this.pageSize)
      },
      _listOwnerDetailAccountReceipt(page, rows) {
        this.ownerDetailAccountReceiptInfo.selectReceipts = []
        const param = {
          page: page,
          row: rows,
          ownerId: this.ownerDetailAccountReceiptInfo.ownerId,
          communityId: this.communityId
        }
  
        listAccountReceipt(param).then(response => {
24d3590f   wuxw   房屋收费页面开发完成
88
          this.ownerDetailAccountReceiptInfo.feeReceipts = response.data.map(item => {
c85e0853   wuxw   业主详情开发完成
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
            return { ...item, checked: false }
          })
          this.total = response.data.total
        }).catch(error => {
          console.error('请求失败:', error)
        })
      },
      _printFeeAccountReceipt() {
        const selected = this.ownerDetailAccountReceiptInfo.feeReceipts.filter(item => item.checked)
        if (selected.length < 1) {
          this.$message.warning(this.$t('ownerDetailAccountReceipt.selectPrint'))
          return
        }
        const arIds = selected.map(item => item.arId).join(',')
        window.open(`/print.html#/pages/property/printAccountReceipt?arIds=${arIds}&apply=N`)
      },
      _printFeeSmallAccountReceipt() {
        const selected = this.ownerDetailAccountReceiptInfo.feeReceipts.filter(item => item.checked)
        if (selected.length < 1) {
          this.$message.warning(this.$t('ownerDetailAccountReceipt.selectPrint'))
          return
        }
        const arIds = selected.map(item => item.arId).join(',')
        window.open(`/smallPrint.html#/pages/property/printSmallAccountReceipt?arIds=${arIds}`)
      },
      handleCheckChange(row) {
        if (row.checked) {
          this.ownerDetailAccountReceiptInfo.selectReceipts.push(row.arId)
        } else {
          const index = this.ownerDetailAccountReceiptInfo.selectReceipts.indexOf(row.arId)
          if (index > -1) {
            this.ownerDetailAccountReceiptInfo.selectReceipts.splice(index, 1)
          }
        }
      },
      handleCurrentChange(val) {
        this.currentPage = val
        this._listOwnerDetailAccountReceipt(val, this.pageSize)
      }
    }
  }
  </script>