Blame view

src/components/contract/contractDetailFee.vue 10.6 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
d767b5e6   wuxw   v1.9 合同费用bug 修复
2
    <div class="">
fc9bd1db   wuxw   开发完成合同详情
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
      <div class="flex justify-end">
        <div :span="2" class="padding-right-xs padding-left-xl"></div>
        <div :span="2" class="padding-right-xs padding-right-xl"></div>
        <div :span="8" class="text-right">
          <el-button type="primary" size="small" style="margin-left:10px" @click="_openTempImportContractFeeModal">
            {{ $t('contractDetailFee.temporaryFee') }}
          </el-button>
          <el-button type="primary" size="small" style="margin-left:10px" @click="_openContractCreateFeeAddModal">
            {{ $t('contractDetailFee.createFee') }}
          </el-button>
          <el-button type="primary" size="small" style="margin-left:10px" @click="_toContractOwePayFee">
            {{ $t('contractDetailFee.payArrears') }}
          </el-button>
        </div>
      </div>
      <div class="margin-top">
        <el-table :data="contractDetailFeeInfo.fees" style="width: 100%" border stripe>
          <el-table-column prop="feeName" :label="$t('contractDetailFee.feeItem')" align="center"></el-table-column>
          <el-table-column prop="feeFlagName" :label="$t('contractDetailFee.feeFlag')" align="center"></el-table-column>
          <el-table-column prop="feeTypeCdName" :label="$t('contractDetailFee.feeType')" align="center"></el-table-column>
          <el-table-column prop="amountOwed" :label="$t('contractDetailFee.receivableAmount')"
            align="center"></el-table-column>
          <el-table-column prop="startTime" :label="$t('contractDetailFee.accountingTime')"
            align="center"></el-table-column>
          <el-table-column :label="$t('contractDetailFee.receivablePeriod')" align="center">
            <template slot-scope="scope">
              {{ _getContractEndTime(scope.row) }}~<br />
              {{ _getContractDeadlineTime(scope.row) }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('contractDetailFee.description')" align="center" width="150">
            <template slot-scope="scope">
              <div v-if="scope.row.computingFormula == '5005' || scope.row.computingFormula == '9009'">
                <div><span>{{ $t('contractDetailFee.previousReading') }}:</span>{{ scope.row.preDegrees }}</div>
                <div><span>{{ $t('contractDetailFee.currentReading') }}:</span>{{ scope.row.curDegrees }}</div>
                <div><span>{{ $t('contractDetailFee.unitPrice') }}:</span>{{ scope.row.mwPrice || scope.row.squarePrice }}
                </div>
                <div><span>{{ $t('contractDetailFee.surcharge') }}:</span>{{ scope.row.additionalAmount }}</div>
              </div>
              <div v-else-if="scope.row.computingFormula == '6006'">
                <div><span>{{ $t('contractDetailFee.usage') }}:</span>{{
                  _getContractAttrValue(scope.row.feeAttrs, '390006') }}</div>
                <div><span>{{ $t('contractDetailFee.unitPrice') }}:</span>{{ scope.row.squarePrice }}</div>
                <div><span>{{ $t('contractDetailFee.surcharge') }}:</span>{{ scope.row.additionalAmount }}</div>
              </div>
              <div v-else-if="scope.row.feeTypeCd == '888800010017'">
                <div><span>{{ $t('contractDetailFee.algorithm') }}:</span>{{
                  _getContractAttrValue(scope.row.feeAttrs, '390005') }}</div>
                <div><span>{{ $t('contractDetailFee.usage') }}:</span>{{
                  _getContractAttrValue(scope.row.feeAttrs, '390003') }}</div>
              </div>
              <div v-else-if="scope.row.computingFormula == '4004'">
                <div>{{ $t('contractDetailFee.feeBasedOnActual') }}</div>
              </div>
              <div v-else>
                <div><span>{{ $t('contractDetailFee.unitPrice') }}:</span>{{ scope.row.squarePrice }}</div>
                <div v-if="scope.row.feeFlag == '1003006'"><span>{{ $t('contractDetailFee.surcharge') }}:</span>{{
                  scope.row.additionalAmount }}</div>
                <div v-else><span>{{ $t('contractDetailFee.fixedFee') }}:</span>{{ scope.row.additionalAmount }}</div>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="stateName" :label="$t('contractDetailFee.status')" align="center"></el-table-column>
          <el-table-column :label="$t('contractDetailFee.operation')" align="center">
            <template slot-scope="scope">
              <el-button type="text" v-if="scope.row.state != '2009001' && hasPrivilege('502020082314267912')"
                @click="_payContractFee(scope.row)">
                {{ $t('contractDetailFee.payment') }}
              </el-button>
              <el-button type="text" @click="_payContractFeeHis(scope.row)">
                {{ $t('contractDetailFee.paymentHistory') }}
              </el-button>
              <el-button type="text" v-if="hasPrivilege('502020090604200029')" @click="_deleteContractFee(scope.row)">
                {{ $t('contractDetailFee.cancel') }}
              </el-button>
              <el-button type="text" v-if="scope.row.state != '2009001' && hasPrivilege('502021070488970005')"
                @click="_finishContractFee(scope.row)">
                {{ $t('contractDetailFee.end') }}
              </el-button>
              <el-button type="text" v-if="scope.row.state != '2009001' && hasPrivilege('502020090427190001')"
                @click="_editContractFee(scope.row)">
                {{ $t('contractDetailFee.change') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-row class="margin-top">
          <el-col :span="4">
            <div>{{ $t('contractDetailFee.note1') }}</div>
            <div>{{ $t('contractDetailFee.note2') }}</div>
          </el-col>
          <el-col :span="2">
            <span>{{ $t('contractDetailFee.arrearsSubtotal') }}:</span>
            {{ contractDetailFeeInfo.totalAmount }}
          </el-col>
          <el-col :span="6" class="text-right">
            <el-pagination @current-change="handlePageChange" :current-page="pagination.currentPage"
              :page-size="pagination.pageSize" layout="total, prev, pager, next"
              :total="pagination.total"></el-pagination>
          </el-col>
        </el-row>
      </div>
d767b5e6   wuxw   v1.9 合同费用bug 修复
105
106
107
108
109
110
      <temp-import-room-fee ref="tempImportRoomFee" @success="_query"></temp-import-room-fee>
      <contract-create-fee-add ref="contractCreateFeeAdd" @success="_query"></contract-create-fee-add>
      <delete-fee ref="deleteFee" @success="_query"></delete-fee>
      <edit-fee ref="editFee" @success="_query"></edit-fee>
      <finish-fee ref="finishFee" @success="_query"></finish-fee>
  
fc9bd1db   wuxw   开发完成合同详情
111
112
113
114
115
116
117
    </div>
  </template>
  
  <script>
  import { listFee } from '@/api/contract/contractDetailFeeApi'
  import { getCommunityId } from '@/api/community/communityApi'
  import TempImportRoomFee from '@/components/fee/tempImportRoomFee'
d767b5e6   wuxw   v1.9 合同费用bug 修复
118
119
120
121
122
  import contractCreateFeeAdd from '@/components/fee/contractCreateFeeAdd'
  import {dateFormat} from '@/utils/dateUtil'
  import DeleteFee from '@/components/fee/deleteFee'
  import EditFee from '@/components/fee/editFee'
  import FinishFee from '@/components/fee/finishFee'
fc9bd1db   wuxw   开发完成合同详情
123
124
125
126
  
  export default {
    name: 'ContractDetailFee',
    components: {
d767b5e6   wuxw   v1.9 合同费用bug 修复
127
128
129
130
131
      TempImportRoomFee,
      contractCreateFeeAdd,
      DeleteFee,
      EditFee,
      FinishFee
fc9bd1db   wuxw   开发完成合同详情
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
    },
    data() {
      return {
        contractDetailFeeInfo: {
          rooms: [],
          contractId: '',
          roomNum: '',
          allOweFeeAmount: '0',
          totalAmount: 0,
        },
        pagination: {
          currentPage: 1,
          pageSize: 10,
          total: 0
        }
      }
    },
    methods: {
      open(data) {
        this.contractDetailFeeInfo.contractId = data.contractId
d767b5e6   wuxw   v1.9 合同费用bug 修复
152
153
154
155
        this.contractDetailFeeInfo.contractName = data.contractName
        this._loadContractDetailFeeData(1, this.pagination.pageSize)
      },
      _query() {
fc9bd1db   wuxw   开发完成合同详情
156
157
        this._loadContractDetailFeeData(1, this.pagination.pageSize)
      },
d767b5e6   wuxw   v1.9 合同费用bug 修复
158
      async _loadContractDetailFeeData(page, row) {
fc9bd1db   wuxw   开发完成合同详情
159
160
161
162
163
164
165
        const params = {
          page: page || 1,
          row: row || 10,
          communityId: this.communityId,
          payerObjId: this.contractDetailFeeInfo.contractId,
        }
  
d767b5e6   wuxw   v1.9 合同费用bug 修复
166
167
168
169
170
171
        const res = await listFee(params)
        console.log(res)
        this.contractDetailFeeInfo.total = res.total
        this.contractDetailFeeInfo.records = res.records
        this.contractDetailFeeInfo.fees = res.fees
        this.pagination.total = res.total
fc9bd1db   wuxw   开发完成合同详情
172
  
d767b5e6   wuxw   v1.9 合同费用bug 修复
173
174
175
        let totalAmount = 0.0
        res.fees.forEach(item => {
          totalAmount += parseFloat(item.amountOwed)
fc9bd1db   wuxw   开发完成合同详情
176
        })
d767b5e6   wuxw   v1.9 合同费用bug 修复
177
178
        this.contractDetailFeeInfo.totalAmount = totalAmount.toFixed(2)
  
fc9bd1db   wuxw   开发完成合同详情
179
180
181
182
183
184
185
186
187
188
      },
      _openTempImportContractFeeModal() {
        this.$refs.tempImportRoomFee.open({
          roomId: this.contractDetailFeeInfo.contractId,
          objType: '7777',
          roomName: this.contractDetailFeeInfo.contractName,
          ownerName: this.contractDetailFeeInfo.ownerName
        })
      },
      _payContractFee(fee) {
d767b5e6   wuxw   v1.9 合同费用bug 修复
189
        this.$router.push(`/views/fee/payFeeOrder?feeId=${fee.feeId}`)
fc9bd1db   wuxw   开发完成合同详情
190
191
      },
      _editContractFee(fee) {
d767b5e6   wuxw   v1.9 合同费用bug 修复
192
        this.$refs.editFee.open(fee)
fc9bd1db   wuxw   开发完成合同详情
193
194
195
      },
      _payContractFeeHis(fee) {
        fee.builtUpArea = this.contractDetailFeeInfo.builtUpArea
d767b5e6   wuxw   v1.9 合同费用bug 修复
196
        this.$router.push(`/views/fee/propertyFee?${this.objToGetParam(fee)}`)
fc9bd1db   wuxw   开发完成合同详情
197
198
      },
      _deleteContractFee(fee) {
d767b5e6   wuxw   v1.9 合同费用bug 修复
199
        this.$refs.deleteFee.open({
fc9bd1db   wuxw   开发完成合同详情
200
201
202
203
204
          communityId: this.communityId,
          feeId: fee.feeId
        })
      },
      _finishContractFee(fee) {
d767b5e6   wuxw   v1.9 合同费用bug 修复
205
        this.$refs.finishFee.open({
fc9bd1db   wuxw   开发完成合同详情
206
207
208
209
210
          communityId: this.communityId,
          feeId: fee.feeId
        })
      },
      _toContractOwePayFee() {
d767b5e6   wuxw   v1.9 合同费用bug 修复
211
        this.$router.push(`/views/fee/owePayFeeOrder?payObjId=${this.contractDetailFeeInfo.contractId}&payObjType=7777&contractName=${this.contractDetailFeeInfo.contractName}`)
fc9bd1db   wuxw   开发完成合同详情
212
213
      },
      _openContractCreateFeeAddModal() {
d767b5e6   wuxw   v1.9 合同费用bug 修复
214
        this.$refs.contractCreateFeeAdd.open(this.contractDetailFeeInfo, false)
fc9bd1db   wuxw   开发完成合同详情
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
      },
      _getContractAttrValue(attrs, specCd) {
        let value = ""
        attrs.forEach(item => {
          if (item.specCd == specCd) {
            value = item.value
            return
          }
        })
        return value
      },
      _getContractDeadlineTime(fee) {
        if (fee.amountOwed == 0 && fee.endTime == fee.deadlineTime) {
          return "-"
        }
        if (fee.state == '2009001') {
          return "-"
        }
d767b5e6   wuxw   v1.9 合同费用bug 修复
233
        return dateFormat(fee.deadlineTime)
fc9bd1db   wuxw   开发完成合同详情
234
235
236
237
238
      },
      _getContractEndTime(fee) {
        if (fee.state == '2009001') {
          return "-"
        }
d767b5e6   wuxw   v1.9 合同费用bug 修复
239
        return dateFormat(fee.endTime)
fc9bd1db   wuxw   开发完成合同详情
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
      },
      handlePageChange(currentPage) {
        this.pagination.currentPage = currentPage
        this._loadContractDetailFeeData(currentPage, this.pagination.pageSize)
      },
      objToGetParam(obj) {
        return Object.keys(obj).map(key => `${key}=${obj[key]}`).join('&')
      }
    },
    created() {
      this.communityId = getCommunityId()
    }
  }
  </script>
  
  <style scoped>
  .margin-top {
    margin-top: 20px;
  }
  
  .margin-top-lg {
    margin-top: 30px;
  }
  
  .padding-right-xs {
    padding-right: 5px;
  }
  
  .padding-left-xl {
    padding-left: 20px;
  }
  
  .text-right {
    text-align: right;
  }
  </style>