telephone-clients 4.0.0-1-60 → 4.0.0-1-62

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,798 +1,798 @@
1
- <template>
2
- <div style="height: auto;width: 100%;padding: 10px">
3
- <work-busy :is-busy="isBusy"></work-busy>
4
- <div partial>
5
- <div class="row app-row">
6
- <div class="col-xs-4">
7
- <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
8
- <label class="font text-left">预购气量:</label>
9
- </div><div class="col-xs-8">
10
- <input type="number" class ="input_search input_ys" placeholder="请输入预存气量..." readonly v-model="model.f_pregas"></div>
11
- </div>
12
- <div class="row app-row">
13
- <div class="col-xs-4">
14
- <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
15
- <label class="font text-left">预购金额:</label>
16
- </div><div class="col-xs-8">
17
- <input type="number" class ="input_search input_ys" placeholder="请输入预购金额..." readonly v-model="model.f_preamount"></div>
18
- </div>
19
- <div class="row app-row" v-if="hasLimit">
20
- <div class="col-xs-4">
21
- <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
22
- <label class="font text-left">购气上限:</label>
23
- </div><div class="col-xs-8">
24
- <input type="number" class ="input_search input_ys" placeholder="请输入购气上限..." readonly v-model="maxgas"></div>
25
- </div>
26
- <div class="row app-row">
27
- <div class="col-xs-4">
28
- <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
29
- <label class="font text-left" style="color: #a51212">本次缴费:</label>
30
- </div><div class="col-xs-8">
31
- <!--<input type="text" class ="input_search input_ys" placeholder="请输入缴费金额..."
32
- @blur="preamount()"
33
- v-model="model.f_totalcost"></div>-->
34
- <input type="number" class ="input_search input_ys" placeholder="请输入缴费金额..." readonly
35
- v-model="model.f_totalcost"></div>
36
- </div>
37
- <div class="row app-row">
38
- <div class="col-xs-4">
39
- <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
40
- <label class="font text-left">当前气价:</label>
41
- </div><div class="col-xs-8">
42
- <input type="number" class ="input_search input_ys" placeholder="" readonly
43
- v-model="model.gasPrice"></div>
44
- </div>
45
- <div class="row app-row">
46
- <div class="col-xs-4">
47
- <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
48
- <label class="font text-left">付款方式:</label>
49
- </div>
50
- <div class="col-xs-8">
51
- <!--<input type="text" class ="input_search input_ys" placeholder="请选择付款方式..." readonly v-model="model.f_payment"></div>-->
52
- <v-select
53
- :value.sync="model.f_payment"
54
- :options='Paytypes'
55
- placeholder='请选择付款方式...'
56
- close-on-select
57
- :search="false"
58
- value-single
59
- style="margin-bottom: 10px;"
60
- width="78%"
61
- v-model="model.f_payment"
62
- ></v-select>
63
- </div>
64
- </div>
65
- <div class="row app-row">
66
- <div class="col-xs-4">
67
- <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
68
- <label class="font text-left">打印格式:</label>
69
- </div>
70
- <div class="col-xs-8">
71
- <!--<input type="text" class ="input_search input_ys" placeholder="请输入打印格式..." readonly v-model="model.f_print"></div>-->
72
- <v-select
73
- :value.sync="model.f_print"
74
- :options='Printtypes'
75
- placeholder='请输入打印格式...'
76
- close-on-select
77
- value-single
78
- style="margin-bottom: 10px;"
79
- width="78%"
80
- v-model="model.f_print"
81
- ></v-select>
82
- </div>
83
- </div>
84
- <div class="row app-row" v-if="ladderPrice.f_stair1surplus">
85
- <table border="1px solid black" style="width: 100%; text-align: center">
86
- <tr style="background-color: #00b3ee;">
87
- <td colspan="4">气阶</td>
88
- <td colspan="4">剩余</td>
89
- <td colspan="4">单价</td>
90
- </tr>
91
- <tr>
92
- <td colspan="4">一阶</td>
93
- <td colspan="4">{{ parseFloat(ladderPrice.f_stair1surplus).toFixed(2) }}</td>
94
- <td colspan="4">{{ ladderPrice.f_stair1price }}</td>
95
- </tr>
96
- <tr>
97
- <td colspan="4">二阶</td>
98
- <td colspan="4">{{ parseFloat(ladderPrice.f_stair2surplus).toFixed(2) }}</td>
99
- <td colspan="4">{{ ladderPrice.f_stair2price }}</td>
100
- </tr>
101
- <tr>
102
- <td colspan="4">三阶</td>
103
- <td colspan="4">无上限</td>
104
- <td colspan="4">{{ ladderPrice.f_stair3price }}</td>
105
- </tr>
106
- </table>
107
- </div>
108
- <div class="row app-row" v-if="model.f_payment[0].includes('POS')">
109
- <div class="col-xs-4">
110
- <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
111
- <label class="font text-left">&nbsp;&nbsp;凭证号:</label>
112
- </div><div class="col-xs-8">
113
- <input type="text" class ="input_search input_ys" placeholder="请输入缴费金额..."
114
- v-model="model.f_voucher_number"></div>
115
- </div>
116
- <div class="row app-row" style="padding-top: 0.5em;">
117
- <div class="col-sm-12">
118
- <label class="font_normal_body">自定义{{matertype2}}</label>
119
- <input class="input_search input_ys" @input="numValid('CustomGas')" style="width:60%" v-model="CustomGas" rows="1" placeholder="请输入自定义{{matertype2}}">
120
- </div>
121
- </div>
122
- <div class="row" style="margin-top: 10px;">
123
- <label class="font_normal_body"><b>&nbsp;&nbsp;&nbsp;选择{{matertype2}}&nbsp;&nbsp;&nbsp;</b></label>
124
- </div>
125
- <div class="row" style="text-align: center">
126
- <button class="button_btn" @click="selectmoney(btnmoney)" v-for=" btnmoney in btnmoneys"> {{btnmoney}}{{matertype}}</button>
127
- </div>
128
- <div class="row app-row" style="padding-top: 0.5em;">
129
- <div class="col-sm-12">
130
- <label for="f_comments" class="font_normal_body">&nbsp;&nbsp;&nbsp;备注&nbsp;&nbsp;&nbsp;</label>
131
- <input class="input_search input_ys" style="width:60%" v-model="model.f_comments" rows="1" placeholder="备注">
132
- </div>
133
- </div>
134
- <div style="text-align:right; height: 20%;margin-top: 15px;">
135
- <!-- <strong v-show="!isMax" style="font-size: large" >计算公式:{{calculatedetail ? calculatedetail : ' 暂无'}}</strong><br/>-->
136
- <!-- <strong v-show="isMax" style="font-size: large;color: #d9534f" >已经达到购气上限</strong><br/>-->
137
-
138
- </div>
139
- <div class="row text-center" style="margin-top: 25px;">
140
- <button class="btn btn-lg btn-font btn-color" style="width: 28%;" type="button" @click="confirm()" :disabled="clickConfirm" >确认</button>
141
- <!--<button class="btn btn-lg btn-font btn-color" @click="clean()" style="font-size: 15px;">取消</button>-->
142
- </div>
143
- </div>
144
- <work-busy :is-busy="isworking"></work-busy>
145
- </div>
146
- </template>
147
- <script>
148
- /**
149
- *综合业务
150
- *收费组件
151
- */
152
-
153
- import {HttpResetClass} from 'vue-client'
154
- import Vue from 'vue'
155
- import * as Util from '../../components/Util'
156
-
157
-
158
- export default {
159
- title: '物联网表收费',
160
- data() {
161
- return {
162
- config: {
163
- isBusy:false,
164
- showupload:false, //默认不显示附件上传组件
165
- hasPrint : false, //默认打票
166
- hasBillManage : false, //默认不启用发票管理
167
- billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
168
- printType: '普通收据', // 收据/电子票/专用发票/国税发票
169
- payment: '手持pos现金缴费'
170
- },
171
- isMax:false,
172
- model: {
173
- f_userfiles_id: '', // 表编号 方式一: 针对微信查询
174
- f_userinfo_code: '', // 用户编号 卡表标识
175
- f_filialeids: '', // 用户分公司
176
- f_overdue: 0, // 机表滞纳金减免
177
- f_card_id: '', // 卡表缴费标识 卡号
178
- f_user_id: '', // 卡表缴费标识 用户id
179
- f_serial_id: '', // 流水号
180
- f_pregas: 0, // 预购气量 购气量
181
- f_preamount: 0, // 预购金额 购气金额
182
- f_totalcost: 0, // 本次缴费金额 应交气费
183
- f_collection: 0, // 收款
184
- // f_terminal_num: 'POS设备号', // 这个不能传 终端号/设备号
185
- f_payment: '手持pos现金缴费', // 付款方式
186
- CustomGas: '',// 自定义金额/气量
187
- f_bank_name :'',
188
- f_print: '普通收据', // 打印格式
189
- f_unit: 'yuan', // yuan/fen,如果不传按分处理
190
- f_operate_date: '', //操作时间
191
- f_operator: '', // 第三方渠道(微信,支付宝,等)
192
- writeCard_fee: '', // 写卡金额
193
- writeCard_gas: '', // 写卡气量
194
- gasPrice:0
195
- },
196
- btnmoneys: [50,100,200,300,500,'自定义'], // 默认气量或者金额
197
- // 下拉框值
198
- Paytypes: this.$appdata.getParam('付款方式'),
199
- // Paytypes: [{label: "现金缴费", value: "现金缴费"}, {label: "微信支付", value: "微信支付"}, {label: "银行支付", value: "银行支付"}, {label: "其他", value: "其他"}],
200
- Printtypes: [{label: "普通收据", value: "普通收据"}],
201
- calculatedetail: '', // 计算公式
202
-
203
- mulPrint: false,
204
- clickConfirm: false, // 控制确认按钮只能点击一次
205
- // 下拉框值
206
- printstyle: this.$appdata.getParam('打印格式'),
207
- privilegeList: [{label: '无优惠', value: '0'}],
208
- writeparams: {},
209
- matertype: '元',
210
- matertype2: '金额',
211
- isworking: false,
212
- timer:null,
213
- timer2:null,
214
- sellinggasId:'',
215
- isWrited: '未写卡',
216
- ladderPrice: {}
217
- }
218
- },
219
- props: ['row'],
220
- ready() {
221
- //tag
222
- this.Paytypes = this.$appdata.getParam('支付方式')
223
- //tag)
224
- //tag)
225
- this.matertype = this.row.f_meter_type.includes('卡表') ? '方' : '元'
226
- this.matertype2 = this.row.f_meter_type.includes('卡表') ? '气量' : '金额'
227
- this.model.f_userfiles_id = this.row.f_userfiles_id
228
- this.model.f_userinfo_code = this.row.f_userinfo_code
229
- this.model.f_user_id = this.row.f_user_id
230
- this.model.f_card_id = this.row.f_card_id
231
- this.model.f_total_gas = this.row.f_total_gas
232
-
233
- // this.model.f_operator= "手机测试"
234
- // this.model.f_operatorid= "42118"
235
- // this.model.f_orgid= "21142"
236
- // this.model.f_orgname= "测试公司(一)"
237
- // this.model.f_depid= "21160"
238
- // this.model.f_depname= "安检部"
239
-
240
- this.model.f_operator = Vue.user.name
241
- this.model.f_operatorid = Vue.user.id
242
- this.model.f_orgid = Vue.user.orgid
243
- this.model.f_orgname = Vue.user.orgs
244
- this.model.f_depid = Vue.user.depids
245
- this.model.f_depname = Vue.user.deps
246
- // this.getcardid()
247
- this.getGasPrice(this.model.f_userfiles_id)
248
-
249
- },
250
- watch: {
251
- 'model.f_preamount' () {
252
- //tag
253
- if (!this.row.f_meter_type.includes('卡表')) {
254
- this.countprice()
255
- }else {
256
- //tag
257
- }
258
-
259
- },
260
- 'model.f_pregas' () {
261
- //tag
262
- if (this.row.f_meter_type.includes('卡表')) {
263
- this.countprice()
264
- }else {
265
- //tag
266
- }
267
- },
268
- 'CustomGas' (val) {
269
- console.log('自定义发生改变' + JSON.stringify(val))
270
- if (val) {
271
- this.btnmoneys.splice(this.btnmoneys.length - 1, 1, val);
272
- }
273
- }
274
- },
275
- methods: {
276
- //利用函数传参达到复用
277
- numValid(val){
278
- //只能输入数字
279
- this[val] =this[val].replace(/[^0-9]/g,'')
280
- },
281
- selectmoney (money) {
282
- //tag
283
- //tag
284
- if (!this.row.f_meter_type.includes('卡表')) {
285
- this.model.f_preamount = money
286
- }else {
287
- this.model.f_pregas = money
288
- }
289
- },
290
- aa() {
291
- //tag
292
- this.isworking = false
293
- clearTimeout(this.timer);
294
- clearTimeout(this.timer2);
295
- },
296
- isLimit(gas,fee){
297
- if (this.hasLimit) {
298
- if (this.limitDetial.f_limit_type ==='气量'){
299
- if (gas > this.maxgas){
300
- this.$showAlert(`预购气量大于购气气量上限,上限为:${this.maxgas}`, 'warning', 5000)
301
- return false
302
- }
303
- }else {
304
- if (fee > this.maxgas){
305
- this.$showAlert(`预购气量大于购气金额上限,上限为:${this.maxgas}`, 'warning', 5000)
306
- return false
307
- }
308
- }
309
- return true
310
- }
311
- return true
312
- },
313
- // 化价
314
- async countprice () {
315
- //tag
316
- this.isBusy = true
317
- let parameter = {
318
- model: {
319
- f_userfiles_id: this.row.f_userfiles_id,
320
- f_card_id: this.row.f_card_id,
321
- f_meternumber: this.row.f_meternumber // 表编号
322
- },
323
- value: !this.row.f_meter_type.includes('卡表') ? this.model.f_preamount : this.model.f_pregas, // 传入气量或者金额
324
- isGasValue: !this.row.f_meter_type.includes('卡表') ? 1 : 0 // 0表示气量,1表示金额
325
- }
326
- try {
327
- //tag)
328
- let http = new HttpResetClass()
329
- // let gasParams = await http.load('POST',`/api/af-revenue/logic/commonCal`, {data: parameter}, {})
330
- let gasParams = await http.load('POST',`${this.$androidUtil.getProxyUrl()}/api/af-revenue/logic/commonCal`, {data: parameter}, {})
331
- //tag)
332
- if (gasParams.data) {
333
- // 本次缴费 = 预存金额
334
- this.model.f_totalcost = this.model.f_preamount = gasParams.data.chargenum
335
- // 预存气量
336
- this.model.f_pregas = gasParams.data.oughtamount
337
- }
338
- this.isBusy = false
339
- } catch (e) {
340
- //tag)
341
- this.isBusy = false
342
- this.$showMessage('获取化价信息错误!')
343
- }
344
-
345
- },
346
- myverify () {
347
- let flag = false
348
- if (!this.model.f_totalcost || this.model.f_totalcost < 0 ) {
349
- this.$showMessage('本次缴费金额异常')
350
- return flag
351
- }
352
- if (!this.model.f_pregas || this.model.f_pregas < 0 ) {
353
- this.$showMessage('预购气量异常')
354
- return flag
355
- }
356
- if (!this.model.f_preamount || this.model.f_preamount < 0 ) {
357
- this.$showMessage('预购金额异常')
358
- return flag
359
- }
360
- if (!this.model.f_payment) {
361
- this.$showMessage('请选择支付方式')
362
- return flag
363
- }
364
- flag = true
365
- return flag
366
- },
367
- async confirm() {
368
- this.clickConfirm = true
369
- //tag
370
- let fengongsi = this.$appdata.getSingleValue('分公司')
371
- if (!fengongsi) {
372
- this.$showMessage('分公司获取失败!')
373
- this.clickConfirm = false
374
- return
375
- }
376
- let posinfo2 = HostApp.read(fengongsi)
377
- // console.log('cccc')
378
- // let posinfo2={
379
- // code:200,
380
- // msg:{
381
- // Gas:1
382
- // }
383
- // }
384
- if(posinfo2.code == 200){
385
- //tag
386
- if(posinfo2.msg.Gas > 0){
387
- this.$showMessage('卡上有气,请告知客户接表后再来充值!')
388
- this.clickConfirm = false
389
- return
390
- }
391
- }else {
392
- this.$showMessage(posinfo2.msg)
393
- this.clickConfirm = false
394
- return
395
- }
396
- //tag
397
- this.$showMessage(`确定对客户${this.row.f_user_name}进行缴费吗?`, ['confirm', 'cancel']).then(async (res) => {
398
- if (res === 'confirm') {
399
- //tag
400
- // 校验
401
- if (this.myverify()) {
402
- this.clickConfirm = true
403
- //tag
404
- // 1.调用收款接口
405
- if (this.model.f_payment == '建行支付') {
406
- //tag
407
- // 去支付界面
408
- let _this = this
409
- let pardate = {
410
- _this:this,
411
- title:'二维码收款',
412
- safe:true
413
- }
414
- _this.$dispatch('gotoson',pardate)
415
- //tag
416
- let parameter = {
417
- money: this.model.f_totalcost
418
- }
419
- _this.$goto('create_qrcode', {row: parameter}, 'self',_this.payback)
420
-
421
- }else if (this.model.f_payment == '现金缴费' || this.model.f_payment == '手持pos现金缴费') {
422
- //tag
423
- //tag
424
- this.saveCharges()
425
-
426
- }else {
427
- //tag
428
- this.$showMessage('此功能正在维护中!')
429
- return
430
- }
431
- }
432
-
433
- }
434
- })
435
-
436
-
437
- },
438
- payback (msg) {
439
- if (msg) {
440
- //tag)
441
- this.model.f_serial_id = msg
442
- //tag
443
- this.saveCharges()
444
- }else {
445
- //tag
446
- this.$showMessage('支付失败!')
447
- }
448
- },
449
- async saveCharges() {
450
- //tag
451
- // 操作时间
452
- this.model.f_operate_date = Util.toStandardTimeString()
453
- // 收款等于本次缴费
454
- this.model.f_collection = this.model.f_totalcost
455
- //tag)
456
- let http1 = new HttpResetClass()
457
- let resp = ''
458
- if (this.row.f_meter_type.includes('物联网表')) {
459
- // resp = await http1.load('POST',`/af-telephone/rs/logic/iotPay`, {data: this.model},{
460
- resp = await http1.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/iotPay`, {data: this.model},{
461
- resolveMsg: null,
462
- rejectMsg: null
463
- })
464
- }else if (this.row.f_meter_type.includes('机表')) {
465
- // resp = await http1.load('POST',`/af-telephone/rs/logic/machinePay`, {data: this.model},{
466
- resp = await http1.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/machinePay`, {data: this.model},{
467
- resolveMsg: null,
468
- rejectMsg: null
469
- })
470
-
471
- }else if (this.row.f_meter_type.includes('卡表')) {
472
- // resp = await http1.load('POST',`/af-telephone/rs/logic/thirdPay`, {data: this.model},{
473
- resp = await http1.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/thirdPay`, {data: this.model},{
474
- resolveMsg: null,
475
- rejectMsg: null
476
- })
477
- this.sellinggasId = resp.data.id
478
- }
479
-
480
- //tag)
481
- /*{"data":{"id":"175860728"}}*/
482
- if (resp.data) {
483
- this.$showMessage('缴费成功!')
484
- if (this.row.f_meter_type.includes('卡表')) {
485
- this.$showMessage('是否现在现在进行写卡?', ['confirm', 'cancel']).then((res) => {
486
- if (res === 'confirm') {
487
- //tag
488
- this.writeCard()
489
- }
490
- })
491
- }else {
492
- // 打印收据
493
- this.$showMessage('是否打印收据?', ['confirm', 'cancel']).then((res) => {
494
- if (res === 'confirm') {
495
- //tag
496
- this.PrintReceipt()
497
- }else {
498
- //返回读卡页面
499
- this.$dispatch('confirm')
500
- this.$dispatch('confirm')
501
- }
502
- })
503
- }
504
- }else {
505
- this.$showMessage('保存收费记录失败!')
506
- //tag
507
- }
508
-
509
- },
510
- clean() {
511
- this.$info('取消操作')
512
- },
513
- PrintReceipt() {
514
- //tag
515
- // 清空打印内容
516
- let printContent = []
517
- // 抬头
518
- var comName = '荣成港华天然气'
519
- printContent.push({type: 3, text: comName, fontsize: 3, isbold: true, align: 'center'})
520
- printContent.push({type: 3, text: '自 助 购 气 凭 证', fontsize: 3, isbold: true, align: 'center'})
521
- printContent.push({type: 3, text: '----------------------------', fontsize: 3, isbold: true, align: 'center'})
522
- // 小票信息
523
- printContent.push({type: 3, text: '用户编号:' + this.model.f_userinfo_code, fontsize: 2, isbold: true, align: 'left'})
524
- // 卡表用户显示卡号
525
- if (this.row.f_meter_type !== '机表' && this.row.f_meter_type !== '物联网表') {
526
- printContent.push({type: 3, text: '用户卡号:' + this.model.f_card_id, fontsize: 2, isbold: true, align: 'left'})
527
- }
528
- printContent.push({type: 3, text: '用户姓名:' + this.row.f_user_name, fontsize: 2, isbold: true, align: 'left'})
529
- printContent.push({type: 3, text: '用户地址:' + this.row.f_address, fontsize: 2, isbold: true, align: 'left'})
530
- // 机表物联网表显示购买金额
531
- // if (this.row.f_meter_type.includes('卡表')) {
532
- printContent.push({type: 3, text: '购 气 量:' + this.model.f_pregas + '方', fontsize: 2, isbold: true, align: 'left'})
533
- // }
534
- printContent.push({type: 3, text: '本次缴费:' + this.model.f_collection + '元', fontsize: 2, isbold: true, align: 'left'})
535
- printContent.push({type: 3, text: '大 写:' + Vue.PosUtil.convertCurrency(this.model.f_collection), fontsize: 2, isbold: true, align: 'left'})
536
- printContent.push({type: 3, text: '购气日期:' + Vue.PosUtil.getNowDate('yyyy-MM-dd'), fontsize: 2, isbold: true, align: 'left'})
537
- printContent.push({type: 3, text: '支付流水号:' + this.model.f_serial_id, fontsize: 2, isbold: true, align: 'left'})
538
- if (this.row.f_meter_type !== '机表' && this.row.f_meter_type !== '物联网表') {
539
- printContent.push({type: 3, text: '写卡结果:' + this.isWrited, fontsize: 2, isbold: true, align: 'left'})
540
- }
541
- printContent.push({type: 3, text: '----------------------------', fontsize: 3, isbold: true, align: 'center'})
542
- printContent.push({type: 3, text: '', fontsize: 3, isbold: true, align: 'center'})
543
- // 走纸
544
- printContent.push({type: 4, value: 5, unit: 'pixel'})
545
- // 打印
546
- let print = HostApp.print(JSON.stringify(printContent))
547
- if (print.code === 200) {
548
- this.$showMessage('打印成功!是否返回上一层?', ['confirm', 'cancel']).then((res) => {
549
- if (res === 'confirm') {
550
- //tag
551
- this.$dispatch('confirm')
552
- this.$dispatch('confirm')
553
- }
554
- })
555
-
556
- }else {
557
- this.$showMessage('打印失败!请检查POS纸张、电量等,确认无误点击确认再次打印', ['confirm', 'cancel']).then((res) => {
558
- if (res === 'confirm') {
559
- //tag
560
- let print2 = HostApp.print(JSON.stringify(printContent))
561
- if (print2.code === 200) {
562
- this.$showMessage('打印成功!').then((res) => {
563
- //tag
564
- this.$dispatch('confirm')
565
- this.$dispatch('confirm')
566
- })
567
- }else {
568
- this.$showMessage('打印失败!').then((res) => {
569
- //tag
570
- this.$dispatch('confirm')
571
- this.$dispatch('confirm')
572
- })
573
- }
574
- }else {
575
- this.$dispatch('confirm')
576
- this.$dispatch('confirm')
577
- }
578
- })
579
- }
580
- },
581
- async getcardid () {
582
- //tag
583
- let http = new HttpResetClass()
584
- let row = await http.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/getCardNumber`, {data: {id: this.row.brand_id}}, {
585
- // this.$resetpost(`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/getCardNumber`, {data: {id: this.row.brand_id}}, {
586
- resolveMsg: '获取卡号成功!!',
587
- rejectMsg: '获取卡号出错!!!'
588
- })
589
- //tag)
590
- let cardId = row.data.cardNumber + ''
591
- this.row.f_card_id = this.model.cardNumber = cardId.substring(0, cardId.length - 8) + this.row.f_userinfo_code
592
- //tag)
593
- //tag)
594
- },
595
- async writeCard() {
596
- //tag
597
- let params = {
598
- AREA:this.$appdata.getSingleValue('分公司'), // 分公司
599
- ulen: 0, // 判断版本
600
- factory: this.row.f_alias,
601
- kmm: '0', // 2019-12-22 查旭说的。给一个0 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
602
- kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
603
- kh: this.row.f_card_id, // 卡号
604
- yhh: this.row.f_meterid ? this.row.f_meterid : 0, // 用户号,档案中自己输
605
- ql: this.model.writeCard_gas ? this.model.writeCard_gas : this.model.f_pregas, // 预购气量
606
- csql: '0', // 上次购气量,新开户为0
607
- ccsql: '0', // 上上次购气量,新开户为0
608
- cs: this.row.Times ? this.row.Times + 1 : '1', // 求购气次数,先开户为1
609
- ljgql: this.model.f_total_gas, // 当前累计购气量
610
- bkcs: '0', // 新开户卡,为0
611
- ljyql: '0', // 累积用气量,有些表要累加原来用气量,新开户卡,为0
612
- bjql: this.row.f_police_gas, // 报警气量,t_gasbrand表中
613
- czsx: this.row.f_topup_ceil, // 充值上线,t_gasbrand表中
614
- tzed: this.row.f_overdr_lines, // 透支额度,t_gasbrand表中
615
- cssqrq: '0', // 上次售气日期,格式为YYYYMMDD
616
- meterid: this.row.f_meternumber, // 表号
617
- money: this.model.writeCard_fee ? this.model.writeCard_fee : this.model.f_preamount, // 购气金额
618
- dqdm: this.row.f_area_code, // 精益工业地区代码
619
- klx: this.row.f_coding
620
- }
621
- console.log("777"+JSON.stringify(params))
622
- // 获取写卡参数
623
- let data = {
624
- f_card_id: this.row.f_card_id + '',
625
- f_alias: this.row.f_alias,
626
- f_user_id: this.row.f_user_id,
627
- f_userfiles_id: this.row.f_userfiles_id
628
- }
629
- console.log("888"+JSON.stringify(data))
630
- //tag)
631
- let http = new HttpResetClass()
632
- let cardParams = await http.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/stairCard`, {data: data}, {resolveMsg: null, rejectMsg: '获取写卡参数失败'})
633
- //tag)
634
- console.log("999"+JSON.stringify(cardParams))
635
- // 拼接参数
636
- params = await Object.assign({}, await this.writeCardParams(cardParams), params)
637
- console.log("101"+JSON.stringify(params))
638
- //tag)
639
- this.writeparams = params
640
- this.isworking = true
641
- // 写卡定时器
642
- this.timer = setTimeout(this.aa,"5000")
643
- this.timer2 = setTimeout(this.writecard2,"2000")
644
- },
645
- async writecard2() {
646
- let params = this.writeparams
647
- //tag)
648
- let writres = await HostApp.sell(JSON.stringify(params))
649
- //tag)
650
- this.isworking = false
651
- let msg = '写卡失败'
652
- if(writres.code =='200') {
653
- this.isWrited = '已写卡'
654
- // 写卡成功,修改状态 已写卡 调用打票
655
- await this.updatewritecard('已写卡')
656
- this.$showMessage('写卡成功!是否打印小票?', ['confirm', 'cancel']).then((res) => {
657
- if (res === 'confirm') {
658
- //tag
659
- this.PrintReceipt()
660
- }
661
- })
662
- }else {
663
- this.isWrited = '未写卡'
664
- await this.updatewritecard('未写卡')
665
- this.$showMessage('写卡失败!是否打印小票?', ['confirm', 'cancel']).then((res) => {
666
- if (res === 'confirm') {
667
- //tag
668
- this.PrintReceipt()
669
- }
670
- })
671
- }
672
- },
673
- updatewritecard(msg) {
674
- //tag)
675
- let http11 = new HttpResetClass()
676
- let sqldata = `update t_sellinggas set f_write_card = '${msg}' where id = '${this.sellinggasId}'`
677
- //tag)
678
- http11.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/runSQL`, {data:{sql:sqldata}}, {resolveMsg: null, rejectMsg: null})
679
-
680
- },
681
- writeCardParams (cardParams) {
682
- //tag)
683
- let result = {
684
- csql: cardParams.data.sc,
685
- lastmoney: cardParams.data.scje,
686
- ccsql: cardParams.data.ssc,
687
- lastlastmoney: cardParams.data.sscje,
688
- ljgql: cardParams.data.f_pregas,
689
- ljyql: cardParams.data.f_pregasall,
690
- yhh: cardParams.data.f_meterid,
691
- sxrq: cardParams.data.f_perform_date,
692
- totalmoney: cardParams.data.f_collection,
693
- stairversion: cardParams.data.f_stairversion,
694
- pricedate: cardParams.data.pricedate,
695
- pricetype: cardParams.data.pricetype
696
- }
697
-
698
- // 对阶梯进行处理
699
- if (cardParams.data.stairprice.includes(';') && cardParams.data.stairamount.includes(';')) {
700
- let gases = cardParams.data.stairamount.split(';')
701
- let prices = cardParams.data.stairprice.split(';')
702
- if (gases.length >= 2) {
703
- result.stairgas1 = gases[0] !== '' ? gases[0] : 0
704
- result.stairgas2 = gases[1] !== '' ? gases[1] : 0
705
- result.stairgas3 = '99999999'
706
- }
707
- if (prices.length >= 2) {
708
- result.stairprice1 = prices[0] !== '' ? prices[0] : 0
709
- result.stairprice2 = prices[1] !== '' ? prices[1] : 0
710
- result.stairprice3 = prices[2] !== '' ? prices[2] : 0
711
- }
712
- } else {
713
- // 从固定气价的表换金额表的时候,气量随便写,金额用之前的固定单价
714
- result.stairgas1 = '77777777'
715
- result.stairgas2 = '88888888'
716
- result.stairgas3 = '99999999'
717
-
718
- result.stairprice1 = cardParams.data.stairprice
719
- result.stairprice2 = cardParams.data.stairprice
720
- result.stairprice3 = cardParams.data.stairprice
721
- }
722
-
723
- return result
724
- },
725
- async getGasPrice(f_userfiles_id) {
726
- //tag)
727
- let http = new HttpResetClass()
728
- let data = {
729
- model: {f_userfiles_id: f_userfiles_id},
730
- value: 0,
731
- isGasValue: 0
732
- }
733
- //tag)
734
- let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/api/af-revenue/logic/commonCal`, {data: data}, {
735
- resolveMsg: null,
736
- rejectMsg: null
737
- })
738
- if (res.data.chargeprice[0].f_price_name !== '固定气价'){
739
- if (res.data.hasOwnProperty('f_stair1surplus') && res.data.f_stair1surplus > 0) {
740
- this.model.gasPrice = res.data.f_stair1price
741
- } else if (res.data.hasOwnProperty('f_stair2surplus') && res.data.f_stair2surplus > 0) {
742
- this.model.gasPrice = res.data.f_stair2price
743
- } else if ((res.data.hasOwnProperty('f_stair3surplus') && res.data.f_stair3surplus > 0) || (!res.data.hasOwnProperty('f_stair3surplus'))) {
744
- this.model.gasPrice = res.data.f_stair3price
745
- } else if (res.data.hasOwnProperty('f_stair4price')) {
746
- this.model.gasPrice = res.data.f_stair4price
747
- }
748
- this.ladderPrice = res.data
749
- } else {
750
- this.model.gasPrice = res.data.chargeprice[0].f_price
751
- }
752
-
753
- }
754
- },
755
- computed: {
756
-
757
- }
758
- }
759
- </script>
760
-
761
- <style scoped>
762
- .app-row {
763
- background-color: white;
764
- padding: 10px 10px 0 10px;
765
- border-bottom: 1px solid rgba(235, 235, 235, 0.7);
766
- }
767
- .input_ys {
768
- /*border: 1px solid #93B2D3 !important;*/
769
- border: none !important;
770
- width: 220px;
771
- height: 35px;
772
- text-align: center;
773
- }
774
- .button_btn {
775
- width: 27%;
776
- height: 45px;
777
- background-color: #4b93da;
778
- border-radius: 6px;
779
- border: none;
780
- font-family: PingFang;
781
- font-size: 18px;
782
- color: #ffffff;
783
- margin: 3% 2%;
784
- }
785
- .font_normal_body {
786
- font-size: 16px !important;
787
- line-height: 10px;
788
- }
789
- .btn-color{
790
- background-color: #FFFFFF;
791
- border-radius: 10px ;
792
- border: 1px solid #499EDF;
793
- }
794
- .btn-font{
795
- font:600 16px PingFang-SC-Bold;
796
- color: #499EDF;
797
- }
798
- </style>
1
+ <template>
2
+ <div style="height: auto;width: 100%;padding: 10px">
3
+ <work-busy :is-busy="isBusy"></work-busy>
4
+ <div partial>
5
+ <div class="row app-row">
6
+ <div class="col-xs-4">
7
+ <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
8
+ <label class="font text-left">预购气量:</label>
9
+ </div><div class="col-xs-8">
10
+ <input type="number" class ="input_search input_ys" placeholder="请输入预存气量..." readonly v-model="model.f_pregas"></div>
11
+ </div>
12
+ <div class="row app-row">
13
+ <div class="col-xs-4">
14
+ <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
15
+ <label class="font text-left">预购金额:</label>
16
+ </div><div class="col-xs-8">
17
+ <input type="number" class ="input_search input_ys" placeholder="请输入预购金额..." readonly v-model="model.f_preamount"></div>
18
+ </div>
19
+ <div class="row app-row" v-if="hasLimit">
20
+ <div class="col-xs-4">
21
+ <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
22
+ <label class="font text-left">购气上限:</label>
23
+ </div><div class="col-xs-8">
24
+ <input type="number" class ="input_search input_ys" placeholder="请输入购气上限..." readonly v-model="maxgas"></div>
25
+ </div>
26
+ <div class="row app-row">
27
+ <div class="col-xs-4">
28
+ <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
29
+ <label class="font text-left" style="color: #a51212">本次缴费:</label>
30
+ </div><div class="col-xs-8">
31
+ <!--<input type="text" class ="input_search input_ys" placeholder="请输入缴费金额..."
32
+ @blur="preamount()"
33
+ v-model="model.f_totalcost"></div>-->
34
+ <input type="number" class ="input_search input_ys" placeholder="请输入缴费金额..." readonly
35
+ v-model="model.f_totalcost"></div>
36
+ </div>
37
+ <div class="row app-row">
38
+ <div class="col-xs-4">
39
+ <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
40
+ <label class="font text-left">当前气价:</label>
41
+ </div><div class="col-xs-8">
42
+ <input type="number" class ="input_search input_ys" placeholder="" readonly
43
+ v-model="model.gasPrice"></div>
44
+ </div>
45
+ <div class="row app-row">
46
+ <div class="col-xs-4">
47
+ <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
48
+ <label class="font text-left">付款方式:</label>
49
+ </div>
50
+ <div class="col-xs-8">
51
+ <!--<input type="text" class ="input_search input_ys" placeholder="请选择付款方式..." readonly v-model="model.f_payment"></div>-->
52
+ <v-select
53
+ :value.sync="model.f_payment"
54
+ :options='Paytypes'
55
+ placeholder='请选择付款方式...'
56
+ close-on-select
57
+ :search="false"
58
+ value-single
59
+ style="margin-bottom: 10px;"
60
+ width="78%"
61
+ v-model="model.f_payment"
62
+ ></v-select>
63
+ </div>
64
+ </div>
65
+ <div class="row app-row">
66
+ <div class="col-xs-4">
67
+ <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
68
+ <label class="font text-left">打印格式:</label>
69
+ </div>
70
+ <div class="col-xs-8">
71
+ <!--<input type="text" class ="input_search input_ys" placeholder="请输入打印格式..." readonly v-model="model.f_print"></div>-->
72
+ <v-select
73
+ :value.sync="model.f_print"
74
+ :options='Printtypes'
75
+ placeholder='请输入打印格式...'
76
+ close-on-select
77
+ value-single
78
+ style="margin-bottom: 10px;"
79
+ width="78%"
80
+ v-model="model.f_print"
81
+ ></v-select>
82
+ </div>
83
+ </div>
84
+ <div class="row app-row" v-if="ladderPrice.f_stair1surplus">
85
+ <table border="1px solid black" style="width: 100%; text-align: center">
86
+ <tr style="background-color: #00b3ee;">
87
+ <td colspan="4">气阶</td>
88
+ <td colspan="4">剩余</td>
89
+ <td colspan="4">单价</td>
90
+ </tr>
91
+ <tr>
92
+ <td colspan="4">一阶</td>
93
+ <td colspan="4">{{ parseFloat(ladderPrice.f_stair1surplus).toFixed(2) }}</td>
94
+ <td colspan="4">{{ ladderPrice.f_stair1price }}</td>
95
+ </tr>
96
+ <tr>
97
+ <td colspan="4">二阶</td>
98
+ <td colspan="4">{{ parseFloat(ladderPrice.f_stair2surplus).toFixed(2) }}</td>
99
+ <td colspan="4">{{ ladderPrice.f_stair2price }}</td>
100
+ </tr>
101
+ <tr>
102
+ <td colspan="4">三阶</td>
103
+ <td colspan="4">无上限</td>
104
+ <td colspan="4">{{ ladderPrice.f_stair3price }}</td>
105
+ </tr>
106
+ </table>
107
+ </div>
108
+ <div class="row app-row" v-if="model.f_payment[0].includes('POS')">
109
+ <div class="col-xs-4">
110
+ <img src="../../assets/购气缴费.png" style="width: 20px;margin-bottom: 5px" alt="">
111
+ <label class="font text-left">&nbsp;&nbsp;凭证号:</label>
112
+ </div><div class="col-xs-8">
113
+ <input type="text" class ="input_search input_ys" placeholder="请输入缴费金额..."
114
+ v-model="model.f_voucher_number"></div>
115
+ </div>
116
+ <div class="row app-row" style="padding-top: 0.5em;">
117
+ <div class="col-sm-12">
118
+ <label class="font_normal_body">自定义{{matertype2}}</label>
119
+ <input class="input_search input_ys" @input="numValid('CustomGas')" style="width:60%" v-model="CustomGas" rows="1" placeholder="请输入自定义{{matertype2}}">
120
+ </div>
121
+ </div>
122
+ <div class="row" style="margin-top: 10px;">
123
+ <label class="font_normal_body"><b>&nbsp;&nbsp;&nbsp;选择{{matertype2}}&nbsp;&nbsp;&nbsp;</b></label>
124
+ </div>
125
+ <div class="row" style="text-align: center">
126
+ <button class="button_btn" @click="selectmoney(btnmoney)" v-for=" btnmoney in btnmoneys"> {{btnmoney}}{{matertype}}</button>
127
+ </div>
128
+ <div class="row app-row" style="padding-top: 0.5em;">
129
+ <div class="col-sm-12">
130
+ <label for="f_comments" class="font_normal_body">&nbsp;&nbsp;&nbsp;备注&nbsp;&nbsp;&nbsp;</label>
131
+ <input class="input_search input_ys" style="width:60%" v-model="model.f_comments" rows="1" placeholder="备注">
132
+ </div>
133
+ </div>
134
+ <div style="text-align:right; height: 20%;margin-top: 15px;">
135
+ <!-- <strong v-show="!isMax" style="font-size: large" >计算公式:{{calculatedetail ? calculatedetail : ' 暂无'}}</strong><br/>-->
136
+ <!-- <strong v-show="isMax" style="font-size: large;color: #d9534f" >已经达到购气上限</strong><br/>-->
137
+
138
+ </div>
139
+ <div class="row text-center" style="margin-top: 25px;">
140
+ <button class="btn btn-lg btn-font btn-color" style="width: 28%;" type="button" @click="confirm()" :disabled="clickConfirm" >确认</button>
141
+ <!--<button class="btn btn-lg btn-font btn-color" @click="clean()" style="font-size: 15px;">取消</button>-->
142
+ </div>
143
+ </div>
144
+ <work-busy :is-busy="isworking"></work-busy>
145
+ </div>
146
+ </template>
147
+ <script>
148
+ /**
149
+ *综合业务
150
+ *收费组件
151
+ */
152
+
153
+ import {HttpResetClass} from 'vue-client'
154
+ import Vue from 'vue'
155
+ import * as Util from '../../components/Util'
156
+
157
+
158
+ export default {
159
+ title: '物联网表收费',
160
+ data() {
161
+ return {
162
+ config: {
163
+ isBusy:false,
164
+ showupload:false, //默认不显示附件上传组件
165
+ hasPrint : false, //默认打票
166
+ hasBillManage : false, //默认不启用发票管理
167
+ billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
168
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
169
+ payment: '手持pos现金缴费'
170
+ },
171
+ isMax:false,
172
+ model: {
173
+ f_userfiles_id: '', // 表编号 方式一: 针对微信查询
174
+ f_userinfo_code: '', // 用户编号 卡表标识
175
+ f_filialeids: '', // 用户分公司
176
+ f_overdue: 0, // 机表滞纳金减免
177
+ f_card_id: '', // 卡表缴费标识 卡号
178
+ f_user_id: '', // 卡表缴费标识 用户id
179
+ f_serial_id: '', // 流水号
180
+ f_pregas: 0, // 预购气量 购气量
181
+ f_preamount: 0, // 预购金额 购气金额
182
+ f_totalcost: 0, // 本次缴费金额 应交气费
183
+ f_collection: 0, // 收款
184
+ // f_terminal_num: 'POS设备号', // 这个不能传 终端号/设备号
185
+ f_payment: '手持pos现金缴费', // 付款方式
186
+ CustomGas: '',// 自定义金额/气量
187
+ f_bank_name :'',
188
+ f_print: '普通收据', // 打印格式
189
+ f_unit: 'yuan', // yuan/fen,如果不传按分处理
190
+ f_operate_date: '', //操作时间
191
+ f_operator: '', // 第三方渠道(微信,支付宝,等)
192
+ writeCard_fee: '', // 写卡金额
193
+ writeCard_gas: '', // 写卡气量
194
+ gasPrice:0
195
+ },
196
+ btnmoneys: [50,100,200,300,500,'自定义'], // 默认气量或者金额
197
+ // 下拉框值
198
+ Paytypes: this.$appdata.getParam('付款方式'),
199
+ // Paytypes: [{label: "现金缴费", value: "现金缴费"}, {label: "微信支付", value: "微信支付"}, {label: "银行支付", value: "银行支付"}, {label: "其他", value: "其他"}],
200
+ Printtypes: [{label: "普通收据", value: "普通收据"}],
201
+ calculatedetail: '', // 计算公式
202
+
203
+ mulPrint: false,
204
+ clickConfirm: false, // 控制确认按钮只能点击一次
205
+ // 下拉框值
206
+ printstyle: this.$appdata.getParam('打印格式'),
207
+ privilegeList: [{label: '无优惠', value: '0'}],
208
+ writeparams: {},
209
+ matertype: '元',
210
+ matertype2: '金额',
211
+ isworking: false,
212
+ timer:null,
213
+ timer2:null,
214
+ sellinggasId:'',
215
+ isWrited: '未写卡',
216
+ ladderPrice: {}
217
+ }
218
+ },
219
+ props: ['row'],
220
+ ready() {
221
+ //tag
222
+ this.Paytypes = this.$appdata.getParam('支付方式')
223
+ //tag)
224
+ //tag)
225
+ this.matertype = this.row.f_meter_type.includes('卡表') ? '方' : '元'
226
+ this.matertype2 = this.row.f_meter_type.includes('卡表') ? '气量' : '金额'
227
+ this.model.f_userfiles_id = this.row.f_userfiles_id
228
+ this.model.f_userinfo_code = this.row.f_userinfo_code
229
+ this.model.f_user_id = this.row.f_user_id
230
+ this.model.f_card_id = this.row.f_card_id
231
+ this.model.f_total_gas = this.row.f_total_gas
232
+
233
+ // this.model.f_operator= "手机测试"
234
+ // this.model.f_operatorid= "42118"
235
+ // this.model.f_orgid= "21142"
236
+ // this.model.f_orgname= "测试公司(一)"
237
+ // this.model.f_depid= "21160"
238
+ // this.model.f_depname= "安检部"
239
+
240
+ this.model.f_operator = Vue.user.name
241
+ this.model.f_operatorid = Vue.user.id
242
+ this.model.f_orgid = Vue.user.orgid
243
+ this.model.f_orgname = Vue.user.orgs
244
+ this.model.f_depid = Vue.user.depids
245
+ this.model.f_depname = Vue.user.deps
246
+ // this.getcardid()
247
+ this.getGasPrice(this.model.f_userfiles_id)
248
+
249
+ },
250
+ watch: {
251
+ 'model.f_preamount' () {
252
+ //tag
253
+ if (!this.row.f_meter_type.includes('卡表')) {
254
+ this.countprice()
255
+ }else {
256
+ //tag
257
+ }
258
+
259
+ },
260
+ 'model.f_pregas' () {
261
+ //tag
262
+ if (this.row.f_meter_type.includes('卡表')) {
263
+ this.countprice()
264
+ }else {
265
+ //tag
266
+ }
267
+ },
268
+ 'CustomGas' (val) {
269
+ console.log('自定义发生改变' + JSON.stringify(val))
270
+ if (val) {
271
+ this.btnmoneys.splice(this.btnmoneys.length - 1, 1, val);
272
+ }
273
+ }
274
+ },
275
+ methods: {
276
+ //利用函数传参达到复用
277
+ numValid(val){
278
+ //只能输入数字
279
+ this[val] =this[val].replace(/[^0-9]/g,'')
280
+ },
281
+ selectmoney (money) {
282
+ //tag
283
+ //tag
284
+ if (!this.row.f_meter_type.includes('卡表')) {
285
+ this.model.f_preamount = money
286
+ }else {
287
+ this.model.f_pregas = money
288
+ }
289
+ },
290
+ aa() {
291
+ //tag
292
+ this.isworking = false
293
+ clearTimeout(this.timer);
294
+ clearTimeout(this.timer2);
295
+ },
296
+ isLimit(gas,fee){
297
+ if (this.hasLimit) {
298
+ if (this.limitDetial.f_limit_type ==='气量'){
299
+ if (gas > this.maxgas){
300
+ this.$showAlert(`预购气量大于购气气量上限,上限为:${this.maxgas}`, 'warning', 5000)
301
+ return false
302
+ }
303
+ }else {
304
+ if (fee > this.maxgas){
305
+ this.$showAlert(`预购气量大于购气金额上限,上限为:${this.maxgas}`, 'warning', 5000)
306
+ return false
307
+ }
308
+ }
309
+ return true
310
+ }
311
+ return true
312
+ },
313
+ // 化价
314
+ async countprice () {
315
+ //tag
316
+ this.isBusy = true
317
+ let parameter = {
318
+ model: {
319
+ f_userfiles_id: this.row.f_userfiles_id,
320
+ f_card_id: this.row.f_card_id,
321
+ f_meternumber: this.row.f_meternumber // 表编号
322
+ },
323
+ value: !this.row.f_meter_type.includes('卡表') ? this.model.f_preamount : this.model.f_pregas, // 传入气量或者金额
324
+ isGasValue: !this.row.f_meter_type.includes('卡表') ? 1 : 0 // 0表示气量,1表示金额
325
+ }
326
+ try {
327
+ //tag)
328
+ let http = new HttpResetClass()
329
+ // let gasParams = await http.load('POST',`/api/af-revenue/logic/commonCal`, {data: parameter}, {})
330
+ let gasParams = await http.load('POST',`${this.$androidUtil.getProxyUrl()}/api/af-revenue/logic/commonCal`, {data: parameter}, {})
331
+ //tag)
332
+ if (gasParams.data) {
333
+ // 本次缴费 = 预存金额
334
+ this.model.f_totalcost = this.model.f_preamount = gasParams.data.chargenum
335
+ // 预存气量
336
+ this.model.f_pregas = gasParams.data.oughtamount
337
+ }
338
+ this.isBusy = false
339
+ } catch (e) {
340
+ //tag)
341
+ this.isBusy = false
342
+ this.$showMessage('获取化价信息错误!')
343
+ }
344
+
345
+ },
346
+ myverify () {
347
+ let flag = false
348
+ if (!this.model.f_totalcost || this.model.f_totalcost < 0 ) {
349
+ this.$showMessage('本次缴费金额异常')
350
+ return flag
351
+ }
352
+ if (!this.model.f_pregas || this.model.f_pregas < 0 ) {
353
+ this.$showMessage('预购气量异常')
354
+ return flag
355
+ }
356
+ if (!this.model.f_preamount || this.model.f_preamount < 0 ) {
357
+ this.$showMessage('预购金额异常')
358
+ return flag
359
+ }
360
+ if (!this.model.f_payment) {
361
+ this.$showMessage('请选择支付方式')
362
+ return flag
363
+ }
364
+ flag = true
365
+ return flag
366
+ },
367
+ async confirm() {
368
+ this.clickConfirm = true
369
+ //tag
370
+ let fengongsi = this.$appdata.getSingleValue('分公司')
371
+ if (!fengongsi) {
372
+ this.$showMessage('分公司获取失败!')
373
+ this.clickConfirm = false
374
+ return
375
+ }
376
+ let posinfo2 = HostApp.read(fengongsi)
377
+ // console.log('cccc')
378
+ // let posinfo2={
379
+ // code:200,
380
+ // msg:{
381
+ // Gas:1
382
+ // }
383
+ // }
384
+ if(posinfo2.code == 200){
385
+ //tag
386
+ if(posinfo2.msg.Gas > 0){
387
+ this.$showMessage('卡上有气,请告知客户接表后再来充值!')
388
+ this.clickConfirm = false
389
+ return
390
+ }
391
+ }else {
392
+ this.$showMessage(posinfo2.msg)
393
+ this.clickConfirm = false
394
+ return
395
+ }
396
+ //tag
397
+ this.$showMessage(`确定对客户${this.row.f_user_name}进行缴费吗?`, ['confirm', 'cancel']).then(async (res) => {
398
+ if (res === 'confirm') {
399
+ //tag
400
+ // 校验
401
+ if (this.myverify()) {
402
+ this.clickConfirm = true
403
+ //tag
404
+ // 1.调用收款接口
405
+ if (this.model.f_payment == '建行支付') {
406
+ //tag
407
+ // 去支付界面
408
+ let _this = this
409
+ let pardate = {
410
+ _this:this,
411
+ title:'二维码收款',
412
+ safe:true
413
+ }
414
+ _this.$dispatch('gotoson',pardate)
415
+ //tag
416
+ let parameter = {
417
+ money: this.model.f_totalcost
418
+ }
419
+ _this.$goto('create_qrcode', {row: parameter}, 'self',_this.payback)
420
+
421
+ }else if (this.model.f_payment == '现金缴费' || this.model.f_payment == '手持pos现金缴费') {
422
+ //tag
423
+ //tag
424
+ this.saveCharges()
425
+
426
+ }else {
427
+ //tag
428
+ this.$showMessage('此功能正在维护中!')
429
+ return
430
+ }
431
+ }
432
+
433
+ }
434
+ })
435
+
436
+
437
+ },
438
+ payback (msg) {
439
+ if (msg) {
440
+ //tag)
441
+ this.model.f_serial_id = msg
442
+ //tag
443
+ this.saveCharges()
444
+ }else {
445
+ //tag
446
+ this.$showMessage('支付失败!')
447
+ }
448
+ },
449
+ async saveCharges() {
450
+ //tag
451
+ // 操作时间
452
+ this.model.f_operate_date = Util.toStandardTimeString()
453
+ // 收款等于本次缴费
454
+ this.model.f_collection = this.model.f_totalcost
455
+ //tag)
456
+ let http1 = new HttpResetClass()
457
+ let resp = ''
458
+ if (this.row.f_meter_type.includes('物联网表')) {
459
+ // resp = await http1.load('POST',`/af-telephone/rs/logic/iotPay`, {data: this.model},{
460
+ resp = await http1.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/iotPay`, {data: this.model},{
461
+ resolveMsg: null,
462
+ rejectMsg: null
463
+ })
464
+ }else if (this.row.f_meter_type.includes('机表')) {
465
+ // resp = await http1.load('POST',`/af-telephone/rs/logic/machinePay`, {data: this.model},{
466
+ resp = await http1.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/machinePay`, {data: this.model},{
467
+ resolveMsg: null,
468
+ rejectMsg: null
469
+ })
470
+
471
+ }else if (this.row.f_meter_type.includes('卡表')) {
472
+ // resp = await http1.load('POST',`/af-telephone/rs/logic/thirdPay`, {data: this.model},{
473
+ resp = await http1.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/thirdPay`, {data: this.model},{
474
+ resolveMsg: null,
475
+ rejectMsg: null
476
+ })
477
+ this.sellinggasId = resp.data.id
478
+ }
479
+
480
+ //tag)
481
+ /*{"data":{"id":"175860728"}}*/
482
+ if (resp.data) {
483
+ this.$showMessage('缴费成功!')
484
+ if (this.row.f_meter_type.includes('卡表')) {
485
+ this.$showMessage('是否现在现在进行写卡?', ['confirm', 'cancel']).then((res) => {
486
+ if (res === 'confirm') {
487
+ //tag
488
+ this.writeCard()
489
+ }
490
+ })
491
+ }else {
492
+ // 打印收据
493
+ this.$showMessage('是否打印收据?', ['confirm', 'cancel']).then((res) => {
494
+ if (res === 'confirm') {
495
+ //tag
496
+ this.PrintReceipt()
497
+ }else {
498
+ //返回读卡页面
499
+ this.$dispatch('confirm')
500
+ this.$dispatch('confirm')
501
+ }
502
+ })
503
+ }
504
+ }else {
505
+ this.$showMessage('保存收费记录失败!')
506
+ //tag
507
+ }
508
+
509
+ },
510
+ clean() {
511
+ this.$info('取消操作')
512
+ },
513
+ PrintReceipt() {
514
+ //tag
515
+ // 清空打印内容
516
+ let printContent = []
517
+ // 抬头
518
+ var comName = '荣成港华天然气'
519
+ printContent.push({type: 3, text: comName, fontsize: 3, isbold: true, align: 'center'})
520
+ printContent.push({type: 3, text: '自 助 购 气 凭 证', fontsize: 3, isbold: true, align: 'center'})
521
+ printContent.push({type: 3, text: '----------------------------', fontsize: 3, isbold: true, align: 'center'})
522
+ // 小票信息
523
+ printContent.push({type: 3, text: '用户编号:' + this.model.f_userinfo_code, fontsize: 2, isbold: true, align: 'left'})
524
+ // 卡表用户显示卡号
525
+ if (this.row.f_meter_type !== '机表' && this.row.f_meter_type !== '物联网表') {
526
+ printContent.push({type: 3, text: '用户卡号:' + this.model.f_card_id, fontsize: 2, isbold: true, align: 'left'})
527
+ }
528
+ printContent.push({type: 3, text: '用户姓名:' + this.row.f_user_name, fontsize: 2, isbold: true, align: 'left'})
529
+ printContent.push({type: 3, text: '用户地址:' + this.row.f_address, fontsize: 2, isbold: true, align: 'left'})
530
+ // 机表物联网表显示购买金额
531
+ // if (this.row.f_meter_type.includes('卡表')) {
532
+ printContent.push({type: 3, text: '购 气 量:' + this.model.f_pregas + '方', fontsize: 2, isbold: true, align: 'left'})
533
+ // }
534
+ printContent.push({type: 3, text: '本次缴费:' + this.model.f_collection + '元', fontsize: 2, isbold: true, align: 'left'})
535
+ printContent.push({type: 3, text: '大 写:' + Vue.PosUtil.convertCurrency(this.model.f_collection), fontsize: 2, isbold: true, align: 'left'})
536
+ printContent.push({type: 3, text: '购气日期:' + Vue.PosUtil.getNowDate('yyyy-MM-dd'), fontsize: 2, isbold: true, align: 'left'})
537
+ printContent.push({type: 3, text: '支付流水号:' + this.model.f_serial_id, fontsize: 2, isbold: true, align: 'left'})
538
+ if (this.row.f_meter_type !== '机表' && this.row.f_meter_type !== '物联网表') {
539
+ printContent.push({type: 3, text: '写卡结果:' + this.isWrited, fontsize: 2, isbold: true, align: 'left'})
540
+ }
541
+ printContent.push({type: 3, text: '----------------------------', fontsize: 3, isbold: true, align: 'center'})
542
+ printContent.push({type: 3, text: '', fontsize: 3, isbold: true, align: 'center'})
543
+ // 走纸
544
+ printContent.push({type: 4, value: 5, unit: 'pixel'})
545
+ // 打印
546
+ let print = HostApp.print(JSON.stringify(printContent))
547
+ if (print.code === 200) {
548
+ this.$showMessage('打印成功!是否返回上一层?', ['confirm', 'cancel']).then((res) => {
549
+ if (res === 'confirm') {
550
+ //tag
551
+ this.$dispatch('confirm')
552
+ this.$dispatch('confirm')
553
+ }
554
+ })
555
+
556
+ }else {
557
+ this.$showMessage('打印失败!请检查POS纸张、电量等,确认无误点击确认再次打印', ['confirm', 'cancel']).then((res) => {
558
+ if (res === 'confirm') {
559
+ //tag
560
+ let print2 = HostApp.print(JSON.stringify(printContent))
561
+ if (print2.code === 200) {
562
+ this.$showMessage('打印成功!').then((res) => {
563
+ //tag
564
+ this.$dispatch('confirm')
565
+ this.$dispatch('confirm')
566
+ })
567
+ }else {
568
+ this.$showMessage('打印失败!').then((res) => {
569
+ //tag
570
+ this.$dispatch('confirm')
571
+ this.$dispatch('confirm')
572
+ })
573
+ }
574
+ }else {
575
+ this.$dispatch('confirm')
576
+ this.$dispatch('confirm')
577
+ }
578
+ })
579
+ }
580
+ },
581
+ async getcardid () {
582
+ //tag
583
+ let http = new HttpResetClass()
584
+ let row = await http.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/getCardNumber`, {data: {id: this.row.brand_id}}, {
585
+ // this.$resetpost(`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/getCardNumber`, {data: {id: this.row.brand_id}}, {
586
+ resolveMsg: '获取卡号成功!!',
587
+ rejectMsg: '获取卡号出错!!!'
588
+ })
589
+ //tag)
590
+ let cardId = row.data.cardNumber + ''
591
+ this.row.f_card_id = this.model.cardNumber = cardId.substring(0, cardId.length - 8) + this.row.f_userinfo_code
592
+ //tag)
593
+ //tag)
594
+ },
595
+ async writeCard() {
596
+ //tag
597
+ let params = {
598
+ AREA:this.$appdata.getSingleValue('分公司'), // 分公司
599
+ ulen: 0, // 判断版本
600
+ factory: this.row.f_alias,
601
+ kmm: '0', // 2019-12-22 查旭说的。给一个0 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
602
+ kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
603
+ kh: this.row.f_card_id, // 卡号
604
+ yhh: this.row.f_meterid ? this.row.f_meterid : 0, // 用户号,档案中自己输
605
+ ql: this.model.writeCard_gas ? this.model.writeCard_gas : this.model.f_pregas, // 预购气量
606
+ csql: '0', // 上次购气量,新开户为0
607
+ ccsql: '0', // 上上次购气量,新开户为0
608
+ cs: this.row.Times ? this.row.Times + 1 : '1', // 求购气次数,先开户为1
609
+ ljgql: this.model.f_total_gas, // 当前累计购气量
610
+ bkcs: '0', // 新开户卡,为0
611
+ ljyql: '0', // 累积用气量,有些表要累加原来用气量,新开户卡,为0
612
+ bjql: this.row.f_police_gas, // 报警气量,t_gasbrand表中
613
+ czsx: this.row.f_topup_ceil, // 充值上线,t_gasbrand表中
614
+ tzed: this.row.f_overdr_lines, // 透支额度,t_gasbrand表中
615
+ cssqrq: '0', // 上次售气日期,格式为YYYYMMDD
616
+ meterid: this.row.f_meternumber, // 表号
617
+ money: this.model.writeCard_fee ? this.model.writeCard_fee : this.model.f_preamount, // 购气金额
618
+ dqdm: this.row.f_area_code, // 精益工业地区代码
619
+ klx: this.row.f_coding
620
+ }
621
+ console.log("777"+JSON.stringify(params))
622
+ // 获取写卡参数
623
+ let data = {
624
+ f_card_id: this.row.f_card_id + '',
625
+ f_alias: this.row.f_alias,
626
+ f_user_id: this.row.f_user_id,
627
+ f_userfiles_id: this.row.f_userfiles_id
628
+ }
629
+ console.log("888"+JSON.stringify(data))
630
+ //tag)
631
+ let http = new HttpResetClass()
632
+ let cardParams = await http.load('POST',`${this.$androidUtil.getProxyUrl()}/api/af-revenue/logic/stairCard`, {data: data}, {resolveMsg: null, rejectMsg: '获取写卡参数失败'})
633
+ //tag)
634
+ console.log("999"+JSON.stringify(cardParams))
635
+ // 拼接参数
636
+ params = await Object.assign({}, await this.writeCardParams(cardParams), params)
637
+ console.log("101"+JSON.stringify(params))
638
+ //tag)
639
+ this.writeparams = params
640
+ this.isworking = true
641
+ // 写卡定时器
642
+ this.timer = setTimeout(this.aa,"5000")
643
+ this.timer2 = setTimeout(this.writecard2,"2000")
644
+ },
645
+ async writecard2() {
646
+ let params = this.writeparams
647
+ //tag)
648
+ let writres = await HostApp.sell(JSON.stringify(params))
649
+ //tag)
650
+ this.isworking = false
651
+ let msg = '写卡失败'
652
+ if(writres.code =='200') {
653
+ this.isWrited = '已写卡'
654
+ // 写卡成功,修改状态 已写卡 调用打票
655
+ await this.updatewritecard('已写卡')
656
+ this.$showMessage('写卡成功!是否打印小票?', ['confirm', 'cancel']).then((res) => {
657
+ if (res === 'confirm') {
658
+ //tag
659
+ this.PrintReceipt()
660
+ }
661
+ })
662
+ }else {
663
+ this.isWrited = '未写卡'
664
+ await this.updatewritecard('未写卡')
665
+ this.$showMessage('写卡失败!是否打印小票?', ['confirm', 'cancel']).then((res) => {
666
+ if (res === 'confirm') {
667
+ //tag
668
+ this.PrintReceipt()
669
+ }
670
+ })
671
+ }
672
+ },
673
+ updatewritecard(msg) {
674
+ //tag)
675
+ let http11 = new HttpResetClass()
676
+ let sqldata = `update t_sellinggas set f_write_card = '${msg}' where id = '${this.sellinggasId}'`
677
+ //tag)
678
+ http11.load('POST',`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/logic/runSQL`, {data:{sql:sqldata}}, {resolveMsg: null, rejectMsg: null})
679
+
680
+ },
681
+ writeCardParams (cardParams) {
682
+ //tag)
683
+ let result = {
684
+ csql: cardParams.data.sc,
685
+ lastmoney: cardParams.data.scje,
686
+ ccsql: cardParams.data.ssc,
687
+ lastlastmoney: cardParams.data.sscje,
688
+ ljgql: cardParams.data.f_pregas,
689
+ ljyql: cardParams.data.f_pregasall,
690
+ yhh: cardParams.data.f_meterid,
691
+ sxrq: cardParams.data.f_perform_date,
692
+ totalmoney: cardParams.data.f_collection,
693
+ stairversion: cardParams.data.f_stairversion,
694
+ pricedate: cardParams.data.pricedate,
695
+ pricetype: cardParams.data.pricetype
696
+ }
697
+
698
+ // 对阶梯进行处理
699
+ if (cardParams.data.stairprice.includes(';') && cardParams.data.stairamount.includes(';')) {
700
+ let gases = cardParams.data.stairamount.split(';')
701
+ let prices = cardParams.data.stairprice.split(';')
702
+ if (gases.length >= 2) {
703
+ result.stairgas1 = gases[0] !== '' ? gases[0] : 0
704
+ result.stairgas2 = gases[1] !== '' ? gases[1] : 0
705
+ result.stairgas3 = '99999999'
706
+ }
707
+ if (prices.length >= 2) {
708
+ result.stairprice1 = prices[0] !== '' ? prices[0] : 0
709
+ result.stairprice2 = prices[1] !== '' ? prices[1] : 0
710
+ result.stairprice3 = prices[2] !== '' ? prices[2] : 0
711
+ }
712
+ } else {
713
+ // 从固定气价的表换金额表的时候,气量随便写,金额用之前的固定单价
714
+ result.stairgas1 = '77777777'
715
+ result.stairgas2 = '88888888'
716
+ result.stairgas3 = '99999999'
717
+
718
+ result.stairprice1 = cardParams.data.stairprice
719
+ result.stairprice2 = cardParams.data.stairprice
720
+ result.stairprice3 = cardParams.data.stairprice
721
+ }
722
+
723
+ return result
724
+ },
725
+ async getGasPrice(f_userfiles_id) {
726
+ //tag)
727
+ let http = new HttpResetClass()
728
+ let data = {
729
+ model: {f_userfiles_id: f_userfiles_id},
730
+ value: 0,
731
+ isGasValue: 0
732
+ }
733
+ //tag)
734
+ let res = await http.load('POST', `${this.$androidUtil.getProxyUrl()}/api/af-revenue/logic/commonCal`, {data: data}, {
735
+ resolveMsg: null,
736
+ rejectMsg: null
737
+ })
738
+ if (res.data.chargeprice[0].f_price_name !== '固定气价'){
739
+ if (res.data.hasOwnProperty('f_stair1surplus') && res.data.f_stair1surplus > 0) {
740
+ this.model.gasPrice = res.data.f_stair1price
741
+ } else if (res.data.hasOwnProperty('f_stair2surplus') && res.data.f_stair2surplus > 0) {
742
+ this.model.gasPrice = res.data.f_stair2price
743
+ } else if ((res.data.hasOwnProperty('f_stair3surplus') && res.data.f_stair3surplus > 0) || (!res.data.hasOwnProperty('f_stair3surplus'))) {
744
+ this.model.gasPrice = res.data.f_stair3price
745
+ } else if (res.data.hasOwnProperty('f_stair4price')) {
746
+ this.model.gasPrice = res.data.f_stair4price
747
+ }
748
+ this.ladderPrice = res.data
749
+ } else {
750
+ this.model.gasPrice = res.data.chargeprice[0].f_price
751
+ }
752
+
753
+ }
754
+ },
755
+ computed: {
756
+
757
+ }
758
+ }
759
+ </script>
760
+
761
+ <style scoped>
762
+ .app-row {
763
+ background-color: white;
764
+ padding: 10px 10px 0 10px;
765
+ border-bottom: 1px solid rgba(235, 235, 235, 0.7);
766
+ }
767
+ .input_ys {
768
+ /*border: 1px solid #93B2D3 !important;*/
769
+ border: none !important;
770
+ width: 220px;
771
+ height: 35px;
772
+ text-align: center;
773
+ }
774
+ .button_btn {
775
+ width: 27%;
776
+ height: 45px;
777
+ background-color: #4b93da;
778
+ border-radius: 6px;
779
+ border: none;
780
+ font-family: PingFang;
781
+ font-size: 18px;
782
+ color: #ffffff;
783
+ margin: 3% 2%;
784
+ }
785
+ .font_normal_body {
786
+ font-size: 16px !important;
787
+ line-height: 10px;
788
+ }
789
+ .btn-color{
790
+ background-color: #FFFFFF;
791
+ border-radius: 10px ;
792
+ border: 1px solid #499EDF;
793
+ }
794
+ .btn-font{
795
+ font:600 16px PingFang-SC-Bold;
796
+ color: #499EDF;
797
+ }
798
+ </style>