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