sale-client 4.2.131 → 4.2.133

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.
@@ -1,1351 +1,1351 @@
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" @gasbrand="gasBrandChange" 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
- @blur="remanentChange"
59
- v-validate:f_remanent_gas='{required: true, dctest: [-1, ">" ] }'>
60
- </div>
61
- <div class="col-sm-4 form-group">
62
- <label class=" font_normal_body">补气单价</label>
63
- <input class="input_search" style="width:60%" type="number"
64
- v-model="model.f_remanent_price"
65
- placeholder="补气单价" readonly>
66
- </div>
67
- <div class="col-sm-4 form-group"
68
- :class="[$v.f_remanent_money.required || $v.f_remanent_money.dctest ? 'has-error' : 'has-success']">
69
- <label for="f_remanent_money" class=" font_normal_body">补气金额</label>
70
- <input class="input_search" style="width:60%" type="number"
71
- v-model="model.f_remanent_money"
72
- placeholder="补气金额"
73
- @blur="remanentChange"
74
- v-validate:f_remanent_money='{required: true, dctest: [-1, ">" ] }'>
75
- </div>
76
- </div>
77
- <div class="row auto" v-if="changeType == 'gasToGas'">
78
- <!-- 气量转气量 -->
79
- <div class="col-sm-4 form-group"
80
- :class="[$v.f_remanent_gas.required || $v.f_remanent_gas.dctest ? 'has-error' : 'has-success']">
81
- <label for="f_remanent_gas" class=" font_normal_body">补&ensp;气&ensp;量</label>
82
- <input class="input_search" style="width:60%" type="number"
83
- v-model="model.f_remanent_gas"
84
- placeholder="补气量"
85
- v-validate:f_remanent_gas='{required: true, dctest: [-1, ">" ] }'>
86
- </div>
87
- </div>
88
-
89
- <div class="row auto" v-if="changeType == 'amountToAmount'">
90
- <!-- 金额转金额 -->
91
- <div class="col-sm-4 form-group"
92
- :class="[$v.f_remanent_money.required || $v.f_remanent_money.dctest ? 'has-error' : 'has-success']">
93
- <label for="f_remanent_money" class=" font_normal_body">补气金额</label>
94
- <input class="input_search" style="width:60%" type="number"
95
- v-model="model.f_remanent_money"
96
- placeholder="补气金额"
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" v-model="newinfo.f_meter_book"
204
- placeholder='新抄表册' :options="meterbookoptions"
205
- close-on-select></v-select>
206
- </div>
207
-
208
- </div>
209
- <div class="row auto" v-if="!model.f_type.includes('换卡控流量计')">
210
- <div class="col-sm-4 ">
211
- <label for="f_comments" class=" font_normal_body">业务单号</label>
212
- <input class="input_search" style="width:60%" type="text"
213
- v-model="model.f_serial_number" placeholder="业务单号">
214
- </div>
215
- <div class="col-sm-4 ">
216
- <label class=" font_normal_body">阶梯累计</label>
217
- <v-select id="f_ladder_sync"
218
- v-model="f_payment"
219
- placeholder='是否累计'
220
- :search="false"
221
- :value-single="true"
222
- :value.sync="model.f_ladder_sync"
223
- :options='ladder'
224
- close-on-select clear-button></v-select>
225
- </div>
226
- <div class="col-sm-4"
227
- :class="[$v.f_stair_use.required || $v.f_stair_use.dctest ? 'has-error' : 'has-success']"
228
- v-if="row.f_meter_type.includes('卡表') && model.metermessage.gasbrand[0].f_meter_type ==='物联网表'&& model.f_ladder_sync !=='不同步'">
229
- <label class=" font_normal_body">阶梯用量</label>
230
- <input class="input_search" style="width:60%" type="number"
231
- v-validate:f_stair_use='{required: true, dctest: [0, ">=" ] }'
232
- v-model="model.f_stair_use" placeholder="旧表阶梯使用量">
233
- </div>
234
- <div class="col-sm-4 "
235
- v-if="(model.metermessage.gasbrand[0].f_meter_type ==='物联网表' && model.metermessage.gasbrand[0].f_hascard ==='是')
236
- || (model.f_type.includes('清零') && row.f_meter_type ==='物联网表' && row.f_hascard ==='是')">
237
- <label class=" font_normal_body">开户方式</label>
238
- <v-select id="f_open_type"
239
- v-model="f_payment"
240
- placeholder='开户方式'
241
- :search="false"
242
- :value-single="true"
243
- :value.sync="model.f_open_type"
244
- :options='opentype'
245
- close-on-select clear-button></v-select>
246
- </div>
247
- <div v-if="config.aroundmeter" class="col-sm-4 form-group" :class="[$v.f_newaroundmeter.required ? 'has-error' : '']">
248
- <label class="font_normal_body">新表表向</label>
249
- <v-select :value.sync="model.f_newaroundmeter" :options='aroundmeters' placeholder='新表表向'
250
- :value-single="true"
251
- close-on-select
252
- v-model='model.f_newaroundmeter'></v-select>
253
- </div>
254
- </div>
255
- <div cl="row auto">
256
- <div class="col-sm-4" :class="[$v.f_changetables_reason.required ? 'has-error' : '']">
257
- <label for="f_changetables_reason" class=" font_normal_body" >换表原因</label>
258
- <input type="text" class="input_search" style="width: 60%" v-show="false" v-model="$refs.f_changetables_reason.selectedItems" v-validate:f_changetables_reason='{required: true }'>
259
- <v-select id="f_changetables_reason"
260
- v-model="model.f_changetables_reason"
261
- :value-single="true"
262
- placeholder='换表原因'
263
- :value.sync="model.f_changetables_reason"
264
- :options='reason'
265
- v-ref:f_changetables_reason
266
- close-on-select></v-select>
267
- </div>
268
- <div class="row" style="margin-top:10px;" v-if="model.f_changetables_reason ==='其他'">
269
- <div class="col-sm-12" :class="[$v.f_othereason.required ? 'has-error' : 'has-success']">
270
- <label class="font_normal_body ">其他原因</label>
271
- <textarea class="input_textarea" rows="3" style="width:87%;" v-model="model.f_othereason"
272
- v-validate:f_othereason='{required: true}'
273
- ></textarea>
274
- </div>
275
- </div>
276
- </div>
277
- <div class="row auto">
278
- <div class="col-sm-12"
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"></textarea>
283
- </div>
284
- <div class="col-sm-12"
285
- :class="[$v.f_comments.required ? 'has-error' : 'has-success']"
286
- v-if="commitflag"
287
- >
288
- <label class="font_normal_body ">备&emsp;&emsp;注</label>
289
- <textarea class="input_textarea" rows="3" style="width:87%;" v-model="model.f_comments"
290
- v-validate:f_comments='{required: true}'
291
- ></textarea>
292
- </div>
293
- </div>
294
-
295
- <!-- <div class="col-sm-12" v-if="config.changeReason">-->
296
- <!-- <label class="font_normal_body ">换表原因</label>-->
297
- <!-- <textarea class="input_textarea" rows="3" style="width:87%;" v-model="model.f_changetables_reason"></textarea>-->
298
- <!-- </div>-->
299
- <div style="text-align:right;height:auto;">
300
- <button class="button_search" v-show="config.approve == true ? applyButtonShow : false" type="button" @click="apply()"
301
- :disabled="(!meterinfo && !(model.f_type.includes('清零') || model.f_type.includes('换卡控流量计'))) || !$v.valid"
302
- >换表审核
303
- </button>
304
- <button class="button_search" v-show="config.approve == true ? !applyButtonShow : true" type="button" @click="confirmbefore()"
305
- :disabled="(!meterinfo && !(model.f_type.includes('清零') ||
306
- model.f_type.includes('换卡控流量计'))) || !$v.valid"
307
- >确认
308
- </button>
309
- <button class="button_clear" v-show="applyButtonShow" type="button" @click="clean()">取消
310
- </button>
311
- </div>
312
- </form>
313
- <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
314
- <print-bill :show="print" :bill-config='config' :bill-data='billData' v-ref:printbill @toggle="close" :data='row' @printok="printok" ></print-bill>
315
- </validator>
316
- <modal :show.sync="addTaskModalShow" backdrop="false" width="40%" title="创建任务" small="true" @modal-close="addTaskModalClose()">
317
- <article slot="modal-body" class="row" style="padding: 10px">
318
- <add-apply-task :applytaskobj.sync="addTaskModel" @valid="addTaskValid = true" @invalid="addTaskValid = false">
319
- </add-apply-task>
320
- </article>
321
- <footer slot="modal-footer" class="modal-footer" style="text-align: right;border: 0">
322
- <button class="btn button_search" @click="addTask()"
323
- :disabled="!addTaskValid">新增审核任务
324
- </button>
325
- </footer>
326
- </modal>
327
- </div>
328
- <upload v-if="config.showupload" :blodid="row.f_userinfo_id" :businessid="model.randomBusinessId" isremark="true" fusetype="换表&清零"></upload>
329
- </template>
330
- <script>
331
- /**
332
- *换表管理
333
- *组合界面,加载机表,物联网表,气量卡表,金额卡表旧表信息,以及控制显示换新表信息
334
- */
335
- import { HttpResetClass } from 'vue-client'
336
- let getPrice = async function (self) {
337
- await self.$LoadParams.loadParam(self.$login.f.orgid)
338
- await self.$getConfig(self, 'ChangeMeter')
339
-
340
- self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
341
- self.model.f_payment = self.config.payment
342
- self.model.f_ladder_sync = self.config.ladderSync
343
- self.mulPrint = self.config.printType instanceof Array
344
- self.model.f_use_type = self.config.billType
345
- self.model.f_bill_type = self.model.f_print
346
- self.hasValidateBill = self.config.hasBillManage
347
-
348
- self.model.f_open_type = self.config.open_way
349
- self.isGas = (self.row.f_collection_type == '按气量')
350
-
351
- let http = new HttpResetClass()
352
- let param = {
353
- tablename: 't_detailprice',
354
- condition: `f_price_name = '1' and f_stairprice_id = '${self.row.f_stairprice_id}'`
355
- }
356
- let res = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
357
- data: param
358
- }, {
359
- resolveMsg: null,
360
- rejectMsg: '获取一阶单价!!'
361
- })
362
- if (res.data.length > 0) {
363
- self.model.f_remanent_price = res.data[0].f_price
364
- }
365
- let http2 = new HttpResetClass()
366
- let chargeData = {
367
- tablename: 't_chargeprice',
368
- items: 'f_gas,f_money,f_price',
369
- condition: `f_userfiles_id = '${self.row.f_userfiles_id}' and f_state = '有效'`,
370
- orderitem: 'f_operate_date desc'
371
- }
372
- let chargePrice = await http2.load('POST', 'api/af-revenue/sql/singleTable_OrderBy', {
373
- data: chargeData
374
- }, {
375
- resolveMsg: null,
376
- rejectMsg: '获取划价记录失败!!'
377
- })
378
- if (chargePrice.data.length > 0) {
379
- self.chargePrices = chargePrice.data
380
- }
381
- let temp = {
382
- tablename: 't_meter_book',
383
- condition: `f_book_state='有效' and f_filiale_id='${self.$login.f.orgid}'`
384
- }
385
- let meterbooks = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {data: temp},
386
- {resolveMsg: null, rejectMsg: '获取抄表册信息失败!!'})
387
- if (meterbooks.data.length > 0) {
388
- let options = []
389
- for (let i = 0; i < meterbooks.data.length; i++) {
390
- let tmp = {label: meterbooks.data[i].f_book_name, value: `${meterbooks.data[i].id}`}
391
- options.push(tmp)
392
- }
393
- self.meterbookoptions = options
394
- }
395
- if (self.row.f_price_type === '固定气价') {
396
- self.model.f_stair_use = 0
397
- } else {
398
- let a = await http.load('POST', 'api/af-revenue/logic/getStairUse', {data: self.row}, {resolveMsg: null, rejectMsg: '获取阶梯使用情况出错'})
399
- console.log(a.data)
400
- self.model.f_stair_use = a.data
401
- }
402
- self.newinfo.pricetype = [self.row.f_price_type]
403
- let params = {
404
- f_user_type: self.row.f_user_type,
405
- f_gasproperties: self.row.f_gasproperties,
406
- f_price_type: self.row.f_price_type,
407
- filter: self.$login.f.orgid
408
- }
409
- let rs = self.$GetSaleParam.getPrice(params)
410
- rs.forEach((val) => {
411
- if (val.label == self.row.f_price_name) {
412
- self.newinfo.pricename = [val.value]
413
- }
414
- })
415
- self.initData()
416
- }
417
- export default {
418
- title: '换表登记',
419
- data () {
420
- return {
421
- resid: [], // 存放新增的f_files表中id
422
- model: {
423
- f_flowmeter_number: '',
424
- f_flowmeter_pass: '',
425
- f_flowmeter_brand: '',
426
- f_flowmeter_model: '',
427
- f_flowmeter_accuracy: '',
428
- f_flowmeter_mpa_level: '',
429
- f_flowmeter_install_date: this.$login.toStandardTimeString(),
430
- metermessage: {
431
- f_meter_type: '',
432
- gasbrand: '',
433
- gasmodel: '',
434
- f_meternumber: '',
435
- f_meter_base: '',
436
- f_metertitles: '',
437
- f_oldmeter_use_reference: 0 // 旧表使用量参考值
438
- },
439
- // 旧表底数
440
- f_ladder_sync: '',
441
- f_using_base_old: '',
442
- // 换表补气量
443
- f_remanent_gas: 0,
444
- // 换表补气单价
445
- f_remanent_price: 0,
446
- f_open_type: '',
447
- f_remanent_money: 0,
448
- f_type: '换新表',
449
- f_comments: '',
450
- f_othereason: '',
451
- f_stair_use: '',
452
- f_payment: '现金缴费',
453
- f_print: '普通收据',
454
- f_state: '有效',
455
- f_changemeter_date: this.$login.toStandardTimeString(),
456
- f_changemeter_fee: this.$appdata.getSingleValue('换表金额') ? this.$appdata.getSingleValue('换表金额') : 0,
457
- f_difference_reason: '',
458
- // 金额表剩余金额
459
- f_using_fee_old: 0,
460
- randomBusinessId: ''
461
- },
462
- chargePrices: [],
463
- meterinfo: false,
464
-
465
- meterbookoptions: [],
466
- // 控制气量和金额的转换显示
467
- changeType: '',
468
- config: {
469
- hasPrint: false, // 默认打票
470
- hasBillManage: false, // 默认不启用发票管理
471
- billType: '其他费用', // 票据类型(燃气费,其他费用,调用的发票代码不同)
472
- printType: '普通收据', // 收据/电子票/专用发票/国税发票
473
- payment: '现金缴费',
474
- ladderSync: '同步',
475
- open_way: '指令开户',
476
- hasArrearsChange: false, // 是否可以有欠费换表
477
- f_change_operator: false, // 换表人是否必填
478
- castInt: true,
479
- aroundmeter: false, // 表向
480
- changeReason: false, // 换表原因
481
- dispatch: false, // 是否派工
482
- showupload: true, //
483
- approve: false // 是否开启审核
484
- },
485
- print: false,
486
- // 启用发票管理需要对票号进行验证
487
- hasValidateBill: false,
488
- validateOk: false,
489
- billData: {
490
- url: 'api/af-revenue/report/change_meter',
491
- bill: ''
492
- },
493
- // 控制气量金额的编辑
494
- isGas: false,
495
- replacewatchtype: this.$appdata.getParam('换表类型'),
496
- reason: this.$appdata.getParam('换表原因') ? this.$appdata.getParam('换表原因') : [],
497
- paytype: this.$appdata.getParam('付款方式'),
498
- printstyle: this.$appdata.getParam('打印格式'),
499
- gasproperties: [],
500
- addgasnum: 0,
501
- addgas: false,
502
- books: {
503
- data: []
504
- },
505
- addbalance: false,
506
- newinfo: {
507
- f_user_type: '',
508
- f_gasproperties: '',
509
- pricetype: '',
510
- pricename: '',
511
- f_perform_date: this.$login.toStandardDateString() + ' 00:00:00' // 操作时间
512
- },
513
- ladder: [{label: '累计', value: '同步'}, {label: '不累计', value: '不同步'}],
514
- opentype: [{label: '指令开户', value: '指令开户'}, {label: '发卡开户', value: '发卡开户'}],
515
- usertypes: this.$appdata.getParam('用户类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')] : [],
516
- pricetypes: this.$appdata.getParam('气价类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('气价类型')] : [],
517
- addTaskModel: {
518
- f_task_name: '',
519
- f_userinfo_code: '',
520
- f_work_flow_name: '',
521
- f_approval: '',
522
- f_memorandum: ''
523
- },
524
- addTaskValid: false,
525
- addTaskModalShow: false,
526
- commitflag: false,
527
- // 总欠费金额
528
- alldue_fee: 0
529
- }
530
- },
531
- props: {
532
- row: {
533
- type: Object,
534
- default: undefined
535
- },
536
- applyButtonShow: {
537
- type: Boolean,
538
- default: true
539
- },
540
- dataModel: {
541
- type: Object,
542
- default: undefined
543
- }
544
- },
545
- ready () {
546
- // 重写 toFixed 方法,实现四舍五入
547
- Number.prototype.toFixed = function(digits) {
548
- const num = this
549
- const multiplier = Math.pow(10, digits)
550
- const rounded = Math.round(num * multiplier) / multiplier
551
- return rounded.toString()
552
- }
553
- getPrice(this)
554
- this.getRandomId()
555
- },
556
- events: {
557
- // 删除Resid数组元素
558
- 'delResid' (val) {
559
- this.resid.$remove({id: val, f_biobid: ''})
560
- // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
561
- },
562
- // 增加Resid数组元素
563
- 'resid' (val) {
564
- this.resid.push({id: val, f_biobid: ''})
565
- }
566
- },
567
- computed: {
568
- aroundmeters () {
569
- return this.$appdata.getParam('左右表')
570
- },
571
- flowmeterbrands () {
572
- let gasbrand = this.$GetSaleParam.getGasbrand()
573
- let flowmeterbrands = []
574
- for (let row of gasbrand) {
575
- flowmeterbrands.push({label: row.label, value: row.label})
576
- }
577
- return flowmeterbrands
578
- }
579
- },
580
- methods: {
581
- getRandomId () {
582
- this.model.randomBusinessId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
583
- let res = Math.random() * 16 | 0
584
- let v = c == 'x' ? res : (res & 0x3 | 0x8)
585
- return v.toString(16)
586
- })
587
- },
588
- feeOldChange () {
589
- if (this.model.f_using_fee_old) {
590
- this.model.f_remanent_money = this.model.f_using_fee_old
591
- }
592
- },
593
- addTaskModalClose () {
594
- this.addTaskModel.f_work_flow_name = ''
595
- this.addTaskModel.f_task_name = ''
596
- this.addTaskModel.f_userinfo_code = ''
597
- this.addTaskModel.f_approval = ''
598
- this.addTaskModel.f_memorandum = ''
599
- },
600
- validateBill (val) {
601
- this.validateOk = !val.isOk
602
- this.billData.bill = val.bill
603
- },
604
- close () {
605
- this.print = false
606
- this.printok()
607
- },
608
- async printok () {
609
- let msg = await this.$showMessage('已成功换表,是否进入补气或购气界面', ['confirm', 'cancel'])
610
- if (msg == 'confirm') {
611
- this.$dispatch('get-new-row', this.row)
612
- } else {
613
- this.$dispatch('success')
614
- }
615
- },
616
- flowmetermodels (label) {
617
- let gasbrand = this.$GetSaleParam.getGasbrand()
618
- let flowmetermodels = []
619
- for (let row of gasbrand) {
620
- if (row.label == label) {
621
- for (let gasmodel of row.value.gasmodel) {
622
- flowmetermodels.push({label: gasmodel.label, value: gasmodel.label})
623
- }
624
- break
625
- }
626
- }
627
- return flowmetermodels
628
- },
629
- getPricenames () {
630
- console.log('气价。,。。', this.newinfo.pricetype)
631
- let rs = []
632
- if (this.row.f_user_type && this.row.f_gasproperties && this.newinfo.pricetype.length === 1) {
633
- let params = {
634
- f_user_type: this.row.f_user_type,
635
- f_gasproperties: this.row.f_gasproperties,
636
- f_price_type: this.newinfo.pricetype[0],
637
- filter: this.$login.f.orgid
638
- }
639
- rs = this.$GetSaleParam.getPrice(params)
640
- }
641
- if (rs.length === 0) {
642
- this.newinfo.f_price_name = ''
643
- }
644
- return rs
645
- },
646
- userTypeChange () {
647
- this.gasproperties = []
648
- if (this.newinfo.f_user_type.length === 1) {
649
- this.gasproperties = this.$appdata.getParam(this.newinfo.f_user_type[0])
650
- }
651
- },
652
- // 返回
653
- clean () {
654
- this.$dispatch('success', '换表', this.row)
655
- },
656
- // 卡表换表时,保存一条抄表记录(可传入旧表快照,默认用当前 row)
657
- async saveCardHandRecord (oldRow) {
658
- // 没有录入旧表底数则不保存
659
- if (!this.model.f_using_base_old) {
660
- return
661
- }
662
- const row = oldRow || this.row
663
- const data = {
664
- f_tablebase: Number(this.model.f_using_base_old), // 本期底数
665
- // 上期底数(当前档案中的底数即上次抄表底数)
666
- f_last_tablebase: row.f_meter_base,
667
- f_operator: this.$login.f.name,
668
- f_filiale: this.$login.f.f_fengongsi,
669
- f_outlets: this.$login.f.f_parentname,
670
- f_meter_state: '已抄表',
671
- f_hand_state: '有效',
672
- f_meter_source: '换表结算抄表',
673
- f_input_date: this.$login.toStandardTimeString(),
674
- f_last_input_date: row.f_last_input_date ? row.f_last_input_date : this.$login.toStandardTimeString(),
675
- f_operate_date: this.$login.toStandardTimeString(),
676
- f_filialeids: this.$login.f.orgid,
677
- f_orgid: this.$login.f.orgid,
678
- f_orgname: this.$login.f.orgs,
679
- f_depid: this.$login.f.depids,
680
- f_depname: this.$login.f.deps,
681
- f_operatorid: this.$login.f.id,
682
- f_user_id: row.f_user_id + '',
683
- f_total_gas: row.f_total_gas,
684
- f_total_fee: row.f_total_fee,
685
- f_userfiles_id: row.f_userfiles_id,
686
- f_userinfo_id: this.row.f_userinfo_id,
687
- f_userinfo_code: this.row.f_userinfo_code,
688
- f_user_type: this.row.f_user_type,
689
- f_hand_date: this.$login.toStandardTimeString(),
690
- f_total_usegas_amount: row.f_total_usegas_amount,
691
- f_price_id: this.row.f_price_id,
692
- f_meternumber: this.row.f_meternumber,
693
- f_meter_brand: this.row.f_meter_brand,
694
- f_meter_classify: this.row.f_meter_type,
695
- f_user_name: this.row.f_user_name,
696
- f_inputtor: this.$login.f.name,
697
- f_gasproperties: this.row.f_gasproperties,
698
- f_address: this.row.f_address
699
- }
700
- try {
701
- console.log('卡表换表保存抄表记录..', row)
702
- await this.$resetpost('api/af-revenue/logic/cardCommonEnter', data, {
703
- resolveMsg: null,
704
- rejectMsg: '录入数据出错!!!'
705
- })
706
- } catch (e) {
707
- console.log('卡表换表保存抄表记录失败', e)
708
- }
709
- },
710
- addTask () {
711
- if (this.addTaskModel.f_userinfo_code != this.row.f_userinfo_code) {
712
- this.$showAlert('请填写正确的用户编号!!!', 'warning', 3000)
713
- return
714
- }
715
- let memorandum = {
716
- f_memorandum: this.addTaskModel.f_memorandum
717
- }
718
- this.model.f_business_name = '换表'
719
- this.model.f_user_name = this.row.f_user_name
720
- this.model.fusetype = '换表&清零'
721
- this.model.filesids = this.resid
722
- let data = {
723
- f_created_by: this.$login.f.name,
724
- f_orgid: this.$login.f.orgid,
725
- f_orgname: this.$login.f.orgs,
726
- f_depid: this.$login.f.depids,
727
- f_depname: this.$login.f.deps,
728
- addModel: this.addTaskModel,
729
- f_memorandum: JSON.stringify(memorandum),
730
- f_userinfo_json: this.model,
731
- f_userinfo_id: this.row.f_userinfo_id
732
- }
733
- this.$resetpost('api/af-revenue/logic/future_createWorkFlowTask', {'data': data}
734
- , {resolveMsg: null, rejectMsg: '新增任务失败!!'}).then(
735
- (res) => {
736
- this.$showAlert(res.data.msg + '请等待审批完成后去流程页面进行操作!!!', 'info', 3000)
737
- this.addTaskModalClose()
738
- this.addTaskModalShow = false
739
- }
740
- )
741
- },
742
- async apply () {
743
- this.addTaskModel.f_task_name = `用户:${this.row.f_user_name},编号:${this.row.f_userinfo_code} 申请换表`
744
- this.addTaskModel.f_userinfo_code = this.row.f_userinfo_code
745
- this.addTaskModalShow = true
746
- },
747
- async confirmbefore () {
748
- if (this.model.metermessage.f_meter_type[0] !== '机表') {
749
- if (!this.config.hasArrearsChange && this.books.data && this.books.data.length > 0) {
750
- if (this.books.data[0].f_whether_pay === '否') {
751
- this.$showAlert('该表有欠费,请到机表缴费界面进行缴费', 'warning', 3000)
752
- this.$dispatch('button-specifies', {name: '机表收费', value: 'machine-charge'}, this.row)
753
- } else {
754
- this.confirm()
755
- }
756
- } else {
757
- this.confirm()
758
- }
759
- } else {
760
- this.confirm()
761
- }
762
- },
763
- async confirm () {
764
- let msg = ''
765
- if (this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) {
766
- let a = this.config.castInt ? parseInt(this.model.f_using_base_old) : this.model.f_using_base_old
767
- let b = this.config.castInt ? parseInt(this.row.f_meter_base) : this.row.f_meter_base
768
- if (a > b) {
769
- msg = (this.row.f_meter_type === '机表' ? '该用户表底数大于上次抄表底数,请确定是否继续生成欠费记录' : '该用户表底数大于上次抄表底数,请确定是否进行结算')
770
- } else if (this.row.f_capacity && this.row.f_capacity > 0 && (parseInt(this.model.f_using_base_old) < parseInt(this.row.f_meter_base))) {
771
- msg = '该用户表底数大于上次抄表底数,且已超越最大量程,请确定是否继续生成欠费记录'
772
- }
773
- }
774
- if ((this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) && msg) {
775
- this.$showMessage(msg, ['confirm', 'cancel']).then((res) => {
776
- if (res === 'confirm') {
777
- debugger
778
- let url = this.row.f_meter_type.includes('物联网表') ? 'api/af-revenue/logic/changeMeterWebHand' : 'api/af-revenue/logic/changeMeterHand'
779
- let data = {
780
- downDate: this.$login.toStandardTimeString(),
781
- startDate: this.$login.toStandardDateString(),
782
- endDate: this.$login.toStandardDateString(),
783
- condition: `f_userfiles_id = '${this.row.f_userfiles_id}'`,
784
- f_operator: this.$login.f.name,
785
- f_operatorid: this.$login.f.id,
786
- f_meternumber: this.row.f_meternumber,
787
- f_userinfo_id: this.row.f_userinfo_id,
788
- f_userfiles_id: this.row.f_userfiles_id,
789
- f_serial_number: this.model.f_serial_number,
790
- f_meterbase: this.model.f_using_base_old,
791
- f_meter_brand: this.row.f_meter_brand,
792
- f_meter_classify: this.row.f_meter_type,
793
- f_price_id: this.row.f_price_id
794
- }
795
- this.$resetpost(url, {data: data}, {resolveMsg: '生成欠费成功', rejectMsg: '生成欠费失败'}).then((res) => {
796
- console.log('成功')
797
- if (this.model.metermessage.f_meter_type[0] != '机表') {
798
- this.$dispatch('refresh')
799
- } else {
800
- this.saveobj()
801
- }
802
- })
803
- } else {
804
-
805
- }
806
- })
807
- } else {
808
- 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))) {
809
- await this.$showMessage(`该表可能存在超用,请确定是否继续进行换表操作!!!,或者取消进入超用收费!`, ['confirm', 'cancel']).then((res) => {
810
- if (res === 'confirm') {
811
- this.saveobj()
812
- } else {
813
- }
814
- })
815
- } else {
816
- this.saveobj()
817
- }
818
- }
819
- },
820
- async saveobj () {
821
- try {
822
- const oldMeterSnapshot = Object.assign({}, this.row)
823
- // 换表前先保存卡表抄见,随后调整内存中的版本以避免乐观锁冲突
824
- if (oldMeterSnapshot.f_meter_type == '气量卡表' || oldMeterSnapshot.f_meter_type == '金额卡表') {
825
- await this.saveCardHandRecord(oldMeterSnapshot)
826
- if (typeof this.row.version !== 'undefined') {
827
- this.row.version = (this.row.version || 0) + 1
828
- }
829
- }
830
- this.model.f_operator = this.$login.f.name
831
- this.model.f_operatorid = this.$login.f.id
832
- this.model.f_orgid = this.$login.f.orgid
833
- this.model.f_orgname = this.$login.f.orgs
834
- this.model.f_depid = this.$login.f.depids
835
- this.model.f_depname = this.$login.f.deps
836
- this.model.f_zoneid = this.$login.f.zoneid
837
- this.model.f_zones = this.$login.f.zones
838
- this.model.alldue_fee = this.alldue_fee
839
- let data = {
840
- model: this.model,
841
- f_meter_book: this.newinfo.f_meter_book[0],
842
- old: this.row
843
- }
844
- // 如果更新了气价
845
- if (this.newinfo.pricename.length > 0) {
846
- data.newinfo = this.newinfo.pricename[0].f_price_id
847
- }
848
- let meterinfo = await this.$resetpost('api/af-revenue/logic/changeMeter', data, {
849
- resolveMsg: null,
850
- rejectMsg: '换表失败!!!'
851
- })
852
-
853
- if (this.config.showupload) {
854
- let param = []
855
- for (let row of this.resid) {
856
- param.push({id: row.id})
857
- }
858
- let data1 = {
859
- param: param,
860
- f_blobid: meterinfo.data.id
861
- }
862
- console.log('-------------------------->', data1)
863
- await this.$resetpost('api/af-revenue/logic/updatefiles', data1)
864
- }
865
- // 赋值【新表id】
866
- this.row.f_userfiles_id = meterinfo.data.new_userfiles_id
867
-
868
- if (this.newinfo.pricename.length > 0) {
869
- let param = {
870
- f_userinfo_id: this.row.f_userinfo_id,
871
- f_userfiles_id: this.row.f_userfiles_id,
872
- f_user_id: this.row.f_user_id,
873
- f_user_name: this.row.f_user_name,
874
- f_user_type: this.newinfo.f_user_type[0],
875
- f_gasproperties: this.newinfo.f_gasproperties[0],
876
- f_price_type: this.newinfo.pricetype[0],
877
- f_price_id: this.newinfo.pricename[0].f_price_id,
878
- f_filialeid: this.$login.f.orgid,
879
- f_operator: this.$login.f.name,
880
- f_operatorid: this.$login.f.id,
881
- f_orgid: this.$login.f.orgid,
882
- f_orgname: this.$login.f.orgs,
883
- f_depid: this.$login.f.depids,
884
- f_depname: this.$login.f.deps,
885
- f_perform_date: this.newinfo.f_perform_date,
886
- f_change_reason: '换表调价'
887
- }
888
-
889
- await this.$resetpost('api/af-revenue/logic/user_pricechange', {data: param}, {resolveMsg: '更新气价成功', rejectMsg: '更新气价失败'})
890
- }
891
- // 开始打票
892
- if (this.config.hasPrint) {
893
- if (this.model.f_print.indexOf('电子发票') == -1) {
894
- if (this.config.hasBillManage) {
895
- // 启用发票管理,获取票据管理中的票号并存储记录
896
- this.row.id = meterinfo.data.id
897
- this.row.f_bill_type = '换表'
898
- this.row.f_bill_style = this.model.f_print[0]
899
- this.print = true
900
- } else {
901
- this.row.id = meterinfo.data.id
902
- this.print = true
903
- }
904
- } else {
905
- this.printok()
906
- }
907
- } else {
908
- if (!this.config.approve) {
909
- this.printok()
910
- }
911
- }
912
-
913
- if (this.config.dispatch) {
914
- await this.$showMessage(`是否添加派工单`, ['confirm', 'cancel']).then((res) => {
915
- if (res === 'confirm') {
916
- let batch = {
917
- sf_id: meterinfo.data.id,
918
- f_userinfo_code: this.row.f_userinfo_code,
919
- f_dispathch_name: this.row.f_user_name,
920
- f_phone: this.row.f_user_phone,
921
- f_dispathch_address: this.row.f_address,
922
- f_dispathch_type: '安装',
923
- f_source: '换表',
924
- f_remarks: this.model.f_comments,
925
- f_operator_date: this.$login.toStandardTimeString(),
926
- f_orgid: this.$login.f.orgid,
927
- f_dispathch_state: '待分配'
928
- }
929
- console.log('111:', batch)
930
- this.$resetpost('api/af-revenue/logic/savePatch', batch).then((res1) => {
931
- // this.params.rows.splice(index, 1)
932
- console.log('更新成功!--------------------->', res1.data.id)
933
- })
934
- }
935
- })
936
- }
937
- if (this.config.approve) {
938
- console.log('存储换表业务信息')
939
- await this.$dispatch('futureapply', meterinfo)
940
- }
941
- } catch (error) {
942
- console.log('抛出的错误。。', error)
943
- let res = error.data.toString()
944
- this.$showAlert(res, 'danger', 2000)
945
- this.$dispatch('refresh')
946
- }
947
- },
948
- async pregasChange () {
949
- if (parseInt(this.model.f_using_base_old) < parseInt(this.row.f_meter_base)) {
950
- await this.$showMessage(`录入旧表底数小于系统就表底数请再次核对!`, ['confirm', 'cancel']).then((res) => {
951
- if (res === 'confirm') {
952
- } else {
953
- this.model.f_using_base_old = ''
954
- }
955
- })
956
- }
957
- this.commitflag = false
958
- // 每种表对应的计算方式都不一样
959
- if (this.row.f_meter_type == '气量卡表') {
960
- this.calGasCardRemanent()
961
- } else if (this.row.f_meter_type == '金额卡表') {
962
- // this.$showAlert('金额卡表换表尚在开发中,敬请期待!!', 'warning', 5000)
963
- // this.$dispatch('refresh')
964
- this.calMoneyCardRemanent()
965
- } else if (this.row.f_meter_type == '物联网表') {
966
- this.Iotjisuan()
967
- }
968
- let msg = ''
969
- if (this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) {
970
- let a = this.config.castInt ? parseInt(this.model.f_using_base_old) : this.model.f_using_base_old
971
- let b = this.config.castInt ? parseInt(this.row.f_meter_base) : this.row.f_meter_base
972
- if (a > b) {
973
- msg = (this.row.f_meter_type === '机表' ? '该用户表底数大于上次抄表底数,请确定是否继续生成欠费记录' : '该用户表底数大于上次抄表底数,请确定是否进行结算')
974
- } else if (this.row.f_capacity && this.row.f_capacity > 0 && (parseInt(this.model.f_using_base_old) < parseInt(this.row.f_meter_base))) {
975
- msg = '该用户表底数大于上次抄表底数,且已超越最大量程,请确定是否继续生成欠费记录'
976
- }
977
- }
978
- if ((this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) && msg) {
979
- this.$showMessage(msg, ['confirm', 'cancel']).then((res) => {
980
- if (res === 'confirm') {
981
- let url = this.row.f_meter_type.includes('物联网表') ? 'api/af-revenue/logic/changeMeterWebHand' : 'api/af-revenue/logic/changeMeterHand'
982
- let data = {
983
- downDate: this.$login.toStandardTimeString(),
984
- startDate: this.$login.toStandardDateString(),
985
- endDate: this.$login.toStandardDateString(),
986
- condition: `f_userfiles_id = '${this.row.f_userfiles_id}'`,
987
- f_operator: this.$login.f.name,
988
- f_operatorid: this.$login.f.id,
989
- f_meternumber: this.row.f_meternumber,
990
- f_userinfo_id: this.row.f_userinfo_id,
991
- f_userfiles_id: this.row.f_userfiles_id,
992
- f_serial_number: this.model.f_serial_number,
993
- f_meterbase: this.model.f_using_base_old,
994
- f_meter_brand: this.row.f_meter_brand,
995
- f_meter_classify: this.row.f_meter_type,
996
- f_price_id: this.row.f_price_id
997
- }
998
- this.$resetpost(url, {data: data}, {resolveMsg: '生成欠费成功', rejectMsg: '生成欠费失败'}).then((res) => {
999
- console.log('成功')
1000
- if (this.row.f_meter_type.includes('物联网表')) {
1001
- this.$dispatch('refresh')
1002
- } else {
1003
- this.$dispatch('resflushrowdata')
1004
- // this.$dispatch('button-specifies', {name: '机表收费', value: 'machine-charge'}, this.row)
1005
- }
1006
- })
1007
- }
1008
- })
1009
- }
1010
- },
1011
- async Iotjisuan () {
1012
- let gas = (this.model.f_using_base_old - 0) - (this.row.f_meter_base - 0)
1013
- let getAmount = await this.$CommonService.gasCalculate(this.row, gas)
1014
- let money = getAmount.data.chargenum
1015
- },
1016
- typeChange () {
1017
- if (this.model.f_type.includes('清零')) {
1018
- let oldMeter = {
1019
- f_meter_type: this.row.f_meter_type,
1020
- f_collection_type: this.row.f_collection_type
1021
- }
1022
- let newMeter = {
1023
- f_meter_type: this.row.f_meter_type,
1024
- f_collection_type: this.row.f_collection_type
1025
- }
1026
- let res = this.$ChangeMeter.changeMeter(oldMeter, newMeter, this.row)
1027
- console.log('看看新旧表的转换结果', res)
1028
- this.changeType = res.name
1029
- } else {
1030
- this.changeType = ''
1031
- }
1032
- },
1033
-
1034
- initData () {
1035
- this.commitflag = false
1036
- if (this.row.f_meter_type == '物联网表') {
1037
- // 判断是否需要结算
1038
- if (this.row.f_collection_type == '按气量') {
1039
- this.calGasIOTRemanent()
1040
- } else {
1041
- this.calMoneyIOTRemanent()
1042
- }
1043
- } else if (this.row.f_meter_type == '机表') {
1044
- this.validateOwe()
1045
- } else {
1046
- this.pregasChange()
1047
- }
1048
- },
1049
-
1050
- calGasCardRemanent () {
1051
- // 拿到旧表底数 和【累计购气量+初始底数】比较 这里剩余气量如果是清零补气的就不加,如果是换表补气的就加
1052
- let param = this.row.f_total_gas + this.row.f_initial_base
1053
-
1054
- if (this.row.f_remanent_type == 1) {
1055
- param += this.row.f_remanent_gas
1056
- }
1057
-
1058
- if (this.model.f_using_base_old > param) {
1059
- this.$showAlert('该表可能存在超用,请核实输入后进行换表操作!!', 'warning', 5000)
1060
- this.$dispatch('refresh')
1061
- }
1062
- this.model.f_remanent_gas = (param - (this.model.f_using_base_old - 0)).toFixed(this.getGasDecimalPlaces())
1063
- },
1064
-
1065
- calMoneyCardRemanent () {
1066
- if (!this.model.f_remanent_money) {
1067
- this.model.f_remanent_money = ''
1068
- }
1069
- let param = this.row.f_total_gas + this.row.f_initial_base
1070
-
1071
- if (this.row.f_remanent_type == 1) {
1072
- param += this.row.f_remanent_gas
1073
- }
1074
-
1075
- if (this.model.f_using_base_old > param) {
1076
- this.$showAlert('该表可能存在超用,请核实输入后进行换表操作!!', 'warning', 5000)
1077
- this.$dispatch('refresh')
1078
- }
1079
- this.model.f_remanent_gas = (param - (this.model.f_using_base_old - 0)).toFixed(this.getGasDecimalPlaces())
1080
- console.log('金额结算' + this.model.f_remanent_gas)
1081
- if (this.model.f_remanent_price > 0) {
1082
- this.model.f_remanent_gas = (param - (this.model.f_using_base_old - 0)).toFixed(this.getGasDecimalPlaces())
1083
- this.model.f_remanent_money = ((this.model.f_remanent_gas - 0) * (this.model.f_remanent_price - 0)).toFixed(4)
1084
- if (this.row.f_remanent_gas > 0) {
1085
- 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)
1086
- } else if (this.row.f_remanent_money > 0) {
1087
- this.model.f_remanent_money = (this.model.f_remanent_money - 0) + (this.row.f_remanent_money - 0)
1088
- }
1089
- console.log('金额结算' + this.model.f_remanent_money)
1090
- }
1091
- },
1092
-
1093
- calGasIOTRemanent () {
1094
- this.model.f_remanent_gas = (this.row.f_balance_gas - 0)
1095
- if (this.row.f_remanent_type == 1) {
1096
- this.model.f_remanent_gas += (this.row.f_remanent_gas - 0)
1097
- }
1098
- },
1099
- calMoneyIOTRemanent () {
1100
- this.model.f_remanent_money = (this.row.f_balance_amount - 0).toFixed(4)
1101
- if (this.row.f_remanent_type == 1) {
1102
- if (this.row.f_remanent_gas > 0) {
1103
- 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)
1104
- } else if (this.row.f_remanent_money > 0) {
1105
- this.model.f_remanent_money = (this.model.f_remanent_money - 0) + (this.row.f_remanent_money - 0)
1106
- }
1107
- }
1108
- },
1109
-
1110
- gasModelChange (val) {
1111
- console.log('新表信息', val)
1112
- if (val.length > 0) {
1113
- this.commitflag = false
1114
- // 新气表信息已选
1115
- let oldMeter = {
1116
- f_meter_type: this.row.f_meter_type,
1117
- f_collection_type: this.row.f_collection_type
1118
- }
1119
- let newMeter = {
1120
- f_meter_type: val[0].f_meter_type,
1121
- f_collection_type: val[0].f_collection_type
1122
- }
1123
- let res = this.$ChangeMeter.changeMeter(oldMeter, newMeter, this.row)
1124
- console.log('看看新旧表的转换结果', res)
1125
- this.changeType = res.name
1126
-
1127
- // 根据新表品牌重新计算补气量的小数位数
1128
- if (this.model.f_remanent_gas) {
1129
- if (val[0].f_meter_brand === '秦川卡表') {
1130
- this.model.f_remanent_gas = (this.model.f_remanent_gas - 0).toFixed(2)
1131
- } else if (val[0].f_meter_brand === '重庆精益民用') {
1132
- this.model.f_remanent_gas = (this.model.f_remanent_gas - 0).toFixed(1)
1133
- } else {
1134
- this.model.f_remanent_gas = (this.model.f_remanent_gas - 0).toFixed(4)
1135
- }
1136
- }
1137
- }
1138
- },
1139
-
1140
- remanentChange () {
1141
- this.commitflag = true
1142
- // 气量转金额 或者 金额转气量的时候对气量和金额不做限制, 可以修改, 但是只变单价
1143
- this.model.f_remanent_price = ((this.model.f_remanent_money) / (this.model.f_remanent_gas)).toFixed(4)
1144
- if (this.model.f_remanent_price == 'NaN') {
1145
- this.model.f_remanent_price = 0
1146
- }
1147
- },
1148
-
1149
- async validateOwe () {
1150
- let http = new HttpResetClass()
1151
- // 有欠费是否能换表 如果能则需要获取到欠费金额
1152
- if (this.config.hasArrearsChange) {
1153
- let res = await http.load('POST', 'api/af-revenue/logic/sale_getOwe', {data: {f_userinfo_id: this.row.f_userinfo_id}}, {resolveMsg: null, rejectMsg: '获取欠费出错!!'})
1154
- let owes = []
1155
- for (let i = 0; i < res.data.length; i++) {
1156
- for (let j = 0; j < res.data[i].rows.length; j++) {
1157
- owes.push(res.data[i].rows[j])
1158
- }
1159
- }
1160
- console.log('获取到的欠费记录', owes)
1161
- this.alldue_fee = owes.reduce((total, item) => {
1162
- return total + (item.f_oughtfee + item.overdue - item.f_debt_money)
1163
- }, 0)
1164
- console.log('总欠费金额为', this.alldue_fee)
1165
- this.books = owes
1166
- } else {
1167
- // 如果 不能 则只需要获取到记录数,采用相对节省资源的查询
1168
- let books = await http.load('POST', 'api/af-revenue/sql/singleTable_OrderBy', {
1169
- data: {
1170
- items: 'f_whether_pay',
1171
- tablename: 't_handplan',
1172
- condition: ` f_user_id = '${this.row.f_user_id}' and f_oughtfee > 0 and f_hand_state = '有效' and f_meter_state='已抄表' `,
1173
- orderitem: ' id desc'
1174
- }
1175
- }, {resolveMsg: null, rejectMsg: null}
1176
- )
1177
- console.log('获取到的欠费记录', books)
1178
- this.books = books
1179
- // 如果是机表验证是否有欠费
1180
- if ((this.row.f_balance - 0) < 0) {
1181
- this.$showAlert('该表有欠费,请到机表缴费界面进行缴费', 'warning', 3000)
1182
- this.$dispatch('button-specifies', {name: '机表收费', value: 'machine-charge'}, this.row)
1183
- }
1184
- }
1185
- },
1186
- getComments (array) {
1187
- let str = '剩余补气量中,'
1188
- array.forEach((item) => {
1189
- str = str + '单价:' + item.price + '补气量为:' + item.gas + 'm³,'
1190
- })
1191
- str += '折算后补气量为' + this.model.f_remanent_gas + 'm³,补气金额为' + this.model.f_remanent_money + '元,平均单价为' + this.model.f_remanent_price + '元'
1192
- this.model.f_comments = str
1193
- },
1194
- allocateGas (totalGas, rates, price) {
1195
- let remainingGas = totalGas
1196
- const allocations = []
1197
- let totalAmount = 0
1198
-
1199
- for (const rate of rates) {
1200
- if (remainingGas <= 0) break // 如果剩余气量为0或负数,跳出循环
1201
- if (remainingGas >= rate.f_gas) {
1202
- // 如果剩余气量大于等于当前条目的气量
1203
- allocations.push({
1204
- gas: rate.f_gas,
1205
- price: rate.f_price,
1206
- amount: rate.f_money
1207
- })
1208
- totalAmount += parseFloat(rate.f_money)
1209
- remainingGas -= rate.f_gas
1210
- } else {
1211
- // 如果剩余气量小于当前条目的气量
1212
- allocations.push({
1213
- gas: remainingGas,
1214
- price: rate.f_price,
1215
- amount: parseFloat((remainingGas * rate.f_price).toFixed(4))
1216
- })
1217
- totalAmount += parseFloat((remainingGas * rate.f_price).toFixed(4))
1218
- remainingGas = 0 // 剩余气量设置为0
1219
- break // 跳出循环
1220
- }
1221
- }
1222
- // 如果遍历完所有条目后仍有剩余气量
1223
- if (remainingGas > 0) {
1224
- allocations.push({
1225
- gas: remainingGas,
1226
- price: price,
1227
- amount: parseFloat((remainingGas * price).toFixed(4))
1228
- })
1229
- totalAmount += parseFloat((remainingGas * price).toFixed(4))
1230
- }
1231
- this.model.f_remanent_price = (totalAmount / this.model.f_remanent_gas).toFixed(4)
1232
- this.model.f_remanent_money = totalAmount
1233
- // 计算公式
1234
- this.getComments(allocations)
1235
- },
1236
- // 新增:根据表品牌返回补气量小数位数
1237
- getGasDecimalPlaces() {
1238
- if (this.model.metermessage.gasbrand && this.model.metermessage.gasbrand[0]) {
1239
- if (this.model.metermessage.gasbrand[0].f_meter_brand === '秦川卡表') {
1240
- return 2
1241
- } else if (this.model.metermessage.gasbrand[0].f_meter_brand === '重庆精益民用') {
1242
- return 1
1243
- }
1244
- }
1245
- return 4
1246
- }
1247
- },
1248
- watch: {
1249
- 'row' () {
1250
- console.log('-------------------------------')
1251
- console.log(this.row)
1252
- },
1253
- 'model.metermessage.f_meter_type' (val) {
1254
- console.log(val)
1255
- if (val.length > 0) {
1256
- if (val[0] != '气量卡表' && this.row.f_meter_type == '气量卡表') {
1257
- this.allocateGas(this.model.f_remanent_gas, this.chargePrices, this.model.f_remanent_price)
1258
- } else {
1259
- if (this.model.f_comments) {
1260
- this.model.f_comments = ''
1261
- }
1262
- }
1263
- }
1264
- },
1265
- 'model.f_remanent_money' (val) {
1266
- console.log('观察补气金额', val)
1267
- if (!this.isGas) {
1268
- if (this.model.f_remanent_price) {
1269
- this.model.f_remanent_gas = (val / this.model.f_remanent_price).toFixed(this.getGasDecimalPlaces())
1270
- } else {
1271
- this.model.f_remanent_gas = 0
1272
- }
1273
- }
1274
- if (this.model.f_using_base_old) {
1275
- this.commitflag = true
1276
- }
1277
- },
1278
- 'model.f_remanent_gas' (val, val2) {
1279
- console.log('观察补气量', val)
1280
- if (this.isGas) {
1281
- if (this.row.f_meter_type == '气量卡表' && this.model.metermessage.f_meter_type[0] && this.model.metermessage.f_meter_type[0] != '气量卡表') {
1282
- if (this.chargePrices.length < 1) {
1283
- this.model.f_remanent_money = (val / this.model.f_remanent_price).toFixed(4)
1284
- } else {
1285
- this.allocateGas(this.model.f_remanent_gas, this.chargePrices, this.model.f_remanent_price)
1286
- }
1287
- } else {
1288
- if (this.model.f_remanent_price > 0) {
1289
- this.model.f_remanent_money = (val * this.model.f_remanent_price).toFixed(4)
1290
- }
1291
- }
1292
- }
1293
- if (this.model.f_using_base_old) {
1294
- this.commitflag = true
1295
- }
1296
- },
1297
- 'dataModel' (val) {
1298
- console.log('看看dataModel的值:', val)
1299
- if (val) {
1300
- this.$nextTick(() => {
1301
- this.model = Object.assign({}, this.model, val)
1302
- this.resid = this.model.filesids
1303
- })
1304
- }
1305
- console.log('看看this.model的值:', this.model)
1306
- },
1307
- 'newinfoData' (val) {
1308
- console.log('看看newinfoData的值:', val)
1309
- if (val) {
1310
- this.$nextTick(() => {
1311
- this.newinfo = Object.assign({}, this.newinfo, val)
1312
- })
1313
- }
1314
- console.log('看看this.newinfo的值:', this.newinfo)
1315
- }
1316
- }
1317
- }
1318
- </script>
1319
- <style lang="less">
1320
- #ChangeMeter {
1321
- .col-sm-4 {
1322
- .font_normal_body {
1323
- width: 73px;
1324
- overflow: auto;
1325
- white-space: nowrap;
1326
- // 指滚动条两边的按钮
1327
- &::-webkit-scrollbar-button {
1328
- display: none;
1329
- }
1330
- // 滚动条的宽度
1331
- &::-webkit-scrollbar {
1332
- width: 5px !important;
1333
- height: 5px !important;
1334
- }
1335
- // 滚动条的设置
1336
- &::-webkit-scrollbar-thumb {
1337
- background-color: #ddd;
1338
- background-clip: padding-box;
1339
- }
1340
- &::-webkit-scrollbar-thumb:hover {
1341
- background-color: #bbb;
1342
- }
1343
- &::-webkit-scrollbar-track {
1344
- /*滚动条里面轨道*/
1345
- box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
1346
- background: #ededed;
1347
- }
1348
- }
1349
- }
1350
- }
1351
- </style>
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" @gasbrand="gasBrandChange" 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
+ @blur="remanentChange"
59
+ v-validate:f_remanent_gas='{required: true, dctest: [-1, ">" ] }'>
60
+ </div>
61
+ <div class="col-sm-4 form-group">
62
+ <label class=" font_normal_body">补气单价</label>
63
+ <input class="input_search" style="width:60%" type="number"
64
+ v-model="model.f_remanent_price"
65
+ placeholder="补气单价" readonly>
66
+ </div>
67
+ <div class="col-sm-4 form-group"
68
+ :class="[$v.f_remanent_money.required || $v.f_remanent_money.dctest ? 'has-error' : 'has-success']">
69
+ <label for="f_remanent_money" class=" font_normal_body">补气金额</label>
70
+ <input class="input_search" style="width:60%" type="number"
71
+ v-model="model.f_remanent_money"
72
+ placeholder="补气金额"
73
+ @blur="remanentChange"
74
+ v-validate:f_remanent_money='{required: true, dctest: [-1, ">" ] }'>
75
+ </div>
76
+ </div>
77
+ <div class="row auto" v-if="changeType == 'gasToGas'">
78
+ <!-- 气量转气量 -->
79
+ <div class="col-sm-4 form-group"
80
+ :class="[$v.f_remanent_gas.required || $v.f_remanent_gas.dctest ? 'has-error' : 'has-success']">
81
+ <label for="f_remanent_gas" class=" font_normal_body">补&ensp;气&ensp;量</label>
82
+ <input class="input_search" style="width:60%" type="number"
83
+ v-model="model.f_remanent_gas"
84
+ placeholder="补气量"
85
+ v-validate:f_remanent_gas='{required: true, dctest: [-1, ">" ] }'>
86
+ </div>
87
+ </div>
88
+
89
+ <div class="row auto" v-if="changeType == 'amountToAmount'">
90
+ <!-- 金额转金额 -->
91
+ <div class="col-sm-4 form-group"
92
+ :class="[$v.f_remanent_money.required || $v.f_remanent_money.dctest ? 'has-error' : 'has-success']">
93
+ <label for="f_remanent_money" class=" font_normal_body">补气金额</label>
94
+ <input class="input_search" style="width:60%" type="number"
95
+ v-model="model.f_remanent_money"
96
+ placeholder="补气金额"
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" v-model="newinfo.f_meter_book"
204
+ placeholder='新抄表册' :options="meterbookoptions"
205
+ close-on-select></v-select>
206
+ </div>
207
+
208
+ </div>
209
+ <div class="row auto" v-if="!model.f_type.includes('换卡控流量计')">
210
+ <div class="col-sm-4 ">
211
+ <label for="f_comments" class=" font_normal_body">业务单号</label>
212
+ <input class="input_search" style="width:60%" type="text"
213
+ v-model="model.f_serial_number" placeholder="业务单号">
214
+ </div>
215
+ <div class="col-sm-4 ">
216
+ <label class=" font_normal_body">阶梯累计</label>
217
+ <v-select id="f_ladder_sync"
218
+ v-model="f_payment"
219
+ placeholder='是否累计'
220
+ :search="false"
221
+ :value-single="true"
222
+ :value.sync="model.f_ladder_sync"
223
+ :options='ladder'
224
+ close-on-select clear-button></v-select>
225
+ </div>
226
+ <div class="col-sm-4"
227
+ :class="[$v.f_stair_use.required || $v.f_stair_use.dctest ? 'has-error' : 'has-success']"
228
+ v-if="row.f_meter_type.includes('卡表') && model.metermessage.gasbrand[0].f_meter_type ==='物联网表'&& model.f_ladder_sync !=='不同步'">
229
+ <label class=" font_normal_body">阶梯用量</label>
230
+ <input class="input_search" style="width:60%" type="number"
231
+ v-validate:f_stair_use='{required: true, dctest: [0, ">=" ] }'
232
+ v-model="model.f_stair_use" placeholder="旧表阶梯使用量">
233
+ </div>
234
+ <div class="col-sm-4 "
235
+ v-if="(model.metermessage.gasbrand[0].f_meter_type ==='物联网表' && model.metermessage.gasbrand[0].f_hascard ==='是')
236
+ || (model.f_type.includes('清零') && row.f_meter_type ==='物联网表' && row.f_hascard ==='是')">
237
+ <label class=" font_normal_body">开户方式</label>
238
+ <v-select id="f_open_type"
239
+ v-model="f_payment"
240
+ placeholder='开户方式'
241
+ :search="false"
242
+ :value-single="true"
243
+ :value.sync="model.f_open_type"
244
+ :options='opentype'
245
+ close-on-select clear-button></v-select>
246
+ </div>
247
+ <div v-if="config.aroundmeter" class="col-sm-4 form-group" :class="[$v.f_newaroundmeter.required ? 'has-error' : '']">
248
+ <label class="font_normal_body">新表表向</label>
249
+ <v-select :value.sync="model.f_newaroundmeter" :options='aroundmeters' placeholder='新表表向'
250
+ :value-single="true"
251
+ close-on-select
252
+ v-model='model.f_newaroundmeter'></v-select>
253
+ </div>
254
+ </div>
255
+ <div cl="row auto">
256
+ <div class="col-sm-4" :class="[$v.f_changetables_reason.required ? 'has-error' : '']">
257
+ <label for="f_changetables_reason" class=" font_normal_body" >换表原因</label>
258
+ <input type="text" class="input_search" style="width: 60%" v-show="false" v-model="$refs.f_changetables_reason.selectedItems" v-validate:f_changetables_reason='{required: true }'>
259
+ <v-select id="f_changetables_reason"
260
+ v-model="model.f_changetables_reason"
261
+ :value-single="true"
262
+ placeholder='换表原因'
263
+ :value.sync="model.f_changetables_reason"
264
+ :options='reason'
265
+ v-ref:f_changetables_reason
266
+ close-on-select></v-select>
267
+ </div>
268
+ <div class="row" style="margin-top:10px;" v-if="model.f_changetables_reason ==='其他'">
269
+ <div class="col-sm-12" :class="[$v.f_othereason.required ? 'has-error' : 'has-success']">
270
+ <label class="font_normal_body ">其他原因</label>
271
+ <textarea class="input_textarea" rows="3" style="width:87%;" v-model="model.f_othereason"
272
+ v-validate:f_othereason='{required: true}'
273
+ ></textarea>
274
+ </div>
275
+ </div>
276
+ </div>
277
+ <div class="row auto">
278
+ <div class="col-sm-12"
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"></textarea>
283
+ </div>
284
+ <div class="col-sm-12"
285
+ :class="[$v.f_comments.required ? 'has-error' : 'has-success']"
286
+ v-if="commitflag"
287
+ >
288
+ <label class="font_normal_body ">备&emsp;&emsp;注</label>
289
+ <textarea class="input_textarea" rows="3" style="width:87%;" v-model="model.f_comments"
290
+ v-validate:f_comments='{required: true}'
291
+ ></textarea>
292
+ </div>
293
+ </div>
294
+
295
+ <!-- <div class="col-sm-12" v-if="config.changeReason">-->
296
+ <!-- <label class="font_normal_body ">换表原因</label>-->
297
+ <!-- <textarea class="input_textarea" rows="3" style="width:87%;" v-model="model.f_changetables_reason"></textarea>-->
298
+ <!-- </div>-->
299
+ <div style="text-align:right;height:auto;">
300
+ <button class="button_search" v-show="config.approve == true ? applyButtonShow : false" type="button" @click="apply()"
301
+ :disabled="(!meterinfo && !(model.f_type.includes('清零') || model.f_type.includes('换卡控流量计'))) || !$v.valid"
302
+ >换表审核
303
+ </button>
304
+ <button class="button_search" v-show="config.approve == true ? !applyButtonShow : true" type="button" @click="confirmbefore()"
305
+ :disabled="(!meterinfo && !(model.f_type.includes('清零') ||
306
+ model.f_type.includes('换卡控流量计'))) || !$v.valid"
307
+ >确认
308
+ </button>
309
+ <button class="button_clear" v-show="applyButtonShow" type="button" @click="clean()">取消
310
+ </button>
311
+ </div>
312
+ </form>
313
+ <validate-bill v-if="hasValidateBill" :data="model" @validate-bill="validateBill"></validate-bill>
314
+ <print-bill :show="print" :bill-config='config' :bill-data='billData' v-ref:printbill @toggle="close" :data='row' @printok="printok" ></print-bill>
315
+ </validator>
316
+ <modal :show.sync="addTaskModalShow" backdrop="false" width="40%" title="创建任务" small="true" @modal-close="addTaskModalClose()">
317
+ <article slot="modal-body" class="row" style="padding: 10px">
318
+ <add-apply-task :applytaskobj.sync="addTaskModel" @valid="addTaskValid = true" @invalid="addTaskValid = false">
319
+ </add-apply-task>
320
+ </article>
321
+ <footer slot="modal-footer" class="modal-footer" style="text-align: right;border: 0">
322
+ <button class="btn button_search" @click="addTask()"
323
+ :disabled="!addTaskValid">新增审核任务
324
+ </button>
325
+ </footer>
326
+ </modal>
327
+ </div>
328
+ <upload v-if="config.showupload" :blodid="row.f_userinfo_id" :businessid="model.randomBusinessId" isremark="true" fusetype="换表&清零"></upload>
329
+ </template>
330
+ <script>
331
+ /**
332
+ *换表管理
333
+ *组合界面,加载机表,物联网表,气量卡表,金额卡表旧表信息,以及控制显示换新表信息
334
+ */
335
+ import { HttpResetClass } from 'vue-client'
336
+ let getPrice = async function (self) {
337
+ await self.$LoadParams.loadParam(self.$login.f.orgid)
338
+ await self.$getConfig(self, 'ChangeMeter')
339
+
340
+ self.model.f_print = self.config.printType instanceof Array ? self.config.printType : [self.config.printType]
341
+ self.model.f_payment = self.config.payment
342
+ self.model.f_ladder_sync = self.config.ladderSync
343
+ self.mulPrint = self.config.printType instanceof Array
344
+ self.model.f_use_type = self.config.billType
345
+ self.model.f_bill_type = self.model.f_print
346
+ self.hasValidateBill = self.config.hasBillManage
347
+
348
+ self.model.f_open_type = self.config.open_way
349
+ self.isGas = (self.row.f_collection_type == '按气量')
350
+
351
+ let http = new HttpResetClass()
352
+ let param = {
353
+ tablename: 't_detailprice',
354
+ condition: `f_price_name = '1' and f_stairprice_id = '${self.row.f_stairprice_id}'`
355
+ }
356
+ let res = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
357
+ data: param
358
+ }, {
359
+ resolveMsg: null,
360
+ rejectMsg: '获取一阶单价!!'
361
+ })
362
+ if (res.data.length > 0) {
363
+ self.model.f_remanent_price = res.data[0].f_price
364
+ }
365
+ let http2 = new HttpResetClass()
366
+ let chargeData = {
367
+ tablename: 't_chargeprice',
368
+ items: 'f_gas,f_money,f_price',
369
+ condition: `f_userfiles_id = '${self.row.f_userfiles_id}' and f_state = '有效'`,
370
+ orderitem: 'f_operate_date desc'
371
+ }
372
+ let chargePrice = await http2.load('POST', 'api/af-revenue/sql/singleTable_OrderBy', {
373
+ data: chargeData
374
+ }, {
375
+ resolveMsg: null,
376
+ rejectMsg: '获取划价记录失败!!'
377
+ })
378
+ if (chargePrice.data.length > 0) {
379
+ self.chargePrices = chargePrice.data
380
+ }
381
+ let temp = {
382
+ tablename: 't_meter_book',
383
+ condition: `f_book_state='有效' and f_filiale_id='${self.$login.f.orgid}'`
384
+ }
385
+ let meterbooks = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {data: temp},
386
+ {resolveMsg: null, rejectMsg: '获取抄表册信息失败!!'})
387
+ if (meterbooks.data.length > 0) {
388
+ let options = []
389
+ for (let i = 0; i < meterbooks.data.length; i++) {
390
+ let tmp = {label: meterbooks.data[i].f_book_name, value: `${meterbooks.data[i].id}`}
391
+ options.push(tmp)
392
+ }
393
+ self.meterbookoptions = options
394
+ }
395
+ if (self.row.f_price_type === '固定气价') {
396
+ self.model.f_stair_use = 0
397
+ } else {
398
+ let a = await http.load('POST', 'api/af-revenue/logic/getStairUse', {data: self.row}, {resolveMsg: null, rejectMsg: '获取阶梯使用情况出错'})
399
+ console.log(a.data)
400
+ self.model.f_stair_use = a.data
401
+ }
402
+ self.newinfo.pricetype = [self.row.f_price_type]
403
+ let params = {
404
+ f_user_type: self.row.f_user_type,
405
+ f_gasproperties: self.row.f_gasproperties,
406
+ f_price_type: self.row.f_price_type,
407
+ filter: self.$login.f.orgid
408
+ }
409
+ let rs = self.$GetSaleParam.getPrice(params)
410
+ rs.forEach((val) => {
411
+ if (val.label == self.row.f_price_name) {
412
+ self.newinfo.pricename = [val.value]
413
+ }
414
+ })
415
+ self.initData()
416
+ }
417
+ export default {
418
+ title: '换表登记',
419
+ data () {
420
+ return {
421
+ resid: [], // 存放新增的f_files表中id
422
+ model: {
423
+ f_flowmeter_number: '',
424
+ f_flowmeter_pass: '',
425
+ f_flowmeter_brand: '',
426
+ f_flowmeter_model: '',
427
+ f_flowmeter_accuracy: '',
428
+ f_flowmeter_mpa_level: '',
429
+ f_flowmeter_install_date: this.$login.toStandardTimeString(),
430
+ metermessage: {
431
+ f_meter_type: '',
432
+ gasbrand: '',
433
+ gasmodel: '',
434
+ f_meternumber: '',
435
+ f_meter_base: '',
436
+ f_metertitles: '',
437
+ f_oldmeter_use_reference: 0 // 旧表使用量参考值
438
+ },
439
+ // 旧表底数
440
+ f_ladder_sync: '',
441
+ f_using_base_old: '',
442
+ // 换表补气量
443
+ f_remanent_gas: 0,
444
+ // 换表补气单价
445
+ f_remanent_price: 0,
446
+ f_open_type: '',
447
+ f_remanent_money: 0,
448
+ f_type: '换新表',
449
+ f_comments: '',
450
+ f_othereason: '',
451
+ f_stair_use: '',
452
+ f_payment: '现金缴费',
453
+ f_print: '普通收据',
454
+ f_state: '有效',
455
+ f_changemeter_date: this.$login.toStandardTimeString(),
456
+ f_changemeter_fee: this.$appdata.getSingleValue('换表金额') ? this.$appdata.getSingleValue('换表金额') : 0,
457
+ f_difference_reason: '',
458
+ // 金额表剩余金额
459
+ f_using_fee_old: 0,
460
+ randomBusinessId: ''
461
+ },
462
+ chargePrices: [],
463
+ meterinfo: false,
464
+
465
+ meterbookoptions: [],
466
+ // 控制气量和金额的转换显示
467
+ changeType: '',
468
+ config: {
469
+ hasPrint: false, // 默认打票
470
+ hasBillManage: false, // 默认不启用发票管理
471
+ billType: '其他费用', // 票据类型(燃气费,其他费用,调用的发票代码不同)
472
+ printType: '普通收据', // 收据/电子票/专用发票/国税发票
473
+ payment: '现金缴费',
474
+ ladderSync: '同步',
475
+ open_way: '指令开户',
476
+ hasArrearsChange: false, // 是否可以有欠费换表
477
+ f_change_operator: false, // 换表人是否必填
478
+ castInt: true,
479
+ aroundmeter: false, // 表向
480
+ changeReason: false, // 换表原因
481
+ dispatch: false, // 是否派工
482
+ showupload: true, //
483
+ approve: false // 是否开启审核
484
+ },
485
+ print: false,
486
+ // 启用发票管理需要对票号进行验证
487
+ hasValidateBill: false,
488
+ validateOk: false,
489
+ billData: {
490
+ url: 'api/af-revenue/report/change_meter',
491
+ bill: ''
492
+ },
493
+ // 控制气量金额的编辑
494
+ isGas: false,
495
+ replacewatchtype: this.$appdata.getParam('换表类型'),
496
+ reason: this.$appdata.getParam('换表原因') ? this.$appdata.getParam('换表原因') : [],
497
+ paytype: this.$appdata.getParam('付款方式'),
498
+ printstyle: this.$appdata.getParam('打印格式'),
499
+ gasproperties: [],
500
+ addgasnum: 0,
501
+ addgas: false,
502
+ books: {
503
+ data: []
504
+ },
505
+ addbalance: false,
506
+ newinfo: {
507
+ f_user_type: '',
508
+ f_gasproperties: '',
509
+ pricetype: '',
510
+ pricename: '',
511
+ f_perform_date: this.$login.toStandardDateString() + ' 00:00:00' // 操作时间
512
+ },
513
+ ladder: [{label: '累计', value: '同步'}, {label: '不累计', value: '不同步'}],
514
+ opentype: [{label: '指令开户', value: '指令开户'}, {label: '发卡开户', value: '发卡开户'}],
515
+ usertypes: this.$appdata.getParam('用户类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')] : [],
516
+ pricetypes: this.$appdata.getParam('气价类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('气价类型')] : [],
517
+ addTaskModel: {
518
+ f_task_name: '',
519
+ f_userinfo_code: '',
520
+ f_work_flow_name: '',
521
+ f_approval: '',
522
+ f_memorandum: ''
523
+ },
524
+ addTaskValid: false,
525
+ addTaskModalShow: false,
526
+ commitflag: false,
527
+ // 总欠费金额
528
+ alldue_fee: 0
529
+ }
530
+ },
531
+ props: {
532
+ row: {
533
+ type: Object,
534
+ default: undefined
535
+ },
536
+ applyButtonShow: {
537
+ type: Boolean,
538
+ default: true
539
+ },
540
+ dataModel: {
541
+ type: Object,
542
+ default: undefined
543
+ }
544
+ },
545
+ ready () {
546
+ // 重写 toFixed 方法,实现四舍五入
547
+ Number.prototype.toFixed = function(digits) {
548
+ const num = this
549
+ const multiplier = Math.pow(10, digits)
550
+ const rounded = Math.round(num * multiplier) / multiplier
551
+ return rounded.toString()
552
+ }
553
+ getPrice(this)
554
+ this.getRandomId()
555
+ },
556
+ events: {
557
+ // 删除Resid数组元素
558
+ 'delResid' (val) {
559
+ this.resid.$remove({id: val, f_biobid: ''})
560
+ // this.resid.splice(this.resid.indexOf({id:val,f_biobid:''}),1);
561
+ },
562
+ // 增加Resid数组元素
563
+ 'resid' (val) {
564
+ this.resid.push({id: val, f_biobid: ''})
565
+ }
566
+ },
567
+ computed: {
568
+ aroundmeters () {
569
+ return this.$appdata.getParam('左右表')
570
+ },
571
+ flowmeterbrands () {
572
+ let gasbrand = this.$GetSaleParam.getGasbrand()
573
+ let flowmeterbrands = []
574
+ for (let row of gasbrand) {
575
+ flowmeterbrands.push({label: row.label, value: row.label})
576
+ }
577
+ return flowmeterbrands
578
+ }
579
+ },
580
+ methods: {
581
+ getRandomId () {
582
+ this.model.randomBusinessId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
583
+ let res = Math.random() * 16 | 0
584
+ let v = c == 'x' ? res : (res & 0x3 | 0x8)
585
+ return v.toString(16)
586
+ })
587
+ },
588
+ feeOldChange () {
589
+ if (this.model.f_using_fee_old) {
590
+ this.model.f_remanent_money = this.model.f_using_fee_old
591
+ }
592
+ },
593
+ addTaskModalClose () {
594
+ this.addTaskModel.f_work_flow_name = ''
595
+ this.addTaskModel.f_task_name = ''
596
+ this.addTaskModel.f_userinfo_code = ''
597
+ this.addTaskModel.f_approval = ''
598
+ this.addTaskModel.f_memorandum = ''
599
+ },
600
+ validateBill (val) {
601
+ this.validateOk = !val.isOk
602
+ this.billData.bill = val.bill
603
+ },
604
+ close () {
605
+ this.print = false
606
+ this.printok()
607
+ },
608
+ async printok () {
609
+ let msg = await this.$showMessage('已成功换表,是否进入补气或购气界面', ['confirm', 'cancel'])
610
+ if (msg == 'confirm') {
611
+ this.$dispatch('get-new-row', this.row)
612
+ } else {
613
+ this.$dispatch('success')
614
+ }
615
+ },
616
+ flowmetermodels (label) {
617
+ let gasbrand = this.$GetSaleParam.getGasbrand()
618
+ let flowmetermodels = []
619
+ for (let row of gasbrand) {
620
+ if (row.label == label) {
621
+ for (let gasmodel of row.value.gasmodel) {
622
+ flowmetermodels.push({label: gasmodel.label, value: gasmodel.label})
623
+ }
624
+ break
625
+ }
626
+ }
627
+ return flowmetermodels
628
+ },
629
+ getPricenames () {
630
+ console.log('气价。,。。', this.newinfo.pricetype)
631
+ let rs = []
632
+ if (this.row.f_user_type && this.row.f_gasproperties && this.newinfo.pricetype.length === 1) {
633
+ let params = {
634
+ f_user_type: this.row.f_user_type,
635
+ f_gasproperties: this.row.f_gasproperties,
636
+ f_price_type: this.newinfo.pricetype[0],
637
+ filter: this.$login.f.orgid
638
+ }
639
+ rs = this.$GetSaleParam.getPrice(params)
640
+ }
641
+ if (rs.length === 0) {
642
+ this.newinfo.f_price_name = ''
643
+ }
644
+ return rs
645
+ },
646
+ userTypeChange () {
647
+ this.gasproperties = []
648
+ if (this.newinfo.f_user_type.length === 1) {
649
+ this.gasproperties = this.$appdata.getParam(this.newinfo.f_user_type[0])
650
+ }
651
+ },
652
+ // 返回
653
+ clean () {
654
+ this.$dispatch('success', '换表', this.row)
655
+ },
656
+ // 卡表换表时,保存一条抄表记录(可传入旧表快照,默认用当前 row)
657
+ async saveCardHandRecord (oldRow) {
658
+ // 没有录入旧表底数则不保存
659
+ if (!this.model.f_using_base_old) {
660
+ return
661
+ }
662
+ const row = oldRow || this.row
663
+ const data = {
664
+ f_tablebase: Number(this.model.f_using_base_old), // 本期底数
665
+ // 上期底数(当前档案中的底数即上次抄表底数)
666
+ f_last_tablebase: row.f_meter_base,
667
+ f_operator: this.$login.f.name,
668
+ f_filiale: this.$login.f.f_fengongsi,
669
+ f_outlets: this.$login.f.f_parentname,
670
+ f_meter_state: '已抄表',
671
+ f_hand_state: '有效',
672
+ f_meter_source: '换表结算抄表',
673
+ f_input_date: this.$login.toStandardTimeString(),
674
+ f_last_input_date: row.f_last_input_date ? row.f_last_input_date : this.$login.toStandardTimeString(),
675
+ f_operate_date: this.$login.toStandardTimeString(),
676
+ f_filialeids: this.$login.f.orgid,
677
+ f_orgid: this.$login.f.orgid,
678
+ f_orgname: this.$login.f.orgs,
679
+ f_depid: this.$login.f.depids,
680
+ f_depname: this.$login.f.deps,
681
+ f_operatorid: this.$login.f.id,
682
+ f_user_id: row.f_user_id + '',
683
+ f_total_gas: row.f_total_gas,
684
+ f_total_fee: row.f_total_fee,
685
+ f_userfiles_id: row.f_userfiles_id,
686
+ f_userinfo_id: this.row.f_userinfo_id,
687
+ f_userinfo_code: this.row.f_userinfo_code,
688
+ f_user_type: this.row.f_user_type,
689
+ f_hand_date: this.$login.toStandardTimeString(),
690
+ f_total_usegas_amount: row.f_total_usegas_amount,
691
+ f_price_id: this.row.f_price_id,
692
+ f_meternumber: this.row.f_meternumber,
693
+ f_meter_brand: this.row.f_meter_brand,
694
+ f_meter_classify: this.row.f_meter_type,
695
+ f_user_name: this.row.f_user_name,
696
+ f_inputtor: this.$login.f.name,
697
+ f_gasproperties: this.row.f_gasproperties,
698
+ f_address: this.row.f_address
699
+ }
700
+ try {
701
+ console.log('卡表换表保存抄表记录..', row)
702
+ await this.$resetpost('api/af-revenue/logic/cardCommonEnter', data, {
703
+ resolveMsg: null,
704
+ rejectMsg: '录入数据出错!!!'
705
+ })
706
+ } catch (e) {
707
+ console.log('卡表换表保存抄表记录失败', e)
708
+ }
709
+ },
710
+ addTask () {
711
+ if (this.addTaskModel.f_userinfo_code != this.row.f_userinfo_code) {
712
+ this.$showAlert('请填写正确的用户编号!!!', 'warning', 3000)
713
+ return
714
+ }
715
+ let memorandum = {
716
+ f_memorandum: this.addTaskModel.f_memorandum
717
+ }
718
+ this.model.f_business_name = '换表'
719
+ this.model.f_user_name = this.row.f_user_name
720
+ this.model.fusetype = '换表&清零'
721
+ this.model.filesids = this.resid
722
+ let data = {
723
+ f_created_by: this.$login.f.name,
724
+ f_orgid: this.$login.f.orgid,
725
+ f_orgname: this.$login.f.orgs,
726
+ f_depid: this.$login.f.depids,
727
+ f_depname: this.$login.f.deps,
728
+ addModel: this.addTaskModel,
729
+ f_memorandum: JSON.stringify(memorandum),
730
+ f_userinfo_json: this.model,
731
+ f_userinfo_id: this.row.f_userinfo_id
732
+ }
733
+ this.$resetpost('api/af-revenue/logic/future_createWorkFlowTask', {'data': data}
734
+ , {resolveMsg: null, rejectMsg: '新增任务失败!!'}).then(
735
+ (res) => {
736
+ this.$showAlert(res.data.msg + '请等待审批完成后去流程页面进行操作!!!', 'info', 3000)
737
+ this.addTaskModalClose()
738
+ this.addTaskModalShow = false
739
+ }
740
+ )
741
+ },
742
+ async apply () {
743
+ this.addTaskModel.f_task_name = `用户:${this.row.f_user_name},编号:${this.row.f_userinfo_code} 申请换表`
744
+ this.addTaskModel.f_userinfo_code = this.row.f_userinfo_code
745
+ this.addTaskModalShow = true
746
+ },
747
+ async confirmbefore () {
748
+ if (this.model.metermessage.f_meter_type[0] !== '机表') {
749
+ if (!this.config.hasArrearsChange && this.books.data && this.books.data.length > 0) {
750
+ if (this.books.data[0].f_whether_pay === '否') {
751
+ this.$showAlert('该表有欠费,请到机表缴费界面进行缴费', 'warning', 3000)
752
+ this.$dispatch('button-specifies', {name: '机表收费', value: 'machine-charge'}, this.row)
753
+ } else {
754
+ this.confirm()
755
+ }
756
+ } else {
757
+ this.confirm()
758
+ }
759
+ } else {
760
+ this.confirm()
761
+ }
762
+ },
763
+ async confirm () {
764
+ let msg = ''
765
+ if (this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) {
766
+ let a = this.config.castInt ? parseInt(this.model.f_using_base_old) : this.model.f_using_base_old
767
+ let b = this.config.castInt ? parseInt(this.row.f_meter_base) : this.row.f_meter_base
768
+ if (a > b) {
769
+ msg = (this.row.f_meter_type === '机表' ? '该用户表底数大于上次抄表底数,请确定是否继续生成欠费记录' : '该用户表底数大于上次抄表底数,请确定是否进行结算')
770
+ } else if (this.row.f_capacity && this.row.f_capacity > 0 && (parseInt(this.model.f_using_base_old) < parseInt(this.row.f_meter_base))) {
771
+ msg = '该用户表底数大于上次抄表底数,且已超越最大量程,请确定是否继续生成欠费记录'
772
+ }
773
+ }
774
+ if ((this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) && msg) {
775
+ this.$showMessage(msg, ['confirm', 'cancel']).then((res) => {
776
+ if (res === 'confirm') {
777
+ debugger
778
+ let url = this.row.f_meter_type.includes('物联网表') ? 'api/af-revenue/logic/changeMeterWebHand' : 'api/af-revenue/logic/changeMeterHand'
779
+ let data = {
780
+ downDate: this.$login.toStandardTimeString(),
781
+ startDate: this.$login.toStandardDateString(),
782
+ endDate: this.$login.toStandardDateString(),
783
+ condition: `f_userfiles_id = '${this.row.f_userfiles_id}'`,
784
+ f_operator: this.$login.f.name,
785
+ f_operatorid: this.$login.f.id,
786
+ f_meternumber: this.row.f_meternumber,
787
+ f_userinfo_id: this.row.f_userinfo_id,
788
+ f_userfiles_id: this.row.f_userfiles_id,
789
+ f_serial_number: this.model.f_serial_number,
790
+ f_meterbase: this.model.f_using_base_old,
791
+ f_meter_brand: this.row.f_meter_brand,
792
+ f_meter_classify: this.row.f_meter_type,
793
+ f_price_id: this.row.f_price_id
794
+ }
795
+ this.$resetpost(url, {data: data}, {resolveMsg: '生成欠费成功', rejectMsg: '生成欠费失败'}).then((res) => {
796
+ console.log('成功')
797
+ if (this.model.metermessage.f_meter_type[0] != '机表') {
798
+ this.$dispatch('refresh')
799
+ } else {
800
+ this.saveobj()
801
+ }
802
+ })
803
+ } else {
804
+
805
+ }
806
+ })
807
+ } else {
808
+ 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))) {
809
+ await this.$showMessage(`该表可能存在超用,请确定是否继续进行换表操作!!!,或者取消进入超用收费!`, ['confirm', 'cancel']).then((res) => {
810
+ if (res === 'confirm') {
811
+ this.saveobj()
812
+ } else {
813
+ }
814
+ })
815
+ } else {
816
+ this.saveobj()
817
+ }
818
+ }
819
+ },
820
+ async saveobj () {
821
+ try {
822
+ const oldMeterSnapshot = Object.assign({}, this.row)
823
+ // 换表前先保存卡表抄见,随后调整内存中的版本以避免乐观锁冲突
824
+ if (oldMeterSnapshot.f_meter_type == '气量卡表' || oldMeterSnapshot.f_meter_type == '金额卡表') {
825
+ await this.saveCardHandRecord(oldMeterSnapshot)
826
+ if (typeof this.row.version !== 'undefined') {
827
+ this.row.version = (this.row.version || 0) + 1
828
+ }
829
+ }
830
+ this.model.f_operator = this.$login.f.name
831
+ this.model.f_operatorid = this.$login.f.id
832
+ this.model.f_orgid = this.$login.f.orgid
833
+ this.model.f_orgname = this.$login.f.orgs
834
+ this.model.f_depid = this.$login.f.depids
835
+ this.model.f_depname = this.$login.f.deps
836
+ this.model.f_zoneid = this.$login.f.zoneid
837
+ this.model.f_zones = this.$login.f.zones
838
+ this.model.alldue_fee = this.alldue_fee
839
+ let data = {
840
+ model: this.model,
841
+ f_meter_book: this.newinfo.f_meter_book[0],
842
+ old: this.row
843
+ }
844
+ // 如果更新了气价
845
+ if (this.newinfo.pricename.length > 0) {
846
+ data.newinfo = this.newinfo.pricename[0].f_price_id
847
+ }
848
+ let meterinfo = await this.$resetpost('api/af-revenue/logic/changeMeter', data, {
849
+ resolveMsg: null,
850
+ rejectMsg: '换表失败!!!'
851
+ })
852
+
853
+ if (this.config.showupload) {
854
+ let param = []
855
+ for (let row of this.resid) {
856
+ param.push({id: row.id})
857
+ }
858
+ let data1 = {
859
+ param: param,
860
+ f_blobid: meterinfo.data.id
861
+ }
862
+ console.log('-------------------------->', data1)
863
+ await this.$resetpost('api/af-revenue/logic/updatefiles', data1)
864
+ }
865
+ // 赋值【新表id】
866
+ this.row.f_userfiles_id = meterinfo.data.new_userfiles_id
867
+
868
+ if (this.newinfo.pricename.length > 0) {
869
+ let param = {
870
+ f_userinfo_id: this.row.f_userinfo_id,
871
+ f_userfiles_id: this.row.f_userfiles_id,
872
+ f_user_id: this.row.f_user_id,
873
+ f_user_name: this.row.f_user_name,
874
+ f_user_type: this.newinfo.f_user_type[0],
875
+ f_gasproperties: this.newinfo.f_gasproperties[0],
876
+ f_price_type: this.newinfo.pricetype[0],
877
+ f_price_id: this.newinfo.pricename[0].f_price_id,
878
+ f_filialeid: this.$login.f.orgid,
879
+ f_operator: this.$login.f.name,
880
+ f_operatorid: this.$login.f.id,
881
+ f_orgid: this.$login.f.orgid,
882
+ f_orgname: this.$login.f.orgs,
883
+ f_depid: this.$login.f.depids,
884
+ f_depname: this.$login.f.deps,
885
+ f_perform_date: this.newinfo.f_perform_date,
886
+ f_change_reason: '换表调价'
887
+ }
888
+
889
+ await this.$resetpost('api/af-revenue/logic/user_pricechange', {data: param}, {resolveMsg: '更新气价成功', rejectMsg: '更新气价失败'})
890
+ }
891
+ // 开始打票
892
+ if (this.config.hasPrint) {
893
+ if (this.model.f_print.indexOf('电子发票') == -1) {
894
+ if (this.config.hasBillManage) {
895
+ // 启用发票管理,获取票据管理中的票号并存储记录
896
+ this.row.id = meterinfo.data.id
897
+ this.row.f_bill_type = '换表'
898
+ this.row.f_bill_style = this.model.f_print[0]
899
+ this.print = true
900
+ } else {
901
+ this.row.id = meterinfo.data.id
902
+ this.print = true
903
+ }
904
+ } else {
905
+ this.printok()
906
+ }
907
+ } else {
908
+ if (!this.config.approve) {
909
+ this.printok()
910
+ }
911
+ }
912
+
913
+ if (this.config.dispatch) {
914
+ await this.$showMessage(`是否添加派工单`, ['confirm', 'cancel']).then((res) => {
915
+ if (res === 'confirm') {
916
+ let batch = {
917
+ sf_id: meterinfo.data.id,
918
+ f_userinfo_code: this.row.f_userinfo_code,
919
+ f_dispathch_name: this.row.f_user_name,
920
+ f_phone: this.row.f_user_phone,
921
+ f_dispathch_address: this.row.f_address,
922
+ f_dispathch_type: '安装',
923
+ f_source: '换表',
924
+ f_remarks: this.model.f_comments,
925
+ f_operator_date: this.$login.toStandardTimeString(),
926
+ f_orgid: this.$login.f.orgid,
927
+ f_dispathch_state: '待分配'
928
+ }
929
+ console.log('111:', batch)
930
+ this.$resetpost('api/af-revenue/logic/savePatch', batch).then((res1) => {
931
+ // this.params.rows.splice(index, 1)
932
+ console.log('更新成功!--------------------->', res1.data.id)
933
+ })
934
+ }
935
+ })
936
+ }
937
+ if (this.config.approve) {
938
+ console.log('存储换表业务信息')
939
+ await this.$dispatch('futureapply', meterinfo)
940
+ }
941
+ } catch (error) {
942
+ console.log('抛出的错误。。', error)
943
+ let res = error.data.toString()
944
+ this.$showAlert(res, 'danger', 2000)
945
+ this.$dispatch('refresh')
946
+ }
947
+ },
948
+ async pregasChange () {
949
+ if (parseInt(this.model.f_using_base_old) < parseInt(this.row.f_meter_base)) {
950
+ await this.$showMessage(`录入旧表底数小于系统就表底数请再次核对!`, ['confirm', 'cancel']).then((res) => {
951
+ if (res === 'confirm') {
952
+ } else {
953
+ this.model.f_using_base_old = ''
954
+ }
955
+ })
956
+ }
957
+ this.commitflag = false
958
+ // 每种表对应的计算方式都不一样
959
+ if (this.row.f_meter_type == '气量卡表') {
960
+ this.calGasCardRemanent()
961
+ } else if (this.row.f_meter_type == '金额卡表') {
962
+ // this.$showAlert('金额卡表换表尚在开发中,敬请期待!!', 'warning', 5000)
963
+ // this.$dispatch('refresh')
964
+ this.calMoneyCardRemanent()
965
+ } else if (this.row.f_meter_type == '物联网表') {
966
+ this.Iotjisuan()
967
+ }
968
+ let msg = ''
969
+ if (this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) {
970
+ let a = this.config.castInt ? parseInt(this.model.f_using_base_old) : this.model.f_using_base_old
971
+ let b = this.config.castInt ? parseInt(this.row.f_meter_base) : this.row.f_meter_base
972
+ if (a > b) {
973
+ msg = (this.row.f_meter_type === '机表' ? '该用户表底数大于上次抄表底数,请确定是否继续生成欠费记录' : '该用户表底数大于上次抄表底数,请确定是否进行结算')
974
+ } else if (this.row.f_capacity && this.row.f_capacity > 0 && (parseInt(this.model.f_using_base_old) < parseInt(this.row.f_meter_base))) {
975
+ msg = '该用户表底数大于上次抄表底数,且已超越最大量程,请确定是否继续生成欠费记录'
976
+ }
977
+ }
978
+ if ((this.row.f_meter_type.includes('机表') || this.row.f_meter_type.includes('物联网表')) && msg) {
979
+ this.$showMessage(msg, ['confirm', 'cancel']).then((res) => {
980
+ if (res === 'confirm') {
981
+ let url = this.row.f_meter_type.includes('物联网表') ? 'api/af-revenue/logic/changeMeterWebHand' : 'api/af-revenue/logic/changeMeterHand'
982
+ let data = {
983
+ downDate: this.$login.toStandardTimeString(),
984
+ startDate: this.$login.toStandardDateString(),
985
+ endDate: this.$login.toStandardDateString(),
986
+ condition: `f_userfiles_id = '${this.row.f_userfiles_id}'`,
987
+ f_operator: this.$login.f.name,
988
+ f_operatorid: this.$login.f.id,
989
+ f_meternumber: this.row.f_meternumber,
990
+ f_userinfo_id: this.row.f_userinfo_id,
991
+ f_userfiles_id: this.row.f_userfiles_id,
992
+ f_serial_number: this.model.f_serial_number,
993
+ f_meterbase: this.model.f_using_base_old,
994
+ f_meter_brand: this.row.f_meter_brand,
995
+ f_meter_classify: this.row.f_meter_type,
996
+ f_price_id: this.row.f_price_id
997
+ }
998
+ this.$resetpost(url, {data: data}, {resolveMsg: '生成欠费成功', rejectMsg: '生成欠费失败'}).then((res) => {
999
+ console.log('成功')
1000
+ if (this.row.f_meter_type.includes('物联网表')) {
1001
+ this.$dispatch('refresh')
1002
+ } else {
1003
+ this.$dispatch('resflushrowdata')
1004
+ // this.$dispatch('button-specifies', {name: '机表收费', value: 'machine-charge'}, this.row)
1005
+ }
1006
+ })
1007
+ }
1008
+ })
1009
+ }
1010
+ },
1011
+ async Iotjisuan () {
1012
+ let gas = (this.model.f_using_base_old - 0) - (this.row.f_meter_base - 0)
1013
+ let getAmount = await this.$CommonService.gasCalculate(this.row, gas)
1014
+ let money = getAmount.data.chargenum
1015
+ },
1016
+ typeChange () {
1017
+ if (this.model.f_type.includes('清零')) {
1018
+ let oldMeter = {
1019
+ f_meter_type: this.row.f_meter_type,
1020
+ f_collection_type: this.row.f_collection_type
1021
+ }
1022
+ let newMeter = {
1023
+ f_meter_type: this.row.f_meter_type,
1024
+ f_collection_type: this.row.f_collection_type
1025
+ }
1026
+ let res = this.$ChangeMeter.changeMeter(oldMeter, newMeter, this.row)
1027
+ console.log('看看新旧表的转换结果', res)
1028
+ this.changeType = res.name
1029
+ } else {
1030
+ this.changeType = ''
1031
+ }
1032
+ },
1033
+
1034
+ initData () {
1035
+ this.commitflag = false
1036
+ if (this.row.f_meter_type == '物联网表') {
1037
+ // 判断是否需要结算
1038
+ if (this.row.f_collection_type == '按气量') {
1039
+ this.calGasIOTRemanent()
1040
+ } else {
1041
+ this.calMoneyIOTRemanent()
1042
+ }
1043
+ } else if (this.row.f_meter_type == '机表') {
1044
+ this.validateOwe()
1045
+ } else {
1046
+ this.pregasChange()
1047
+ }
1048
+ },
1049
+
1050
+ calGasCardRemanent () {
1051
+ // 拿到旧表底数 和【累计购气量+初始底数】比较 这里剩余气量如果是清零补气的就不加,如果是换表补气的就加
1052
+ let param = this.row.f_total_gas + this.row.f_initial_base
1053
+
1054
+ if (this.row.f_remanent_type == 1) {
1055
+ param += this.row.f_remanent_gas
1056
+ }
1057
+
1058
+ if (this.model.f_using_base_old > param) {
1059
+ this.$showAlert('该表可能存在超用,请核实输入后进行换表操作!!', 'warning', 5000)
1060
+ this.$dispatch('refresh')
1061
+ }
1062
+ this.model.f_remanent_gas = (param - (this.model.f_using_base_old - 0)).toFixed(this.getGasDecimalPlaces())
1063
+ },
1064
+
1065
+ calMoneyCardRemanent () {
1066
+ if (!this.model.f_remanent_money) {
1067
+ this.model.f_remanent_money = ''
1068
+ }
1069
+ let param = this.row.f_total_gas + this.row.f_initial_base
1070
+
1071
+ if (this.row.f_remanent_type == 1) {
1072
+ param += this.row.f_remanent_gas
1073
+ }
1074
+
1075
+ if (this.model.f_using_base_old > param) {
1076
+ this.$showAlert('该表可能存在超用,请核实输入后进行换表操作!!', 'warning', 5000)
1077
+ this.$dispatch('refresh')
1078
+ }
1079
+ this.model.f_remanent_gas = (param - (this.model.f_using_base_old - 0)).toFixed(this.getGasDecimalPlaces())
1080
+ console.log('金额结算' + this.model.f_remanent_gas)
1081
+ if (this.model.f_remanent_price > 0) {
1082
+ this.model.f_remanent_gas = (param - (this.model.f_using_base_old - 0)).toFixed(this.getGasDecimalPlaces())
1083
+ this.model.f_remanent_money = ((this.model.f_remanent_gas - 0) * (this.model.f_remanent_price - 0)).toFixed(4)
1084
+ if (this.row.f_remanent_gas > 0) {
1085
+ 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)
1086
+ } else if (this.row.f_remanent_money > 0) {
1087
+ this.model.f_remanent_money = (this.model.f_remanent_money - 0) + (this.row.f_remanent_money - 0)
1088
+ }
1089
+ console.log('金额结算' + this.model.f_remanent_money)
1090
+ }
1091
+ },
1092
+
1093
+ calGasIOTRemanent () {
1094
+ this.model.f_remanent_gas = (this.row.f_balance_gas - 0)
1095
+ if (this.row.f_remanent_type == 1) {
1096
+ this.model.f_remanent_gas += (this.row.f_remanent_gas - 0)
1097
+ }
1098
+ },
1099
+ calMoneyIOTRemanent () {
1100
+ this.model.f_remanent_money = (this.row.f_balance_amount - 0).toFixed(4)
1101
+ if (this.row.f_remanent_type == 1) {
1102
+ if (this.row.f_remanent_gas > 0) {
1103
+ 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)
1104
+ } else if (this.row.f_remanent_money > 0) {
1105
+ this.model.f_remanent_money = (this.model.f_remanent_money - 0) + (this.row.f_remanent_money - 0)
1106
+ }
1107
+ }
1108
+ },
1109
+
1110
+ gasModelChange (val) {
1111
+ console.log('新表信息', val)
1112
+ if (val.length > 0) {
1113
+ this.commitflag = false
1114
+ // 新气表信息已选
1115
+ let oldMeter = {
1116
+ f_meter_type: this.row.f_meter_type,
1117
+ f_collection_type: this.row.f_collection_type
1118
+ }
1119
+ let newMeter = {
1120
+ f_meter_type: val[0].f_meter_type,
1121
+ f_collection_type: val[0].f_collection_type
1122
+ }
1123
+ let res = this.$ChangeMeter.changeMeter(oldMeter, newMeter, this.row)
1124
+ console.log('看看新旧表的转换结果', res)
1125
+ this.changeType = res.name
1126
+
1127
+ // 根据新表品牌重新计算补气量的小数位数
1128
+ if (this.model.f_remanent_gas) {
1129
+ if (val[0].f_meter_brand === '秦川卡表') {
1130
+ this.model.f_remanent_gas = (this.model.f_remanent_gas - 0).toFixed(2)
1131
+ } else if (val[0].f_meter_brand === '重庆精益民用') {
1132
+ this.model.f_remanent_gas = (this.model.f_remanent_gas - 0).toFixed(1)
1133
+ } else {
1134
+ this.model.f_remanent_gas = (this.model.f_remanent_gas - 0).toFixed(4)
1135
+ }
1136
+ }
1137
+ }
1138
+ },
1139
+
1140
+ remanentChange () {
1141
+ this.commitflag = true
1142
+ // 气量转金额 或者 金额转气量的时候对气量和金额不做限制, 可以修改, 但是只变单价
1143
+ this.model.f_remanent_price = ((this.model.f_remanent_money) / (this.model.f_remanent_gas)).toFixed(4)
1144
+ if (this.model.f_remanent_price == 'NaN') {
1145
+ this.model.f_remanent_price = 0
1146
+ }
1147
+ },
1148
+
1149
+ async validateOwe () {
1150
+ let http = new HttpResetClass()
1151
+ // 有欠费是否能换表 如果能则需要获取到欠费金额
1152
+ if (this.config.hasArrearsChange) {
1153
+ let res = await http.load('POST', 'api/af-revenue/logic/sale_getOwe', {data: {f_userinfo_id: this.row.f_userinfo_id}}, {resolveMsg: null, rejectMsg: '获取欠费出错!!'})
1154
+ let owes = []
1155
+ for (let i = 0; i < res.data.length; i++) {
1156
+ for (let j = 0; j < res.data[i].rows.length; j++) {
1157
+ owes.push(res.data[i].rows[j])
1158
+ }
1159
+ }
1160
+ console.log('获取到的欠费记录', owes)
1161
+ this.alldue_fee = owes.reduce((total, item) => {
1162
+ return total + (item.f_oughtfee + item.overdue - item.f_debt_money)
1163
+ }, 0)
1164
+ console.log('总欠费金额为', this.alldue_fee)
1165
+ this.books = owes
1166
+ } else {
1167
+ // 如果 不能 则只需要获取到记录数,采用相对节省资源的查询
1168
+ let books = await http.load('POST', 'api/af-revenue/sql/singleTable_OrderBy', {
1169
+ data: {
1170
+ items: 'f_whether_pay',
1171
+ tablename: 't_handplan',
1172
+ condition: ` f_user_id = '${this.row.f_user_id}' and f_oughtfee > 0 and f_hand_state = '有效' and f_meter_state='已抄表' `,
1173
+ orderitem: ' id desc'
1174
+ }
1175
+ }, {resolveMsg: null, rejectMsg: null}
1176
+ )
1177
+ console.log('获取到的欠费记录', books)
1178
+ this.books = books
1179
+ // 如果是机表验证是否有欠费
1180
+ if ((this.row.f_balance - 0) < 0) {
1181
+ this.$showAlert('该表有欠费,请到机表缴费界面进行缴费', 'warning', 3000)
1182
+ this.$dispatch('button-specifies', {name: '机表收费', value: 'machine-charge'}, this.row)
1183
+ }
1184
+ }
1185
+ },
1186
+ getComments (array) {
1187
+ let str = '剩余补气量中,'
1188
+ array.forEach((item) => {
1189
+ str = str + '单价:' + item.price + '补气量为:' + item.gas + 'm³,'
1190
+ })
1191
+ str += '折算后补气量为' + this.model.f_remanent_gas + 'm³,补气金额为' + this.model.f_remanent_money + '元,平均单价为' + this.model.f_remanent_price + '元'
1192
+ this.model.f_comments = str
1193
+ },
1194
+ allocateGas (totalGas, rates, price) {
1195
+ let remainingGas = totalGas
1196
+ const allocations = []
1197
+ let totalAmount = 0
1198
+
1199
+ for (const rate of rates) {
1200
+ if (remainingGas <= 0) break // 如果剩余气量为0或负数,跳出循环
1201
+ if (remainingGas >= rate.f_gas) {
1202
+ // 如果剩余气量大于等于当前条目的气量
1203
+ allocations.push({
1204
+ gas: rate.f_gas,
1205
+ price: rate.f_price,
1206
+ amount: rate.f_money
1207
+ })
1208
+ totalAmount += parseFloat(rate.f_money)
1209
+ remainingGas -= rate.f_gas
1210
+ } else {
1211
+ // 如果剩余气量小于当前条目的气量
1212
+ allocations.push({
1213
+ gas: remainingGas,
1214
+ price: rate.f_price,
1215
+ amount: parseFloat((remainingGas * rate.f_price).toFixed(4))
1216
+ })
1217
+ totalAmount += parseFloat((remainingGas * rate.f_price).toFixed(4))
1218
+ remainingGas = 0 // 剩余气量设置为0
1219
+ break // 跳出循环
1220
+ }
1221
+ }
1222
+ // 如果遍历完所有条目后仍有剩余气量
1223
+ if (remainingGas > 0) {
1224
+ allocations.push({
1225
+ gas: remainingGas,
1226
+ price: price,
1227
+ amount: parseFloat((remainingGas * price).toFixed(4))
1228
+ })
1229
+ totalAmount += parseFloat((remainingGas * price).toFixed(4))
1230
+ }
1231
+ this.model.f_remanent_price = (totalAmount / this.model.f_remanent_gas).toFixed(4)
1232
+ this.model.f_remanent_money = totalAmount
1233
+ // 计算公式
1234
+ this.getComments(allocations)
1235
+ },
1236
+ // 新增:根据表品牌返回补气量小数位数
1237
+ getGasDecimalPlaces() {
1238
+ if (this.model.metermessage.gasbrand && this.model.metermessage.gasbrand[0]) {
1239
+ if (this.model.metermessage.gasbrand[0].f_meter_brand === '秦川卡表') {
1240
+ return 2
1241
+ } else if (this.model.metermessage.gasbrand[0].f_meter_brand === '重庆精益民用') {
1242
+ return 1
1243
+ }
1244
+ }
1245
+ return 4
1246
+ }
1247
+ },
1248
+ watch: {
1249
+ 'row' () {
1250
+ console.log('-------------------------------')
1251
+ console.log(this.row)
1252
+ },
1253
+ 'model.metermessage.f_meter_type' (val) {
1254
+ console.log(val)
1255
+ if (val.length > 0) {
1256
+ if (val[0] != '气量卡表' && this.row.f_meter_type == '气量卡表') {
1257
+ this.allocateGas(this.model.f_remanent_gas, this.chargePrices, this.model.f_remanent_price)
1258
+ } else {
1259
+ if (this.model.f_comments) {
1260
+ this.model.f_comments = ''
1261
+ }
1262
+ }
1263
+ }
1264
+ },
1265
+ 'model.f_remanent_money' (val) {
1266
+ console.log('观察补气金额', val)
1267
+ if (!this.isGas) {
1268
+ if (this.model.f_remanent_price) {
1269
+ this.model.f_remanent_gas = (val / this.model.f_remanent_price).toFixed(this.getGasDecimalPlaces())
1270
+ } else {
1271
+ this.model.f_remanent_gas = 0
1272
+ }
1273
+ }
1274
+ if (this.model.f_using_base_old) {
1275
+ this.commitflag = true
1276
+ }
1277
+ },
1278
+ 'model.f_remanent_gas' (val, val2) {
1279
+ console.log('观察补气量', val)
1280
+ if (this.isGas) {
1281
+ if (this.row.f_meter_type == '气量卡表' && this.model.metermessage.f_meter_type[0] && this.model.metermessage.f_meter_type[0] != '气量卡表') {
1282
+ if (this.chargePrices.length < 1) {
1283
+ this.model.f_remanent_money = (val / this.model.f_remanent_price).toFixed(4)
1284
+ } else {
1285
+ this.allocateGas(this.model.f_remanent_gas, this.chargePrices, this.model.f_remanent_price)
1286
+ }
1287
+ } else {
1288
+ if (this.model.f_remanent_price > 0) {
1289
+ this.model.f_remanent_money = (val * this.model.f_remanent_price).toFixed(4)
1290
+ }
1291
+ }
1292
+ }
1293
+ if (this.model.f_using_base_old) {
1294
+ this.commitflag = true
1295
+ }
1296
+ },
1297
+ 'dataModel' (val) {
1298
+ console.log('看看dataModel的值:', val)
1299
+ if (val) {
1300
+ this.$nextTick(() => {
1301
+ this.model = Object.assign({}, this.model, val)
1302
+ this.resid = this.model.filesids
1303
+ })
1304
+ }
1305
+ console.log('看看this.model的值:', this.model)
1306
+ },
1307
+ 'newinfoData' (val) {
1308
+ console.log('看看newinfoData的值:', val)
1309
+ if (val) {
1310
+ this.$nextTick(() => {
1311
+ this.newinfo = Object.assign({}, this.newinfo, val)
1312
+ })
1313
+ }
1314
+ console.log('看看this.newinfo的值:', this.newinfo)
1315
+ }
1316
+ }
1317
+ }
1318
+ </script>
1319
+ <style lang="less">
1320
+ #ChangeMeter {
1321
+ .col-sm-4 {
1322
+ .font_normal_body {
1323
+ width: 73px;
1324
+ overflow: auto;
1325
+ white-space: nowrap;
1326
+ // 指滚动条两边的按钮
1327
+ &::-webkit-scrollbar-button {
1328
+ display: none;
1329
+ }
1330
+ // 滚动条的宽度
1331
+ &::-webkit-scrollbar {
1332
+ width: 5px !important;
1333
+ height: 5px !important;
1334
+ }
1335
+ // 滚动条的设置
1336
+ &::-webkit-scrollbar-thumb {
1337
+ background-color: #ddd;
1338
+ background-clip: padding-box;
1339
+ }
1340
+ &::-webkit-scrollbar-thumb:hover {
1341
+ background-color: #bbb;
1342
+ }
1343
+ &::-webkit-scrollbar-track {
1344
+ /*滚动条里面轨道*/
1345
+ box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
1346
+ background: #ededed;
1347
+ }
1348
+ }
1349
+ }
1350
+ }
1351
+ </style>