sale-client 3.4.113 → 3.4.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,899 +1,899 @@
1
- <template>
2
- <div class="flex-row">
3
- <div class="span" style="overflow-y: hidden">
4
- <validator name='v'>
5
- <form novalidate class="form-horizontal">
6
- <div class="row">
7
- <div class="col-sm-4" :class="[$v.payment.required ? 'has-error' : '']">
8
- <label class=" font_normal_body" title="参数名称:付款方式">收款方式</label>
9
- <input type="text" v-show="false" v-model="$refs.payment.selectedItems"
10
- v-validate:payment='{required: true }'>
11
- <v-select v-model="f_payment"
12
- placeholder='请选择'
13
- :value.sync="model.f_payment"
14
- :options='paytype' clear-button v-ref:payment></v-select>
15
- </div>
16
-
17
- <div class="col-sm-4" v-if="row.f_collection_type == '按气量'"
18
- :class="[$v.f_pregas.required || $v.f_pregas.dctest? 'has-error' : 'has-success']">
19
- <label for="f_pregas" class=" font_normal_body">*预购气量</label>
20
- <input class="input_search" style="width:60%" type="number"
21
- @blur="pregas()" v-model="model.f_pregas"
22
- v-validate:f_pregas='{required: true, dctest: [maxgas, "<=" ]}' placeholder="预购气量"
23
- v-next-el='sk'>
24
- </div>
25
- <div class="col-sm-4" v-if="row.f_collection_type == '按金额'">
26
- <label for="f_pregas" class=" font_normal_body">*预购气量</label>
27
- <input class="input_search" style="width:60%" type="number"
28
- @blur="pregas()" v-model="model.f_pregas" placeholder="预购气量"
29
- v-next-el='sk'>
30
- </div>
31
- <div class="col-sm-4"
32
- :class="[$v.f_pregas.required || $v.f_pregas.dctest? 'has-error' : 'has-success']">
33
- <label for="f_pregas" class=" font_normal_body">*预购金额</label>
34
- <input class="input_search" style="width:60%" type="number"
35
- @blur="preamount()" v-model="model.f_preamount" id="fpregas"
36
- v-validate:f_preamount='{required: true, dctest: [maxmoney, "<=" ],dctest: [0, ">"]}' placeholder="预购金额"
37
- v-next-el='sk'>
38
- </div><!--
39
- <div class="col-sm-4" v-if="row.f_collection_type == '按气量'">
40
- <label for="f_preamount" class=" font_normal_body">&nbsp;预购金额</label>
41
- <input class="input_search" style="width:60%" type="number" v-model="model.f_preamount"
42
- v-scale="[model.f_preamount, 4]" placeholder="预购金额" disabled>
43
- </div>-->
44
-
45
- </div>
46
- <div class="row" style="margin-top:6px;">
47
- <div class="col-sm-4" :class="[$v.printstyle.required ? 'has-error' : '']">
48
- <label for="f_print" class="font_normal_body">打印格式</label>
49
- <input type="text" v-show="false" v-model="$refs.printstyle.selectedItems"
50
- v-validate:printstyle='{required: true }'>
51
- <v-select id="print"
52
- v-model="f_print"
53
- placeholder='请选择'
54
- :multiple="mulPrint"
55
- :value.sync="model.f_print"
56
- :options='printstyle'
57
- close-on-select clear-button v-ref:printstyle>
58
- </v-select>
59
- </div>
60
- <div class="col-sm-4 " v-if="hasLimit&&limitgas">
61
- <label class="font_normal_body">&ensp;购气上限</label>
62
- <input class="input_search" style="width:60%" style="width:60%" type="number" v-model="maxgas"
63
- v-scale="[maxgas, 4]" placeholder='限购余气' disabled>
64
- </div>
65
- <div class="col-sm-4 form-group" v-if="hasLimit&&limitmoney">
66
- <label class="font_normal_body">金额上限</label>
67
- <input class="input_search" style="width:60%" style="width:60%" type="number" v-model="maxmoney"
68
- v-scale="[maxmoney, 2]" placeholder='限购金额' disabled>
69
- </div>
70
- <div class="col-sm-4" v-if="!hasLimit">
71
- </div>
72
-
73
- <div class="col-sm-4"
74
- :class="[$v.f_totalcost.required || $v.f_totalcost.dctest ? 'has-error' : 'has-success']">
75
- <label for="f_temp_amount"
76
- class=" font_normal_body">&nbsp;应收金额</label>
77
- <input class="input_search" style="width:60%" type="number"
78
- @blur="preamount()" v-model="model.f_totalcost"
79
- v-validate:f_totalcost='{required: true, dctest: [0, ">=" ] }' placeholder="应收金额"
80
- v-next-el='sk' v-scale="[model.f_totalcost, 4]" disabled>
81
- </div>
82
- </div>
83
- <div class="row">
84
-
85
- <div class="col-sm-4">
86
- <label for="f_balance" class="font_normal_body">上期结余</label>
87
- <input class="input_search" style="width:60%" type="number" v-model="model.f_balance"
88
- v-scale="[model.f_balance, 4]" placeholder="上期结余" disabled>
89
- </div>
90
-
91
- <div class="col-sm-4">
92
- <label for="f_curbalance" class="font_normal_body">&nbsp;本期结余</label>
93
- <input class="input_search" style="width:60%" type="number" v-model="curbalance"
94
- v-scale="[curbalance, 4]" placeholder="本期结余" disabled>
95
- </div>
96
-
97
- <div class="col-sm-3" v-if="row.f_collection_type === '按气量' && model.f_payment!='赠气'"
98
- :class="[$v.f_collection.required || $v.f_collection.dctest ? 'has-error' : 'has-success']">
99
- <label for="f_collection" class=" font_normal_body">*收&emsp;&emsp;款</label>
100
- <input id="f_collection" class="input_search" style="width:60%" type="number" v-model="model.f_collection"
101
- v-validate:f_collection='{required: true, dctest: [(model.f_totalcost - 0), ">=" ] }'
102
- v-el:sk v-scale="[model.f_totalcost, 4]" :disabled="$refs.givechange.promptText != ''">
103
- </div>
104
- <div class="col-sm-3" v-if="row.f_collection_type === '按气量' && model.f_payment=='赠气'"
105
- :class="[$v.f_collection.required || $v.f_collection.dctest ? 'has-error' : 'has-success']">
106
- <label for="f_collection" class=" font_normal_body"><font size="4px" style="font-weight:bold">*收&emsp;款</font></label>
107
- <input id="f_collection" class="input_search" style="width:60%;font-size: 18px;font-weight:bold;" type="number" v-model="model.f_collection"
108
- v-el:sk v-scale="[model.f_totalcost, 4]" :disabled="$refs.givechange.promptText != ''">
109
- </div>
110
- <div class="col-sm-3" v-if="row.f_collection_type === '按金额'">
111
- <label for="f_collection" class=" font_normal_body"><font size="4px" style="font-weight:bold">*收&emsp;款</font></label>
112
- <input id="f_collection" class="input_search" style="width:50%;font-size: 18px;font-weight:bold;" type="number" v-model="model.f_collection"
113
- v-el:sk v-scale="[model.f_collection, 4]" :disabled="$refs.givechange.promptText != ''">
114
- </div>
115
- <div class="col-sm-1 form-group">
116
- <give-change :curbalance="curbalance" :collection.sync="model.f_collection" v-ref:givechange></give-change>
117
- </div>
118
- </div>
119
- <div class="row" style="margin-top:5px;">
120
- <div class="col-sm-9">
121
- </div>
122
- <div class="col-sm-3">
123
- <span v-if="$v.f_collection.dctest" style="color:red ">收款不能小于应收金额</span>
124
- </div>
125
- </div>
126
-
127
- <div class="row" style="margin-top:5px;" v-show="authArr.includes('优惠权限')">
128
- <div class="col-sm-4">
129
- <label class="font_normal_body">优惠方式</label>
130
- <v-select v-model="model.f_privilege_id" @blur.native.capture="privilegeCalculate"
131
- placeholder='请选择'
132
- :value.sync="model.f_privilege_id"
133
- :options='privilegeList' clear-button value-single>
134
- </v-select>
135
- </div>
136
- <div class="col-sm-4">
137
- <label for="f_preamount" class=" font_normal_body">&nbsp;优惠金额</label>
138
- <input class="input_search" style="width:60%" type="number" v-model="model.f_privilege_money"
139
- v-scale="[model.f_privilege_money, 2]" placeholder="优惠金额" disabled>
140
- </div>
141
- <div class="col-sm-4">
142
- <label for="f_preamount" class=" font_normal_body">&nbsp;实际收款</label>
143
- <input class="input_search" style="width:60%" type="number" v-model="model.f_after_discount"
144
- v-scale="[model.f_after_discount, 2]" placeholder="优惠后收款" disabled>
145
- </div>
146
- </div>
147
-
148
- <div class="row" v-if="model.f_payment[0].includes('POS')">
149
- <div class="col-sm-4">
150
- <label for="f_voucher_number" class="font_normal_body">凭证号</label>
151
- <input type="text" class="input_search" style="width:60%" v-model="model.f_voucher_number"
152
- placeholder="凭证号">
153
- </div>
154
- </div>
155
- <div class="row" style="padding-top: 0.5em;">
156
- <div class="col-sm-4" v-if="!mjshow">
157
- <label for="f_serial_number" class=" font_normal_body">业务单号</label>
158
- <input class="input_search" style="width:60%" type="text"
159
- v-model="model.f_serial_number" placeholder="业务单号">
160
- </div>
161
- <div class="col-sm-4" v-if="mjshow"
162
- :class="[$v.f_serial_number.required || $v.f_serial_number.dctest ? 'has-error' : 'has-success']">
163
- <label for="f_serial_number" class=" font_normal_body">业务单号</label>
164
- <input class="input_search" style="width:60%" type="text" v-validate:f_serial_number='{required: true }'
165
- v-model="model.f_serial_number" placeholder="业务单号">
166
- </div>
167
-
168
-
169
- <div class="col-sm-8">
170
- <label for="f_comments" class="font_normal_body">&nbsp;备&emsp;&emsp;注</label>
171
- <input class="input_search" style="width:77%" v-model="model.f_comments" rows="1" placeholder="备注">
172
- </div>
173
- </div>
174
-
175
- <div v-if="paymentModel.length >1">
176
- <div class="row" style="margin-top:10px;">
177
- <p class="col-sm-2 text-left" style="padding: 10px;"><img src="../../../../static/juxing.png"/><strong
178
- style="margin-left: 4%">付款明细</strong></p>
179
- </div>
180
- <div class="row" style="margin-top:10px;">
181
- <div class="col-sm-4 " v-for="pay in paymentModel">
182
- <label class="font_normal_body">{{pay.f_payment}}:</label>
183
- <input id="f_money" type="text" class="input_search" style="width:60%" v-model="pay.f_money">
184
- </div>
185
- <div class="col-sm-4 ">
186
- <strong v-if="!islegal" style="color: red">所输入的金额必须等于收款金额</strong>
187
- </div>
188
- </div>
189
- </div>
190
- </form>
191
- <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
192
- <print-bill :show="print" :bill-config='config' :bill-data='billData' :data='row' @toggle="close"
193
- @printok="printok" v-ref:printbill></print-bill>
194
- <div style="text-align:right; height: 25%">
195
- <strong style="color:red;margin-right: 5px">{{ $refs.givechange.promptText }}</strong>
196
- <strong style="font-size: large" v-if="!config.notShowFormula">计算公式:{{calculatedetail ? calculatedetail : ' 暂无'}}</strong><br/>
197
- <payment-code-button :clickable="!$v.valid || validateOk || !islegal || clickConfirm"
198
- :payment.sync="model.f_payment" :payment-data="paytype"
199
- @confirm-payment="confirm()">
200
- </payment-code-button>
201
- <button class="button_search btn-gn" type="submit" @click="checkInvoiceMsg()"
202
- :disabled='!$v.valid || validateOk || !islegal || clickConfirm'>确认
203
- </button>
204
- <button class="button_clear btn-gn" @click="clean()">取消</button>
205
- </div>
206
- </validator>
207
- <modal :show.sync="eticket_msg" v-ref:modal large backdrop="false" :width="900">
208
- <header slot="modal-header" class="modal-header">
209
- <button type="button" class="close" @click="eticket_msg = false"><span>&times;</span></button>
210
- <h4 class="modal-title">发票信息</h4>
211
- </header>
212
- <article slot="modal-body" class="modal-body">
213
- <div class="auto select-overspread form-horizontal">
214
- <div class="row auto">
215
- <div class="col-sm-6 form-group form-input-group" :class="[!row.f_paper_name ? 'has-error' : '']">
216
- <label class="control-label">开票名称:</label>
217
- <input class="form-control col-sm-2"
218
- v-model="row.f_paper_name" placeholder="开票名称">
219
- </div>
220
- <div class="col-sm-6 form-group form-input-group">
221
- <nobr class="col-sm-4"><label class="control-label">是否征税:</label></nobr>
222
- <v-select v-model="invoice_is_pax"
223
- placeholder='请选择'
224
- :value.sync="invoice_is_pax"
225
- close-on-select
226
- :width="60"
227
- :value-single="true"
228
- :search="false"
229
- :options='is_pax' clear-button>
230
- </v-select>
231
- </div>
232
- <div class="col-sm-12 form-group form-input-group">
233
- <label class="control-label">开户行及账号:</label>
234
- <input class="form-control col-sm-2"
235
- v-model="row.f_paper_account" placeholder="购方开户行及账号">
236
- </div>
237
- <div class="col-sm-12 form-group form-input-group" >
238
- <label class="control-label">纳税人识别号:</label>
239
- <input class="form-control col-sm-2"
240
- v-model="row.f_taxpayer_id" placeholder="纳税人识别号">
241
- </div>
242
- <div class="col-sm-12 form-group form-input-group" :class="[!row.f_address_phone ? 'has-error' : '']">
243
- <label class="control-label">开票地址电话:</label>
244
- <input class="form-control col-sm-2"
245
- v-model="row.f_address_phone" placeholder="开票地址">
246
- </div>
247
- <div class="col-sm-12 form-group form-input-group">
248
- <label class="control-label">邮箱推送:</label>
249
- <input class="form-control col-sm-2"
250
- v-model="row.f_email" placeholder="邮箱推送">
251
- </div>
252
- </div>
253
- </div>
254
- </article>
255
- <footer slot="modal-footer" class="modal-footer">
256
- <button type="button" class="btn button_search"
257
- :disabled="!(row.f_paper_name&&row.f_address_phone)"
258
- @click='confirm'>确认收费
259
- </button>
260
- </footer>
261
- </modal>
262
- <ticket-print :show="eticket_show" @toggle="eticket_toggle" v-ref:eticketbill></ticket-print>
263
- <payment-code v-ref:paymentcode :payment="model.f_payment" :row="row" :money="model.f_after_discount"></payment-code>
264
- </div>
265
- </div>
266
- <upload :blodid="blodid" v-if="config.showupload" isremark="true" fusetype="卡表收费"></upload>
267
- </template>
268
- <script>
269
- import {HttpResetClass} from 'vue-client'
270
- import XML from '../../../plugins/ObjTree'
271
-
272
- /**
273
- *综合业务
274
- *卡表收费组件
275
- */
276
-
277
- // 输入金额,换算气量
278
- let preamountGen = async function (self) {
279
- let calFee = ((self.model.f_preamount - 0)).toFixed(4)
280
- if (self.model.f_payment == '赠气') {
281
- calFee = (self.model.f_preamount - 0).toFixed(4)
282
- }
283
- // 通过金额进行划价
284
- let getGas = await self.$CommonService.feeCalculate(self.model, calFee)
285
- if (getGas.data.gas) {
286
- if (self.row.f_isdecimal === '是') {
287
- if (self.row.f_alias === 'QiaoSong') {
288
- self.model.f_pregas = (getGas.data.gas - 0).toFixed(1)
289
- } else {
290
- self.model.f_pregas = (getGas.data.gas - 0).toFixed(4)
291
- }
292
- if (self.row.f_collection_type === '按金额') {
293
- self.dymoney = 0
294
- } else {
295
- let dymoney2 = await self.$CommonService.gasCalculate(self.model, (getGas.data.gas).toFixed(4))
296
- self.dymoney = (getGas.data.chargenum - 0).toFixed(4) - (dymoney2.data.chargenum - 0).toFixed(4)
297
- }
298
- } else {
299
- // 如果不支持小数,将划价出的多余非整数气量进行划价为金额
300
- let tempnum = Math.floor(getGas.data.gas - 0)
301
- let dymoney1 = await self.$CommonService.gasCalculate(self.model, (tempnum).toFixed(4))
302
- self.dymoney = (getGas.data.chargenum - 0).toFixed(2) - (dymoney1.data.chargenum - 0).toFixed(2)
303
- self.model.f_pregas = Math.floor(getGas.data.gas - 0)
304
- }
305
- }
306
- self.model.f_totalcost = ((self.row.f_balance - 0) >= (self.model.f_preamount - 0) ? 0 : (self.model.f_preamount - 0 - self.row.f_balance))
307
-
308
- self.model.chargeprice = getGas.data.chargeprice
309
- Object.assign(self.model, self.model, getGas.data)
310
- if (self.model.f_payment == '赠气') {
311
- self.model.f_totalcost = self.model.f_preamount
312
- self.model.f_collection = 0
313
- } else {
314
- self.model.f_collection = self.config.autoCollection ? self.model.f_totalcost : 0
315
- self.model.f_totalcost = ((self.model.f_totalcost - 0) - (self.dymoney - 0)).toFixed(4)
316
- }
317
- self.model.f_preamount = (calFee - (self.dymoney - 0)).toFixed(4)
318
- self.calText(getGas.data.chargeprice)
319
- }
320
-
321
- // 输入气量,换算金额
322
- let pregasGen = async function (self) {
323
- if (self.row.f_isdecimal === '是') {
324
- self.model.f_pregas = (self.model.f_pregas - 0).toFixed(4)
325
- } else {
326
- self.model.f_pregas = (self.model.f_pregas - 0).toFixed(0)
327
- }
328
- if ((self.model.f_pregas - 0) - (self.maxgas - 0) <= 0) {
329
- self.model.f_meter_type = self.row.f_meter_type
330
- let getAmount = await self.$CommonService.gasCalculate(self.model, self.model.f_pregas)
331
- self.model.f_preamount = getAmount.data.chargenum
332
- self.model.f_totalcost = ((self.row.f_balance - 0) > (getAmount.data.chargenum - 0) ? 0 : ((getAmount.data.chargenum - 0) - (self.row.f_balance - 0)).toFixed(4))
333
- Object.assign(self.model, self.model, getAmount.data)
334
- self.model.chargeprice = getAmount.data.chargeprice
335
- if (self.model.f_payment == '赠气') {
336
- self.model.f_totalcost = getAmount.data.chargenum
337
- self.model.f_collection = 0
338
- } else {
339
- self.model.f_collection = self.config.autoCollection ? self.model.f_totalcost : 0
340
- }
341
- self.calText(getAmount.data.chargeprice)
342
- }
343
- }
344
- // 执行保存逻辑
345
- let sellgasGen = async function (self) {
346
- try {
347
- self.row.cardInfo = self.cardData
348
-
349
- if (self.paymentModel.length === 0) {
350
- self.paymentModel = [{
351
- f_payment: self.model.f_payment[0],
352
- f_money: self.model.f_preamount
353
- }]
354
- }
355
- self.model.xiekamoney = self.model.f_preamount
356
- if (self.row.f_price_type == '阶梯气价' && self.row.f_is_step == '否') {
357
- self.model.xiekamoney = (self.model.f_pregas * self.model.chargeprice[0].f_price)
358
- self.model.xiekamoney = self.model.xiekamoney.toFixed(4)
359
- }
360
-
361
- self.model.payments = self.paymentModel
362
- // 加入扫码盒付款码支付流水号
363
- self.model.f_serial_id = self.$refs.paymentcode.paymentCodeReturnData.f_out_trade_no
364
- let res = await self.$CardService.sellgas(self.model, self.row)
365
- console.log('----------------->卡表收费返回id', res)
366
- let localeSustainMoney = window.localStorage.getItem('sustainMoney')
367
- if (localeSustainMoney != null) {
368
- localeSustainMoney = (localeSustainMoney - 0) + (self.model.f_collection - 0)
369
- window.localStorage.setItem('sustainMoney', localeSustainMoney)
370
- }
371
- let param = []
372
- for (let row of self.resid) {
373
- param.push({id: row.id})
374
- }
375
- let writeid
376
- if (res.data && res.data.id) {
377
- writeid = res.data.id
378
- } else {
379
- writeid = res
380
- }
381
- let data = {
382
- param: param,
383
- f_blobid: writeid
384
- }
385
-
386
- await self.$resetpost('rs/logic/updatefiles', data)
387
- console.log(self.config, self.config.hasPrint && !self.$login.r.includes('不打印发票'))
388
- // 开始打票
389
- if (self.config.hasPrint && !self.$login.r.includes('不打印发票')) {
390
- if (self.model.f_print.indexOf('电子发票') == -1) {
391
- if (self.config.hasBillManage) {
392
- // 启用发票管理,获取票据管理中的票号并存储记录
393
- self.row.id = res
394
- self.row.f_bill_type = '卡表收费'
395
- self.row.f_bill_style = self.model.f_print[0]
396
- self.print = true
397
- } else {
398
- self.row.id = res
399
- self.print = true
400
- }
401
- } else {
402
- if (self.model.f_print[0] === '电子发票') {
403
- self.row.id = res
404
- self.eticket_show = true
405
- //应铜川需要卡表显示
406
- await self.$refs.eticketbill.openETicket([res], self.row, '是', self.invoice_is_pax, '卡表收费')
407
- // await self.$CommonService.openEticket(res, '售气收费')
408
- // self.print = true
409
- }
410
- }
411
- } else {
412
- self.$dispatch('success')
413
- }
414
- self.clickConfirm = false
415
- } catch (error) {
416
- console.log('捕获到异常', error)
417
- if (error instanceof Object) {
418
- self.$showAlert(error.data, 'danger', 0)
419
- } else {
420
- self.$showAlert(error, 'danger', 0)
421
- }
422
- self.$dispatch('refresh')
423
- self.clickConfirm = false
424
- }
425
- }
426
-
427
- let asyncCardMeterCenter = async function (self) {
428
- await self.$getConfig(self, 'CardMeterCenter')
429
- console.log('卡表收费config', self.config)
430
- // 默认打印格式
431
- self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
432
- self.model.f_payment = [self.config.payment]
433
- self.mulPrint = self.config.printType instanceof Array
434
-
435
- // 获取当前票号用
436
- self.model.f_use_type = self.config.billType
437
- self.model.f_bill_type = self.model.f_print
438
- self.hasValidateBill = self.config.hasBillManage
439
-
440
- // 判断限购
441
- let limit_param = {
442
- f_userinfo_id: self.row.f_userinfo_id,
443
- f_user_id: self.row.f_user_id,
444
- f_stairprice_id: self.row.f_stairprice_id
445
- }
446
- let getLimit = await self.$resetpost('rs/logic/sale_getLimitGas', {data: limit_param}, {
447
- resolveMsg: null,
448
- rejectMsg: '获取限购值失败!!'
449
- })
450
- console.log('获取限购值', getLimit)
451
- self.hasLimit = getLimit.data.hasLimit
452
- if (self.hasLimit) {
453
- if (getLimit.data.f_limit_value || getLimit.data.f_limit_amount) {
454
- if (getLimit.data.f_limit_value < 0 && getLimit.data.f_limit_amount < 0) {
455
- self.$showAlert(`${getLimit.data.msg}`, 'warning', 3000)
456
- self.$dispatch('refresh')
457
- } else {
458
- if (getLimit.data.f_limit_value) {
459
- self.maxgas = (getLimit.data.f_limit_value - 0)
460
- self.limitgas = true
461
- }
462
- if (getLimit.data.f_limit_amount) {
463
- self.maxmoney = (getLimit.data.f_limit_amount - 0)
464
- self.limitmoney = true
465
- }
466
- }
467
- }
468
- }
469
- let nowrite_param = {
470
- f_userfiles_id: self.row.f_userfiles_id,
471
- }
472
- let getNoWriteCard = await self.$resetpost('rs/sql/getnowritecard', {data: nowrite_param}, {
473
- resolveMsg: null,
474
- rejectMsg: '获取限购值失败!!'
475
- })
476
- if(getNoWriteCard.data.length >0){
477
- self.$showMessage(`三小时内存在写卡失败的记录,是否重新写卡?`, ['confirm', 'cancel']).then(async (res) => {
478
- if (res === 'confirm') {
479
- let url = 'http://127.0.0.1:8003/'+ getNoWriteCard.data[0].f_cardpost
480
- let param = JSON.parse(getNoWriteCard.data[0].f_cardparam)
481
- let cardRes = await self.$resetpost(url, param, {resolveMsg: null, rejectMsg: '重新写卡失败'})
482
- if (cardRes.data.Err || cardRes.data.Exception) {
483
- self.$showAlert(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`, 'danger', 3000)
484
- self.$dispatch('refresh', self.row)
485
- } else {
486
- self.$resetpost('rs/logic/writeCardAgin', getNoWriteCard.data[0], {resolveMsg: '重新写卡成功', rejectMsg: '重新写卡失败'})
487
- self.$dispatch('success')
488
- }
489
- }else{
490
- self.$dispatch('refresh', self.row)
491
- }
492
- })
493
- }
494
-
495
- }
496
- export default {
497
- title: '卡表收费',
498
- data () {
499
- return {
500
- mjshow: false,
501
- serialShow: false,
502
- resid: [], // 存放新增的f_files表中id
503
- config: {
504
- notShowFormula: false, // 不显示计算公式,默认显示
505
- autoCollection: true, // 自动填写收款
506
- showupload: true, // 显示上传
507
- hasPrint: false, // 默认打票
508
- hasBillManage: false, // 默认不启用发票管理
509
- billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
510
- printType: '普通收据', // 收据/电子票/专用发票/国税发票
511
- payment: '现金缴费'
512
- },
513
- eticket_msg: false,
514
- eticket_show: false,
515
- invoice_is_pax: '不征税',
516
- is_pax: [{label: '征税', value: '征税'}, {label: '不征税', value: '不征税'}],
517
- model: {
518
- f_purchase: 0,
519
- f_payment: [],
520
- f_pregas: '',
521
- f_preamount: 0,
522
- f_totalcost: 0,
523
- f_curbalance: 0,
524
- f_collection: '',
525
- f_balance: 0,
526
- f_print: [],
527
- f_meter_type: '',
528
- f_voucher_number: '',
529
- f_banktransfer_person: '',
530
- f_banktransfer_date: '',
531
- f_privilege_id: 0,
532
- f_privilege_money: 0,
533
- f_after_discount: 0
534
- },
535
- calculatedetail: '',
536
-
537
- // 启用发票管理需要对票号进行验证
538
- hasValidateBill: false,
539
- validateOk: false,
540
-
541
- print: false,
542
- billData: {
543
- url: 'rs/report/card_bill',
544
- billnumber: ''
545
- },
546
- hasLimit: false,
547
- maxgas: 99999999, // 限购
548
- maxmoney: 99999999,
549
- limitmoney: false,
550
- limitgas: false,
551
-
552
- paymentModel: [], // 多笔付款方式
553
-
554
- mulPrint: false,
555
- clickConfirm: false, // 控制确认按钮只能点击一次
556
- // 下拉框值
557
- paytype: [],
558
- printstyle: this.$appdata.getParam('打印格式'),
559
- privilegeList: [{label: '无优惠', value: '0'}],
560
- BankTransfer: false,
561
- // 小数是否支持,导致划价产生的多余气量,金额
562
- dymoney: 0
563
- }
564
- },
565
- props: ['row', 'cardData'],
566
- async ready () {
567
- if (this.authArr.includes('余额写卡限定')) {
568
- this.paytype = [{label: '余额写卡', value: '余额写卡'}]
569
- } else {
570
- this.paytype = await this.$appdata.getParam('付款方式') ? await this.$appdata.getParam('付款方式') : []
571
- if (!this.$login.r.includes('免交充值付款')) {
572
- this.paytype = this.paytype.filter((item) => {
573
- return item.label != '免交'
574
- })
575
- }
576
- }
577
- // this.getPurchase()
578
- this.model.f_price_id = this.row.f_price_id
579
- this.model.f_user_id = this.row.f_user_id
580
- this.model.f_userfiles_id = this.row.f_userfiles_id
581
- this.model.f_userinfo_id = this.row.f_userinfo_id
582
- this.model.f_balance = this.row.f_alias === 'QiaoSong' ? Math.trunc(this.row.f_balance) : this.row.f_balance
583
- if (this.row.f_collection_type == '按金额') {
584
- this.model.f_preamount = ''
585
- this.model.f_pregas = 0
586
- }
587
- document.getElementById('fpregas').focus()
588
- asyncCardMeterCenter(this)
589
- },
590
- watch: {
591
- 'model.f_payment.length' (val) {
592
- console.log('付款方式多选。。', val)
593
- if (val > 1 && !this.model.f_preamount) {
594
- this.model.f_payment = ['现金缴费']
595
- this.$showAlert('请先计算付款金额', 'warning', 2000)
596
- } else {
597
- this.paymentModel = []
598
-
599
- this.model.f_payment.forEach((res) => {
600
- let temp = {
601
- f_payment: res,
602
- f_money: 0
603
- }
604
- this.paymentModel.push(temp)
605
- })
606
- this.$resetValidation()
607
-
608
- // 获取计算优惠
609
- this.getPrivilegeList()
610
- }
611
- },
612
- 'model.f_payment' (val) {
613
- if (val == '免交') {
614
- this.mjshow = true
615
- } else if (val == '赠气' && (this.model.f_preamount || this.model.f_preamount != '')) {
616
- if (this.row.f_collection_type == '按气量') {
617
- this.pregas()
618
- } else {
619
- this.preamount()
620
- }
621
- } else {
622
- this.mjshow = false
623
- }
624
- // if(this.row.f_collection_type == '按气量'){
625
- // this.pregas();
626
- // }else{
627
- // this.preamount();
628
- // }
629
- },
630
- 'model.f_collection' (val) {
631
- // 获取计算优惠
632
- this.getPrivilegeList()
633
- }
634
- },
635
- events: {
636
- // 删除Resid数组元素
637
- 'delResid' (val) {
638
- this.resid.$remove({id: val, f_biobid: ''})
639
- // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
640
- },
641
- // 增加Resid数组元素
642
- 'resid' (val) {
643
- this.resid.push({id: val, f_biobid: ''})
644
- }
645
- },
646
- methods: {
647
- // 校验发票信息
648
- checkInvoiceMsg () {
649
- console.log(this.model.f_print[0])
650
- if (this.model.f_print[0] === '电子发票') {
651
- if (!this.row.f_taxpayer_id) {
652
- this.row.f_taxpayer_id = this.row.f_idnumber
653
- }
654
- if (!this.row.f_paper_name) {
655
- this.row.f_paper_name = this.row.f_user_name
656
- }
657
- if (!this.row.f_address_phone) {
658
- this.row.f_address_phone = this.row.f_address + ' ' + this.row.f_user_phone
659
- }
660
- if(!this.row.f_email){
661
- this.row.f_email = this.row.f_email
662
- }
663
- this.eticket_msg = true
664
- } else {
665
- this.confirm()
666
- }
667
- },
668
- confirm () {
669
- this.eticket_msg = false
670
- if (this.model.f_payment.length > 0 && this.model.f_payment.includes('余额写卡')) {
671
- if (this.model.f_collection > this.row.f_balance) {
672
- this.$showAlert('请注意!您的账户余额小于当前写卡金额,无法进行余额写卡,请修改后重试', 'warning', 2000)
673
- return
674
- }
675
-
676
- if (this.model.f_collection > 0) {
677
- this.$showAlert('请注意!进行余额写卡,收款不能大于0', 'warning', 1000)
678
- return
679
- }
680
- }
681
- this.$showMessage(`确定对用户${this.row.f_user_name}进行卡表收费吗?`, ['confirm', 'cancel']).then(async (res) => {
682
- if (res === 'confirm') {
683
- // 先调用付款码支付组件流程
684
- let ss = await this.$refs.paymentcode.flowPath()
685
- this.$refs.paymentcode.paymentCodeShow = false
686
- console.log('付款码操作返回', ss)
687
- if (!ss.result) return
688
-
689
- this.clickConfirm = true
690
- this.model.f_curbalance = this.curbalance
691
- this.$dispatch('no-button')
692
- sellgasGen(this)
693
- }
694
- })
695
- },
696
- eticket_toggle () {
697
- this.eticket_show = false
698
- this.$dispatch('success')
699
- },
700
- clean () {
701
- this.$info('取消操作')
702
- this.$dispatch('refresh', this.row)
703
- },
704
- validateBill (val) {
705
- this.validateOk = !val.isOk
706
- this.billData.bill = val.bill
707
- },
708
- printok () {
709
- // 收据打完,判断是否还有其他票据进行请求
710
- for (let i = 0; i < this.model.f_print.length; i++) {
711
- if (this.model.f_print[i] === '电子发票') {
712
- this.$CommonService.openEticket(this.row.id, '售气收费')
713
- }
714
- }
715
- this.$dispatch('success')
716
- },
717
- pregas () {
718
- this.dymoney = 0
719
- if (this.model.f_pregas && this.model.f_pregas > 0) {
720
- try {
721
- // 对气量进行验证
722
- if ((this.row.f_topup_ceil - 0) > 0 && (this.model.f_pregas - 0) > (this.row.f_topup_ceil - 0)) {
723
- this.$showAlert(`您输入的气量不能大于该表的充值上限: ${this.row.f_topup_ceil}`, 'warning', 5000)
724
- this.model.f_pregas = null
725
- } else {
726
- pregasGen(this)
727
- }
728
- } catch (error) {
729
- this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
730
- this.$dispatch('error', '发卡售气', this.model, error)
731
- }
732
- } else {
733
- this.model.f_pregas = null
734
- }
735
- },
736
- preamount () {
737
- this.dymoney = 0
738
- this.model.f_price_id = this.row.f_price_id
739
- this.model.f_user_id = this.row.f_user_id
740
- this.model.f_userfiles_id = this.row.f_userfiles_id
741
- this.model.f_userinfo_id = this.row.f_userinfo_id
742
- try {
743
- preamountGen(this)
744
- } catch (error) {
745
- this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
746
- this.$dispatch('error', '发卡售气', this.model, error)
747
- }
748
- },
749
- calText (val) {
750
- let str = ''
751
- let num = 0
752
- val.forEach((item) => {
753
- if (item.f_gas > 0) {
754
- num = num + 1
755
- }
756
- if (this.row.f_isdecimal === '是') {
757
- str = str + item.f_price + ' x ' + item.f_gas + '+'
758
- } else {
759
- str = str + item.f_price + ' x ' + Math.floor(item.f_gas) + '+'
760
- }
761
- })
762
- str = str.slice(0, str.length - 1)
763
- this.calculatedetail = str
764
- if (num > 1) {
765
- if(this.$login.r.find(item=>item=='阶梯提示无按钮')){
766
- this.$showAlert('友好提示:本次购气已跨阶梯', 'warning', 3000)
767
- }else{
768
- this.$showMessage('友好提示:本次购气已跨阶梯',['confirm','cancel']);
769
- }
770
- }
771
- },
772
- close () {
773
- this.print = false
774
- this.clean()
775
- },
776
- paymentchange () {
777
- console.log('model.f_payment', this.model.f_payment[0])
778
- if (JSON.stringify(this.model.f_payment).indexOf('转账') !== -1) {
779
- // 进入转账筛选条件
780
- this.model.f_banktransfer_person = ''
781
- this.model.f_banktransfer_date = ''
782
- this.BankTransfer = true
783
- } else {
784
- this.model.f_banktransfer_person = ''
785
- this.model.f_banktransfer_date = ''
786
- this.BankTransfer = false
787
- }
788
- },
789
- // 根据选择的付款方式 获取优惠列表
790
- async getPrivilegeList () {
791
- // 初始化下拉选择列表
792
- this.privilegeList = [{label: '无优惠', value: '0'}]
793
- // 初始为无优惠
794
- this.model.f_privilege_id = '0'
795
- if (this.model.f_payment && this.model.f_payment.length) {
796
- // 查询条件
797
- let payments = JSON.stringify(this.model.f_payment)
798
- payments = payments.replace('[', '(').replace(']', ')').replace(/"/g, '\'')
799
- let HttpReset = new HttpResetClass()
800
- let privilege = await HttpReset.load('POST', 'rs/sql/singleTable_OrderBy', {
801
- data: {
802
- items: 'id,f_privilege_name,f_privilege_type',
803
- tablename: 't_privilege',
804
- condition: `f_payment in ${payments} and f_gasproperties = '${this.row.f_gasproperties}' and f_user_type = '${this.row.f_user_type}' and f_perform_date <= GETDATE() and f_end_date >= GETDATE() and f_state = '有效'`,
805
- orderitem: 'id'
806
- }
807
- }, {resolveMsg: null, rejectMsg: '查询优惠信息失败'})
808
- // 查询结果放到下拉列表
809
- for (let p of privilege.data) {
810
- this.privilegeList.push({label: p.f_privilege_name, value: p.id, type: p.f_privilege_type})
811
- }
812
- this.privilegeCalculate()
813
- }
814
- },
815
- // 优惠计算
816
- async privilegeCalculate () {
817
- // 初始化减免金额
818
- this.model.f_privilege_money = 0
819
- this.model.f_after_discount = this.model.f_collection
820
- // 判断是否是自定义优惠
821
- if (this.model.f_privilege_id != null && parseInt(this.model.f_privilege_id)) {
822
- for (let p of this.privilegeList) {
823
- if (p.value == this.model.f_privilege_id && p.type == '自定义') {
824
- this.model.f_privilege_money = window.prompt('请输入你想优惠的金额')
825
- if (!(/^[1-9]\d*(\.\d+)?$/).test(this.model.f_privilege_money) || !(/^[1-9]\d*(\.\d+)?$/).test(this.model.f_privilege_money)) {
826
- this.$showMessage('金额输入格式不正确!')
827
- this.model.f_privilege_money = 0
828
- return
829
- }
830
- if ((this.model.f_privilege_money - 0) >= this.model.f_collection) {
831
- this.$showMessage('减免金额不能大于等于收款金额')
832
- this.model.f_privilege_money = 0
833
- return
834
- }
835
- }
836
- }
837
- }
838
- // 优惠方式, 收款 缺一不计算
839
- if (this.model.f_payment && this.model.f_payment.length && parseInt(this.model.f_privilege_id) && this.model.f_collection) {
840
- let c = {
841
- f_privilege_id: this.model.f_privilege_id,
842
- f_collection: this.model.f_collection,
843
- f_privilege_money: this.data.f_privilege_money
844
- }
845
- let privilegeData = await this.$resetpost('rs/logic/calculatePrivilege', c, {
846
- resolveMsg: null,
847
- rejectMsg: '计算优惠金额出错'
848
- })
849
- // 减免金额
850
- this.model.f_privilege_money = privilegeData.data.f_privilege_money
851
- // 减免后收款金额
852
- this.model.f_after_discount = privilegeData.data.f_collection
853
- }
854
- }
855
- },
856
- computed: {
857
- authArr () {
858
- return this.$login.r ? this.$login.r : []
859
- },
860
- 'curbalance' () {
861
- if (this.model.f_payment == '赠气') {
862
- return this.model.f_balance
863
- }
864
- if (this.model.f_preamount) {
865
- // if (this.row.f_collection_type === '按金额') {
866
- // return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
867
- // } else {
868
- if ((this.row.f_balance - 0) > (this.model.f_preamount - 0)) {
869
- return ((this.row.f_balance - 0) - (this.model.f_preamount - 0) + (this.model.f_collection - 0)).toFixed(4)
870
- } else {
871
- return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
872
- }
873
- // return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
874
- // }
875
- } else {
876
- return this.row.f_balance
877
- }
878
- },
879
- 'invoice_show_gas' () {
880
- return this.row.f_collection_type === '按气量' ? '是' : '否'
881
- },
882
- 'islegal' () {
883
- console.log('支付分离。。。', this.paymentModel.length, this.model.f_collection)
884
- if (this.paymentModel.length > 1 && this.model.f_collection) {
885
- let sum = 0
886
- this.paymentModel.forEach((res) => {
887
- sum += (res.f_money - 0)
888
- })
889
- return (this.model.f_collection - 0) === (sum - 0)
890
- } else {
891
- return true
892
- }
893
- }
894
- }
895
- }
896
- </script>
897
-
898
- <style>
899
- </style>
1
+ <template>
2
+ <div class="flex-row">
3
+ <div class="span" style="overflow-y: hidden">
4
+ <validator name='v'>
5
+ <form novalidate class="form-horizontal">
6
+ <div class="row">
7
+ <div class="col-sm-4" :class="[$v.payment.required ? 'has-error' : '']">
8
+ <label class=" font_normal_body" title="参数名称:付款方式">收款方式</label>
9
+ <input type="text" v-show="false" v-model="$refs.payment.selectedItems"
10
+ v-validate:payment='{required: true }'>
11
+ <v-select v-model="f_payment"
12
+ placeholder='请选择'
13
+ :value.sync="model.f_payment"
14
+ :options='paytype' clear-button v-ref:payment></v-select>
15
+ </div>
16
+
17
+ <div class="col-sm-4" v-if="row.f_collection_type == '按气量'"
18
+ :class="[$v.f_pregas.required || $v.f_pregas.dctest? 'has-error' : 'has-success']">
19
+ <label for="f_pregas" class=" font_normal_body">*预购气量</label>
20
+ <input class="input_search" style="width:60%" type="number"
21
+ @blur="pregas()" v-model="model.f_pregas"
22
+ v-validate:f_pregas='{required: true, dctest: [maxgas, "<=" ]}' placeholder="预购气量"
23
+ v-next-el='sk'>
24
+ </div>
25
+ <div class="col-sm-4" v-if="row.f_collection_type == '按金额'">
26
+ <label for="f_pregas" class=" font_normal_body">*预购气量</label>
27
+ <input class="input_search" style="width:60%" type="number"
28
+ @blur="pregas()" v-model="model.f_pregas" placeholder="预购气量"
29
+ v-next-el='sk'>
30
+ </div>
31
+ <div class="col-sm-4"
32
+ :class="[$v.f_pregas.required || $v.f_pregas.dctest? 'has-error' : 'has-success']">
33
+ <label for="f_pregas" class=" font_normal_body">*预购金额</label>
34
+ <input class="input_search" style="width:60%" type="number"
35
+ @blur="preamount()" v-model="model.f_preamount" id="fpregas"
36
+ v-validate:f_preamount='{required: true, dctest: [maxmoney, "<=" ],dctest: [0, ">"]}' placeholder="预购金额"
37
+ v-next-el='sk'>
38
+ </div><!--
39
+ <div class="col-sm-4" v-if="row.f_collection_type == '按气量'">
40
+ <label for="f_preamount" class=" font_normal_body">&nbsp;预购金额</label>
41
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_preamount"
42
+ v-scale="[model.f_preamount, 4]" placeholder="预购金额" disabled>
43
+ </div>-->
44
+
45
+ </div>
46
+ <div class="row" style="margin-top:6px;">
47
+ <div class="col-sm-4" :class="[$v.printstyle.required ? 'has-error' : '']">
48
+ <label for="f_print" class="font_normal_body">打印格式</label>
49
+ <input type="text" v-show="false" v-model="$refs.printstyle.selectedItems"
50
+ v-validate:printstyle='{required: true }'>
51
+ <v-select id="print"
52
+ v-model="f_print"
53
+ placeholder='请选择'
54
+ :multiple="mulPrint"
55
+ :value.sync="model.f_print"
56
+ :options='printstyle'
57
+ close-on-select clear-button v-ref:printstyle>
58
+ </v-select>
59
+ </div>
60
+ <div class="col-sm-4 " v-if="hasLimit&&limitgas">
61
+ <label class="font_normal_body">&ensp;购气上限</label>
62
+ <input class="input_search" style="width:60%" style="width:60%" type="number" v-model="maxgas"
63
+ v-scale="[maxgas, 4]" placeholder='限购余气' disabled>
64
+ </div>
65
+ <div class="col-sm-4 form-group" v-if="hasLimit&&limitmoney">
66
+ <label class="font_normal_body">金额上限</label>
67
+ <input class="input_search" style="width:60%" style="width:60%" type="number" v-model="maxmoney"
68
+ v-scale="[maxmoney, 2]" placeholder='限购金额' disabled>
69
+ </div>
70
+ <div class="col-sm-4" v-if="!hasLimit">
71
+ </div>
72
+
73
+ <div class="col-sm-4"
74
+ :class="[$v.f_totalcost.required || $v.f_totalcost.dctest ? 'has-error' : 'has-success']">
75
+ <label for="f_temp_amount"
76
+ class=" font_normal_body">&nbsp;应收金额</label>
77
+ <input class="input_search" style="width:60%" type="number"
78
+ @blur="preamount()" v-model="model.f_totalcost"
79
+ v-validate:f_totalcost='{required: true, dctest: [0, ">=" ] }' placeholder="应收金额"
80
+ v-next-el='sk' v-scale="[model.f_totalcost, 4]" disabled>
81
+ </div>
82
+ </div>
83
+ <div class="row">
84
+
85
+ <div class="col-sm-4">
86
+ <label for="f_balance" class="font_normal_body">上期结余</label>
87
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_balance"
88
+ v-scale="[model.f_balance, 4]" placeholder="上期结余" disabled>
89
+ </div>
90
+
91
+ <div class="col-sm-4">
92
+ <label for="f_curbalance" class="font_normal_body">&nbsp;本期结余</label>
93
+ <input class="input_search" style="width:60%" type="number" v-model="curbalance"
94
+ v-scale="[curbalance, 4]" placeholder="本期结余" disabled>
95
+ </div>
96
+
97
+ <div class="col-sm-3" v-if="row.f_collection_type === '按气量' && model.f_payment!='赠气'"
98
+ :class="[$v.f_collection.required || $v.f_collection.dctest ? 'has-error' : 'has-success']">
99
+ <label for="f_collection" class=" font_normal_body">*收&emsp;&emsp;款</label>
100
+ <input id="f_collection" class="input_search" style="width:60%" type="number" v-model="model.f_collection"
101
+ v-validate:f_collection='{required: true, dctest: [(model.f_totalcost - 0), ">=" ] }'
102
+ v-el:sk v-scale="[model.f_totalcost, 4]" :disabled="$refs.givechange.promptText != ''">
103
+ </div>
104
+ <div class="col-sm-3" v-if="row.f_collection_type === '按气量' && model.f_payment=='赠气'"
105
+ :class="[$v.f_collection.required || $v.f_collection.dctest ? 'has-error' : 'has-success']">
106
+ <label for="f_collection" class=" font_normal_body"><font size="4px" style="font-weight:bold">*收&emsp;款</font></label>
107
+ <input id="f_collection" class="input_search" style="width:60%;font-size: 18px;font-weight:bold;" type="number" v-model="model.f_collection"
108
+ v-el:sk v-scale="[model.f_totalcost, 4]" :disabled="$refs.givechange.promptText != ''">
109
+ </div>
110
+ <div class="col-sm-3" v-if="row.f_collection_type === '按金额'">
111
+ <label for="f_collection" class=" font_normal_body"><font size="4px" style="font-weight:bold">*收&emsp;款</font></label>
112
+ <input id="f_collection" class="input_search" style="width:50%;font-size: 18px;font-weight:bold;" type="number" v-model="model.f_collection"
113
+ v-el:sk v-scale="[model.f_collection, 4]" :disabled="$refs.givechange.promptText != ''">
114
+ </div>
115
+ <div class="col-sm-1 form-group">
116
+ <give-change :curbalance="curbalance" :collection.sync="model.f_collection" v-ref:givechange></give-change>
117
+ </div>
118
+ </div>
119
+ <div class="row" style="margin-top:5px;">
120
+ <div class="col-sm-9">
121
+ </div>
122
+ <div class="col-sm-3">
123
+ <span v-if="$v.f_collection.dctest" style="color:red ">收款不能小于应收金额</span>
124
+ </div>
125
+ </div>
126
+
127
+ <div class="row" style="margin-top:5px;" v-show="authArr.includes('优惠权限')">
128
+ <div class="col-sm-4">
129
+ <label class="font_normal_body">优惠方式</label>
130
+ <v-select v-model="model.f_privilege_id" @blur.native.capture="privilegeCalculate"
131
+ placeholder='请选择'
132
+ :value.sync="model.f_privilege_id"
133
+ :options='privilegeList' clear-button value-single>
134
+ </v-select>
135
+ </div>
136
+ <div class="col-sm-4">
137
+ <label for="f_preamount" class=" font_normal_body">&nbsp;优惠金额</label>
138
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_privilege_money"
139
+ v-scale="[model.f_privilege_money, 2]" placeholder="优惠金额" disabled>
140
+ </div>
141
+ <div class="col-sm-4">
142
+ <label for="f_preamount" class=" font_normal_body">&nbsp;实际收款</label>
143
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_after_discount"
144
+ v-scale="[model.f_after_discount, 2]" placeholder="优惠后收款" disabled>
145
+ </div>
146
+ </div>
147
+
148
+ <div class="row" v-if="model.f_payment[0].includes('POS')">
149
+ <div class="col-sm-4">
150
+ <label for="f_voucher_number" class="font_normal_body">凭证号</label>
151
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_voucher_number"
152
+ placeholder="凭证号">
153
+ </div>
154
+ </div>
155
+ <div class="row" style="padding-top: 0.5em;">
156
+ <div class="col-sm-4" v-if="!mjshow">
157
+ <label for="f_serial_number" class=" font_normal_body">业务单号</label>
158
+ <input class="input_search" style="width:60%" type="text"
159
+ v-model="model.f_serial_number" placeholder="业务单号">
160
+ </div>
161
+ <div class="col-sm-4" v-if="mjshow"
162
+ :class="[$v.f_serial_number.required || $v.f_serial_number.dctest ? 'has-error' : 'has-success']">
163
+ <label for="f_serial_number" class=" font_normal_body">业务单号</label>
164
+ <input class="input_search" style="width:60%" type="text" v-validate:f_serial_number='{required: true }'
165
+ v-model="model.f_serial_number" placeholder="业务单号">
166
+ </div>
167
+
168
+
169
+ <div class="col-sm-8">
170
+ <label for="f_comments" class="font_normal_body">&nbsp;备&emsp;&emsp;注</label>
171
+ <input class="input_search" style="width:77%" v-model="model.f_comments" rows="1" placeholder="备注">
172
+ </div>
173
+ </div>
174
+
175
+ <div v-if="paymentModel.length >1">
176
+ <div class="row" style="margin-top:10px;">
177
+ <p class="col-sm-2 text-left" style="padding: 10px;"><img src="../../../../static/juxing.png"/><strong
178
+ style="margin-left: 4%">付款明细</strong></p>
179
+ </div>
180
+ <div class="row" style="margin-top:10px;">
181
+ <div class="col-sm-4 " v-for="pay in paymentModel">
182
+ <label class="font_normal_body">{{pay.f_payment}}:</label>
183
+ <input id="f_money" type="text" class="input_search" style="width:60%" v-model="pay.f_money">
184
+ </div>
185
+ <div class="col-sm-4 ">
186
+ <strong v-if="!islegal" style="color: red">所输入的金额必须等于收款金额</strong>
187
+ </div>
188
+ </div>
189
+ </div>
190
+ </form>
191
+ <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
192
+ <print-bill :show="print" :bill-config='config' :bill-data='billData' :data='row' @toggle="close"
193
+ @printok="printok" v-ref:printbill></print-bill>
194
+ <div style="text-align:right; height: 25%">
195
+ <strong style="color:red;margin-right: 5px">{{ $refs.givechange.promptText }}</strong>
196
+ <strong style="font-size: large" v-if="!config.notShowFormula">计算公式:{{calculatedetail ? calculatedetail : ' 暂无'}}</strong><br/>
197
+ <payment-code-button :clickable="!$v.valid || validateOk || !islegal || clickConfirm"
198
+ :payment.sync="model.f_payment" :payment-data="paytype"
199
+ @confirm-payment="confirm()">
200
+ </payment-code-button>
201
+ <button class="button_search btn-gn" type="submit" @click="checkInvoiceMsg()"
202
+ :disabled='!$v.valid || validateOk || !islegal || clickConfirm'>确认
203
+ </button>
204
+ <button class="button_clear btn-gn" @click="clean()">取消</button>
205
+ </div>
206
+ </validator>
207
+ <modal :show.sync="eticket_msg" v-ref:modal large backdrop="false" :width="900">
208
+ <header slot="modal-header" class="modal-header">
209
+ <button type="button" class="close" @click="eticket_msg = false"><span>&times;</span></button>
210
+ <h4 class="modal-title">发票信息</h4>
211
+ </header>
212
+ <article slot="modal-body" class="modal-body">
213
+ <div class="auto select-overspread form-horizontal">
214
+ <div class="row auto">
215
+ <div class="col-sm-6 form-group form-input-group" :class="[!row.f_paper_name ? 'has-error' : '']">
216
+ <label class="control-label">开票名称:</label>
217
+ <input class="form-control col-sm-2"
218
+ v-model="row.f_paper_name" placeholder="开票名称">
219
+ </div>
220
+ <div class="col-sm-6 form-group form-input-group">
221
+ <nobr class="col-sm-4"><label class="control-label">是否征税:</label></nobr>
222
+ <v-select v-model="invoice_is_pax"
223
+ placeholder='请选择'
224
+ :value.sync="invoice_is_pax"
225
+ close-on-select
226
+ :width="60"
227
+ :value-single="true"
228
+ :search="false"
229
+ :options='is_pax' clear-button>
230
+ </v-select>
231
+ </div>
232
+ <div class="col-sm-12 form-group form-input-group">
233
+ <label class="control-label">开户行及账号:</label>
234
+ <input class="form-control col-sm-2"
235
+ v-model="row.f_paper_account" placeholder="购方开户行及账号">
236
+ </div>
237
+ <div class="col-sm-12 form-group form-input-group" >
238
+ <label class="control-label">纳税人识别号:</label>
239
+ <input class="form-control col-sm-2"
240
+ v-model="row.f_taxpayer_id" placeholder="纳税人识别号">
241
+ </div>
242
+ <div class="col-sm-12 form-group form-input-group" :class="[!row.f_address_phone ? 'has-error' : '']">
243
+ <label class="control-label">开票地址电话:</label>
244
+ <input class="form-control col-sm-2"
245
+ v-model="row.f_address_phone" placeholder="开票地址">
246
+ </div>
247
+ <div class="col-sm-12 form-group form-input-group">
248
+ <label class="control-label">邮箱推送:</label>
249
+ <input class="form-control col-sm-2"
250
+ v-model="row.f_email" placeholder="邮箱推送">
251
+ </div>
252
+ </div>
253
+ </div>
254
+ </article>
255
+ <footer slot="modal-footer" class="modal-footer">
256
+ <button type="button" class="btn button_search"
257
+ :disabled="!(row.f_paper_name&&row.f_address_phone)"
258
+ @click='confirm'>确认收费
259
+ </button>
260
+ </footer>
261
+ </modal>
262
+ <ticket-print :show="eticket_show" @toggle="eticket_toggle" v-ref:eticketbill></ticket-print>
263
+ <payment-code v-ref:paymentcode :payment="model.f_payment" :row="row" :money="model.f_after_discount"></payment-code>
264
+ </div>
265
+ </div>
266
+ <upload :blodid="blodid" v-if="config.showupload" isremark="true" fusetype="卡表收费"></upload>
267
+ </template>
268
+ <script>
269
+ import {HttpResetClass} from 'vue-client'
270
+ import XML from '../../../plugins/ObjTree'
271
+
272
+ /**
273
+ *综合业务
274
+ *卡表收费组件
275
+ */
276
+
277
+ // 输入金额,换算气量
278
+ let preamountGen = async function (self) {
279
+ let calFee = ((self.model.f_preamount - 0)).toFixed(4)
280
+ if (self.model.f_payment == '赠气') {
281
+ calFee = (self.model.f_preamount - 0).toFixed(4)
282
+ }
283
+ // 通过金额进行划价
284
+ let getGas = await self.$CommonService.feeCalculate(self.model, calFee)
285
+ if (getGas.data.gas) {
286
+ if (self.row.f_isdecimal === '是') {
287
+ if (self.row.f_alias === 'QiaoSong') {
288
+ self.model.f_pregas = (getGas.data.gas - 0).toFixed(1)
289
+ } else {
290
+ self.model.f_pregas = (getGas.data.gas - 0).toFixed(4)
291
+ }
292
+ if (self.row.f_collection_type === '按金额') {
293
+ self.dymoney = 0
294
+ } else {
295
+ let dymoney2 = await self.$CommonService.gasCalculate(self.model, (getGas.data.gas).toFixed(4))
296
+ self.dymoney = (getGas.data.chargenum - 0).toFixed(4) - (dymoney2.data.chargenum - 0).toFixed(4)
297
+ }
298
+ } else {
299
+ // 如果不支持小数,将划价出的多余非整数气量进行划价为金额
300
+ let tempnum = Math.floor(getGas.data.gas - 0)
301
+ let dymoney1 = await self.$CommonService.gasCalculate(self.model, (tempnum).toFixed(4))
302
+ self.dymoney = (getGas.data.chargenum - 0).toFixed(2) - (dymoney1.data.chargenum - 0).toFixed(2)
303
+ self.model.f_pregas = Math.floor(getGas.data.gas - 0)
304
+ }
305
+ }
306
+ self.model.f_totalcost = ((self.row.f_balance - 0) >= (self.model.f_preamount - 0) ? 0 : (self.model.f_preamount - 0 - self.row.f_balance))
307
+
308
+ self.model.chargeprice = getGas.data.chargeprice
309
+ Object.assign(self.model, self.model, getGas.data)
310
+ if (self.model.f_payment == '赠气') {
311
+ self.model.f_totalcost = self.model.f_preamount
312
+ self.model.f_collection = 0
313
+ } else {
314
+ self.model.f_collection = self.config.autoCollection ? self.model.f_totalcost : 0
315
+ self.model.f_totalcost = ((self.model.f_totalcost - 0) - (self.dymoney - 0)).toFixed(4)
316
+ }
317
+ self.model.f_preamount = (calFee - (self.dymoney - 0)).toFixed(4)
318
+ self.calText(getGas.data.chargeprice)
319
+ }
320
+
321
+ // 输入气量,换算金额
322
+ let pregasGen = async function (self) {
323
+ if (self.row.f_isdecimal === '是') {
324
+ self.model.f_pregas = (self.model.f_pregas - 0).toFixed(4)
325
+ } else {
326
+ self.model.f_pregas = (self.model.f_pregas - 0).toFixed(0)
327
+ }
328
+ if ((self.model.f_pregas - 0) - (self.maxgas - 0) <= 0) {
329
+ self.model.f_meter_type = self.row.f_meter_type
330
+ let getAmount = await self.$CommonService.gasCalculate(self.model, self.model.f_pregas)
331
+ self.model.f_preamount = getAmount.data.chargenum
332
+ self.model.f_totalcost = ((self.row.f_balance - 0) > (getAmount.data.chargenum - 0) ? 0 : ((getAmount.data.chargenum - 0) - (self.row.f_balance - 0)).toFixed(4))
333
+ Object.assign(self.model, self.model, getAmount.data)
334
+ self.model.chargeprice = getAmount.data.chargeprice
335
+ if (self.model.f_payment == '赠气') {
336
+ self.model.f_totalcost = getAmount.data.chargenum
337
+ self.model.f_collection = 0
338
+ } else {
339
+ self.model.f_collection = self.config.autoCollection ? self.model.f_totalcost : 0
340
+ }
341
+ self.calText(getAmount.data.chargeprice)
342
+ }
343
+ }
344
+ // 执行保存逻辑
345
+ let sellgasGen = async function (self) {
346
+ try {
347
+ self.row.cardInfo = self.cardData
348
+
349
+ if (self.paymentModel.length === 0) {
350
+ self.paymentModel = [{
351
+ f_payment: self.model.f_payment[0],
352
+ f_money: self.model.f_preamount
353
+ }]
354
+ }
355
+ self.model.xiekamoney = self.model.f_preamount
356
+ if (self.row.f_price_type == '阶梯气价' && self.row.f_is_step == '否' && self.row.f_collection_type == '按金额') {
357
+ self.model.xiekamoney = (self.model.f_pregas * self.model.chargeprice[0].f_price)
358
+ self.model.xiekamoney = self.model.xiekamoney.toFixed(4)
359
+ }
360
+
361
+ self.model.payments = self.paymentModel
362
+ // 加入扫码盒付款码支付流水号
363
+ self.model.f_serial_id = self.$refs.paymentcode.paymentCodeReturnData.f_out_trade_no
364
+ let res = await self.$CardService.sellgas(self.model, self.row)
365
+ console.log('----------------->卡表收费返回id', res)
366
+ let localeSustainMoney = window.localStorage.getItem('sustainMoney')
367
+ if (localeSustainMoney != null) {
368
+ localeSustainMoney = (localeSustainMoney - 0) + (self.model.f_collection - 0)
369
+ window.localStorage.setItem('sustainMoney', localeSustainMoney)
370
+ }
371
+ let param = []
372
+ for (let row of self.resid) {
373
+ param.push({id: row.id})
374
+ }
375
+ let writeid
376
+ if (res.data && res.data.id) {
377
+ writeid = res.data.id
378
+ } else {
379
+ writeid = res
380
+ }
381
+ let data = {
382
+ param: param,
383
+ f_blobid: writeid
384
+ }
385
+
386
+ await self.$resetpost('rs/logic/updatefiles', data)
387
+ console.log(self.config, self.config.hasPrint && !self.$login.r.includes('不打印发票'))
388
+ // 开始打票
389
+ if (self.config.hasPrint && !self.$login.r.includes('不打印发票')) {
390
+ if (self.model.f_print.indexOf('电子发票') == -1) {
391
+ if (self.config.hasBillManage) {
392
+ // 启用发票管理,获取票据管理中的票号并存储记录
393
+ self.row.id = res
394
+ self.row.f_bill_type = '卡表收费'
395
+ self.row.f_bill_style = self.model.f_print[0]
396
+ self.print = true
397
+ } else {
398
+ self.row.id = res
399
+ self.print = true
400
+ }
401
+ } else {
402
+ if (self.model.f_print[0] === '电子发票') {
403
+ self.row.id = res
404
+ self.eticket_show = true
405
+ //应铜川需要卡表显示
406
+ await self.$refs.eticketbill.openETicket([res], self.row, '是', self.invoice_is_pax, '卡表收费')
407
+ // await self.$CommonService.openEticket(res, '售气收费')
408
+ // self.print = true
409
+ }
410
+ }
411
+ } else {
412
+ self.$dispatch('success')
413
+ }
414
+ self.clickConfirm = false
415
+ } catch (error) {
416
+ console.log('捕获到异常', error)
417
+ if (error instanceof Object) {
418
+ self.$showAlert(error.data, 'danger', 0)
419
+ } else {
420
+ self.$showAlert(error, 'danger', 0)
421
+ }
422
+ self.$dispatch('refresh')
423
+ self.clickConfirm = false
424
+ }
425
+ }
426
+
427
+ let asyncCardMeterCenter = async function (self) {
428
+ await self.$getConfig(self, 'CardMeterCenter')
429
+ console.log('卡表收费config', self.config)
430
+ // 默认打印格式
431
+ self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
432
+ self.model.f_payment = [self.config.payment]
433
+ self.mulPrint = self.config.printType instanceof Array
434
+
435
+ // 获取当前票号用
436
+ self.model.f_use_type = self.config.billType
437
+ self.model.f_bill_type = self.model.f_print
438
+ self.hasValidateBill = self.config.hasBillManage
439
+
440
+ // 判断限购
441
+ let limit_param = {
442
+ f_userinfo_id: self.row.f_userinfo_id,
443
+ f_user_id: self.row.f_user_id,
444
+ f_stairprice_id: self.row.f_stairprice_id
445
+ }
446
+ let getLimit = await self.$resetpost('rs/logic/sale_getLimitGas', {data: limit_param}, {
447
+ resolveMsg: null,
448
+ rejectMsg: '获取限购值失败!!'
449
+ })
450
+ console.log('获取限购值', getLimit)
451
+ self.hasLimit = getLimit.data.hasLimit
452
+ if (self.hasLimit) {
453
+ if (getLimit.data.f_limit_value || getLimit.data.f_limit_amount) {
454
+ if (getLimit.data.f_limit_value < 0 && getLimit.data.f_limit_amount < 0) {
455
+ self.$showAlert(`${getLimit.data.msg}`, 'warning', 3000)
456
+ self.$dispatch('refresh')
457
+ } else {
458
+ if (getLimit.data.f_limit_value) {
459
+ self.maxgas = (getLimit.data.f_limit_value - 0)
460
+ self.limitgas = true
461
+ }
462
+ if (getLimit.data.f_limit_amount) {
463
+ self.maxmoney = (getLimit.data.f_limit_amount - 0)
464
+ self.limitmoney = true
465
+ }
466
+ }
467
+ }
468
+ }
469
+ let nowrite_param = {
470
+ f_userfiles_id: self.row.f_userfiles_id,
471
+ }
472
+ let getNoWriteCard = await self.$resetpost('rs/sql/getnowritecard', {data: nowrite_param}, {
473
+ resolveMsg: null,
474
+ rejectMsg: '获取限购值失败!!'
475
+ })
476
+ if(getNoWriteCard.data.length >0){
477
+ self.$showMessage(`三小时内存在写卡失败的记录,是否重新写卡?`, ['confirm', 'cancel']).then(async (res) => {
478
+ if (res === 'confirm') {
479
+ let url = 'http://127.0.0.1:8003/'+ getNoWriteCard.data[0].f_cardpost
480
+ let param = JSON.parse(getNoWriteCard.data[0].f_cardparam)
481
+ let cardRes = await self.$resetpost(url, param, {resolveMsg: null, rejectMsg: '重新写卡失败'})
482
+ if (cardRes.data.Err || cardRes.data.Exception) {
483
+ self.$showAlert(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`, 'danger', 3000)
484
+ self.$dispatch('refresh', self.row)
485
+ } else {
486
+ self.$resetpost('rs/logic/writeCardAgin', getNoWriteCard.data[0], {resolveMsg: '重新写卡成功', rejectMsg: '重新写卡失败'})
487
+ self.$dispatch('success')
488
+ }
489
+ }else{
490
+ self.$dispatch('refresh', self.row)
491
+ }
492
+ })
493
+ }
494
+
495
+ }
496
+ export default {
497
+ title: '卡表收费',
498
+ data () {
499
+ return {
500
+ mjshow: false,
501
+ serialShow: false,
502
+ resid: [], // 存放新增的f_files表中id
503
+ config: {
504
+ notShowFormula: false, // 不显示计算公式,默认显示
505
+ autoCollection: true, // 自动填写收款
506
+ showupload: true, // 显示上传
507
+ hasPrint: false, // 默认打票
508
+ hasBillManage: false, // 默认不启用发票管理
509
+ billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
510
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
511
+ payment: '现金缴费'
512
+ },
513
+ eticket_msg: false,
514
+ eticket_show: false,
515
+ invoice_is_pax: '不征税',
516
+ is_pax: [{label: '征税', value: '征税'}, {label: '不征税', value: '不征税'}],
517
+ model: {
518
+ f_purchase: 0,
519
+ f_payment: [],
520
+ f_pregas: '',
521
+ f_preamount: 0,
522
+ f_totalcost: 0,
523
+ f_curbalance: 0,
524
+ f_collection: '',
525
+ f_balance: 0,
526
+ f_print: [],
527
+ f_meter_type: '',
528
+ f_voucher_number: '',
529
+ f_banktransfer_person: '',
530
+ f_banktransfer_date: '',
531
+ f_privilege_id: 0,
532
+ f_privilege_money: 0,
533
+ f_after_discount: 0
534
+ },
535
+ calculatedetail: '',
536
+
537
+ // 启用发票管理需要对票号进行验证
538
+ hasValidateBill: false,
539
+ validateOk: false,
540
+
541
+ print: false,
542
+ billData: {
543
+ url: 'rs/report/card_bill',
544
+ billnumber: ''
545
+ },
546
+ hasLimit: false,
547
+ maxgas: 99999999, // 限购
548
+ maxmoney: 99999999,
549
+ limitmoney: false,
550
+ limitgas: false,
551
+
552
+ paymentModel: [], // 多笔付款方式
553
+
554
+ mulPrint: false,
555
+ clickConfirm: false, // 控制确认按钮只能点击一次
556
+ // 下拉框值
557
+ paytype: [],
558
+ printstyle: this.$appdata.getParam('打印格式'),
559
+ privilegeList: [{label: '无优惠', value: '0'}],
560
+ BankTransfer: false,
561
+ // 小数是否支持,导致划价产生的多余气量,金额
562
+ dymoney: 0
563
+ }
564
+ },
565
+ props: ['row', 'cardData'],
566
+ async ready () {
567
+ if (this.authArr.includes('余额写卡限定')) {
568
+ this.paytype = [{label: '余额写卡', value: '余额写卡'}]
569
+ } else {
570
+ this.paytype = await this.$appdata.getParam('付款方式') ? await this.$appdata.getParam('付款方式') : []
571
+ if (!this.$login.r.includes('免交充值付款')) {
572
+ this.paytype = this.paytype.filter((item) => {
573
+ return item.label != '免交'
574
+ })
575
+ }
576
+ }
577
+ // this.getPurchase()
578
+ this.model.f_price_id = this.row.f_price_id
579
+ this.model.f_user_id = this.row.f_user_id
580
+ this.model.f_userfiles_id = this.row.f_userfiles_id
581
+ this.model.f_userinfo_id = this.row.f_userinfo_id
582
+ this.model.f_balance = this.row.f_alias === 'QiaoSong' ? Math.trunc(this.row.f_balance) : this.row.f_balance
583
+ if (this.row.f_collection_type == '按金额') {
584
+ this.model.f_preamount = ''
585
+ this.model.f_pregas = 0
586
+ }
587
+ document.getElementById('fpregas').focus()
588
+ asyncCardMeterCenter(this)
589
+ },
590
+ watch: {
591
+ 'model.f_payment.length' (val) {
592
+ console.log('付款方式多选。。', val)
593
+ if (val > 1 && !this.model.f_preamount) {
594
+ this.model.f_payment = ['现金缴费']
595
+ this.$showAlert('请先计算付款金额', 'warning', 2000)
596
+ } else {
597
+ this.paymentModel = []
598
+
599
+ this.model.f_payment.forEach((res) => {
600
+ let temp = {
601
+ f_payment: res,
602
+ f_money: 0
603
+ }
604
+ this.paymentModel.push(temp)
605
+ })
606
+ this.$resetValidation()
607
+
608
+ // 获取计算优惠
609
+ this.getPrivilegeList()
610
+ }
611
+ },
612
+ 'model.f_payment' (val) {
613
+ if (val == '免交') {
614
+ this.mjshow = true
615
+ } else if (val == '赠气' && (this.model.f_preamount || this.model.f_preamount != '')) {
616
+ if (this.row.f_collection_type == '按气量') {
617
+ this.pregas()
618
+ } else {
619
+ this.preamount()
620
+ }
621
+ } else {
622
+ this.mjshow = false
623
+ }
624
+ // if(this.row.f_collection_type == '按气量'){
625
+ // this.pregas();
626
+ // }else{
627
+ // this.preamount();
628
+ // }
629
+ },
630
+ 'model.f_collection' (val) {
631
+ // 获取计算优惠
632
+ this.getPrivilegeList()
633
+ }
634
+ },
635
+ events: {
636
+ // 删除Resid数组元素
637
+ 'delResid' (val) {
638
+ this.resid.$remove({id: val, f_biobid: ''})
639
+ // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
640
+ },
641
+ // 增加Resid数组元素
642
+ 'resid' (val) {
643
+ this.resid.push({id: val, f_biobid: ''})
644
+ }
645
+ },
646
+ methods: {
647
+ // 校验发票信息
648
+ checkInvoiceMsg () {
649
+ console.log(this.model.f_print[0])
650
+ if (this.model.f_print[0] === '电子发票') {
651
+ if (!this.row.f_taxpayer_id) {
652
+ this.row.f_taxpayer_id = this.row.f_idnumber
653
+ }
654
+ if (!this.row.f_paper_name) {
655
+ this.row.f_paper_name = this.row.f_user_name
656
+ }
657
+ if (!this.row.f_address_phone) {
658
+ this.row.f_address_phone = this.row.f_address + ' ' + this.row.f_user_phone
659
+ }
660
+ if(!this.row.f_email){
661
+ this.row.f_email = this.row.f_email
662
+ }
663
+ this.eticket_msg = true
664
+ } else {
665
+ this.confirm()
666
+ }
667
+ },
668
+ confirm () {
669
+ this.eticket_msg = false
670
+ if (this.model.f_payment.length > 0 && this.model.f_payment.includes('余额写卡')) {
671
+ if (this.model.f_collection > this.row.f_balance) {
672
+ this.$showAlert('请注意!您的账户余额小于当前写卡金额,无法进行余额写卡,请修改后重试', 'warning', 2000)
673
+ return
674
+ }
675
+
676
+ if (this.model.f_collection > 0) {
677
+ this.$showAlert('请注意!进行余额写卡,收款不能大于0', 'warning', 1000)
678
+ return
679
+ }
680
+ }
681
+ this.$showMessage(`确定对用户${this.row.f_user_name}进行卡表收费吗?`, ['confirm', 'cancel']).then(async (res) => {
682
+ if (res === 'confirm') {
683
+ // 先调用付款码支付组件流程
684
+ let ss = await this.$refs.paymentcode.flowPath()
685
+ this.$refs.paymentcode.paymentCodeShow = false
686
+ console.log('付款码操作返回', ss)
687
+ if (!ss.result) return
688
+
689
+ this.clickConfirm = true
690
+ this.model.f_curbalance = this.curbalance
691
+ this.$dispatch('no-button')
692
+ sellgasGen(this)
693
+ }
694
+ })
695
+ },
696
+ eticket_toggle () {
697
+ this.eticket_show = false
698
+ this.$dispatch('success')
699
+ },
700
+ clean () {
701
+ this.$info('取消操作')
702
+ this.$dispatch('refresh', this.row)
703
+ },
704
+ validateBill (val) {
705
+ this.validateOk = !val.isOk
706
+ this.billData.bill = val.bill
707
+ },
708
+ printok () {
709
+ // 收据打完,判断是否还有其他票据进行请求
710
+ for (let i = 0; i < this.model.f_print.length; i++) {
711
+ if (this.model.f_print[i] === '电子发票') {
712
+ this.$CommonService.openEticket(this.row.id, '售气收费')
713
+ }
714
+ }
715
+ this.$dispatch('success')
716
+ },
717
+ pregas () {
718
+ this.dymoney = 0
719
+ if (this.model.f_pregas && this.model.f_pregas > 0) {
720
+ try {
721
+ // 对气量进行验证
722
+ if ((this.row.f_topup_ceil - 0) > 0 && (this.model.f_pregas - 0) > (this.row.f_topup_ceil - 0)) {
723
+ this.$showAlert(`您输入的气量不能大于该表的充值上限: ${this.row.f_topup_ceil}`, 'warning', 5000)
724
+ this.model.f_pregas = null
725
+ } else {
726
+ pregasGen(this)
727
+ }
728
+ } catch (error) {
729
+ this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
730
+ this.$dispatch('error', '发卡售气', this.model, error)
731
+ }
732
+ } else {
733
+ this.model.f_pregas = null
734
+ }
735
+ },
736
+ preamount () {
737
+ this.dymoney = 0
738
+ this.model.f_price_id = this.row.f_price_id
739
+ this.model.f_user_id = this.row.f_user_id
740
+ this.model.f_userfiles_id = this.row.f_userfiles_id
741
+ this.model.f_userinfo_id = this.row.f_userinfo_id
742
+ try {
743
+ preamountGen(this)
744
+ } catch (error) {
745
+ this.$showAlert(`发卡售气划价错误,错误类型:${error}`, 'danger', 0)
746
+ this.$dispatch('error', '发卡售气', this.model, error)
747
+ }
748
+ },
749
+ calText (val) {
750
+ let str = ''
751
+ let num = 0
752
+ val.forEach((item) => {
753
+ if (item.f_gas > 0) {
754
+ num = num + 1
755
+ }
756
+ if (this.row.f_isdecimal === '是') {
757
+ str = str + item.f_price + ' x ' + item.f_gas + '+'
758
+ } else {
759
+ str = str + item.f_price + ' x ' + Math.floor(item.f_gas) + '+'
760
+ }
761
+ })
762
+ str = str.slice(0, str.length - 1)
763
+ this.calculatedetail = str
764
+ if (num > 1) {
765
+ if(this.$login.r.find(item=>item=='阶梯提示无按钮')){
766
+ this.$showAlert('友好提示:本次购气已跨阶梯', 'warning', 3000)
767
+ }else{
768
+ this.$showMessage('友好提示:本次购气已跨阶梯',['confirm','cancel']);
769
+ }
770
+ }
771
+ },
772
+ close () {
773
+ this.print = false
774
+ this.clean()
775
+ },
776
+ paymentchange () {
777
+ console.log('model.f_payment', this.model.f_payment[0])
778
+ if (JSON.stringify(this.model.f_payment).indexOf('转账') !== -1) {
779
+ // 进入转账筛选条件
780
+ this.model.f_banktransfer_person = ''
781
+ this.model.f_banktransfer_date = ''
782
+ this.BankTransfer = true
783
+ } else {
784
+ this.model.f_banktransfer_person = ''
785
+ this.model.f_banktransfer_date = ''
786
+ this.BankTransfer = false
787
+ }
788
+ },
789
+ // 根据选择的付款方式 获取优惠列表
790
+ async getPrivilegeList () {
791
+ // 初始化下拉选择列表
792
+ this.privilegeList = [{label: '无优惠', value: '0'}]
793
+ // 初始为无优惠
794
+ this.model.f_privilege_id = '0'
795
+ if (this.model.f_payment && this.model.f_payment.length) {
796
+ // 查询条件
797
+ let payments = JSON.stringify(this.model.f_payment)
798
+ payments = payments.replace('[', '(').replace(']', ')').replace(/"/g, '\'')
799
+ let HttpReset = new HttpResetClass()
800
+ let privilege = await HttpReset.load('POST', 'rs/sql/singleTable_OrderBy', {
801
+ data: {
802
+ items: 'id,f_privilege_name,f_privilege_type',
803
+ tablename: 't_privilege',
804
+ condition: `f_payment in ${payments} and f_gasproperties = '${this.row.f_gasproperties}' and f_user_type = '${this.row.f_user_type}' and f_perform_date <= GETDATE() and f_end_date >= GETDATE() and f_state = '有效'`,
805
+ orderitem: 'id'
806
+ }
807
+ }, {resolveMsg: null, rejectMsg: '查询优惠信息失败'})
808
+ // 查询结果放到下拉列表
809
+ for (let p of privilege.data) {
810
+ this.privilegeList.push({label: p.f_privilege_name, value: p.id, type: p.f_privilege_type})
811
+ }
812
+ this.privilegeCalculate()
813
+ }
814
+ },
815
+ // 优惠计算
816
+ async privilegeCalculate () {
817
+ // 初始化减免金额
818
+ this.model.f_privilege_money = 0
819
+ this.model.f_after_discount = this.model.f_collection
820
+ // 判断是否是自定义优惠
821
+ if (this.model.f_privilege_id != null && parseInt(this.model.f_privilege_id)) {
822
+ for (let p of this.privilegeList) {
823
+ if (p.value == this.model.f_privilege_id && p.type == '自定义') {
824
+ this.model.f_privilege_money = window.prompt('请输入你想优惠的金额')
825
+ if (!(/^[1-9]\d*(\.\d+)?$/).test(this.model.f_privilege_money) || !(/^[1-9]\d*(\.\d+)?$/).test(this.model.f_privilege_money)) {
826
+ this.$showMessage('金额输入格式不正确!')
827
+ this.model.f_privilege_money = 0
828
+ return
829
+ }
830
+ if ((this.model.f_privilege_money - 0) >= this.model.f_collection) {
831
+ this.$showMessage('减免金额不能大于等于收款金额')
832
+ this.model.f_privilege_money = 0
833
+ return
834
+ }
835
+ }
836
+ }
837
+ }
838
+ // 优惠方式, 收款 缺一不计算
839
+ if (this.model.f_payment && this.model.f_payment.length && parseInt(this.model.f_privilege_id) && this.model.f_collection) {
840
+ let c = {
841
+ f_privilege_id: this.model.f_privilege_id,
842
+ f_collection: this.model.f_collection,
843
+ f_privilege_money: this.data.f_privilege_money
844
+ }
845
+ let privilegeData = await this.$resetpost('rs/logic/calculatePrivilege', c, {
846
+ resolveMsg: null,
847
+ rejectMsg: '计算优惠金额出错'
848
+ })
849
+ // 减免金额
850
+ this.model.f_privilege_money = privilegeData.data.f_privilege_money
851
+ // 减免后收款金额
852
+ this.model.f_after_discount = privilegeData.data.f_collection
853
+ }
854
+ }
855
+ },
856
+ computed: {
857
+ authArr () {
858
+ return this.$login.r ? this.$login.r : []
859
+ },
860
+ 'curbalance' () {
861
+ if (this.model.f_payment == '赠气') {
862
+ return this.model.f_balance
863
+ }
864
+ if (this.model.f_preamount) {
865
+ // if (this.row.f_collection_type === '按金额') {
866
+ // return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
867
+ // } else {
868
+ if ((this.row.f_balance - 0) > (this.model.f_preamount - 0)) {
869
+ return ((this.row.f_balance - 0) - (this.model.f_preamount - 0) + (this.model.f_collection - 0)).toFixed(4)
870
+ } else {
871
+ return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
872
+ }
873
+ // return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
874
+ // }
875
+ } else {
876
+ return this.row.f_balance
877
+ }
878
+ },
879
+ 'invoice_show_gas' () {
880
+ return this.row.f_collection_type === '按气量' ? '是' : '否'
881
+ },
882
+ 'islegal' () {
883
+ console.log('支付分离。。。', this.paymentModel.length, this.model.f_collection)
884
+ if (this.paymentModel.length > 1 && this.model.f_collection) {
885
+ let sum = 0
886
+ this.paymentModel.forEach((res) => {
887
+ sum += (res.f_money - 0)
888
+ })
889
+ return (this.model.f_collection - 0) === (sum - 0)
890
+ } else {
891
+ return true
892
+ }
893
+ }
894
+ }
895
+ }
896
+ </script>
897
+
898
+ <style>
899
+ </style>