sale-client 4.2.94 → 4.2.96

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.
@@ -0,0 +1,1194 @@
1
+ <template>
2
+ <div class="auto" style="overflow:auto;" id="ChangeMeter">
3
+ <validator name='v'>
4
+ <form novalidate class="form-horizontal">
5
+ <div class="row auto">
6
+ <div class="col-sm-4 form-group">
7
+ <label for="f_type" class=" font_normal_body">换表类型</label>
8
+ <v-select id="f_type"
9
+ v-model="model.f_type"
10
+ title="参数:换表类型"
11
+ placeholder='请选择'
12
+ :value-single="true"
13
+ :value.sync="model.f_type"
14
+ :options='replacewatchtype'
15
+ @change="typeChange"
16
+ :disabled="!(row.f_meter_type.includes('卡表')||row.f_meter_type ==='物联网表')"
17
+ close-on-select clear-button>
18
+ </v-select>
19
+ </div>
20
+ <div class="col-sm-4 form-group" v-if="!config.f_change_operator">
21
+ <label for="f_change_operator" class=" font_normal_body">换&ensp;表&ensp;人</label>
22
+ <input class="input_search" style="width:60%" type="text" v-model="model.f_change_operator"
23
+ placeholder="换表人">
24
+ </div>
25
+ <div class="col-sm-4 form-group" v-if="config.f_change_operator" :class="[$v.f_change_operator.required ? 'has-error' : '']">
26
+ <label for="f_change_operator" class=" font_normal_body">换&ensp;表&ensp;人</label>
27
+ <input class="input_search" style="width:60%" type="text" v-model="model.f_change_operator"
28
+ v-validate:f_change_operator="{required: true }"
29
+ placeholder="换表人">
30
+ </div>
31
+
32
+ <div class="col-sm-4 form-group"
33
+ :class="[$v.f_using_base_old.required || $v.f_using_base_old.dctest ? 'has-error' : 'has-success']">
34
+ <label for="f_remanent_gas" class=" font_normal_body">旧表底数</label>
35
+ <input class="input_search" style="width:60%" type="number"
36
+ v-model="model.f_using_base_old"
37
+ placeholder="请输入旧表底数"
38
+ v-validate:f_using_base_old='{required: true, dctest: [-1, ">" ] }'
39
+ @blur="pregasChange()">
40
+ </div>
41
+ </div>
42
+ <!--<p class="bg-info text-center" v-if="!model.f_type.includes('清零')" style="padding: 8px;">新表信息</p>-->
43
+ <meter-message v-if="!model.f_type.includes('清零') && !model.f_type.includes('换卡控流量计')"
44
+ :f_userfiles_id="row.f_userfiles_id" :metermessage.sync="model.metermessage"
45
+ @valid="meterinfo = true"
46
+ @invalid="meterinfo = false" @gasmodel="gasModelChange" v-ref:metermsg></meter-message>
47
+
48
+ <div v-if="row.f_meter_type != '机表'">
49
+ <div class="row auto" style="margin-top: 10px"
50
+ v-if="changeType == 'gasToAmount' || changeType == 'amountToGas'">
51
+ <!-- 气量转金额 || 金额转签气量 -->
52
+ <div class="col-sm-4 form-group"
53
+ :class="[$v.f_remanent_gas.required || $v.f_remanent_gas.dctest ? 'has-error' : 'has-success']">
54
+ <label for="f_remanent_gas" class=" font_normal_body">补&ensp;气&ensp;量</label>
55
+ <input class="input_search" style="width:60%" type="number"
56
+ v-model="model.f_remanent_gas"
57
+ placeholder="补气量"
58
+ v-validate:f_remanent_gas='{required: true, dctest: [-1, ">" ] }'>
59
+ </div>
60
+ <div class="col-sm-4 form-group">
61
+ <label class=" font_normal_body">补气单价</label>
62
+ <input class="input_search" style="width:60%" type="number"
63
+ v-model="model.f_remanent_price"
64
+ placeholder="补气单价" readonly>
65
+ </div>
66
+ <div class="col-sm-4 form-group"
67
+ :class="[$v.f_remanent_money.required || $v.f_remanent_money.dctest ? 'has-error' : 'has-success']">
68
+ <label for="f_remanent_money" class=" font_normal_body">补气金额</label>
69
+ <input class="input_search" style="width:60%" type="number"
70
+ v-model="model.f_remanent_money"
71
+ placeholder="补气金额"
72
+ @blur="remanentChange"
73
+ v-validate:f_remanent_money='{required: true, dctest: [-1, ">" ] }'>
74
+ </div>
75
+ </div>
76
+ <div class="row auto" v-if="changeType == 'gasToGas'">
77
+ <!-- 气量转气量 -->
78
+ <div class="col-sm-4 form-group"
79
+ :class="[$v.f_remanent_gas.required || $v.f_remanent_gas.dctest ? 'has-error' : 'has-success']">
80
+ <label for="f_remanent_gas" class=" font_normal_body">补&ensp;气&ensp;量</label>
81
+ <input class="input_search" style="width:60%" type="number"
82
+ v-model="model.f_remanent_gas"
83
+ placeholder="补气量"
84
+ v-validate:f_remanent_gas='{required: true, dctest: [-1, ">" ] }'>
85
+ </div>
86
+ </div>
87
+
88
+ <div class="row auto" v-if="changeType == 'amountToAmount'">
89
+ <!-- 金额转金额 -->
90
+ <div class="col-sm-4 form-group"
91
+ :class="[$v.f_remanent_money.required || $v.f_remanent_money.dctest ? 'has-error' : 'has-success']">
92
+ <label for="f_remanent_money" class=" font_normal_body">补气金额</label>
93
+ <input class="input_search" style="width:60%" type="number"
94
+ v-model="model.f_remanent_money"
95
+ placeholder="补气金额"
96
+ v-scale="[model.f_remanent_money, row.f_fee_decimal || 4]"
97
+ v-validate:f_remanent_money='{required: true, dctest: [-1, ">" ] }'>
98
+ </div>
99
+ </div>
100
+ </div>
101
+
102
+ <div class="row auto" v-if="model.f_type.includes('换卡控流量计')">
103
+ <div class="col-sm-4 form-group">
104
+ <label class="font_normal_body" title="流量计表号">新流量计表号</label>
105
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_flowmeter_number"
106
+ placeholder='流量计表号'></input>
107
+ </div>
108
+ <div class="col-sm-4 form-group">
109
+ <label class="font_normal_body" title="流量计通经">新流量计通经</label>
110
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_flowmeter_pass"
111
+ placeholder='流量计通经'></input>
112
+ </div>
113
+ <div class="col-sm-4 form-group" :class="[$v.f_meter_base.required ? 'has-error' : '']">
114
+ <label class="font_normal_body">新表底数</label>
115
+ <input type="number" class="input_search" style="width:60%" v-validate:f_meter_base='{required: true }'
116
+ v-model="model.metermessage.f_meter_base" placeholder='表底数'>
117
+ </div>
118
+
119
+ <div class="col-sm-4 form-group">
120
+ <label class="font_normal_body" title="流量计品牌">新流量计品牌</label>
121
+ <v-select :value.sync="model.f_flowmeter_brand" :options='flowmeterbrands' value-single placeholder='流量计品牌'
122
+ close-on-select
123
+ search v-model='model.f_flowmeter_brand'></v-select>
124
+ </div>
125
+ <div class="col-sm-4 form-group">
126
+ <label class="font_normal_body" title="流量计型号">新流量计型号</label>
127
+ <v-select :value.sync="model.f_flowmeter_model" :options='flowmetermodels(model.f_flowmeter_brand)'
128
+ value-single placeholder='流量计型号' close-on-select
129
+ v-model='model.f_flowmeter_model' :disabled='model.f_flowmeter_brand.length === 0'></v-select>
130
+ </div>
131
+ <div class="col-sm-4 form-group">
132
+ <label class="font_normal_body" title="流量计精准度">新流量计精准度</label>
133
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_flowmeter_accuracy"
134
+ placeholder='流量计精准度'></input>
135
+ </div>
136
+ <div class="col-sm-4 form-group">
137
+ <label class="font_normal_body" title="流量计压力等级">新流量计压力等级</label>
138
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_flowmeter_mpa_level"
139
+ placeholder='流量计压力等级'></input>
140
+ </div>
141
+ <div class="col-sm-4 form-group">
142
+ <label class="font_normal_body" title="流量计安装日期">新流量计安装日期</label>
143
+ <datepicker style="width:60%" placeholder="流量计安装日期"
144
+ v-model="model.f_flowmeter_install_date"
145
+ :value.sync="model.f_flowmeter_install_date"
146
+ :format="'yyyy-MM-dd HH:mm:ss'"
147
+ ></datepicker>
148
+ </div>
149
+ <div class="col-sm-4 form-group">
150
+ <label class="font_normal_body">业务单号</label>
151
+ <input class="input_search" style="width:60%" type="text"
152
+ v-model="model.f_serial_number" placeholder="业务单号">
153
+ </div>
154
+ </div>
155
+
156
+
157
+ <div class="row auto">
158
+
159
+ <div class="col-sm-4 form-group">
160
+ <label for="f_changemeter_fee" class=" font_normal_body">换表金额</label>
161
+ <input class="input_search" style="width:60%" type="number" v-model="model.f_changemeter_fee"
162
+ placeholder="换表金额">
163
+ </div>
164
+ <div class="col-sm-4 form-group">
165
+ <label for="f_paytype" class=" font_normal_body" title="参数名称:付款方式">收款方式</label>
166
+ <v-select id="f_payment"
167
+ title="参数:付款方式"
168
+ v-model="f_payment"
169
+ placeholder='请选择'
170
+ :value-single="true"
171
+ :value.sync="model.f_payment"
172
+ :options='paytype'
173
+ close-on-select clear-button></v-select>
174
+ </div>
175
+ <div class="col-sm-4 form-group">
176
+ <label for="f_print" class="font_normal_body">打印格式</label>
177
+ <v-select id="print"
178
+ title="参数:打印格式"
179
+ v-model="f_print"
180
+ placeholder='请选择'
181
+ :multiple="mulPrint"
182
+ :value.sync="model.f_print"
183
+ :options='printstyle'
184
+ close-on-select clear-button></v-select>
185
+ </div>
186
+ </div>
187
+ <div class="row" v-if="!model.f_type.includes('换卡控流量计')">
188
+ <div class="col-sm-4 form-group" :class="[$m.type.required ? 'has-error' : '']">
189
+ <label class="font_normal_body">气价类型</label>
190
+ <v-select :value.sync="newinfo.pricetype" v-model="newinfo.pricetype"
191
+ placeholder='气价类型' :options="pricetypes"
192
+ close-on-select v-ref:type>
193
+ </v-select>
194
+ </div>
195
+ <div class="col-sm-4 form-group" :class="[$m.name.required ? 'has-error' : '']">
196
+ <label class="font_normal_body">气价名称</label>
197
+ <v-select :value.sync="newinfo.pricename" v-model="newinfo.pricename"
198
+ placeholder='气价名称' :options="getPricenames()"
199
+ close-on-select :disabled='newinfo.pricetype.length === 0 ' v-ref:name></v-select>
200
+ </div>
201
+ <div class="col-sm-4 form-group">
202
+ <label class="font_normal_body">新抄表册</label>
203
+ <v-select :value.sync="newinfo.f_meter_book"
204
+ v-model="newinfo.f_meter_book"
205
+ placeholder='新抄表册'
206
+ :options="meterbookoptions"
207
+ close-on-select>
208
+
209
+ </v-select>
210
+ </div>
211
+
212
+ </div>
213
+ <div class="row auto" v-if="!model.f_type.includes('换卡控流量计')">
214
+ <div class="col-sm-4 ">
215
+ <label for="f_comments" class=" font_normal_body">业务单号</label>
216
+ <input class="input_search" style="width:60%" type="text"
217
+ v-model="model.f_serial_number" placeholder="业务单号">
218
+ </div>
219
+ <div class="col-sm-4 ">
220
+ <label class=" font_normal_body">阶梯累计</label>
221
+ <v-select id="f_ladder_sync"
222
+ v-model="model.f_ladder_sync"
223
+ placeholder='是否累计'
224
+ :search="false"
225
+ :value-single="true"
226
+ :value.sync="model.f_ladder_sync"
227
+ :options='ladder'
228
+ close-on-select clear-button></v-select>
229
+ </div>
230
+ <div class="col-sm-4"
231
+ :class="[$v.f_stair_use.required || $v.f_stair_use.dctest ? 'has-error' : 'has-success']"
232
+ v-if=" model.metermessage.gasbrand[0].f_meter_type ==='物联网表'&& model.f_ladder_sync !=='不同步'">
233
+ <label class=" font_normal_body">阶梯用量</label>
234
+ <input class="input_search" style="width:60%" type="number"
235
+ v-validate:f_stair_use='{required: true, dctest: [0, ">=" ] }'
236
+ v-model="model.f_stair_use" placeholder="旧表阶梯使用量">
237
+ </div>
238
+ <div class="col-sm-4 "
239
+ v-if="(model.metermessage.gasbrand[0].f_meter_type ==='物联网表' && model.metermessage.gasbrand[0].f_hascard ==='是')
240
+ || (model.f_type.includes('清零') && row.f_meter_type ==='物联网表' && row.f_hascard ==='是')">
241
+ <label class=" font_normal_body">开户方式</label>
242
+ <v-select id="f_open_type"
243
+ v-model="model.f_open_type"
244
+ placeholder='开户方式'
245
+ :search="false"
246
+ :value-single="true"
247
+ :value.sync="model.f_open_type"
248
+ :options='opentype'
249
+ close-on-select clear-button></v-select>
250
+ </div>
251
+ <div v-if="config.aroundmeter" class="col-sm-4 form-group" :class="[$v.f_newaroundmeter.required ? 'has-error' : '']">
252
+ <label class="font_normal_body">新表表向</label>
253
+ <v-select :value.sync="model.f_newaroundmeter" :options='aroundmeters' placeholder='新表表向'
254
+ :value-single="true"
255
+ close-on-select
256
+ v-model='model.f_newaroundmeter'></v-select>
257
+ </div>
258
+ <div v-if="config.hasAudit" class="col-sm-4 form-group">
259
+ <label class="font_normal_body" :class="[$v.f_audit_person.required ? 'has-error' : 'has-success']">&nbsp;审核人员&nbsp;</label>
260
+ <input v-show="false" v-model="model.f_audit_person"
261
+ v-validate:f_audit_person='{required: true}'>
262
+ <v-select :value.sync="model.f_audit_person"
263
+ :options='auditor' placeholder='请选择'
264
+ selected="审核人员"
265
+ :value-single="true"
266
+ style="width:60%"
267
+ close-on-select></v-select>
268
+ </div>
269
+ </div>
270
+ <div class="row auto">
271
+ <div class="col-sm-12"
272
+ v-if="!commitflag"
273
+ >
274
+ <label class="font_normal_body ">备&emsp;&emsp;注</label>
275
+ <textarea class="input_textarea" rows="3" style="width:87%;" v-model="model.f_comments"></textarea>
276
+ </div>
277
+ <div class="col-sm-12"
278
+ :class="[$v.f_comments.required ? 'has-error' : 'has-success']"
279
+ v-if="commitflag"
280
+ >
281
+ <label class="font_normal_body ">备&emsp;&emsp;注</label>
282
+ <textarea class="input_textarea" rows="3" style="width:87%;" v-model="model.f_comments"
283
+ v-validate:f_comments='{required: true}'
284
+ ></textarea>
285
+ </div>
286
+ </div>
287
+
288
+ <div class="col-sm-12" v-if="config.changeReason">
289
+ <label class="font_normal_body ">换表原因</label>
290
+ <textarea class="input_textarea" rows="3" style="width:87%;" v-model="model.f_changetables_reason"></textarea>
291
+ </div>
292
+ <div style="text-align:right;height:auto;">
293
+ <button class="button_search" v-show="config.approve == true ? applyButtonShow : false" type="button" @click="apply()"
294
+ :disabled="(!meterinfo && !(model.f_type.includes('清零') || model.f_type.includes('换卡控流量计'))) || !$v.valid"
295
+ >换表审核
296
+ </button>
297
+ <button class="button_search" v-show="config.approve == true ? !applyButtonShow : true" type="button" @click="confirmbefore()"
298
+ :disabled="(!meterinfo && !(model.f_type.includes('清零') ||
299
+ model.f_type.includes('换卡控流量计'))) || !$v.valid"
300
+ >确认
301
+ </button>
302
+ <button class="button_clear" v-show="applyButtonShow" type="button" @click="clean()">取消
303
+ </button>
304
+ </div>
305
+ </form>
306
+ <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
307
+ <print-bill :show="print" :bill-config='config' :bill-data='billData' v-ref:printbill @toggle="close" :data='row' @printok="printok" ></print-bill>
308
+ </validator>
309
+ <modal :show.sync="addTaskModalShow" backdrop="false" width="40%" title="创建任务" small="true" @modal-close="addTaskModalClose()">
310
+ <article slot="modal-body" class="row" style="padding: 10px">
311
+ <add-apply-task :applytaskobj.sync="addTaskModel" @valid="addTaskValid = true" @invalid="addTaskValid = false">
312
+ </add-apply-task>
313
+ </article>
314
+ <footer slot="modal-footer" class="modal-footer" style="text-align: right;border: 0">
315
+ <button class="btn button_search" @click="addTask()"
316
+ :disabled="!addTaskValid">新增审核任务
317
+ </button>
318
+ </footer>
319
+ </modal>
320
+ </div>
321
+ <upload v-if="config.showupload" :blodid="row.f_userinfo_id" :businessid="model.randomBusinessId" isremark="true" fusetype="换表&清零"></upload>
322
+ </template>
323
+ <script>
324
+ /**
325
+ *换表管理
326
+ *组合界面,加载机表,物联网表,气量卡表,金额卡表旧表信息,以及控制显示换新表信息
327
+ */
328
+ import { HttpResetClass } from 'vue-client'
329
+ import Vue from 'vue'
330
+ let getPrice = async function (self) {
331
+ await self.$LoadParams.loadParam(self.$login.f.orgid)
332
+ await self.$getConfig(self, 'ChangeMeter')
333
+
334
+ self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
335
+ self.model.f_payment = self.config.payment
336
+ self.model.f_ladder_sync = self.config.ladderSync
337
+ self.mulPrint = self.config.printType instanceof Array
338
+ self.model.f_use_type = self.config.billType
339
+ self.model.f_bill_type = self.model.f_print
340
+ self.hasValidateBill = self.config.hasBillManage
341
+ self.newinfo.f_meter_book = self.row.f_meter_book_num ? [self.row.f_meter_book_num] : []
342
+
343
+ self.model.f_open_type = self.config.open_way
344
+ self.isGas = (self.row.f_collection_type == '按气量')
345
+
346
+ let http = new HttpResetClass()
347
+ let param = {
348
+ tablename: 't_detailprice',
349
+ condition: `f_price_name = '1' and f_stairprice_id = '${self.row.f_stairprice_id}'`
350
+ }
351
+ let res = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
352
+ data: param
353
+ }, {
354
+ resolveMsg: null,
355
+ rejectMsg: '获取一阶单价!!'
356
+ })
357
+ if (res.data.length > 0) {
358
+ self.model.f_remanent_price = res.data[0].f_price
359
+ }
360
+ let temp = {
361
+ tablename: 't_meter_book',
362
+ condition: `f_book_state='有效' and f_filiale_id='${self.$login.f.orgid}'`
363
+ }
364
+ let meterbooks = await http.load('POST', 'api/af-revenue/sql/saleSingleTable?pageNo=1&pageSize=9999', {data: temp},
365
+ {resolveMsg: null, rejectMsg: '获取抄表册信息失败!!'})
366
+ if (meterbooks.data.length > 0) {
367
+ let options = []
368
+ for (let i = 0; i < meterbooks.data.length; i++) {
369
+ let tmp = {label: meterbooks.data[i].f_book_name, value: meterbooks.data[i].id}
370
+ options.push(tmp)
371
+ }
372
+ self.meterbookoptions = options
373
+ }
374
+ if (self.row.f_price_type === '固定气价') {
375
+ self.model.f_stair_use = 0
376
+ } else {
377
+ let a = await http.load('POST', 'api/af-revenue/logic/commonCal', {data: {model: self.row, isGasValue: 0, value: 0}}, {resolveMsg: null, rejectMsg: '获取阶梯使用情况出错'})
378
+ console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaa', a)
379
+ self.stairInfo = a.data
380
+ self.model.f_stair_use = a.data.sumamount
381
+ }
382
+ self.newinfo.pricetype = [self.row.f_price_type]
383
+ let params = {
384
+ f_user_type: self.row.f_user_type,
385
+ f_gasproperties: self.row.f_gasproperties,
386
+ f_price_type: self.row.f_price_type,
387
+ filter: self.$login.f.orgid
388
+ }
389
+ let rs = self.$GetSaleParam.getPrice(params)
390
+ rs.forEach((val) => {
391
+ if (val.label == self.row.f_price_name) {
392
+ self.newinfo.pricename = [val.value]
393
+ }
394
+ })
395
+ self.initData()
396
+ }
397
+ export default {
398
+ title: '换表登记',
399
+ data () {
400
+ return {
401
+ resid: [], // 存放新增的f_files表中id
402
+ model: {
403
+ f_flowmeter_number: '',
404
+ f_flowmeter_pass: '',
405
+ f_flowmeter_brand: '',
406
+ f_flowmeter_model: '',
407
+ f_flowmeter_accuracy: '',
408
+ f_flowmeter_mpa_level: '',
409
+ f_flowmeter_install_date: this.$login.toStandardTimeString(),
410
+ metermessage: {
411
+ f_meter_type: '',
412
+ gasbrand: '',
413
+ gasmodel: '',
414
+ f_meternumber: '',
415
+ f_meter_base: '',
416
+ f_metertitles: '',
417
+ f_oldmeter_use_reference: 0 // 旧表使用量参考值
418
+ },
419
+ // 旧表底数
420
+ f_ladder_sync: '',
421
+ f_using_base_old: '',
422
+ // 换表补气量
423
+ f_remanent_gas: 0,
424
+ // 换表补气单价
425
+ f_remanent_price: 0,
426
+ f_open_type: '',
427
+ f_remanent_money: 0,
428
+ f_type: '换新表',
429
+ f_comments: '',
430
+ f_othereason: '',
431
+ f_stair_use: '',
432
+ f_payment: '现金缴费',
433
+ f_print: '普通收据',
434
+ f_state: '有效',
435
+ f_changemeter_date: this.$login.toStandardTimeString(),
436
+ f_changemeter_fee: this.$appdata.getSingleValue('换表金额') ? this.$appdata.getSingleValue('换表金额') : 0,
437
+ f_difference_reason: '',
438
+ // 金额表剩余金额
439
+ f_using_fee_old: 0,
440
+ randomBusinessId: ''
441
+ },
442
+ meterinfo: false,
443
+ stairInfo: null,
444
+ meterbookoptions: [],
445
+ // 控制气量和金额的转换显示
446
+ changeType: '',
447
+ config: {
448
+ hasPrint: false, // 默认打票
449
+ hasBillManage: false, // 默认不启用发票管理
450
+ billType: '其他费用', // 票据类型(燃气费,其他费用,调用的发票代码不同)
451
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
452
+ payment: '现金缴费',
453
+ ladderSync: '同步',
454
+ open_way: '发卡开户',
455
+ hasArrearsChange: false, // 是否可以有欠费换表
456
+ f_change_operator: false, // 换表人是否必填
457
+ castInt: true,
458
+ aroundmeter: false, // 表向
459
+ changeReason: false, // 换表原因
460
+ changePrice: false, // 气价任意变更权限
461
+ dispatch: true, // 是否派工
462
+ showupload: true, //
463
+ hasAudit: false // 是否审核
464
+ },
465
+ print: false,
466
+ // 启用发票管理需要对票号进行验证
467
+ hasValidateBill: false,
468
+ validateOk: false,
469
+ billData: {
470
+ url: 'api/af-revenue/report/change_meter',
471
+ bill: ''
472
+ },
473
+ // 控制气量金额的编辑
474
+ isGas: false,
475
+ replacewatchtype: this.$appdata.getParam('换表类型'),
476
+ reason: this.$appdata.getParam('换表原因') ? this.$appdata.getParam('换表原因') : [],
477
+ paytype: this.$appdata.getParam('付款方式'),
478
+ printstyle: this.$appdata.getParam('打印格式'),
479
+ gasproperties: [],
480
+ addgasnum: 0,
481
+ addgas: false,
482
+ books: {
483
+ data: []
484
+ },
485
+ addbalance: false,
486
+ newinfo: {
487
+ f_user_type: '',
488
+ f_gasproperties: '',
489
+ f_meter_book: '',
490
+ pricetype: '',
491
+ pricename: '',
492
+ f_perform_date: this.$login.toStandardDateString() + ' 00:00:00' // 操作时间
493
+ },
494
+ ladder: [{label: '累计', value: '同步'}, {label: '不累计', value: '不同步'}],
495
+ auditor: [],
496
+ opentype: [{label: '指令开户', value: '指令开户'}, {label: '发卡开户', value: '发卡开户'}],
497
+ usertypes: this.$appdata.getParam('用户类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')] : [],
498
+ pricetypes: this.$appdata.getParam('气价类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('气价类型')] : [],
499
+ addTaskModel: {
500
+ f_task_name: '',
501
+ f_userinfo_code: '',
502
+ f_work_flow_name: '',
503
+ f_approval: '',
504
+ f_memorandum: ''
505
+ },
506
+ addTaskValid: false,
507
+ addTaskModalShow: false,
508
+ commitflag: false,
509
+ // 总欠费金额
510
+ alldue_fee: 0
511
+ }
512
+ },
513
+ props: {
514
+ row: {
515
+ type: Object,
516
+ default: undefined
517
+ },
518
+ applyButtonShow: {
519
+ type: Boolean,
520
+ default: true
521
+ },
522
+ dataModel: {
523
+ type: Object,
524
+ default: undefined
525
+ }
526
+ },
527
+ ready () {
528
+ getPrice(this)
529
+ this.getRandomId()
530
+ this.getAuditor()
531
+ },
532
+ events: {
533
+ // 删除Resid数组元素
534
+ 'delResid' (val) {
535
+ this.resid.$remove({id: val, f_biobid: ''})
536
+ // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
537
+ },
538
+ // 增加Resid数组元素
539
+ 'resid' (val) {
540
+ this.resid.push({id: val, f_biobid: ''})
541
+ }
542
+ },
543
+ computed: {
544
+ aroundmeters () {
545
+ return this.$appdata.getParam('左右表')
546
+ },
547
+ flowmeterbrands () {
548
+ let gasbrand = this.$GetSaleParam.getGasbrand()
549
+ let flowmeterbrands = []
550
+ for (let row of gasbrand) {
551
+ flowmeterbrands.push({label: row.label, value: row.label})
552
+ }
553
+ return flowmeterbrands
554
+ }
555
+ },
556
+ methods: {
557
+ async getAuditor () {
558
+ await this.$GetSaleParam.initinputtor()
559
+ this.auditor = this.$GetSaleParam.getAudit(this.$login.f.orgid)
560
+ },
561
+ getRandomId () {
562
+ this.model.randomBusinessId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
563
+ let res = Math.random() * 16 | 0
564
+ let v = c == 'x' ? res : (res & 0x3 | 0x8)
565
+ return v.toString(16)
566
+ })
567
+ },
568
+ feeOldChange () {
569
+ if (this.model.f_using_fee_old) {
570
+ this.model.f_remanent_money = this.model.f_using_fee_old
571
+ }
572
+ },
573
+ addTaskModalClose () {
574
+ this.addTaskModel.f_work_flow_name = ''
575
+ this.addTaskModel.f_task_name = ''
576
+ this.addTaskModel.f_userinfo_code = ''
577
+ this.addTaskModel.f_approval = ''
578
+ this.addTaskModel.f_memorandum = ''
579
+ },
580
+ validateBill (val) {
581
+ this.validateOk = !val.isOk
582
+ this.billData.bill = val.bill
583
+ },
584
+ close () {
585
+ this.print = false
586
+ this.printok()
587
+ },
588
+ async printok () {
589
+ let msg = await this.$showMessage('已成功换表,是否进入补气或购气界面', ['confirm', 'cancel'])
590
+ if (msg == 'confirm') {
591
+ this.$dispatch('get-new-row', this.row)
592
+ } else {
593
+ this.$dispatch('success')
594
+ }
595
+ },
596
+ flowmetermodels (label) {
597
+ let gasbrand = this.$GetSaleParam.getGasbrand()
598
+ let flowmetermodels = []
599
+ for (let row of gasbrand) {
600
+ if (row.label == label) {
601
+ for (let gasmodel of row.value.gasmodel) {
602
+ flowmetermodels.push({label: gasmodel.label, value: gasmodel.label})
603
+ }
604
+ break
605
+ }
606
+ }
607
+ return flowmetermodels
608
+ },
609
+ getPricenames () {
610
+ console.log('气价。,。。', this.newinfo.pricetype)
611
+ let rs = []
612
+ if (this.row.f_user_type && this.row.f_gasproperties && this.newinfo.pricetype.length === 1) {
613
+ let params = {
614
+ f_user_type: this.row.f_user_type,
615
+ f_gasproperties: this.row.f_gasproperties,
616
+ f_price_type: this.newinfo.pricetype[0],
617
+ filter: this.$login.f.orgid
618
+ }
619
+ if (this.config.changePrice) {
620
+ rs = this.$GetSaleParam.getPriceAllOther(params)
621
+ } else {
622
+ rs = this.$GetSaleParam.getPrice(params)
623
+ }
624
+ }
625
+ if (rs.length === 0) {
626
+ this.newinfo.f_price_name = ''
627
+ }
628
+ return rs
629
+ },
630
+ userTypeChange () {
631
+ this.gasproperties = []
632
+ if (this.newinfo.f_user_type.length === 1) {
633
+ this.gasproperties = this.$appdata.getParam(this.newinfo.f_user_type[0])
634
+ }
635
+ },
636
+ // 返回
637
+ clean () {
638
+ this.$dispatch('success', '换表', this.row)
639
+ },
640
+ addTask () {
641
+ if (this.addTaskModel.f_userinfo_code != this.row.f_userinfo_code) {
642
+ this.$showAlert('请填写正确的用户编号!!!', 'warning', 3000)
643
+ return
644
+ }
645
+ let memorandum = {
646
+ f_memorandum: this.addTaskModel.f_memorandum
647
+ }
648
+ this.model.f_business_name = '换表'
649
+ this.model.f_user_name = this.row.f_user_name
650
+ this.model.fusetype = '换表&清零'
651
+ this.model.filesids = this.resid
652
+ let data = {
653
+ f_created_by: this.$login.f.name,
654
+ f_orgid: this.$login.f.orgid,
655
+ f_orgname: this.$login.f.orgs,
656
+ f_depid: this.$login.f.depids,
657
+ f_depname: this.$login.f.deps,
658
+ addModel: this.addTaskModel,
659
+ f_memorandum: JSON.stringify(memorandum),
660
+ f_userinfo_json: this.model,
661
+ f_userinfo_id: this.row.f_userinfo_id
662
+ }
663
+ this.$resetpost('api/af-revenue/logic/future_createWorkFlowTask', {'data': data}
664
+ , {resolveMsg: null, rejectMsg: '新增任务失败!!'}).then(
665
+ (res) => {
666
+ this.$showAlert(res.data.msg + '请等待审批完成后去流程页面进行操作!!!', 'info', 3000)
667
+ this.addTaskModalClose()
668
+ this.addTaskModalShow = false
669
+ }
670
+ )
671
+ },
672
+ async apply () {
673
+ this.addTaskModel.f_task_name = `用户:${this.row.f_user_name},编号:${this.row.f_userinfo_code} 申请换表`
674
+ this.addTaskModel.f_userinfo_code = this.row.f_userinfo_code
675
+ this.addTaskModalShow = true
676
+ },
677
+ async confirmbefore () {
678
+ if (this.model.metermessage.f_meter_type[0] !== '机表') {
679
+ if (!this.config.hasArrearsChange && this.books.data && this.books.data.length > 0) {
680
+ if (this.books.data[0].f_whether_pay === '否') {
681
+ this.$showAlert('换表失败,该表有欠费,请到机表缴费界面进行缴费', 'warning', 3000)
682
+ this.$dispatch('button-specifies', {name: '机表收费', value: 'machine-charge'}, this.row)
683
+ } else {
684
+ this.confirm()
685
+ }
686
+ } else {
687
+ this.confirm()
688
+ }
689
+ } else {
690
+ this.confirm()
691
+ }
692
+ },
693
+ async confirm () {
694
+ let msg = ''
695
+ if (this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) {
696
+ let a = this.config.castInt ? parseInt(this.model.f_using_base_old) : this.model.f_using_base_old
697
+ let b = this.config.castInt ? parseInt(this.row.f_meter_base) : this.row.f_meter_base
698
+ if (a > b) {
699
+ msg = (this.row.f_meter_type === '机表' ? '该用户表底数大于上次抄表底数,请确定是否继续生成欠费记录' : '该用户表底数大于上次抄表底数,请确定是否进行结算')
700
+ } else if (this.row.f_capacity && this.row.f_capacity > 0 && (parseInt(this.model.f_using_base_old) < parseInt(this.row.f_meter_base))) {
701
+ msg = '该用户表底数大于上次抄表底数,且已超越最大量程,请确定是否继续生成欠费记录'
702
+ }
703
+ }
704
+ if ((this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) && msg) {
705
+ this.$showMessage(msg, ['confirm', 'cancel']).then((res) => {
706
+ if (res === 'confirm') {
707
+ debugger
708
+ let url = this.row.f_meter_type.includes('物联网表') ? 'api/af-revenue/logic/changeMeterWebHand' : 'api/af-revenue/logic/changeMeterHand'
709
+ let data = {
710
+ downDate: this.$login.toStandardTimeString(),
711
+ startDate: this.$login.toStandardDateString(),
712
+ endDate: this.$login.toStandardDateString(),
713
+ condition: `f_userfiles_id = '${this.row.f_userfiles_id}'`,
714
+ f_operator: this.$login.f.name,
715
+ f_operatorid: this.$login.f.id,
716
+ f_meternumber: this.row.f_meternumber,
717
+ f_userinfo_id: this.row.f_userinfo_id,
718
+ f_userfiles_id: this.row.f_userfiles_id,
719
+ f_serial_number: this.model.f_serial_number,
720
+ f_meterbase: this.model.f_using_base_old,
721
+ f_meter_brand: this.row.f_meter_brand,
722
+ f_meter_classify: this.row.f_meter_type,
723
+ f_price_id: this.row.f_price_id
724
+ }
725
+ this.$resetpost(url, {data: data}, {resolveMsg: '生成欠费成功', rejectMsg: '生成欠费失败'}).then((res) => {
726
+ console.log('成功')
727
+
728
+ if (this.model.metermessage.f_meter_type[0] != '机表') {
729
+ console.log('换表失败,该表已产生欠费,清欠后重新进行换表操作1!')
730
+ this.$showAlert('换表失败,该表已产生欠费,请清欠后,重新进行换表操作!', 'warning', 5000)
731
+ console.log('换表失败,该表已产生欠费,清欠后重新进行换表操作2!')
732
+ this.$dispatch('refresh')
733
+ } else {
734
+ this.saveobj()
735
+ }
736
+ })
737
+ } else {
738
+
739
+ }
740
+ })
741
+ } else {
742
+ if (this.row.f_meter_type.includes('气量卡表') && (this.model.f_using_base_old > (this.row.f_total_gas + this.row.f_initial_base + this.row.f_remanent_gas))) {
743
+ await this.$showMessage(`该表可能存在超用,请确定是否继续进行换表操作!!!,或者取消进入超用收费!`, ['confirm', 'cancel']).then((res) => {
744
+ if (res === 'confirm') {
745
+ this.saveobj()
746
+ } else {
747
+ }
748
+ })
749
+ } else {
750
+ this.saveobj()
751
+ }
752
+ }
753
+ },
754
+ async saveobj () {
755
+ try {
756
+ this.model.f_operator = this.$login.f.name
757
+ this.model.f_operatorid = this.$login.f.id
758
+ this.model.f_orgid = this.$login.f.orgid
759
+ this.model.f_orgname = this.$login.f.orgs
760
+ this.model.f_depid = this.$login.f.depids
761
+ this.model.f_depname = this.$login.f.deps
762
+ this.model.f_zoneid = this.$login.f.zoneid
763
+ this.model.f_zones = this.$login.f.zones
764
+ this.model.alldue_fee = this.alldue_fee
765
+ let data = {
766
+ model: this.model,
767
+ f_meter_book: this.newinfo.f_meter_book[0],
768
+ old: this.row
769
+ }
770
+ // 如果更新了气价
771
+ if (this.newinfo.pricename.length > 0) {
772
+ data.newinfo = this.newinfo.pricename[0].f_price_id
773
+ }
774
+ let meterinfo = await this.$resetpost('api/af-revenue/logic/changeMeter', data, {
775
+ resolveMsg: null,
776
+ rejectMsg: '换表失败!!!'
777
+ })
778
+
779
+ if (this.config.showupload) {
780
+ let param = []
781
+ for (let row of this.resid) {
782
+ param.push({id: row.id})
783
+ }
784
+ let data1 = {
785
+ param: param,
786
+ f_blobid: meterinfo.data.id
787
+ }
788
+ console.log('-------------------------->', data1)
789
+ await this.$resetpost('api/af-revenue/logic/updatefiles', data1)
790
+ }
791
+ // 赋值【新表id】
792
+ this.row.f_userfiles_id = meterinfo.data.new_userfiles_id
793
+
794
+ if (this.newinfo.pricename.length > 0) {
795
+ let param = {
796
+ f_userinfo_id: this.row.f_userinfo_id,
797
+ f_userfiles_id: this.row.f_userfiles_id,
798
+ f_user_id: this.row.f_user_id,
799
+ f_user_name: this.row.f_user_name,
800
+ f_user_type: this.newinfo.f_user_type[0],
801
+ f_gasproperties: this.newinfo.f_gasproperties[0],
802
+ f_price_type: this.newinfo.pricetype[0],
803
+ f_price_id: this.newinfo.pricename[0].f_price_id,
804
+ f_filialeid: this.$login.f.orgid,
805
+ f_operator: this.$login.f.name,
806
+ f_operatorid: this.$login.f.id,
807
+ f_orgid: this.$login.f.orgid,
808
+ f_orgname: this.$login.f.orgs,
809
+ f_depid: this.$login.f.depids,
810
+ f_depname: this.$login.f.deps,
811
+ f_perform_date: this.newinfo.f_perform_date,
812
+ f_change_reason: '换表调价'
813
+ }
814
+
815
+ await this.$resetpost('api/af-revenue/logic/user_pricechange', {data: param}, {resolveMsg: '更新气价成功', rejectMsg: '更新气价失败'})
816
+ }
817
+ // 开始打票
818
+ if (this.config.hasPrint) {
819
+ if (this.model.f_print.indexOf('电子发票') == -1) {
820
+ if (this.config.hasBillManage) {
821
+ // 启用发票管理,获取票据管理中的票号并存储记录
822
+ this.row.id = meterinfo.data.id
823
+ this.row.f_bill_type = '换表'
824
+ this.row.f_bill_style = this.model.f_print[0]
825
+ this.print = true
826
+ } else {
827
+ this.row.id = meterinfo.data.id
828
+ this.print = true
829
+ }
830
+ } else {
831
+ this.printok()
832
+ }
833
+ }
834
+
835
+ if (this.config.dispatch) {
836
+ await this.$showMessage(`是否添加派工单`, ['confirm', 'cancel']).then((res) => {
837
+ if (res === 'confirm') {
838
+ let batch = {
839
+ sf_id: meterinfo.data.id,
840
+ f_userinfo_code: this.row.f_userinfo_code,
841
+ f_dispathch_name: this.row.f_user_name,
842
+ f_phone: this.row.f_user_phone,
843
+ f_dispathch_address: this.row.f_address,
844
+ f_dispathch_type: '安装',
845
+ f_source: '换表',
846
+ f_remarks: this.model.f_comments,
847
+ f_operator_date: this.$login.toStandardTimeString(),
848
+ f_orgid: this.$login.f.orgid,
849
+ f_dispathch_state: '待分配'
850
+ }
851
+ console.log('111:', batch)
852
+ this.$resetpost('api/af-revenue/logic/savePatch', batch).then((res1) => {
853
+ // this.params.rows.splice(index, 1)
854
+ console.log('更新成功!--------------------->', res1.data.id)
855
+ })
856
+ }
857
+ })
858
+ }
859
+ if (this.config.approve) {
860
+ await this.$dispatch('futureapply', meterinfo)
861
+ } else {
862
+ this.printok()
863
+ }
864
+ } catch (error) {
865
+ console.log('抛出的错误。。', error)
866
+ let res = error.data.toString()
867
+ this.$showAlert(res, 'danger', 2000)
868
+ this.$dispatch('refresh')
869
+ }
870
+ },
871
+ async pregasChange () {
872
+ if (parseInt(this.model.f_using_base_old) < parseInt(this.row.f_meter_base)) {
873
+ await this.$showMessage(`录入旧表底数小于系统旧表底数请再次核对!`, ['confirm', 'cancel']).then((res) => {
874
+ if (res === 'confirm') {
875
+ } else {
876
+ this.model.f_using_base_old = ''
877
+ }
878
+ })
879
+ }
880
+ this.commitflag = false
881
+ // 每种表对应的计算方式都不一样
882
+ if (this.row.f_meter_type == '气量卡表') {
883
+ this.calGasCardRemanent()
884
+ } else if (this.row.f_meter_type == '金额卡表') {
885
+ // this.$showAlert('金额卡表换表尚在开发中,敬请期待!!', 'warning', 5000)
886
+ // this.$dispatch('refresh')
887
+ this.calMoneyCardRemanent()
888
+ } else if (this.row.f_meter_type == '物联网表') {
889
+ this.Iotjisuan()
890
+ }
891
+ let msg = ''
892
+ if (this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) {
893
+ let a = this.config.castInt ? parseInt(this.model.f_using_base_old) : this.model.f_using_base_old
894
+ let b = this.config.castInt ? parseInt(this.row.f_meter_base) : this.row.f_meter_base
895
+ if (a > b) {
896
+ msg = (this.row.f_meter_type === '机表' ? '该用户表底数大于上次抄表底数,请确定是否继续生成欠费记录' : '该用户表底数大于上次抄表底数,请确定是否进行结算')
897
+ } else if (this.row.f_capacity && this.row.f_capacity > 0 && (parseInt(this.model.f_using_base_old) < parseInt(this.row.f_meter_base))) {
898
+ msg = '该用户表底数大于上次抄表底数,且已超越最大量程,请确定是否继续生成欠费记录'
899
+ }
900
+ }
901
+ if ((this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) && msg) {
902
+ this.$showMessage(msg, ['confirm', 'cancel']).then((res) => {
903
+ if (res === 'confirm') {
904
+ let url = this.row.f_meter_type.includes('物联网表') ? 'api/af-revenue/logic/changeMeterWebHand' : 'api/af-revenue/logic/changeMeterHand'
905
+ let data = {
906
+ downDate: this.$login.toStandardTimeString(),
907
+ startDate: this.$login.toStandardDateString(),
908
+ endDate: this.$login.toStandardDateString(),
909
+ condition: `f_userfiles_id = '${this.row.f_userfiles_id}'`,
910
+ f_operator: this.$login.f.name,
911
+ f_operatorid: this.$login.f.id,
912
+ f_meternumber: this.row.f_meternumber,
913
+ f_userinfo_id: this.row.f_userinfo_id,
914
+ f_userfiles_id: this.row.f_userfiles_id,
915
+ f_serial_number: this.model.f_serial_number,
916
+ f_meterbase: this.model.f_using_base_old,
917
+ f_meter_brand: this.row.f_meter_brand,
918
+ f_meter_classify: this.row.f_meter_type,
919
+ f_price_id: this.row.f_price_id
920
+ }
921
+ this.$resetpost(url, {data: data}, {resolveMsg: '生成欠费成功', rejectMsg: '生成欠费失败'}).then((res) => {
922
+ console.log('成功')
923
+ if (this.row.f_meter_type.includes('物联网表')) {
924
+ console.log('换表失败,该表已产生欠费,清欠后重新进行换表操作1!')
925
+ this.$showAlert('换表失败,该表已产生欠费,请清欠后,重新进行换表操作!', 'warning', 5000)
926
+ console.log('换表失败,该表已产生欠费,清欠后重新进行换表操作2!')
927
+ this.$dispatch('refresh')
928
+ } else {
929
+ this.$dispatch('resflushrowdata')
930
+ // this.$dispatch('button-specifies', {name: '机表收费', value: 'machine-charge'}, this.row)
931
+ }
932
+ })
933
+ }
934
+ })
935
+ }
936
+ },
937
+ async Iotjisuan () {
938
+ let gas = (this.model.f_using_base_old - 0) - (this.row.f_meter_base - 0)
939
+ let getAmount = await this.$CommonService.gasCalculate(this.row, gas)
940
+ let money = getAmount.data.chargenum
941
+ },
942
+ typeChange () {
943
+ if (this.model.f_type && this.model.f_type.includes('清零')) {
944
+ let oldMeter = {
945
+ f_meter_type: this.row.f_meter_type,
946
+ f_collection_type: this.row.f_collection_type
947
+ }
948
+ let newMeter = {
949
+ f_meter_type: this.row.f_meter_type,
950
+ f_collection_type: this.row.f_collection_type
951
+ }
952
+ let res = this.$ChangeMeter.changeMeter(oldMeter, newMeter, this.row)
953
+ console.log('看看新旧表的转换结果', res)
954
+ this.changeType = res.name
955
+ } else {
956
+ this.changeType = ''
957
+ }
958
+ },
959
+
960
+ initData () {
961
+ this.commitflag = false
962
+ if (this.row.f_meter_type == '物联网表') {
963
+ // 判断是否需要结算
964
+ if (this.row.f_collection_type == '按气量') {
965
+ this.calGasIOTRemanent()
966
+ } else {
967
+ this.calMoneyIOTRemanent()
968
+ }
969
+ } else if (this.row.f_meter_type == '机表') {
970
+ this.validateOwe()
971
+ } else {
972
+ this.pregasChange()
973
+ }
974
+ },
975
+
976
+ calGasCardRemanent () {
977
+ // 拿到旧表底数 和【累计购气量+初始底数】比较 这里剩余气量如果是清零补气的就不加,如果是换表补气的就加
978
+ let param = this.row.f_total_gas + this.row.f_initial_base
979
+
980
+ if (this.row.f_remanent_type == 1) {
981
+ param += this.row.f_remanent_gas
982
+ }
983
+
984
+ if (this.model.f_using_base_old > param) {
985
+ this.$showAlert('该表可能存在超用,请核实输入后进行换表操作!!', 'warning', 5000)
986
+ this.$dispatch('refresh')
987
+ }
988
+ if (this.model.f_remanent_price > 0) {
989
+ this.model.f_remanent_gas = (param - (this.model.f_using_base_old - 0)).toFixed(4)
990
+ }
991
+ },
992
+
993
+ calMoneyCardRemanent () {
994
+ if (!this.model.f_remanent_money) {
995
+ this.model.f_remanent_money = ''
996
+ }
997
+ },
998
+
999
+ calGasIOTRemanent () {
1000
+ this.model.f_remanent_gas = (this.row.f_balance_gas - 0)
1001
+ if (this.row.f_remanent_type == 1) {
1002
+ this.model.f_remanent_gas += (this.row.f_remanent_gas - 0)
1003
+ }
1004
+ },
1005
+ calMoneyIOTRemanent () {
1006
+ this.model.f_remanent_money = (this.row.f_balance_amount - 0).toFixed(4)
1007
+ if (this.row.f_remanent_type == 1) {
1008
+ if (this.row.f_remanent_gas > 0) {
1009
+ this.model.f_remanent_money = (this.model.f_remanent_money - 0) + ((this.row.f_remanent_gas - 0) * (this.row.f_remanent_price - 0)).toFixed(4)
1010
+ } else if (this.row.f_remanent_money > 0) {
1011
+ this.model.f_remanent_money = (this.model.f_remanent_money - 0) + (this.row.f_remanent_money - 0)
1012
+ }
1013
+ }
1014
+ },
1015
+
1016
+ gasModelChange (val) {
1017
+ console.log('新表信息', val)
1018
+ if (val.length > 0) {
1019
+ this.commitflag = false
1020
+ // 新气表信息已选
1021
+ let oldMeter = {
1022
+ f_meter_type: this.row.f_meter_type,
1023
+ f_collection_type: this.row.f_collection_type
1024
+ }
1025
+ let newMeter = {
1026
+ f_meter_type: val[0].f_meter_type,
1027
+ f_collection_type: val[0].f_collection_type
1028
+ }
1029
+ let res = this.$ChangeMeter.changeMeter(oldMeter, newMeter, this.row)
1030
+ console.log('看看新旧表的转换结果', res)
1031
+ this.changeType = res.name
1032
+ /* if (this.addbalance) {
1033
+ this.addbalance = false
1034
+ this.model.f_remanent_money = (this.model.f_remanent_money - 0) - (this.row.f_balance - 0)
1035
+ }
1036
+ if (this.addgas) {
1037
+ this.addgas = false
1038
+ this.model.f_remanent_gas = (this.model.f_remanent_gas - 0) - (this.addgasnum - 0)
1039
+ this.addgasnum = 0
1040
+ }
1041
+ if (newMeter.f_meter_type == '物联网表' && newMeter.f_collection_type == '按金额' && (!this.addbalance)) {
1042
+ this.addbalance = true
1043
+ this.model.f_remanent_money = this.model.f_remanent_money ? (this.model.f_remanent_money - 0) + (this.row.f_balance - 0) : (this.row.f_balance - 0)
1044
+ if (!this.isGas) {
1045
+ this.addgas = true
1046
+ }
1047
+ }
1048
+ if (newMeter.f_meter_type == '物联网表' && newMeter.f_collection_type == '按气量' && (!this.addgas)) {
1049
+ this.addgas = true
1050
+ debugger
1051
+ this.addgasnum = ((this.row.f_balance - 0) / this.model.f_remanent_price).toFixed(4)
1052
+ this.model.f_remanent_gas = this.model.f_remanent_gas ? (this.model.f_remanent_gas - 0) + (this.addgasnum - 0) : this.addgasnum
1053
+ if (!this.isGas) {
1054
+ this.addbalance = true
1055
+ this.model.f_remanent_money = this.model.f_remanent_money ? (this.model.f_remanent_money - 0) + (this.row.f_balance - 0) : (this.row.f_balance - 0)
1056
+ }
1057
+ } */
1058
+ }
1059
+ },
1060
+
1061
+ remanentChange () {
1062
+ this.commitflag = true
1063
+ // 气量转金额 或者 金额转气量的时候对气量和金额不做限制, 可以修改, 但是只变单价
1064
+ this.model.f_remanent_price = ((this.model.f_remanent_money) / (this.model.f_remanent_gas)).toFixed(4)
1065
+ if (this.model.f_remanent_price == 'NaN') {
1066
+ this.model.f_remanent_price = 0
1067
+ }
1068
+ },
1069
+
1070
+ async validateOwe () {
1071
+ let http = new HttpResetClass()
1072
+ // 有欠费是否能换表 如果能则需要获取到欠费金额
1073
+ if (this.config.hasArrearsChange) {
1074
+ let res = await http.load('POST', 'api/af-revenue/logic/sale_getOwe', {data: {f_userinfo_id: this.row.f_userinfo_id}}, {resolveMsg: null, rejectMsg: '获取欠费出错!!'})
1075
+ let owes = []
1076
+ for (let i = 0; i < res.data.length; i++) {
1077
+ for (let j = 0; j < res.data[i].rows.length; j++) {
1078
+ owes.push(res.data[i].rows[j])
1079
+ }
1080
+ }
1081
+ console.log('获取到的欠费记录', owes)
1082
+ this.alldue_fee = owes.reduce((total, item) => {
1083
+ return total + (item.f_oughtfee + item.overdue - item.f_debt_money)
1084
+ }, 0)
1085
+ console.log('总欠费金额为', this.alldue_fee)
1086
+ this.books = owes
1087
+ } else {
1088
+ // 如果 不能 则只需要获取到记录数,采用相对节省资源的查询
1089
+ let books = await http.load('POST', 'api/af-revenue/sql/singleTable_OrderBy', {
1090
+ data: {
1091
+ items: 'f_whether_pay',
1092
+ tablename: 't_handplan',
1093
+ condition: ` f_user_id = '${this.row.f_user_id}' and f_oughtfee > 0 and f_hand_state = '有效' and f_meter_state='已抄表' `,
1094
+ orderitem: ' id desc'
1095
+ }
1096
+ }, {resolveMsg: null, rejectMsg: null}
1097
+ )
1098
+ console.log('获取到的欠费记录', books)
1099
+ this.books = books
1100
+ // 如果是机表验证是否有欠费
1101
+ if ((this.row.f_balance - 0) < 0) {
1102
+ this.$showAlert('该表有欠费,请到机表缴费界面进行缴费', 'warning', 3000)
1103
+ this.$dispatch('button-specifies', {name: '机表收费', value: 'machine-charge'}, this.row)
1104
+ }
1105
+ }
1106
+ }
1107
+ },
1108
+
1109
+ watch: {
1110
+ 'model.metermessage.f_meter_type' (val) {
1111
+ if (val && val.length > 0) {
1112
+ if (this.row.f_meter_type.includes('卡表') && val[0] === '物联网表') {
1113
+ if ((this.stairInfo.f_stair1surplus - 0) === 0) {
1114
+ this.$showMessage('该用户本气价周期购气已跨阶', ['confirm'])
1115
+ }
1116
+ }
1117
+ }
1118
+ },
1119
+ 'row' () {
1120
+ console.log('-------------------------------')
1121
+ console.log(this.row)
1122
+ },
1123
+ 'model.f_remanent_money' (val) {
1124
+ console.log('观察补气金额', val)
1125
+ if (!this.isGas) {
1126
+ this.model.f_remanent_gas = (val / this.model.f_remanent_price).toFixed(4)
1127
+ }
1128
+ if (this.model.f_using_base_old) {
1129
+ this.commitflag = true
1130
+ }
1131
+ },
1132
+ 'model.f_remanent_gas' (val) {
1133
+ if (this.isGas) {
1134
+ this.model.f_remanent_money = (val * this.model.f_remanent_price).toFixed(4)
1135
+ }
1136
+ if (this.model.f_using_base_old) {
1137
+ this.commitflag = true
1138
+ }
1139
+ },
1140
+ 'dataModel' (val) {
1141
+ console.log('看看dataModel的值:', val)
1142
+ if (val) {
1143
+ this.$nextTick(() => {
1144
+ this.model = Object.assign({}, this.model, val)
1145
+ this.resid = this.model.filesids
1146
+ })
1147
+ }
1148
+ console.log('看看this.model的值:', this.model)
1149
+ },
1150
+ 'newinfoData' (val) {
1151
+ console.log('看看newinfoData的值:', val)
1152
+ if (val) {
1153
+ this.$nextTick(() => {
1154
+ this.newinfo = Object.assign({}, this.newinfo, val)
1155
+ })
1156
+ }
1157
+ console.log('看看this.newinfo的值:', this.newinfo)
1158
+ }
1159
+ }
1160
+ }
1161
+ </script>
1162
+ <style lang="less">
1163
+ #ChangeMeter {
1164
+ .col-sm-4 {
1165
+ .font_normal_body {
1166
+ width: 73px;
1167
+ overflow: auto;
1168
+ white-space: nowrap;
1169
+ // 指滚动条两边的按钮
1170
+ &::-webkit-scrollbar-button {
1171
+ display: none;
1172
+ }
1173
+ // 滚动条的宽度
1174
+ &::-webkit-scrollbar {
1175
+ width: 5px !important;
1176
+ height: 5px !important;
1177
+ }
1178
+ // 滚动条的设置
1179
+ &::-webkit-scrollbar-thumb {
1180
+ background-color: #ddd;
1181
+ background-clip: padding-box;
1182
+ }
1183
+ &::-webkit-scrollbar-thumb:hover {
1184
+ background-color: #bbb;
1185
+ }
1186
+ &::-webkit-scrollbar-track {
1187
+ /*滚动条里面轨道*/
1188
+ box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
1189
+ background: #ededed;
1190
+ }
1191
+ }
1192
+ }
1193
+ }
1194
+ </style>