sale-client 4.2.31 → 4.2.33

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