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