Blame view

src/views/fee/printPayFeeXiangyun.vue 12.2 KB
63ef3e7f   wuxw   v1.9 加入天麟收据模版
1
2
3
4
5
6
7
8
9
10
11
  <template>
      <div class="print-pay-fee-xiangyun-container">
          <div class="text-center">
              <div style="color:#000;font-size:36px">
                  {{ printPayFeeInfo.communityName }} {{ printPayFeeInfo.apply == 'Y' ? $t('printPayFeeXiangyun.applyForm') : $t('printPayFeeXiangyun.receiptForm') }}
              </div>
          </div>
          <div style="color:#000;font-size:20px;text-align:right;margin-bottom:10px;">
              <span>{{ $t('printPayFeeXiangyun.receiptNum') }}:{{ printPayFeeInfo.receiptNum }}</span>
          </div>
          <el-row style="color:#000;font-size:20px;margin-bottom:10px;">
aaff7ab5   wuxw   优化一些bug
12
              <el-col :span="12" class="text-right">
63ef3e7f   wuxw   v1.9 加入天麟收据模版
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
105
                  <span>{{ $t('printPayFeeXiangyun.owner') }}:{{ printPayFeeInfo.payObjName }}</span>
              </el-col>
              <el-col :span="12" style="text-align:right;">
                  <span>{{ $t('printPayFeeXiangyun.payTime') }}:{{ printPayFeeInfo.feeTime }}</span>
              </el-col>
          </el-row>
  
          <table class="table vc-table-border" style="color:#000;font-size:20px">
              <thead>
                  <tr>
                      <th scope="col" class="text-center" width="80px">
                          {{ $t('printPayFeeXiangyun.serialNumber') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.feeItem') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.houseCar') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.feeRange') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.cycle') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.unitPriceFixed') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.areaUsage') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.paymentMethod') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.amount') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.discountAmount') }}
                      </th>
                      <th scope="col" class="text-center">
                          {{ $t('printPayFeeXiangyun.remark') }}
                      </th>
                  </tr>
              </thead>
              <tbody class="vc-table-border" style="color:#000;font-size:20px">
                  <tr v-for="(item, index) in printPayFeeInfo.fees" :key="index" class="vc-table-border">
                      <th scope="row" class="text-center">{{ index + 1 }}</th>
                      <td class="text-center">{{ item.feeName }}</td>
                      <td class="text-center">{{ item.objName }}</td>
                      <td class="text-center" v-if="item.preDegrees">
                          {{ dateFormat(item.startTime) }}{{ $t('printPayFeeXiangyun.to') }}{{ dateFormat(item.endTime) }}<br />
                          {{ item.preDegrees }} {{ $t('printPayFeeXiangyun.to') }} {{ item.curDegrees }}
                      </td>
                      <!-- 根据山东需求 如果为押金时 显示为无-->
                      <td class="text-center" v-else-if="item.feeTypeCd == '888800010006'">
                          {{ $t('printPayFeeXiangyun.none') }}
                      </td>
                      <td class="text-center" v-else>
                          {{ dateFormat(item.startTime) }}{{ $t('printPayFeeXiangyun.to') }}{{ dateFormat(item.endTime) }}
                      </td>
                      <td class="text-center">{{ item.cycle }}</td>
                      <td class="text-center">{{ item.squarePrice }}</td>
                      <td class="text-center">{{ item.area }}</td>
                      <td class="text-center">{{ item.primeRate }}</td>
                      <td class="text-center">{{ item.amount }}</td>
                      <td class="text-center">{{ item.discountPrice }}</td>
                      <td class="text-center" width="200px">{{ item.remark }}</td>
                  </tr>
                  <tr>
                      <td colspan="3" class="text-center">
                          {{ $t('printPayFeeXiangyun.capitalRMB') }}(元)
                      </td>
                      <td colspan="4" class="text-center">
                          {{ changeNumMoneyToChinese(printPayFeeInfo.amount) }}
                      </td>
                      <td colspan="4" class="text-center">{{ printPayFeeInfo.amount }}</td>
                  </tr>
                  <tr height="60px" v-if="printPayFeeInfo.content || printPayFeeInfo.qrImg">
                      <td colspan="7">
                          <div style="max-width: 600px;" v-html="printPayFeeInfo.content"></div>
                      </td>
                      <td colspan="4">
                          <img v-if="printPayFeeInfo.qrImg" :src="printPayFeeInfo.qrImg" width="100px" height="100px">
                      </td>
                  </tr>
              </tbody>
          </table>
  
          <el-row style="color:#000;font-size:20px;margin-top:20px;">
              <el-col :span="20">
                  <el-row>
                      <el-col :span="6">{{ $t('printPayFeeXiangyun.departmentHead') }}:</el-col>
aaff7ab5   wuxw   优化一些bug
106
                      <el-col :span="6">{{ $t('printPayFeeXiangyun.operator') }}:{{userInfo.name}}</el-col>
63ef3e7f   wuxw   v1.9 加入天麟收据模版
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
                      <el-col :span="6">{{ $t('printPayFeeXiangyun.financeReceipt') }}:</el-col>
                      <el-col :span="6">{{ $t('printPayFeeXiangyun.customerConfirm') }}:</el-col>
                  </el-row>
              </el-col>
              <el-col :span="4" id="print-btn">
                  <el-button type="primary" class="float-right" @click="handlePrint">
                      <i class="fa fa-check"></i>&nbsp;{{ $t('common.print') }}
                  </el-button>
                  <el-button type="warning" class="float-right" style="margin-right:20px;" @click="handleClose">
                      {{ $t('common.cancel') }}
                  </el-button>
              </el-col>
          </el-row>
      </div>
  </template>
  
  <script>
  import { getCommunityId, getCommunityName } from '@/api/community/communityApi'
  import { queryFeeReceipt, queryFeeReceiptDetail, queryFeePrintSpec } from '@/api/fee/printPayFeeApi'
aaff7ab5   wuxw   优化一些bug
126
127
  import { getUserId, getUserName } from '@/api/user/userApi'
  
63ef3e7f   wuxw   v1.9 加入天麟收据模版
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
  import { dateFormat } from '@/utils/dateUtil'
  import { changeNumMoneyToChinese } from '@/utils/moneyUtil'
  
  export default {
      name: 'PrintPayFeeXiangyun',
      data() {
          return {
              printPayFeeInfo: {
                  communityName: '',
                  receiptId: '',
                  receiptIds: '',
                  detailIds: '',
                  roomName: '',
                  amount: 0.00,
                  fees: [],
                  feeTime: '',
                  wechatName: '',
                  content: '',
                  qrImg: '',
                  payObjName: '',
                  feeReceipt: [],
                  apply: 'N',
                  receiptNum: '',
                  merge: ''
              },
aaff7ab5   wuxw   优化一些bug
153
               userInfo: {},
63ef3e7f   wuxw   v1.9 加入天麟收据模版
154
155
156
157
158
159
              printFlag: '0',
              communityId: ''
          }
      },
      created() {
          this.communityId = getCommunityId()
aaff7ab5   wuxw   优化一些bug
160
161
162
163
          this.userInfo = {
        userId: getUserId(),
        name: getUserName()
      }
63ef3e7f   wuxw   v1.9 加入天麟收据模版
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
          this.initData()
      },
      methods: {
          initData() {
              this.printPayFeeInfo.receiptId = this.$route.query.receiptId
              this.printPayFeeInfo.receiptIds = this.$route.query.receiptIds
              this.printPayFeeInfo.detailIds = this.$route.query.detailIds
              this.printPayFeeInfo.apply = this.$route.query.apply || 'N'
              this.printPayFeeInfo.merge = this.$route.query.merge
              this.printPayFeeInfo.communityName = getCommunityName()
  
              this.loadReceipt()
              this.loadPrintSpec()
          },
          loadReceipt() {
              const params = {
                  page: 1,
                  row: 30,
                  receiptId: this.printPayFeeInfo.receiptId,
                  receiptIds: this.printPayFeeInfo.receiptIds,
                  detailIds: this.printPayFeeInfo.detailIds,
                  communityId: this.communityId
              }
  
              queryFeeReceipt(params).then(response => {
                  const feeReceipt = response.data
                  let amount = 0
                  feeReceipt.forEach(item => {
                      amount += parseFloat(item.amount)
                  })
  
                  this.printPayFeeInfo.amount = amount.toFixed(2)
                  this.printPayFeeInfo.roomName = feeReceipt[0].objName
                  this.printPayFeeInfo.feeTime = feeReceipt[0].createTime
                  this.printPayFeeInfo.payObjName = feeReceipt[0].payObjName
                  this.printPayFeeInfo.feeReceipt = feeReceipt
                  this.printPayFeeInfo.receiptNum = feeReceipt[0].receiptCode
  
                  this.loadReceiptDetail()
              }).catch(error => {
                  console.error('请求失败处理', error)
              })
          },
          loadReceiptDetail() {
              const params = {
                  page: 1,
                  row: 100,
                  receiptId: this.printPayFeeInfo.receiptId,
                  receiptIds: this.printPayFeeInfo.receiptIds,
                  detailIds: this.printPayFeeInfo.detailIds,
                  communityId: this.communityId,
                  mergeFee: this.printPayFeeInfo.merge
              }
  
              queryFeeReceiptDetail(params).then(response => {
                  const feeReceiptDetails = response.data
                  this.printPayFeeInfo.receiptNum = this.printPayFeeInfo.receiptNum + "(" + feeReceiptDetails[0].payOrderId + ")"
  
                  feeReceiptDetails.forEach(item => {
                      this.printPayFeeInfo.feeReceipt.forEach(im => {
                          if (item.receiptId == im.receiptId) {
                              item.objName = im.objName
                              item.feeTypeCd = im.feeTypeCd
                          }
                      })
                  })
                  this.printPayFeeInfo.fees = feeReceiptDetails
              }).catch(error => {
                  console.error('请求失败处理', error)
              })
          },
          loadPrintSpec() {
              const params = {
                  page: 1,
                  row: 1,
                  specCd: 2020,
                  communityId: this.communityId
              }
  
              queryFeePrintSpec(params).then(response => {
                  const data = response.data
                  if (data.length > 0) {
                      this.printPayFeeInfo.content = data[0].content
                      this.printPayFeeInfo.qrImg = data[0].qrImg
                      if (data[0].printName) {
                          this.printPayFeeInfo.communityName = data[0].printName
                      }
                  }
              }).catch(error => {
                  console.error('请求失败处理', error)
              })
          },
          dateFormat(date) {
              if (!date) return ''
              return dateFormat(date)
          },
          changeNumMoneyToChinese,
          handlePrint() {
              this.printFlag = '1'
              console.log('printFlag:', this.printFlag)
              document.getElementById("print-btn").style.display = "none"
              window.print()
              window.opener = null
              window.close()
          },
          handleClose() {
              window.opener = null
              window.close()
          }
      }
  }
  </script>
  
  <style scoped>
  .print-pay-fee-xiangyun-container {
      padding: 20px;
  }
  
  .text-center {
      text-align: center;
  }
  
  .text-right {
      text-align: right;
  }
  
  .float-left {
      float: left;
  }
  
  .float-right {
      float: right;
  }
  
  .table {
      width: 100%;
      margin-bottom: 1rem;
      color: #212529;
      border-collapse: collapse;
  }
  
  .vc-table-border {
      border: 1px solid #000;
  }
  
  .vc-table-border th,
  .vc-table-border td {
      border: 1px solid #000;
      padding: 8px;
  }
  
  @media print {
      #print-btn {
          display: none !important;
      }
  }
  </style>