sale-client 3.6.47 → 3.6.48

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.
@@ -1,5 +1,5 @@
1
1
  var path = require('path')
2
- const [localUrl, serverRul] = ['http://121.36.60.63:8800/', 'http://121.36.60.63:8800/']
2
+ const [localUrl, serverRul] = ['http://121.36.106.17:8400/', 'http://121.36.106.17:8400/']
3
3
  var merge = require('webpack-merge')
4
4
  var baseConfig = require('./webpack.dev.conf')
5
5
  var devConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sale-client",
3
- "version": "3.6.47",
3
+ "version": "3.6.48",
4
4
  "description": "收费模块前台组件",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,487 +1,487 @@
1
- <template>
2
- <div class="flex-row">
3
- <div class="span" style="overflow-y: auto;">
4
- <validator name='v'>
5
- <form novalidate class="form-horizontal">
6
- <p class="bg-info text-center" style="padding: 8px;">换表{{showGas ? '补气' : '补费'}}</p>
7
-
8
- <div class="row">
9
- <div class="col-sm-4" v-if="showGas">
10
- <label for="f_pregas" class=" font_normal_body">剩余气量</label>
11
- <input class="input_search" style="width:60%" type="number"
12
- v-model="model.f_fill_gas"
13
- placeholder="剩余补气量" disabled>
14
- <!--<button type="button" class="btn button_new btn-lg" style="width:13%"-->
15
- <!--@click="openExplain">-->
16
- <!--<span class="glyphicon glyphicon-question-sign"></span>-->
17
- <!--</button>-->
18
- </div>
19
- <div class="col-sm-4" v-if="!showGas">
20
- <label for="f_pregas" class=" font_normal_body">应补金额</label>
21
- <input class="input_search" style="width:60%" type="number"
22
- :value="model.f_fill_money" disabled>
23
- <!--<button type="button" class="btn button_new btn-lg" style="width:13%"-->
24
- <!--@click="openExplain">-->
25
- <!--<span class="glyphicon glyphicon-question-sign"></span>-->
26
- <!--</button>-->
27
- </div>
28
- </div>
29
- <div v-show="remanentfalg">
30
- <strong style="font-size: large" >【补气提示】:{{remanentstr}}</strong><br/>
31
- </div>
32
- <div v-show="false">
33
- <div class="row" style="margin-top:5px;">
34
- <div class="col-sm-4">
35
- <label class=" font_normal_body" title="参数名称:付款方式">收款方式</label>
36
- <v-select v-model="f_payment"
37
- placeholder='请选择'
38
- style="width:60%"
39
- :value.sync="model.f_payment"
40
- :options='paytype'
41
- clear-button></v-select>
42
-
43
- </div>
44
- <div class="col-sm-4">
45
- <label for="f_print" class="font_normal_body">打印格式</label>
46
- <v-select id="print"
47
- v-model="f_print"
48
- placeholder='请选择'
49
- style="width:60%"
50
- :value.sync="model.f_print"
51
- :options='printstyle'
52
- close-on-select clear-button>
53
- </v-select>
54
-
55
- </div>
56
- <div class="col-sm-4" v-if="model.f_payment[0].includes('POS')">
57
- <label for="f_voucher_number" class="font_normal_body">凭证号</label>
58
- <input type="text" class="input_search" style="width:60%" v-model="model.f_voucher_number" placeholder="凭证号">
59
- </div>
60
- </div>
61
-
62
- <div class="row" style="margin-top:5px;">
63
-
64
- <div class="col-sm-4" v-if="(row.f_balance_gas - 0) < 0">
65
- <label for="f_balance_gas" class="font_normal_body">超用气量</label>
66
- <input type="text" class="input_search" style="width:60%" v-model="(0 - row.f_balance_gas)" disabled>
67
- </div>
68
-
69
- <div class="col-sm-4" v-if="(row.f_balance_amount - 0) < 0">
70
- <label for="f_balance_amount" class="font_normal_body">超用金额</label>
71
- <input type="text" class="input_search" style="width:60%" v-model="(0 - row.f_balance_amount)" disabled>
72
- </div>
73
-
74
- <div class="col-sm-4" v-if="showGas"
75
- :class="[$v.f_pregas.required || $v.f_pregas.dctest ? 'has-error' : 'has-success']">
76
- <label for="f_pregas" class="font_normal_body">预购气量</label>
77
- <input id="f_pregas" class="input_search" style="width:60%" type="number" v-model="model.f_pregas"
78
- @blur="pregas"
79
- v-validate:f_pregas='{required: true, dctest: [(0 - row.f_balance_gas) < 0 ? 0 : (0 - row.f_balance_gas), ">=" ]}'
80
- v-scale="[model.f_pregas, 4]">
81
- </div>
82
-
83
- <div class="col-sm-4" v-if="!showGas"
84
- :class="[$v.f_preamount.required || $v.f_preamount.dctest ? 'has-error' : 'has-success']">
85
- <label for="f_preamount" class="font_normal_body">预购金额</label>
86
- <input id="f_preamount" class="input_search" style="width:60%" type="number" v-model="model.f_preamount"
87
- @blur="remstrgas" v-validate:f_preamount='{required: true, dctest: [(0 - row.f_balance_amount) < 0 ? 0 : (0 - row.f_balance_amount) , ">" ]}'
88
- v-scale="[model.f_preamount, 4]" :disabled="showGas">
89
- </div>
90
-
91
- <div class="col-sm-4" v-if="showGas">
92
- <label for="f_preamount" class="font_normal_body">预购金额</label>
93
- <input class="input_search" style="width:60%" type="number" v-model="model.f_preamount"
94
- v-scale="[model.f_preamount, 4]" :disabled="showGas">
95
- </div>
96
- </div>
97
- <div class="row" style="margin-top:5px;">
98
- <div class="col-sm-12">
99
- <label for="f_curbalance" class="font_normal_body">&nbsp;&nbsp;&nbsp;备注&nbsp;&nbsp;&nbsp;</label>
100
- <input class="input_search" style="width:53.5%" v-model="model.f_comments">
101
- </div>
102
- </div>
103
- </div>
104
- <div v-if="paymentModel.length >1">
105
- <div class="row" style="margin-top:10px;" >
106
- <p class="col-sm-2 text-left" style="padding: 10px;"><img src="../../../../../static/juxing.png"/><strong style="margin-left: 4%">付款明细</strong></p>
107
- </div>
108
- <div class="row" style="margin-top:10px;" >
109
- <div class="col-sm-4 " v-for="pay in paymentModel" >
110
- <label class="font_normal_body">{{pay.f_payment}}</label>
111
- <input id="f_money" type="text" class="input_search" style="width:60%" v-model="pay.f_money">
112
- </div>
113
- <div class="col-sm-4 ">
114
- <strong v-if="!islegal" style="color: red">所输入的金额必须等于收款金额</strong>
115
- </div>
116
- </div>
117
- </div>
118
- </form>
119
- <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
120
- <print-bill :show="print" :bill-data='billData' v-ref:printbill :bill-config='config'
121
- @printok="printok" @toggle="printCancel" :data='row' ></print-bill>
122
- <div style="text-align:right;height: 25%;margin-top: 2%">
123
- <strong style="font-size: large" v-if="!config.notShowFormula && showGas">计算公式:{{calculatedetail ? calculatedetail : ' 暂无'}}</strong><br/>
124
- <payment-code-button :clickable="!$v.valid || validateOk || !islegal"
125
- :payment.sync="model.f_payment" :payment-data="paytype"
126
- @confirm-payment="confirm()">
127
- </payment-code-button>
128
- <button class="button_search btn-gn" @click="confirm()" :disabled='!$v.valid || validateOk || !islegal'>确认</button>
129
- <button class="button_clear btn-gn" @click="clean()">取消</button>
130
- </div>
131
- </validator>
132
- </div>
133
-
134
- <payment-code v-ref:paymentcode :payment="model.f_payment" :row="row" :money="model.f_collection"></payment-code>
135
- </div>
136
- </template>
137
- <script>
138
- /**
139
- *综合业务
140
- *物联网表收费组件
141
- */
142
- import XML from '../../../../plugins/ObjTree'
143
-
144
- let asyncIOTMeterCenter = async function (self) {
145
- await self.$getConfig(self, 'IotChangeFill')
146
- console.log('卡表收费config', self.config)
147
- // 默认打印格式
148
- self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
149
- self.model.f_payment = [self.config.payment]
150
-
151
- self.model.f_use_type = self.config.billType
152
- self.model.f_bill_type = self.model.f_print
153
- self.hasValidateBill = self.config.hasBillManage
154
- }
155
-
156
- let pregasGen = async function (self) {
157
- if ((self.model.f_fill_gas - 0) < (self.model.f_pregas - 0)) {
158
- let calGas = 0
159
- if (self.row.f_isdecimal === '是') {
160
- calGas = ((self.model.f_pregas - 0) - (self.model.f_fill_gas - 0)).toFixed(4)
161
- } else {
162
- calGas = ((self.model.f_pregas - 0) - (self.model.f_fill_gas - 0)).toFixed(0)
163
- }
164
- self.model.f_user_id = self.row.f_user_id
165
- self.model.f_userfiles_id = self.row.f_userfiles_id
166
- let getAmount = await self.$CommonService.gasCalculate(self.model, calGas)
167
- self.model.f_preamount = getAmount.data.chargenum
168
- Object.assign(self.model, self.model, getAmount.data)
169
- self.model.chargeprice = getAmount.data.chargeprice
170
- self.calText(getAmount.data.chargeprice)
171
- } else {
172
- self.model.f_preamount = 0
173
- }
174
- self.remstrgas()
175
- }
176
-
177
- let IOTChargeGen = async function (self) {
178
- try {
179
- if (self.paymentModel.length === 0) {
180
- self.paymentModel = [{
181
- f_payment: self.model.f_payment[0],
182
- f_money: self.model.f_preamount
183
- }]
184
- }
185
-
186
- self.model.payments = self.paymentModel
187
-
188
- let param = {
189
- f_share_times: self.row.f_share_times,
190
- f_hascard: self.row.f_hascard,
191
- f_open_way: self.row.f_open_type,
192
- f_user_name: self.row.f_user_name,
193
- f_user_type: self.row.f_user_type,
194
- f_meter_type: self.row.f_meter_type,
195
- f_gasproperties: self.row.f_gasproperties,
196
- f_userinfo_id: self.row.f_userinfo_id,
197
- f_address: self.row.f_address,
198
- f_meter_brand: self.row.f_meter_brand,
199
-
200
- f_old_total_gas: self.row.f_total_gas,
201
- f_old_total_fee: self.row.f_total_fee,
202
-
203
- f_fill_gas: self.model.f_fill_gas ? self.model.f_fill_gas : 0,
204
- f_fill_money: self.model.f_fill_money ? self.model.f_fill_money : 0,
205
-
206
- f_remanent_gas: self.row.f_remanent_gas,
207
- f_remanent_price: self.row.f_remanent_price,
208
- f_remanent_money: self.row.f_remanent_money,
209
- f_remanent_type: self.row.f_remanent_type,
210
-
211
- f_user_id: self.row.f_user_id,
212
- f_userfiles_id: self.row.f_userfiles_id,
213
- f_pregas: self.model.f_pregas - 0,
214
- f_balance: self.row.f_balance,
215
- f_balance_gas: self.row.f_balance_gas,
216
- f_balance_amount: self.row.f_balance_amount,
217
- f_preamount: self.model.f_preamount - 0,
218
- f_payment: self.model.f_payment.toString(),
219
- payments: self.model.payments,
220
- f_print: self.model.f_print.toString(),
221
- f_voucher_number: self.model.f_voucher_number,
222
- userinfo_version: self.row.userinfo_version,
223
- version: self.row.version,
224
- f_operator: self.$login.f.name,
225
- f_operatorid: self.$login.f.id,
226
- f_orgid: self.$login.f.orgid,
227
- f_orgname: self.$login.f.orgs,
228
- f_depid: self.$login.f.depids,
229
- f_depname: self.$login.f.deps,
230
- f_comments: self.model.f_comments,
231
- times: self.row.f_iot_times,
232
- bothGasFee: self.config.bothGasFee,
233
- // 额外判断
234
- f_collection_type: self.row.f_collection_type,
235
- f_calculation: self.row.f_calculation
236
- }
237
-
238
- if (self.row.f_remanent_type == 1) {
239
- // 换新表
240
- param.f_total_gas = (self.row.f_total_gas - 0) + (self.model.f_pregas - 0)
241
- param.f_total_fee = (self.row.f_total_fee - 0) + (self.model.f_preamount - 0)
242
- } else {
243
- // 清零换表 (不考虑,物联网不存在清零换表)
244
- if (self.model.f_fill_gas > 0 && !self.showGas) {
245
- param.f_total_fee = (self.row.f_total_fee - 0) + (self.model.f_preamount - 0) - (self.model.f_fill_money - 0)
246
- } else {
247
- param.f_total_gas = (self.row.f_total_gas - 0) + (self.model.f_pregas - self.model.f_fill_gas)
248
- param.f_total_fee = (self.row.f_total_fee - 0) + (self.model.f_preamount - 0)
249
- }
250
- }
251
- // 加入扫码盒付款码支付流水号
252
- param.f_serial_id = self.$refs.paymentcode.paymentCodeReturnData.f_out_trade_no
253
- let res = await self.$resetpost('rs/logic/sale_iotRemanentGas', {data: param}, {
254
- warnMsg: `确定对客户${self.row.f_user_name}进行物联网表缴费吗?`,
255
- resolveMsg: '物联网收费成功!!',
256
- rejectMsg: '物联网收费出错!!!'
257
- })
258
-
259
- // 开始打票
260
- console.log('开始打票', self.config)
261
- if (self.config.hasPrint) {
262
- console.log('self.config.printType', self.config.printType)
263
- if (self.config.printType != '电子发票') {
264
- console.log('self.config.hasBillManage', self.config.hasBillManage)
265
- if (self.config.hasBillManage) {
266
- // 启用发票管理,获取票据管理中的票号并存储记录
267
- self.row.id = res.data.fillgasid
268
- self.row.f_bill_type = '物联网收费'
269
- self.row.f_bill_style = self.model.f_print[0]
270
- self.print = true
271
- } else {
272
- self.row.id = res.data.fillgasid
273
- self.print = true
274
- }
275
- } else if (self.config.printType === '国税发票') {
276
- // TODO
277
- } else if (self.config.printType === '电子发票') {
278
- // TODO
279
- }
280
- } else {
281
- self.$dispatch('success')
282
- }
283
- } catch (error) {
284
- if (error.status === 301) {
285
- self.$dispatch('refresh')
286
- } else {
287
- if (error) {
288
- self.$showAlert(error, 'danger', 0)
289
- }
290
- }
291
-
292
- self.$dispatch('refresh')
293
- }
294
- }
295
-
296
- export default {
297
- title: '物联网表收费',
298
- data () {
299
- return {
300
- config: {
301
- notShowFormula: false, // 不显示计算公式,默认显示
302
- hasPrint: false, // 默认打票
303
- hasBillManage: false, // 默认不启用发票管理
304
- bothGasFee: false, // 默认 false 金额表加金额 气量表加气量
305
- billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
306
- printType: '普通收据', // 收据/电子票/专用发票/国税发票
307
- payment: '现金缴费'
308
- },
309
- model: {
310
- f_payment: ['现金缴费'],
311
- f_pregas: null,
312
- f_preamount: null,
313
- f_print: [],
314
- f_fill_gas: 0,
315
- f_fill_money: 0,
316
- f_comments: ''
317
- },
318
- showGas: false,
319
- calculatedetail: '',
320
-
321
- print: false,
322
- billData: {
323
- url: 'rs/report/iot_sell',
324
- bill: ''
325
- },
326
-
327
- // 启用发票管理需要对票号进行验证
328
- hasValidateBill: false,
329
- validateOk: false,
330
-
331
- paymentModel: [],
332
-
333
- // 补气提示控制
334
- remanentfalg: false,
335
- remanentstr: '',
336
-
337
- // 下拉框值
338
- paytype: this.$appdata.getParam('付款方式'),
339
- printstyle: this.$appdata.getParam('打印格式')
340
- }
341
- },
342
- props: ['row'],
343
- async ready () {
344
- this.showGas = (this.row.f_collection_type === '按气量')
345
- await asyncIOTMeterCenter(this)
346
- await this.calRemanentMoney()
347
- },
348
- watch: {
349
- 'model.f_payment.length' (val) {
350
- console.log('付款方式多选。。', val)
351
- if (val > 1 && !this.model.f_preamount) {
352
- this.model.f_payment = ['现金缴费']
353
- this.$showAlert('请先计算付款金额', 'warning', 2000)
354
- } else {
355
- this.paymentModel = []
356
-
357
- this.model.f_payment.forEach((res) => {
358
- let temp = {
359
- f_payment: res,
360
- f_money: 0
361
- }
362
- this.paymentModel.push(temp)
363
- })
364
- this.$resetValidation()
365
- }
366
- }
367
- },
368
- methods: {
369
- async confirm () {
370
- this.model.f_userinfo_id = this.row.f_userinfo_id
371
- this.model.f_userfiles_id = this.row.f_userfiles_id
372
- this.model.f_user_id = this.row.f_user_id
373
- this.model.userinfo_version = this.row.userinfo_version
374
- this.model.version = this.row.version
375
-
376
- this.model.f_operator = this.$login.f.name
377
- this.model.f_operatorid = this.$login.f.id
378
- this.model.f_orgid = this.$login.f.orgid
379
- this.model.f_orgname = this.$login.f.orgs
380
- this.model.f_depid = this.$login.f.depids
381
- this.model.f_depname = this.$login.f.deps
382
- // 先调用付款码支付组件流程
383
- let ss = await this.$refs.paymentcode.flowPath()
384
- this.$refs.paymentcode.paymentCodeShow = false
385
- console.log('付款码操作返回', ss)
386
- if (!ss.result) return
387
-
388
- IOTChargeGen(this)
389
- },
390
- clean () {
391
- this.$info('取消操作')
392
- this.$dispatch('refresh', this.row)
393
- },
394
- close () {
395
- this.print = false
396
- this.clean()
397
- },
398
- printok () {
399
- this.$dispatch('success')
400
- },
401
- validateBill (val) {
402
- this.validateOk = !val.isOk
403
- this.billData.bill = val.bill
404
- },
405
- printCancel () {
406
- this.$dispatch('refresh')
407
- },
408
- calRemanentMoney () {
409
- console.log('======', this.row)
410
- // 计算 应补金额
411
- let getResult = this.$CommonService.calRemanentMoney(this.row)
412
- if (this.showGas) {
413
- this.model.f_pregas = this.model.f_fill_gas = getResult
414
- this.model.f_preamount = this.config.bothGasFee ? (this.model.f_pregas * this.row.f_remanent_price).toFixed(this.row.f_isdecimal === '否' ? 0 : 4) : 0
415
- } else {
416
- this.model.f_preamount = this.model.f_fill_money = getResult
417
- this.model.f_pregas = this.config.bothGasFee ? ((this.model.f_preamount - 0) / (this.row.f_remanent_price - 0)).toFixed(this.row.f_isdecimal === '否' ? 0 : 4) : 0
418
- }
419
- },
420
- openExplain () {
421
-
422
- },
423
- pregas () {
424
- if (this.model.f_pregas && this.model.f_pregas > 0 && this.model.f_pregas - (0 - this.row.f_balance_gas) >= 0) {
425
- try {
426
- pregasGen(this)
427
- } catch (error) {
428
- this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
429
- this.$dispatch('error', '发卡售气', this.model, error)
430
- }
431
- } else {
432
- this.model.f_pregas = null
433
- }
434
- },
435
- remstrgas () {
436
- if (this.row.f_collection_type == '按气量') {
437
- if (this.model.f_fill_gas > this.model.f_pregas && this.model.f_pregas > 0) {
438
- this.remanentstr = '您已经成功抵扣' + this.model.f_pregas + '补气量!!,该气量不会产生任何费用'
439
- this.remanentfalg = true
440
- } else if (this.model.f_fill_gas < this.model.f_pregas) {
441
- this.remanentstr = '您已经成功抵扣' + this.model.f_fill_gas + '补气量!!!,该气量不会产生任何费用,并且超出购买' + (this.model.f_pregas - this.model.f_fill_gas) +
442
- '方气量,超出部分产生费用!'
443
- this.remanentfalg = true
444
- } else {
445
- this.remanentfalg = false
446
- this.remanentstr = ''
447
- }
448
- } else {
449
- let temp = (this.model.f_fill_money - 0)
450
-
451
- if (temp > (this.model.f_preamount - 0) && (this.model.f_preamount - 0) > 0) {
452
- this.remanentstr = '您已经成功抵扣' + this.model.f_preamount + '元!!!,本次不收取费用!!'
453
- this.remanentfalg = true
454
- } else if (temp < (this.model.f_preamount - 0)) {
455
- this.remanentstr = '您已经成功抵扣' + temp + '元!!!,本次将收取' + (this.model.f_preamount - temp) + '元!!!'
456
- this.remanentfalg = true
457
- } else {
458
- this.remanentfalg = false
459
- this.remanentstr = ''
460
- }
461
- }
462
- },
463
- calText (val) {
464
- let str = ''
465
- val.forEach((item) => {
466
- str = str + item.f_price + ' x ' + item.f_gas + '+'
467
- })
468
- str = str.slice(0, str.length - 1)
469
- this.calculatedetail = str
470
- }
471
- },
472
- computed: {
473
- 'islegal' () {
474
- if (this.paymentModel.length > 1 && this.model.f_preamount) {
475
- let sum = 0
476
- this.paymentModel.forEach((res) => {
477
- sum += (res.f_money - 0)
478
- })
479
-
480
- return (this.model.f_preamount - 0) === (sum - 0)
481
- } else {
482
- return true
483
- }
484
- }
485
- }
486
- }
487
- </script>
1
+ <template>
2
+ <div class="flex-row">
3
+ <div class="span" style="overflow-y: auto;">
4
+ <validator name='v'>
5
+ <form novalidate class="form-horizontal">
6
+ <p class="bg-info text-center" style="padding: 8px;">换表{{showGas ? '补气' : '补费'}}</p>
7
+
8
+ <div class="row">
9
+ <div class="col-sm-4" v-if="showGas">
10
+ <label for="f_pregas" class=" font_normal_body">剩余气量</label>
11
+ <input class="input_search" style="width:60%" type="number"
12
+ v-model="model.f_fill_gas"
13
+ placeholder="剩余补气量" disabled>
14
+ <!--<button type="button" class="btn button_new btn-lg" style="width:13%"-->
15
+ <!--@click="openExplain">-->
16
+ <!--<span class="glyphicon glyphicon-question-sign"></span>-->
17
+ <!--</button>-->
18
+ </div>
19
+ <div class="col-sm-4" v-if="!showGas">
20
+ <label for="f_pregas" class=" font_normal_body">应补金额</label>
21
+ <input class="input_search" style="width:60%" type="number"
22
+ :value="model.f_fill_money" disabled>
23
+ <!--<button type="button" class="btn button_new btn-lg" style="width:13%"-->
24
+ <!--@click="openExplain">-->
25
+ <!--<span class="glyphicon glyphicon-question-sign"></span>-->
26
+ <!--</button>-->
27
+ </div>
28
+ </div>
29
+ <div v-show="remanentfalg">
30
+ <strong style="font-size: large" >【补气提示】:{{remanentstr}}</strong><br/>
31
+ </div>
32
+ <div v-show="false">
33
+ <div class="row" style="margin-top:5px;">
34
+ <div class="col-sm-4">
35
+ <label class=" font_normal_body" title="参数名称:付款方式">收款方式</label>
36
+ <v-select v-model="f_payment"
37
+ placeholder='请选择'
38
+ style="width:60%"
39
+ :value.sync="model.f_payment"
40
+ :options='paytype'
41
+ clear-button></v-select>
42
+
43
+ </div>
44
+ <div class="col-sm-4">
45
+ <label for="f_print" class="font_normal_body">打印格式</label>
46
+ <v-select id="print"
47
+ v-model="f_print"
48
+ placeholder='请选择'
49
+ style="width:60%"
50
+ :value.sync="model.f_print"
51
+ :options='printstyle'
52
+ close-on-select clear-button>
53
+ </v-select>
54
+
55
+ </div>
56
+ <div class="col-sm-4" v-if="model.f_payment[0].includes('POS')">
57
+ <label for="f_voucher_number" class="font_normal_body">凭证号</label>
58
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_voucher_number" placeholder="凭证号">
59
+ </div>
60
+ </div>
61
+
62
+ <div class="row" style="margin-top:5px;">
63
+
64
+ <div class="col-sm-4" v-if="(row.f_balance_gas - 0) < 0">
65
+ <label for="f_balance_gas" class="font_normal_body">超用气量</label>
66
+ <input type="text" class="input_search" style="width:60%" v-model="(0 - row.f_balance_gas)" disabled>
67
+ </div>
68
+
69
+ <div class="col-sm-4" v-if="(row.f_balance_amount - 0) < 0">
70
+ <label for="f_balance_amount" class="font_normal_body">超用金额</label>
71
+ <input type="text" class="input_search" style="width:60%" v-model="(0 - row.f_balance_amount)" disabled>
72
+ </div>
73
+
74
+ <div class="col-sm-4" v-if="showGas"
75
+ :class="[$v.f_pregas.required || $v.f_pregas.dctest ? 'has-error' : 'has-success']">
76
+ <label for="f_pregas" class="font_normal_body">预购气量</label>
77
+ <input id="f_pregas" class="input_search" style="width:60%" type="number" v-model="model.f_pregas"
78
+ @blur="pregas"
79
+ v-validate:f_pregas='{required: true, dctest: [(0 - row.f_balance_gas) < 0 ? 0 : (0 - row.f_balance_gas), ">=" ]}'
80
+ v-scale="[model.f_pregas, 4]">
81
+ </div>
82
+
83
+ <div class="col-sm-4" v-if="!showGas"
84
+ :class="[$v.f_preamount.required || $v.f_preamount.dctest ? 'has-error' : 'has-success']">
85
+ <label for="f_preamount" class="font_normal_body">预购金额</label>
86
+ <input id="f_preamount" class="input_search" style="width:60%" type="number" v-model="model.f_preamount"
87
+ @blur="remstrgas" v-validate:f_preamount='{required: true, dctest: [(0 - row.f_balance_amount) < 0 ? 0 : (0 - row.f_balance_amount) , ">" ]}'
88
+ v-scale="[model.f_preamount, 4]" :disabled="showGas">
89
+ </div>
90
+
91
+ <div class="col-sm-4" v-if="showGas">
92
+ <label for="f_preamount" class="font_normal_body">预购金额</label>
93
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_preamount"
94
+ v-scale="[model.f_preamount, 4]" :disabled="showGas">
95
+ </div>
96
+ </div>
97
+ <div class="row" style="margin-top:5px;">
98
+ <div class="col-sm-12">
99
+ <label for="f_curbalance" class="font_normal_body">&nbsp;&nbsp;&nbsp;备注&nbsp;&nbsp;&nbsp;</label>
100
+ <input class="input_search" style="width:53.5%" v-model="model.f_comments">
101
+ </div>
102
+ </div>
103
+ </div>
104
+ <div v-if="paymentModel.length >1">
105
+ <div class="row" style="margin-top:10px;" >
106
+ <p class="col-sm-2 text-left" style="padding: 10px;"><img src="../../../../../static/juxing.png"/><strong style="margin-left: 4%">付款明细</strong></p>
107
+ </div>
108
+ <div class="row" style="margin-top:10px;" >
109
+ <div class="col-sm-4 " v-for="pay in paymentModel" >
110
+ <label class="font_normal_body">{{pay.f_payment}}</label>
111
+ <input id="f_money" type="text" class="input_search" style="width:60%" v-model="pay.f_money">
112
+ </div>
113
+ <div class="col-sm-4 ">
114
+ <strong v-if="!islegal" style="color: red">所输入的金额必须等于收款金额</strong>
115
+ </div>
116
+ </div>
117
+ </div>
118
+ </form>
119
+ <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
120
+ <print-bill :show="print" :bill-data='billData' v-ref:printbill :bill-config='config'
121
+ @printok="printok" @toggle="printCancel" :data='row' ></print-bill>
122
+ <div style="text-align:right;height: 25%;margin-top: 2%">
123
+ <strong style="font-size: large" v-if="!config.notShowFormula && showGas">计算公式:{{calculatedetail ? calculatedetail : ' 暂无'}}</strong><br/>
124
+ <payment-code-button :clickable="!$v.valid || validateOk || !islegal"
125
+ :payment.sync="model.f_payment" :payment-data="paytype"
126
+ @confirm-payment="confirm()">
127
+ </payment-code-button>
128
+ <button class="button_search btn-gn" @click="confirm()" :disabled='!$v.valid || validateOk || !islegal'>确认</button>
129
+ <button class="button_clear btn-gn" @click="clean()">取消</button>
130
+ </div>
131
+ </validator>
132
+ </div>
133
+
134
+ <payment-code v-ref:paymentcode :payment="model.f_payment" :row="row" :money="model.f_collection"></payment-code>
135
+ </div>
136
+ </template>
137
+ <script>
138
+ /**
139
+ *综合业务
140
+ *物联网表收费组件
141
+ */
142
+ import XML from '../../../../plugins/ObjTree'
143
+
144
+ let asyncIOTMeterCenter = async function (self) {
145
+ await self.$getConfig(self, 'IotChangeFill')
146
+ console.log('卡表收费config', self.config)
147
+ // 默认打印格式
148
+ self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
149
+ self.model.f_payment = [self.config.payment]
150
+
151
+ self.model.f_use_type = self.config.billType
152
+ self.model.f_bill_type = self.model.f_print
153
+ self.hasValidateBill = self.config.hasBillManage
154
+ }
155
+
156
+ let pregasGen = async function (self) {
157
+ if ((self.model.f_fill_gas - 0) < (self.model.f_pregas - 0)) {
158
+ let calGas = 0
159
+ if (self.row.f_isdecimal === '是') {
160
+ calGas = ((self.model.f_pregas - 0) - (self.model.f_fill_gas - 0)).toFixed(4)
161
+ } else {
162
+ calGas = ((self.model.f_pregas - 0) - (self.model.f_fill_gas - 0)).toFixed(0)
163
+ }
164
+ self.model.f_user_id = self.row.f_user_id
165
+ self.model.f_userfiles_id = self.row.f_userfiles_id
166
+ let getAmount = await self.$CommonService.gasCalculate(self.model, calGas)
167
+ self.model.f_preamount = getAmount.data.chargenum
168
+ Object.assign(self.model, self.model, getAmount.data)
169
+ self.model.chargeprice = getAmount.data.chargeprice
170
+ self.calText(getAmount.data.chargeprice)
171
+ } else {
172
+ self.model.f_preamount = 0
173
+ }
174
+ self.remstrgas()
175
+ }
176
+
177
+ let IOTChargeGen = async function (self) {
178
+ try {
179
+ if (self.paymentModel.length === 0) {
180
+ self.paymentModel = [{
181
+ f_payment: self.model.f_payment[0],
182
+ f_money: self.model.f_preamount
183
+ }]
184
+ }
185
+
186
+ self.model.payments = self.paymentModel
187
+
188
+ let param = {
189
+ f_share_times: self.row.f_share_times,
190
+ f_hascard: self.row.f_hascard,
191
+ f_open_way: self.row.f_open_type,
192
+ f_user_name: self.row.f_user_name,
193
+ f_user_type: self.row.f_user_type,
194
+ f_meter_type: self.row.f_meter_type,
195
+ f_gasproperties: self.row.f_gasproperties,
196
+ f_userinfo_id: self.row.f_userinfo_id,
197
+ f_address: self.row.f_address,
198
+ f_meter_brand: self.row.f_meter_brand,
199
+
200
+ f_old_total_gas: self.row.f_total_gas,
201
+ f_old_total_fee: self.row.f_total_fee,
202
+
203
+ f_fill_gas: self.model.f_fill_gas ? self.model.f_fill_gas : 0,
204
+ f_fill_money: self.model.f_fill_money ? self.model.f_fill_money : 0,
205
+
206
+ f_remanent_gas: self.row.f_remanent_gas,
207
+ f_remanent_price: self.row.f_remanent_price,
208
+ f_remanent_money: self.row.f_remanent_money,
209
+ f_remanent_type: self.row.f_remanent_type,
210
+
211
+ f_user_id: self.row.f_user_id,
212
+ f_userfiles_id: self.row.f_userfiles_id,
213
+ f_pregas: self.model.f_pregas - 0,
214
+ f_balance: self.row.f_balance,
215
+ f_balance_gas: self.row.f_balance_gas,
216
+ f_balance_amount: self.row.f_balance_amount,
217
+ f_preamount: self.model.f_preamount - 0,
218
+ f_payment: self.model.f_payment.toString(),
219
+ payments: self.model.payments,
220
+ f_print: self.model.f_print.toString(),
221
+ f_voucher_number: self.model.f_voucher_number,
222
+ userinfo_version: self.row.userinfo_version,
223
+ version: self.row.version,
224
+ f_operator: self.$login.f.name,
225
+ f_operatorid: self.$login.f.id,
226
+ f_orgid: self.$login.f.orgid,
227
+ f_orgname: self.$login.f.orgs,
228
+ f_depid: self.$login.f.depids,
229
+ f_depname: self.$login.f.deps,
230
+ f_comments: self.model.f_comments,
231
+ times: self.row.f_iot_times,
232
+ bothGasFee: self.config.bothGasFee,
233
+ // 额外判断
234
+ f_collection_type: self.row.f_collection_type,
235
+ f_calculation: self.row.f_calculation
236
+ }
237
+
238
+ if (self.row.f_remanent_type == 1) {
239
+ // 换新表
240
+ param.f_total_gas = (self.row.f_total_gas - 0) + (self.model.f_pregas - 0)
241
+ param.f_total_fee = (self.row.f_total_fee - 0) + (self.model.f_preamount - 0)
242
+ } else {
243
+ // 清零换表 (不考虑,物联网不存在清零换表)
244
+ if (self.model.f_fill_gas > 0 && !self.showGas) {
245
+ param.f_total_fee = (self.row.f_total_fee - 0) + (self.model.f_preamount - 0) - (self.model.f_fill_money - 0)
246
+ } else {
247
+ param.f_total_gas = (self.row.f_total_gas - 0) + (self.model.f_pregas - self.model.f_fill_gas)
248
+ param.f_total_fee = (self.row.f_total_fee - 0) + (self.model.f_preamount - 0) - (self.model.f_fill_money - 0)
249
+ }
250
+ }
251
+ // 加入扫码盒付款码支付流水号
252
+ param.f_serial_id = self.$refs.paymentcode.paymentCodeReturnData.f_out_trade_no
253
+ let res = await self.$resetpost('rs/logic/sale_iotRemanentGas', {data: param}, {
254
+ warnMsg: `确定对客户${self.row.f_user_name}进行物联网表缴费吗?`,
255
+ resolveMsg: '物联网收费成功!!',
256
+ rejectMsg: '物联网收费出错!!!'
257
+ })
258
+
259
+ // 开始打票
260
+ console.log('开始打票', self.config)
261
+ if (self.config.hasPrint) {
262
+ console.log('self.config.printType', self.config.printType)
263
+ if (self.config.printType != '电子发票') {
264
+ console.log('self.config.hasBillManage', self.config.hasBillManage)
265
+ if (self.config.hasBillManage) {
266
+ // 启用发票管理,获取票据管理中的票号并存储记录
267
+ self.row.id = res.data.fillgasid
268
+ self.row.f_bill_type = '物联网收费'
269
+ self.row.f_bill_style = self.model.f_print[0]
270
+ self.print = true
271
+ } else {
272
+ self.row.id = res.data.fillgasid
273
+ self.print = true
274
+ }
275
+ } else if (self.config.printType === '国税发票') {
276
+ // TODO
277
+ } else if (self.config.printType === '电子发票') {
278
+ // TODO
279
+ }
280
+ } else {
281
+ self.$dispatch('success')
282
+ }
283
+ } catch (error) {
284
+ if (error.status === 301) {
285
+ self.$dispatch('refresh')
286
+ } else {
287
+ if (error) {
288
+ self.$showAlert(error, 'danger', 0)
289
+ }
290
+ }
291
+
292
+ self.$dispatch('refresh')
293
+ }
294
+ }
295
+
296
+ export default {
297
+ title: '物联网表收费',
298
+ data () {
299
+ return {
300
+ config: {
301
+ notShowFormula: false, // 不显示计算公式,默认显示
302
+ hasPrint: false, // 默认打票
303
+ hasBillManage: false, // 默认不启用发票管理
304
+ bothGasFee: false, // 默认 false 金额表加金额 气量表加气量
305
+ billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
306
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
307
+ payment: '现金缴费'
308
+ },
309
+ model: {
310
+ f_payment: ['现金缴费'],
311
+ f_pregas: null,
312
+ f_preamount: null,
313
+ f_print: [],
314
+ f_fill_gas: 0,
315
+ f_fill_money: 0,
316
+ f_comments: ''
317
+ },
318
+ showGas: false,
319
+ calculatedetail: '',
320
+
321
+ print: false,
322
+ billData: {
323
+ url: 'rs/report/iot_sell',
324
+ bill: ''
325
+ },
326
+
327
+ // 启用发票管理需要对票号进行验证
328
+ hasValidateBill: false,
329
+ validateOk: false,
330
+
331
+ paymentModel: [],
332
+
333
+ // 补气提示控制
334
+ remanentfalg: false,
335
+ remanentstr: '',
336
+
337
+ // 下拉框值
338
+ paytype: this.$appdata.getParam('付款方式'),
339
+ printstyle: this.$appdata.getParam('打印格式')
340
+ }
341
+ },
342
+ props: ['row'],
343
+ async ready () {
344
+ this.showGas = (this.row.f_collection_type === '按气量')
345
+ await asyncIOTMeterCenter(this)
346
+ await this.calRemanentMoney()
347
+ },
348
+ watch: {
349
+ 'model.f_payment.length' (val) {
350
+ console.log('付款方式多选。。', val)
351
+ if (val > 1 && !this.model.f_preamount) {
352
+ this.model.f_payment = ['现金缴费']
353
+ this.$showAlert('请先计算付款金额', 'warning', 2000)
354
+ } else {
355
+ this.paymentModel = []
356
+
357
+ this.model.f_payment.forEach((res) => {
358
+ let temp = {
359
+ f_payment: res,
360
+ f_money: 0
361
+ }
362
+ this.paymentModel.push(temp)
363
+ })
364
+ this.$resetValidation()
365
+ }
366
+ }
367
+ },
368
+ methods: {
369
+ async confirm () {
370
+ this.model.f_userinfo_id = this.row.f_userinfo_id
371
+ this.model.f_userfiles_id = this.row.f_userfiles_id
372
+ this.model.f_user_id = this.row.f_user_id
373
+ this.model.userinfo_version = this.row.userinfo_version
374
+ this.model.version = this.row.version
375
+
376
+ this.model.f_operator = this.$login.f.name
377
+ this.model.f_operatorid = this.$login.f.id
378
+ this.model.f_orgid = this.$login.f.orgid
379
+ this.model.f_orgname = this.$login.f.orgs
380
+ this.model.f_depid = this.$login.f.depids
381
+ this.model.f_depname = this.$login.f.deps
382
+ // 先调用付款码支付组件流程
383
+ let ss = await this.$refs.paymentcode.flowPath()
384
+ this.$refs.paymentcode.paymentCodeShow = false
385
+ console.log('付款码操作返回', ss)
386
+ if (!ss.result) return
387
+
388
+ IOTChargeGen(this)
389
+ },
390
+ clean () {
391
+ this.$info('取消操作')
392
+ this.$dispatch('refresh', this.row)
393
+ },
394
+ close () {
395
+ this.print = false
396
+ this.clean()
397
+ },
398
+ printok () {
399
+ this.$dispatch('success')
400
+ },
401
+ validateBill (val) {
402
+ this.validateOk = !val.isOk
403
+ this.billData.bill = val.bill
404
+ },
405
+ printCancel () {
406
+ this.$dispatch('refresh')
407
+ },
408
+ calRemanentMoney () {
409
+ console.log('======', this.row)
410
+ // 计算 应补金额
411
+ let getResult = this.$CommonService.calRemanentMoney(this.row)
412
+ if (this.showGas) {
413
+ this.model.f_pregas = this.model.f_fill_gas = getResult
414
+ this.model.f_preamount = this.config.bothGasFee ? (this.model.f_pregas * this.row.f_remanent_price).toFixed(this.row.f_isdecimal === '否' ? 0 : 4) : 0
415
+ } else {
416
+ this.model.f_preamount = this.model.f_fill_money = getResult
417
+ this.model.f_pregas = this.config.bothGasFee ? ((this.model.f_preamount - 0) / (this.row.f_remanent_price - 0)).toFixed(this.row.f_isdecimal === '否' ? 0 : 4) : 0
418
+ }
419
+ },
420
+ openExplain () {
421
+
422
+ },
423
+ pregas () {
424
+ if (this.model.f_pregas && this.model.f_pregas > 0 && this.model.f_pregas - (0 - this.row.f_balance_gas) >= 0) {
425
+ try {
426
+ pregasGen(this)
427
+ } catch (error) {
428
+ this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
429
+ this.$dispatch('error', '发卡售气', this.model, error)
430
+ }
431
+ } else {
432
+ this.model.f_pregas = null
433
+ }
434
+ },
435
+ remstrgas () {
436
+ if (this.row.f_collection_type == '按气量') {
437
+ if (this.model.f_fill_gas > this.model.f_pregas && this.model.f_pregas > 0) {
438
+ this.remanentstr = '您已经成功抵扣' + this.model.f_pregas + '补气量!!,该气量不会产生任何费用'
439
+ this.remanentfalg = true
440
+ } else if (this.model.f_fill_gas < this.model.f_pregas) {
441
+ this.remanentstr = '您已经成功抵扣' + this.model.f_fill_gas + '补气量!!!,该气量不会产生任何费用,并且超出购买' + (this.model.f_pregas - this.model.f_fill_gas) +
442
+ '方气量,超出部分产生费用!'
443
+ this.remanentfalg = true
444
+ } else {
445
+ this.remanentfalg = false
446
+ this.remanentstr = ''
447
+ }
448
+ } else {
449
+ let temp = (this.model.f_fill_money - 0)
450
+
451
+ if (temp > (this.model.f_preamount - 0) && (this.model.f_preamount - 0) > 0) {
452
+ this.remanentstr = '您已经成功抵扣' + this.model.f_preamount + '元!!!,本次不收取费用!!'
453
+ this.remanentfalg = true
454
+ } else if (temp < (this.model.f_preamount - 0)) {
455
+ this.remanentstr = '您已经成功抵扣' + temp + '元!!!,本次将收取' + (this.model.f_preamount - temp) + '元!!!'
456
+ this.remanentfalg = true
457
+ } else {
458
+ this.remanentfalg = false
459
+ this.remanentstr = ''
460
+ }
461
+ }
462
+ },
463
+ calText (val) {
464
+ let str = ''
465
+ val.forEach((item) => {
466
+ str = str + item.f_price + ' x ' + item.f_gas + '+'
467
+ })
468
+ str = str.slice(0, str.length - 1)
469
+ this.calculatedetail = str
470
+ }
471
+ },
472
+ computed: {
473
+ 'islegal' () {
474
+ if (this.paymentModel.length > 1 && this.model.f_preamount) {
475
+ let sum = 0
476
+ this.paymentModel.forEach((res) => {
477
+ sum += (res.f_money - 0)
478
+ })
479
+
480
+ return (this.model.f_preamount - 0) === (sum - 0)
481
+ } else {
482
+ return true
483
+ }
484
+ }
485
+ }
486
+ }
487
+ </script>