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