sale-client 4.2.65 → 4.2.67

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.
@@ -0,0 +1,710 @@
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, 4]"
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, 4]"
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, 4]" 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" :businessid="randomBusinessId" 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.transactionId
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
+ if (self.config.showupload) {
214
+ let param = []
215
+ for (let row of self.resid) {
216
+ param.push({id: row.id})
217
+ }
218
+ let data = {
219
+ param: param,
220
+ f_blobid: res.data
221
+ }
222
+
223
+ await self.$resetpost('api/af-revenue/logic/updatefiles', data)
224
+ }
225
+
226
+ // 开始打票
227
+ if (self.config.hasPrint) {
228
+ if (self.printInvoiceType.indexOf(self.data.f_print) === -1) {
229
+ if (self.data.f_print[0] == '热敏收据') {
230
+ self.billData.url = 'api/af-revenue/report/machine_bill_thermal'
231
+ if (self.$parent.$children[0].selecteds) {
232
+ if (self.$parent.$children[0].selectedRows === 0) {
233
+ self.billData.url = 'api/af-revenue/report/pre_sell_thermal'
234
+ }
235
+ // 获取选中的handplan的id
236
+ self.data.handid = ''
237
+ self.$parent.$children[0].selecteds.forEach((row, index) => {
238
+ self.data.handid = self.data.handid + "','" + row.handplan_id
239
+ })
240
+ } else {
241
+ self.billData.url = 'api/af-revenue/report/pre_sell'
242
+ self.data.handid = ''
243
+ }
244
+ self.data.id = res.data
245
+ self.print = true
246
+ } else {
247
+ if (self.$login.r.includes('非民用纸质票据拆分')) {
248
+ if (self.row.f_user_type === '非民用') {
249
+ self.billData.url = 'api/af-revenue/report/fmy_machine_bill'
250
+ }
251
+ }
252
+ if (self.config.hasBillManage) {
253
+ // 启用发票管理,获取票据管理中的票号并存储记录
254
+ self.data.id = res.data
255
+ self.data.f_bill_type = '机表收费'
256
+ self.data.f_bill_style = self.data.f_print[0]
257
+ self.print = true
258
+ } else {
259
+ // 如果不欠费就用下边的预存收据
260
+ if (self.$parent.$children[0].selecteds) {
261
+ console.log('1111111', self.$parent.$children[0].selecteds)
262
+ if (self.$parent.$children[0].selectedRows === 0) {
263
+ console.log('22222222', self.$parent.$children[0].selectedRows)
264
+ self.billData.url = 'api/af-revenue/report/pre_sell'
265
+ }
266
+ // 获取选中的handplan的id
267
+ self.data.handid = ''
268
+ self.$parent.$children[0].selecteds.forEach((row, index) => {
269
+ self.data.handid = self.data.handid + "','" + row.handplan_id
270
+ })
271
+ } else {
272
+ console.log('3333333')
273
+ self.billData.url = 'api/af-revenue/report/pre_sell'
274
+ self.data.handid = ''
275
+ }
276
+ self.data.id = res.data
277
+ self.print = true
278
+ }
279
+ }
280
+ } else if (self.data.f_print[0] === '国税发票') {
281
+ // TODO
282
+ } else if (self.printInvoiceType.indexOf(self.data.f_print[0]) !== -1) {
283
+ self.eticket_show = true
284
+ self.row.f_print = self.data.f_print[0]
285
+ await self.$refs.eticketbill.openETicket(res.data, self.row, '机表收费')
286
+ // await self.$CommonService.openEticket(res.data, '售气收费')
287
+ // 如果不欠费就用下边的预存收据
288
+ // if (self.$parent.$children[0].selecteds) {
289
+ // if (self.$parent.$children[0].selectedRows === 0) {
290
+ // self.billData.url = 'api/af-revenue/report/pre_sell'
291
+ // }
292
+ // // 获取选中的handplan的id
293
+ // self.data.handid = ''
294
+ // self.$parent.$children[0].selecteds.forEach((row, index) => {
295
+ // self.data.handid = self.data.handid + "','" + row.handplan_id
296
+ // })
297
+ // } else {
298
+ // self.billData.url = 'api/af-revenue/report/pre_sell'
299
+ // self.data.handid = ''
300
+ // }
301
+ // self.data.id = res.data
302
+ // self.print = true
303
+ }
304
+ } else {
305
+ self.$dispatch('success', '机表收费确认', self.row, self.data)
306
+ }
307
+ } catch (error) {
308
+ self.$showAlert(error, 'danger', 0)
309
+ self.$dispatch('refresh')
310
+ }
311
+ }
312
+
313
+ export default {
314
+ title: '收费',
315
+ data () {
316
+ return {
317
+ mjshow: false,
318
+ resid: [], // 存放新增的f_files表中id
319
+ randomBusinessId: '',
320
+ config: {
321
+ showupload: true, // 显示上传
322
+ hasPrint: true, // 默认打票
323
+ hasBillManage: false, // 默认不启用发票管理
324
+ hasfindaReail: true, // 默认开启找零功能
325
+ taxforidnumber: true, // 身份证号同步到纳税人识别号
326
+ billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
327
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
328
+ payment: '现金缴费'
329
+ },
330
+ eticket_msg: false,
331
+ eticket_show: false,
332
+ invoice_is_pax: '征税',
333
+ is_pax: [{label: '征税', value: '征税'}, {label: '不征税', value: '不征税'}],
334
+ // 垃圾费
335
+ f_garbage_fee: 0,
336
+ overdueModal: {
337
+ f_old_overdue: 0,
338
+ f_new_overdue: ''
339
+ },
340
+ newOverdue: 0,
341
+ isBreakOverdue: false,
342
+ breakOverdue: {},
343
+
344
+ showErrorMsg: false,
345
+ print: false,
346
+ isConfirm: true,
347
+ show: false,
348
+ count: 0,
349
+ billData: {
350
+ url: 'api/af-revenue/report/machine_bill',
351
+ bill: ''
352
+ },
353
+
354
+ // 启用发票管理需要对票号进行验证
355
+ hasValidateBill: false,
356
+ validateOk: false,
357
+ handid: '',
358
+ showOverdueModal: false,
359
+ editOverdue: this.$login.r.includes('违约金修改'),
360
+ paytype: [],
361
+ printstyle: this.$appdata.getParam('打印格式') ? this.$appdata.getParam('打印格式') : [],
362
+ printInvoiceType: this.$appdata.getSingleValue('电子票打印类型') ? this.$appdata.getSingleValue('电子票打印类型') : '电子发票',
363
+ privilegeList: [{label: '无优惠', value: '0'}],
364
+ // 在向下取整时,保存所有的应交金额
365
+ totalcost: 0,
366
+ serialShow: false
367
+ }
368
+ },
369
+ props: ['data', 'row', 'floor', 'ceil', 'charge'],
370
+ ready () {
371
+ this.paytype = this.$appdata.getParam('付款方式') ? this.$appdata.getParam('付款方式') : []
372
+ if (!this.$login.r.includes('免交充值付款')) {
373
+ this.paytype = this.paytype.filter((item) => {
374
+ return item.label != '免交'
375
+ })
376
+ }
377
+ // this.calOverdue()
378
+ this.newOverdue = this.overdueModal.f_old_overdue = this.data.f_overdue
379
+ if (this.floor) {
380
+ this.totalcost = this.data.f_totalcost
381
+ }
382
+ document.getElementById('f_collection').focus()
383
+ this.getRandomId()
384
+ asyncMachineMeterCenter(this)
385
+ },
386
+ events: {
387
+ // 删除Resid数组元素
388
+ 'delResid' (val) {
389
+ this.resid.$remove({id: val, f_biobid: ''})
390
+ // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
391
+ },
392
+ // 增加Resid数组元素
393
+ 'resid' (val) {
394
+ this.resid.push({id: val, f_biobid: ''})
395
+ }
396
+ },
397
+ modefiy () {
398
+ this.overdueModal.f_new_overdue = ''
399
+ this.showOverdueModal = true
400
+ },
401
+ methods: {
402
+ getRandomId () {
403
+ this.randomBusinessId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
404
+ let res = Math.random() * 16 | 0
405
+ let v = c == 'x' ? res : (res & 0x3 | 0x8)
406
+ return v.toString(16)
407
+ })
408
+ },
409
+ // 校验发票信息
410
+ checkInvoiceMsg () {
411
+ if (this.printInvoiceType.indexOf(this.data.f_print[0]) !== -1) {
412
+ if (!this.row.f_taxpayer_id && this.config.taxforidnumber) {
413
+ this.row.f_taxpayer_id = this.row.f_idnumber
414
+ }
415
+ if (!this.row.f_paper_name) {
416
+ this.row.f_paper_name = this.row.f_user_name
417
+ }
418
+ if (!this.row.f_address_phone) {
419
+ this.row.f_address_phone = this.row.f_address + ' ' + this.row.f_user_phone
420
+ }
421
+ if (!this.row.f_email) {
422
+ this.row.f_email = this.row.f_email
423
+ }
424
+ this.eticket_msg = true
425
+ } else {
426
+ this.confirm()
427
+ }
428
+ },
429
+ confirmOverdue () {
430
+ this.breakOverdue = {
431
+ f_user_id: this.data.f_user_id,
432
+ f_userfiles_id: this.data.f_userfiles_id,
433
+ f_userinfo_id: this.data.f_userinfo_id,
434
+ f_old_overdue: this.overdueModal.f_old_overdue,
435
+ f_new_overdue: this.overdueModal.f_new_overdue,
436
+ f_operator: this.$login.f.name,
437
+ f_operatorid: this.$login.f.id,
438
+ f_orgid: this.$login.f.orgid,
439
+ f_orgname: this.$login.f.orgs,
440
+ f_depid: this.$login.f.depids,
441
+ f_depname: this.$login.f.deps,
442
+ f_zoneid: this.$login.f.zoneid,
443
+ f_zones: this.$login.f.zones
444
+ }
445
+ this.showOverdueModal = false
446
+ this.newOverdue = this.overdueModal.f_new_overdue
447
+ this.isBreakOverdue = (this.overdueModal.f_new_overdue - this.overdueModal.f_old_overdue != 0)
448
+ },
449
+
450
+ closeOverdue () {
451
+ this.showOverdueModal = false
452
+ this.editOverdue = null
453
+ this.showErrorMsg = false
454
+ },
455
+ /**
456
+ * 用来进行小数相加的工具方法
457
+ * @param {*} num1
458
+ * @param {*} num2
459
+ */
460
+ addNum (num1, num2) {
461
+ let sq1, sq2, multiple
462
+ try {
463
+ sq1 = num1.toString().split('.')[1].length
464
+ } catch (e) {
465
+ sq1 = 0
466
+ }
467
+ try {
468
+ sq2 = num2.toString().split('.')[1].length
469
+ } catch (e) {
470
+ sq2 = 0
471
+ }
472
+ multiple = Math.pow(10, Math.max(sq1, sq2) + 1)
473
+ return (num1 * multiple + num2 * multiple) / multiple
474
+ },
475
+ /**
476
+ * 用来进行小数相减的工具方法
477
+ * @param {*} num1
478
+ * @param {*} num2
479
+ */
480
+ subNum (num1, num2) {
481
+ let sq1, sq2, multiple
482
+ try {
483
+ sq1 = num1.toString().split('.')[1].length
484
+ } catch (e) {
485
+ sq1 = 0
486
+ }
487
+ try {
488
+ sq2 = num2.toString().split('.')[1].length
489
+ } catch (e) {
490
+ sq2 = 0
491
+ }
492
+ multiple = Math.pow(10, Math.max(sq1, sq2) + 1)
493
+ return (num1 * multiple - num2 * multiple) / multiple
494
+ },
495
+ confirm () {
496
+ this.eticket_msg = false
497
+ // 如果有变更原因说明有变更
498
+ if (this.data.f_collection < 0) {
499
+ this.$showMessage('收款金额不能小于零!!')
500
+ return
501
+ }
502
+ if (this.charge) {
503
+ let inti = this.subNum(this.addNum(this.data.f_collection, this.data.f_balance), this.data.f_totalcost)
504
+ console.log('===>', inti)
505
+ if (this.floor) {
506
+ if (inti < -1) {
507
+ this.$showMessage('收款金额不足以清缴欠费,请核查,并重新输入收款金额!!')
508
+ return
509
+ }
510
+ } else {
511
+ if (inti < 0) {
512
+ this.$showMessage('收款金额不足以清缴欠费,请核查,并重新输入收款金额!!')
513
+ // this.data.f_collection = this.data.f_totalcost
514
+ return
515
+ }
516
+ }
517
+ }
518
+ if (this.newOverdue > 0) {
519
+ let inti = this.subNum(this.addNum(this.data.f_collection, this.data.f_balance), this.data.f_totalcost)
520
+ console.log('===>', inti)
521
+ if (this.floor) {
522
+ if (inti < -1) {
523
+ this.$showMessage('该户已产生违约金,必须全部进行清缴,请核查,并重新输入收款金额!!')
524
+ return
525
+ }
526
+ } else {
527
+ if (inti < 0) {
528
+ this.$showMessage('该户已产生违约金,必须全部进行清缴,请核查,并重新输入收款金额!!')
529
+ // this.data.f_collection = this.data.f_totalcost
530
+ return
531
+ }
532
+ }
533
+ }
534
+
535
+ this.data.f_overdue = this.newOverdue
536
+ this.data.isBreakOverdue = this.isBreakOverdue
537
+ if (this.isBreakOverdue) {
538
+ this.data.breakOverdue = this.breakOverdue
539
+ }
540
+ this.$showMessage(`确定对用户${this.row.f_user_name}进行机表缴费吗?`, ['confirm', 'cancel']).then(async (res) => {
541
+ if (res === 'confirm') {
542
+ // 先调用付款码支付组件流程
543
+ let ss = await this.$refs.paymentcode.flowPath()
544
+ this.$refs.paymentcode.paymentCodeShow = false
545
+ console.log('付款码操作返回', ss)
546
+ if (!ss.result) return
547
+ machineChargeGen(this)
548
+ }
549
+ })
550
+ },
551
+ calOverdue () {
552
+ this.data.f_totalcost = this.data.f_totalcost - (this.data.f_overdue - this.newOverdue)
553
+ this.data.f_overdue = this.newOverdue
554
+ },
555
+ clean () {
556
+ this.$dispatch('success', '机表收费', this.data)
557
+ this.$info('取消操作')
558
+ },
559
+ validateBill (val) {
560
+ this.validateOk = !val.isOk
561
+ this.billData.bill = val.bill
562
+ },
563
+ printok () {
564
+ this.$dispatch('success')
565
+ },
566
+ checkOverdue () {
567
+ this.$nextTick(() => {
568
+ this.newOverdue = this.data.f_overdue
569
+ this.calOverdue()
570
+ })
571
+ },
572
+ close () {
573
+ this.print = false
574
+ this.clean()
575
+ },
576
+ // 根据选择的付款方式 获取优惠列表
577
+ async getPrivilegeList () {
578
+ // 初始化下拉选择列表
579
+ this.privilegeList = [{label: '无优惠', value: '0'}]
580
+ // 初始为无优惠
581
+ this.data.f_privilege_id = '0'
582
+ if (this.data.f_payment && this.data.f_payment.length) {
583
+ // 查询条件
584
+ let payments = JSON.stringify(this.data.f_payment)
585
+ payments = payments.replace('[', '(').replace(']', ')').replace(/"/g, '\'')
586
+ let HttpReset = new HttpResetClass()
587
+ let privilege = await HttpReset.load('POST', 'api/af-revenue/sql/singleTable_OrderBy', {
588
+ data: {
589
+ items: 'id,f_privilege_name,f_privilege_type',
590
+ tablename: 't_privilege',
591
+ 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 = '有效'`,
592
+ orderitem: 'id'
593
+ }
594
+ }, {resolveMsg: null, rejectMsg: '查询优惠信息失败'})
595
+ // 查询结果放到下拉列表
596
+ for (let p of privilege.data) {
597
+ this.privilegeList.push({label: p.f_privilege_name, value: p.id, type: p.f_privilege_type})
598
+ }
599
+ this.privilegeCalculate()
600
+ }
601
+ },
602
+ eticket_toggle () {
603
+ this.eticket_show = false
604
+ this.$dispatch('success')
605
+ },
606
+ // 优惠计算
607
+ async privilegeCalculate () {
608
+ // 初始化减免金额
609
+ this.data.f_privilege_money = 0
610
+ this.data.f_after_discount = this.data.f_collection
611
+ // 判断是否是自定义优惠
612
+ if (parseInt(this.data.f_privilege_id)) {
613
+ for (let p of this.privilegeList) {
614
+ if (p.value == this.data.f_privilege_id && p.type == '自定义') {
615
+ this.data.f_privilege_money = window.prompt('请输入你想优惠的金额')
616
+ if (!(/^[1-9]\d*(\.\d+)?$/).test(this.data.f_privilege_money) || !(/^[1-9]\d*(\.\d+)?$/).test(this.data.f_privilege_money)) {
617
+ this.$showMessage('金额输入格式不正确!')
618
+ this.data.f_privilege_money = 0
619
+ return
620
+ }
621
+ if ((this.data.f_privilege_money - 0) >= this.data.f_collection) {
622
+ this.$showMessage('减免金额不能大于等于收款金额')
623
+ this.data.f_privilege_money = 0
624
+ return
625
+ }
626
+ }
627
+ }
628
+ }
629
+ // 优惠方式, 收款 缺一不计算
630
+ if (this.data.f_payment && this.data.f_payment.length && parseInt(this.data.f_privilege_id) && this.data.f_collection) {
631
+ let c = {
632
+ f_privilege_id: this.data.f_privilege_id,
633
+ f_collection: this.data.f_collection,
634
+ f_privilege_money: this.data.f_privilege_money
635
+ }
636
+ let privilegeData = await this.$resetpost('api/af-revenue/logic/calculatePrivilege', c, {resolveMsg: null, rejectMsg: '计算优惠金额出错'})
637
+ // 减免金额
638
+ this.data.f_privilege_money = privilegeData.data.f_privilege_money
639
+ // 减免后收款金额
640
+ this.data.f_after_discount = privilegeData.data.f_collection
641
+ }
642
+ },
643
+ async speckText (str) {
644
+ var url = 'http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=6&text=' + encodeURI(str)
645
+ await new Audio(url).play()
646
+ }
647
+ },
648
+ watch: {
649
+ 'data.f_overdue' (val) {
650
+ // this.data.f_last_overdue = this.newOverdue
651
+ this.newOverdue = val
652
+ },
653
+ 'splitAll' (val) {
654
+ this.data.f_pregas = this.data.f_pregas - val
655
+ },
656
+ 'invoice_show_gas' () {
657
+ return this.row.f_collection_type === '按气量' ? '是' : '否'
658
+ },
659
+ 'newOverdue' (val) {
660
+ this.data.f_totalcost = (this.data.f_preamount - 0) + (val - 0)
661
+ if (this.data.f_totalcost - this.data.f_balance > 0) {
662
+ if (this.floor) {
663
+ this.data.f_collection = Math.floor(this.data.f_totalcost - this.data.f_balance)
664
+ } else if (this.ceil) {
665
+ this.data.f_collection = Math.ceil(this.data.f_totalcost - this.data.f_balance)
666
+ } else {
667
+ this.data.f_collection = this.data.f_totalcost - this.data.f_balance
668
+ }
669
+ } else {
670
+ this.data.f_collection = 0
671
+ }
672
+ },
673
+ 'data.f_payment' (val) {
674
+ this.getPrivilegeList()
675
+ // 根据付款方式增加业务单号
676
+ let _payment = this.$appdata.getSingleValue('需要输入业务单号的付款方式') || ''
677
+ if (val == '免交' || _payment.includes(val)) {
678
+ this.mjshow = true
679
+ } else {
680
+ this.mjshow = false
681
+ }
682
+ },
683
+ async 'data.f_collection' (val) {
684
+ if ((this.data.f_totalcost - 0) > (val - 0)) {
685
+ if (this.authArr.includes('机表收费语音播报')) {
686
+ await this.speckText('请注意,当前收款小于欠费')
687
+ }
688
+ }
689
+ // 没获取优惠之前默认和收款一样,防止获取优惠太慢导致收款金额与实际收款不符
690
+ this.data.f_after_discount = this.data.f_collection
691
+ // 获取计算优惠
692
+ this.getPrivilegeList()
693
+ }
694
+ },
695
+ computed: {
696
+ authArr () {
697
+ return this.$login.r ? this.$login.r : []
698
+ },
699
+ curbalance () {
700
+ if (((this.data.f_collection - 0) + (this.data.f_balance - 0)) > (this.data.f_totalcost - 0)) {
701
+ return ((this.data.f_collection - 0) + (this.data.f_balance - 0) - (this.data.f_totalcost - 0)).toFixed(4)
702
+ } else if (this.floor) {
703
+ return ((this.data.f_collection - 0) + (this.data.f_balance - 0) - (this.data.f_totalcost - 0)).toFixed(4)
704
+ } else {
705
+ return 0
706
+ }
707
+ }
708
+ }
709
+ }
710
+ </script>