sale-client 4.2.21 → 4.2.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 (50) hide show
  1. package/build/dev-server.js +52 -32
  2. package/package.json +1 -1
  3. package/src/App.vue +1 -1
  4. package/src/components/revenue/HandManager/MeterBookUser.vue +726 -726
  5. package/src/components/revenue/comprehen/ComprehenOperation/QrPay/QrPaymentDetailed.vue +423 -423
  6. package/src/components/revenue/comprehen/ComprehenOperation/newchangemeter/ChangeMeter.vue +2 -0
  7. package/src/components/revenue/comprehen/Maintenance/hand/handOperate.vue +469 -469
  8. package/src/components/revenue/machineHandManage/ArrearsQuery.vue +938 -938
  9. package/src/components/webMeter/MeterManage/WebMeterBatchOperationValve.vue +970 -970
  10. package/src/filiale/alashan/eticket/EticketRecordList.vue +428 -428
  11. package/src/filiale/bayan/ChargeList.vue +1010 -1010
  12. package/src/filiale/bayan/StockListmain.vue +543 -543
  13. package/src/filiale/beifangshiye/OtherChargeNew.vue +625 -625
  14. package/src/filiale/lixianV3/ArrearsQuery.vue +938 -938
  15. package/src/filiale/lixianV3/InsuranceChargesDetails.vue +425 -425
  16. package/src/filiale/meihekou/common/userinfo_detail/ic_detail/MachineRecordQuery.vue +281 -281
  17. package/src/filiale/qianneng/revenue/sms/AccountMessageList.vue +508 -508
  18. package/src/filiale/ronghao/ArrearsQuery.vue +974 -974
  19. package/src/filiale/ronghao/CardService.js +2144 -2144
  20. package/src/filiale/ronghao/InsuranceManage.vue +58 -58
  21. package/src/filiale/ronghao/MachineChargeService.js +149 -149
  22. package/src/filiale/ronghao/NoCardMeterCenter.vue +534 -534
  23. package/src/filiale/ronghao/PaymentCode.vue +174 -174
  24. package/src/filiale/ronghao/PriceChangeCompensation/CompensationManage.vue +26 -26
  25. package/src/filiale/ronghao/PriceChangeCompensation/IotCompensation.vue +318 -318
  26. package/src/filiale/ronghao/PriceChangeCompensation/JbCompensation.vue +343 -343
  27. package/src/filiale/ronghao/PriceChangeCompensation/SurplusRecordDetail.vue +74 -74
  28. package/src/filiale/ronghao/ReplaceCardManage.vue +415 -415
  29. package/src/filiale/ronghao/Upload.vue +654 -654
  30. package/src/filiale/ronghao/cardDown.vue +1141 -1141
  31. package/src/filiale/ronghao/changemeterOperate.vue +315 -315
  32. package/src/filiale/ronghao/fillgasSpecific.vue +313 -313
  33. package/src/filiale/ronghao/ic_detail/ChargeRecordQuery.vue +106 -106
  34. package/src/filiale/ronghao/ic_detail/WatchCollection.vue +115 -115
  35. package/src/filiale/ronghao/ic_detail/WebHandQueryUser.vue +411 -411
  36. package/src/filiale/ronghao/machineDown.vue +1176 -1176
  37. package/src/filiale/ronghao/replacementSingleInfoOperation.vue +315 -315
  38. package/src/filiale/ronghao/specificInformation.vue +537 -537
  39. package/src/filiale/yangchun/ChargeList.vue +954 -954
  40. package/src/filiale/yuncheng/changemeterListMaintain.vue +504 -504
  41. package/src/filiale/zhongsheng/BlackListList.vue +293 -293
  42. package/src/filiale/zhongyi/HandQueryUser.vue +389 -389
  43. package/src/main.js +1 -1
  44. package/src/plugins/CardService.js +2217 -2217
  45. package/.gradle/5.2.1/fileChanges/last-build.bin +0 -0
  46. package/.gradle/5.2.1/fileHashes/fileHashes.lock +0 -0
  47. package/.gradle/5.2.1/gc.properties +0 -0
  48. package/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  49. package/.gradle/buildOutputCleanup/cache.properties +0 -2
  50. package/.gradle/vcs-1/gc.properties +0 -0
@@ -1,2144 +1,2144 @@
1
- import Vue from 'vue'
2
- import co from 'co'
3
-
4
- let CardService = {
5
- install (Vue, options) {
6
- // 给vue增添对话框显示方法
7
- Vue.CardService = Vue.prototype.$CardService = CardService
8
- },
9
- // 判断是否插卡
10
- hasCard () {
11
- let has = hasCardGen()
12
- return co(has)
13
- },
14
- // 读卡
15
- readCard () {
16
- let read = readCard()
17
- return co(read)
18
- },
19
- // 指令写卡
20
- // 目前支持 承德海力物联网表
21
- instructWriteCard (row) {
22
- let read = instructWriteCardGen(row)
23
- return co(read)
24
- },
25
- // 开户发卡
26
- initCard (model, row, allot) {
27
- // let init = initCardGen(model, row, allot ? this.getallotdata(allot, row, '发卡售气') : null)
28
- // return co(init)
29
-
30
- let f_serial_number = ''
31
- let f_price = ''
32
- let inputprice = '0'
33
- if (model.f_serial_number) {
34
- f_serial_number = model.f_serial_number
35
- }
36
- if (model.f_price && (model.f_price - 0) > 0) {
37
- f_price = model.f_price
38
- inputprice = '1'
39
- }
40
- let f_privilege_gas = 0
41
- if (model.f_privilege_gas) {
42
- f_privilege_gas = model.f_privilege_gas
43
- }
44
- let param = {
45
- f_alias: row.f_alias,
46
- garbage_number: model.garbage_number,
47
- garbage_money: model.garbage_money,
48
- f_serial_id: model.f_serial_id,
49
- f_userinfo_id: row.f_userinfo_id,
50
- f_serial_number: f_serial_number,
51
- f_user_id: row.f_user_id,
52
- f_price: f_price,
53
- inputprice: inputprice,
54
- f_userfiles_id: row.f_userfiles_id,
55
- f_pregas: model.f_pregas,
56
- f_preamount: model.f_preamount,
57
- f_balance: row.f_balance,
58
- f_meter_type: row.f_meter_type,
59
- f_calculation: row.f_calculation,
60
- f_collection_type: row.f_collection_type,
61
- f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
62
- f_write_money: model.xiekamoney,
63
- f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
64
- f_write_totalfee: (row.f_write_totalfee - 0) + (model.xiekamoney - 0),
65
- f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
66
- f_open_fee: model.f_open_fee,
67
- f_collection: model.f_collection,
68
- f_payment: model.f_payment.toString(),
69
- payments: model.payments,
70
- f_print: model.f_print.toString(),
71
- f_voucher_number: model.f_voucher_number,
72
- userinfo_version: row.userinfo_version,
73
- version: row.version,
74
- // 优惠金额
75
- f_privilege_money: model.f_privilege_money,
76
- f_privilege_gas: f_privilege_gas,
77
- f_after_discount: model.f_after_discount,
78
-
79
- f_operator: Vue.$login.f.name,
80
- f_operatorid: Vue.$login.f.id,
81
- f_orgid: Vue.$login.f.orgid,
82
- f_orgname: Vue.$login.f.orgs,
83
- f_depid: Vue.$login.f.depids,
84
- f_depname: Vue.$login.f.deps,
85
- f_zoneid: Vue.$login.f.zoneid,
86
- f_zones: Vue.$login.f.zones,
87
- f_comments: model.f_comments
88
- }
89
- console.log('发卡售气前参数', row)
90
- return sendCardSaleGasGen(param, row)
91
- },
92
- resetinitCard (model, row) {
93
- let f_serial_number = ''
94
- let f_price = ''
95
- let inputprice = '0'
96
- if (model.f_serial_number) {
97
- f_serial_number = model.f_serial_number
98
- }
99
- if (model.f_price && (model.f_price - 0) > 0) {
100
- f_price = model.f_price
101
- inputprice = '1'
102
- }
103
- let f_privilege_gas = 0
104
- if (model.f_privilege_gas) {
105
- f_privilege_gas = model.f_privilege_gas
106
- }
107
- let param = {
108
- f_serial_id: model.f_serial_id,
109
- f_userinfo_id: row.f_userinfo_id,
110
- f_user_name: row.f_user_name,
111
- f_serial_number: f_serial_number,
112
- f_user_id: row.f_user_id,
113
- f_price: f_price,
114
- inputprice: inputprice,
115
- f_userfiles_id: row.f_userfiles_id,
116
- f_pregas: model.f_pregas,
117
- f_preamount: model.f_preamount,
118
- f_balance: row.f_balance,
119
- f_meter_type: row.f_meter_type,
120
- f_calculation: row.f_calculation,
121
- f_collection_type: row.f_collection_type,
122
- f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
123
- f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
124
- f_write_totalfee: (row.f_write_totalfee - 0) + (model.f_preamount - 0),
125
- f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
126
- f_open_fee: model.f_open_fee,
127
- f_collection: model.f_collection,
128
- // f_print: model.f_print.toString(),
129
- f_user_type: row.f_user_type,
130
- f_gasproperties: row.f_gasproperties,
131
- f_address: row.f_address,
132
- f_meter_brand: row.f_meter_brand,
133
- f_voucher_number: model.f_voucher_number,
134
- userinfo_version: row.userinfo_version,
135
- version: row.version,
136
-
137
- f_operator: Vue.$login.f.name,
138
- f_operatorid: Vue.$login.f.id,
139
- f_orgid: Vue.$login.f.orgid,
140
- f_orgname: Vue.$login.f.orgs,
141
- f_depid: Vue.$login.f.depids,
142
- f_depname: Vue.$login.f.deps,
143
- f_zoneid: Vue.$login.f.zoneid,
144
- f_zones: Vue.$login.f.zones,
145
- f_comments: model.f_comments
146
- }
147
- console.log('重发卡售气前参数', row)
148
- return resetsendCardSaleGasGen(param, row)
149
- },
150
- // 补气开户发卡
151
- remanentinitCard (model, row, allot) {
152
- let param = {
153
- f_share_times: row.f_share_times,
154
- f_hascard: row.f_hascard,
155
- f_open_way: row.f_open_type,
156
- f_serial_id: model.f_serial_id,
157
- f_userinfo_id: row.f_userinfo_id,
158
- f_user_id: row.f_user_id,
159
- // 补气量
160
- f_fill_gas: model.f_fill_gas,
161
- f_fill_money: model.f_fill_money,
162
- f_remanent_gas: row.f_remanent_gas === 0 ? model.f_fill_gas : row.f_remanent_gas,
163
- f_remanent_price: row.f_remanent_price,
164
- f_remanent_money: row.f_remanent_money === 0 ? model.f_fill_money : row.f_remanent_money,
165
- f_remanent_type: row.f_remanent_type,
166
- f_userfiles_id: row.f_userfiles_id,
167
- f_user_name: row.f_user_name,
168
- f_user_type: row.f_user_type,
169
- f_gasproperties: row.f_gasproperties,
170
- f_address: row.f_address,
171
- f_meter_brand: row.f_meter_brand,
172
- f_meter_type: row.f_meter_type,
173
- f_collection_type: row.f_collection_type,
174
- // 购气量
175
- f_pregas: (model.f_pregas - 0) === 0 ? model.f_fill_gas : (model.f_pregas - 0),
176
- f_preamount: (model.f_preamount - 0) === 0 ? model.f_fill_money : (model.f_preamount - 0),
177
- f_totalcost: model.f_totalcost - 0,
178
- f_balance: row.f_balance,
179
- f_open_fee: model.f_open_fee,
180
- f_collection: model.f_collection,
181
- f_payment: model.f_payment.toString(),
182
- payments: model.payments,
183
- f_print: model.f_print.toString(),
184
- f_voucher_number: model.f_voucher_number,
185
- userinfo_version: row.userinfo_version,
186
- version: row.version,
187
- f_operator: Vue.$login.f.name,
188
- f_operatorid: Vue.$login.f.id,
189
- f_orgid: Vue.$login.f.orgid,
190
- f_orgname: Vue.$login.f.orgs,
191
- f_depid: Vue.$login.f.depids,
192
- f_depname: Vue.$login.f.deps,
193
- f_zoneid: Vue.$login.f.zoneid,
194
- f_zones: Vue.$login.f.zones,
195
- f_comments: model.f_comments
196
- }
197
-
198
- if (row.f_remanent_type === 1) {
199
- param.f_total_gas = (row.f_total_gas - 0) + (model.f_pregas - 0)
200
- param.f_total_fee = (row.f_total_fee - 0) + (model.f_preamount - 0)
201
- } else {
202
- if ((model.f_pregas - 0) > (model.f_fill_gas - 0)) {
203
- param.f_total_gas = (row.f_total_gas - 0) + ((model.f_pregas - 0) - (model.f_fill_gas - 0))
204
- param.f_total_fee = (row.f_total_fee - 0) + (model.f_preamount - 0)
205
- } else {
206
- param.f_total_gas = (row.f_total_gas - 0)
207
- param.f_total_fee = (row.f_total_fee - 0)
208
- }
209
- }
210
- param.f_write_totalgas = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
211
- param.f_write_totalfee = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
212
- return sendCardSaleGasGenremanent(param, row)
213
- },
214
-
215
- offlineWrite (row) {
216
- return offlineWriteGen(row)
217
- },
218
- // 余量补差
219
- margin (model, row) {
220
- let f_serial_number = ''
221
- let f_price = ''
222
- let inputprice = '0'
223
- let f_privilege_gas = 0
224
- if (model.f_serial_number) {
225
- f_serial_number = model.f_serial_number
226
- }
227
- if (model.f_price && (model.f_price - 0) > 0) {
228
- f_price = model.f_price
229
- inputprice = '1'
230
- }
231
- if (model.f_privilege_gas) {
232
- f_privilege_gas = model.f_privilege_gas
233
- }
234
- let param = {
235
- garbage_number: model.garbage_number,
236
- garbage_money: model.garbage_money,
237
- f_serial_id: model.f_serial_id,
238
- f_userinfo_id: row.f_userinfo_id,
239
- f_serial_number: f_serial_number,
240
- f_write_money: model.xiekamoney,
241
- f_price: f_price,
242
- inputprice: inputprice,
243
- // 补气量
244
- f_remanent_gas: row.f_remanent_gas,
245
- f_remanent_price: row.f_remanent_price,
246
- f_user_id: row.f_user_id,
247
- f_calculation: row.f_calculation,
248
- f_collection_type: row.f_collection_type,
249
- f_userfiles_id: row.f_userfiles_id,
250
- f_pregas: model.f_pregas,
251
- f_totalcost: model.f_totalcost,
252
- f_balance: row.f_balance,
253
- f_meter_type: row.f_meter_type,
254
- f_preamount: model.f_preamount,
255
- f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
256
- f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
257
- f_write_totalfee: (row.f_write_totalfee - 0) + (model.xiekamoney - 0),
258
- f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
259
- f_collection: model.f_collection,
260
- // 优惠金额
261
- f_privilege_money: model.f_privilege_money,
262
- f_privilege_gas: f_privilege_gas,
263
- f_after_discount: model.f_after_discount,
264
- f_payment: model.f_payment.toString(),
265
- payments: model.payments,
266
- f_print: model.f_print.toString(),
267
- f_voucher_number: model.f_voucher_number,
268
- userinfo_version: row.userinfo_version,
269
- version: row.version,
270
- isGasValue: model.f_pregas ? 0 : 1,
271
- f_meter_base: row.f_meter_base,
272
- f_operator: Vue.$login.f.name,
273
- f_operatorid: Vue.$login.f.id,
274
- f_orgid: Vue.$login.f.orgid,
275
- f_orgname: Vue.$login.f.orgs,
276
- f_depid: Vue.$login.f.depids,
277
- f_depname: Vue.$login.f.deps,
278
- f_zoneid: Vue.$login.f.zoneid,
279
- f_zones: Vue.$login.f.zones,
280
- f_comments: model.f_comments,
281
- f_sys_balance: model.f_sys_balance
282
- }
283
- return marginGen(param, row)
284
- },
285
- // 卡表收费
286
- sellgas (model, row) {
287
- let f_serial_number = ''
288
- let f_price = ''
289
- let inputprice = '0'
290
- let f_privilege_gas = 0
291
- if (model.f_serial_number) {
292
- f_serial_number = model.f_serial_number
293
- }
294
- if (model.f_price && (model.f_price - 0) > 0) {
295
- f_price = model.f_price
296
- inputprice = '1'
297
- }
298
- if (model.f_privilege_gas) {
299
- f_privilege_gas = model.f_privilege_gas
300
- }
301
- let param = {
302
- f_alias: row.f_alias,
303
- garbage_number: model.garbage_number,
304
- garbage_money: model.garbage_money,
305
- f_serial_id: model.f_serial_id,
306
- f_userinfo_id: row.f_userinfo_id,
307
- f_serial_number: f_serial_number,
308
- f_write_money: model.xiekamoney,
309
- f_price: f_price,
310
- inputprice: inputprice,
311
- // 补气量
312
- f_remanent_gas: row.f_remanent_gas,
313
- f_remanent_price: row.f_remanent_price,
314
- f_user_id: row.f_user_id,
315
- f_calculation: row.f_calculation,
316
- f_collection_type: row.f_collection_type,
317
- f_userfiles_id: row.f_userfiles_id,
318
- f_pregas: model.f_pregas,
319
- f_totalcost: model.f_totalcost,
320
- f_balance: row.f_balance,
321
- f_meter_type: row.f_meter_type,
322
- f_preamount: model.f_preamount,
323
- f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
324
- f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
325
- f_write_totalfee: (row.f_write_totalfee - 0) + (model.xiekamoney - 0),
326
- f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
327
- f_collection: model.f_collection,
328
- // 优惠金额
329
- f_privilege_money: model.f_privilege_money,
330
- f_privilege_gas: f_privilege_gas,
331
- f_after_discount: model.f_after_discount,
332
- f_payment: model.f_payment.toString(),
333
- payments: model.payments,
334
- f_print: model.f_print.toString(),
335
- f_voucher_number: model.f_voucher_number,
336
- userinfo_version: row.userinfo_version,
337
- version: row.version,
338
- f_meter_base: row.f_meter_base,
339
- f_operator: Vue.$login.f.name,
340
- f_operatorid: Vue.$login.f.id,
341
- f_orgid: Vue.$login.f.orgid,
342
- f_orgname: Vue.$login.f.orgs,
343
- f_depid: Vue.$login.f.depids,
344
- f_depname: Vue.$login.f.deps,
345
- f_zoneid: Vue.$login.f.zoneid,
346
- f_zones: Vue.$login.f.zones,
347
- f_comments: model.f_comments,
348
- f_sys_balance: model.f_sys_balance,
349
- deduct: model.getDeduct
350
- }
351
- return sellgasGen(param, row)
352
- },
353
-
354
- // 补气卡表收费
355
- remanentsellgas (model, row) {
356
- let param = {
357
- f_user_name: row.f_user_name,
358
- f_user_type: row.f_user_type,
359
- f_gasproperties: row.f_gasproperties,
360
- f_userinfo_id: row.f_userinfo_id,
361
- f_address: row.f_address,
362
- f_meter_brand: row.f_meter_brand,
363
- f_meter_type: row.f_meter_type,
364
- f_meternumber: row.f_meternumber,
365
- f_collection_type: row.f_collection_type,
366
- f_card_id: row.f_card_id,
367
- f_write_money: model.xiekamoney,
368
- // 补气信息
369
- f_fill_gas: model.f_fill_gas,
370
- f_fill_money: model.f_fill_money,
371
-
372
- f_remanent_gas: row.f_remanent_gas,
373
- f_remanent_price: row.f_remanent_price,
374
- f_remanent_type: row.f_remanent_type,
375
- f_user_id: row.f_user_id,
376
- f_userfiles_id: row.f_userfiles_id,
377
- f_pregas: model.f_pregas,
378
- f_balance: row.f_balance,
379
- f_preamount: model.f_preamount,
380
- f_totalcost: model.f_totalcost,
381
- f_collection: model.f_collection,
382
- f_payment: model.f_payment.toString(),
383
- payments: model.payments,
384
- f_print: model.f_print.toString(),
385
- f_voucher_number: model.f_voucher_number,
386
- userinfo_version: row.userinfo_version,
387
- version: row.version,
388
- f_operator: Vue.$login.f.name,
389
- f_operatorid: Vue.$login.f.id,
390
- f_orgid: Vue.$login.f.orgid,
391
- f_orgname: Vue.$login.f.orgs,
392
- f_depid: Vue.$login.f.depids,
393
- f_depname: Vue.$login.f.deps,
394
- f_zoneid: Vue.$login.f.zoneid,
395
- f_zones: Vue.$login.f.zones,
396
- f_comments: model.f_comments
397
- }
398
-
399
- // 0:代表清零补气, 累购量不加 1:代表换表补气 累购量加
400
- if (row.f_remanent_type === 1) {
401
- param.f_total_gas = (row.f_total_gas - 0) + (model.f_pregas - 0)
402
- param.f_total_fee = (row.f_total_fee - 0) + (model.f_preamount - 0)
403
- } else {
404
- if (model.f_pregas > row.f_remanent_gas) {
405
- param.f_total_gas = (row.f_total_gas - 0) + (model.f_pregas - row.f_remanent_gas)
406
- param.f_total_fee = (row.f_total_fee - 0) + (model.f_preamount - 0)
407
- } else {
408
- param.f_total_gas = (row.f_total_gas - 0)
409
- param.f_total_fee = (row.f_total_fee - 0)
410
- }
411
- }
412
- param.f_write_totalgas = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
413
- param.f_write_totalfee = (row.f_write_totalfee - 0) + (model.xiekamoney - 0)
414
- return sellgasRemanentGen(param, row)
415
- },
416
- // 数码表收费
417
- DigtialSellGas (model, row) {
418
- let f_serial_number = ''
419
- if (model.f_serial_number) {
420
- f_serial_number = model.f_serial_number
421
- }
422
- let param = {
423
- f_userinfo_id: row.f_userinfo_id,
424
- f_serial_number: f_serial_number,
425
- f_user_id: row.f_user_id,
426
- f_userfiles_id: row.f_userfiles_id,
427
- f_pregas: model.f_pregas,
428
- f_write_money: model.f_write_money,
429
- f_balance: row.f_balance,
430
- f_preamount: model.f_preamount,
431
- f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
432
- f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
433
- f_write_totalfee: (row.f_write_totalfee - 0) + (model.f_write_money - 0),
434
- f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
435
- f_collection: model.f_collection,
436
- f_payment: model.f_payment.toString(),
437
- payments: model.payments,
438
- f_print: model.f_print.toString(),
439
- f_voucher_number: model.f_voucher_number,
440
- userinfo_version: row.userinfo_version,
441
- version: row.version,
442
- f_operator: Vue.$login.f.name,
443
- f_operatorid: Vue.$login.f.id,
444
- f_orgid: Vue.$login.f.orgid,
445
- f_orgname: Vue.$login.f.orgs,
446
- f_depid: Vue.$login.f.depids,
447
- f_depname: Vue.$login.f.deps,
448
- f_zoneid: Vue.$login.f.zoneid,
449
- f_zones: Vue.$login.f.zones
450
-
451
- }
452
-
453
- return DigtialSellGasGen(param, row)
454
- },
455
- // 无卡收费
456
- noCardSellGas (model, row) {
457
- let f_serial_number = ''
458
- if (model.f_serial_number) {
459
- f_serial_number = model.f_serial_number
460
- }
461
- let f_write_card = ''
462
- if (model.f_write_card) {
463
- f_write_card = model.f_write_card
464
- }
465
- let param = {
466
- f_userinfo_id: row.f_userinfo_id,
467
- f_serial_number: f_serial_number,
468
- f_user_id: row.f_user_id,
469
- f_userfiles_id: row.f_userfiles_id,
470
- f_pregas: model.f_pregas,
471
- f_write_money: model.f_write_money,
472
- f_balance: row.f_balance,
473
- f_preamount: model.f_preamount,
474
- f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
475
- f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
476
- f_write_totalfee: (row.f_write_totalfee - 0) + (model.f_write_money - 0),
477
- f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
478
- f_collection: model.f_collection,
479
- f_payment: model.f_payment.toString(),
480
- payments: model.payments,
481
- f_print: model.f_print.toString(),
482
- f_voucher_number: model.f_voucher_number,
483
- userinfo_version: row.userinfo_version,
484
- version: row.version,
485
- f_write_card: f_write_card === '不写卡' ? '不写卡' : '未写卡',
486
- f_operator: Vue.$login.f.name,
487
- f_operatorid: Vue.$login.f.id,
488
- f_orgid: Vue.$login.f.orgid,
489
- f_orgname: Vue.$login.f.orgs,
490
- f_depid: Vue.$login.f.depids,
491
- f_depname: Vue.$login.f.deps,
492
- f_zoneid: Vue.$login.f.zoneid,
493
- f_zones: Vue.$login.f.zones
494
-
495
- }
496
-
497
- return noCardSellGasGen(param, row)
498
- },
499
-
500
- // 补卡写卡
501
- replaceCard (model, row, allot) {
502
- // 磁条卡走了 replaceCiTiaoCard 不走这里
503
- // if (row.f_meter_type.indexOf('卡表') === -1 && row.f_meter_type.indexOf('物联网表') === -1) {
504
- // model.f_type = '补磁条卡'
505
- // let replace = replaceCiTiaoCardGen(model, row)
506
- // return co(replace)
507
- // }
508
- let replace = replaceCardGen(model, row, allot ? this.getallotdata(allot, row, '补卡') : null)
509
- return co(replace)
510
- },
511
- // 磁条卡补卡写卡
512
- replaceCiTiaoCard (model, row, allot) {
513
- let replace = replaceCiTiaoCardGen(model, row)
514
- return co(replace)
515
- },
516
- // 机表写卡
517
- replaceCardJB (model, row) {
518
- let replace = replaceCardGenJB(model, row)
519
- return co(replace)
520
- },
521
- // 物联网写卡
522
- replaceCardWeb (model, row) {
523
- let replace = replaceCardGenWeb(model, row)
524
- return co(replace)
525
- },
526
- replacecXq (model, row) {
527
- let replace = replaceXq(model, row)
528
- return co(replace)
529
- }
530
- }
531
-
532
- // 判断是否有卡插入
533
- let hasCardGen = async function () {
534
- return await Vue.resetpost('http://127.0.0.1:8003/HasCard', {}, {resolveMsg: null, rejectMsg: '请检查卡是否插好!!'})
535
- }
536
- // 读卡
537
- let readCard = async function () {
538
- return await Vue.resetpost('http://127.0.0.1:8003/ReadCard', {data: {}}, {resolveMsg: null, rejectMsg: null})
539
- }
540
-
541
- let replaceCiTiaoCardGen = async function (model, row) {
542
- // 1.存库 2.写卡
543
- let result = null
544
- let getCardNumber = {data: {cardNumber: null}}
545
- try {
546
- const OperatorInfo = {
547
- f_operator: Vue.$login.f.name,
548
- f_operatorid: Vue.$login.f.id,
549
- f_orgid: Vue.$login.f.orgid,
550
- f_orgname: Vue.$login.f.orgs,
551
- f_depid: Vue.$login.f.depids,
552
- f_depname: Vue.$login.f.deps
553
- }
554
- // 获取卡号
555
- // if (!row.f_card_id) {
556
- // getCardNumber = await Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {
557
- // resolveMsg: null,
558
- // rejectMsg: '发卡售气获取卡号失败!!'
559
- // })
560
- // console.log('获取卡号、、', getCardNumber)
561
- // } else {
562
- // getCardNumber.data.cardNumber = row.f_card_id
563
- // console.log('档案自带卡号、、', getCardNumber)
564
- // }
565
- if (row.f_userinfo_code) {
566
- getCardNumber.data.cardNumber = row.f_card_id
567
- }
568
- result = await Vue.resetpost('api/af-revenue/logic/sendCiTiaoCardRemanentGas', {
569
- data: {
570
- model,
571
- getCardNumber,
572
- row,
573
- OperatorInfo
574
- }
575
- }, {resolveMsg: null, rejectMsg: '发卡售气存库失败'})
576
- // 存库
577
- console.log('换表发卡存库返回', result)
578
- // 写卡
579
- Vue.showAlert('请刷卡', 'warning', 50000)
580
- // 组织写卡数据
581
- let params = {
582
- kh: result.data.cardnumber
583
- }
584
- let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteCard_HEC', params, {
585
- resolveMsg: null,
586
- rejectMsg: '开户卡服务错误'
587
- })
588
- Vue.closeAlert()
589
- if (!result || cardRes.data.Err || cardRes.data.Exception) {
590
- // 写卡异常
591
- await Vue.resetpost('api/af-revenue/logic/sendCiTiaoCardRemanentGas', {
592
- data: {
593
- model,
594
- getCardNumber,
595
- row,
596
- Chongzheng: true,
597
- fill_id: result.data.id
598
- }
599
- }, {resolveMsg: null, rejectMsg: null})
600
- throw new Error(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`)
601
- } else {
602
- // 写卡成功
603
- Vue.showAlert('写卡成功', 'success', 2000)
604
- return result
605
- }
606
- } catch (error) {
607
- console.log('换表发卡出错。。', error)
608
- if (result) {
609
- // 出错进行回滚
610
- row.f_user_id = row.f_user_id + ''
611
- if (result) {
612
- await Vue.resetpost('api/af-revenue/logic/sendCiTiaoCardRemanentGas', {
613
- data: {
614
- model,
615
- getCardNumber,
616
- row,
617
- Chongzheng: true,
618
- fill_id: result.data.id
619
- }
620
- }, {resolveMsg: null, rejectMsg: null})
621
- }
622
- }
623
- if (error.data) {
624
- throw new Error(error.data)
625
- } else {
626
- throw error
627
- }
628
- }
629
- }
630
-
631
- let sendCardSaleGasGenremanent = async function (model, row) {
632
- // 1.存库 2.写卡
633
- let result = null
634
- try {
635
- let cardState = await hasCardGen()
636
- console.log('判卡函数返回:', cardState)
637
- if (JSON.parse(cardState.data).state === 1) {
638
- // 获取卡号
639
- let getCardNumber = {data: {cardNumber: null}}
640
- if (!row.f_card_id) {
641
- getCardNumber = await Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {resolveMsg: null, rejectMsg: '发卡售气获取卡号失败!!'})
642
- console.log('获取卡号、、', getCardNumber)
643
- } else {
644
- getCardNumber.data.cardNumber = row.f_card_id
645
- console.log('档案自带卡号、、', getCardNumber)
646
- }
647
- if (row.f_alias && row.f_alias.includes('SmartCard_TP')) {
648
- model.cardNumber = row.f_meternumber
649
- } else if (getCardNumber.data.cardNumber) {
650
- model.cardNumber = getCardNumber.data.cardNumber + ''
651
- } else {
652
- throw new Error('获取卡号失败!请核实参数管理中的卡号重新换表发卡售气。')
653
- }
654
- result = await Vue.resetpost('api/af-revenue/logic/sendCardRemanentGas', {data: model}, {resolveMsg: null, rejectMsg: '发卡售气存库失败'})
655
- // 存库
656
- console.log('换表发卡存库返回', result)
657
- // 写卡
658
- let cardParams = await getParamGen(result.data.cardnumber, row.f_alias, row.f_user_id, row.f_userfiles_id)
659
-
660
- // 组织写卡数据
661
- let params = {
662
- factory: row.f_alias,
663
- kmm: '0', // 2019-12-22 查旭说的。给一个0 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
664
- kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
665
- kh: result.data.cardnumber, // 卡号
666
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
667
- ql: model.f_pregas, // 预购气量
668
- csql: '0', // 上次购气量,新开户为0
669
- ccsql: '0', // 上上次购气量,新开户为0
670
- cs: '1', // 求购气次数,先开户为1
671
- ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
672
- ljgqje: (row.f_write_totalfee - 0) + (model.f_preamount - 0), // 累计购气金额
673
- bkcs: '0', // 新开户卡,为0
674
- ljyql: '0', // 累积用气量,有些表要累加原来用气量,新开户卡,为0
675
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
676
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
677
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
678
- cssqrq: '0', // 上次售气日期,格式为YYYYMMDD
679
- meterid: row.f_meternumber, // 表号
680
- money: model.f_preamount, // 购气金额
681
- dqdm: row.f_area_code, // 精益工业地区代码
682
- klx: row.f_coding
683
- }
684
-
685
- params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
686
-
687
- // 判断是否是累购表
688
- if (row.f_support_purchase === '是') {
689
- params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
690
- params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
691
- params.totalmoney = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
692
- }
693
- console.log('换表发卡写卡参数', params)
694
- let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
695
- resolveMsg: null,
696
- rejectMsg: '开户卡服务错误'
697
- }, 80000)
698
- if (!cardParams || ((model.f_pregas > model.f_remanent_gas) && !result) || cardRes.data.Err || cardRes.data.Exception) {
699
- // 写卡异常
700
- // 数据回滚操作
701
- // 由于数据太长,将f_user_id 更改为字符串
702
- row.f_userfiles_id = row.f_userfiles_id + ''
703
-
704
- await Vue.resetpost('api/af-revenue/logic/remanentRollback', {data: {fillgasid: result.data.fillgasid, sellid: result.data.sellid, row: row}}, {
705
- resolveMsg: null,
706
- rejectMsg: '开户失败'
707
- })
708
- throw new Error(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`)
709
- } else {
710
- // 写卡成功
711
- // 更新卡密码
712
- row.version = result.data.version - 1,
713
- await Vue.CommonService.updatePassword(row, cardRes)
714
- Vue.showAlert('补气购气成功', 'success', 2000)
715
- return result
716
- }
717
- } else {
718
- throw new Error(`请检查卡是否插好!!`)
719
- }
720
- } catch (error) {
721
- console.log('换表发卡出错。。', error)
722
-
723
- if (result) {
724
- // 出错进行回滚
725
- row.f_user_id = row.f_user_id + ''
726
- if (result) {
727
- await Vue.resetpost('api/af-revenue/logic/remanentRollback', {data: {fillgasid: result.data.fillgasid, sellid: result.data.sellid, row: row}}, {
728
- resolveMsg: null,
729
- rejectMsg: '写卡失败,数据回滚失败,请联系技术人员处理!!'
730
- })
731
- }
732
- }
733
-
734
- if (error.data) {
735
- throw new Error(error.data)
736
- } else {
737
- throw error
738
- }
739
- }
740
- }
741
- let resetsendCardSaleGasGen = async function (model, row) {
742
- // 1.存库 2.写卡
743
- let result = null
744
- try {
745
- let cardState = await hasCardGen()
746
- console.log('判卡函数返回:', cardState)
747
- if (JSON.parse(cardState.data).state === 1) {
748
- // 获取卡号
749
- let getCardNumber = await Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {resolveMsg: null, rejectMsg: '重发卡售气获取卡号失败!!'})
750
- console.log('获取卡号、、', getCardNumber)
751
- if (getCardNumber.data.cardNumber) {
752
- // 当卡的别名是泰鹏普通卡的时候卡号和表号一致
753
- console.log('开始验证是不是泰鹏普通卡')
754
- if (row.f_alias && row.f_alias.includes('SmartCard_TP')) {
755
- model.cardNumber = row.f_meternumber
756
- } else {
757
- model.cardNumber = getCardNumber.data.cardNumber + ''
758
- model.f_card_id = getCardNumber.data.cardNumber + ''
759
- }
760
- } else {
761
- throw new Error('获取卡号失败!请核实参数管理中的卡号重新发卡售气。')
762
- }
763
- // 存库
764
- result = await Vue.resetpost('api/af-revenue/logic/sale_resetsendCardSaleGas_logic', {data: model}, {resolveMsg: null, rejectMsg: '重发卡售气存库失败'})
765
- console.log('重发卡售气存库返回', result)
766
- // 写卡
767
- let cardParams = await getParamGen(result.data.cardnumber, row.f_alias, row.f_user_id, row.f_userfiles_id)
768
-
769
- // 组织写卡数据
770
- let params = {
771
- factory: row.f_alias,
772
- kmm: '0', // 2019-12-22 查旭说的。给一个0 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
773
- kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
774
- kh: result.data.cardnumber, // 卡号
775
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
776
- ql: model.f_pregas, // 预购气量
777
- csql: '0', // 上次购气量,新开户为0
778
- ccsql: '0', // 上上次购气量,新开户为0
779
- cs: '1', // 求购气次数,先开户为1
780
- // ljgql: model.f_pregas, // 当前累计购气量
781
- bkcs: '0', // 新开户卡,为0
782
- ljyql: '0', // 累积用气量,有些表要累加原来用气量,新开户卡,为0
783
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
784
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
785
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
786
- cssqrq: '0', // 上次售气日期,格式为YYYYMMDD
787
- meterid: row.f_meternumber, // 表号
788
- money: model.f_preamount, // 购气金额
789
- dqdm: row.f_area_code, // 精益工业地区代码
790
- klx: row.f_coding,
791
- ljgql: (row.f_total_gas - 0) + (model.f_pregas - 0), // 当前累计购气量
792
- ljgqje: (row.f_total_fee - 0) + (model.f_preamount - 0) // 累计购气金额
793
- }
794
- // 判断是否是累购表
795
- if (row.f_support_purchase === '是') {
796
- params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
797
- params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
798
- }
799
- params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
800
- console.log('重发卡售气写卡参数', params)
801
- let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
802
- resolveMsg: null,
803
- rejectMsg: '重开户卡服务错误'
804
- }, 80000)
805
- if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
806
- // 写卡异常
807
- // 数据回滚操作
808
- throw `卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`
809
- } else {
810
- // 写卡成功
811
- // 更新卡密码
812
- await Vue.CommonService.updatePassword(row, cardRes)
813
- Vue.showAlert('初始化卡成功', 'success', 2000)
814
- return result
815
- }
816
- } else {
817
- throw new Error(`请检查卡是否插好!!`)
818
- }
819
- } catch (error) {
820
- if (result) {
821
- // 出错进行回滚
822
- row.f_userfiles_id = row.f_userfiles_id + ''
823
- if (result) {
824
- await Vue.resetpost('api/af-revenue/logic/salecardrollback', {data: {id: result.data.id, row: row}}, {
825
- resolveMsg: null,
826
- rejectMsg: '写卡失败,数据回滚失败,请联系技术人员处理!!'
827
- })
828
- }
829
- }
830
- if (error.data) {
831
- throw new Error(error.data)
832
- } else {
833
- throw error
834
- }
835
- }
836
- }
837
-
838
- let sendCardSaleGasGen = async function (model, row) {
839
- // 1.存库 2.写卡
840
- let result = null
841
- try {
842
- let cardState = await hasCardGen()
843
- console.log('判卡函数返回:', cardState)
844
- if (JSON.parse(cardState.data).state === 1) {
845
- // 获取卡号
846
- let getCardNumber = {data: {cardNumber: null}}
847
- if (!row.f_card_id) {
848
- getCardNumber = await Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {resolveMsg: null, rejectMsg: '发卡售气获取卡号失败!!'})
849
- console.log('获取卡号、、', getCardNumber)
850
- } else {
851
- getCardNumber.data.cardNumber = row.f_card_id
852
- console.log('档案自带卡号、、', getCardNumber)
853
- }
854
- if (getCardNumber.data.cardNumber) {
855
- // 当卡的别名是泰鹏普通卡的时候卡号和表号一致
856
- console.log('开始验证是不是泰鹏普通卡')
857
- if (row.f_alias && (row.f_alias.includes('SmartCard_TP') || row.f_alias.includes('LiHengSystem'))) {
858
- model.cardNumber = row.f_meternumber
859
- } else if (row.f_alias && row.f_alias.includes('LaiDeRF')) {
860
- model.cardNumber = row.f_card_id
861
- } else {
862
- model.cardNumber = getCardNumber.data.cardNumber + ''
863
- }
864
- } else {
865
- throw new Error('获取卡号失败!请核实参数管理中的卡号重新发卡售气。')
866
- }
867
- // 存库
868
- result = await Vue.resetpost('api/af-revenue/logic/sale_sendCardSaleGas_logic', {data: model}, {resolveMsg: null, rejectMsg: '发卡售气存库失败'})
869
- console.log('发卡售气存库返回', result)
870
- // 写卡
871
- let cardParams = await getParamGen(result.data.cardnumber, row.f_alias, row.f_user_id, row.f_userfiles_id)
872
-
873
- // 组织写卡数据
874
- let params = {
875
- factory: row.f_alias,
876
- kmm: '0', // 2019-12-22 查旭说的。给一个0 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
877
- kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
878
- kh: result.data.cardnumber, // 卡号
879
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
880
- ql: model.f_pregas, // 预购气量
881
- csql: '0', // 上次购气量,新开户为0
882
- ccsql: '0', // 上上次购气量,新开户为0
883
- cs: '1', // 求购气次数,先开户为1
884
- // ljgql: model.f_pregas, // 当前累计购气量
885
- bkcs: '0', // 新开户卡,为0
886
- ljyql: '0', // 累积用气量,有些表要累加原来用气量,新开户卡,为0
887
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
888
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
889
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
890
- cssqrq: '0', // 上次售气日期,格式为YYYYMMDD
891
- meterid: row.f_meternumber, // 表号
892
- money: model.f_write_money, // 购气金额
893
- dqdm: row.f_area_code, // 精益工业地区代码
894
- klx: row.f_coding,
895
- ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
896
- ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0) // 累计购气金额
897
- }
898
- // 天源表发卡售气时,cs默认给0
899
- if (row.f_alias && row.f_alias.includes('TianYuan')) {
900
- console.log('天源表发卡售气时,写卡次数给:', params.cs)
901
- params.cs = '0'
902
- }
903
- // 判断是否是累购表
904
- if (row.f_support_purchase === '是') {
905
- params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
906
- params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
907
- }
908
- params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
909
- console.log('发卡售气写卡参数', params)
910
- let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
911
- resolveMsg: null,
912
- rejectMsg: '开户卡服务错误'
913
- }, 80000)
914
- if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
915
- // 写卡异常
916
- // 数据回滚操作
917
- throw `卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`
918
- } else {
919
- // 写卡成功
920
- // 更新卡密码
921
- await Vue.CommonService.updatePassword(row, cardRes)
922
- Vue.showAlert('发卡售气成功', 'success', 2000)
923
- return result
924
- }
925
- } else {
926
- throw new Error(`请检查卡是否插好!!`)
927
- }
928
- } catch (error) {
929
- if (result) {
930
- // 出错进行回滚
931
- row.f_userfiles_id = row.f_userfiles_id + ''
932
- if (result) {
933
- await Vue.resetpost('api/af-revenue/logic/salecardrollback', {data: {id: result.data.id, row: row}}, {
934
- resolveMsg: null,
935
- rejectMsg: '写卡失败,数据回滚失败,请联系技术人员处理!!'
936
- })
937
- }
938
- }
939
- if (error.data) {
940
- throw new Error(error.data)
941
- } else {
942
- throw error
943
- }
944
- }
945
- }
946
-
947
- let replaceCardGen2 = function * (model, row, allot) {
948
- let result = yield co(reissueCardGen(model, row))
949
- let data = {
950
- userfiles: {},
951
- record: {
952
- id: result.data.id,
953
- f_state: '有效'
954
- }
955
- }
956
- return yield Vue.resetpost('api/af-revenue/logic/updatemark', {data: data}, {resolveMsg: '补卡成功', rejectMsg: '补卡修改状态失败'})
957
- }
958
- // 物联网表发卡管理
959
- let replaceCardGenWeb = function * (model, row) {
960
- let result = null
961
- let allotback
962
- try {
963
- // 判断是否有卡
964
- let cardState = yield co(hasCardGen())
965
- if (JSON.parse(cardState.data).state === 1) {
966
- let cardId = ''
967
- if (row.f_card_id && row.f_card_id !== 'null') {
968
- cardId = row.f_card_id
969
- } else {
970
- let getCardNumber = yield co(getCardNumberGen(row.f_gasbrand_id))
971
- console.log('获取卡号、、', getCardNumber)
972
- cardId = getCardNumber.data.cardNumber
973
- }
974
- if (row.f_tag) {
975
- // 截取用户编号后四位
976
- cardId = row.f_tag + row.f_card_id
977
- }
978
- model.f_card_id = cardId
979
- // 存库
980
- result = yield co(reissueCardGenJB(model, row))
981
- // 获取气价和售气情况参数
982
- let cardParams = yield co(getParamGen(cardId, row.f_alias, row.f_user_id, row.f_userfiles_id))
983
- // 写卡
984
- let params = {
985
- factory: row.f_alias,
986
- kh: cardId, // 卡号
987
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
988
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
989
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
990
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
991
- ljgql: (row.f_total_gas - 0), // 当前累计购气量
992
- ljgqje: (row.f_total_fee - 0), // 累计购气金额
993
- kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
994
- bkcs: row.f_fillcard_times + 1, // 补卡次数,从补卡表里通过表编号获得
995
- cs: row.f_times, // 求购气次数,先开户为1
996
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号
997
- meterid: row.f_meternumber, // 表号
998
- meternumber: row.f_meternumber,
999
- dqdm: row.f_area_code, // 精益工业地区代码
1000
- money: 0, // 购气金额
1001
- klx: row.f_coding
1002
- }
1003
- // 判断是否是累购表
1004
- if (row.f_support_purchase === '是') {
1005
- params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
1006
- params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
1007
- }
1008
- params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1009
- console.log('补卡是写的次数。。。。', params)
1010
- let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
1011
- resolveMsg: null,
1012
- rejectMsg: '补卡卡服务错误'
1013
- }))
1014
- // 卡服务写卡异常,业务逻辑回滚
1015
- if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1016
- Vue.$showAlert('物联网表补卡失败!!', 'danger', 0)
1017
- let rollbackParam = {
1018
- id: result.data.id,
1019
- f_card_id: row.f_card_id,
1020
- f_whether_hairpin: row.f_whether_hairpin,
1021
- f_user_id: row.f_user_id
1022
- }
1023
- if (row.f_tag) {
1024
- rollbackParam.f_tag = row.f_tag
1025
- }
1026
- yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1027
- resolveMsg: null,
1028
- rejectMsg: null
1029
- })
1030
- } else {
1031
- // 如果成功修改标识(更新状态为有效)
1032
- // 没有更新过表档案,这里版本号减一
1033
- row.version = (row.version - 0) - 1
1034
- yield co(Vue.CommonService.updatePassword(row, cardRes))
1035
- let data = {
1036
- userfiles: {
1037
- f_card_id: row.f_card_id,
1038
- f_whether_hairpin: '已发'
1039
- },
1040
- record: {
1041
- id: result.data.id,
1042
- f_state: '有效'
1043
- }
1044
- }
1045
- return yield Vue.resetpost('api/af-revenue/logic/updatemark', {data: data}, {resolveMsg: '物联网表补卡成功', rejectMsg: '补卡修改状态失败'})
1046
- }
1047
- } else {
1048
- Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1049
- }
1050
- } catch (error) {
1051
- let msg = ''
1052
- if (error.status === 612) {
1053
- msg = '请检查读卡器时候连接,或者卡服务是否启动!!'
1054
- } else {
1055
- msg = '补卡失败!!'
1056
-
1057
- let rollbackParam = {
1058
- id: result.data.id,
1059
- f_card_id: null,
1060
- f_whether_hairpin: row.f_whether_hairpin,
1061
- f_user_id: row.f_user_id
1062
- }
1063
- if (row.f_tag) {
1064
- rollbackParam.f_tag = row.f_tag
1065
- }
1066
- yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1067
- resolveMsg: null,
1068
- rejectMsg: '物联网表补卡失败!!'
1069
- })
1070
- }
1071
- Vue.showAlert(msg, 'danger', 0)
1072
- }
1073
- }
1074
- // 机表补卡管理
1075
- let replaceCardGenJB = function * (model, row) {
1076
- let result = null
1077
- let allotback
1078
- try {
1079
- // 判断是否有卡
1080
- let cardState = yield co(hasCardGen())
1081
- if (JSON.parse(cardState.data).state === 1) {
1082
- let cardId = row.f_card_id
1083
- if (row.f_tag) {
1084
- // 截取用户编号后四位
1085
- cardId = row.f_tag + row.f_card_id
1086
- }
1087
- model.f_card_id = cardId
1088
- // 存库
1089
- result = yield co(reissueCardGenJB(model, row))
1090
- // 获取气价和售气情况参数
1091
- let cardParams = yield co(getParamGen(cardId, row.f_alias, row.f_user_id, row.f_userfiles_id))
1092
- // 写卡
1093
- let params = {
1094
- factory: row.f_alias,
1095
- kh: cardId, // 卡号
1096
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1097
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1098
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1099
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1100
- ljgql: (row.f_total_gas - 0) + (model.f_pregas - 0), // 当前累计购气量
1101
- ljgqje: (row.f_total_fee - 0) + (model.f_preamount - 0), // 累计购气金额
1102
- kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1103
- bkcs: row.f_fillcard_times + 1, // 补卡次数,从补卡表里通过表编号获得
1104
- cs: row.f_times, // 求购气次数,先开户为1
1105
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号
1106
- meterid: row.f_meternumber, // 表号
1107
- meternumber: row.f_meternumber,
1108
- dqdm: row.f_area_code, // 精益工业地区代码
1109
- money: 0, // 购气金额
1110
- klx: row.f_coding
1111
- }
1112
- // 判断是否是累购表
1113
- if (row.f_support_purchase === '是') {
1114
- params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
1115
- params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
1116
- }
1117
- params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1118
- console.log('补卡是写的次数。。。。', params)
1119
- let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
1120
- resolveMsg: null,
1121
- rejectMsg: '补卡卡服务错误'
1122
- }, 80000))
1123
- // 卡服务写卡异常,业务逻辑回滚
1124
- if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1125
- Vue.$showAlert('机表补卡失败!!', 'danger', 0)
1126
- let rollbackParam = {
1127
- id: result.data.id,
1128
- f_card_id: row.f_card_id,
1129
- f_whether_hairpin: row.f_whether_hairpin,
1130
- f_user_id: row.f_user_id
1131
- }
1132
- if (row.f_tag) {
1133
- rollbackParam.f_tag = row.f_tag
1134
- }
1135
- yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1136
- resolveMsg: null,
1137
- rejectMsg: null
1138
- })
1139
- } else {
1140
- // 如果成功修改标识(更新状态为有效)
1141
- // 没有更新过表档案,这里版本号减一
1142
- row.version = (row.version - 0) - 1
1143
- yield co(Vue.CommonService.updatePassword(row, cardRes))
1144
- let data = {
1145
- userfiles: {
1146
- f_card_id: row.f_card_id,
1147
- f_whether_hairpin: '已发'
1148
- },
1149
- record: {
1150
- id: result.data.id,
1151
- f_state: '有效'
1152
- }
1153
- }
1154
- return yield Vue.resetpost('api/af-revenue/logic/updatemark', {data: data}, {resolveMsg: '机表补卡成功', rejectMsg: '补卡修改状态失败'})
1155
- }
1156
- } else {
1157
- Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1158
- }
1159
- } catch (error) {
1160
- let msg = ''
1161
- if (error.status === 612) {
1162
- msg = '请检查读卡器时候连接,或者卡服务是否启动!!'
1163
- } else {
1164
- msg = '补卡失败!!'
1165
-
1166
- let rollbackParam = {
1167
- id: result.data.id,
1168
- f_card_id: null,
1169
- f_whether_hairpin: row.f_whether_hairpin,
1170
- f_user_id: row.f_user_id
1171
- }
1172
- if (row.f_tag) {
1173
- rollbackParam.f_tag = row.f_tag
1174
- }
1175
- yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1176
- resolveMsg: null,
1177
- rejectMsg: '机表补卡失败!!'
1178
- })
1179
- }
1180
- Vue.showAlert(msg, 'danger', 0)
1181
- }
1182
- }
1183
- // 擦虚气
1184
- let replaceXq = function * (model, row) {
1185
- let result = null
1186
- let cardState = yield co(hasCardGen())
1187
- if (JSON.parse(cardState.data).state === 1) {
1188
- let params = {
1189
- factory: row.f_alias,
1190
- kh: row.f_card_id, // 卡号
1191
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1192
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1193
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1194
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1195
- ljgql: (row.f_total_gas - 0), // 当前累计购气量
1196
- ljgqje: (row.f_total_fee - 0), // 累计购气金额
1197
- kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1198
- bkcs: row.f_fillcard_times + 1, // 补卡次数,从补卡表里通过表编号获得
1199
- cs: row.f_times, // 求购气次数,先开户为1
1200
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号
1201
- meterid: row.f_meternumber, // 表号
1202
- meternumber: row.f_meternumber,
1203
- dqdm: row.f_area_code, // 精益工业地区代码
1204
- money: 0, // 购气金额
1205
- klx: row.f_coding
1206
- }
1207
- let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
1208
- resolveMsg: null,
1209
- rejectMsg: '擦虚气服务错误'
1210
- }, 80000))
1211
- if (cardRes.data.Err || cardRes.data.Exception) {
1212
- return {status: 1}
1213
- } else {
1214
- return {status: 0}
1215
- }
1216
- } else {
1217
- Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1218
- }
1219
- }
1220
-
1221
- // 补卡管理
1222
- let replaceCardGen = function * (model, row, allot) {
1223
- let result = null
1224
- let allotback
1225
- try {
1226
- // 判断是否有卡
1227
- let cardState = yield co(hasCardGen())
1228
- if (JSON.parse(cardState.data).state === 1) {
1229
- let cardId = row.f_card_id
1230
- // 如果当前是物联网表,表未发卡,进行补需要获取卡号
1231
- if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是' && (row.f_card_id == null || row.f_card_id === '')) {
1232
- let getCardNumber = yield Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {resolveMsg: null, rejectMsg: '发卡售气获取卡号失败!!'})
1233
- console.log('获取卡号、、', getCardNumber)
1234
- if (getCardNumber.data.cardNumber) {
1235
- cardId = getCardNumber.data.cardNumber
1236
- } else {
1237
- throw new Error('获取卡号失败!请核实参数管理中的卡号重新发卡售气。')
1238
- }
1239
- }
1240
- if (row.f_tag) {
1241
- // 截取用户编号后四位
1242
- cardId = row.f_tag + row.f_card_id
1243
- }
1244
- model.f_card_id = cardId
1245
- // 存库
1246
- result = yield co(reissueCardGen(model, row))
1247
- if (allot) {
1248
- allotback = yield Vue.resetpost('api/af-revenue/logic/saveAllotData', {data: allot}, {
1249
- resolveMsg: null,
1250
- rejectMsg: '更新发卡信息失败'
1251
- })
1252
- }
1253
- // 获取气价和售气情况参数
1254
- let cardParams = yield co(getParamGen(cardId, row.f_alias, row.f_user_id, row.f_userfiles_id))
1255
- console.log('补卡是写的次数111。。。。', row, model)
1256
- // 写卡
1257
- let params = {
1258
- factory: row.f_alias,
1259
- kh: cardId, // 卡号
1260
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1261
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1262
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1263
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1264
- ljgql: (row.f_total_gas - 0), // 当前累计购气量
1265
- ljgqje: (row.f_total_fee - 0), // 累计购气金额
1266
- kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1267
- bkcs: row.f_fillcard_times + 1, // 补卡次数,从补卡表里通过表编号获得
1268
- cs: row.f_times, // 求购气次数,先开户为1
1269
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号
1270
- meterid: row.f_meternumber, // 表号
1271
- meternumber: row.f_meternumber,
1272
- dqdm: row.f_area_code, // 精益工业地区代码
1273
- money: 0, // 购气金额
1274
- klx: row.f_coding
1275
- }
1276
- // 判断是否是累购表
1277
- if (row.f_support_purchase === '是') {
1278
- params.ljgql = (row.f_write_totalgas - 0)
1279
- params.ljgqje = (row.f_write_totalfee - 0)
1280
- }
1281
- // 判断是否接表,如果未接表(次数减一)已过表(次数为档案里面的次数) 针对不补气的
1282
- if (model.f_ispick_table) {
1283
- params.cs = (model.f_ispick_table === '未过表' ? row.f_times - 1 : row.f_times)
1284
- }
1285
-
1286
- params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1287
- // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1288
- // params.klx = yield co(getmodelbrandGen(row))
1289
- // params.klx = params.klx.data[0].f_coding
1290
- // }
1291
- console.log('补卡是写的次数。。。。', params)
1292
-
1293
- let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
1294
- resolveMsg: null,
1295
- rejectMsg: '补卡卡服务错误'
1296
- }, 80000))
1297
- // 卡服务写卡异常,业务逻辑回滚
1298
- if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1299
- Vue.$showAlert('补卡失败!!', 'danger', 0)
1300
- let rollbackParam = {
1301
- id: result.data.id,
1302
- f_card_id: row.f_card_id,
1303
- f_user_id: row.f_user_id
1304
- }
1305
- if (row.f_tag) {
1306
- rollbackParam.f_tag = row.f_tag
1307
- }
1308
- yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1309
- resolveMsg: null,
1310
- rejectMsg: null
1311
- })
1312
- // 更新卡状态为作废
1313
- if (allot) {
1314
- yield Vue.resetpost('api/af-revenue/logic/allotDataRollback', {data: allotback.data}, {resolveMsg: null, rejectMsg: null})
1315
- }
1316
- } else {
1317
- // 如果成功修改标识(更新状态为有效)
1318
- // 没有更新过表档案,这里版本号减一
1319
- row.version = (row.version - 0) - 1
1320
- yield co(Vue.CommonService.updatePassword(row, cardRes))
1321
- let data = {
1322
- userfiles: {},
1323
- record: {
1324
- id: result.data.id,
1325
- f_state: '有效'
1326
- }
1327
- }
1328
- return yield Vue.resetpost('api/af-revenue/logic/updatemark', {data: data}, {resolveMsg: '补卡成功', rejectMsg: '补卡修改状态失败'})
1329
- }
1330
- } else {
1331
- Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1332
- }
1333
- } catch (error) {
1334
- let msg = ''
1335
- if (error.status === 612) {
1336
- msg = '请检查读卡器时候连接,或者卡服务是否启动!!'
1337
- } else {
1338
- msg = '补卡失败!!'
1339
-
1340
- let rollbackParam = {
1341
- id: result.data.id,
1342
- f_card_id: row.f_card_id,
1343
- f_user_id: row.f_user_id
1344
- }
1345
- if (row.f_tag) {
1346
- rollbackParam.f_tag = row.f_tag
1347
- }
1348
- yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1349
- resolveMsg: null,
1350
- rejectMsg: '补卡失败!!'
1351
- })
1352
- }
1353
- // 更新卡状态为作废
1354
- if (allot) {
1355
- yield Vue.resetpost('api/af-revenue/logic/allotDataRollback', {data: allotback.data}, {resolveMsg: null, rejectMsg: null})
1356
- }
1357
- Vue.showAlert(msg, 'danger', 0)
1358
- }
1359
- }
1360
-
1361
- let offlineWriteGen2 = async function (row) {
1362
- let update = {
1363
- id: row.unWriteSell[0].id,
1364
- f_write_operator: Vue.$login.f.name,
1365
- f_write_date: Vue.$login.toStandardTimeString()
1366
- }
1367
- await Vue.resetpost('api/af-revenue/logic/offlineWrite', update, {resolveMsg: null, rejectMsg: '写卡成功,更新数据失败'})
1368
- }
1369
-
1370
- let offlineWriteGen = async function (row) {
1371
- console.log('线下写卡', row)
1372
- try {
1373
- // 写卡前调用(该为特殊业务逻辑根据需要写到project工程) (有些第三方缴费柜台写卡,用户缴费之后,如果在规定时间内不写卡,就会进行退款。所以写卡前调用第三方锁定订单。写卡成功或失败调用对应的接口告知第三方)
1374
-
1375
- let beforeParam = {
1376
- id: row.unWriteSell[0].id,
1377
- f_operatorid: Vue.$login.f.id,
1378
- f_depid: Vue.$login.f.depids
1379
- }
1380
-
1381
- await Vue.resetpost('api/af-revenue/logic/sale_write_before', {data: beforeParam}, {resolveMsg: null, rejectMsg: '线下写卡前调用第三方失败!!'})
1382
-
1383
- let cardState = await hasCardGen()
1384
- if (JSON.parse(cardState.data).state === 1) {
1385
- // 获取
1386
- let result = await Vue.resetpost('api/af-revenue/logic/sale_getLastOper', {data: {f_userfiles_id: row.f_userfiles_id}}, {resolveMsg: null, rejectMsg: '获取最后一次操作失败'})
1387
- console.log('获取最后一次的操作。。', result)
1388
- // 先把收费记录状态改成 已写卡在进行操作
1389
- // 写卡成功 更新收费记录
1390
- let update = {
1391
- id: row.unWriteSell[0].id,
1392
- f_write_comments: !row.f_write_comments ? '' : row.f_write_comments,
1393
- f_write_operator: Vue.$login.f.name,
1394
- f_write_date: Vue.$login.toStandardTimeString()
1395
- }
1396
- await Vue.resetpost('api/af-revenue/logic/offlineWrite', update, {resolveMsg: null, rejectMsg: '写卡成功,更新数据失败'})
1397
- let cardid = row.f_card_id
1398
- if (row.f_tag) {
1399
- // 截取用户编号后四位
1400
- cardid = row.f_tag + row.f_card_id
1401
- }
1402
- // 执行写卡操作
1403
- let cardParams = await getParamGen(row.f_card_id, row.f_alias, row.f_user_id, row.f_userfiles_id)
1404
- let param = {
1405
- factory: row.f_alias,
1406
- kh: cardid,
1407
- cs: row.unWriteSell[0].f_times,
1408
- yhh: row.cardInfo.Yhh ? row.cardInfo.Yhh : row.f_meterid,
1409
- meterid: row.f_meternumber ? row.f_meternumber : 0,
1410
- meternumber: row.f_meternumber ? row.f_meternumber : 0,
1411
- kmm: row.f_card_password,
1412
- ljgql: (row.f_write_totalgas - 0), // 当前累计购气量
1413
- ljgqje: (row.f_write_totalfee - 0), // 累计购气金额
1414
- bjql: row.f_police_gas,
1415
- czsx: row.f_topup_ceil,
1416
- tzed: row.f_overdr_lines,
1417
- bkcs: row.f_fillcard_times,
1418
- dqdm: row.f_area_code,
1419
- klx: row.f_coding,
1420
- ql: row.unWriteSell[0].f_pregas,
1421
- money: row.unWriteSell[0].f_write_money
1422
- }
1423
- param = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), param)
1424
- let cardRes
1425
- if (result.data.last_oper == null) result.data.last_oper = ''
1426
- if (row.states === '补卡' || result.data.last_oper === '补卡') {
1427
- param.kzt = result.data.ispick === '未过表' && result.data.lastsell_oper === '发卡售气' ? '0' : '1'
1428
- param.cs = row.cardInfo.Times + 1
1429
- param.bkcs = param.bkcs + 1
1430
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', param, {resolveMsg: null, rejectMsg: '写卡失败'}, 80000)
1431
- } else if (row.states === '换表') {
1432
- param.kzt = '0'
1433
- param.bkcs = param.bkcs + 1
1434
- param.cs = 1
1435
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', param, {resolveMsg: null, rejectMsg: '写卡失败'}, 80000)
1436
- } else {
1437
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', param, {resolveMsg: null, rejectMsg: '写卡失败'}, 80000)
1438
- }
1439
- if (!cardParams || cardRes.data.Err || cardRes.data.Exception) {
1440
- let sql = `update t_sellinggas set
1441
- f_write_card = '写卡失败'
1442
- where id = '${row.unWriteSell[0].id}'`
1443
- let data = {
1444
- sql: sql
1445
- }
1446
- await Vue.resetpost('api/af-revenue/logic/runSQL', data)
1447
- throw new Error(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`)
1448
- }
1449
- } else {
1450
- Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1451
- }
1452
- } catch (error) {
1453
- // 考虑到这里报错可能是因为 写卡请求超时报的错,但是请求已经发到卡服务,可能已经写上卡,所以先不做处理
1454
- // let sql = `update t_sellinggas set
1455
- // f_write_card = '未写卡',
1456
- // where id = '${row.unWriteSell[0].id}'`
1457
- // let data = {
1458
- // sql: sql
1459
- // }
1460
- // await this.$resetpost('api/af-revenue/logic/runSQL', data)
1461
- throw error
1462
- }
1463
- }
1464
-
1465
- let DigtialSellGasGen = async function (model, row) {
1466
- try {
1467
- let result = await Vue.resetpost('api/af-revenue/logic/sale_digtialCharge_logic', {data: model}, {resolveMsg: '收费成功', rejectMsg: '卡表收费存库失败'})
1468
- return result.data.id
1469
- } catch (error) {
1470
- if (error.data) {
1471
- throw new Error(error.data)
1472
- } else {
1473
- throw error
1474
- }
1475
- }
1476
- }
1477
- let noCardSellGasGen = async function (model, row) {
1478
- try {
1479
- let result = await Vue.resetpost('api/af-revenue/logic/sale_cardCharge_logic', {data: model}, {resolveMsg: '收费成功', rejectMsg: '卡表收费存库失败'})
1480
- return result.data.id
1481
- } catch (error) {
1482
- if (model.f_payment.indexOf('扫码枪支付') > -1) {
1483
- await Vue.resetpost('weixin2/rs/pay/jsApiRefund', {
1484
- data: {
1485
- out_trade_no: model.f_serial_id,
1486
- f_total_fee: model.f_collection,
1487
- flag: 'microPayRongHaoJsbc'
1488
- }
1489
- }, {resolveMsg: null, rejectMsg: '调用银行退费接口失败'})
1490
- }
1491
- if (error.data) {
1492
- throw new Error(error.data)
1493
- } else {
1494
- throw error
1495
- }
1496
- }
1497
- }
1498
-
1499
- // 补气卡表收费
1500
- let sellgasRemanentGen = async function (model, row) {
1501
- let result = null
1502
- try {
1503
- let cardState = await hasCardGen()
1504
- if (JSON.parse(cardState.data).state === 1) {
1505
- // 将卡上次数写入数据库
1506
- model.f_times = row.cardInfo.Times + 1
1507
- // 将回写表号或者用户号
1508
- model.f_meterid = row.cardInfo.Yhh ? row.cardInfo.Yhh : row.f_meterid
1509
-
1510
- let cardid = row.f_card_id
1511
- if (row.f_tag) {
1512
- // 截取用户编号后四位
1513
- cardid = model.f_card_id = row.f_tag + row.f_card_id
1514
- }
1515
- result = await Vue.resetpost('api/af-revenue/logic/sellgasRemanentGas', {data: model}, {resolveMsg: null, rejectMsg: '卡表收费存库失败'})
1516
- // 获取气价和售气情况参数
1517
- let cardParams = await getParamGen(cardid, row.f_alias, row.f_user_id, row.f_userfiles_id)
1518
- console.log('写卡次数和获取的写卡参数...', row.cardInfo.Times, cardParams)
1519
- // 写卡
1520
- let params = {
1521
- factory: row.f_alias, // 气表厂家
1522
- kh: cardid, // 卡号
1523
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
1524
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1525
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1526
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1527
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1528
- ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1529
- ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1530
- bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1531
- ql: model.f_pregas, // 预购气量
1532
- cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1533
- money: model.f_write_money, // 购气金额
1534
- meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1535
- dqdm: row.f_area_code, // 精益工业地区代码
1536
- klx: row.f_coding
1537
- }
1538
- params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1539
- console.log('购气最后操作。。', result)
1540
- let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'})
1541
- console.log('卡表收费返回写卡参数值', cardRes)
1542
- // 卡服务写卡异常,业务逻辑回滚
1543
- if (!cardParams || ((model.f_pregas > model.f_remanent_gas) && !result) || cardRes.data.Err || cardRes.data.Exception) {
1544
- let data = {
1545
- id: result.data.id,
1546
- userinfo: {
1547
- f_userinfo_id: row.f_userinfo_id,
1548
- version: row.userinfo_version + 1,
1549
- f_balance: row.f_balance,
1550
- userfiles: {
1551
- f_user_id: model.f_user_id,
1552
- f_userfiles_id: model.f_userfiles_id,
1553
- f_card_id: row.f_card_id,
1554
- f_total_gas: row.f_total_gas,
1555
- f_write_totalgas: row.f_write_totalgas,
1556
- f_write_totalfee: row.f_write_totalfee,
1557
- f_total_fee: row.f_total_fee,
1558
- f_times: row.cardInfo.Times,
1559
- version: row.version + 1
1560
- }
1561
- }
1562
- }
1563
- if (row.f_tag) {
1564
- data.userinfo.userfiles.f_tag = row.f_tag
1565
- }
1566
- await Vue.resetpost('api/af-revenue/logic/sellgasremanentRollback', {data: data}, {resolveMsg: null, rejectMsg: '卡表收费回滚出错!!'})
1567
- throw new Error(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`)
1568
- } else {
1569
- // 更新卡密码
1570
- await Vue.CommonService.updatePassword(row, cardRes)
1571
- Vue.showAlert('换表补气成功', 'success', 2000)
1572
- return result
1573
- }
1574
- } else {
1575
- throw new Error(`请检查卡是否插好!!`)
1576
- }
1577
- } catch (error) {
1578
- if (result) {
1579
- let data = {
1580
- sellid: result.data.sellid,
1581
- fillgasid: result.data.fillgasid,
1582
- userinfo: {
1583
- f_userinfo_id: row.f_userinfo_id,
1584
- version: row.userinfo_version + 1,
1585
- f_balance: row.f_balance,
1586
- userfiles: {
1587
- f_user_id: model.f_user_id,
1588
- f_total_gas: row.f_total_gas,
1589
- f_write_totalgas: row.f_write_totalgas,
1590
- f_write_totalfee: row.f_write_totalfee,
1591
- f_total_fee: row.f_total_fee,
1592
- f_card_id: row.f_card_id,
1593
- f_times: row.cardInfo.Times,
1594
- version: row.version + 1
1595
- }
1596
- }
1597
- }
1598
- if (row.f_tag) {
1599
- data.userinfo.userfiles.f_tag = row.f_tag
1600
- }
1601
- await Vue.resetpost('api/af-revenue/logic/sellgasremanentRollback', {data: data}, {resolveMsg: '卡表收费失败', rejectMsg: '卡表收费失败'})
1602
- }
1603
- throw error
1604
- }
1605
- }
1606
- // 余量补差
1607
- let marginGen = async function (model, row) {
1608
- let result = null
1609
- let cardparam
1610
- let cardpost
1611
- try {
1612
- let cardState = await hasCardGen()
1613
- if (JSON.parse(cardState.data).state === 1) {
1614
- // 将卡上次数写入数据库
1615
- if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_hascard === '是' && row.f_share_times === '是') {
1616
- row.cardInfo.Times = row.cardInfo.Times ? row.cardInfo.Times : row.f_times
1617
- model.f_times = row.f_times + 1
1618
- } else {
1619
- model.f_times = row.cardInfo.Times + 1
1620
- }
1621
- // 将回写表号或者用户号
1622
- model.f_meterid = row.cardInfo.Yhh ? row.cardInfo.Yhh : row.f_meterid
1623
-
1624
- let cardid = row.f_card_id
1625
- if (row.f_tag) {
1626
- // 截取用户编号后四位
1627
- cardid = model.f_card_id = row.f_tag + row.f_card_id
1628
- }
1629
- // 存库
1630
- result = await Vue.resetpost('api/af-revenue/logic/marginCharge', {data: model}, {resolveMsg: null, rejectMsg: '卡表收费存库失败'})
1631
- // 获取气价和售气情况参数
1632
- let cardParams = await getParamGen(cardid, row.f_alias, row.f_user_id, row.f_userfiles_id)
1633
- console.log('写卡次数和获取的写卡参数...', row.cardInfo.Times, cardParams)
1634
- // 写卡
1635
- let params = {
1636
- factory: row.f_alias, // 气表厂家
1637
- kh: cardid, // 卡号
1638
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
1639
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1640
- bjql: row.f_police_gas,
1641
- ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1642
- ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1643
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1644
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1645
- bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1646
- ql: model.f_pregas, // 预购气量
1647
- cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1648
- money: model.f_write_money, // 购气金额
1649
- dqdm: row.f_area_code, // 精益工业地区代码
1650
- klx: row.f_coding,
1651
- meterid: row.f_meternumber ? row.f_meternumber : 0 // 表号
1652
- }
1653
- params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1654
- // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1655
- // params.klx = yield co(getmodelbrandGen(row))
1656
- // params.klx = params.klx.data[0].f_coding
1657
- // }
1658
-
1659
- let params2 = {
1660
- factory: row.f_alias,
1661
- kh: cardid, // 卡号
1662
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1663
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1664
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1665
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1666
- ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1667
- ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1668
- kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1669
- bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1670
- ql: model.f_pregas, // 预购气量
1671
- cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1672
- sxrq: model.f_startdate, // 生效日期,价格管理中取
1673
- meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1674
- // meternumber: row.f_meternumber ? row.f_meternumber : 0, // 海力金额表号
1675
- dqdm: row.f_area_code, // 精益工业地区代码
1676
- money: model.f_write_money, // 购气金额
1677
- klx: row.f_coding
1678
- }
1679
-
1680
- params2 = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params2)
1681
- // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1682
- // params2.klx = yield co(getmodelbrandGen(row))
1683
- // params2.klx = params2.klx.data[0].f_coding
1684
- // }
1685
-
1686
- let params3 = {
1687
- factory: row.f_alias,
1688
- kh: cardid, // 卡号
1689
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1690
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1691
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1692
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1693
- ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1694
- ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1695
- kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1696
- bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1697
- ql: model.f_pregas, // 预购气量
1698
- cs: 1, // 求购气次数,先开户为1
1699
- sxrq: model.f_startdate, // 生效日期,价格管理中取
1700
- meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1701
- // meternumber: row.f_meternumber ? row.f_meternumber : 0, // 海力金额表号
1702
- dqdm: row.f_area_code, // 精益工业地区代码
1703
- money: model.f_write_money, // 购气金额
1704
- klx: row.f_coding
1705
- }
1706
- params3 = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params3)
1707
- // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1708
- // params3.klx = yield co(getmodelbrandGen(row))
1709
- // params3.klx = params3.klx.data[0].f_coding
1710
- // }
1711
- console.log('购气最后操作。。', result)
1712
- if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是') {
1713
- params.cs = row.f_times + 1
1714
- params2.cs = row.f_times + 1
1715
- }
1716
- let cardRes
1717
- if (result.data.last_oper === '补卡') {
1718
- // 此次验证开户之后未过表补卡验证问题
1719
- params2.kzt = result.data.ispick === '未过表' && result.data.lastsell_oper === '发卡售气' ? '0' : '1'
1720
- cardparam = JSON.stringify(params2)
1721
- cardpost = 'WriteNewCard'
1722
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params2, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1723
- } else if (result.data.last_oper === '换表') {
1724
- console.log('我走的是写新卡换表')
1725
- cardparam = JSON.stringify(params3)
1726
- cardpost = 'WriteNewCard'
1727
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params3, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1728
- } else if (result.data.last_oper === '换表补气') {
1729
- // 累购金额需要将上次购气金额加上
1730
- console.log('我走的是正常的收费', params)
1731
- cardparam = JSON.stringify(params)
1732
- cardpost = 'WriteGasCard'
1733
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1734
- } else {
1735
- console.log('我走的是正常的收费', params)
1736
- cardparam = JSON.stringify(params)
1737
- cardpost = 'WriteGasCard'
1738
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1739
- }
1740
- console.log('卡表收费返回写卡参数值', cardRes)
1741
- // 卡服务写卡异常,业务逻辑回滚
1742
- if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1743
- if (result) {
1744
- let data = {
1745
- cardparam: cardparam,
1746
- cardpost: cardpost,
1747
- id: result.data.id,
1748
- userinfo: {
1749
- f_userinfo_id: row.f_userinfo_id,
1750
- version: row.userinfo_version + 1,
1751
- f_balance: row.f_balance,
1752
- userfiles: {
1753
- f_user_id: model.f_user_id,
1754
- f_userfiles_id: row.f_userfiles_id,
1755
- f_total_gas: row.f_total_gas,
1756
- f_write_totalgas: row.f_write_totalgas,
1757
- f_write_totalfee: row.f_write_totalfee,
1758
- f_total_fee: row.f_total_fee,
1759
- f_card_id: row.f_card_id,
1760
- f_times: row.cardInfo.Times,
1761
- version: row.version + 1
1762
- }
1763
- }
1764
- }
1765
- if (row.f_tag) {
1766
- data.userinfo.userfiles.f_tag = row.f_tag
1767
- }
1768
- if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是') {
1769
- data.userinfo.userfiles.f_times = row.f_times
1770
- }
1771
- await Vue.resetpost('api/af-revenue/logic/cardChargeRollback', {data: data}, {resolveMsg: '卡表收费失败', rejectMsg: '卡表收费失败'})
1772
- }
1773
- throw `卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`
1774
- } else {
1775
- // 调用读卡进行校验
1776
- let readCardInfo = await Vue.resetpost('http://127.0.0.1:8003/ReadCard', {kmm: row.f_card_password}, {resolveMsg: null, rejectMsg: '读卡失败!!'})
1777
- if (readCardInfo.data && Vue.$login.r.includes('读卡2')) {
1778
- console.log('读卡验证', readCardInfo.data, row)
1779
- if (row.f_collection_type === '按金额') {
1780
- if (readCardInfo.data.Money !== model.f_preamount || readCardInfo.data.Factory !== row.f_alias || readCardInfo.data.CardID !== row.f_card_id) {
1781
- Vue.showAlert('读卡参数和缴费参数不一致,请核实!!', 'warning', 2000)
1782
- return result.data.id
1783
- }
1784
- } else {
1785
- if (readCardInfo.data.Gas !== Number((model.f_pregas - 0).toFixed(2)) || readCardInfo.data.Factory !== row.f_alias || readCardInfo.data.CardID !== row.f_card_id) {
1786
- Vue.showAlert('读卡参数和缴费参数不一致,请核实!!', 'warning', 2000)
1787
- return result.data.id
1788
- }
1789
- }
1790
- }
1791
- // 更新卡密码
1792
- await Vue.CommonService.updatePassword(row, cardRes)
1793
- Vue.showAlert('售气成功', 'success', 2000)
1794
- return result.data.id
1795
- }
1796
- } else {
1797
- throw new Error(`请检查卡是否插好!!`)
1798
- }
1799
- } catch (error) {
1800
- throw error
1801
- }
1802
- }
1803
- // 卡表收费
1804
- let sellgasGen = async function (model, row) {
1805
- let result = null
1806
- let cardparam
1807
- let cardpost
1808
- try {
1809
- let cardState = await hasCardGen()
1810
- if (JSON.parse(cardState.data).state === 1) {
1811
- // 将卡上次数写入数据库
1812
- if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_hascard === '是' && row.f_share_times === '是') {
1813
- row.cardInfo.Times = row.f_times
1814
- model.f_times = row.f_times + 1
1815
- } else {
1816
- model.f_times = row.cardInfo.Times + 1
1817
- }
1818
- // 将回写表号或者用户号
1819
- model.f_meterid = row.cardInfo.Yhh ? row.cardInfo.Yhh : row.f_meterid
1820
-
1821
- let cardid = row.f_card_id
1822
- if (row.f_tag) {
1823
- // 截取用户编号后四位
1824
- cardid = model.f_card_id = row.f_tag + row.f_card_id
1825
- }
1826
- // 存库
1827
- try {
1828
- result = await Vue.resetpost('api/af-revenue/logic/sale_cardCharge_logic', {data: model}, {resolveMsg: null, rejectMsg: '卡表收费存库失败'})
1829
- } catch (error) {
1830
- // 判断是否为扫码枪支付 如果是扫码枪支付 直接调用退费接口给用户进行退费处理
1831
- if (model.f_payment.indexOf('扫码枪支付') > -1) {
1832
- await Vue.resetpost('weixin2/rs/pay/jsApiRefund', {
1833
- data: {
1834
- out_trade_no: model.f_serial_id,
1835
- f_total_fee: model.f_collection,
1836
- flag: 'microPayRongHaoJsbc'
1837
- }
1838
- }, {resolveMsg: null, rejectMsg: '调用银行退费接口失败'})
1839
- }
1840
- throw error
1841
- }
1842
- // 获取气价和售气情况参数
1843
- let cardParams = await getParamGen(cardid, row.f_alias, row.f_user_id, row.f_userfiles_id)
1844
- console.log('写卡次数和获取的写卡参数...', row.cardInfo.Times, cardParams)
1845
- // 写卡
1846
- let params = {
1847
- factory: row.f_alias, // 气表厂家
1848
- kh: cardid, // 卡号
1849
- yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
1850
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1851
- bjql: row.f_police_gas,
1852
- ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1853
- ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1854
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1855
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1856
- bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1857
- ql: model.f_pregas, // 预购气量
1858
- cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1859
- money: model.f_write_money, // 购气金额
1860
- dqdm: row.f_area_code, // 精益工业地区代码
1861
- klx: row.f_coding,
1862
- meterid: row.f_meternumber ? row.f_meternumber : 0 // 表号
1863
- }
1864
- params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1865
- // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1866
- // params.klx = yield co(getmodelbrandGen(row))
1867
- // params.klx = params.klx.data[0].f_coding
1868
- // }
1869
-
1870
- let params2 = {
1871
- factory: row.f_alias,
1872
- kh: cardid, // 卡号
1873
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1874
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1875
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1876
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1877
- ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1878
- ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1879
- kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1880
- bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1881
- ql: model.f_pregas, // 预购气量
1882
- cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1883
- sxrq: model.f_startdate, // 生效日期,价格管理中取
1884
- meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1885
- // meternumber: row.f_meternumber ? row.f_meternumber : 0, // 海力金额表号
1886
- dqdm: row.f_area_code, // 精益工业地区代码
1887
- money: model.f_write_money, // 购气金额
1888
- klx: row.f_coding
1889
- }
1890
-
1891
- params2 = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params2)
1892
- // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1893
- // params2.klx = yield co(getmodelbrandGen(row))
1894
- // params2.klx = params2.klx.data[0].f_coding
1895
- // }
1896
-
1897
- let params3 = {
1898
- factory: row.f_alias,
1899
- kh: cardid, // 卡号
1900
- kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1901
- bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1902
- czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1903
- tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1904
- ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1905
- ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1906
- kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1907
- bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1908
- ql: model.f_pregas, // 预购气量
1909
- cs: 1, // 求购气次数,先开户为1
1910
- sxrq: model.f_startdate, // 生效日期,价格管理中取
1911
- meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1912
- // meternumber: row.f_meternumber ? row.f_meternumber : 0, // 海力金额表号
1913
- dqdm: row.f_area_code, // 精益工业地区代码
1914
- money: model.f_write_money, // 购气金额
1915
- klx: row.f_coding
1916
- }
1917
- params3 = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params3)
1918
- // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1919
- // params3.klx = yield co(getmodelbrandGen(row))
1920
- // params3.klx = params3.klx.data[0].f_coding
1921
- // }
1922
- console.log('购气最后操作。。', result)
1923
- if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是') {
1924
- params.cs = row.f_times + 1
1925
- params2.cs = row.f_times + 1
1926
- }
1927
- let cardRes
1928
- if (result.data.last_oper === '补卡') {
1929
- // 此次验证开户之后未过表补卡验证问题
1930
- params2.kzt = result.data.ispick === '未过表' && result.data.lastsell_oper === '发卡售气' ? '0' : '1'
1931
- cardparam = JSON.stringify(params2)
1932
- cardpost = 'WriteNewCard'
1933
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params2, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1934
- } else if (result.data.last_oper === '换表') {
1935
- console.log('我走的是写新卡换表')
1936
- cardparam = JSON.stringify(params3)
1937
- cardpost = 'WriteNewCard'
1938
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params3, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1939
- } else if (result.data.last_oper === '换表补气') {
1940
- // 累购金额需要将上次购气金额加上
1941
- console.log('我走的是正常的收费', params)
1942
- cardparam = JSON.stringify(params)
1943
- cardpost = 'WriteGasCard'
1944
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1945
- } else {
1946
- console.log('我走的是正常的收费', params)
1947
- cardparam = JSON.stringify(params)
1948
- cardpost = 'WriteGasCard'
1949
- cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1950
- }
1951
- console.log('卡表收费返回写卡参数值', cardRes)
1952
- // 卡服务写卡异常,业务逻辑回滚
1953
- if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1954
- if (result) {
1955
- let data = {
1956
- cardparam: cardparam,
1957
- cardpost: cardpost,
1958
- id: result.data.id,
1959
- userinfo: {
1960
- f_userinfo_id: row.f_userinfo_id,
1961
- version: row.userinfo_version + 1,
1962
- f_balance: row.f_balance,
1963
- userfiles: {
1964
- f_user_id: model.f_user_id,
1965
- f_userfiles_id: row.f_userfiles_id,
1966
- f_total_gas: row.f_total_gas,
1967
- f_write_totalgas: row.f_write_totalgas,
1968
- f_write_totalfee: row.f_write_totalfee,
1969
- f_total_fee: row.f_total_fee,
1970
- f_card_id: row.f_card_id,
1971
- f_times: row.cardInfo.Times,
1972
- version: row.version + 1
1973
- }
1974
- }
1975
- }
1976
- if (row.f_tag) {
1977
- data.userinfo.userfiles.f_tag = row.f_tag
1978
- }
1979
- if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是') {
1980
- data.userinfo.userfiles.f_times = row.f_times
1981
- }
1982
- await Vue.resetpost('api/af-revenue/logic/cardChargeRollback', {data: data}, {resolveMsg: '卡表收费失败', rejectMsg: '卡表收费失败'})
1983
- }
1984
- throw `卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`
1985
- } else {
1986
- // 调用读卡进行校验
1987
- let readCardInfo = await Vue.resetpost('http://127.0.0.1:8003/ReadCard', {kmm: row.f_card_password}, {resolveMsg: null, rejectMsg: '读卡失败!!'})
1988
- if (readCardInfo.data && Vue.$login.r.includes('读卡2')) {
1989
- console.log('读卡验证', readCardInfo.data, row)
1990
- if (row.f_collection_type === '按金额') {
1991
- if (readCardInfo.data.Money !== model.f_preamount || readCardInfo.data.Factory !== row.f_alias || readCardInfo.data.CardID !== row.f_card_id) {
1992
- Vue.showAlert('读卡参数和缴费参数不一致,请核实!!', 'warning', 2000)
1993
- return result.data.id
1994
- }
1995
- } else {
1996
- if (readCardInfo.data.Gas !== Number((model.f_pregas - 0).toFixed(2)) || readCardInfo.data.Factory !== row.f_alias || readCardInfo.data.CardID !== row.f_card_id) {
1997
- Vue.showAlert('读卡参数和缴费参数不一致,请核实!!', 'warning', 2000)
1998
- return result.data.id
1999
- }
2000
- }
2001
- }
2002
- // 更新卡密码
2003
- await Vue.CommonService.updatePassword(row, cardRes)
2004
- Vue.showAlert('售气成功', 'success', 2000)
2005
- return result.data.id
2006
- }
2007
- } else {
2008
- throw new Error(`请检查卡是否插好!!`)
2009
- }
2010
- } catch (error) {
2011
- throw error
2012
- }
2013
- }
2014
- let reissueCardGenJB = function * (model, row) {
2015
- if (model.f_cardfees === '') {
2016
- model.f_cardfees = 0
2017
- }
2018
- let data = {
2019
- f_user_id: row.f_user_id,
2020
- f_userfiles_id: row.f_userfiles_id,
2021
- f_user_type: row.f_user_type,
2022
- f_gasproperties: row.f_gasproperties,
2023
- f_address: row.f_address,
2024
- f_meter_brand: row.f_meter_brand,
2025
- f_type: model.f_type,
2026
- f_card_id: model.f_card_id,
2027
- f_ispick_table: model.f_ispick_table,
2028
- f_cardfees: model.f_cardfees,
2029
- f_payment: model.f_payment[0],
2030
- f_bill_style: model.f_print[0],
2031
- f_comments: model.f_comments,
2032
- record_userinfo: row.f_userinfo_id,
2033
- f_userinfo_id: row.f_userinfo_id,
2034
- f_user_name: row.f_user_name,
2035
- f_operat_type: '补卡',
2036
- f_describe: `${Vue.$login.f.name}对客户${row.f_user_name}进行${row.f_type}操作`,
2037
- f_state: '有效',
2038
- f_operator: Vue.$login.f.name,
2039
- f_operatorid: Vue.$login.f.id,
2040
- f_orgid: Vue.$login.f.orgid,
2041
- f_orgname: Vue.$login.f.orgs,
2042
- f_depid: Vue.$login.f.depids,
2043
- f_depname: Vue.$login.f.deps,
2044
- f_zoneid: Vue.$login.f.zoneid,
2045
- f_zones: Vue.$login.f.zones,
2046
- f_business_tracking_number: model.f_business_tracking_number
2047
- }
2048
-
2049
- return Vue.resetpost('api/af-revenue/logic/sale_fillCard', data, {resolveMsg: null, rejectMsg: '补卡存库失败'})
2050
- }
2051
- let reissueCardGen = function * (model, row) {
2052
- if (model.f_cardfees === '') {
2053
- model.f_cardfees = 0
2054
- }
2055
- if (!model.f_fill_type) {
2056
- model.f_fill_type = ['']
2057
- }
2058
- let data = {
2059
- f_serial_id: model.f_serial_id,
2060
- f_user_id: row.f_user_id,
2061
- f_userfiles_id: row.f_userfiles_id,
2062
- f_user_type: row.f_user_type,
2063
- f_gasproperties: row.f_gasproperties,
2064
- f_address: row.f_address,
2065
- f_meter_brand: row.f_meter_brand,
2066
- f_type: model.f_type,
2067
- f_card_id: model.f_card_id,
2068
- f_ispick_table: model.f_ispick_table,
2069
- f_cardfees: model.f_cardfees,
2070
- f_payment: model.f_payment[0],
2071
- f_bill_style: model.f_print[0],
2072
- f_fill_type: model.f_fill_type[0],
2073
- f_comments: model.f_comments,
2074
- record_userinfo: row.f_userinfo_id,
2075
- f_userinfo_id: row.f_userinfo_id,
2076
- f_user_name: row.f_user_name,
2077
- f_operat_type: '补卡',
2078
- f_describe: `${Vue.$login.f.name}对客户${row.f_user_name}进行补卡操作`,
2079
- f_state: '有效',
2080
- f_operator: Vue.$login.f.name,
2081
- f_operatorid: Vue.$login.f.id,
2082
- f_orgid: Vue.$login.f.orgid,
2083
- f_orgname: Vue.$login.f.orgs,
2084
- f_depid: Vue.$login.f.depids,
2085
- f_depname: Vue.$login.f.deps,
2086
- f_zoneid: Vue.$login.f.zoneid,
2087
- f_zones: Vue.$login.f.zones,
2088
- f_business_tracking_number: model.f_business_tracking_number
2089
- }
2090
-
2091
- return Vue.resetpost('api/af-revenue/logic/sale_fillCard', data, {resolveMsg: null, rejectMsg: '补卡存库失败'})
2092
- }
2093
-
2094
- let getParamGen = async function (cardid, alias, f_user_id, f_userfiles_id) {
2095
- let data = {
2096
- f_card_id: cardid + '',
2097
- f_alias: alias,
2098
- f_user_id: f_user_id,
2099
- f_userfiles_id: f_userfiles_id
2100
- }
2101
- return Vue.resetpost('api/af-revenue/logic/stairCard', {data: data}, {resolveMsg: null, rejectMsg: '获取写卡参数失败'})
2102
- }
2103
-
2104
- let getCardNumberGen = async function (brand_id) {
2105
- return Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: brand_id}}, {resolveMsg: null, rejectMsg: '发卡售气获取卡号失败!!'})
2106
- }
2107
-
2108
- // 指令写卡
2109
- // 目前支持 承德海力物联网表
2110
- let instructWriteCardGen = function * (row) {
2111
- try {
2112
- // 判断是否有卡
2113
- let cardState = yield co(hasCardGen())
2114
- if (JSON.parse(cardState.data).state === 1) {
2115
- // 写卡
2116
- let params = {
2117
- kh: row.f_meternumber,
2118
- meterid: row.f_meternumber,
2119
- factory: row.f_alias
2120
- }
2121
- let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
2122
- resolveMsg: null,
2123
- rejectMsg: '补卡卡服务错误'
2124
- }))
2125
- // 卡服务写卡异常,业务逻辑回滚
2126
- if (cardRes.data.Err || cardRes.data.Exception) {
2127
- Vue.$showAlert('指令写卡失败!!', 'danger', 0)
2128
- } else {
2129
- return cardRes
2130
- }
2131
- } else {
2132
- Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
2133
- return 0
2134
- }
2135
- } catch (error) {
2136
- let msg = ''
2137
- if (error.status === 612) {
2138
- msg = '请检查读卡器时候连接,或者卡服务是否启动!!'
2139
- }
2140
- Vue.showAlert(msg, 'danger', 0)
2141
- return 0
2142
- }
2143
- }
2144
- export default CardService
1
+ import Vue from 'vue'
2
+ import co from 'co'
3
+
4
+ let CardService = {
5
+ install (Vue, options) {
6
+ // 给vue增添对话框显示方法
7
+ Vue.CardService = Vue.prototype.$CardService = CardService
8
+ },
9
+ // 判断是否插卡
10
+ hasCard () {
11
+ let has = hasCardGen()
12
+ return co(has)
13
+ },
14
+ // 读卡
15
+ readCard () {
16
+ let read = readCard()
17
+ return co(read)
18
+ },
19
+ // 指令写卡
20
+ // 目前支持 承德海力物联网表
21
+ instructWriteCard (row) {
22
+ let read = instructWriteCardGen(row)
23
+ return co(read)
24
+ },
25
+ // 开户发卡
26
+ initCard (model, row, allot) {
27
+ // let init = initCardGen(model, row, allot ? this.getallotdata(allot, row, '发卡售气') : null)
28
+ // return co(init)
29
+
30
+ let f_serial_number = ''
31
+ let f_price = ''
32
+ let inputprice = '0'
33
+ if (model.f_serial_number) {
34
+ f_serial_number = model.f_serial_number
35
+ }
36
+ if (model.f_price && (model.f_price - 0) > 0) {
37
+ f_price = model.f_price
38
+ inputprice = '1'
39
+ }
40
+ let f_privilege_gas = 0
41
+ if (model.f_privilege_gas) {
42
+ f_privilege_gas = model.f_privilege_gas
43
+ }
44
+ let param = {
45
+ f_alias: row.f_alias,
46
+ garbage_number: model.garbage_number,
47
+ garbage_money: model.garbage_money,
48
+ f_serial_id: model.f_serial_id,
49
+ f_userinfo_id: row.f_userinfo_id,
50
+ f_serial_number: f_serial_number,
51
+ f_user_id: row.f_user_id,
52
+ f_price: f_price,
53
+ inputprice: inputprice,
54
+ f_userfiles_id: row.f_userfiles_id,
55
+ f_pregas: model.f_pregas,
56
+ f_preamount: model.f_preamount,
57
+ f_balance: row.f_balance,
58
+ f_meter_type: row.f_meter_type,
59
+ f_calculation: row.f_calculation,
60
+ f_collection_type: row.f_collection_type,
61
+ f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
62
+ f_write_money: model.xiekamoney,
63
+ f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
64
+ f_write_totalfee: (row.f_write_totalfee - 0) + (model.xiekamoney - 0),
65
+ f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
66
+ f_open_fee: model.f_open_fee,
67
+ f_collection: model.f_collection,
68
+ f_payment: model.f_payment.toString(),
69
+ payments: model.payments,
70
+ f_print: model.f_print.toString(),
71
+ f_voucher_number: model.f_voucher_number,
72
+ userinfo_version: row.userinfo_version,
73
+ version: row.version,
74
+ // 优惠金额
75
+ f_privilege_money: model.f_privilege_money,
76
+ f_privilege_gas: f_privilege_gas,
77
+ f_after_discount: model.f_after_discount,
78
+
79
+ f_operator: Vue.$login.f.name,
80
+ f_operatorid: Vue.$login.f.id,
81
+ f_orgid: Vue.$login.f.orgid,
82
+ f_orgname: Vue.$login.f.orgs,
83
+ f_depid: Vue.$login.f.depids,
84
+ f_depname: Vue.$login.f.deps,
85
+ f_zoneid: Vue.$login.f.zoneid,
86
+ f_zones: Vue.$login.f.zones,
87
+ f_comments: model.f_comments
88
+ }
89
+ console.log('发卡售气前参数', row)
90
+ return sendCardSaleGasGen(param, row)
91
+ },
92
+ resetinitCard (model, row) {
93
+ let f_serial_number = ''
94
+ let f_price = ''
95
+ let inputprice = '0'
96
+ if (model.f_serial_number) {
97
+ f_serial_number = model.f_serial_number
98
+ }
99
+ if (model.f_price && (model.f_price - 0) > 0) {
100
+ f_price = model.f_price
101
+ inputprice = '1'
102
+ }
103
+ let f_privilege_gas = 0
104
+ if (model.f_privilege_gas) {
105
+ f_privilege_gas = model.f_privilege_gas
106
+ }
107
+ let param = {
108
+ f_serial_id: model.f_serial_id,
109
+ f_userinfo_id: row.f_userinfo_id,
110
+ f_user_name: row.f_user_name,
111
+ f_serial_number: f_serial_number,
112
+ f_user_id: row.f_user_id,
113
+ f_price: f_price,
114
+ inputprice: inputprice,
115
+ f_userfiles_id: row.f_userfiles_id,
116
+ f_pregas: model.f_pregas,
117
+ f_preamount: model.f_preamount,
118
+ f_balance: row.f_balance,
119
+ f_meter_type: row.f_meter_type,
120
+ f_calculation: row.f_calculation,
121
+ f_collection_type: row.f_collection_type,
122
+ f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
123
+ f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
124
+ f_write_totalfee: (row.f_write_totalfee - 0) + (model.f_preamount - 0),
125
+ f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
126
+ f_open_fee: model.f_open_fee,
127
+ f_collection: model.f_collection,
128
+ // f_print: model.f_print.toString(),
129
+ f_user_type: row.f_user_type,
130
+ f_gasproperties: row.f_gasproperties,
131
+ f_address: row.f_address,
132
+ f_meter_brand: row.f_meter_brand,
133
+ f_voucher_number: model.f_voucher_number,
134
+ userinfo_version: row.userinfo_version,
135
+ version: row.version,
136
+
137
+ f_operator: Vue.$login.f.name,
138
+ f_operatorid: Vue.$login.f.id,
139
+ f_orgid: Vue.$login.f.orgid,
140
+ f_orgname: Vue.$login.f.orgs,
141
+ f_depid: Vue.$login.f.depids,
142
+ f_depname: Vue.$login.f.deps,
143
+ f_zoneid: Vue.$login.f.zoneid,
144
+ f_zones: Vue.$login.f.zones,
145
+ f_comments: model.f_comments
146
+ }
147
+ console.log('重发卡售气前参数', row)
148
+ return resetsendCardSaleGasGen(param, row)
149
+ },
150
+ // 补气开户发卡
151
+ remanentinitCard (model, row, allot) {
152
+ let param = {
153
+ f_share_times: row.f_share_times,
154
+ f_hascard: row.f_hascard,
155
+ f_open_way: row.f_open_type,
156
+ f_serial_id: model.f_serial_id,
157
+ f_userinfo_id: row.f_userinfo_id,
158
+ f_user_id: row.f_user_id,
159
+ // 补气量
160
+ f_fill_gas: model.f_fill_gas,
161
+ f_fill_money: model.f_fill_money,
162
+ f_remanent_gas: row.f_remanent_gas === 0 ? model.f_fill_gas : row.f_remanent_gas,
163
+ f_remanent_price: row.f_remanent_price,
164
+ f_remanent_money: row.f_remanent_money === 0 ? model.f_fill_money : row.f_remanent_money,
165
+ f_remanent_type: row.f_remanent_type,
166
+ f_userfiles_id: row.f_userfiles_id,
167
+ f_user_name: row.f_user_name,
168
+ f_user_type: row.f_user_type,
169
+ f_gasproperties: row.f_gasproperties,
170
+ f_address: row.f_address,
171
+ f_meter_brand: row.f_meter_brand,
172
+ f_meter_type: row.f_meter_type,
173
+ f_collection_type: row.f_collection_type,
174
+ // 购气量
175
+ f_pregas: (model.f_pregas - 0) === 0 ? model.f_fill_gas : (model.f_pregas - 0),
176
+ f_preamount: (model.f_preamount - 0) === 0 ? model.f_fill_money : (model.f_preamount - 0),
177
+ f_totalcost: model.f_totalcost - 0,
178
+ f_balance: row.f_balance,
179
+ f_open_fee: model.f_open_fee,
180
+ f_collection: model.f_collection,
181
+ f_payment: model.f_payment.toString(),
182
+ payments: model.payments,
183
+ f_print: model.f_print.toString(),
184
+ f_voucher_number: model.f_voucher_number,
185
+ userinfo_version: row.userinfo_version,
186
+ version: row.version,
187
+ f_operator: Vue.$login.f.name,
188
+ f_operatorid: Vue.$login.f.id,
189
+ f_orgid: Vue.$login.f.orgid,
190
+ f_orgname: Vue.$login.f.orgs,
191
+ f_depid: Vue.$login.f.depids,
192
+ f_depname: Vue.$login.f.deps,
193
+ f_zoneid: Vue.$login.f.zoneid,
194
+ f_zones: Vue.$login.f.zones,
195
+ f_comments: model.f_comments
196
+ }
197
+
198
+ if (row.f_remanent_type === 1) {
199
+ param.f_total_gas = (row.f_total_gas - 0) + (model.f_pregas - 0)
200
+ param.f_total_fee = (row.f_total_fee - 0) + (model.f_preamount - 0)
201
+ } else {
202
+ if ((model.f_pregas - 0) > (model.f_fill_gas - 0)) {
203
+ param.f_total_gas = (row.f_total_gas - 0) + ((model.f_pregas - 0) - (model.f_fill_gas - 0))
204
+ param.f_total_fee = (row.f_total_fee - 0) + (model.f_preamount - 0)
205
+ } else {
206
+ param.f_total_gas = (row.f_total_gas - 0)
207
+ param.f_total_fee = (row.f_total_fee - 0)
208
+ }
209
+ }
210
+ param.f_write_totalgas = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
211
+ param.f_write_totalfee = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
212
+ return sendCardSaleGasGenremanent(param, row)
213
+ },
214
+
215
+ offlineWrite (row) {
216
+ return offlineWriteGen(row)
217
+ },
218
+ // 余量补差
219
+ margin (model, row) {
220
+ let f_serial_number = ''
221
+ let f_price = ''
222
+ let inputprice = '0'
223
+ let f_privilege_gas = 0
224
+ if (model.f_serial_number) {
225
+ f_serial_number = model.f_serial_number
226
+ }
227
+ if (model.f_price && (model.f_price - 0) > 0) {
228
+ f_price = model.f_price
229
+ inputprice = '1'
230
+ }
231
+ if (model.f_privilege_gas) {
232
+ f_privilege_gas = model.f_privilege_gas
233
+ }
234
+ let param = {
235
+ garbage_number: model.garbage_number,
236
+ garbage_money: model.garbage_money,
237
+ f_serial_id: model.f_serial_id,
238
+ f_userinfo_id: row.f_userinfo_id,
239
+ f_serial_number: f_serial_number,
240
+ f_write_money: model.xiekamoney,
241
+ f_price: f_price,
242
+ inputprice: inputprice,
243
+ // 补气量
244
+ f_remanent_gas: row.f_remanent_gas,
245
+ f_remanent_price: row.f_remanent_price,
246
+ f_user_id: row.f_user_id,
247
+ f_calculation: row.f_calculation,
248
+ f_collection_type: row.f_collection_type,
249
+ f_userfiles_id: row.f_userfiles_id,
250
+ f_pregas: model.f_pregas,
251
+ f_totalcost: model.f_totalcost,
252
+ f_balance: row.f_balance,
253
+ f_meter_type: row.f_meter_type,
254
+ f_preamount: model.f_preamount,
255
+ f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
256
+ f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
257
+ f_write_totalfee: (row.f_write_totalfee - 0) + (model.xiekamoney - 0),
258
+ f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
259
+ f_collection: model.f_collection,
260
+ // 优惠金额
261
+ f_privilege_money: model.f_privilege_money,
262
+ f_privilege_gas: f_privilege_gas,
263
+ f_after_discount: model.f_after_discount,
264
+ f_payment: model.f_payment.toString(),
265
+ payments: model.payments,
266
+ f_print: model.f_print.toString(),
267
+ f_voucher_number: model.f_voucher_number,
268
+ userinfo_version: row.userinfo_version,
269
+ version: row.version,
270
+ isGasValue: model.f_pregas ? 0 : 1,
271
+ f_meter_base: row.f_meter_base,
272
+ f_operator: Vue.$login.f.name,
273
+ f_operatorid: Vue.$login.f.id,
274
+ f_orgid: Vue.$login.f.orgid,
275
+ f_orgname: Vue.$login.f.orgs,
276
+ f_depid: Vue.$login.f.depids,
277
+ f_depname: Vue.$login.f.deps,
278
+ f_zoneid: Vue.$login.f.zoneid,
279
+ f_zones: Vue.$login.f.zones,
280
+ f_comments: model.f_comments,
281
+ f_sys_balance: model.f_sys_balance
282
+ }
283
+ return marginGen(param, row)
284
+ },
285
+ // 卡表收费
286
+ sellgas (model, row) {
287
+ let f_serial_number = ''
288
+ let f_price = ''
289
+ let inputprice = '0'
290
+ let f_privilege_gas = 0
291
+ if (model.f_serial_number) {
292
+ f_serial_number = model.f_serial_number
293
+ }
294
+ if (model.f_price && (model.f_price - 0) > 0) {
295
+ f_price = model.f_price
296
+ inputprice = '1'
297
+ }
298
+ if (model.f_privilege_gas) {
299
+ f_privilege_gas = model.f_privilege_gas
300
+ }
301
+ let param = {
302
+ f_alias: row.f_alias,
303
+ garbage_number: model.garbage_number,
304
+ garbage_money: model.garbage_money,
305
+ f_serial_id: model.f_serial_id,
306
+ f_userinfo_id: row.f_userinfo_id,
307
+ f_serial_number: f_serial_number,
308
+ f_write_money: model.xiekamoney,
309
+ f_price: f_price,
310
+ inputprice: inputprice,
311
+ // 补气量
312
+ f_remanent_gas: row.f_remanent_gas,
313
+ f_remanent_price: row.f_remanent_price,
314
+ f_user_id: row.f_user_id,
315
+ f_calculation: row.f_calculation,
316
+ f_collection_type: row.f_collection_type,
317
+ f_userfiles_id: row.f_userfiles_id,
318
+ f_pregas: model.f_pregas,
319
+ f_totalcost: model.f_totalcost,
320
+ f_balance: row.f_balance,
321
+ f_meter_type: row.f_meter_type,
322
+ f_preamount: model.f_preamount,
323
+ f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
324
+ f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
325
+ f_write_totalfee: (row.f_write_totalfee - 0) + (model.xiekamoney - 0),
326
+ f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
327
+ f_collection: model.f_collection,
328
+ // 优惠金额
329
+ f_privilege_money: model.f_privilege_money,
330
+ f_privilege_gas: f_privilege_gas,
331
+ f_after_discount: model.f_after_discount,
332
+ f_payment: model.f_payment.toString(),
333
+ payments: model.payments,
334
+ f_print: model.f_print.toString(),
335
+ f_voucher_number: model.f_voucher_number,
336
+ userinfo_version: row.userinfo_version,
337
+ version: row.version,
338
+ f_meter_base: row.f_meter_base,
339
+ f_operator: Vue.$login.f.name,
340
+ f_operatorid: Vue.$login.f.id,
341
+ f_orgid: Vue.$login.f.orgid,
342
+ f_orgname: Vue.$login.f.orgs,
343
+ f_depid: Vue.$login.f.depids,
344
+ f_depname: Vue.$login.f.deps,
345
+ f_zoneid: Vue.$login.f.zoneid,
346
+ f_zones: Vue.$login.f.zones,
347
+ f_comments: model.f_comments,
348
+ f_sys_balance: model.f_sys_balance,
349
+ deduct: model.getDeduct
350
+ }
351
+ return sellgasGen(param, row)
352
+ },
353
+
354
+ // 补气卡表收费
355
+ remanentsellgas (model, row) {
356
+ let param = {
357
+ f_user_name: row.f_user_name,
358
+ f_user_type: row.f_user_type,
359
+ f_gasproperties: row.f_gasproperties,
360
+ f_userinfo_id: row.f_userinfo_id,
361
+ f_address: row.f_address,
362
+ f_meter_brand: row.f_meter_brand,
363
+ f_meter_type: row.f_meter_type,
364
+ f_meternumber: row.f_meternumber,
365
+ f_collection_type: row.f_collection_type,
366
+ f_card_id: row.f_card_id,
367
+ f_write_money: model.xiekamoney,
368
+ // 补气信息
369
+ f_fill_gas: model.f_fill_gas,
370
+ f_fill_money: model.f_fill_money,
371
+
372
+ f_remanent_gas: row.f_remanent_gas,
373
+ f_remanent_price: row.f_remanent_price,
374
+ f_remanent_type: row.f_remanent_type,
375
+ f_user_id: row.f_user_id,
376
+ f_userfiles_id: row.f_userfiles_id,
377
+ f_pregas: model.f_pregas,
378
+ f_balance: row.f_balance,
379
+ f_preamount: model.f_preamount,
380
+ f_totalcost: model.f_totalcost,
381
+ f_collection: model.f_collection,
382
+ f_payment: model.f_payment.toString(),
383
+ payments: model.payments,
384
+ f_print: model.f_print.toString(),
385
+ f_voucher_number: model.f_voucher_number,
386
+ userinfo_version: row.userinfo_version,
387
+ version: row.version,
388
+ f_operator: Vue.$login.f.name,
389
+ f_operatorid: Vue.$login.f.id,
390
+ f_orgid: Vue.$login.f.orgid,
391
+ f_orgname: Vue.$login.f.orgs,
392
+ f_depid: Vue.$login.f.depids,
393
+ f_depname: Vue.$login.f.deps,
394
+ f_zoneid: Vue.$login.f.zoneid,
395
+ f_zones: Vue.$login.f.zones,
396
+ f_comments: model.f_comments
397
+ }
398
+
399
+ // 0:代表清零补气, 累购量不加 1:代表换表补气 累购量加
400
+ if (row.f_remanent_type === 1) {
401
+ param.f_total_gas = (row.f_total_gas - 0) + (model.f_pregas - 0)
402
+ param.f_total_fee = (row.f_total_fee - 0) + (model.f_preamount - 0)
403
+ } else {
404
+ if (model.f_pregas > row.f_remanent_gas) {
405
+ param.f_total_gas = (row.f_total_gas - 0) + (model.f_pregas - row.f_remanent_gas)
406
+ param.f_total_fee = (row.f_total_fee - 0) + (model.f_preamount - 0)
407
+ } else {
408
+ param.f_total_gas = (row.f_total_gas - 0)
409
+ param.f_total_fee = (row.f_total_fee - 0)
410
+ }
411
+ }
412
+ param.f_write_totalgas = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
413
+ param.f_write_totalfee = (row.f_write_totalfee - 0) + (model.xiekamoney - 0)
414
+ return sellgasRemanentGen(param, row)
415
+ },
416
+ // 数码表收费
417
+ DigtialSellGas (model, row) {
418
+ let f_serial_number = ''
419
+ if (model.f_serial_number) {
420
+ f_serial_number = model.f_serial_number
421
+ }
422
+ let param = {
423
+ f_userinfo_id: row.f_userinfo_id,
424
+ f_serial_number: f_serial_number,
425
+ f_user_id: row.f_user_id,
426
+ f_userfiles_id: row.f_userfiles_id,
427
+ f_pregas: model.f_pregas,
428
+ f_write_money: model.f_write_money,
429
+ f_balance: row.f_balance,
430
+ f_preamount: model.f_preamount,
431
+ f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
432
+ f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
433
+ f_write_totalfee: (row.f_write_totalfee - 0) + (model.f_write_money - 0),
434
+ f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
435
+ f_collection: model.f_collection,
436
+ f_payment: model.f_payment.toString(),
437
+ payments: model.payments,
438
+ f_print: model.f_print.toString(),
439
+ f_voucher_number: model.f_voucher_number,
440
+ userinfo_version: row.userinfo_version,
441
+ version: row.version,
442
+ f_operator: Vue.$login.f.name,
443
+ f_operatorid: Vue.$login.f.id,
444
+ f_orgid: Vue.$login.f.orgid,
445
+ f_orgname: Vue.$login.f.orgs,
446
+ f_depid: Vue.$login.f.depids,
447
+ f_depname: Vue.$login.f.deps,
448
+ f_zoneid: Vue.$login.f.zoneid,
449
+ f_zones: Vue.$login.f.zones
450
+
451
+ }
452
+
453
+ return DigtialSellGasGen(param, row)
454
+ },
455
+ // 无卡收费
456
+ noCardSellGas (model, row) {
457
+ let f_serial_number = ''
458
+ if (model.f_serial_number) {
459
+ f_serial_number = model.f_serial_number
460
+ }
461
+ let f_write_card = ''
462
+ if (model.f_write_card) {
463
+ f_write_card = model.f_write_card
464
+ }
465
+ let param = {
466
+ f_userinfo_id: row.f_userinfo_id,
467
+ f_serial_number: f_serial_number,
468
+ f_user_id: row.f_user_id,
469
+ f_userfiles_id: row.f_userfiles_id,
470
+ f_pregas: model.f_pregas,
471
+ f_write_money: model.f_write_money,
472
+ f_balance: row.f_balance,
473
+ f_preamount: model.f_preamount,
474
+ f_total_gas: (row.f_total_gas - 0) + (model.f_pregas - 0),
475
+ f_write_totalgas: (row.f_write_totalgas - 0) + (model.f_pregas - 0),
476
+ f_write_totalfee: (row.f_write_totalfee - 0) + (model.f_write_money - 0),
477
+ f_total_fee: (row.f_total_fee - 0) + (model.f_preamount - 0),
478
+ f_collection: model.f_collection,
479
+ f_payment: model.f_payment.toString(),
480
+ payments: model.payments,
481
+ f_print: model.f_print.toString(),
482
+ f_voucher_number: model.f_voucher_number,
483
+ userinfo_version: row.userinfo_version,
484
+ version: row.version,
485
+ f_write_card: f_write_card === '不写卡' ? '不写卡' : '未写卡',
486
+ f_operator: Vue.$login.f.name,
487
+ f_operatorid: Vue.$login.f.id,
488
+ f_orgid: Vue.$login.f.orgid,
489
+ f_orgname: Vue.$login.f.orgs,
490
+ f_depid: Vue.$login.f.depids,
491
+ f_depname: Vue.$login.f.deps,
492
+ f_zoneid: Vue.$login.f.zoneid,
493
+ f_zones: Vue.$login.f.zones
494
+
495
+ }
496
+
497
+ return noCardSellGasGen(param, row)
498
+ },
499
+
500
+ // 补卡写卡
501
+ replaceCard (model, row, allot) {
502
+ // 磁条卡走了 replaceCiTiaoCard 不走这里
503
+ // if (row.f_meter_type.indexOf('卡表') === -1 && row.f_meter_type.indexOf('物联网表') === -1) {
504
+ // model.f_type = '补磁条卡'
505
+ // let replace = replaceCiTiaoCardGen(model, row)
506
+ // return co(replace)
507
+ // }
508
+ let replace = replaceCardGen(model, row, allot ? this.getallotdata(allot, row, '补卡') : null)
509
+ return co(replace)
510
+ },
511
+ // 磁条卡补卡写卡
512
+ replaceCiTiaoCard (model, row, allot) {
513
+ let replace = replaceCiTiaoCardGen(model, row)
514
+ return co(replace)
515
+ },
516
+ // 机表写卡
517
+ replaceCardJB (model, row) {
518
+ let replace = replaceCardGenJB(model, row)
519
+ return co(replace)
520
+ },
521
+ // 物联网写卡
522
+ replaceCardWeb (model, row) {
523
+ let replace = replaceCardGenWeb(model, row)
524
+ return co(replace)
525
+ },
526
+ replacecXq (model, row) {
527
+ let replace = replaceXq(model, row)
528
+ return co(replace)
529
+ }
530
+ }
531
+
532
+ // 判断是否有卡插入
533
+ let hasCardGen = async function () {
534
+ return await Vue.resetpost('http://127.0.0.1:8003/HasCard', {}, {resolveMsg: null, rejectMsg: '请检查卡是否插好!!'})
535
+ }
536
+ // 读卡
537
+ let readCard = async function () {
538
+ return await Vue.resetpost('http://127.0.0.1:8003/ReadCard', {data: {}}, {resolveMsg: null, rejectMsg: null})
539
+ }
540
+
541
+ let replaceCiTiaoCardGen = async function (model, row) {
542
+ // 1.存库 2.写卡
543
+ let result = null
544
+ let getCardNumber = {data: {cardNumber: null}}
545
+ try {
546
+ const OperatorInfo = {
547
+ f_operator: Vue.$login.f.name,
548
+ f_operatorid: Vue.$login.f.id,
549
+ f_orgid: Vue.$login.f.orgid,
550
+ f_orgname: Vue.$login.f.orgs,
551
+ f_depid: Vue.$login.f.depids,
552
+ f_depname: Vue.$login.f.deps
553
+ }
554
+ // 获取卡号
555
+ // if (!row.f_card_id) {
556
+ // getCardNumber = await Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {
557
+ // resolveMsg: null,
558
+ // rejectMsg: '发卡售气获取卡号失败!!'
559
+ // })
560
+ // console.log('获取卡号、、', getCardNumber)
561
+ // } else {
562
+ // getCardNumber.data.cardNumber = row.f_card_id
563
+ // console.log('档案自带卡号、、', getCardNumber)
564
+ // }
565
+ if (row.f_userinfo_code) {
566
+ getCardNumber.data.cardNumber = row.f_card_id
567
+ }
568
+ result = await Vue.resetpost('api/af-revenue/logic/sendCiTiaoCardRemanentGas', {
569
+ data: {
570
+ model,
571
+ getCardNumber,
572
+ row,
573
+ OperatorInfo
574
+ }
575
+ }, {resolveMsg: null, rejectMsg: '发卡售气存库失败'})
576
+ // 存库
577
+ console.log('换表发卡存库返回', result)
578
+ // 写卡
579
+ Vue.showAlert('请刷卡', 'warning', 50000)
580
+ // 组织写卡数据
581
+ let params = {
582
+ kh: result.data.cardnumber
583
+ }
584
+ let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteCard_HEC', params, {
585
+ resolveMsg: null,
586
+ rejectMsg: '开户卡服务错误'
587
+ })
588
+ Vue.closeAlert()
589
+ if (!result || cardRes.data.Err || cardRes.data.Exception) {
590
+ // 写卡异常
591
+ await Vue.resetpost('api/af-revenue/logic/sendCiTiaoCardRemanentGas', {
592
+ data: {
593
+ model,
594
+ getCardNumber,
595
+ row,
596
+ Chongzheng: true,
597
+ fill_id: result.data.id
598
+ }
599
+ }, {resolveMsg: null, rejectMsg: null})
600
+ throw new Error(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`)
601
+ } else {
602
+ // 写卡成功
603
+ Vue.showAlert('写卡成功', 'success', 2000)
604
+ return result
605
+ }
606
+ } catch (error) {
607
+ console.log('换表发卡出错。。', error)
608
+ if (result) {
609
+ // 出错进行回滚
610
+ row.f_user_id = row.f_user_id + ''
611
+ if (result) {
612
+ await Vue.resetpost('api/af-revenue/logic/sendCiTiaoCardRemanentGas', {
613
+ data: {
614
+ model,
615
+ getCardNumber,
616
+ row,
617
+ Chongzheng: true,
618
+ fill_id: result.data.id
619
+ }
620
+ }, {resolveMsg: null, rejectMsg: null})
621
+ }
622
+ }
623
+ if (error.data) {
624
+ throw new Error(error.data)
625
+ } else {
626
+ throw error
627
+ }
628
+ }
629
+ }
630
+
631
+ let sendCardSaleGasGenremanent = async function (model, row) {
632
+ // 1.存库 2.写卡
633
+ let result = null
634
+ try {
635
+ let cardState = await hasCardGen()
636
+ console.log('判卡函数返回:', cardState)
637
+ if (JSON.parse(cardState.data).state === 1) {
638
+ // 获取卡号
639
+ let getCardNumber = {data: {cardNumber: null}}
640
+ if (!row.f_card_id) {
641
+ getCardNumber = await Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {resolveMsg: null, rejectMsg: '发卡售气获取卡号失败!!'})
642
+ console.log('获取卡号、、', getCardNumber)
643
+ } else {
644
+ getCardNumber.data.cardNumber = row.f_card_id
645
+ console.log('档案自带卡号、、', getCardNumber)
646
+ }
647
+ if (row.f_alias && row.f_alias.includes('SmartCard_TP')) {
648
+ model.cardNumber = row.f_meternumber
649
+ } else if (getCardNumber.data.cardNumber) {
650
+ model.cardNumber = getCardNumber.data.cardNumber + ''
651
+ } else {
652
+ throw new Error('获取卡号失败!请核实参数管理中的卡号重新换表发卡售气。')
653
+ }
654
+ result = await Vue.resetpost('api/af-revenue/logic/sendCardRemanentGas', {data: model}, {resolveMsg: null, rejectMsg: '发卡售气存库失败'})
655
+ // 存库
656
+ console.log('换表发卡存库返回', result)
657
+ // 写卡
658
+ let cardParams = await getParamGen(result.data.cardnumber, row.f_alias, row.f_user_id, row.f_userfiles_id)
659
+
660
+ // 组织写卡数据
661
+ let params = {
662
+ factory: row.f_alias,
663
+ kmm: '0', // 2019-12-22 查旭说的。给一个0 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
664
+ kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
665
+ kh: result.data.cardnumber, // 卡号
666
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
667
+ ql: model.f_pregas, // 预购气量
668
+ csql: '0', // 上次购气量,新开户为0
669
+ ccsql: '0', // 上上次购气量,新开户为0
670
+ cs: '1', // 求购气次数,先开户为1
671
+ ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
672
+ ljgqje: (row.f_write_totalfee - 0) + (model.f_preamount - 0), // 累计购气金额
673
+ bkcs: '0', // 新开户卡,为0
674
+ ljyql: '0', // 累积用气量,有些表要累加原来用气量,新开户卡,为0
675
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
676
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
677
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
678
+ cssqrq: '0', // 上次售气日期,格式为YYYYMMDD
679
+ meterid: row.f_meternumber, // 表号
680
+ money: model.f_preamount, // 购气金额
681
+ dqdm: row.f_area_code, // 精益工业地区代码
682
+ klx: row.f_coding
683
+ }
684
+
685
+ params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
686
+
687
+ // 判断是否是累购表
688
+ if (row.f_support_purchase === '是') {
689
+ params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
690
+ params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
691
+ params.totalmoney = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
692
+ }
693
+ console.log('换表发卡写卡参数', params)
694
+ let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
695
+ resolveMsg: null,
696
+ rejectMsg: '开户卡服务错误'
697
+ }, 80000)
698
+ if (!cardParams || ((model.f_pregas > model.f_remanent_gas) && !result) || cardRes.data.Err || cardRes.data.Exception) {
699
+ // 写卡异常
700
+ // 数据回滚操作
701
+ // 由于数据太长,将f_user_id 更改为字符串
702
+ row.f_userfiles_id = row.f_userfiles_id + ''
703
+
704
+ await Vue.resetpost('api/af-revenue/logic/remanentRollback', {data: {fillgasid: result.data.fillgasid, sellid: result.data.sellid, row: row}}, {
705
+ resolveMsg: null,
706
+ rejectMsg: '开户失败'
707
+ })
708
+ throw new Error(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`)
709
+ } else {
710
+ // 写卡成功
711
+ // 更新卡密码
712
+ row.version = result.data.version - 1,
713
+ await Vue.CommonService.updatePassword(row, cardRes)
714
+ Vue.showAlert('补气购气成功', 'success', 2000)
715
+ return result
716
+ }
717
+ } else {
718
+ throw new Error(`请检查卡是否插好!!`)
719
+ }
720
+ } catch (error) {
721
+ console.log('换表发卡出错。。', error)
722
+
723
+ if (result) {
724
+ // 出错进行回滚
725
+ row.f_user_id = row.f_user_id + ''
726
+ if (result) {
727
+ await Vue.resetpost('api/af-revenue/logic/remanentRollback', {data: {fillgasid: result.data.fillgasid, sellid: result.data.sellid, row: row}}, {
728
+ resolveMsg: null,
729
+ rejectMsg: '写卡失败,数据回滚失败,请联系技术人员处理!!'
730
+ })
731
+ }
732
+ }
733
+
734
+ if (error.data) {
735
+ throw new Error(error.data)
736
+ } else {
737
+ throw error
738
+ }
739
+ }
740
+ }
741
+ let resetsendCardSaleGasGen = async function (model, row) {
742
+ // 1.存库 2.写卡
743
+ let result = null
744
+ try {
745
+ let cardState = await hasCardGen()
746
+ console.log('判卡函数返回:', cardState)
747
+ if (JSON.parse(cardState.data).state === 1) {
748
+ // 获取卡号
749
+ let getCardNumber = await Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {resolveMsg: null, rejectMsg: '重发卡售气获取卡号失败!!'})
750
+ console.log('获取卡号、、', getCardNumber)
751
+ if (getCardNumber.data.cardNumber) {
752
+ // 当卡的别名是泰鹏普通卡的时候卡号和表号一致
753
+ console.log('开始验证是不是泰鹏普通卡')
754
+ if (row.f_alias && row.f_alias.includes('SmartCard_TP')) {
755
+ model.cardNumber = row.f_meternumber
756
+ } else {
757
+ model.cardNumber = getCardNumber.data.cardNumber + ''
758
+ model.f_card_id = getCardNumber.data.cardNumber + ''
759
+ }
760
+ } else {
761
+ throw new Error('获取卡号失败!请核实参数管理中的卡号重新发卡售气。')
762
+ }
763
+ // 存库
764
+ result = await Vue.resetpost('api/af-revenue/logic/sale_resetsendCardSaleGas_logic', {data: model}, {resolveMsg: null, rejectMsg: '重发卡售气存库失败'})
765
+ console.log('重发卡售气存库返回', result)
766
+ // 写卡
767
+ let cardParams = await getParamGen(result.data.cardnumber, row.f_alias, row.f_user_id, row.f_userfiles_id)
768
+
769
+ // 组织写卡数据
770
+ let params = {
771
+ factory: row.f_alias,
772
+ kmm: '0', // 2019-12-22 查旭说的。给一个0 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
773
+ kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
774
+ kh: result.data.cardnumber, // 卡号
775
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
776
+ ql: model.f_pregas, // 预购气量
777
+ csql: '0', // 上次购气量,新开户为0
778
+ ccsql: '0', // 上上次购气量,新开户为0
779
+ cs: '1', // 求购气次数,先开户为1
780
+ // ljgql: model.f_pregas, // 当前累计购气量
781
+ bkcs: '0', // 新开户卡,为0
782
+ ljyql: '0', // 累积用气量,有些表要累加原来用气量,新开户卡,为0
783
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
784
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
785
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
786
+ cssqrq: '0', // 上次售气日期,格式为YYYYMMDD
787
+ meterid: row.f_meternumber, // 表号
788
+ money: model.f_preamount, // 购气金额
789
+ dqdm: row.f_area_code, // 精益工业地区代码
790
+ klx: row.f_coding,
791
+ ljgql: (row.f_total_gas - 0) + (model.f_pregas - 0), // 当前累计购气量
792
+ ljgqje: (row.f_total_fee - 0) + (model.f_preamount - 0) // 累计购气金额
793
+ }
794
+ // 判断是否是累购表
795
+ if (row.f_support_purchase === '是') {
796
+ params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
797
+ params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
798
+ }
799
+ params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
800
+ console.log('重发卡售气写卡参数', params)
801
+ let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
802
+ resolveMsg: null,
803
+ rejectMsg: '重开户卡服务错误'
804
+ }, 80000)
805
+ if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
806
+ // 写卡异常
807
+ // 数据回滚操作
808
+ throw `卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`
809
+ } else {
810
+ // 写卡成功
811
+ // 更新卡密码
812
+ await Vue.CommonService.updatePassword(row, cardRes)
813
+ Vue.showAlert('初始化卡成功', 'success', 2000)
814
+ return result
815
+ }
816
+ } else {
817
+ throw new Error(`请检查卡是否插好!!`)
818
+ }
819
+ } catch (error) {
820
+ if (result) {
821
+ // 出错进行回滚
822
+ row.f_userfiles_id = row.f_userfiles_id + ''
823
+ if (result) {
824
+ await Vue.resetpost('api/af-revenue/logic/salecardrollback', {data: {id: result.data.id, row: row}}, {
825
+ resolveMsg: null,
826
+ rejectMsg: '写卡失败,数据回滚失败,请联系技术人员处理!!'
827
+ })
828
+ }
829
+ }
830
+ if (error.data) {
831
+ throw new Error(error.data)
832
+ } else {
833
+ throw error
834
+ }
835
+ }
836
+ }
837
+
838
+ let sendCardSaleGasGen = async function (model, row) {
839
+ // 1.存库 2.写卡
840
+ let result = null
841
+ try {
842
+ let cardState = await hasCardGen()
843
+ console.log('判卡函数返回:', cardState)
844
+ if (JSON.parse(cardState.data).state === 1) {
845
+ // 获取卡号
846
+ let getCardNumber = {data: {cardNumber: null}}
847
+ if (!row.f_card_id) {
848
+ getCardNumber = await Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {resolveMsg: null, rejectMsg: '发卡售气获取卡号失败!!'})
849
+ console.log('获取卡号、、', getCardNumber)
850
+ } else {
851
+ getCardNumber.data.cardNumber = row.f_card_id
852
+ console.log('档案自带卡号、、', getCardNumber)
853
+ }
854
+ if (getCardNumber.data.cardNumber) {
855
+ // 当卡的别名是泰鹏普通卡的时候卡号和表号一致
856
+ console.log('开始验证是不是泰鹏普通卡')
857
+ if (row.f_alias && (row.f_alias.includes('SmartCard_TP') || row.f_alias.includes('LiHengSystem'))) {
858
+ model.cardNumber = row.f_meternumber
859
+ } else if (row.f_alias && row.f_alias.includes('LaiDeRF')) {
860
+ model.cardNumber = row.f_card_id
861
+ } else {
862
+ model.cardNumber = getCardNumber.data.cardNumber + ''
863
+ }
864
+ } else {
865
+ throw new Error('获取卡号失败!请核实参数管理中的卡号重新发卡售气。')
866
+ }
867
+ // 存库
868
+ result = await Vue.resetpost('api/af-revenue/logic/sale_sendCardSaleGas_logic', {data: model}, {resolveMsg: null, rejectMsg: '发卡售气存库失败'})
869
+ console.log('发卡售气存库返回', result)
870
+ // 写卡
871
+ let cardParams = await getParamGen(result.data.cardnumber, row.f_alias, row.f_user_id, row.f_userfiles_id)
872
+
873
+ // 组织写卡数据
874
+ let params = {
875
+ factory: row.f_alias,
876
+ kmm: '0', // 2019-12-22 查旭说的。给一个0 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
877
+ kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
878
+ kh: result.data.cardnumber, // 卡号
879
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
880
+ ql: model.f_pregas, // 预购气量
881
+ csql: '0', // 上次购气量,新开户为0
882
+ ccsql: '0', // 上上次购气量,新开户为0
883
+ cs: '1', // 求购气次数,先开户为1
884
+ // ljgql: model.f_pregas, // 当前累计购气量
885
+ bkcs: '0', // 新开户卡,为0
886
+ ljyql: '0', // 累积用气量,有些表要累加原来用气量,新开户卡,为0
887
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
888
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
889
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
890
+ cssqrq: '0', // 上次售气日期,格式为YYYYMMDD
891
+ meterid: row.f_meternumber, // 表号
892
+ money: model.f_write_money, // 购气金额
893
+ dqdm: row.f_area_code, // 精益工业地区代码
894
+ klx: row.f_coding,
895
+ ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
896
+ ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0) // 累计购气金额
897
+ }
898
+ // 天源表发卡售气时,cs默认给0
899
+ if (row.f_alias && row.f_alias.includes('TianYuan')) {
900
+ console.log('天源表发卡售气时,写卡次数给:', params.cs)
901
+ params.cs = '0'
902
+ }
903
+ // 判断是否是累购表
904
+ if (row.f_support_purchase === '是') {
905
+ params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
906
+ params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
907
+ }
908
+ params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
909
+ console.log('发卡售气写卡参数', params)
910
+ let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
911
+ resolveMsg: null,
912
+ rejectMsg: '开户卡服务错误'
913
+ }, 80000)
914
+ if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
915
+ // 写卡异常
916
+ // 数据回滚操作
917
+ throw `卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`
918
+ } else {
919
+ // 写卡成功
920
+ // 更新卡密码
921
+ await Vue.CommonService.updatePassword(row, cardRes)
922
+ Vue.showAlert('发卡售气成功', 'success', 2000)
923
+ return result
924
+ }
925
+ } else {
926
+ throw new Error(`请检查卡是否插好!!`)
927
+ }
928
+ } catch (error) {
929
+ if (result) {
930
+ // 出错进行回滚
931
+ row.f_userfiles_id = row.f_userfiles_id + ''
932
+ if (result) {
933
+ await Vue.resetpost('api/af-revenue/logic/salecardrollback', {data: {id: result.data.id, row: row}}, {
934
+ resolveMsg: null,
935
+ rejectMsg: '写卡失败,数据回滚失败,请联系技术人员处理!!'
936
+ })
937
+ }
938
+ }
939
+ if (error.data) {
940
+ throw new Error(error.data)
941
+ } else {
942
+ throw error
943
+ }
944
+ }
945
+ }
946
+
947
+ let replaceCardGen2 = function * (model, row, allot) {
948
+ let result = yield co(reissueCardGen(model, row))
949
+ let data = {
950
+ userfiles: {},
951
+ record: {
952
+ id: result.data.id,
953
+ f_state: '有效'
954
+ }
955
+ }
956
+ return yield Vue.resetpost('api/af-revenue/logic/updatemark', {data: data}, {resolveMsg: '补卡成功', rejectMsg: '补卡修改状态失败'})
957
+ }
958
+ // 物联网表发卡管理
959
+ let replaceCardGenWeb = function * (model, row) {
960
+ let result = null
961
+ let allotback
962
+ try {
963
+ // 判断是否有卡
964
+ let cardState = yield co(hasCardGen())
965
+ if (JSON.parse(cardState.data).state === 1) {
966
+ let cardId = ''
967
+ if (row.f_card_id && row.f_card_id !== 'null') {
968
+ cardId = row.f_card_id
969
+ } else {
970
+ let getCardNumber = yield co(getCardNumberGen(row.f_gasbrand_id))
971
+ console.log('获取卡号、、', getCardNumber)
972
+ cardId = getCardNumber.data.cardNumber
973
+ }
974
+ if (row.f_tag) {
975
+ // 截取用户编号后四位
976
+ cardId = row.f_tag + row.f_card_id
977
+ }
978
+ model.f_card_id = cardId
979
+ // 存库
980
+ result = yield co(reissueCardGenJB(model, row))
981
+ // 获取气价和售气情况参数
982
+ let cardParams = yield co(getParamGen(cardId, row.f_alias, row.f_user_id, row.f_userfiles_id))
983
+ // 写卡
984
+ let params = {
985
+ factory: row.f_alias,
986
+ kh: cardId, // 卡号
987
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
988
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
989
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
990
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
991
+ ljgql: (row.f_total_gas - 0), // 当前累计购气量
992
+ ljgqje: (row.f_total_fee - 0), // 累计购气金额
993
+ kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
994
+ bkcs: row.f_fillcard_times + 1, // 补卡次数,从补卡表里通过表编号获得
995
+ cs: row.f_times, // 求购气次数,先开户为1
996
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号
997
+ meterid: row.f_meternumber, // 表号
998
+ meternumber: row.f_meternumber,
999
+ dqdm: row.f_area_code, // 精益工业地区代码
1000
+ money: 0, // 购气金额
1001
+ klx: row.f_coding
1002
+ }
1003
+ // 判断是否是累购表
1004
+ if (row.f_support_purchase === '是') {
1005
+ params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
1006
+ params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
1007
+ }
1008
+ params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1009
+ console.log('补卡是写的次数。。。。', params)
1010
+ let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
1011
+ resolveMsg: null,
1012
+ rejectMsg: '补卡卡服务错误'
1013
+ }))
1014
+ // 卡服务写卡异常,业务逻辑回滚
1015
+ if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1016
+ Vue.$showAlert('物联网表补卡失败!!', 'danger', 0)
1017
+ let rollbackParam = {
1018
+ id: result.data.id,
1019
+ f_card_id: row.f_card_id,
1020
+ f_whether_hairpin: row.f_whether_hairpin,
1021
+ f_user_id: row.f_user_id
1022
+ }
1023
+ if (row.f_tag) {
1024
+ rollbackParam.f_tag = row.f_tag
1025
+ }
1026
+ yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1027
+ resolveMsg: null,
1028
+ rejectMsg: null
1029
+ })
1030
+ } else {
1031
+ // 如果成功修改标识(更新状态为有效)
1032
+ // 没有更新过表档案,这里版本号减一
1033
+ row.version = (row.version - 0) - 1
1034
+ yield co(Vue.CommonService.updatePassword(row, cardRes))
1035
+ let data = {
1036
+ userfiles: {
1037
+ f_card_id: row.f_card_id,
1038
+ f_whether_hairpin: '已发'
1039
+ },
1040
+ record: {
1041
+ id: result.data.id,
1042
+ f_state: '有效'
1043
+ }
1044
+ }
1045
+ return yield Vue.resetpost('api/af-revenue/logic/updatemark', {data: data}, {resolveMsg: '物联网表补卡成功', rejectMsg: '补卡修改状态失败'})
1046
+ }
1047
+ } else {
1048
+ Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1049
+ }
1050
+ } catch (error) {
1051
+ let msg = ''
1052
+ if (error.status === 612) {
1053
+ msg = '请检查读卡器时候连接,或者卡服务是否启动!!'
1054
+ } else {
1055
+ msg = '补卡失败!!'
1056
+
1057
+ let rollbackParam = {
1058
+ id: result.data.id,
1059
+ f_card_id: null,
1060
+ f_whether_hairpin: row.f_whether_hairpin,
1061
+ f_user_id: row.f_user_id
1062
+ }
1063
+ if (row.f_tag) {
1064
+ rollbackParam.f_tag = row.f_tag
1065
+ }
1066
+ yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1067
+ resolveMsg: null,
1068
+ rejectMsg: '物联网表补卡失败!!'
1069
+ })
1070
+ }
1071
+ Vue.showAlert(msg, 'danger', 0)
1072
+ }
1073
+ }
1074
+ // 机表补卡管理
1075
+ let replaceCardGenJB = function * (model, row) {
1076
+ let result = null
1077
+ let allotback
1078
+ try {
1079
+ // 判断是否有卡
1080
+ let cardState = yield co(hasCardGen())
1081
+ if (JSON.parse(cardState.data).state === 1) {
1082
+ let cardId = row.f_card_id
1083
+ if (row.f_tag) {
1084
+ // 截取用户编号后四位
1085
+ cardId = row.f_tag + row.f_card_id
1086
+ }
1087
+ model.f_card_id = cardId
1088
+ // 存库
1089
+ result = yield co(reissueCardGenJB(model, row))
1090
+ // 获取气价和售气情况参数
1091
+ let cardParams = yield co(getParamGen(cardId, row.f_alias, row.f_user_id, row.f_userfiles_id))
1092
+ // 写卡
1093
+ let params = {
1094
+ factory: row.f_alias,
1095
+ kh: cardId, // 卡号
1096
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1097
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1098
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1099
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1100
+ ljgql: (row.f_total_gas - 0) + (model.f_pregas - 0), // 当前累计购气量
1101
+ ljgqje: (row.f_total_fee - 0) + (model.f_preamount - 0), // 累计购气金额
1102
+ kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1103
+ bkcs: row.f_fillcard_times + 1, // 补卡次数,从补卡表里通过表编号获得
1104
+ cs: row.f_times, // 求购气次数,先开户为1
1105
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号
1106
+ meterid: row.f_meternumber, // 表号
1107
+ meternumber: row.f_meternumber,
1108
+ dqdm: row.f_area_code, // 精益工业地区代码
1109
+ money: 0, // 购气金额
1110
+ klx: row.f_coding
1111
+ }
1112
+ // 判断是否是累购表
1113
+ if (row.f_support_purchase === '是') {
1114
+ params.ljgql = (row.f_write_totalgas - 0) + (model.f_pregas - 0)
1115
+ params.ljgqje = (row.f_write_totalfee - 0) + (model.f_preamount - 0)
1116
+ }
1117
+ params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1118
+ console.log('补卡是写的次数。。。。', params)
1119
+ let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
1120
+ resolveMsg: null,
1121
+ rejectMsg: '补卡卡服务错误'
1122
+ }, 80000))
1123
+ // 卡服务写卡异常,业务逻辑回滚
1124
+ if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1125
+ Vue.$showAlert('机表补卡失败!!', 'danger', 0)
1126
+ let rollbackParam = {
1127
+ id: result.data.id,
1128
+ f_card_id: row.f_card_id,
1129
+ f_whether_hairpin: row.f_whether_hairpin,
1130
+ f_user_id: row.f_user_id
1131
+ }
1132
+ if (row.f_tag) {
1133
+ rollbackParam.f_tag = row.f_tag
1134
+ }
1135
+ yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1136
+ resolveMsg: null,
1137
+ rejectMsg: null
1138
+ })
1139
+ } else {
1140
+ // 如果成功修改标识(更新状态为有效)
1141
+ // 没有更新过表档案,这里版本号减一
1142
+ row.version = (row.version - 0) - 1
1143
+ yield co(Vue.CommonService.updatePassword(row, cardRes))
1144
+ let data = {
1145
+ userfiles: {
1146
+ f_card_id: row.f_card_id,
1147
+ f_whether_hairpin: '已发'
1148
+ },
1149
+ record: {
1150
+ id: result.data.id,
1151
+ f_state: '有效'
1152
+ }
1153
+ }
1154
+ return yield Vue.resetpost('api/af-revenue/logic/updatemark', {data: data}, {resolveMsg: '机表补卡成功', rejectMsg: '补卡修改状态失败'})
1155
+ }
1156
+ } else {
1157
+ Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1158
+ }
1159
+ } catch (error) {
1160
+ let msg = ''
1161
+ if (error.status === 612) {
1162
+ msg = '请检查读卡器时候连接,或者卡服务是否启动!!'
1163
+ } else {
1164
+ msg = '补卡失败!!'
1165
+
1166
+ let rollbackParam = {
1167
+ id: result.data.id,
1168
+ f_card_id: null,
1169
+ f_whether_hairpin: row.f_whether_hairpin,
1170
+ f_user_id: row.f_user_id
1171
+ }
1172
+ if (row.f_tag) {
1173
+ rollbackParam.f_tag = row.f_tag
1174
+ }
1175
+ yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1176
+ resolveMsg: null,
1177
+ rejectMsg: '机表补卡失败!!'
1178
+ })
1179
+ }
1180
+ Vue.showAlert(msg, 'danger', 0)
1181
+ }
1182
+ }
1183
+ // 擦虚气
1184
+ let replaceXq = function * (model, row) {
1185
+ let result = null
1186
+ let cardState = yield co(hasCardGen())
1187
+ if (JSON.parse(cardState.data).state === 1) {
1188
+ let params = {
1189
+ factory: row.f_alias,
1190
+ kh: row.f_card_id, // 卡号
1191
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1192
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1193
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1194
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1195
+ ljgql: (row.f_total_gas - 0), // 当前累计购气量
1196
+ ljgqje: (row.f_total_fee - 0), // 累计购气金额
1197
+ kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1198
+ bkcs: row.f_fillcard_times + 1, // 补卡次数,从补卡表里通过表编号获得
1199
+ cs: row.f_times, // 求购气次数,先开户为1
1200
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号
1201
+ meterid: row.f_meternumber, // 表号
1202
+ meternumber: row.f_meternumber,
1203
+ dqdm: row.f_area_code, // 精益工业地区代码
1204
+ money: 0, // 购气金额
1205
+ klx: row.f_coding
1206
+ }
1207
+ let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
1208
+ resolveMsg: null,
1209
+ rejectMsg: '擦虚气服务错误'
1210
+ }, 80000))
1211
+ if (cardRes.data.Err || cardRes.data.Exception) {
1212
+ return {status: 1}
1213
+ } else {
1214
+ return {status: 0}
1215
+ }
1216
+ } else {
1217
+ Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1218
+ }
1219
+ }
1220
+
1221
+ // 补卡管理
1222
+ let replaceCardGen = function * (model, row, allot) {
1223
+ let result = null
1224
+ let allotback
1225
+ try {
1226
+ // 判断是否有卡
1227
+ let cardState = yield co(hasCardGen())
1228
+ if (JSON.parse(cardState.data).state === 1) {
1229
+ let cardId = row.f_card_id
1230
+ // 如果当前是物联网表,表未发卡,进行补需要获取卡号
1231
+ if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是' && (row.f_card_id == null || row.f_card_id === '')) {
1232
+ let getCardNumber = yield Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: row.brand_id}}, {resolveMsg: null, rejectMsg: '发卡售气获取卡号失败!!'})
1233
+ console.log('获取卡号、、', getCardNumber)
1234
+ if (getCardNumber.data.cardNumber) {
1235
+ cardId = getCardNumber.data.cardNumber
1236
+ } else {
1237
+ throw new Error('获取卡号失败!请核实参数管理中的卡号重新发卡售气。')
1238
+ }
1239
+ }
1240
+ if (row.f_tag) {
1241
+ // 截取用户编号后四位
1242
+ cardId = row.f_tag + row.f_card_id
1243
+ }
1244
+ model.f_card_id = cardId
1245
+ // 存库
1246
+ result = yield co(reissueCardGen(model, row))
1247
+ if (allot) {
1248
+ allotback = yield Vue.resetpost('api/af-revenue/logic/saveAllotData', {data: allot}, {
1249
+ resolveMsg: null,
1250
+ rejectMsg: '更新发卡信息失败'
1251
+ })
1252
+ }
1253
+ // 获取气价和售气情况参数
1254
+ let cardParams = yield co(getParamGen(cardId, row.f_alias, row.f_user_id, row.f_userfiles_id))
1255
+ console.log('补卡是写的次数111。。。。', row, model)
1256
+ // 写卡
1257
+ let params = {
1258
+ factory: row.f_alias,
1259
+ kh: cardId, // 卡号
1260
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1261
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1262
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1263
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1264
+ ljgql: (row.f_total_gas - 0), // 当前累计购气量
1265
+ ljgqje: (row.f_total_fee - 0), // 累计购气金额
1266
+ kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1267
+ bkcs: row.f_fillcard_times + 1, // 补卡次数,从补卡表里通过表编号获得
1268
+ cs: row.f_times, // 求购气次数,先开户为1
1269
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号
1270
+ meterid: row.f_meternumber, // 表号
1271
+ meternumber: row.f_meternumber,
1272
+ dqdm: row.f_area_code, // 精益工业地区代码
1273
+ money: 0, // 购气金额
1274
+ klx: row.f_coding
1275
+ }
1276
+ // 判断是否是累购表
1277
+ if (row.f_support_purchase === '是') {
1278
+ params.ljgql = (row.f_write_totalgas - 0)
1279
+ params.ljgqje = (row.f_write_totalfee - 0)
1280
+ }
1281
+ // 判断是否接表,如果未接表(次数减一)已过表(次数为档案里面的次数) 针对不补气的
1282
+ if (model.f_ispick_table) {
1283
+ params.cs = (model.f_ispick_table === '未过表' ? row.f_times - 1 : row.f_times)
1284
+ }
1285
+
1286
+ params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1287
+ // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1288
+ // params.klx = yield co(getmodelbrandGen(row))
1289
+ // params.klx = params.klx.data[0].f_coding
1290
+ // }
1291
+ console.log('补卡是写的次数。。。。', params)
1292
+
1293
+ let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
1294
+ resolveMsg: null,
1295
+ rejectMsg: '补卡卡服务错误'
1296
+ }, 80000))
1297
+ // 卡服务写卡异常,业务逻辑回滚
1298
+ if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1299
+ Vue.$showAlert('补卡失败!!', 'danger', 0)
1300
+ let rollbackParam = {
1301
+ id: result.data.id,
1302
+ f_card_id: row.f_card_id,
1303
+ f_user_id: row.f_user_id
1304
+ }
1305
+ if (row.f_tag) {
1306
+ rollbackParam.f_tag = row.f_tag
1307
+ }
1308
+ yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1309
+ resolveMsg: null,
1310
+ rejectMsg: null
1311
+ })
1312
+ // 更新卡状态为作废
1313
+ if (allot) {
1314
+ yield Vue.resetpost('api/af-revenue/logic/allotDataRollback', {data: allotback.data}, {resolveMsg: null, rejectMsg: null})
1315
+ }
1316
+ } else {
1317
+ // 如果成功修改标识(更新状态为有效)
1318
+ // 没有更新过表档案,这里版本号减一
1319
+ row.version = (row.version - 0) - 1
1320
+ yield co(Vue.CommonService.updatePassword(row, cardRes))
1321
+ let data = {
1322
+ userfiles: {},
1323
+ record: {
1324
+ id: result.data.id,
1325
+ f_state: '有效'
1326
+ }
1327
+ }
1328
+ return yield Vue.resetpost('api/af-revenue/logic/updatemark', {data: data}, {resolveMsg: '补卡成功', rejectMsg: '补卡修改状态失败'})
1329
+ }
1330
+ } else {
1331
+ Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1332
+ }
1333
+ } catch (error) {
1334
+ let msg = ''
1335
+ if (error.status === 612) {
1336
+ msg = '请检查读卡器时候连接,或者卡服务是否启动!!'
1337
+ } else {
1338
+ msg = '补卡失败!!'
1339
+
1340
+ let rollbackParam = {
1341
+ id: result.data.id,
1342
+ f_card_id: row.f_card_id,
1343
+ f_user_id: row.f_user_id
1344
+ }
1345
+ if (row.f_tag) {
1346
+ rollbackParam.f_tag = row.f_tag
1347
+ }
1348
+ yield Vue.resetpost('api/af-revenue/logic/repairCardRoolBack', {data: rollbackParam}, {
1349
+ resolveMsg: null,
1350
+ rejectMsg: '补卡失败!!'
1351
+ })
1352
+ }
1353
+ // 更新卡状态为作废
1354
+ if (allot) {
1355
+ yield Vue.resetpost('api/af-revenue/logic/allotDataRollback', {data: allotback.data}, {resolveMsg: null, rejectMsg: null})
1356
+ }
1357
+ Vue.showAlert(msg, 'danger', 0)
1358
+ }
1359
+ }
1360
+
1361
+ let offlineWriteGen2 = async function (row) {
1362
+ let update = {
1363
+ id: row.unWriteSell[0].id,
1364
+ f_write_operator: Vue.$login.f.name,
1365
+ f_write_date: Vue.$login.toStandardTimeString()
1366
+ }
1367
+ await Vue.resetpost('api/af-revenue/logic/offlineWrite', update, {resolveMsg: null, rejectMsg: '写卡成功,更新数据失败'})
1368
+ }
1369
+
1370
+ let offlineWriteGen = async function (row) {
1371
+ console.log('线下写卡', row)
1372
+ try {
1373
+ // 写卡前调用(该为特殊业务逻辑根据需要写到project工程) (有些第三方缴费柜台写卡,用户缴费之后,如果在规定时间内不写卡,就会进行退款。所以写卡前调用第三方锁定订单。写卡成功或失败调用对应的接口告知第三方)
1374
+
1375
+ let beforeParam = {
1376
+ id: row.unWriteSell[0].id,
1377
+ f_operatorid: Vue.$login.f.id,
1378
+ f_depid: Vue.$login.f.depids
1379
+ }
1380
+
1381
+ await Vue.resetpost('api/af-revenue/logic/sale_write_before', {data: beforeParam}, {resolveMsg: null, rejectMsg: '线下写卡前调用第三方失败!!'})
1382
+
1383
+ let cardState = await hasCardGen()
1384
+ if (JSON.parse(cardState.data).state === 1) {
1385
+ // 获取
1386
+ let result = await Vue.resetpost('api/af-revenue/logic/sale_getLastOper', {data: {f_userfiles_id: row.f_userfiles_id}}, {resolveMsg: null, rejectMsg: '获取最后一次操作失败'})
1387
+ console.log('获取最后一次的操作。。', result)
1388
+ // 先把收费记录状态改成 已写卡在进行操作
1389
+ // 写卡成功 更新收费记录
1390
+ let update = {
1391
+ id: row.unWriteSell[0].id,
1392
+ f_write_comments: !row.f_write_comments ? '' : row.f_write_comments,
1393
+ f_write_operator: Vue.$login.f.name,
1394
+ f_write_date: Vue.$login.toStandardTimeString()
1395
+ }
1396
+ await Vue.resetpost('api/af-revenue/logic/offlineWrite', update, {resolveMsg: null, rejectMsg: '写卡成功,更新数据失败'})
1397
+ let cardid = row.f_card_id
1398
+ if (row.f_tag) {
1399
+ // 截取用户编号后四位
1400
+ cardid = row.f_tag + row.f_card_id
1401
+ }
1402
+ // 执行写卡操作
1403
+ let cardParams = await getParamGen(row.f_card_id, row.f_alias, row.f_user_id, row.f_userfiles_id)
1404
+ let param = {
1405
+ factory: row.f_alias,
1406
+ kh: cardid,
1407
+ cs: row.unWriteSell[0].f_times,
1408
+ yhh: row.cardInfo.Yhh ? row.cardInfo.Yhh : row.f_meterid,
1409
+ meterid: row.f_meternumber ? row.f_meternumber : 0,
1410
+ meternumber: row.f_meternumber ? row.f_meternumber : 0,
1411
+ kmm: row.f_card_password,
1412
+ ljgql: (row.f_write_totalgas - 0), // 当前累计购气量
1413
+ ljgqje: (row.f_write_totalfee - 0), // 累计购气金额
1414
+ bjql: row.f_police_gas,
1415
+ czsx: row.f_topup_ceil,
1416
+ tzed: row.f_overdr_lines,
1417
+ bkcs: row.f_fillcard_times,
1418
+ dqdm: row.f_area_code,
1419
+ klx: row.f_coding,
1420
+ ql: row.unWriteSell[0].f_pregas,
1421
+ money: row.unWriteSell[0].f_write_money
1422
+ }
1423
+ param = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), param)
1424
+ let cardRes
1425
+ if (result.data.last_oper == null) result.data.last_oper = ''
1426
+ if (row.states === '补卡' || result.data.last_oper === '补卡') {
1427
+ param.kzt = result.data.ispick === '未过表' && result.data.lastsell_oper === '发卡售气' ? '0' : '1'
1428
+ param.cs = row.cardInfo.Times + 1
1429
+ param.bkcs = param.bkcs + 1
1430
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', param, {resolveMsg: null, rejectMsg: '写卡失败'}, 80000)
1431
+ } else if (row.states === '换表') {
1432
+ param.kzt = '0'
1433
+ param.bkcs = param.bkcs + 1
1434
+ param.cs = 1
1435
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', param, {resolveMsg: null, rejectMsg: '写卡失败'}, 80000)
1436
+ } else {
1437
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', param, {resolveMsg: null, rejectMsg: '写卡失败'}, 80000)
1438
+ }
1439
+ if (!cardParams || cardRes.data.Err || cardRes.data.Exception) {
1440
+ let sql = `update t_sellinggas set
1441
+ f_write_card = '写卡失败'
1442
+ where id = '${row.unWriteSell[0].id}'`
1443
+ let data = {
1444
+ sql: sql
1445
+ }
1446
+ await Vue.resetpost('api/af-revenue/logic/runSQL', data)
1447
+ throw new Error(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`)
1448
+ }
1449
+ } else {
1450
+ Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
1451
+ }
1452
+ } catch (error) {
1453
+ // 考虑到这里报错可能是因为 写卡请求超时报的错,但是请求已经发到卡服务,可能已经写上卡,所以先不做处理
1454
+ // let sql = `update t_sellinggas set
1455
+ // f_write_card = '未写卡',
1456
+ // where id = '${row.unWriteSell[0].id}'`
1457
+ // let data = {
1458
+ // sql: sql
1459
+ // }
1460
+ // await this.$resetpost('api/af-revenue/logic/runSQL', data)
1461
+ throw error
1462
+ }
1463
+ }
1464
+
1465
+ let DigtialSellGasGen = async function (model, row) {
1466
+ try {
1467
+ let result = await Vue.resetpost('api/af-revenue/logic/sale_digtialCharge_logic', {data: model}, {resolveMsg: '收费成功', rejectMsg: '卡表收费存库失败'})
1468
+ return result.data.id
1469
+ } catch (error) {
1470
+ if (error.data) {
1471
+ throw new Error(error.data)
1472
+ } else {
1473
+ throw error
1474
+ }
1475
+ }
1476
+ }
1477
+ let noCardSellGasGen = async function (model, row) {
1478
+ try {
1479
+ let result = await Vue.resetpost('api/af-revenue/logic/sale_cardCharge_logic', {data: model}, {resolveMsg: '收费成功', rejectMsg: '卡表收费存库失败'})
1480
+ return result.data.id
1481
+ } catch (error) {
1482
+ if (model.f_payment.indexOf('扫码枪支付') > -1) {
1483
+ await Vue.resetpost('weixin2/rs/pay/jsApiRefund', {
1484
+ data: {
1485
+ out_trade_no: model.f_serial_id,
1486
+ f_total_fee: model.f_collection,
1487
+ flag: 'microPayRongHaoJsbc'
1488
+ }
1489
+ }, {resolveMsg: null, rejectMsg: '调用银行退费接口失败'})
1490
+ }
1491
+ if (error.data) {
1492
+ throw new Error(error.data)
1493
+ } else {
1494
+ throw error
1495
+ }
1496
+ }
1497
+ }
1498
+
1499
+ // 补气卡表收费
1500
+ let sellgasRemanentGen = async function (model, row) {
1501
+ let result = null
1502
+ try {
1503
+ let cardState = await hasCardGen()
1504
+ if (JSON.parse(cardState.data).state === 1) {
1505
+ // 将卡上次数写入数据库
1506
+ model.f_times = row.cardInfo.Times + 1
1507
+ // 将回写表号或者用户号
1508
+ model.f_meterid = row.cardInfo.Yhh ? row.cardInfo.Yhh : row.f_meterid
1509
+
1510
+ let cardid = row.f_card_id
1511
+ if (row.f_tag) {
1512
+ // 截取用户编号后四位
1513
+ cardid = model.f_card_id = row.f_tag + row.f_card_id
1514
+ }
1515
+ result = await Vue.resetpost('api/af-revenue/logic/sellgasRemanentGas', {data: model}, {resolveMsg: null, rejectMsg: '卡表收费存库失败'})
1516
+ // 获取气价和售气情况参数
1517
+ let cardParams = await getParamGen(cardid, row.f_alias, row.f_user_id, row.f_userfiles_id)
1518
+ console.log('写卡次数和获取的写卡参数...', row.cardInfo.Times, cardParams)
1519
+ // 写卡
1520
+ let params = {
1521
+ factory: row.f_alias, // 气表厂家
1522
+ kh: cardid, // 卡号
1523
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
1524
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1525
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1526
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1527
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1528
+ ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1529
+ ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1530
+ bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1531
+ ql: model.f_pregas, // 预购气量
1532
+ cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1533
+ money: model.f_write_money, // 购气金额
1534
+ meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1535
+ dqdm: row.f_area_code, // 精益工业地区代码
1536
+ klx: row.f_coding
1537
+ }
1538
+ params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1539
+ console.log('购气最后操作。。', result)
1540
+ let cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'})
1541
+ console.log('卡表收费返回写卡参数值', cardRes)
1542
+ // 卡服务写卡异常,业务逻辑回滚
1543
+ if (!cardParams || ((model.f_pregas > model.f_remanent_gas) && !result) || cardRes.data.Err || cardRes.data.Exception) {
1544
+ let data = {
1545
+ id: result.data.id,
1546
+ userinfo: {
1547
+ f_userinfo_id: row.f_userinfo_id,
1548
+ version: row.userinfo_version + 1,
1549
+ f_balance: row.f_balance,
1550
+ userfiles: {
1551
+ f_user_id: model.f_user_id,
1552
+ f_userfiles_id: model.f_userfiles_id,
1553
+ f_card_id: row.f_card_id,
1554
+ f_total_gas: row.f_total_gas,
1555
+ f_write_totalgas: row.f_write_totalgas,
1556
+ f_write_totalfee: row.f_write_totalfee,
1557
+ f_total_fee: row.f_total_fee,
1558
+ f_times: row.cardInfo.Times,
1559
+ version: row.version + 1
1560
+ }
1561
+ }
1562
+ }
1563
+ if (row.f_tag) {
1564
+ data.userinfo.userfiles.f_tag = row.f_tag
1565
+ }
1566
+ await Vue.resetpost('api/af-revenue/logic/sellgasremanentRollback', {data: data}, {resolveMsg: null, rejectMsg: '卡表收费回滚出错!!'})
1567
+ throw new Error(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`)
1568
+ } else {
1569
+ // 更新卡密码
1570
+ await Vue.CommonService.updatePassword(row, cardRes)
1571
+ Vue.showAlert('换表补气成功', 'success', 2000)
1572
+ return result
1573
+ }
1574
+ } else {
1575
+ throw new Error(`请检查卡是否插好!!`)
1576
+ }
1577
+ } catch (error) {
1578
+ if (result) {
1579
+ let data = {
1580
+ sellid: result.data.sellid,
1581
+ fillgasid: result.data.fillgasid,
1582
+ userinfo: {
1583
+ f_userinfo_id: row.f_userinfo_id,
1584
+ version: row.userinfo_version + 1,
1585
+ f_balance: row.f_balance,
1586
+ userfiles: {
1587
+ f_user_id: model.f_user_id,
1588
+ f_total_gas: row.f_total_gas,
1589
+ f_write_totalgas: row.f_write_totalgas,
1590
+ f_write_totalfee: row.f_write_totalfee,
1591
+ f_total_fee: row.f_total_fee,
1592
+ f_card_id: row.f_card_id,
1593
+ f_times: row.cardInfo.Times,
1594
+ version: row.version + 1
1595
+ }
1596
+ }
1597
+ }
1598
+ if (row.f_tag) {
1599
+ data.userinfo.userfiles.f_tag = row.f_tag
1600
+ }
1601
+ await Vue.resetpost('api/af-revenue/logic/sellgasremanentRollback', {data: data}, {resolveMsg: '卡表收费失败', rejectMsg: '卡表收费失败'})
1602
+ }
1603
+ throw error
1604
+ }
1605
+ }
1606
+ // 余量补差
1607
+ let marginGen = async function (model, row) {
1608
+ let result = null
1609
+ let cardparam
1610
+ let cardpost
1611
+ try {
1612
+ let cardState = await hasCardGen()
1613
+ if (JSON.parse(cardState.data).state === 1) {
1614
+ // 将卡上次数写入数据库
1615
+ if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_hascard === '是' && row.f_share_times === '是') {
1616
+ row.cardInfo.Times = row.cardInfo.Times ? row.cardInfo.Times : row.f_times
1617
+ model.f_times = row.f_times + 1
1618
+ } else {
1619
+ model.f_times = row.cardInfo.Times + 1
1620
+ }
1621
+ // 将回写表号或者用户号
1622
+ model.f_meterid = row.cardInfo.Yhh ? row.cardInfo.Yhh : row.f_meterid
1623
+
1624
+ let cardid = row.f_card_id
1625
+ if (row.f_tag) {
1626
+ // 截取用户编号后四位
1627
+ cardid = model.f_card_id = row.f_tag + row.f_card_id
1628
+ }
1629
+ // 存库
1630
+ result = await Vue.resetpost('api/af-revenue/logic/marginCharge', {data: model}, {resolveMsg: null, rejectMsg: '卡表收费存库失败'})
1631
+ // 获取气价和售气情况参数
1632
+ let cardParams = await getParamGen(cardid, row.f_alias, row.f_user_id, row.f_userfiles_id)
1633
+ console.log('写卡次数和获取的写卡参数...', row.cardInfo.Times, cardParams)
1634
+ // 写卡
1635
+ let params = {
1636
+ factory: row.f_alias, // 气表厂家
1637
+ kh: cardid, // 卡号
1638
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
1639
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1640
+ bjql: row.f_police_gas,
1641
+ ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1642
+ ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1643
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1644
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1645
+ bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1646
+ ql: model.f_pregas, // 预购气量
1647
+ cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1648
+ money: model.f_write_money, // 购气金额
1649
+ dqdm: row.f_area_code, // 精益工业地区代码
1650
+ klx: row.f_coding,
1651
+ meterid: row.f_meternumber ? row.f_meternumber : 0 // 表号
1652
+ }
1653
+ params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1654
+ // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1655
+ // params.klx = yield co(getmodelbrandGen(row))
1656
+ // params.klx = params.klx.data[0].f_coding
1657
+ // }
1658
+
1659
+ let params2 = {
1660
+ factory: row.f_alias,
1661
+ kh: cardid, // 卡号
1662
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1663
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1664
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1665
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1666
+ ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1667
+ ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1668
+ kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1669
+ bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1670
+ ql: model.f_pregas, // 预购气量
1671
+ cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1672
+ sxrq: model.f_startdate, // 生效日期,价格管理中取
1673
+ meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1674
+ // meternumber: row.f_meternumber ? row.f_meternumber : 0, // 海力金额表号
1675
+ dqdm: row.f_area_code, // 精益工业地区代码
1676
+ money: model.f_write_money, // 购气金额
1677
+ klx: row.f_coding
1678
+ }
1679
+
1680
+ params2 = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params2)
1681
+ // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1682
+ // params2.klx = yield co(getmodelbrandGen(row))
1683
+ // params2.klx = params2.klx.data[0].f_coding
1684
+ // }
1685
+
1686
+ let params3 = {
1687
+ factory: row.f_alias,
1688
+ kh: cardid, // 卡号
1689
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1690
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1691
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1692
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1693
+ ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1694
+ ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1695
+ kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1696
+ bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1697
+ ql: model.f_pregas, // 预购气量
1698
+ cs: 1, // 求购气次数,先开户为1
1699
+ sxrq: model.f_startdate, // 生效日期,价格管理中取
1700
+ meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1701
+ // meternumber: row.f_meternumber ? row.f_meternumber : 0, // 海力金额表号
1702
+ dqdm: row.f_area_code, // 精益工业地区代码
1703
+ money: model.f_write_money, // 购气金额
1704
+ klx: row.f_coding
1705
+ }
1706
+ params3 = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params3)
1707
+ // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1708
+ // params3.klx = yield co(getmodelbrandGen(row))
1709
+ // params3.klx = params3.klx.data[0].f_coding
1710
+ // }
1711
+ console.log('购气最后操作。。', result)
1712
+ if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是') {
1713
+ params.cs = row.f_times + 1
1714
+ params2.cs = row.f_times + 1
1715
+ }
1716
+ let cardRes
1717
+ if (result.data.last_oper === '补卡') {
1718
+ // 此次验证开户之后未过表补卡验证问题
1719
+ params2.kzt = result.data.ispick === '未过表' && result.data.lastsell_oper === '发卡售气' ? '0' : '1'
1720
+ cardparam = JSON.stringify(params2)
1721
+ cardpost = 'WriteNewCard'
1722
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params2, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1723
+ } else if (result.data.last_oper === '换表') {
1724
+ console.log('我走的是写新卡换表')
1725
+ cardparam = JSON.stringify(params3)
1726
+ cardpost = 'WriteNewCard'
1727
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params3, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1728
+ } else if (result.data.last_oper === '换表补气') {
1729
+ // 累购金额需要将上次购气金额加上
1730
+ console.log('我走的是正常的收费', params)
1731
+ cardparam = JSON.stringify(params)
1732
+ cardpost = 'WriteGasCard'
1733
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1734
+ } else {
1735
+ console.log('我走的是正常的收费', params)
1736
+ cardparam = JSON.stringify(params)
1737
+ cardpost = 'WriteGasCard'
1738
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1739
+ }
1740
+ console.log('卡表收费返回写卡参数值', cardRes)
1741
+ // 卡服务写卡异常,业务逻辑回滚
1742
+ if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1743
+ if (result) {
1744
+ let data = {
1745
+ cardparam: cardparam,
1746
+ cardpost: cardpost,
1747
+ id: result.data.id,
1748
+ userinfo: {
1749
+ f_userinfo_id: row.f_userinfo_id,
1750
+ version: row.userinfo_version + 1,
1751
+ f_balance: row.f_balance,
1752
+ userfiles: {
1753
+ f_user_id: model.f_user_id,
1754
+ f_userfiles_id: row.f_userfiles_id,
1755
+ f_total_gas: row.f_total_gas,
1756
+ f_write_totalgas: row.f_write_totalgas,
1757
+ f_write_totalfee: row.f_write_totalfee,
1758
+ f_total_fee: row.f_total_fee,
1759
+ f_card_id: row.f_card_id,
1760
+ f_times: row.cardInfo.Times,
1761
+ version: row.version + 1
1762
+ }
1763
+ }
1764
+ }
1765
+ if (row.f_tag) {
1766
+ data.userinfo.userfiles.f_tag = row.f_tag
1767
+ }
1768
+ if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是') {
1769
+ data.userinfo.userfiles.f_times = row.f_times
1770
+ }
1771
+ await Vue.resetpost('api/af-revenue/logic/cardChargeRollback', {data: data}, {resolveMsg: '卡表收费失败', rejectMsg: '卡表收费失败'})
1772
+ }
1773
+ throw `卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`
1774
+ } else {
1775
+ // 调用读卡进行校验
1776
+ let readCardInfo = await Vue.resetpost('http://127.0.0.1:8003/ReadCard', {kmm: row.f_card_password}, {resolveMsg: null, rejectMsg: '读卡失败!!'})
1777
+ if (readCardInfo.data && Vue.$login.r.includes('读卡2')) {
1778
+ console.log('读卡验证', readCardInfo.data, row)
1779
+ if (row.f_collection_type === '按金额') {
1780
+ if (readCardInfo.data.Money !== model.f_preamount || readCardInfo.data.Factory !== row.f_alias || readCardInfo.data.CardID !== row.f_card_id) {
1781
+ Vue.showAlert('读卡参数和缴费参数不一致,请核实!!', 'warning', 2000)
1782
+ return result.data.id
1783
+ }
1784
+ } else {
1785
+ if (readCardInfo.data.Gas !== Number((model.f_pregas - 0).toFixed(2)) || readCardInfo.data.Factory !== row.f_alias || readCardInfo.data.CardID !== row.f_card_id) {
1786
+ Vue.showAlert('读卡参数和缴费参数不一致,请核实!!', 'warning', 2000)
1787
+ return result.data.id
1788
+ }
1789
+ }
1790
+ }
1791
+ // 更新卡密码
1792
+ await Vue.CommonService.updatePassword(row, cardRes)
1793
+ Vue.showAlert('售气成功', 'success', 2000)
1794
+ return result.data.id
1795
+ }
1796
+ } else {
1797
+ throw new Error(`请检查卡是否插好!!`)
1798
+ }
1799
+ } catch (error) {
1800
+ throw error
1801
+ }
1802
+ }
1803
+ // 卡表收费
1804
+ let sellgasGen = async function (model, row) {
1805
+ let result = null
1806
+ let cardparam
1807
+ let cardpost
1808
+ try {
1809
+ let cardState = await hasCardGen()
1810
+ if (JSON.parse(cardState.data).state === 1) {
1811
+ // 将卡上次数写入数据库
1812
+ if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_hascard === '是' && row.f_share_times === '是') {
1813
+ row.cardInfo.Times = row.f_times
1814
+ model.f_times = row.f_times + 1
1815
+ } else {
1816
+ model.f_times = row.cardInfo.Times + 1
1817
+ }
1818
+ // 将回写表号或者用户号
1819
+ model.f_meterid = row.cardInfo.Yhh ? row.cardInfo.Yhh : row.f_meterid
1820
+
1821
+ let cardid = row.f_card_id
1822
+ if (row.f_tag) {
1823
+ // 截取用户编号后四位
1824
+ cardid = model.f_card_id = row.f_tag + row.f_card_id
1825
+ }
1826
+ // 存库
1827
+ try {
1828
+ result = await Vue.resetpost('api/af-revenue/logic/sale_cardCharge_logic', {data: model}, {resolveMsg: null, rejectMsg: '卡表收费存库失败'})
1829
+ } catch (error) {
1830
+ // 判断是否为扫码枪支付 如果是扫码枪支付 直接调用退费接口给用户进行退费处理
1831
+ if (model.f_payment.indexOf('扫码枪支付') > -1) {
1832
+ await Vue.resetpost('weixin2/rs/pay/jsApiRefund', {
1833
+ data: {
1834
+ out_trade_no: model.f_serial_id,
1835
+ f_total_fee: model.f_collection,
1836
+ flag: 'microPayRongHaoJsbc'
1837
+ }
1838
+ }, {resolveMsg: null, rejectMsg: '调用银行退费接口失败'})
1839
+ }
1840
+ throw error
1841
+ }
1842
+ // 获取气价和售气情况参数
1843
+ let cardParams = await getParamGen(cardid, row.f_alias, row.f_user_id, row.f_userfiles_id)
1844
+ console.log('写卡次数和获取的写卡参数...', row.cardInfo.Times, cardParams)
1845
+ // 写卡
1846
+ let params = {
1847
+ factory: row.f_alias, // 气表厂家
1848
+ kh: cardid, // 卡号
1849
+ yhh: row.f_meterid ? row.f_meterid : 0, // 用户号,档案中自己输
1850
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1851
+ bjql: row.f_police_gas,
1852
+ ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1853
+ ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1854
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1855
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1856
+ bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1857
+ ql: model.f_pregas, // 预购气量
1858
+ cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1859
+ money: model.f_write_money, // 购气金额
1860
+ dqdm: row.f_area_code, // 精益工业地区代码
1861
+ klx: row.f_coding,
1862
+ meterid: row.f_meternumber ? row.f_meternumber : 0 // 表号
1863
+ }
1864
+ params = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params)
1865
+ // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1866
+ // params.klx = yield co(getmodelbrandGen(row))
1867
+ // params.klx = params.klx.data[0].f_coding
1868
+ // }
1869
+
1870
+ let params2 = {
1871
+ factory: row.f_alias,
1872
+ kh: cardid, // 卡号
1873
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1874
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1875
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1876
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1877
+ ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1878
+ ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1879
+ kzt: '1', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1880
+ bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1881
+ ql: model.f_pregas, // 预购气量
1882
+ cs: row.cardInfo.Times + 1, // 求购气次数,先开户为1
1883
+ sxrq: model.f_startdate, // 生效日期,价格管理中取
1884
+ meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1885
+ // meternumber: row.f_meternumber ? row.f_meternumber : 0, // 海力金额表号
1886
+ dqdm: row.f_area_code, // 精益工业地区代码
1887
+ money: model.f_write_money, // 购气金额
1888
+ klx: row.f_coding
1889
+ }
1890
+
1891
+ params2 = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params2)
1892
+ // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1893
+ // params2.klx = yield co(getmodelbrandGen(row))
1894
+ // params2.klx = params2.klx.data[0].f_coding
1895
+ // }
1896
+
1897
+ let params3 = {
1898
+ factory: row.f_alias,
1899
+ kh: cardid, // 卡号
1900
+ kmm: row.f_card_password, // 卡密码,写卡后返回新密码, 不论补卡还是先开户都没有密码
1901
+ bjql: row.f_police_gas, // 报警气量,t_gasbrand表中
1902
+ czsx: row.f_topup_ceil, // 充值上线,t_gasbrand表中
1903
+ tzed: row.f_overdr_lines, // 透支额度,t_gasbrand表中
1904
+ ljgql: (row.f_write_totalgas - 0) + (model.f_pregas - 0), // 当前累计购气量
1905
+ ljgqje: (row.f_write_totalfee - 0) + (model.f_write_money - 0), // 累计购气金额
1906
+ kzt: '0', // 卡状态,0开户卡,1用户卡(0新开户,1补卡)
1907
+ bkcs: row.f_fillcard_times, // 补卡次数,从补卡表里通过表编号获得
1908
+ ql: model.f_pregas, // 预购气量
1909
+ cs: 1, // 求购气次数,先开户为1
1910
+ sxrq: model.f_startdate, // 生效日期,价格管理中取
1911
+ meterid: row.f_meternumber ? row.f_meternumber : 0, // 表号
1912
+ // meternumber: row.f_meternumber ? row.f_meternumber : 0, // 海力金额表号
1913
+ dqdm: row.f_area_code, // 精益工业地区代码
1914
+ money: model.f_write_money, // 购气金额
1915
+ klx: row.f_coding
1916
+ }
1917
+ params3 = Object.assign({}, Vue.CommonService.writeCardParams(cardParams), params3)
1918
+ // if (row.f_alias === 'HaiLiJE' || row.f_alias === 'HaiLiQL' || row.f_alias === 'CangNanTY') {
1919
+ // params3.klx = yield co(getmodelbrandGen(row))
1920
+ // params3.klx = params3.klx.data[0].f_coding
1921
+ // }
1922
+ console.log('购气最后操作。。', result)
1923
+ if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是') {
1924
+ params.cs = row.f_times + 1
1925
+ params2.cs = row.f_times + 1
1926
+ }
1927
+ let cardRes
1928
+ if (result.data.last_oper === '补卡') {
1929
+ // 此次验证开户之后未过表补卡验证问题
1930
+ params2.kzt = result.data.ispick === '未过表' && result.data.lastsell_oper === '发卡售气' ? '0' : '1'
1931
+ cardparam = JSON.stringify(params2)
1932
+ cardpost = 'WriteNewCard'
1933
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params2, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1934
+ } else if (result.data.last_oper === '换表') {
1935
+ console.log('我走的是写新卡换表')
1936
+ cardparam = JSON.stringify(params3)
1937
+ cardpost = 'WriteNewCard'
1938
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params3, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1939
+ } else if (result.data.last_oper === '换表补气') {
1940
+ // 累购金额需要将上次购气金额加上
1941
+ console.log('我走的是正常的收费', params)
1942
+ cardparam = JSON.stringify(params)
1943
+ cardpost = 'WriteGasCard'
1944
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1945
+ } else {
1946
+ console.log('我走的是正常的收费', params)
1947
+ cardparam = JSON.stringify(params)
1948
+ cardpost = 'WriteGasCard'
1949
+ cardRes = await Vue.resetpost('http://127.0.0.1:8003/WriteGasCard', params, {resolveMsg: null, rejectMsg: '卡表收费失败'}, 80000)
1950
+ }
1951
+ console.log('卡表收费返回写卡参数值', cardRes)
1952
+ // 卡服务写卡异常,业务逻辑回滚
1953
+ if (!cardParams || !result || cardRes.data.Err || cardRes.data.Exception) {
1954
+ if (result) {
1955
+ let data = {
1956
+ cardparam: cardparam,
1957
+ cardpost: cardpost,
1958
+ id: result.data.id,
1959
+ userinfo: {
1960
+ f_userinfo_id: row.f_userinfo_id,
1961
+ version: row.userinfo_version + 1,
1962
+ f_balance: row.f_balance,
1963
+ userfiles: {
1964
+ f_user_id: model.f_user_id,
1965
+ f_userfiles_id: row.f_userfiles_id,
1966
+ f_total_gas: row.f_total_gas,
1967
+ f_write_totalgas: row.f_write_totalgas,
1968
+ f_write_totalfee: row.f_write_totalfee,
1969
+ f_total_fee: row.f_total_fee,
1970
+ f_card_id: row.f_card_id,
1971
+ f_times: row.cardInfo.Times,
1972
+ version: row.version + 1
1973
+ }
1974
+ }
1975
+ }
1976
+ if (row.f_tag) {
1977
+ data.userinfo.userfiles.f_tag = row.f_tag
1978
+ }
1979
+ if (!(row.f_hascard == null) && !(row.f_share_times == null) && row.f_meter_type === '物联网表' && row.f_hascard === '是' && row.f_share_times === '是') {
1980
+ data.userinfo.userfiles.f_times = row.f_times
1981
+ }
1982
+ await Vue.resetpost('api/af-revenue/logic/cardChargeRollback', {data: data}, {resolveMsg: '卡表收费失败', rejectMsg: '卡表收费失败'})
1983
+ }
1984
+ throw `卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`
1985
+ } else {
1986
+ // 调用读卡进行校验
1987
+ let readCardInfo = await Vue.resetpost('http://127.0.0.1:8003/ReadCard', {kmm: row.f_card_password}, {resolveMsg: null, rejectMsg: '读卡失败!!'})
1988
+ if (readCardInfo.data && Vue.$login.r.includes('读卡2')) {
1989
+ console.log('读卡验证', readCardInfo.data, row)
1990
+ if (row.f_collection_type === '按金额') {
1991
+ if (readCardInfo.data.Money !== model.f_preamount || readCardInfo.data.Factory !== row.f_alias || readCardInfo.data.CardID !== row.f_card_id) {
1992
+ Vue.showAlert('读卡参数和缴费参数不一致,请核实!!', 'warning', 2000)
1993
+ return result.data.id
1994
+ }
1995
+ } else {
1996
+ if (readCardInfo.data.Gas !== Number((model.f_pregas - 0).toFixed(2)) || readCardInfo.data.Factory !== row.f_alias || readCardInfo.data.CardID !== row.f_card_id) {
1997
+ Vue.showAlert('读卡参数和缴费参数不一致,请核实!!', 'warning', 2000)
1998
+ return result.data.id
1999
+ }
2000
+ }
2001
+ }
2002
+ // 更新卡密码
2003
+ await Vue.CommonService.updatePassword(row, cardRes)
2004
+ Vue.showAlert('售气成功', 'success', 2000)
2005
+ return result.data.id
2006
+ }
2007
+ } else {
2008
+ throw new Error(`请检查卡是否插好!!`)
2009
+ }
2010
+ } catch (error) {
2011
+ throw error
2012
+ }
2013
+ }
2014
+ let reissueCardGenJB = function * (model, row) {
2015
+ if (model.f_cardfees === '') {
2016
+ model.f_cardfees = 0
2017
+ }
2018
+ let data = {
2019
+ f_user_id: row.f_user_id,
2020
+ f_userfiles_id: row.f_userfiles_id,
2021
+ f_user_type: row.f_user_type,
2022
+ f_gasproperties: row.f_gasproperties,
2023
+ f_address: row.f_address,
2024
+ f_meter_brand: row.f_meter_brand,
2025
+ f_type: model.f_type,
2026
+ f_card_id: model.f_card_id,
2027
+ f_ispick_table: model.f_ispick_table,
2028
+ f_cardfees: model.f_cardfees,
2029
+ f_payment: model.f_payment[0],
2030
+ f_bill_style: model.f_print[0],
2031
+ f_comments: model.f_comments,
2032
+ record_userinfo: row.f_userinfo_id,
2033
+ f_userinfo_id: row.f_userinfo_id,
2034
+ f_user_name: row.f_user_name,
2035
+ f_operat_type: '补卡',
2036
+ f_describe: `${Vue.$login.f.name}对客户${row.f_user_name}进行${row.f_type}操作`,
2037
+ f_state: '有效',
2038
+ f_operator: Vue.$login.f.name,
2039
+ f_operatorid: Vue.$login.f.id,
2040
+ f_orgid: Vue.$login.f.orgid,
2041
+ f_orgname: Vue.$login.f.orgs,
2042
+ f_depid: Vue.$login.f.depids,
2043
+ f_depname: Vue.$login.f.deps,
2044
+ f_zoneid: Vue.$login.f.zoneid,
2045
+ f_zones: Vue.$login.f.zones,
2046
+ f_business_tracking_number: model.f_business_tracking_number
2047
+ }
2048
+
2049
+ return Vue.resetpost('api/af-revenue/logic/sale_fillCard', data, {resolveMsg: null, rejectMsg: '补卡存库失败'})
2050
+ }
2051
+ let reissueCardGen = function * (model, row) {
2052
+ if (model.f_cardfees === '') {
2053
+ model.f_cardfees = 0
2054
+ }
2055
+ if (!model.f_fill_type) {
2056
+ model.f_fill_type = ['']
2057
+ }
2058
+ let data = {
2059
+ f_serial_id: model.f_serial_id,
2060
+ f_user_id: row.f_user_id,
2061
+ f_userfiles_id: row.f_userfiles_id,
2062
+ f_user_type: row.f_user_type,
2063
+ f_gasproperties: row.f_gasproperties,
2064
+ f_address: row.f_address,
2065
+ f_meter_brand: row.f_meter_brand,
2066
+ f_type: model.f_type,
2067
+ f_card_id: model.f_card_id,
2068
+ f_ispick_table: model.f_ispick_table,
2069
+ f_cardfees: model.f_cardfees,
2070
+ f_payment: model.f_payment[0],
2071
+ f_bill_style: model.f_print[0],
2072
+ f_fill_type: model.f_fill_type[0],
2073
+ f_comments: model.f_comments,
2074
+ record_userinfo: row.f_userinfo_id,
2075
+ f_userinfo_id: row.f_userinfo_id,
2076
+ f_user_name: row.f_user_name,
2077
+ f_operat_type: '补卡',
2078
+ f_describe: `${Vue.$login.f.name}对客户${row.f_user_name}进行补卡操作`,
2079
+ f_state: '有效',
2080
+ f_operator: Vue.$login.f.name,
2081
+ f_operatorid: Vue.$login.f.id,
2082
+ f_orgid: Vue.$login.f.orgid,
2083
+ f_orgname: Vue.$login.f.orgs,
2084
+ f_depid: Vue.$login.f.depids,
2085
+ f_depname: Vue.$login.f.deps,
2086
+ f_zoneid: Vue.$login.f.zoneid,
2087
+ f_zones: Vue.$login.f.zones,
2088
+ f_business_tracking_number: model.f_business_tracking_number
2089
+ }
2090
+
2091
+ return Vue.resetpost('api/af-revenue/logic/sale_fillCard', data, {resolveMsg: null, rejectMsg: '补卡存库失败'})
2092
+ }
2093
+
2094
+ let getParamGen = async function (cardid, alias, f_user_id, f_userfiles_id) {
2095
+ let data = {
2096
+ f_card_id: cardid + '',
2097
+ f_alias: alias,
2098
+ f_user_id: f_user_id,
2099
+ f_userfiles_id: f_userfiles_id
2100
+ }
2101
+ return Vue.resetpost('api/af-revenue/logic/stairCard', {data: data}, {resolveMsg: null, rejectMsg: '获取写卡参数失败'})
2102
+ }
2103
+
2104
+ let getCardNumberGen = async function (brand_id) {
2105
+ return Vue.resetpost('api/af-revenue/logic/getCardNumber', {data: {id: brand_id}}, {resolveMsg: null, rejectMsg: '发卡售气获取卡号失败!!'})
2106
+ }
2107
+
2108
+ // 指令写卡
2109
+ // 目前支持 承德海力物联网表
2110
+ let instructWriteCardGen = function * (row) {
2111
+ try {
2112
+ // 判断是否有卡
2113
+ let cardState = yield co(hasCardGen())
2114
+ if (JSON.parse(cardState.data).state === 1) {
2115
+ // 写卡
2116
+ let params = {
2117
+ kh: row.f_meternumber,
2118
+ meterid: row.f_meternumber,
2119
+ factory: row.f_alias
2120
+ }
2121
+ let cardRes = yield co(Vue.resetpost('http://127.0.0.1:8003/WriteNewCard', params, {
2122
+ resolveMsg: null,
2123
+ rejectMsg: '补卡卡服务错误'
2124
+ }))
2125
+ // 卡服务写卡异常,业务逻辑回滚
2126
+ if (cardRes.data.Err || cardRes.data.Exception) {
2127
+ Vue.$showAlert('指令写卡失败!!', 'danger', 0)
2128
+ } else {
2129
+ return cardRes
2130
+ }
2131
+ } else {
2132
+ Vue.showAlert('请检查卡是否插好!!', 'danger', 3000)
2133
+ return 0
2134
+ }
2135
+ } catch (error) {
2136
+ let msg = ''
2137
+ if (error.status === 612) {
2138
+ msg = '请检查读卡器时候连接,或者卡服务是否启动!!'
2139
+ }
2140
+ Vue.showAlert(msg, 'danger', 0)
2141
+ return 0
2142
+ }
2143
+ }
2144
+ export default CardService