sale-client 3.6.21 → 3.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/src/components/charge/business/CardMeterCenter.vue +944 -944
  3. package/src/components/charge/business/IOTMeterCenter.vue +793 -793
  4. package/src/components/charge/business/OtherChargeNew.vue +550 -550
  5. package/src/components/charge/business/machine/MachineMeterCenter.vue +676 -676
  6. package/src/components/charge/gasloss/gasLossOperate.vue +383 -383
  7. package/src/components/newBill/CardMeterCenter.vue +902 -902
  8. package/src/components/newBill/IOTMeterCenter.vue +797 -797
  9. package/src/components/revenue/Common/EticketModal.vue +90 -90
  10. package/src/filiale/alashan/business/CardMeterCenter.vue +897 -897
  11. package/src/filiale/chengtou/components/OtherChargeNew.vue +549 -549
  12. package/src/filiale/gehua/CardMeterCenter.vue +898 -898
  13. package/src/filiale/gehua/IOTMeterCenter.vue +791 -791
  14. package/src/filiale/gehua/MachineMeterCenter.vue +685 -685
  15. package/src/filiale/gehua/OtherChargeNew.vue +558 -558
  16. package/src/filiale/guangxi/CardMeterCenter.vue +891 -891
  17. package/src/filiale/guangxi/IOTMeterCenter.vue +774 -774
  18. package/src/filiale/guangxi/MachineMeterCenter.vue +622 -622
  19. package/src/filiale/haile/MachineMeterCenter.vue +762 -762
  20. package/src/filiale/huayin/CardMeterCenter.vue +903 -903
  21. package/src/filiale/huayin/IOTMeterCenter.vue +796 -796
  22. package/src/filiale/huayin/MachineMeterCenter.vue +680 -680
  23. package/src/filiale/jingwei/CardMeterCenter.vue +870 -870
  24. package/src/filiale/jingwei/ShowCardSellGas.vue +903 -903
  25. package/src/filiale/kelai/CardMeterCenter.vue +934 -934
  26. package/src/filiale/kelai/IOTMeterCenter.vue +833 -833
  27. package/src/filiale/kelai/MachineMeterCenter.vue +705 -705
  28. package/src/filiale/macheng/CardMeterCenter.vue +939 -939
  29. package/src/filiale/qianneng/OtherChargeNew.vue +544 -544
  30. package/src/filiale/qianneng/eticket/EticketModal.vue +91 -91
  31. package/src/filiale/qianneng/machine/MachineMeterCenter.vue +676 -676
  32. package/src/filiale/rizhao/IOTMeterCenter.vue +795 -795
  33. package/src/filiale/shangluo/CardMeterCenter.vue +892 -892
  34. package/src/filiale/shangluo/IOTMeterCenter.vue +797 -797
  35. package/src/filiale/shangluo/MachineMeterCenter.vue +734 -734
  36. package/src/filiale/shanxian/OtherChargeNew.vue +561 -561
  37. package/src/filiale/shanxian/components/revenue/CardMeterCenter.vue +944 -944
  38. package/src/filiale/tongchuan/CardMeterCenter.vue +923 -923
  39. package/src/filiale/tongchuan/bill/EticketModal.vue +90 -90
  40. package/src/filiale/wenxi/CardMeterCenter.vue +942 -942
  41. package/src/filiale/wenxi/IOTMeterCenter.vue +774 -774
  42. package/src/filiale/wuhai/CardMeterCenter.vue +945 -945
  43. package/src/filiale/wuhai/IOTMeterCenter.vue +757 -757
  44. package/src/filiale/yuansheng/CardMeterCenter.vue +950 -950
  45. package/src/filiale/yuansheng/IOTMeterCenter.vue +788 -788
@@ -1,676 +1,676 @@
1
- <template>
2
- <div class="span" style="overflow-y: auto !important;">
3
- <validator name='v'>
4
- <form class="form-horizontal">
5
- <div class="row" style="padding-top: 0.5em;">
6
- <div class="col-sm-4 form-group" :class="[$v.payment.required ? 'has-error select-error' : '']">
7
- <label for="f_paytype" class=" font_normal_body" title="参数名称:付款方式">收款方式</label>
8
- <input type="text" v-show="false" v-model="$refs.payment.selectedItems" v-validate:payment='{required: true }'>
9
- <v-select id="f_payment"
10
- v-model="f_payment"
11
- style="width:60%"
12
- placeholder='请选择'
13
- :value.sync="data.f_payment"
14
- :options='paytype'
15
- v-ref:payment
16
- close-on-select clear-button>
17
- </v-select>
18
-
19
- </div>
20
- <div class="col-sm-4 form-group">
21
- <label for="f_print" class="font_normal_body">打印格式</label>
22
-
23
- <v-select id="print"
24
- v-model="data.f_print"
25
- placeholder='请选择'
26
- style="width:60%"
27
- :value.sync="data.f_print"
28
- :options='printstyle'
29
- close-on-select clear-button>
30
- </v-select>
31
-
32
- </div>
33
- <div class="col-sm-4 form-group">
34
- <label for="f_overdue" class="font_normal_body">违&ensp;约&ensp;金</label>
35
- <input class="input_search" style="width:60%" type="number" v-model="newOverdue"
36
- v-scale="[newOverdue,2]" placeholder="违约金"
37
- disabled>
38
- <!--<button type="button" name="button" class="btn btn-link" @click="modefiy()" v-if="authArr.includes('滞纳金修改')">修改</button>-->
39
- </div>
40
- </div>
41
- <div class="row" style="padding-top: 0.5em;" >
42
-
43
- <div class="col-sm-4 form-group">
44
- <label for="f_pregas" class=" font_normal_body">用&ensp;气&ensp;量</label>
45
- <input class="input_search" style="width:60%" type="number"
46
- v-model="data.f_pregas" placeholder="用气量"
47
- v-scale = "[data.f_pregas, 2]" disabled>
48
- </div>
49
- <div class="col-sm-4 form-group">
50
- <label for="f_preamount" class="font_normal_body">实欠气费</label>
51
- <input class="input_search" style="width:60%" style="width:60%" type="number" v-model="data.f_preamount"
52
- v-scale = "[data.f_preamount, 2]"
53
- placeholder="实欠气费" disabled>
54
- </div>
55
-
56
- <div class="col-sm-4 form-group">
57
- <label for="f_totalcost" class=" font_normal_body">应收金额</label>
58
- <input class="input_search" style="width:60%" type="number" v-model="data.f_totalcost"
59
- v-scale = "[data.f_totalcost, 2]" placeholder="应收金额" disabled>
60
- </div>
61
- </div>
62
-
63
- <div class="row" style="padding-top: 0.5em;">
64
- <div class="col-sm-4 form-group">
65
- <label for="f_balance" class="font_normal_body">上期结余</label>
66
- <input class="input_search" style="width:60%" type="number" v-model="data.f_balance"
67
- v-scale="[data.f_balance,4]" placeholder="上期结余" disabled>
68
- </div>
69
- <div class="col-sm-4 form-group">
70
- <label for="f_overdue" class="font_normal_body">本期结余</label>
71
- <input class="input_search" style="width:60%" type="number" v-model="curbalance" disabled>
72
- </div>
73
- <div class="col-sm-3 form-group" v-if="config.hasfindaReail" :class="[$v.f_collection.required || $v.f_collection.dctest ? 'has-error select-error' : '']">
74
- <label for="f_collection" class="font_normal_body">收&emsp;&emsp;款</label>
75
- <input id="f_collection" class="input_search" style="width:60%" type="number" v-model="data.f_collection"
76
- v-validate:f_collection='{required: true, dctest: [0, ">=" ]}' v-scale = "[data.f_collection, 2]"
77
- @mousewheel.native.prevent @keyup.enter="confirm()" :disabled="$refs.givechange.promptText != ''">
78
- </div>
79
- <div class="col-sm-4 form-group" v-if="!config.hasfindaReail" :class="[$v.f_collection.required || $v.f_collection.dctest ? 'has-error select-error' : '']">
80
- <label for="f_collection" class="font_normal_body">收&emsp;&emsp;款</label>
81
- <input id="f_collection" class="input_search" style="width:60%" type="number" v-model="data.f_collection"
82
- v-validate:f_collection='{required: true, dctest: [0, ">=" ]}' v-scale = "[data.f_collection, 2]"
83
- @mousewheel.native.prevent @keyup.enter="confirm()" :disabled="$refs.givechange.promptText != ''">
84
- </div>
85
- <div class="col-sm-1 form-group" v-if="config.hasfindaReail">
86
- <give-change :curbalance="curbalance" :collection.sync="data.f_collection" v-ref:givechange></give-change>
87
- </div>
88
- </div>
89
-
90
- <div class="row" style="margin-top:5px;" v-show="authArr.includes('优惠权限')">
91
- <div class="col-sm-4 form-group">
92
- <label class="font_normal_body">优惠方式</label>
93
- <v-select v-model="data.f_privilege_id" @blur.native.capture="privilegeCalculate"
94
- placeholder='请选择'
95
- :value.sync="data.f_privilege_id"
96
- :options='privilegeList' clear-button value-single>
97
- </v-select>
98
- </div>
99
- <div class="col-sm-4 form-group">
100
- <label for="f_preamount" class=" font_normal_body">优惠金额</label>
101
- <input class="input_search" style="width:60%" type="number" v-model="data.f_privilege_money"
102
- v-scale="[data.f_privilege_money, 2]" placeholder="优惠金额" disabled>
103
- </div>
104
- <div class="col-sm-4 form-group">
105
- <label for="f_preamount" class=" font_normal_body">实际收款</label>
106
- <input class="input_search" style="width:60%" type="number" v-model="data.f_after_discount"
107
- v-scale="[data.f_after_discount, 2]" placeholder="优惠后收款" disabled>
108
- </div>
109
- </div>
110
-
111
- <div class="row" style="padding-top: 0.5em;">
112
- <div class="col-sm-4 form-group" v-show="row.f_garbage_fee === '是'">
113
- <label for="f_garbage_fee" class="font_normal_body">垃&ensp;圾&ensp;费</label>
114
- <input class="input_search" style="width:60%" type="number" v-model="data.f_garbage_fee" disabled>
115
- </div>
116
- </div>
117
-
118
- <div class="row" style="padding-top: 0.5em;">
119
- <div class="col-sm-4" v-if="!mjshow" >
120
- <label for="f_serial_number" class=" font_normal_body">业务单号</label>
121
- <input class="input_search" style="width:60%" type="text"
122
- v-model="data.f_serial_number" placeholder="业务单号">
123
- </div>
124
- <div class="col-sm-4" v-if="mjshow" :class="[$v.f_serial_number.required || $v.f_serial_number.dctest ? 'has-error' : 'has-success']">
125
- <label for="f_serial_number" class=" font_normal_body">业务单号</label>
126
- <input class="input_search" style="width:60%" type="text" v-validate:f_serial_number='{required: true }'
127
- v-model="data.f_serial_number" placeholder="业务单号">
128
- </div>
129
- <div class="col-sm-8">
130
- <label for="f_comments" class="font_normal_body">备&emsp;&emsp;注</label>
131
- <input class="input_search" style="width:87%" v-model="data.f_comments" placeholder="备注">
132
- </div>
133
- </div>
134
- </form>
135
- <validate-bill v-if="hasValidateBill" :data="data" @validate-bill="validateBill"></validate-bill>
136
- <print-bill :show="print" :bill-config='config' :bill-data='billData' v-on:toggle="close" :data='data' @printok="printok" v-ref:printbill></print-bill>
137
- <ticket-print :show="eticket_show" @toggle="eticket_toggle" v-ref:eticketbill></ticket-print>
138
- <eticket-modal :show="eticket_msg" @close-modal-show="eticket_msg = false" :row="row" @confirm="confirm"></eticket-modal>
139
- <div class="text-right" style="margin-top: 1%">
140
- <strong style="color:red;margin-right: 5px">{{ $refs.givechange.promptText }}</strong>
141
- <payment-code-button :clickable="!$v.valid || validateOk"
142
- :payment.sync="data.f_payment" :payment-data="paytype"
143
- @confirm-payment="confirm()">
144
- </payment-code-button>
145
- <button class="button_search btn-gn" @click="checkInvoiceMsg()" :disabled='!$v.valid || validateOk'>确认</button>
146
- <!--<button class="btn btn-success" @click="confirmUserinfo()" :disabled='!$v.valid'>信息保存</button>-->
147
- <button class="button_clear btn-gn" @click="clean()">取消</button>
148
- </div>
149
- </validator>
150
- <!--<modal :show.sync="showOverdueModal" v-ref:modal backdrop="false">-->
151
- <!--<header slot="modal-header" class="modal-header">-->
152
- <!--<button type="button" class="close" @click="closeOverdue"><span>&times;</span></button>-->
153
- <!--<h4 class="modal-title">修改滞纳金</h4>-->
154
- <!--</header>-->
155
- <!--<article slot="modal-body" class="modal-body">-->
156
- <!--<validator name='m'>-->
157
- <!--<form class="form-horizontal">-->
158
- <!--<div class="row">-->
159
- <!--<div class="col-sm-6">-->
160
- <!--<label for="oldOverdue" class="font_normal_body">原违约金</label>-->
161
- <!--<input type="text" class="input_search" style="width:60%" v-once v-model="overdueModal.f_old_overdue" disabled>-->
162
- <!--</div>-->
163
- <!--</div>-->
164
- <!--<div class="row">-->
165
- <!--<div class="col-sm-6" :class="[$m.f_new_overdue.required ? 'has-error select-error' : '']">-->
166
- <!--<label for="newOverdue" class="font_normal_body">新违约金</label>-->
167
- <!--<input type="text" class="input_search" style="width:60%" v-model="overdueModal.f_new_overdue"-->
168
- <!--v-validate:f_new_overdue='{required: true}'>-->
169
- <!--</div>-->
170
- <!--</div>-->
171
- <!--</form>-->
172
- <!--</validator>-->
173
- <!--</article>-->
174
-
175
- <!--<footer slot="modal-footer" class="modal-footer">-->
176
- <!--<button type="button" class="button_search" :disabled='!$m.valid' @click='confirmOverdue()'>确认</button>-->
177
- <!--<button type="button" class="button_clear" @click='closeOverdue'>取消</button>-->
178
- <!--</footer>-->
179
- <!--</modal>-->
180
- <payment-code v-ref:paymentcode :payment="data.f_payment" :row="row" :money="data.f_after_discount"></payment-code>
181
- </div>
182
- <upload :blodid="row.f_userinfo_id" v-if="config.showupload" isremark="true" fusetype="机表收费"></upload>
183
- </template>
184
- <script>
185
- import {HttpResetClass} from 'vue-client'
186
-
187
- /**
188
- *售气收费
189
- *机表收费组件
190
- */
191
-
192
- let asyncMachineMeterCenter = async function (self) {
193
- await self.$getConfig(self, 'MachineMeterCenter')
194
- self.data.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
195
- self.data.f_payment = [self.config.payment]
196
- self.data.f_use_type = self.config.billType
197
- self.data.f_bill_type = self.data.f_print
198
- self.hasValidateBill = self.config.hasBillManage
199
- }
200
-
201
- let machineChargeGen = async function (self) {
202
- try {
203
- if (!self.model) self.model = {}
204
- // 加入扫码盒付款码支付流水号
205
- self.model.f_serial_id = self.$refs.paymentcode.paymentCodeReturnData.f_out_trade_no
206
- console.log('查看传过来的数据=====================>', self)
207
- let res = await self.$MachineChargeService.marchineCharge(self.data, self.model, self.row, self.floor)
208
- let localeSustainMoney = window.localStorage.getItem('sustainMoney')
209
- if (localeSustainMoney != null) {
210
- localeSustainMoney = (localeSustainMoney - 0) + (self.data.f_collection - self.data.f_garbage_fee)
211
- window.localStorage.setItem('sustainMoney', localeSustainMoney)
212
- }
213
- let param = []
214
- for (let row of self.resid) {
215
- param.push({id: row.id})
216
- }
217
- let data = {
218
- param: param,
219
- f_blobid: res.data
220
- }
221
-
222
- await self.$resetpost('rs/logic/updatefiles', data)
223
-
224
- // 开始打票
225
- if (self.config.hasPrint) {
226
- if (self.data.f_print.indexOf('电子发票') == -1) {
227
- if (self.$login.r.includes('非民用纸质票据拆分')) {
228
- if (self.row.f_user_type === '非民用') {
229
- self.billData.url = 'rs/report/fmy_machine_bill'
230
- }
231
- }
232
- if (self.config.hasBillManage) {
233
- // 启用发票管理,获取票据管理中的票号并存储记录
234
- self.data.id = res.data
235
- self.data.f_bill_type = '机表收费'
236
- self.data.f_bill_style = self.data.f_print[0]
237
- self.print = true
238
- } else {
239
- // 如果不欠费就用下边的预存收据
240
- if (self.$parent.$children[0].selecteds) {
241
- console.log('1111111', self.$parent.$children[0].selecteds)
242
- if (self.$parent.$children[0].selectedRows === 0) {
243
- console.log('22222222', self.$parent.$children[0].selectedRows)
244
- self.billData.url = 'rs/report/pre_sell'
245
- }
246
- // 获取选中的handplan的id
247
- self.data.handid = ''
248
- self.$parent.$children[0].selecteds.forEach((row, index) => {
249
- self.data.handid = self.data.handid + "','" + row.handplan_id
250
- })
251
- } else {
252
- console.log('3333333')
253
- self.billData.url = 'rs/report/pre_sell'
254
- self.data.handid = ''
255
- }
256
- self.data.id = res.data
257
- self.print = true
258
- }
259
- } else if (self.data.f_print[0] === '国税发票') {
260
- // TODO
261
- } else if (self.data.f_print[0] === '电子发票') {
262
- self.eticket_show = true
263
- await self.$refs.eticketbill.openETicket(res.data, self.row, '机表收费')
264
- // await self.$CommonService.openEticket(res.data, '售气收费')
265
- // 如果不欠费就用下边的预存收据
266
- // if (self.$parent.$children[0].selecteds) {
267
- // if (self.$parent.$children[0].selectedRows === 0) {
268
- // self.billData.url = 'rs/report/pre_sell'
269
- // }
270
- // // 获取选中的handplan的id
271
- // self.data.handid = ''
272
- // self.$parent.$children[0].selecteds.forEach((row, index) => {
273
- // self.data.handid = self.data.handid + "','" + row.handplan_id
274
- // })
275
- // } else {
276
- // self.billData.url = 'rs/report/pre_sell'
277
- // self.data.handid = ''
278
- // }
279
- // self.data.id = res.data
280
- // self.print = true
281
- }
282
- } else {
283
- self.$dispatch('success', '机表收费确认', self.row, self.data)
284
- }
285
- } catch (error) {
286
- self.$showAlert(error, 'danger', 0)
287
- self.$dispatch('refresh')
288
- }
289
- }
290
-
291
- export default {
292
- title: '收费',
293
- data () {
294
- return {
295
- mjshow: false,
296
- resid: [], // 存放新增的f_files表中id
297
- config: {
298
- showupload: true, // 显示上传
299
- hasPrint: true, // 默认打票
300
- hasBillManage: false, // 默认不启用发票管理
301
- hasfindaReail: true, // 默认开启找零功能
302
- billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
303
- printType: '普通收据', // 收据/电子票/专用发票/国税发票
304
- payment: '现金缴费'
305
- },
306
- eticket_msg: false,
307
- eticket_show: false,
308
- invoice_is_pax: '征税',
309
- is_pax: [{label: '征税', value: '征税'}, {label: '不征税', value: '不征税'}],
310
- // 垃圾费
311
- f_garbage_fee: 0,
312
- overdueModal: {
313
- f_old_overdue: 0,
314
- f_new_overdue: ''
315
- },
316
- newOverdue: 0,
317
- isBreakOverdue: false,
318
- breakOverdue: {},
319
-
320
- showErrorMsg: false,
321
- print: false,
322
- isConfirm: true,
323
- show: false,
324
- count: 0,
325
- billData: {
326
- url: 'rs/report/machine_bill',
327
- bill: ''
328
- },
329
-
330
- // 启用发票管理需要对票号进行验证
331
- hasValidateBill: false,
332
- validateOk: false,
333
- handid: '',
334
- showOverdueModal: false,
335
- editOverdue: this.$login.r.includes('滞纳金修改'),
336
- paytype: [],
337
- printstyle: this.$appdata.getParam('打印格式') ? this.$appdata.getParam('打印格式') : [],
338
- privilegeList: [{label: '无优惠', value: '0'}],
339
- // 在向下取整时,保存所有的应交金额
340
- totalcost: 0,
341
- serialShow: false
342
- }
343
- },
344
- props: ['data', 'row', 'floor', 'ceil', 'charge'],
345
- ready () {
346
- this.paytype = this.$appdata.getParam('付款方式') ? this.$appdata.getParam('付款方式') : []
347
- if (!this.$login.r.includes('免交充值付款')) {
348
- this.paytype = this.paytype.filter((item) => {
349
- return item.label != '免交'
350
- })
351
- }
352
- // this.calOverdue()
353
- this.newOverdue = this.overdueModal.f_old_overdue = this.data.f_overdue
354
- if (this.floor) {
355
- this.totalcost = this.data.f_totalcost
356
- }
357
- document.getElementById('f_collection').focus()
358
- asyncMachineMeterCenter(this)
359
- },
360
- events: {
361
- // 删除Resid数组元素
362
- 'delResid' (val) {
363
- this.resid.$remove({id: val, f_biobid: ''})
364
- // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
365
- },
366
- // 增加Resid数组元素
367
- 'resid' (val) {
368
- this.resid.push({id: val, f_biobid: ''})
369
- }
370
- },
371
- modefiy () {
372
- this.overdueModal.f_new_overdue = ''
373
- this.showOverdueModal = true
374
- },
375
- methods: {
376
- // 校验发票信息
377
- checkInvoiceMsg () {
378
- if (this.data.f_print[0] === '电子发票') {
379
- if (!this.row.f_taxpayer_id) {
380
- this.row.f_taxpayer_id = this.row.f_idnumber
381
- }
382
- if (!this.row.f_paper_name) {
383
- this.row.f_paper_name = this.row.f_user_name
384
- }
385
- if (!this.row.f_address_phone) {
386
- this.row.f_address_phone = this.row.f_address + ' ' + this.row.f_user_phone
387
- }
388
- if (!this.row.f_email) {
389
- this.row.f_email = this.row.f_email
390
- }
391
- this.eticket_msg = true
392
- } else {
393
- this.confirm()
394
- }
395
- },
396
- confirmOverdue () {
397
- this.breakOverdue = {
398
- f_user_id: this.data.f_user_id,
399
- f_userfiles_id: this.data.f_userfiles_id,
400
- f_userinfo_id: this.data.f_userinfo_id,
401
- f_old_overdue: this.overdueModal.f_old_overdue,
402
- f_new_overdue: this.overdueModal.f_new_overdue,
403
- f_operator: this.$login.f.name,
404
- f_operatorid: this.$login.f.id,
405
- f_orgid: this.$login.f.orgid,
406
- f_orgname: this.$login.f.orgs,
407
- f_depid: this.$login.f.depids,
408
- f_depname: this.$login.f.deps,
409
- f_zoneid: this.$login.f.zoneid,
410
- f_zones: this.$login.f.zones
411
- }
412
- this.showOverdueModal = false
413
- this.newOverdue = this.overdueModal.f_new_overdue
414
- this.isBreakOverdue = (this.overdueModal.f_new_overdue - this.overdueModal.f_old_overdue != 0)
415
- },
416
-
417
- closeOverdue () {
418
- this.showOverdueModal = false
419
- this.editOverdue = null
420
- this.showErrorMsg = false
421
- },
422
- /**
423
- * 用来进行小数相加的工具方法
424
- * @param {*} num1
425
- * @param {*} num2
426
- */
427
- addNum (num1, num2) {
428
- let sq1, sq2, multiple
429
- try {
430
- sq1 = num1.toString().split('.')[1].length
431
- } catch (e) {
432
- sq1 = 0
433
- }
434
- try {
435
- sq2 = num2.toString().split('.')[1].length
436
- } catch (e) {
437
- sq2 = 0
438
- }
439
- multiple = Math.pow(10, Math.max(sq1, sq2) + 1)
440
- return (num1 * multiple + num2 * multiple) / multiple
441
- },
442
- /**
443
- * 用来进行小数相减的工具方法
444
- * @param {*} num1
445
- * @param {*} num2
446
- */
447
- subNum (num1, num2) {
448
- let sq1, sq2, multiple
449
- try {
450
- sq1 = num1.toString().split('.')[1].length
451
- } catch (e) {
452
- sq1 = 0
453
- }
454
- try {
455
- sq2 = num2.toString().split('.')[1].length
456
- } catch (e) {
457
- sq2 = 0
458
- }
459
- multiple = Math.pow(10, Math.max(sq1, sq2) + 1)
460
- return (num1 * multiple - num2 * multiple) / multiple
461
- },
462
- confirm () {
463
- this.eticket_msg = false
464
- // 如果有变更原因说明有变更
465
- if (this.data.f_collection < 0) {
466
- this.$showMessage('收款金额不能小于零!!')
467
- return
468
- }
469
- if (this.charge) {
470
- let inti = this.subNum(this.addNum(this.data.f_collection, this.data.f_balance), this.data.f_totalcost)
471
- console.log('===>', inti)
472
- if (this.floor) {
473
- if (inti < -1) {
474
- this.$showMessage('收款金额不足以清缴欠费,请核查,并重新输入收款金额!!')
475
- return
476
- }
477
- } else {
478
- if (inti < 0) {
479
- this.$showMessage('收款金额不足以清缴欠费,请核查,并重新输入收款金额!!')
480
- // this.data.f_collection = this.data.f_totalcost
481
- return
482
- }
483
- }
484
- }
485
- if (this.newOverdue > 0) {
486
- let inti = this.subNum(this.addNum(this.data.f_collection, this.data.f_balance), this.data.f_totalcost)
487
- console.log('===>', inti)
488
- if (this.floor) {
489
- if (inti < -1) {
490
- this.$showMessage('该户已产生违约金,必须全部进行清缴,请核查,并重新输入收款金额!!')
491
- return
492
- }
493
- } else {
494
- if (inti < 0) {
495
- this.$showMessage('该户已产生违约金,必须全部进行清缴,请核查,并重新输入收款金额!!')
496
- // this.data.f_collection = this.data.f_totalcost
497
- return
498
- }
499
- }
500
- }
501
-
502
- this.data.f_overdue = this.newOverdue
503
- this.data.isBreakOverdue = this.isBreakOverdue
504
- if (this.isBreakOverdue) {
505
- this.data.breakOverdue = this.breakOverdue
506
- }
507
- this.$showMessage(`确定对用户${this.row.f_user_name}进行机表缴费吗?`, ['confirm', 'cancel']).then(async (res) => {
508
- if (res === 'confirm') {
509
- // 先调用付款码支付组件流程
510
- let ss = await this.$refs.paymentcode.flowPath()
511
- this.$refs.paymentcode.paymentCodeShow = false
512
- console.log('付款码操作返回', ss)
513
- if (!ss.result) return
514
- machineChargeGen(this)
515
- }
516
- })
517
- },
518
- calOverdue () {
519
- this.data.f_totalcost = this.data.f_totalcost - (this.data.f_overdue - this.newOverdue)
520
- this.data.f_overdue = this.newOverdue
521
- },
522
- clean () {
523
- this.$dispatch('success', '机表收费', this.data)
524
- this.$info('取消操作')
525
- },
526
- validateBill (val) {
527
- this.validateOk = !val.isOk
528
- this.billData.bill = val.bill
529
- },
530
- printok () {
531
- this.$dispatch('success')
532
- },
533
- checkOverdue () {
534
- this.$nextTick(() => {
535
- this.newOverdue = this.data.f_overdue
536
- this.calOverdue()
537
- })
538
- },
539
- close () {
540
- this.print = false
541
- this.clean()
542
- },
543
- // 根据选择的付款方式 获取优惠列表
544
- async getPrivilegeList () {
545
- // 初始化下拉选择列表
546
- this.privilegeList = [{label: '无优惠', value: '0'}]
547
- // 初始为无优惠
548
- this.data.f_privilege_id = '0'
549
- if (this.data.f_payment && this.data.f_payment.length) {
550
- // 查询条件
551
- let payments = JSON.stringify(this.data.f_payment)
552
- payments = payments.replace('[', '(').replace(']', ')').replace(/"/g, '\'')
553
- let HttpReset = new HttpResetClass()
554
- let privilege = await HttpReset.load('POST', 'rs/sql/singleTable_OrderBy', {
555
- data: {
556
- items: 'id,f_privilege_name,f_privilege_type',
557
- tablename: 't_privilege',
558
- condition: `f_payment in ${payments} and f_gasproperties = '${this.row.f_gasproperties}' and f_user_type = '${this.row.f_user_type}' and f_perform_date <= GETDATE() and f_end_date >= GETDATE() and f_state = '有效'`,
559
- orderitem: 'id'
560
- }
561
- }, {resolveMsg: null, rejectMsg: '查询优惠信息失败'})
562
- // 查询结果放到下拉列表
563
- for (let p of privilege.data) {
564
- this.privilegeList.push({label: p.f_privilege_name, value: p.id, type: p.f_privilege_type})
565
- }
566
- this.privilegeCalculate()
567
- }
568
- },
569
- eticket_toggle () {
570
- this.eticket_show = false
571
- this.$dispatch('success')
572
- },
573
- // 优惠计算
574
- async privilegeCalculate () {
575
- // 初始化减免金额
576
- this.data.f_privilege_money = 0
577
- this.data.f_after_discount = this.data.f_collection
578
- // 判断是否是自定义优惠
579
- if (parseInt(this.data.f_privilege_id)) {
580
- for (let p of this.privilegeList) {
581
- if (p.value == this.data.f_privilege_id && p.type == '自定义') {
582
- this.data.f_privilege_money = window.prompt('请输入你想优惠的金额')
583
- if (!(/^[1-9]\d*(\.\d+)?$/).test(this.data.f_privilege_money) || !(/^[1-9]\d*(\.\d+)?$/).test(this.data.f_privilege_money)) {
584
- this.$showMessage('金额输入格式不正确!')
585
- this.data.f_privilege_money = 0
586
- return
587
- }
588
- if ((this.data.f_privilege_money - 0) >= this.data.f_collection) {
589
- this.$showMessage('减免金额不能大于等于收款金额')
590
- this.data.f_privilege_money = 0
591
- return
592
- }
593
- }
594
- }
595
- }
596
- // 优惠方式, 收款 缺一不计算
597
- if (this.data.f_payment && this.data.f_payment.length && parseInt(this.data.f_privilege_id) && this.data.f_collection) {
598
- let c = {
599
- f_privilege_id: this.data.f_privilege_id,
600
- f_collection: this.data.f_collection,
601
- f_privilege_money: this.data.f_privilege_money
602
- }
603
- let privilegeData = await this.$resetpost('rs/logic/calculatePrivilege', c, {resolveMsg: null, rejectMsg: '计算优惠金额出错'})
604
- // 减免金额
605
- this.data.f_privilege_money = privilegeData.data.f_privilege_money
606
- // 减免后收款金额
607
- this.data.f_after_discount = privilegeData.data.f_collection
608
- }
609
- },
610
- async speckText (str) {
611
- var url = 'http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=6&text=' + encodeURI(str)
612
- await new Audio(url).play()
613
- }
614
- },
615
- watch: {
616
- 'data.f_overdue' (val) {
617
- // this.data.f_last_overdue = this.newOverdue
618
- this.newOverdue = val
619
- },
620
- 'splitAll' (val) {
621
- this.data.f_pregas = this.data.f_pregas - val
622
- },
623
- 'invoice_show_gas' () {
624
- return this.row.f_collection_type === '按气量' ? '是' : '否'
625
- },
626
- 'newOverdue' (val) {
627
- this.data.f_totalcost = (this.data.f_preamount - 0) + (val - 0)
628
- if (this.data.f_totalcost - this.data.f_balance > 0) {
629
- if (this.floor) {
630
- this.data.f_collection = Math.floor(this.data.f_totalcost - this.data.f_balance)
631
- } else if (this.ceil) {
632
- this.data.f_collection = Math.ceil(this.data.f_totalcost - this.data.f_balance)
633
- } else {
634
- this.data.f_collection = this.data.f_totalcost - this.data.f_balance
635
- }
636
- } else {
637
- this.data.f_collection = 0
638
- }
639
- },
640
- 'data.f_payment' (val) {
641
- this.getPrivilegeList()
642
- // 根据付款方式增加业务单号
643
- if (val == '免交') {
644
- this.mjshow = true
645
- } else {
646
- this.mjshow = false
647
- }
648
- },
649
- async 'data.f_collection' (val) {
650
- if ((this.data.f_totalcost - 0) > (val - 0)) {
651
- if (this.authArr.includes('机表收费语音播报')) {
652
- await this.speckText('请注意,当前收款小于欠费')
653
- }
654
- }
655
- // 没获取优惠之前默认和收款一样,防止获取优惠太慢导致收款金额与实际收款不符
656
- this.data.f_after_discount = this.data.f_collection
657
- // 获取计算优惠
658
- this.getPrivilegeList()
659
- }
660
- },
661
- computed: {
662
- authArr () {
663
- return this.$login.r ? this.$login.r : []
664
- },
665
- curbalance () {
666
- if (((this.data.f_collection - 0) + (this.data.f_balance - 0)) > (this.data.f_totalcost - 0)) {
667
- return ((this.data.f_collection - 0) + (this.data.f_balance - 0) - (this.data.f_totalcost - 0)).toFixed(4)
668
- } else if (this.floor) {
669
- return ((this.data.f_collection - 0) + (this.data.f_balance - 0) - (this.data.f_totalcost - 0)).toFixed(4)
670
- } else {
671
- return 0
672
- }
673
- }
674
- }
675
- }
676
- </script>
1
+ <template>
2
+ <div class="span" style="overflow-y: auto !important;">
3
+ <validator name='v'>
4
+ <form class="form-horizontal">
5
+ <div class="row" style="padding-top: 0.5em;">
6
+ <div class="col-sm-4 form-group" :class="[$v.payment.required ? 'has-error select-error' : '']">
7
+ <label for="f_paytype" class=" font_normal_body" title="参数名称:付款方式">收款方式</label>
8
+ <input type="text" v-show="false" v-model="$refs.payment.selectedItems" v-validate:payment='{required: true }'>
9
+ <v-select id="f_payment"
10
+ v-model="f_payment"
11
+ style="width:60%"
12
+ placeholder='请选择'
13
+ :value.sync="data.f_payment"
14
+ :options='paytype'
15
+ v-ref:payment
16
+ close-on-select clear-button>
17
+ </v-select>
18
+
19
+ </div>
20
+ <div class="col-sm-4 form-group">
21
+ <label for="f_print" class="font_normal_body">打印格式</label>
22
+
23
+ <v-select id="print"
24
+ v-model="data.f_print"
25
+ placeholder='请选择'
26
+ style="width:60%"
27
+ :value.sync="data.f_print"
28
+ :options='printstyle'
29
+ close-on-select clear-button>
30
+ </v-select>
31
+
32
+ </div>
33
+ <div class="col-sm-4 form-group">
34
+ <label for="f_overdue" class="font_normal_body">违&ensp;约&ensp;金</label>
35
+ <input class="input_search" style="width:60%" type="number" v-model="newOverdue"
36
+ v-scale="[newOverdue,2]" placeholder="违约金"
37
+ disabled>
38
+ <!--<button type="button" name="button" class="btn btn-link" @click="modefiy()" v-if="authArr.includes('滞纳金修改')">修改</button>-->
39
+ </div>
40
+ </div>
41
+ <div class="row" style="padding-top: 0.5em;" >
42
+
43
+ <div class="col-sm-4 form-group">
44
+ <label for="f_pregas" class=" font_normal_body">用&ensp;气&ensp;量</label>
45
+ <input class="input_search" style="width:60%" type="number"
46
+ v-model="data.f_pregas" placeholder="用气量"
47
+ v-scale = "[data.f_pregas, 2]" disabled>
48
+ </div>
49
+ <div class="col-sm-4 form-group">
50
+ <label for="f_preamount" class="font_normal_body">实欠气费</label>
51
+ <input class="input_search" style="width:60%" style="width:60%" type="number" v-model="data.f_preamount"
52
+ v-scale = "[data.f_preamount, 2]"
53
+ placeholder="实欠气费" disabled>
54
+ </div>
55
+
56
+ <div class="col-sm-4 form-group">
57
+ <label for="f_totalcost" class=" font_normal_body">应收金额</label>
58
+ <input class="input_search" style="width:60%" type="number" v-model="data.f_totalcost"
59
+ v-scale = "[data.f_totalcost, 2]" placeholder="应收金额" disabled>
60
+ </div>
61
+ </div>
62
+
63
+ <div class="row" style="padding-top: 0.5em;">
64
+ <div class="col-sm-4 form-group">
65
+ <label for="f_balance" class="font_normal_body">上期结余</label>
66
+ <input class="input_search" style="width:60%" type="number" v-model="data.f_balance"
67
+ v-scale="[data.f_balance,4]" placeholder="上期结余" disabled>
68
+ </div>
69
+ <div class="col-sm-4 form-group">
70
+ <label for="f_overdue" class="font_normal_body">本期结余</label>
71
+ <input class="input_search" style="width:60%" type="number" v-model="curbalance" disabled>
72
+ </div>
73
+ <div class="col-sm-3 form-group" v-if="config.hasfindaReail" :class="[$v.f_collection.required || $v.f_collection.dctest ? 'has-error select-error' : '']">
74
+ <label for="f_collection" class="font_normal_body">收&emsp;&emsp;款</label>
75
+ <input id="f_collection" class="input_search" style="width:60%" type="number" v-model="data.f_collection"
76
+ v-validate:f_collection='{required: true, dctest: [0, ">=" ]}' v-scale = "[data.f_collection, 2]"
77
+ @mousewheel.native.prevent @keyup.enter="confirm()" :disabled="$refs.givechange.promptText != ''">
78
+ </div>
79
+ <div class="col-sm-4 form-group" v-if="!config.hasfindaReail" :class="[$v.f_collection.required || $v.f_collection.dctest ? 'has-error select-error' : '']">
80
+ <label for="f_collection" class="font_normal_body">收&emsp;&emsp;款</label>
81
+ <input id="f_collection" class="input_search" style="width:60%" type="number" v-model="data.f_collection"
82
+ v-validate:f_collection='{required: true, dctest: [0, ">=" ]}' v-scale = "[data.f_collection, 2]"
83
+ @mousewheel.native.prevent @keyup.enter="confirm()" :disabled="$refs.givechange.promptText != ''">
84
+ </div>
85
+ <div class="col-sm-1 form-group" v-if="config.hasfindaReail">
86
+ <give-change :curbalance="curbalance" :collection.sync="data.f_collection" v-ref:givechange></give-change>
87
+ </div>
88
+ </div>
89
+
90
+ <div class="row" style="margin-top:5px;" v-show="authArr.includes('优惠权限')">
91
+ <div class="col-sm-4 form-group">
92
+ <label class="font_normal_body">优惠方式</label>
93
+ <v-select v-model="data.f_privilege_id" @blur.native.capture="privilegeCalculate"
94
+ placeholder='请选择'
95
+ :value.sync="data.f_privilege_id"
96
+ :options='privilegeList' clear-button value-single>
97
+ </v-select>
98
+ </div>
99
+ <div class="col-sm-4 form-group">
100
+ <label for="f_preamount" class=" font_normal_body">优惠金额</label>
101
+ <input class="input_search" style="width:60%" type="number" v-model="data.f_privilege_money"
102
+ v-scale="[data.f_privilege_money, 2]" placeholder="优惠金额" disabled>
103
+ </div>
104
+ <div class="col-sm-4 form-group">
105
+ <label for="f_preamount" class=" font_normal_body">实际收款</label>
106
+ <input class="input_search" style="width:60%" type="number" v-model="data.f_after_discount"
107
+ v-scale="[data.f_after_discount, 2]" placeholder="优惠后收款" disabled>
108
+ </div>
109
+ </div>
110
+
111
+ <div class="row" style="padding-top: 0.5em;">
112
+ <div class="col-sm-4 form-group" v-show="row.f_garbage_fee === '是'">
113
+ <label for="f_garbage_fee" class="font_normal_body">垃&ensp;圾&ensp;费</label>
114
+ <input class="input_search" style="width:60%" type="number" v-model="data.f_garbage_fee" disabled>
115
+ </div>
116
+ </div>
117
+
118
+ <div class="row" style="padding-top: 0.5em;">
119
+ <div class="col-sm-4" v-if="!mjshow" >
120
+ <label for="f_serial_number" class=" font_normal_body">业务单号</label>
121
+ <input class="input_search" style="width:60%" type="text"
122
+ v-model="data.f_serial_number" placeholder="业务单号">
123
+ </div>
124
+ <div class="col-sm-4" v-if="mjshow" :class="[$v.f_serial_number.required || $v.f_serial_number.dctest ? 'has-error' : 'has-success']">
125
+ <label for="f_serial_number" class=" font_normal_body">业务单号</label>
126
+ <input class="input_search" style="width:60%" type="text" v-validate:f_serial_number='{required: true }'
127
+ v-model="data.f_serial_number" placeholder="业务单号">
128
+ </div>
129
+ <div class="col-sm-8">
130
+ <label for="f_comments" class="font_normal_body">备&emsp;&emsp;注</label>
131
+ <input class="input_search" style="width:87%" v-model="data.f_comments" placeholder="备注">
132
+ </div>
133
+ </div>
134
+ </form>
135
+ <validate-bill v-if="hasValidateBill" :data="data" @validate-bill="validateBill"></validate-bill>
136
+ <print-bill :show="print" :bill-config='config' :bill-data='billData' v-on:toggle="close" :data='data' @printok="printok" v-ref:printbill></print-bill>
137
+ <ticket-print :show="eticket_show" @toggle="eticket_toggle" v-ref:eticketbill></ticket-print>
138
+ <eticket-modal :show="eticket_msg" @closemodalshow="eticket_msg = false" :row="row" @confirm="confirm"></eticket-modal>
139
+ <div class="text-right" style="margin-top: 1%">
140
+ <strong style="color:red;margin-right: 5px">{{ $refs.givechange.promptText }}</strong>
141
+ <payment-code-button :clickable="!$v.valid || validateOk"
142
+ :payment.sync="data.f_payment" :payment-data="paytype"
143
+ @confirm-payment="confirm()">
144
+ </payment-code-button>
145
+ <button class="button_search btn-gn" @click="checkInvoiceMsg()" :disabled='!$v.valid || validateOk'>确认</button>
146
+ <!--<button class="btn btn-success" @click="confirmUserinfo()" :disabled='!$v.valid'>信息保存</button>-->
147
+ <button class="button_clear btn-gn" @click="clean()">取消</button>
148
+ </div>
149
+ </validator>
150
+ <!--<modal :show.sync="showOverdueModal" v-ref:modal backdrop="false">-->
151
+ <!--<header slot="modal-header" class="modal-header">-->
152
+ <!--<button type="button" class="close" @click="closeOverdue"><span>&times;</span></button>-->
153
+ <!--<h4 class="modal-title">修改滞纳金</h4>-->
154
+ <!--</header>-->
155
+ <!--<article slot="modal-body" class="modal-body">-->
156
+ <!--<validator name='m'>-->
157
+ <!--<form class="form-horizontal">-->
158
+ <!--<div class="row">-->
159
+ <!--<div class="col-sm-6">-->
160
+ <!--<label for="oldOverdue" class="font_normal_body">原违约金</label>-->
161
+ <!--<input type="text" class="input_search" style="width:60%" v-once v-model="overdueModal.f_old_overdue" disabled>-->
162
+ <!--</div>-->
163
+ <!--</div>-->
164
+ <!--<div class="row">-->
165
+ <!--<div class="col-sm-6" :class="[$m.f_new_overdue.required ? 'has-error select-error' : '']">-->
166
+ <!--<label for="newOverdue" class="font_normal_body">新违约金</label>-->
167
+ <!--<input type="text" class="input_search" style="width:60%" v-model="overdueModal.f_new_overdue"-->
168
+ <!--v-validate:f_new_overdue='{required: true}'>-->
169
+ <!--</div>-->
170
+ <!--</div>-->
171
+ <!--</form>-->
172
+ <!--</validator>-->
173
+ <!--</article>-->
174
+
175
+ <!--<footer slot="modal-footer" class="modal-footer">-->
176
+ <!--<button type="button" class="button_search" :disabled='!$m.valid' @click='confirmOverdue()'>确认</button>-->
177
+ <!--<button type="button" class="button_clear" @click='closeOverdue'>取消</button>-->
178
+ <!--</footer>-->
179
+ <!--</modal>-->
180
+ <payment-code v-ref:paymentcode :payment="data.f_payment" :row="row" :money="data.f_after_discount"></payment-code>
181
+ </div>
182
+ <upload :blodid="row.f_userinfo_id" v-if="config.showupload" isremark="true" fusetype="机表收费"></upload>
183
+ </template>
184
+ <script>
185
+ import {HttpResetClass} from 'vue-client'
186
+
187
+ /**
188
+ *售气收费
189
+ *机表收费组件
190
+ */
191
+
192
+ let asyncMachineMeterCenter = async function (self) {
193
+ await self.$getConfig(self, 'MachineMeterCenter')
194
+ self.data.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
195
+ self.data.f_payment = [self.config.payment]
196
+ self.data.f_use_type = self.config.billType
197
+ self.data.f_bill_type = self.data.f_print
198
+ self.hasValidateBill = self.config.hasBillManage
199
+ }
200
+
201
+ let machineChargeGen = async function (self) {
202
+ try {
203
+ if (!self.model) self.model = {}
204
+ // 加入扫码盒付款码支付流水号
205
+ self.model.f_serial_id = self.$refs.paymentcode.paymentCodeReturnData.f_out_trade_no
206
+ console.log('查看传过来的数据=====================>', self)
207
+ let res = await self.$MachineChargeService.marchineCharge(self.data, self.model, self.row, self.floor)
208
+ let localeSustainMoney = window.localStorage.getItem('sustainMoney')
209
+ if (localeSustainMoney != null) {
210
+ localeSustainMoney = (localeSustainMoney - 0) + (self.data.f_collection - self.data.f_garbage_fee)
211
+ window.localStorage.setItem('sustainMoney', localeSustainMoney)
212
+ }
213
+ let param = []
214
+ for (let row of self.resid) {
215
+ param.push({id: row.id})
216
+ }
217
+ let data = {
218
+ param: param,
219
+ f_blobid: res.data
220
+ }
221
+
222
+ await self.$resetpost('rs/logic/updatefiles', data)
223
+
224
+ // 开始打票
225
+ if (self.config.hasPrint) {
226
+ if (self.data.f_print.indexOf('电子发票') == -1) {
227
+ if (self.$login.r.includes('非民用纸质票据拆分')) {
228
+ if (self.row.f_user_type === '非民用') {
229
+ self.billData.url = 'rs/report/fmy_machine_bill'
230
+ }
231
+ }
232
+ if (self.config.hasBillManage) {
233
+ // 启用发票管理,获取票据管理中的票号并存储记录
234
+ self.data.id = res.data
235
+ self.data.f_bill_type = '机表收费'
236
+ self.data.f_bill_style = self.data.f_print[0]
237
+ self.print = true
238
+ } else {
239
+ // 如果不欠费就用下边的预存收据
240
+ if (self.$parent.$children[0].selecteds) {
241
+ console.log('1111111', self.$parent.$children[0].selecteds)
242
+ if (self.$parent.$children[0].selectedRows === 0) {
243
+ console.log('22222222', self.$parent.$children[0].selectedRows)
244
+ self.billData.url = 'rs/report/pre_sell'
245
+ }
246
+ // 获取选中的handplan的id
247
+ self.data.handid = ''
248
+ self.$parent.$children[0].selecteds.forEach((row, index) => {
249
+ self.data.handid = self.data.handid + "','" + row.handplan_id
250
+ })
251
+ } else {
252
+ console.log('3333333')
253
+ self.billData.url = 'rs/report/pre_sell'
254
+ self.data.handid = ''
255
+ }
256
+ self.data.id = res.data
257
+ self.print = true
258
+ }
259
+ } else if (self.data.f_print[0] === '国税发票') {
260
+ // TODO
261
+ } else if (self.data.f_print[0] === '电子发票') {
262
+ self.eticket_show = true
263
+ await self.$refs.eticketbill.openETicket(res.data, self.row, '机表收费')
264
+ // await self.$CommonService.openEticket(res.data, '售气收费')
265
+ // 如果不欠费就用下边的预存收据
266
+ // if (self.$parent.$children[0].selecteds) {
267
+ // if (self.$parent.$children[0].selectedRows === 0) {
268
+ // self.billData.url = 'rs/report/pre_sell'
269
+ // }
270
+ // // 获取选中的handplan的id
271
+ // self.data.handid = ''
272
+ // self.$parent.$children[0].selecteds.forEach((row, index) => {
273
+ // self.data.handid = self.data.handid + "','" + row.handplan_id
274
+ // })
275
+ // } else {
276
+ // self.billData.url = 'rs/report/pre_sell'
277
+ // self.data.handid = ''
278
+ // }
279
+ // self.data.id = res.data
280
+ // self.print = true
281
+ }
282
+ } else {
283
+ self.$dispatch('success', '机表收费确认', self.row, self.data)
284
+ }
285
+ } catch (error) {
286
+ self.$showAlert(error, 'danger', 0)
287
+ self.$dispatch('refresh')
288
+ }
289
+ }
290
+
291
+ export default {
292
+ title: '收费',
293
+ data () {
294
+ return {
295
+ mjshow: false,
296
+ resid: [], // 存放新增的f_files表中id
297
+ config: {
298
+ showupload: true, // 显示上传
299
+ hasPrint: true, // 默认打票
300
+ hasBillManage: false, // 默认不启用发票管理
301
+ hasfindaReail: true, // 默认开启找零功能
302
+ billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
303
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
304
+ payment: '现金缴费'
305
+ },
306
+ eticket_msg: false,
307
+ eticket_show: false,
308
+ invoice_is_pax: '征税',
309
+ is_pax: [{label: '征税', value: '征税'}, {label: '不征税', value: '不征税'}],
310
+ // 垃圾费
311
+ f_garbage_fee: 0,
312
+ overdueModal: {
313
+ f_old_overdue: 0,
314
+ f_new_overdue: ''
315
+ },
316
+ newOverdue: 0,
317
+ isBreakOverdue: false,
318
+ breakOverdue: {},
319
+
320
+ showErrorMsg: false,
321
+ print: false,
322
+ isConfirm: true,
323
+ show: false,
324
+ count: 0,
325
+ billData: {
326
+ url: 'rs/report/machine_bill',
327
+ bill: ''
328
+ },
329
+
330
+ // 启用发票管理需要对票号进行验证
331
+ hasValidateBill: false,
332
+ validateOk: false,
333
+ handid: '',
334
+ showOverdueModal: false,
335
+ editOverdue: this.$login.r.includes('滞纳金修改'),
336
+ paytype: [],
337
+ printstyle: this.$appdata.getParam('打印格式') ? this.$appdata.getParam('打印格式') : [],
338
+ privilegeList: [{label: '无优惠', value: '0'}],
339
+ // 在向下取整时,保存所有的应交金额
340
+ totalcost: 0,
341
+ serialShow: false
342
+ }
343
+ },
344
+ props: ['data', 'row', 'floor', 'ceil', 'charge'],
345
+ ready () {
346
+ this.paytype = this.$appdata.getParam('付款方式') ? this.$appdata.getParam('付款方式') : []
347
+ if (!this.$login.r.includes('免交充值付款')) {
348
+ this.paytype = this.paytype.filter((item) => {
349
+ return item.label != '免交'
350
+ })
351
+ }
352
+ // this.calOverdue()
353
+ this.newOverdue = this.overdueModal.f_old_overdue = this.data.f_overdue
354
+ if (this.floor) {
355
+ this.totalcost = this.data.f_totalcost
356
+ }
357
+ document.getElementById('f_collection').focus()
358
+ asyncMachineMeterCenter(this)
359
+ },
360
+ events: {
361
+ // 删除Resid数组元素
362
+ 'delResid' (val) {
363
+ this.resid.$remove({id: val, f_biobid: ''})
364
+ // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
365
+ },
366
+ // 增加Resid数组元素
367
+ 'resid' (val) {
368
+ this.resid.push({id: val, f_biobid: ''})
369
+ }
370
+ },
371
+ modefiy () {
372
+ this.overdueModal.f_new_overdue = ''
373
+ this.showOverdueModal = true
374
+ },
375
+ methods: {
376
+ // 校验发票信息
377
+ checkInvoiceMsg () {
378
+ if (this.data.f_print[0] === '电子发票') {
379
+ if (!this.row.f_taxpayer_id) {
380
+ this.row.f_taxpayer_id = this.row.f_idnumber
381
+ }
382
+ if (!this.row.f_paper_name) {
383
+ this.row.f_paper_name = this.row.f_user_name
384
+ }
385
+ if (!this.row.f_address_phone) {
386
+ this.row.f_address_phone = this.row.f_address + ' ' + this.row.f_user_phone
387
+ }
388
+ if (!this.row.f_email) {
389
+ this.row.f_email = this.row.f_email
390
+ }
391
+ this.eticket_msg = true
392
+ } else {
393
+ this.confirm()
394
+ }
395
+ },
396
+ confirmOverdue () {
397
+ this.breakOverdue = {
398
+ f_user_id: this.data.f_user_id,
399
+ f_userfiles_id: this.data.f_userfiles_id,
400
+ f_userinfo_id: this.data.f_userinfo_id,
401
+ f_old_overdue: this.overdueModal.f_old_overdue,
402
+ f_new_overdue: this.overdueModal.f_new_overdue,
403
+ f_operator: this.$login.f.name,
404
+ f_operatorid: this.$login.f.id,
405
+ f_orgid: this.$login.f.orgid,
406
+ f_orgname: this.$login.f.orgs,
407
+ f_depid: this.$login.f.depids,
408
+ f_depname: this.$login.f.deps,
409
+ f_zoneid: this.$login.f.zoneid,
410
+ f_zones: this.$login.f.zones
411
+ }
412
+ this.showOverdueModal = false
413
+ this.newOverdue = this.overdueModal.f_new_overdue
414
+ this.isBreakOverdue = (this.overdueModal.f_new_overdue - this.overdueModal.f_old_overdue != 0)
415
+ },
416
+
417
+ closeOverdue () {
418
+ this.showOverdueModal = false
419
+ this.editOverdue = null
420
+ this.showErrorMsg = false
421
+ },
422
+ /**
423
+ * 用来进行小数相加的工具方法
424
+ * @param {*} num1
425
+ * @param {*} num2
426
+ */
427
+ addNum (num1, num2) {
428
+ let sq1, sq2, multiple
429
+ try {
430
+ sq1 = num1.toString().split('.')[1].length
431
+ } catch (e) {
432
+ sq1 = 0
433
+ }
434
+ try {
435
+ sq2 = num2.toString().split('.')[1].length
436
+ } catch (e) {
437
+ sq2 = 0
438
+ }
439
+ multiple = Math.pow(10, Math.max(sq1, sq2) + 1)
440
+ return (num1 * multiple + num2 * multiple) / multiple
441
+ },
442
+ /**
443
+ * 用来进行小数相减的工具方法
444
+ * @param {*} num1
445
+ * @param {*} num2
446
+ */
447
+ subNum (num1, num2) {
448
+ let sq1, sq2, multiple
449
+ try {
450
+ sq1 = num1.toString().split('.')[1].length
451
+ } catch (e) {
452
+ sq1 = 0
453
+ }
454
+ try {
455
+ sq2 = num2.toString().split('.')[1].length
456
+ } catch (e) {
457
+ sq2 = 0
458
+ }
459
+ multiple = Math.pow(10, Math.max(sq1, sq2) + 1)
460
+ return (num1 * multiple - num2 * multiple) / multiple
461
+ },
462
+ confirm () {
463
+ this.eticket_msg = false
464
+ // 如果有变更原因说明有变更
465
+ if (this.data.f_collection < 0) {
466
+ this.$showMessage('收款金额不能小于零!!')
467
+ return
468
+ }
469
+ if (this.charge) {
470
+ let inti = this.subNum(this.addNum(this.data.f_collection, this.data.f_balance), this.data.f_totalcost)
471
+ console.log('===>', inti)
472
+ if (this.floor) {
473
+ if (inti < -1) {
474
+ this.$showMessage('收款金额不足以清缴欠费,请核查,并重新输入收款金额!!')
475
+ return
476
+ }
477
+ } else {
478
+ if (inti < 0) {
479
+ this.$showMessage('收款金额不足以清缴欠费,请核查,并重新输入收款金额!!')
480
+ // this.data.f_collection = this.data.f_totalcost
481
+ return
482
+ }
483
+ }
484
+ }
485
+ if (this.newOverdue > 0) {
486
+ let inti = this.subNum(this.addNum(this.data.f_collection, this.data.f_balance), this.data.f_totalcost)
487
+ console.log('===>', inti)
488
+ if (this.floor) {
489
+ if (inti < -1) {
490
+ this.$showMessage('该户已产生违约金,必须全部进行清缴,请核查,并重新输入收款金额!!')
491
+ return
492
+ }
493
+ } else {
494
+ if (inti < 0) {
495
+ this.$showMessage('该户已产生违约金,必须全部进行清缴,请核查,并重新输入收款金额!!')
496
+ // this.data.f_collection = this.data.f_totalcost
497
+ return
498
+ }
499
+ }
500
+ }
501
+
502
+ this.data.f_overdue = this.newOverdue
503
+ this.data.isBreakOverdue = this.isBreakOverdue
504
+ if (this.isBreakOverdue) {
505
+ this.data.breakOverdue = this.breakOverdue
506
+ }
507
+ this.$showMessage(`确定对用户${this.row.f_user_name}进行机表缴费吗?`, ['confirm', 'cancel']).then(async (res) => {
508
+ if (res === 'confirm') {
509
+ // 先调用付款码支付组件流程
510
+ let ss = await this.$refs.paymentcode.flowPath()
511
+ this.$refs.paymentcode.paymentCodeShow = false
512
+ console.log('付款码操作返回', ss)
513
+ if (!ss.result) return
514
+ machineChargeGen(this)
515
+ }
516
+ })
517
+ },
518
+ calOverdue () {
519
+ this.data.f_totalcost = this.data.f_totalcost - (this.data.f_overdue - this.newOverdue)
520
+ this.data.f_overdue = this.newOverdue
521
+ },
522
+ clean () {
523
+ this.$dispatch('success', '机表收费', this.data)
524
+ this.$info('取消操作')
525
+ },
526
+ validateBill (val) {
527
+ this.validateOk = !val.isOk
528
+ this.billData.bill = val.bill
529
+ },
530
+ printok () {
531
+ this.$dispatch('success')
532
+ },
533
+ checkOverdue () {
534
+ this.$nextTick(() => {
535
+ this.newOverdue = this.data.f_overdue
536
+ this.calOverdue()
537
+ })
538
+ },
539
+ close () {
540
+ this.print = false
541
+ this.clean()
542
+ },
543
+ // 根据选择的付款方式 获取优惠列表
544
+ async getPrivilegeList () {
545
+ // 初始化下拉选择列表
546
+ this.privilegeList = [{label: '无优惠', value: '0'}]
547
+ // 初始为无优惠
548
+ this.data.f_privilege_id = '0'
549
+ if (this.data.f_payment && this.data.f_payment.length) {
550
+ // 查询条件
551
+ let payments = JSON.stringify(this.data.f_payment)
552
+ payments = payments.replace('[', '(').replace(']', ')').replace(/"/g, '\'')
553
+ let HttpReset = new HttpResetClass()
554
+ let privilege = await HttpReset.load('POST', 'rs/sql/singleTable_OrderBy', {
555
+ data: {
556
+ items: 'id,f_privilege_name,f_privilege_type',
557
+ tablename: 't_privilege',
558
+ condition: `f_payment in ${payments} and f_gasproperties = '${this.row.f_gasproperties}' and f_user_type = '${this.row.f_user_type}' and f_perform_date <= GETDATE() and f_end_date >= GETDATE() and f_state = '有效'`,
559
+ orderitem: 'id'
560
+ }
561
+ }, {resolveMsg: null, rejectMsg: '查询优惠信息失败'})
562
+ // 查询结果放到下拉列表
563
+ for (let p of privilege.data) {
564
+ this.privilegeList.push({label: p.f_privilege_name, value: p.id, type: p.f_privilege_type})
565
+ }
566
+ this.privilegeCalculate()
567
+ }
568
+ },
569
+ eticket_toggle () {
570
+ this.eticket_show = false
571
+ this.$dispatch('success')
572
+ },
573
+ // 优惠计算
574
+ async privilegeCalculate () {
575
+ // 初始化减免金额
576
+ this.data.f_privilege_money = 0
577
+ this.data.f_after_discount = this.data.f_collection
578
+ // 判断是否是自定义优惠
579
+ if (parseInt(this.data.f_privilege_id)) {
580
+ for (let p of this.privilegeList) {
581
+ if (p.value == this.data.f_privilege_id && p.type == '自定义') {
582
+ this.data.f_privilege_money = window.prompt('请输入你想优惠的金额')
583
+ if (!(/^[1-9]\d*(\.\d+)?$/).test(this.data.f_privilege_money) || !(/^[1-9]\d*(\.\d+)?$/).test(this.data.f_privilege_money)) {
584
+ this.$showMessage('金额输入格式不正确!')
585
+ this.data.f_privilege_money = 0
586
+ return
587
+ }
588
+ if ((this.data.f_privilege_money - 0) >= this.data.f_collection) {
589
+ this.$showMessage('减免金额不能大于等于收款金额')
590
+ this.data.f_privilege_money = 0
591
+ return
592
+ }
593
+ }
594
+ }
595
+ }
596
+ // 优惠方式, 收款 缺一不计算
597
+ if (this.data.f_payment && this.data.f_payment.length && parseInt(this.data.f_privilege_id) && this.data.f_collection) {
598
+ let c = {
599
+ f_privilege_id: this.data.f_privilege_id,
600
+ f_collection: this.data.f_collection,
601
+ f_privilege_money: this.data.f_privilege_money
602
+ }
603
+ let privilegeData = await this.$resetpost('rs/logic/calculatePrivilege', c, {resolveMsg: null, rejectMsg: '计算优惠金额出错'})
604
+ // 减免金额
605
+ this.data.f_privilege_money = privilegeData.data.f_privilege_money
606
+ // 减免后收款金额
607
+ this.data.f_after_discount = privilegeData.data.f_collection
608
+ }
609
+ },
610
+ async speckText (str) {
611
+ var url = 'http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=6&text=' + encodeURI(str)
612
+ await new Audio(url).play()
613
+ }
614
+ },
615
+ watch: {
616
+ 'data.f_overdue' (val) {
617
+ // this.data.f_last_overdue = this.newOverdue
618
+ this.newOverdue = val
619
+ },
620
+ 'splitAll' (val) {
621
+ this.data.f_pregas = this.data.f_pregas - val
622
+ },
623
+ 'invoice_show_gas' () {
624
+ return this.row.f_collection_type === '按气量' ? '是' : '否'
625
+ },
626
+ 'newOverdue' (val) {
627
+ this.data.f_totalcost = (this.data.f_preamount - 0) + (val - 0)
628
+ if (this.data.f_totalcost - this.data.f_balance > 0) {
629
+ if (this.floor) {
630
+ this.data.f_collection = Math.floor(this.data.f_totalcost - this.data.f_balance)
631
+ } else if (this.ceil) {
632
+ this.data.f_collection = Math.ceil(this.data.f_totalcost - this.data.f_balance)
633
+ } else {
634
+ this.data.f_collection = this.data.f_totalcost - this.data.f_balance
635
+ }
636
+ } else {
637
+ this.data.f_collection = 0
638
+ }
639
+ },
640
+ 'data.f_payment' (val) {
641
+ this.getPrivilegeList()
642
+ // 根据付款方式增加业务单号
643
+ if (val == '免交') {
644
+ this.mjshow = true
645
+ } else {
646
+ this.mjshow = false
647
+ }
648
+ },
649
+ async 'data.f_collection' (val) {
650
+ if ((this.data.f_totalcost - 0) > (val - 0)) {
651
+ if (this.authArr.includes('机表收费语音播报')) {
652
+ await this.speckText('请注意,当前收款小于欠费')
653
+ }
654
+ }
655
+ // 没获取优惠之前默认和收款一样,防止获取优惠太慢导致收款金额与实际收款不符
656
+ this.data.f_after_discount = this.data.f_collection
657
+ // 获取计算优惠
658
+ this.getPrivilegeList()
659
+ }
660
+ },
661
+ computed: {
662
+ authArr () {
663
+ return this.$login.r ? this.$login.r : []
664
+ },
665
+ curbalance () {
666
+ if (((this.data.f_collection - 0) + (this.data.f_balance - 0)) > (this.data.f_totalcost - 0)) {
667
+ return ((this.data.f_collection - 0) + (this.data.f_balance - 0) - (this.data.f_totalcost - 0)).toFixed(4)
668
+ } else if (this.floor) {
669
+ return ((this.data.f_collection - 0) + (this.data.f_balance - 0) - (this.data.f_totalcost - 0)).toFixed(4)
670
+ } else {
671
+ return 0
672
+ }
673
+ }
674
+ }
675
+ }
676
+ </script>