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