sale-client 3.6.21 → 3.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/src/components/charge/business/CardMeterCenter.vue +944 -944
  3. package/src/components/charge/business/IOTMeterCenter.vue +793 -793
  4. package/src/components/charge/business/OtherChargeNew.vue +550 -550
  5. package/src/components/charge/business/machine/MachineMeterCenter.vue +676 -676
  6. package/src/components/charge/gasloss/gasLossOperate.vue +383 -383
  7. package/src/components/newBill/CardMeterCenter.vue +902 -902
  8. package/src/components/newBill/IOTMeterCenter.vue +797 -797
  9. package/src/components/revenue/Common/EticketModal.vue +90 -90
  10. package/src/filiale/alashan/business/CardMeterCenter.vue +897 -897
  11. package/src/filiale/chengtou/components/OtherChargeNew.vue +549 -549
  12. package/src/filiale/gehua/CardMeterCenter.vue +898 -898
  13. package/src/filiale/gehua/IOTMeterCenter.vue +791 -791
  14. package/src/filiale/gehua/MachineMeterCenter.vue +685 -685
  15. package/src/filiale/gehua/OtherChargeNew.vue +558 -558
  16. package/src/filiale/guangxi/CardMeterCenter.vue +891 -891
  17. package/src/filiale/guangxi/IOTMeterCenter.vue +774 -774
  18. package/src/filiale/guangxi/MachineMeterCenter.vue +622 -622
  19. package/src/filiale/haile/MachineMeterCenter.vue +762 -762
  20. package/src/filiale/huayin/CardMeterCenter.vue +903 -903
  21. package/src/filiale/huayin/IOTMeterCenter.vue +796 -796
  22. package/src/filiale/huayin/MachineMeterCenter.vue +680 -680
  23. package/src/filiale/jingwei/CardMeterCenter.vue +870 -870
  24. package/src/filiale/jingwei/ShowCardSellGas.vue +903 -903
  25. package/src/filiale/kelai/CardMeterCenter.vue +934 -934
  26. package/src/filiale/kelai/IOTMeterCenter.vue +833 -833
  27. package/src/filiale/kelai/MachineMeterCenter.vue +705 -705
  28. package/src/filiale/macheng/CardMeterCenter.vue +939 -939
  29. package/src/filiale/qianneng/OtherChargeNew.vue +544 -544
  30. package/src/filiale/qianneng/eticket/EticketModal.vue +91 -91
  31. package/src/filiale/qianneng/machine/MachineMeterCenter.vue +676 -676
  32. package/src/filiale/rizhao/IOTMeterCenter.vue +795 -795
  33. package/src/filiale/shangluo/CardMeterCenter.vue +892 -892
  34. package/src/filiale/shangluo/IOTMeterCenter.vue +797 -797
  35. package/src/filiale/shangluo/MachineMeterCenter.vue +734 -734
  36. package/src/filiale/shanxian/OtherChargeNew.vue +561 -561
  37. package/src/filiale/shanxian/components/revenue/CardMeterCenter.vue +944 -944
  38. package/src/filiale/tongchuan/CardMeterCenter.vue +923 -923
  39. package/src/filiale/tongchuan/bill/EticketModal.vue +90 -90
  40. package/src/filiale/wenxi/CardMeterCenter.vue +942 -942
  41. package/src/filiale/wenxi/IOTMeterCenter.vue +774 -774
  42. package/src/filiale/wuhai/CardMeterCenter.vue +945 -945
  43. package/src/filiale/wuhai/IOTMeterCenter.vue +757 -757
  44. package/src/filiale/yuansheng/CardMeterCenter.vue +950 -950
  45. package/src/filiale/yuansheng/IOTMeterCenter.vue +788 -788
@@ -1,902 +1,902 @@
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" v-el:fpregas
22
- v-validate:f_pregas='{required: true, dctest: [maxgas, "<=" ]}' placeholder="预购气量"
23
- v-next-el='fcollection'>
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" v-el:fpregas
28
- @blur="pregas()" v-model="model.f_pregas" placeholder="预购气量"
29
- v-next-el='fcollection'>
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"
36
- v-validate:f_preamount='{required: true, dctest: [maxmoney, "<=" ],dctest: [0, ">"]}' placeholder="预购金额"
37
- v-next-el='fcollection'>
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='fcollection' 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!='赠气' && row.f_meter_type.includes('卡表')"
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:fcollection @keyup.enter="checkInvoiceMsg((!$v.valid || validateOk || !islegal || clickConfirm))" 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=='赠气' && row.f_meter_type.includes('卡表')"
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:fcollection @keyup.enter="checkInvoiceMsg((!$v.valid || validateOk || !islegal || clickConfirm))" v-scale="[model.f_totalcost, 4]" :disabled="$refs.givechange.promptText != ''">
109
- </div>
110
- <div class="col-sm-3" v-if="row.f_collection_type === '按金额' && row.f_meter_type.includes('卡表')">
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:fcollection @keyup.enter="checkInvoiceMsg((!$v.valid || validateOk || !islegal || clickConfirm))" v-scale="[model.f_collection, 4]" :disabled="$refs.givechange.promptText != ''">
114
- </div>
115
- <div class="col-sm-4" v-if="!row.f_meter_type.includes('卡表')">
116
- <label for="f_collection" class=" font_normal_body"><font size="4px"
117
- style="font-weight:bold">*收&emsp;款</font></label>
118
- <input id="f_collection" class="input_search" style="width:50%;font-size: 18px;font-weight:bold;"
119
- type="number" v-model="model.f_collection"
120
- v-el:fcollection
121
- @keyup.enter="checkInvoiceMsg((!$v.valid || validateOk || !islegal || clickConfirm))"
122
- v-scale="[model.f_collection, 4]" disabled>
123
- </div>
124
- <div class="col-sm-1 form-group" v-show=" row.f_meter_type.includes('卡表')">
125
- <give-change :curbalance="curbalance" :collection.sync="model.f_collection" v-ref:givechange></give-change>
126
- </div>
127
- </div>
128
- <div class="row" style="margin-top:5px;">
129
- <div class="col-sm-9">
130
- </div>
131
- <div class="col-sm-3">
132
- <span v-if="$v.f_collection.dctest" style="color:red ">收款不能小于应收金额</span>
133
- </div>
134
- </div>
135
-
136
- <div class="row" style="margin-top:5px;" v-show="authArr.includes('优惠权限')">
137
- <div class="col-sm-4">
138
- <label class="font_normal_body">优惠方式</label>
139
- <v-select v-model="model.f_privilege_id" @blur.native.capture="privilegeCalculate"
140
- placeholder='请选择'
141
- :value.sync="model.f_privilege_id"
142
- :options='privilegeList' clear-button value-single>
143
- </v-select>
144
- </div>
145
- <div class="col-sm-4">
146
- <label for="f_preamount" class=" font_normal_body">&nbsp;优惠金额</label>
147
- <input class="input_search" style="width:60%" type="number" v-model="model.f_privilege_money"
148
- v-scale="[model.f_privilege_money, 2]" placeholder="优惠金额" disabled>
149
- </div>
150
- <div class="col-sm-4">
151
- <label for="f_preamount" class=" font_normal_body">&nbsp;实际收款</label>
152
- <input class="input_search" style="width:60%" type="number" v-model="model.f_after_discount"
153
- v-scale="[model.f_after_discount, 2]" placeholder="优惠后收款" disabled>
154
- </div>
155
- </div>
156
-
157
- <div class="row" v-if="model.f_payment[0].includes('POS')">
158
- <div class="col-sm-4">
159
- <label for="f_voucher_number" class="font_normal_body">凭证号</label>
160
- <input type="text" class="input_search" style="width:60%" v-model="model.f_voucher_number"
161
- placeholder="凭证号">
162
- </div>
163
- </div>
164
- <div class="row" style="padding-top: 0.5em;">
165
- <div class="col-sm-4" v-if="!mjshow">
166
- <label for="f_serial_number" class=" font_normal_body">业务单号</label>
167
- <input class="input_search" style="width:60%" type="text"
168
- v-model="model.f_serial_number" placeholder="业务单号">
169
- </div>
170
- <div class="col-sm-4" v-if="mjshow"
171
- :class="[$v.f_serial_number.required || $v.f_serial_number.dctest ? 'has-error' : 'has-success']">
172
- <label for="f_serial_number" class=" font_normal_body">业务单号</label>
173
- <input class="input_search" style="width:60%" type="text" v-validate:f_serial_number='{required: true }'
174
- v-model="model.f_serial_number" placeholder="业务单号">
175
- </div>
176
-
177
-
178
- <div class="col-sm-8">
179
- <label for="f_comments" class="font_normal_body">&nbsp;备&emsp;&emsp;注</label>
180
- <input class="input_search" style="width:77%" v-model="model.f_comments" rows="1" placeholder="备注">
181
- </div>
182
- </div>
183
-
184
- <div v-if="paymentModel.length >1">
185
- <div class="row" style="margin-top:10px;">
186
- <p class="col-sm-2 text-left" style="padding: 10px;"><img src="../../../static/juxing.png"/><strong
187
- style="margin-left: 4%">付款明细</strong></p>
188
- </div>
189
- <div class="row" style="margin-top:10px;">
190
- <div class="col-sm-4 " v-for="pay in paymentModel">
191
- <label class="font_normal_body">{{pay.f_payment}}:</label>
192
- <input id="f_money" type="text" class="input_search" style="width:60%" v-model="pay.f_money">
193
- </div>
194
- <div class="col-sm-4 ">
195
- <strong v-if="!islegal" style="color: red">所输入的金额必须等于收款金额</strong>
196
- </div>
197
- </div>
198
- </div>
199
- </form>
200
- <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
201
- <print-bill :show="print" :bill-config='config' :bill-data='billData' :data='row' @toggle="close"
202
- @printok="printok" v-ref:printbill></print-bill>
203
- <div style="text-align:right; height: 25%">
204
- <strong style="color:red;margin-right: 5px">{{ $refs.givechange.promptText }}</strong>
205
- <strong style="font-size: large" v-if="!config.notShowFormula">计算公式:{{calculatedetail ? calculatedetail : ' 暂无'}}</strong><br/>
206
- <payment-code-button :clickable="!$v.valid || validateOk || !islegal || clickConfirm"
207
- :payment.sync="model.f_payment" :payment-data="paytype"
208
- @confirm-payment="confirm()">
209
- </payment-code-button>
210
- <button class="button_search btn-gn" type="submit" @click="checkInvoiceMsg()"
211
- :disabled='!$v.valid || validateOk || !islegal || clickConfirm'>确认
212
- </button>
213
- <button class="button_clear btn-gn" @click="clean()">取消</button>
214
- </div>
215
- </validator>
216
- <eticket-modal :show="eticket_msg" @close-modal-show="eticket_msg = false" :row="row" @confirm="confirm"></eticket-modal>
217
- <ticket-print :show="eticket_show" @toggle="eticket_toggle" v-ref:eticketbill></ticket-print>
218
- <payment-code v-ref:paymentcode :payment="model.f_payment" :row="row" :money="model.f_after_discount"></payment-code>
219
- </div>
220
- </div>
221
- <upload :blodid="row.f_userinfo_id" v-if="config.showupload" isremark="true" fusetype="卡表收费"></upload>
222
- </template>
223
- <script>
224
- import {HttpResetClass} from 'vue-client'
225
- import XML from '../../plugins/ObjTree'
226
-
227
- /**
228
- *综合业务
229
- *卡表收费组件
230
- */
231
-
232
- // 输入金额,换算气量
233
- let preamountGen = async function (self) {
234
- let calFee = ((self.model.f_preamount - 0)).toFixed(4)
235
- if (self.model.f_payment == '赠气') {
236
- calFee = (self.model.f_preamount - 0).toFixed(4)
237
- }
238
- // 通过金额进行划价
239
- let getGas = await self.$CommonService.feeCalculate(self.model, calFee)
240
- if (getGas.data.gas) {
241
- if (self.row.f_isdecimal === '是') {
242
- if (self.row.f_alias === 'QiaoSong') {
243
- self.model.f_pregas = (getGas.data.gas - 0).toFixed(1)
244
- } else {
245
- self.model.f_pregas = (getGas.data.gas - 0).toFixed(4)
246
- }
247
- if (self.row.f_collection_type === '按金额') {
248
- self.dymoney = 0
249
- } else {
250
- let dymoney2 = await self.$CommonService.gasCalculate(self.model, (getGas.data.gas).toFixed(4))
251
- self.dymoney = (getGas.data.chargenum - 0).toFixed(4) - (dymoney2.data.chargenum - 0).toFixed(4)
252
- }
253
- } else {
254
- // 如果不支持小数,将划价出的多余非整数气量进行划价为金额
255
- let tempnum = Math.floor(getGas.data.gas - 0)
256
- let dymoney1 = await self.$CommonService.gasCalculate(self.model, (tempnum).toFixed(4))
257
- self.dymoney = (getGas.data.chargenum - 0).toFixed(2) - (dymoney1.data.chargenum - 0).toFixed(2)
258
- self.model.f_pregas = Math.floor(getGas.data.gas - 0)
259
- }
260
- }
261
- self.model.f_totalcost = ((self.row.f_balance - 0) >= (self.model.f_preamount - 0) ? 0 : (self.model.f_preamount - 0 - self.row.f_balance))
262
-
263
- self.model.chargeprice = getGas.data.chargeprice
264
- Object.assign(self.model, self.model, getGas.data)
265
- if (self.model.f_payment == '赠气') {
266
- self.model.f_totalcost = self.model.f_preamount
267
- self.model.f_collection = 0
268
- } else {
269
- self.model.f_collection = self.config.autoCollection ? self.model.f_totalcost : 0
270
- self.model.f_totalcost = ((self.model.f_totalcost - 0) - (self.dymoney - 0)).toFixed(4)
271
- }
272
- self.model.f_preamount = (calFee - (self.dymoney - 0)).toFixed(4)
273
- self.calText(getGas.data.chargeprice)
274
- }
275
-
276
- // 输入气量,换算金额
277
- let pregasGen = async function (self) {
278
- if (self.row.f_isdecimal === '是') {
279
- self.model.f_pregas = (self.model.f_pregas - 0).toFixed(4)
280
- } else {
281
- self.model.f_pregas = (self.model.f_pregas - 0).toFixed(0)
282
- }
283
- if ((self.model.f_pregas - 0) - (self.maxgas - 0) <= 0) {
284
- self.model.f_meter_type = self.row.f_meter_type
285
- let getAmount = await self.$CommonService.gasCalculate(self.model, self.model.f_pregas)
286
- self.model.f_preamount = getAmount.data.chargenum
287
- 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))
288
- Object.assign(self.model, self.model, getAmount.data)
289
- self.model.chargeprice = getAmount.data.chargeprice
290
- if (self.model.f_payment == '赠气') {
291
- self.model.f_totalcost = getAmount.data.chargenum
292
- self.model.f_collection = 0
293
- } else {
294
- self.model.f_collection = self.config.autoCollection ? self.model.f_totalcost : 0
295
- if (self.config.floor) {
296
- self.model.f_collection = Math.ceil(self.model.f_collection)
297
- }
298
- }
299
- self.calText(getAmount.data.chargeprice)
300
- }
301
- }
302
- // 执行保存逻辑
303
- let sellgasGen = async function (self) {
304
- try {
305
- self.row.cardInfo = self.cardData
306
-
307
- if (self.paymentModel.length === 0) {
308
- self.paymentModel = [{
309
- f_payment: self.model.f_payment[0],
310
- f_money: self.model.f_preamount
311
- }]
312
- }
313
- self.model.xiekamoney = self.model.f_preamount
314
- if (self.row.f_price_type == '阶梯气价' && self.row.f_is_step == '否' && self.row.f_collection_type == '按金额') {
315
- self.model.xiekamoney = (self.model.f_pregas * self.model.chargeprice[0].f_price)
316
- self.model.xiekamoney = self.model.xiekamoney.toFixed(4)
317
- }
318
-
319
- self.model.payments = self.paymentModel
320
- // 加入扫码盒付款码支付流水号
321
- self.model.f_serial_id = self.$refs.paymentcode.paymentCodeReturnData.f_out_trade_no
322
- let res = await self.$CardService.sellgas(self.model, self.row)
323
- let localeSustainMoney = window.localStorage.getItem('sustainMoney')
324
- if (localeSustainMoney != null) {
325
- localeSustainMoney = (localeSustainMoney - 0) + (self.model.f_collection - 0)
326
- window.localStorage.setItem('sustainMoney', localeSustainMoney)
327
- }
328
- let param = []
329
- for (let row of self.resid) {
330
- param.push({id: row.id})
331
- }
332
- let writeid
333
- if (res.data && res.data.id) {
334
- writeid = res.data.id
335
- } else {
336
- writeid = res
337
- }
338
- let data = {
339
- param: param,
340
- f_blobid: writeid
341
- }
342
-
343
- await self.$resetpost('rs/logic/updatefiles', data)
344
- console.log(self.config, self.config.hasPrint && !self.$login.r.includes('不打印发票'))
345
- // 开始打票
346
- if (self.config.hasPrint && !self.$login.r.includes('不打印发票')) {
347
- if (self.model.f_print.indexOf('电子发票') == -1) {
348
- if (self.$login.r.includes('非民用纸质票据拆分')) {
349
- if (self.row.f_user_type === '非民用') {
350
- self.billData.url = 'rs/report/fmy_card_bill'
351
- }
352
- }
353
- if (self.config.hasBillManage) {
354
- // 启用发票管理,获取票据管理中的票号并存储记录
355
- self.row.id = res
356
- self.row.f_bill_type = '卡表收费'
357
- self.row.f_bill_style = self.model.f_print[0]
358
- self.row.f_url = 'http://192.168.50.77:31039/report/jmreport/shareView/787097260170534912'
359
- self.print = true
360
- } else {
361
- self.row.id = res
362
- self.row.f_url = 'http://192.168.50.77:31039/report/jmreport/shareView/787097260170534912'
363
- self.print = true
364
- }
365
- } else {
366
- if (self.model.f_print[0] === '电子发票') {
367
- self.row.id = res
368
- self.eticket_show = true
369
- // 应铜川需要卡表显示
370
- await self.$refs.eticketbill.openETicket([res], self.row, '是', self.invoice_is_pax, '卡表收费')
371
- // await self.$CommonService.openEticket(res, '售气收费')
372
- // self.print = true
373
- }
374
- }
375
- } else {
376
- self.$dispatch('success')
377
- }
378
- self.clickConfirm = false
379
- } catch (error) {
380
- console.log('捕获到异常', error)
381
- if (error instanceof Object) {
382
- self.$showAlert(error.data, 'danger', 0)
383
- } else {
384
- self.$showAlert(error, 'danger', 0)
385
- }
386
- self.$dispatch('refresh')
387
- self.clickConfirm = false
388
- }
389
- }
390
-
391
- let asyncCardMeterCenter = async function (self) {
392
- await self.$getConfig(self, 'CardMeterCenter')
393
- console.log('卡表收费config', self.config)
394
-
395
- // 添加 “系统余额透支” 付款方式
396
- let i = -1
397
- for (const index in self.paytype) {
398
- if (self.paytype[index].value == "系统余额透支"){
399
- i = index
400
- break
401
- }
402
- }
403
- if (self.canOverdraftBalance()){
404
- if (i == -1){
405
- self.paytype.push({
406
- label: "系统余额透支",
407
- value: "系统余额透支"
408
- })
409
- }
410
- }else {
411
- if (i != -1){
412
- self.paytype.splice(i, 1)
413
- }
414
- }
415
-
416
- // 默认打印格式
417
- self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
418
- self.model.f_payment = [self.config.payment]
419
- self.mulPrint = self.config.printType instanceof Array
420
-
421
- // 获取当前票号用
422
- self.model.f_use_type = self.config.billType
423
- self.model.f_bill_type = self.model.f_print
424
- self.hasValidateBill = self.config.hasBillManage
425
-
426
- // 判断限购
427
- let limit_param = {
428
- f_userinfo_id: self.row.f_userinfo_id,
429
- f_user_id: self.row.f_user_id,
430
- f_stairprice_id: self.row.f_stairprice_id
431
- }
432
- let getLimit = await self.$resetpost('rs/logic/sale_getLimitGas', {data: limit_param}, {
433
- resolveMsg: null,
434
- rejectMsg: '获取限购值失败!!'
435
- })
436
- console.log('获取限购值', getLimit)
437
- self.hasLimit = getLimit.data.hasLimit
438
- if (self.hasLimit) {
439
- if (getLimit.data.f_limit_value || getLimit.data.f_limit_amount) {
440
- if (getLimit.data.f_limit_value < 0 && getLimit.data.f_limit_amount < 0) {
441
- self.$showAlert(`${getLimit.data.msg}`, 'warning', 3000)
442
- self.$dispatch('refresh')
443
- } else {
444
- if (getLimit.data.f_limit_value) {
445
- self.maxgas = (getLimit.data.f_limit_value - 0)
446
- self.limitgas = true
447
- }
448
- if (getLimit.data.f_limit_amount) {
449
- self.maxmoney = (getLimit.data.f_limit_amount - 0)
450
- self.limitmoney = true
451
- }
452
- }
453
- }
454
- }
455
- let nowrite_param = {
456
- f_userfiles_id: self.row.f_userfiles_id
457
- }
458
- let getNoWriteCard = await self.$resetpost('rs/sql/getnowritecard', {data: nowrite_param}, {
459
- resolveMsg: null,
460
- rejectMsg: '获取最近卡表收费记录失败!!'
461
- })
462
- if (getNoWriteCard.data.length > 0) {
463
- self.$showMessage(`三小时内存在写卡失败的记录,是否重新写卡?`, ['confirm', 'cancel']).then(async (res) => {
464
- if (res === 'confirm') {
465
- let url = 'http://127.0.0.1:8003/' + getNoWriteCard.data[0].f_cardpost
466
- let param = JSON.parse(getNoWriteCard.data[0].f_cardparam)
467
- let cardRes = await self.$resetpost(url, param, {resolveMsg: null, rejectMsg: '重新写卡失败'})
468
- if (cardRes.data.Err || cardRes.data.Exception) {
469
- self.$showAlert(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`, 'danger', 3000)
470
- self.$dispatch('refresh', self.row)
471
- } else {
472
- self.$resetpost('rs/logic/writeCardAgin', getNoWriteCard.data[0], {resolveMsg: '重新写卡成功', rejectMsg: '重新写卡失败'})
473
- self.$dispatch('success')
474
- }
475
- } else {
476
- self.$dispatch('refresh', self.row)
477
- }
478
- })
479
- }
480
- }
481
- export default {
482
- title: '卡表收费',
483
- data () {
484
- return {
485
- mjshow: false,
486
- serialShow: false,
487
- resid: [], // 存放新增的f_files表中id
488
- config: {
489
- notShowFormula: false, // 不显示计算公式,默认显示
490
- autoCollection: true, // 自动填写收款
491
- showupload: true, // 显示上传
492
- hasPrint: true, // 默认打票
493
- hasBillManage: false, // 默认不启用发票管理
494
- billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
495
- printType: '普通收据', // 收据/电子票/专用发票/国税发票
496
- payment: '现金缴费',
497
- floor: false,
498
- overdraftBalance: false // 是否支持系统余额透支
499
- },
500
- eticket_msg: false,
501
- eticket_show: false,
502
- invoice_is_pax: '不征税',
503
- is_pax: [{label: '征税', value: '征税'}, {label: '不征税', value: '不征税'}],
504
- model: {
505
- f_purchase: 0,
506
- f_payment: [],
507
- f_pregas: '',
508
- f_preamount: 0,
509
- f_totalcost: 0,
510
- f_curbalance: 0,
511
- f_collection: '',
512
- f_balance: 0,
513
- f_print: [],
514
- f_meter_type: '',
515
- f_voucher_number: '',
516
- f_banktransfer_person: '',
517
- f_banktransfer_date: '',
518
- f_privilege_id: 0,
519
- f_privilege_money: 0,
520
- f_after_discount: 0
521
- },
522
- calculatedetail: '',
523
-
524
- // 启用发票管理需要对票号进行验证
525
- hasValidateBill: false,
526
- validateOk: false,
527
-
528
- print: false,
529
- billData: {
530
- url: 'rs/report/card_bill',
531
- billnumber: ''
532
- },
533
- hasLimit: false,
534
- maxgas: 99999999, // 限购
535
- maxmoney: 99999999,
536
- limitmoney: false,
537
- limitgas: false,
538
-
539
- paymentModel: [], // 多笔付款方式
540
-
541
- mulPrint: false,
542
- clickConfirm: false, // 控制确认按钮只能点击一次
543
- // 下拉框值
544
- paytype: [],
545
- printstyle: this.$appdata.getParam('打印格式'),
546
- privilegeList: [{label: '无优惠', value: '0'}],
547
- BankTransfer: false,
548
- // 小数是否支持,导致划价产生的多余气量,金额
549
- dymoney: 0
550
- }
551
- },
552
- props: ['row', 'cardData'],
553
- async ready () {
554
- if (this.authArr.includes('余额写卡限定')) {
555
- this.paytype = [{label: '余额写卡', value: '余额写卡'}]
556
- } else {
557
- this.paytype = await this.$appdata.getParam('付款方式') ? await this.$appdata.getParam('付款方式') : []
558
- if (!this.$login.r.includes('免交充值付款')) {
559
- this.paytype = this.paytype.filter((item) => {
560
- return item.label != '免交'
561
- })
562
- }
563
- }
564
- // this.getPurchase()
565
- this.model.f_price_id = this.row.f_price_id
566
- this.model.f_user_id = this.row.f_user_id
567
- this.model.f_userfiles_id = this.row.f_userfiles_id
568
- this.model.f_userinfo_id = this.row.f_userinfo_id
569
- this.model.f_balance = this.row.f_alias === 'QiaoSong' ? Math.trunc(this.row.f_balance) : this.row.f_balance
570
- if (this.row.f_collection_type == '按金额') {
571
- this.model.f_preamount = ''
572
- this.model.f_pregas = 0
573
- }
574
- this.$els.fpregas.focus()
575
- asyncCardMeterCenter(this)
576
- },
577
- watch: {
578
- 'model.f_payment.length' (val) {
579
- console.log('付款方式多选。。', val)
580
- if (val > 1 && !this.model.f_preamount) {
581
- this.model.f_payment = ['现金缴费']
582
- this.$showAlert('请先计算付款金额', 'warning', 2000)
583
- } else {
584
- this.paymentModel = []
585
-
586
- this.model.f_payment.forEach((res) => {
587
- let temp = {
588
- f_payment: res,
589
- f_money: 0
590
- }
591
- this.paymentModel.push(temp)
592
- })
593
- this.$resetValidation()
594
-
595
- // 获取计算优惠
596
- this.getPrivilegeList()
597
- }
598
- },
599
- 'model.f_payment' (val) {
600
- if (val == '免交') {
601
- this.mjshow = true
602
- } else if (val == '赠气' && (this.model.f_preamount || this.model.f_preamount != '')) {
603
- if (this.row.f_collection_type == '按气量') {
604
- this.pregas()
605
- } else {
606
- this.preamount()
607
- }
608
- } else {
609
- this.mjshow = false
610
- }
611
- // if(this.row.f_collection_type == '按气量'){
612
- // this.pregas();
613
- // }else{
614
- // this.preamount();
615
- // }
616
- },
617
- 'model.f_collection' (val) {
618
- // 获取计算优惠
619
- this.getPrivilegeList()
620
- }
621
- },
622
- events: {
623
- // 删除Resid数组元素
624
- 'delResid' (val) {
625
- this.resid.$remove({id: val, f_biobid: ''})
626
- // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
627
- },
628
- // 增加Resid数组元素
629
- 'resid' (val) {
630
- this.resid.push({id: val, f_biobid: ''})
631
- }
632
- },
633
- methods: {
634
- // 校验发票信息
635
- checkInvoiceMsg (flag) {
636
- // 校验是否超出最大透支余额
637
- if (this.model.f_payment == '系统余额透支') {
638
- const maxOverdraftBalance = - (this.$appdata.getSingleValue("最大透支余额") - 0)
639
- const curSysBalance = (this.row.f_sys_balance - 0) - (this.model.f_totalcost - 0)
640
- if (curSysBalance < maxOverdraftBalance){
641
- this.$showAlert('您的系统余额将超出最大透支余额,请使用别的付款方式!', 'danger', 5000)
642
- return
643
- }
644
- this.model.f_sys_balance = curSysBalance
645
- }
646
-
647
- // 收款回车时, 如果确认按钮是灰色不进行任何操作
648
- if (flag) return
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
- if (JSON.stringify(this.model.f_payment).indexOf('转账') !== -1) {
778
- // 进入转账筛选条件
779
- this.model.f_banktransfer_person = ''
780
- this.model.f_banktransfer_date = ''
781
- this.BankTransfer = true
782
- } else {
783
- this.model.f_banktransfer_person = ''
784
- this.model.f_banktransfer_date = ''
785
- this.BankTransfer = false
786
- }
787
- },
788
- // 根据选择的付款方式 获取优惠列表
789
- async getPrivilegeList () {
790
- // 初始化下拉选择列表
791
- this.privilegeList = [{label: '无优惠', value: '0'}]
792
- // 初始为无优惠
793
- this.model.f_privilege_id = '0'
794
- if (this.model.f_payment && this.model.f_payment.length) {
795
- // 查询条件
796
- let payments = JSON.stringify(this.model.f_payment)
797
- payments = payments.replace('[', '(').replace(']', ')').replace(/"/g, '\'')
798
- let HttpReset = new HttpResetClass()
799
- let privilege = await HttpReset.load('POST', 'rs/sql/singleTable_OrderBy', {
800
- data: {
801
- items: 'id,f_privilege_name,f_privilege_type',
802
- tablename: 't_privilege',
803
- 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 = '有效'`,
804
- orderitem: 'id'
805
- }
806
- }, {resolveMsg: null, rejectMsg: '查询优惠信息失败'})
807
- // 查询结果放到下拉列表
808
- for (let p of privilege.data) {
809
- this.privilegeList.push({label: p.f_privilege_name, value: p.id, type: p.f_privilege_type})
810
- }
811
- this.privilegeCalculate()
812
- }
813
- },
814
- // 优惠计算
815
- async privilegeCalculate () {
816
- // 初始化减免金额
817
- this.model.f_privilege_money = 0
818
- this.model.f_after_discount = this.model.f_collection
819
- // 判断是否是自定义优惠
820
- if (this.model.f_privilege_id != null && parseInt(this.model.f_privilege_id)) {
821
- for (let p of this.privilegeList) {
822
- if (p.value == this.model.f_privilege_id && p.type == '自定义') {
823
- this.model.f_privilege_money = window.prompt('请输入你想优惠的金额')
824
- if (!(/^[1-9]\d*(\.\d+)?$/).test(this.model.f_privilege_money) || !(/^[1-9]\d*(\.\d+)?$/).test(this.model.f_privilege_money)) {
825
- this.$showMessage('金额输入格式不正确!')
826
- this.model.f_privilege_money = 0
827
- return
828
- }
829
- if ((this.model.f_privilege_money - 0) >= this.model.f_collection) {
830
- this.$showMessage('减免金额不能大于等于收款金额')
831
- this.model.f_privilege_money = 0
832
- return
833
- }
834
- }
835
- }
836
- }
837
- // 优惠方式, 收款 缺一不计算
838
- if (this.model.f_payment && this.model.f_payment.length && parseInt(this.model.f_privilege_id) && this.model.f_collection) {
839
- let c = {
840
- f_privilege_id: this.model.f_privilege_id,
841
- f_collection: this.model.f_collection,
842
- f_privilege_money: this.data.f_privilege_money
843
- }
844
- let privilegeData = await this.$resetpost('rs/logic/calculatePrivilege', c, {
845
- resolveMsg: null,
846
- rejectMsg: '计算优惠金额出错'
847
- })
848
- // 减免金额
849
- this.model.f_privilege_money = privilegeData.data.f_privilege_money
850
- // 减免后收款金额
851
- this.model.f_after_discount = privilegeData.data.f_collection
852
- }
853
- },
854
- // 判断当前用户是否可以使用系统余额透支
855
- canOverdraftBalance(){
856
- return this.config.overdraftBalance && this.row.f_user_type != "民用"
857
- }
858
- },
859
- computed: {
860
- authArr () {
861
- return this.$login.r ? this.$login.r : []
862
- },
863
- 'curbalance' () {
864
- if (this.model.f_payment == '赠气') {
865
- return this.model.f_balance
866
- }
867
- if (this.model.f_preamount) {
868
- // if (this.row.f_collection_type === '按金额') {
869
- // return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
870
- // } else {
871
- if ((this.row.f_balance - 0) > (this.model.f_preamount - 0)) {
872
- return ((this.row.f_balance - 0) - (this.model.f_preamount - 0) + (this.model.f_collection - 0)).toFixed(4)
873
- } else {
874
- return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
875
- }
876
- // return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
877
- // }
878
- } else {
879
- return this.row.f_balance
880
- }
881
- },
882
- 'invoice_show_gas' () {
883
- return this.row.f_collection_type === '按气量' ? '是' : '否'
884
- },
885
- 'islegal' () {
886
- console.log('支付分离。。。', this.paymentModel.length, this.model.f_collection)
887
- if (this.paymentModel.length > 1 && this.model.f_collection) {
888
- let sum = 0
889
- this.paymentModel.forEach((res) => {
890
- sum += (res.f_money - 0)
891
- })
892
- return (this.model.f_collection - 0) === (sum - 0)
893
- } else {
894
- return true
895
- }
896
- }
897
- }
898
- }
899
- </script>
900
-
901
- <style>
902
- </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" v-el:fpregas
22
+ v-validate:f_pregas='{required: true, dctest: [maxgas, "<=" ]}' placeholder="预购气量"
23
+ v-next-el='fcollection'>
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" v-el:fpregas
28
+ @blur="pregas()" v-model="model.f_pregas" placeholder="预购气量"
29
+ v-next-el='fcollection'>
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"
36
+ v-validate:f_preamount='{required: true, dctest: [maxmoney, "<=" ],dctest: [0, ">"]}' placeholder="预购金额"
37
+ v-next-el='fcollection'>
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='fcollection' 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!='赠气' && row.f_meter_type.includes('卡表')"
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:fcollection @keyup.enter="checkInvoiceMsg((!$v.valid || validateOk || !islegal || clickConfirm))" 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=='赠气' && row.f_meter_type.includes('卡表')"
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:fcollection @keyup.enter="checkInvoiceMsg((!$v.valid || validateOk || !islegal || clickConfirm))" v-scale="[model.f_totalcost, 4]" :disabled="$refs.givechange.promptText != ''">
109
+ </div>
110
+ <div class="col-sm-3" v-if="row.f_collection_type === '按金额' && row.f_meter_type.includes('卡表')">
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:fcollection @keyup.enter="checkInvoiceMsg((!$v.valid || validateOk || !islegal || clickConfirm))" v-scale="[model.f_collection, 4]" :disabled="$refs.givechange.promptText != ''">
114
+ </div>
115
+ <div class="col-sm-4" v-if="!row.f_meter_type.includes('卡表')">
116
+ <label for="f_collection" class=" font_normal_body"><font size="4px"
117
+ style="font-weight:bold">*收&emsp;款</font></label>
118
+ <input id="f_collection" class="input_search" style="width:50%;font-size: 18px;font-weight:bold;"
119
+ type="number" v-model="model.f_collection"
120
+ v-el:fcollection
121
+ @keyup.enter="checkInvoiceMsg((!$v.valid || validateOk || !islegal || clickConfirm))"
122
+ v-scale="[model.f_collection, 4]" disabled>
123
+ </div>
124
+ <div class="col-sm-1 form-group" v-show=" row.f_meter_type.includes('卡表')">
125
+ <give-change :curbalance="curbalance" :collection.sync="model.f_collection" v-ref:givechange></give-change>
126
+ </div>
127
+ </div>
128
+ <div class="row" style="margin-top:5px;">
129
+ <div class="col-sm-9">
130
+ </div>
131
+ <div class="col-sm-3">
132
+ <span v-if="$v.f_collection.dctest" style="color:red ">收款不能小于应收金额</span>
133
+ </div>
134
+ </div>
135
+
136
+ <div class="row" style="margin-top:5px;" v-show="authArr.includes('优惠权限')">
137
+ <div class="col-sm-4">
138
+ <label class="font_normal_body">优惠方式</label>
139
+ <v-select v-model="model.f_privilege_id" @blur.native.capture="privilegeCalculate"
140
+ placeholder='请选择'
141
+ :value.sync="model.f_privilege_id"
142
+ :options='privilegeList' clear-button value-single>
143
+ </v-select>
144
+ </div>
145
+ <div class="col-sm-4">
146
+ <label for="f_preamount" class=" font_normal_body">&nbsp;优惠金额</label>
147
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_privilege_money"
148
+ v-scale="[model.f_privilege_money, 2]" placeholder="优惠金额" disabled>
149
+ </div>
150
+ <div class="col-sm-4">
151
+ <label for="f_preamount" class=" font_normal_body">&nbsp;实际收款</label>
152
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_after_discount"
153
+ v-scale="[model.f_after_discount, 2]" placeholder="优惠后收款" disabled>
154
+ </div>
155
+ </div>
156
+
157
+ <div class="row" v-if="model.f_payment[0].includes('POS')">
158
+ <div class="col-sm-4">
159
+ <label for="f_voucher_number" class="font_normal_body">凭证号</label>
160
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_voucher_number"
161
+ placeholder="凭证号">
162
+ </div>
163
+ </div>
164
+ <div class="row" style="padding-top: 0.5em;">
165
+ <div class="col-sm-4" v-if="!mjshow">
166
+ <label for="f_serial_number" class=" font_normal_body">业务单号</label>
167
+ <input class="input_search" style="width:60%" type="text"
168
+ v-model="model.f_serial_number" placeholder="业务单号">
169
+ </div>
170
+ <div class="col-sm-4" v-if="mjshow"
171
+ :class="[$v.f_serial_number.required || $v.f_serial_number.dctest ? 'has-error' : 'has-success']">
172
+ <label for="f_serial_number" class=" font_normal_body">业务单号</label>
173
+ <input class="input_search" style="width:60%" type="text" v-validate:f_serial_number='{required: true }'
174
+ v-model="model.f_serial_number" placeholder="业务单号">
175
+ </div>
176
+
177
+
178
+ <div class="col-sm-8">
179
+ <label for="f_comments" class="font_normal_body">&nbsp;备&emsp;&emsp;注</label>
180
+ <input class="input_search" style="width:77%" v-model="model.f_comments" rows="1" placeholder="备注">
181
+ </div>
182
+ </div>
183
+
184
+ <div v-if="paymentModel.length >1">
185
+ <div class="row" style="margin-top:10px;">
186
+ <p class="col-sm-2 text-left" style="padding: 10px;"><img src="../../../static/juxing.png"/><strong
187
+ style="margin-left: 4%">付款明细</strong></p>
188
+ </div>
189
+ <div class="row" style="margin-top:10px;">
190
+ <div class="col-sm-4 " v-for="pay in paymentModel">
191
+ <label class="font_normal_body">{{pay.f_payment}}:</label>
192
+ <input id="f_money" type="text" class="input_search" style="width:60%" v-model="pay.f_money">
193
+ </div>
194
+ <div class="col-sm-4 ">
195
+ <strong v-if="!islegal" style="color: red">所输入的金额必须等于收款金额</strong>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ </form>
200
+ <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
201
+ <print-bill :show="print" :bill-config='config' :bill-data='billData' :data='row' @toggle="close"
202
+ @printok="printok" v-ref:printbill></print-bill>
203
+ <div style="text-align:right; height: 25%">
204
+ <strong style="color:red;margin-right: 5px">{{ $refs.givechange.promptText }}</strong>
205
+ <strong style="font-size: large" v-if="!config.notShowFormula">计算公式:{{calculatedetail ? calculatedetail : ' 暂无'}}</strong><br/>
206
+ <payment-code-button :clickable="!$v.valid || validateOk || !islegal || clickConfirm"
207
+ :payment.sync="model.f_payment" :payment-data="paytype"
208
+ @confirm-payment="confirm()">
209
+ </payment-code-button>
210
+ <button class="button_search btn-gn" type="submit" @click="checkInvoiceMsg()"
211
+ :disabled='!$v.valid || validateOk || !islegal || clickConfirm'>确认
212
+ </button>
213
+ <button class="button_clear btn-gn" @click="clean()">取消</button>
214
+ </div>
215
+ </validator>
216
+ <eticket-modal :show="eticket_msg" @closemodalshow="eticket_msg = false" :row="row" @confirm="confirm"></eticket-modal>
217
+ <ticket-print :show="eticket_show" @toggle="eticket_toggle" v-ref:eticketbill></ticket-print>
218
+ <payment-code v-ref:paymentcode :payment="model.f_payment" :row="row" :money="model.f_after_discount"></payment-code>
219
+ </div>
220
+ </div>
221
+ <upload :blodid="row.f_userinfo_id" v-if="config.showupload" isremark="true" fusetype="卡表收费"></upload>
222
+ </template>
223
+ <script>
224
+ import {HttpResetClass} from 'vue-client'
225
+ import XML from '../../plugins/ObjTree'
226
+
227
+ /**
228
+ *综合业务
229
+ *卡表收费组件
230
+ */
231
+
232
+ // 输入金额,换算气量
233
+ let preamountGen = async function (self) {
234
+ let calFee = ((self.model.f_preamount - 0)).toFixed(4)
235
+ if (self.model.f_payment == '赠气') {
236
+ calFee = (self.model.f_preamount - 0).toFixed(4)
237
+ }
238
+ // 通过金额进行划价
239
+ let getGas = await self.$CommonService.feeCalculate(self.model, calFee)
240
+ if (getGas.data.gas) {
241
+ if (self.row.f_isdecimal === '是') {
242
+ if (self.row.f_alias === 'QiaoSong') {
243
+ self.model.f_pregas = (getGas.data.gas - 0).toFixed(1)
244
+ } else {
245
+ self.model.f_pregas = (getGas.data.gas - 0).toFixed(4)
246
+ }
247
+ if (self.row.f_collection_type === '按金额') {
248
+ self.dymoney = 0
249
+ } else {
250
+ let dymoney2 = await self.$CommonService.gasCalculate(self.model, (getGas.data.gas).toFixed(4))
251
+ self.dymoney = (getGas.data.chargenum - 0).toFixed(4) - (dymoney2.data.chargenum - 0).toFixed(4)
252
+ }
253
+ } else {
254
+ // 如果不支持小数,将划价出的多余非整数气量进行划价为金额
255
+ let tempnum = Math.floor(getGas.data.gas - 0)
256
+ let dymoney1 = await self.$CommonService.gasCalculate(self.model, (tempnum).toFixed(4))
257
+ self.dymoney = (getGas.data.chargenum - 0).toFixed(2) - (dymoney1.data.chargenum - 0).toFixed(2)
258
+ self.model.f_pregas = Math.floor(getGas.data.gas - 0)
259
+ }
260
+ }
261
+ self.model.f_totalcost = ((self.row.f_balance - 0) >= (self.model.f_preamount - 0) ? 0 : (self.model.f_preamount - 0 - self.row.f_balance))
262
+
263
+ self.model.chargeprice = getGas.data.chargeprice
264
+ Object.assign(self.model, self.model, getGas.data)
265
+ if (self.model.f_payment == '赠气') {
266
+ self.model.f_totalcost = self.model.f_preamount
267
+ self.model.f_collection = 0
268
+ } else {
269
+ self.model.f_collection = self.config.autoCollection ? self.model.f_totalcost : 0
270
+ self.model.f_totalcost = ((self.model.f_totalcost - 0) - (self.dymoney - 0)).toFixed(4)
271
+ }
272
+ self.model.f_preamount = (calFee - (self.dymoney - 0)).toFixed(4)
273
+ self.calText(getGas.data.chargeprice)
274
+ }
275
+
276
+ // 输入气量,换算金额
277
+ let pregasGen = async function (self) {
278
+ if (self.row.f_isdecimal === '是') {
279
+ self.model.f_pregas = (self.model.f_pregas - 0).toFixed(4)
280
+ } else {
281
+ self.model.f_pregas = (self.model.f_pregas - 0).toFixed(0)
282
+ }
283
+ if ((self.model.f_pregas - 0) - (self.maxgas - 0) <= 0) {
284
+ self.model.f_meter_type = self.row.f_meter_type
285
+ let getAmount = await self.$CommonService.gasCalculate(self.model, self.model.f_pregas)
286
+ self.model.f_preamount = getAmount.data.chargenum
287
+ 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))
288
+ Object.assign(self.model, self.model, getAmount.data)
289
+ self.model.chargeprice = getAmount.data.chargeprice
290
+ if (self.model.f_payment == '赠气') {
291
+ self.model.f_totalcost = getAmount.data.chargenum
292
+ self.model.f_collection = 0
293
+ } else {
294
+ self.model.f_collection = self.config.autoCollection ? self.model.f_totalcost : 0
295
+ if (self.config.floor) {
296
+ self.model.f_collection = Math.ceil(self.model.f_collection)
297
+ }
298
+ }
299
+ self.calText(getAmount.data.chargeprice)
300
+ }
301
+ }
302
+ // 执行保存逻辑
303
+ let sellgasGen = async function (self) {
304
+ try {
305
+ self.row.cardInfo = self.cardData
306
+
307
+ if (self.paymentModel.length === 0) {
308
+ self.paymentModel = [{
309
+ f_payment: self.model.f_payment[0],
310
+ f_money: self.model.f_preamount
311
+ }]
312
+ }
313
+ self.model.xiekamoney = self.model.f_preamount
314
+ if (self.row.f_price_type == '阶梯气价' && self.row.f_is_step == '否' && self.row.f_collection_type == '按金额') {
315
+ self.model.xiekamoney = (self.model.f_pregas * self.model.chargeprice[0].f_price)
316
+ self.model.xiekamoney = self.model.xiekamoney.toFixed(4)
317
+ }
318
+
319
+ self.model.payments = self.paymentModel
320
+ // 加入扫码盒付款码支付流水号
321
+ self.model.f_serial_id = self.$refs.paymentcode.paymentCodeReturnData.f_out_trade_no
322
+ let res = await self.$CardService.sellgas(self.model, self.row)
323
+ let localeSustainMoney = window.localStorage.getItem('sustainMoney')
324
+ if (localeSustainMoney != null) {
325
+ localeSustainMoney = (localeSustainMoney - 0) + (self.model.f_collection - 0)
326
+ window.localStorage.setItem('sustainMoney', localeSustainMoney)
327
+ }
328
+ let param = []
329
+ for (let row of self.resid) {
330
+ param.push({id: row.id})
331
+ }
332
+ let writeid
333
+ if (res.data && res.data.id) {
334
+ writeid = res.data.id
335
+ } else {
336
+ writeid = res
337
+ }
338
+ let data = {
339
+ param: param,
340
+ f_blobid: writeid
341
+ }
342
+
343
+ await self.$resetpost('rs/logic/updatefiles', data)
344
+ console.log(self.config, self.config.hasPrint && !self.$login.r.includes('不打印发票'))
345
+ // 开始打票
346
+ if (self.config.hasPrint && !self.$login.r.includes('不打印发票')) {
347
+ if (self.model.f_print.indexOf('电子发票') == -1) {
348
+ if (self.$login.r.includes('非民用纸质票据拆分')) {
349
+ if (self.row.f_user_type === '非民用') {
350
+ self.billData.url = 'rs/report/fmy_card_bill'
351
+ }
352
+ }
353
+ if (self.config.hasBillManage) {
354
+ // 启用发票管理,获取票据管理中的票号并存储记录
355
+ self.row.id = res
356
+ self.row.f_bill_type = '卡表收费'
357
+ self.row.f_bill_style = self.model.f_print[0]
358
+ self.row.f_url = 'http://192.168.50.77:31039/report/jmreport/shareView/787097260170534912'
359
+ self.print = true
360
+ } else {
361
+ self.row.id = res
362
+ self.row.f_url = 'http://192.168.50.77:31039/report/jmreport/shareView/787097260170534912'
363
+ self.print = true
364
+ }
365
+ } else {
366
+ if (self.model.f_print[0] === '电子发票') {
367
+ self.row.id = res
368
+ self.eticket_show = true
369
+ // 应铜川需要卡表显示
370
+ await self.$refs.eticketbill.openETicket([res], self.row, '是', self.invoice_is_pax, '卡表收费')
371
+ // await self.$CommonService.openEticket(res, '售气收费')
372
+ // self.print = true
373
+ }
374
+ }
375
+ } else {
376
+ self.$dispatch('success')
377
+ }
378
+ self.clickConfirm = false
379
+ } catch (error) {
380
+ console.log('捕获到异常', error)
381
+ if (error instanceof Object) {
382
+ self.$showAlert(error.data, 'danger', 0)
383
+ } else {
384
+ self.$showAlert(error, 'danger', 0)
385
+ }
386
+ self.$dispatch('refresh')
387
+ self.clickConfirm = false
388
+ }
389
+ }
390
+
391
+ let asyncCardMeterCenter = async function (self) {
392
+ await self.$getConfig(self, 'CardMeterCenter')
393
+ console.log('卡表收费config', self.config)
394
+
395
+ // 添加 “系统余额透支” 付款方式
396
+ let i = -1
397
+ for (const index in self.paytype) {
398
+ if (self.paytype[index].value == "系统余额透支"){
399
+ i = index
400
+ break
401
+ }
402
+ }
403
+ if (self.canOverdraftBalance()){
404
+ if (i == -1){
405
+ self.paytype.push({
406
+ label: "系统余额透支",
407
+ value: "系统余额透支"
408
+ })
409
+ }
410
+ }else {
411
+ if (i != -1){
412
+ self.paytype.splice(i, 1)
413
+ }
414
+ }
415
+
416
+ // 默认打印格式
417
+ self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
418
+ self.model.f_payment = [self.config.payment]
419
+ self.mulPrint = self.config.printType instanceof Array
420
+
421
+ // 获取当前票号用
422
+ self.model.f_use_type = self.config.billType
423
+ self.model.f_bill_type = self.model.f_print
424
+ self.hasValidateBill = self.config.hasBillManage
425
+
426
+ // 判断限购
427
+ let limit_param = {
428
+ f_userinfo_id: self.row.f_userinfo_id,
429
+ f_user_id: self.row.f_user_id,
430
+ f_stairprice_id: self.row.f_stairprice_id
431
+ }
432
+ let getLimit = await self.$resetpost('rs/logic/sale_getLimitGas', {data: limit_param}, {
433
+ resolveMsg: null,
434
+ rejectMsg: '获取限购值失败!!'
435
+ })
436
+ console.log('获取限购值', getLimit)
437
+ self.hasLimit = getLimit.data.hasLimit
438
+ if (self.hasLimit) {
439
+ if (getLimit.data.f_limit_value || getLimit.data.f_limit_amount) {
440
+ if (getLimit.data.f_limit_value < 0 && getLimit.data.f_limit_amount < 0) {
441
+ self.$showAlert(`${getLimit.data.msg}`, 'warning', 3000)
442
+ self.$dispatch('refresh')
443
+ } else {
444
+ if (getLimit.data.f_limit_value) {
445
+ self.maxgas = (getLimit.data.f_limit_value - 0)
446
+ self.limitgas = true
447
+ }
448
+ if (getLimit.data.f_limit_amount) {
449
+ self.maxmoney = (getLimit.data.f_limit_amount - 0)
450
+ self.limitmoney = true
451
+ }
452
+ }
453
+ }
454
+ }
455
+ let nowrite_param = {
456
+ f_userfiles_id: self.row.f_userfiles_id
457
+ }
458
+ let getNoWriteCard = await self.$resetpost('rs/sql/getnowritecard', {data: nowrite_param}, {
459
+ resolveMsg: null,
460
+ rejectMsg: '获取最近卡表收费记录失败!!'
461
+ })
462
+ if (getNoWriteCard.data.length > 0) {
463
+ self.$showMessage(`三小时内存在写卡失败的记录,是否重新写卡?`, ['confirm', 'cancel']).then(async (res) => {
464
+ if (res === 'confirm') {
465
+ let url = 'http://127.0.0.1:8003/' + getNoWriteCard.data[0].f_cardpost
466
+ let param = JSON.parse(getNoWriteCard.data[0].f_cardparam)
467
+ let cardRes = await self.$resetpost(url, param, {resolveMsg: null, rejectMsg: '重新写卡失败'})
468
+ if (cardRes.data.Err || cardRes.data.Exception) {
469
+ self.$showAlert(`卡服务错误:${cardRes.data.Err}${cardRes.data.Exception},请联系开发人员处理!!`, 'danger', 3000)
470
+ self.$dispatch('refresh', self.row)
471
+ } else {
472
+ self.$resetpost('rs/logic/writeCardAgin', getNoWriteCard.data[0], {resolveMsg: '重新写卡成功', rejectMsg: '重新写卡失败'})
473
+ self.$dispatch('success')
474
+ }
475
+ } else {
476
+ self.$dispatch('refresh', self.row)
477
+ }
478
+ })
479
+ }
480
+ }
481
+ export default {
482
+ title: '卡表收费',
483
+ data () {
484
+ return {
485
+ mjshow: false,
486
+ serialShow: false,
487
+ resid: [], // 存放新增的f_files表中id
488
+ config: {
489
+ notShowFormula: false, // 不显示计算公式,默认显示
490
+ autoCollection: true, // 自动填写收款
491
+ showupload: true, // 显示上传
492
+ hasPrint: true, // 默认打票
493
+ hasBillManage: false, // 默认不启用发票管理
494
+ billType: '燃气费', // 票据类型(燃气费,其他费用,调用的发票代码不同)
495
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
496
+ payment: '现金缴费',
497
+ floor: false,
498
+ overdraftBalance: false // 是否支持系统余额透支
499
+ },
500
+ eticket_msg: false,
501
+ eticket_show: false,
502
+ invoice_is_pax: '不征税',
503
+ is_pax: [{label: '征税', value: '征税'}, {label: '不征税', value: '不征税'}],
504
+ model: {
505
+ f_purchase: 0,
506
+ f_payment: [],
507
+ f_pregas: '',
508
+ f_preamount: 0,
509
+ f_totalcost: 0,
510
+ f_curbalance: 0,
511
+ f_collection: '',
512
+ f_balance: 0,
513
+ f_print: [],
514
+ f_meter_type: '',
515
+ f_voucher_number: '',
516
+ f_banktransfer_person: '',
517
+ f_banktransfer_date: '',
518
+ f_privilege_id: 0,
519
+ f_privilege_money: 0,
520
+ f_after_discount: 0
521
+ },
522
+ calculatedetail: '',
523
+
524
+ // 启用发票管理需要对票号进行验证
525
+ hasValidateBill: false,
526
+ validateOk: false,
527
+
528
+ print: false,
529
+ billData: {
530
+ url: 'rs/report/card_bill',
531
+ billnumber: ''
532
+ },
533
+ hasLimit: false,
534
+ maxgas: 99999999, // 限购
535
+ maxmoney: 99999999,
536
+ limitmoney: false,
537
+ limitgas: false,
538
+
539
+ paymentModel: [], // 多笔付款方式
540
+
541
+ mulPrint: false,
542
+ clickConfirm: false, // 控制确认按钮只能点击一次
543
+ // 下拉框值
544
+ paytype: [],
545
+ printstyle: this.$appdata.getParam('打印格式'),
546
+ privilegeList: [{label: '无优惠', value: '0'}],
547
+ BankTransfer: false,
548
+ // 小数是否支持,导致划价产生的多余气量,金额
549
+ dymoney: 0
550
+ }
551
+ },
552
+ props: ['row', 'cardData'],
553
+ async ready () {
554
+ if (this.authArr.includes('余额写卡限定')) {
555
+ this.paytype = [{label: '余额写卡', value: '余额写卡'}]
556
+ } else {
557
+ this.paytype = await this.$appdata.getParam('付款方式') ? await this.$appdata.getParam('付款方式') : []
558
+ if (!this.$login.r.includes('免交充值付款')) {
559
+ this.paytype = this.paytype.filter((item) => {
560
+ return item.label != '免交'
561
+ })
562
+ }
563
+ }
564
+ // this.getPurchase()
565
+ this.model.f_price_id = this.row.f_price_id
566
+ this.model.f_user_id = this.row.f_user_id
567
+ this.model.f_userfiles_id = this.row.f_userfiles_id
568
+ this.model.f_userinfo_id = this.row.f_userinfo_id
569
+ this.model.f_balance = this.row.f_alias === 'QiaoSong' ? Math.trunc(this.row.f_balance) : this.row.f_balance
570
+ if (this.row.f_collection_type == '按金额') {
571
+ this.model.f_preamount = ''
572
+ this.model.f_pregas = 0
573
+ }
574
+ this.$els.fpregas.focus()
575
+ asyncCardMeterCenter(this)
576
+ },
577
+ watch: {
578
+ 'model.f_payment.length' (val) {
579
+ console.log('付款方式多选。。', val)
580
+ if (val > 1 && !this.model.f_preamount) {
581
+ this.model.f_payment = ['现金缴费']
582
+ this.$showAlert('请先计算付款金额', 'warning', 2000)
583
+ } else {
584
+ this.paymentModel = []
585
+
586
+ this.model.f_payment.forEach((res) => {
587
+ let temp = {
588
+ f_payment: res,
589
+ f_money: 0
590
+ }
591
+ this.paymentModel.push(temp)
592
+ })
593
+ this.$resetValidation()
594
+
595
+ // 获取计算优惠
596
+ this.getPrivilegeList()
597
+ }
598
+ },
599
+ 'model.f_payment' (val) {
600
+ if (val == '免交') {
601
+ this.mjshow = true
602
+ } else if (val == '赠气' && (this.model.f_preamount || this.model.f_preamount != '')) {
603
+ if (this.row.f_collection_type == '按气量') {
604
+ this.pregas()
605
+ } else {
606
+ this.preamount()
607
+ }
608
+ } else {
609
+ this.mjshow = false
610
+ }
611
+ // if(this.row.f_collection_type == '按气量'){
612
+ // this.pregas();
613
+ // }else{
614
+ // this.preamount();
615
+ // }
616
+ },
617
+ 'model.f_collection' (val) {
618
+ // 获取计算优惠
619
+ this.getPrivilegeList()
620
+ }
621
+ },
622
+ events: {
623
+ // 删除Resid数组元素
624
+ 'delResid' (val) {
625
+ this.resid.$remove({id: val, f_biobid: ''})
626
+ // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
627
+ },
628
+ // 增加Resid数组元素
629
+ 'resid' (val) {
630
+ this.resid.push({id: val, f_biobid: ''})
631
+ }
632
+ },
633
+ methods: {
634
+ // 校验发票信息
635
+ checkInvoiceMsg (flag) {
636
+ // 校验是否超出最大透支余额
637
+ if (this.model.f_payment == '系统余额透支') {
638
+ const maxOverdraftBalance = - (this.$appdata.getSingleValue("最大透支余额") - 0)
639
+ const curSysBalance = (this.row.f_sys_balance - 0) - (this.model.f_totalcost - 0)
640
+ if (curSysBalance < maxOverdraftBalance){
641
+ this.$showAlert('您的系统余额将超出最大透支余额,请使用别的付款方式!', 'danger', 5000)
642
+ return
643
+ }
644
+ this.model.f_sys_balance = curSysBalance
645
+ }
646
+
647
+ // 收款回车时, 如果确认按钮是灰色不进行任何操作
648
+ if (flag) return
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
+ if (JSON.stringify(this.model.f_payment).indexOf('转账') !== -1) {
778
+ // 进入转账筛选条件
779
+ this.model.f_banktransfer_person = ''
780
+ this.model.f_banktransfer_date = ''
781
+ this.BankTransfer = true
782
+ } else {
783
+ this.model.f_banktransfer_person = ''
784
+ this.model.f_banktransfer_date = ''
785
+ this.BankTransfer = false
786
+ }
787
+ },
788
+ // 根据选择的付款方式 获取优惠列表
789
+ async getPrivilegeList () {
790
+ // 初始化下拉选择列表
791
+ this.privilegeList = [{label: '无优惠', value: '0'}]
792
+ // 初始为无优惠
793
+ this.model.f_privilege_id = '0'
794
+ if (this.model.f_payment && this.model.f_payment.length) {
795
+ // 查询条件
796
+ let payments = JSON.stringify(this.model.f_payment)
797
+ payments = payments.replace('[', '(').replace(']', ')').replace(/"/g, '\'')
798
+ let HttpReset = new HttpResetClass()
799
+ let privilege = await HttpReset.load('POST', 'rs/sql/singleTable_OrderBy', {
800
+ data: {
801
+ items: 'id,f_privilege_name,f_privilege_type',
802
+ tablename: 't_privilege',
803
+ 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 = '有效'`,
804
+ orderitem: 'id'
805
+ }
806
+ }, {resolveMsg: null, rejectMsg: '查询优惠信息失败'})
807
+ // 查询结果放到下拉列表
808
+ for (let p of privilege.data) {
809
+ this.privilegeList.push({label: p.f_privilege_name, value: p.id, type: p.f_privilege_type})
810
+ }
811
+ this.privilegeCalculate()
812
+ }
813
+ },
814
+ // 优惠计算
815
+ async privilegeCalculate () {
816
+ // 初始化减免金额
817
+ this.model.f_privilege_money = 0
818
+ this.model.f_after_discount = this.model.f_collection
819
+ // 判断是否是自定义优惠
820
+ if (this.model.f_privilege_id != null && parseInt(this.model.f_privilege_id)) {
821
+ for (let p of this.privilegeList) {
822
+ if (p.value == this.model.f_privilege_id && p.type == '自定义') {
823
+ this.model.f_privilege_money = window.prompt('请输入你想优惠的金额')
824
+ if (!(/^[1-9]\d*(\.\d+)?$/).test(this.model.f_privilege_money) || !(/^[1-9]\d*(\.\d+)?$/).test(this.model.f_privilege_money)) {
825
+ this.$showMessage('金额输入格式不正确!')
826
+ this.model.f_privilege_money = 0
827
+ return
828
+ }
829
+ if ((this.model.f_privilege_money - 0) >= this.model.f_collection) {
830
+ this.$showMessage('减免金额不能大于等于收款金额')
831
+ this.model.f_privilege_money = 0
832
+ return
833
+ }
834
+ }
835
+ }
836
+ }
837
+ // 优惠方式, 收款 缺一不计算
838
+ if (this.model.f_payment && this.model.f_payment.length && parseInt(this.model.f_privilege_id) && this.model.f_collection) {
839
+ let c = {
840
+ f_privilege_id: this.model.f_privilege_id,
841
+ f_collection: this.model.f_collection,
842
+ f_privilege_money: this.data.f_privilege_money
843
+ }
844
+ let privilegeData = await this.$resetpost('rs/logic/calculatePrivilege', c, {
845
+ resolveMsg: null,
846
+ rejectMsg: '计算优惠金额出错'
847
+ })
848
+ // 减免金额
849
+ this.model.f_privilege_money = privilegeData.data.f_privilege_money
850
+ // 减免后收款金额
851
+ this.model.f_after_discount = privilegeData.data.f_collection
852
+ }
853
+ },
854
+ // 判断当前用户是否可以使用系统余额透支
855
+ canOverdraftBalance(){
856
+ return this.config.overdraftBalance && this.row.f_user_type != "民用"
857
+ }
858
+ },
859
+ computed: {
860
+ authArr () {
861
+ return this.$login.r ? this.$login.r : []
862
+ },
863
+ 'curbalance' () {
864
+ if (this.model.f_payment == '赠气') {
865
+ return this.model.f_balance
866
+ }
867
+ if (this.model.f_preamount) {
868
+ // if (this.row.f_collection_type === '按金额') {
869
+ // return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
870
+ // } else {
871
+ if ((this.row.f_balance - 0) > (this.model.f_preamount - 0)) {
872
+ return ((this.row.f_balance - 0) - (this.model.f_preamount - 0) + (this.model.f_collection - 0)).toFixed(4)
873
+ } else {
874
+ return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
875
+ }
876
+ // return ((this.model.f_collection - 0) - (this.model.f_totalcost - 0)).toFixed(4)
877
+ // }
878
+ } else {
879
+ return this.row.f_balance
880
+ }
881
+ },
882
+ 'invoice_show_gas' () {
883
+ return this.row.f_collection_type === '按气量' ? '是' : '否'
884
+ },
885
+ 'islegal' () {
886
+ console.log('支付分离。。。', this.paymentModel.length, this.model.f_collection)
887
+ if (this.paymentModel.length > 1 && this.model.f_collection) {
888
+ let sum = 0
889
+ this.paymentModel.forEach((res) => {
890
+ sum += (res.f_money - 0)
891
+ })
892
+ return (this.model.f_collection - 0) === (sum - 0)
893
+ } else {
894
+ return true
895
+ }
896
+ }
897
+ }
898
+ }
899
+ </script>
900
+
901
+ <style>
902
+ </style>