sale-client 3.5.12 → 3.5.13

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,801 +1,801 @@
1
- <template>
2
- <div id="unit" class="flex-row">
3
- <div class="basic-main">
4
- <div class="flex">
5
- <criteria-paged :model="model" v-ref:paged>
6
- <criteria partial='criteria' v-ref:criteria @condition-changed="$parent.selfSearch">
7
- <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
8
- <div class="row">
9
- <div class="form-group col-sm-2">
10
- <label class="font_normal_body">组织机构</label>
11
- <res-select
12
- :initresid='$parent.$parent.curorgid'
13
- @res-select="$parent.$parent.getorg"
14
- is-mul="false"
15
- restype='organization'
16
- >
17
- </res-select>
18
- </div>
19
- <div class="form-group col-sm-2" >
20
- <label class="font_normal_body">客户编号</label>
21
- <input type="text" class="input_search" style="width:60%"
22
- v-model="model.f_userinfo_code" placeholder='客户编号'
23
- condition="f_userinfo_code = '{}'" >
24
- </div>
25
- <div class="form-group col-sm-2">
26
- <label class="font_normal_body">客户名称</label>
27
- <input type="text" class="input_search" style="width:60%"
28
- v-model="model.f_user_name" placeholder='客户名称'
29
- condition="f_user_name like '%{}%'">
30
- </div>
31
-
32
- <div class="form-group col-sm-2">
33
- <label class="font_normal_body" style="color: #c52323">气价变更时间</label>
34
- <datepicker placeholder="气价变更时间"
35
- style="padding: 2px;width: 60%"
36
- v-model="model.f_change_date"
37
- :value.sync="model.f_change_date"
38
- :format="'yyyy-MM-dd'"
39
- ></datepicker>
40
- </div>
41
- <div class="span" style="float:right;">&nbsp;&nbsp;
42
- <button class="button_new" style="width: max-content" v-show="$parent.$parent.pricechange" @click="$parent.$parent.priceshow()">批量调价</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
43
- <button class="button_search" @click="search()" v-el:cx>查询</button>
44
- <button class="button_clear" @click="$parent.$parent.clear()">清空</button>
45
- <div style="float: right" class="button_spacing"
46
- :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"
47
- @click="$parent.$parent.hidden()"></div>
48
- </div>
49
- </div>
50
- <div class="row" v-show="$parent.$parent.criteriaShow">
51
- <div class="form-group col-sm-2" >
52
- <label class="font_normal_body">开始日期</label>
53
- <datepicker placeholder="开始日期"
54
- style="width:60%"
55
- v-model="model.startDate"
56
- :value.sync="model.startDate"
57
- :format="'yyyy-MM-dd'"
58
- ></datepicker>
59
- </div>
60
- <div class="form-group col-sm-2" >
61
- <label class="font_normal_body">结束日期</label>
62
- <datepicker placeholder="结束日期"
63
- style="width:60%"
64
- v-model="model.endDate"
65
- :value.sync="model.endDate"
66
- :format="'yyyy-MM-dd'"
67
- ></datepicker>
68
- </div>
69
- <div class="form-group col-sm-2">
70
- <label class="font_normal_body">客户地址</label>
71
- <input type="text" class="input_search" style="width:60%" style="width:60%" v-model="model.f_address" placeholder='客户地址'
72
- condition="u3.f_address like '%{}%'">
73
- </div>
74
- <div class="form-group col-sm-2">
75
- <label class="font_normal_body">电&emsp;&emsp;话</label>
76
- <input type="text" class="input_search" style="width:60%" v-model="model.f_user_phone" placeholder='电话'
77
- condition="f_user_phone like '%{}%'">
78
- </div>
79
- <div class="form-group col-sm-2">
80
- <label class="font_normal_body">表&emsp;&emsp;号</label>
81
- <input type="text" class="input_search" style="width:60%" style="width:60%" v-model="model.f_meternumber" placeholder='表号'
82
- condition="f_meternumber like '%{}%'">
83
- </div>
84
- <div class="form-group col-sm-2">
85
- <label class="font_normal_body">状&emsp;&emsp;态</label>
86
- <v-select id="price_states"
87
- v-model="model.price_states"
88
- placeholder='请选择'
89
- style="width: 60%"
90
- :value.sync="model.price_states"
91
- :options='$parent.$parent.price_states'
92
- condition="f_new_price {}"
93
- close-on-select></v-select>
94
- </div>
95
- <div class="form-group col-sm-2">
96
- <label class="font_normal_body">气表类型</label>
97
- <v-select id="f_source"
98
- v-model="model.f_source"
99
- placeholder='气表类型'
100
- style="width: 60%"
101
- :value.sync="model.f_source"
102
- :options='$parent.$parent.source'
103
- condition="f_source='{}'"
104
- close-on-select></v-select>
105
- </div>
106
- <div class="form-group col-sm-2">
107
- <label class="font_normal_body">用户类型</label>
108
- <v-select id="f_user_tye"
109
- v-model="model.f_user_type"
110
- placeholder='用户类型'
111
- style="width: 60%"
112
- @change="$parent.$parent.userTypeChange"
113
- :value.sync="model.f_user_type"
114
- :options='$parent.$parent.userTypes'
115
- condition="u2.f_user_type = '{}'"
116
- close-on-select></v-select>
117
- </div>
118
- <div class="form-group col-sm-2">
119
- <label class="font_normal_body">气&emsp;&emsp;价</label>
120
- <v-select id="f_price_name"
121
- v-model="model.price_name"
122
- placeholder='气价名称'
123
- style="width: 60%"
124
- :value.sync="model.price_name"
125
- :options='$parent.$parent.price_name'
126
- condition="u1.f_stairprice_id = '{}'"
127
- close-on-select></v-select>
128
- </div>
129
- <div class="form-group col-sm-2">
130
- <label class="font_normal_body">系统气价</label>
131
- <v-select id="f_price"
132
- v-model="model.f_price"
133
- placeholder='系统气价'
134
- style="width: 60%"
135
- :value.sync="model.f_price"
136
- :options='$parent.$parent.f_prices'
137
- condition="dp.f_price = '{}'"
138
- close-on-select></v-select>
139
- </div>
140
- <div class="col-sm-2 form-group">
141
- <label class="font_normal_body">抄&ensp;表&ensp;员</label>
142
- <v-select :value.sync="model.f_inputtor" v-model='model.f_inputtor'
143
- style="width:60%"
144
-
145
- :options='$parent.$parent.inputtoreser' placeholder='抄表员'
146
- @change="$parent.$parent.inputtorchange"
147
- close-on-select
148
- v-el:cc></v-select>
149
- </div>
150
- <!--表册片区-->
151
- <div class="col-sm-2 form-group">
152
- <label class="font_normal_body">表册片区</label>
153
- <v-select :value.sync="model.f_book_slice_area" v-model="model.f_book_slice_area"
154
- :options='$parent.$parent.bookSliceArea' placeholder='表册片区'
155
- multiple
156
- style="width:60%"
157
- @change="$parent.$parent.sliceChange"
158
- close-on-select
159
- condition="f_book_slice_area in {}"></v-select>
160
- </div>
161
- <div class="col-sm-2 form-group">
162
- <label class="font_normal_body">抄&ensp;表&ensp;册</label>
163
- <v-select :value.sync="model.f_meter_book" v-model="model.f_meter_book"
164
- :options='$parent.$parent.meterbooks' placeholder='抄表册'
165
- multiple
166
- style="width:60%"
167
- close-on-select
168
- condition="f_meter_book_num in {}"></v-select>
169
- </div>
170
- </div>
171
- </div>
172
- </criteria>
173
- <data-grid :model="model" partial='list' class="list_area table_sy" v-ref:grid>
174
- <template partial='head'>
175
- <tr>
176
- <th>
177
- <nobr>序号</nobr>
178
- </th>
179
- <th>
180
- <nobr>客户编号</nobr>
181
- </th>
182
- <th>
183
- <nobr>表号</nobr>
184
- </th>
185
- <th>
186
- <nobr>姓名</nobr>
187
- </th>
188
- <th>
189
- <nobr>用户类型</nobr>
190
- </th>
191
- <th>
192
- <nobr>气表类型</nobr>
193
- </th>
194
- <th>
195
- <nobr>气价名称</nobr>
196
- </th>
197
- <!-- <th><nobr>地址</nobr></th>-->
198
- <th>
199
- <nobr>系统气价</nobr>
200
- </th>
201
- <th>
202
- <nobr>输入气价</nobr>
203
- </th>
204
- <th>
205
- <nobr>补差单价</nobr>
206
- </th>
207
- <th>
208
- <nobr>补差金额</nobr>
209
- </th>
210
- <th>
211
- <nobr>调价时间</nobr>
212
- </th>
213
- <th>
214
- <nobr>调价时间类型</nobr>
215
- </th>
216
- <th>
217
- <nobr>上期底数</nobr>
218
- </th>
219
- <th>
220
- <nobr>本期底数</nobr>
221
- </th>
222
- <th>
223
- <nobr>用气量</nobr>
224
- </th>
225
- <th>
226
- <nobr>补差气量(调价前)</nobr>
227
- </th>
228
- <th>
229
- <nobr>补差天数(调价前)</nobr>
230
- </th>
231
- <th>
232
- <nobr>补差气量(调价后)</nobr>
233
- </th>
234
- <th>
235
- <nobr>补差天数(调价后)</nobr>
236
- </th>
237
- <th>
238
- <nobr>平均补差气量</nobr>
239
- </th>
240
-
241
- <th>
242
- <nobr>差价来源</nobr>
243
- </th>
244
- <th>
245
- <nobr>本次抄表日期</nobr>
246
- </th>
247
- <th>
248
- <nobr>上次抄表日期</nobr>
249
- </th>
250
- <th>
251
- <nobr>操作时间</nobr>
252
- </th>
253
- <th>
254
- <nobr>操作</nobr>
255
- </th>
256
- </tr>
257
- </template>
258
- <template partial='body'>
259
- <td style="text-align: center;">{{$index+1}}</td>
260
- <th style="text-align: center;">{{row.f_userinfo_code}}</th>
261
- <th style="text-align: center;">{{row.f_meternumber}}</th>
262
- <th style="text-align: center;">{{row.f_user_name}}</th>
263
- <th style="text-align: center;">{{row.f_user_type}}</th>
264
- <th style="text-align: center;">{{row.f_meter_type}}</th>
265
- <th style="text-align: center;">{{row.f_price_name}}</th>
266
- <!-- <th style="text-align: center;">{{row.f_address}}</th>-->
267
- <th style="text-align: center;">{{row.f_old_price?row.f_old_price:row.f_price}}</th>
268
- <th style="text-align: center;">
269
- <div class="form-group" style="margin-bottom:0px;"
270
- v-if="!row.f_new_price>0">
271
- <!-- <input type="text" class="form-control" v-model="row.newprice" @blur="$parent.$parent.$parent.enter(row)"-->
272
- <!-- v-next-el="{id: $index+1}" :id="$index" style="width: 100px;padding: 6px;" :disabled="row.state === '开始'">-->
273
- <input v-if="false" type="text" class="form-control" v-model="row.newprice"
274
- @blur="$parent.$parent.$parent.calculation(row)"
275
- v-next-el="{id: $index+1}" :id="$index" style="width: 100px;padding: 6px;"
276
- :disabled="row.state === '开始'">
277
- <button type="button" name="button" class="button_search-2 button_spacing width-60"
278
- @click.stop="$parent.$parent.$parent.calculation(row) && row.states === 1">单户调价
279
- </button>
280
- </div>
281
- <div v-else>{{row.f_new_price}}</div>
282
- </th>
283
- <th style="text-align: center;">{{row.f_change_price}}</th>
284
- <th style="text-align: center;">{{row.f_surplus_fee}}</th>
285
- <th style="text-align: center;">{{row.f_change_date}}</th>
286
- <th style="text-align: center;">{{row.f_changetime_type}}</th>
287
- <th style="text-align: center;">{{row.f_last_tablebase}}</th>
288
- <th style="text-align: center;">{{row.f_tablebase}}</th>
289
- <th style="text-align: center;">{{row.f_tablebase-row.f_last_tablebase}}</th>
290
- <th style="text-align: center;">{{row.startpregas}}</th>
291
- <th style="text-align: center;">{{row.startday}}</th>
292
- <th style="text-align: center;">{{row.endpregas}}</th>
293
- <th style="text-align: center;">{{row.endday}}</th>
294
- <th style="text-align: center;">{{row.avgpregas}}</th>
295
-
296
- <th style="text-align: center;">{{row.f_source}}</th>
297
- <th style="text-align: center;">{{row.f_input_date}}</th>
298
- <th style="text-align: center;">{{row.f_last_input_date}}</th>
299
- <th style="text-align: center;">{{row.f_operate_date}}</th>
300
- <th style="text-align: center;">
301
- <button type="button" name="button" class="btn btn-link" v-if="row.f_new_price"
302
- @click.stop="$parent.$parent.$parent.delectHand(row) && row.states === 1">冲正
303
- </button>
304
- <!-- <button type="button" name="button" class="btn btn-link" v-if="!row.f_new_price"-->
305
- <!-- @click.stop="$parent.$parent.$parent.enter(row) && row.states === 1">补差-->
306
- <!-- </button>-->
307
- </th>
308
- </template>
309
- </data-grid>
310
- </criteria-paged>
311
- <modal :show.sync="show">
312
- <header slot="modal-header" class="modal-header">
313
- <h4 class="modal-title">调 价 补 差</h4>
314
- </header>
315
- <article slot="modal-body" class="modal-body">
316
- <div class="row">
317
- <div class="form-group col-sm-4">
318
- <label class="font_normal_body">调价时间类型</label>
319
- <v-select v-model="pricetime_states"
320
- placeholder='请选择'
321
- style="width: 60%"
322
- value-single
323
- :value.sync="pricetime_states"
324
- :options='pricetime_statesoptions'></v-select>
325
- </div>
326
- <div class="form-group col-sm-4">
327
- <label class="font_normal_body">价&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格</label>
328
- <input type="text" class="form-control" v-model="f_new_price">
329
- </div>
330
- </div>
331
- </article>
332
- <footer slot="modal-footer" class="modal-footer">
333
- <button class="button_search" @click="priceadjustment">生成调价补差表</button>
334
- <button type="button" class="btn btn-default" @click='close'>取消</button>
335
- </footer>
336
- </modal>
337
- <work-busy :is-busy="locking" v-show="locking"></work-busy>
338
- </div>
339
- </div>
340
- </div>
341
- </template>
342
-
343
- <script>
344
- import {HttpResetClass, PagedList} from 'vue-client'
345
- import Vue from 'vue'
346
- import co from 'co'
347
-
348
- let readySomething = async function (self) {
349
- self.$refs.paged.$refs.criteria.model.startDate = self.$login.toStandardDateString()
350
- self.$refs.paged.$refs.criteria.model.endDate = self.$login.toStandardDateString()
351
- self.$refs.paged.$refs.criteria.model.f_change_date = ''
352
- self.$resetpost('rs/sql/getpriceid', {data: {f_filialeids: self.$login.f.orgid}}, {
353
- resolveMsg: null,
354
- rejectMsg: null
355
- }).then((res) => {
356
- console.log(res.data)
357
- let rs = []
358
- for (let i = 0; i < res.data.length; i++) {
359
- if (res.data[i].f_price_type === '固定气价') {
360
- let temp = {
361
- label: res.data[i].f_price_name,
362
- flage: res.data[i].f_user_type,
363
- value: res.data[i].id
364
- }
365
- rs.push(temp)
366
- }
367
- }
368
- console.log(rs)
369
- self.pricers = [{label: '全部', value: '', flage: ''}, ...rs]
370
- self.$showAlert('请输入[气价变更时间]后进行查询!', 'warning', 2000)
371
- self.pricechange = false
372
- //self.$refs.paged.$refs.criteria.search()
373
- })
374
- }
375
- let asyncReadyGen = async function (self) {
376
- // 获取营收参数
377
- await self.$LoadParams.loadMeterBook(self.f_filialeid)
378
- // self.loadMeterBooks()
379
- // await self.$MagGetSaleParam.initinputtor()
380
- // await self.getinputtores()
381
- // console.log('-----------------', self.$login.f.orgid)
382
- // await self.initSlice(self.$login.f.orgid)
383
- await self.initSlice(self.$login.f.orgid)
384
- await self.getinputtores()
385
- await self.$GetSaleParam.initinputtor()
386
- self.getfield = self.config.excelHeaders
387
- await self.initmeterbook()
388
- self.$refs.paged.$refs.cri.model.performDate = self.$login.toStandardDateString()
389
- self.search()
390
-
391
- }
392
-
393
- export default {
394
- title: '调价补差',
395
- data () {
396
- return {
397
- f_orgid: '',
398
- pricechange: true,
399
- criteriaShow: false,
400
- pricers: [{label: '全部', value: '', flage: ''}],
401
- price_name: [{label: '全部', value: ''}],
402
- price_states: [{label: '全部', value: ''}, {label: '已调价', value: ' >0'}, {label: '未调价', value: ' <=0'}],
403
- pricetime_statesoptions: [{label: '全部', value: ''}, {label: '调价时间前', value: '1'}, {label: '调价时间后', value: '0'}],
404
- source: [{label: '卡表抄表', value: '卡表抄表'}, {label: '机表抄表', value: '机表抄表'}],
405
- userTypes: this.$appdata.getParam('用户类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')] : [],
406
- condition: '',
407
- locking: false,
408
- model: new PagedList('rs/sql/get_UserCharge', 20, {
409
- f_change_date: 'this.model.f_change_date === "" ? "1911-01-01" : this.model.f_change_date',
410
- startDate: 'this.model.startDate',
411
- endDate: 'this.model.endDate',
412
- price_states: 'this.model.price_states[0]',
413
- addSelectParam: 'this.model.addSelectParam'
414
- }),
415
- f_new_price: '',
416
- pricetime_states: '',
417
- show: false,
418
- addSelectParam: '',
419
- meterbooks: [{label: '全部', value: ''}], // 抄表册
420
- inputtoreser: [{label: '全部', value: ''}],
421
- bookSliceArea: [],
422
- inputtores2: [],
423
- curorgid: [this.$login.f.orgid],
424
- f_filialeid: this.$login.f.orgid,
425
- operatortype: '',
426
- operatorrow: {},
427
- f_prices: [{label: '全部', value: ''}]
428
- // joinTable:'',
429
- }
430
- },
431
- ready () {
432
- readySomething(this).then(() => {
433
- this.$emit('ready')
434
- }).catch((error) => {
435
- this.$emit('error', error)
436
- })
437
- this.inputtores2 = this.inputtores
438
- asyncReadyGen(this)
439
- },
440
- methods: {
441
- async sliceChange () {
442
- this.$set('$refs.paged.$refs.criteria.model.f_meter_book', [])
443
- let val2 = this.$refs.paged.$refs.criteria.model.f_book_slice_area
444
- if (val2.length > 0) {
445
- let condition = ` 1=1 and f_orgid ='${this.f_filialeid}' and f_book_state='有效' `
446
- let aaa = '('
447
- val2.forEach((item) => {
448
- aaa = aaa + `'${item}',`
449
- })
450
- aaa = aaa + `'')`
451
- condition = condition + ` and f_book_slice_area in ${aaa} `
452
- let param = {
453
- items: '*',
454
- tablename: 't_meter_book',
455
- condition: condition,
456
- orderitem: 'id'
457
- }
458
- let getMeterBooks = await this.$resetpost('rs/sql/singleTable_OrderBy', {data: param}, {
459
- resolveMsg: null,
460
- rejectMsg: '获取营收参数出错!!!'
461
- })
462
- if (getMeterBooks.data) {
463
- if (getMeterBooks.data.length > 0) {
464
- let rs = []
465
- getMeterBooks.data.forEach((item) => {
466
- let temp = {
467
- label: item.f_book_name,
468
- value: item.id
469
- }
470
- rs.push(temp)
471
- })
472
- this.meterbooks = [{label: '全部', value: ''}, ...rs]
473
- } else {
474
- this.meterbooks = [{label: '全部', value: ''}]
475
- }
476
- }
477
- } else {
478
- this.meterbooks = [{label: '全部', value: ''}]
479
- }
480
- },
481
- async initSlice (val) {
482
- if (val) {
483
- let getAllArea = await this.$resetpost('/rs/search', {
484
- source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
485
- userid: this.$login.f.id
486
- }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
487
- let arr = getAllArea.data.filter((res) => {
488
- return res.parentid == val
489
- })
490
- this.bookSliceArea = []
491
- arr.forEach((res) => {
492
- this.bookSliceArea.push({label: res.name, value: res.name})
493
- })
494
- }
495
- },
496
- async inputtorchange () {
497
- let val = this.$refs.paged.$refs.criteria.model.f_inputtor
498
- if (val != null && val != '') {
499
- let param = {
500
- items: '*',
501
- tablename: 't_meter_book',
502
- condition: ` 1=1 and f_inputtor = '${val}' and f_orgid ='${this.f_filialeid}' and f_book_state='有效' `,
503
- orderitem: 'id'
504
-
505
- }
506
- let getMeterBooks = await this.$resetpost('rs/sql/manage_singleTable', {data: param}, {
507
- resolveMsg: null,
508
- rejectMsg: '获取营收参数出错!!!'
509
- })
510
- if (getMeterBooks.data) {
511
- if (getMeterBooks.data.length > 0) {
512
- let rs = []
513
- getMeterBooks.data.forEach((item) => {
514
- let temp = {
515
- label: item.f_book_name,
516
- value: item.id
517
- }
518
- rs.push(temp)
519
- })
520
- this.meterbooks = [{label: '全部', value: ''}, ...rs]
521
- // this.$set('$refs.paged.$refs.criteria.model.f_meter_book',[getMeterBooks.data[0].id]);
522
- } else {
523
- this.$set('$refs.paged.$refs.criteria.model.f_meter_book', [])
524
- this.meterbooks = [{label: '全部', value: ''}]
525
- }
526
- } else {
527
- this.$set('$refs.paged.$refs.criteria.model.f_meter_book', [])
528
- }
529
- } else {
530
- this.$set('$refs.paged.$refs.criteria.model.f_meter_book', [])
531
- this.meterbooks = [{label: '全部', value: ''}]
532
- this.initmeterbook()
533
- }
534
- },
535
- async initmeterbook (orgstr) {
536
- if (orgstr == null) {
537
- orgstr = this.f_filialeid
538
- }
539
- // 获取新的抄表册,先去清理所有的抄表册
540
- this.$GetSaleParam.meterbooks = []
541
- // 开始加载新的抄表册
542
- await this.$LoadParams.loadMeterBook(orgstr)
543
- this.meterbooks = [{label: '全部', value: ''}, ...this.$GetSaleParam.getMeterBooks()]
544
- },
545
- async updateParams () {
546
- // await this.$MagLoadParams.loadParam(this.f_filialeid)
547
- this.inputtoreser = []
548
- this.inputtoreser.push({label: '全部', value: ''})
549
- await this.initSlice(this.f_filialeid)
550
- this.inputtoreser = this.$GetSaleParam.getresinputtor(this.f_filialeid)
551
-
552
- },
553
- async getinputtores () {
554
- // 获取抄表员
555
- let rs = []
556
- if (this.$login.f.f_gasman.length > 0) {
557
- for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
558
- let temp = {
559
- label: this.$login.f.f_gasman[i].name,
560
- value: this.$login.f.f_gasman[i].name
561
- }
562
- rs.push(temp)
563
- }
564
- }
565
- this.inputtoreser = [{label: '全部', value: ''}, ...rs]
566
- },
567
- loadMeterBooks () {
568
- this.meterbooks = [...this.meterbooks, ...this.$GetSaleParam.getMeterBooks()]
569
- },
570
- getorg (val) {
571
- this.f_filialeid = val[0]
572
- },
573
- DateDiffer (Date_end, Date_start) {
574
- if (Date_start === '') {
575
- return 1
576
- }
577
- Date_start = Date_start + ' 00:00:00'
578
- let date1 = new Date(Date_start)
579
- let date2 = new Date(Date_end)
580
- date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate())
581
- date2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate())
582
- const diff = date2.getTime() - date1.getTime()
583
- const diffDate = diff / (24 * 60 * 60 * 1000)
584
- return diffDate
585
- },
586
- hidden () {
587
- this.criteriaShow = !this.criteriaShow
588
- },
589
- // 用户类型发生改变
590
- userTypeChange () {
591
- this.price_name = []
592
- if (this.$refs.paged.$refs.criteria.model.f_user_type) {
593
- if (this.$refs.paged.$refs.criteria.model.f_user_type[0]) {
594
- for (let i = 0; i < this.pricers.length; i++) {
595
- if (this.pricers[i].flage === this.$refs.paged.$refs.criteria.model.f_user_type[0]) {
596
- let rs = {
597
- label: this.pricers[i].label,
598
- value: this.pricers[i].value
599
- }
600
- this.price_name.push(rs)
601
- }
602
- }
603
- }
604
- }
605
- // 选择全部时就放进去所有的气价
606
- if (this.price_name.length === 0) {
607
- for (let i = 0; i < this.pricers.length; i++) {
608
- let rs = {
609
- label: this.pricers[i].label,
610
- value: this.pricers[i].value
611
- }
612
- this.price_name.push(rs)
613
- }
614
- }
615
- },
616
- // 冲正
617
- delectHand (row) {
618
- this.$showMessage('冲正后不可恢复,确定冲正吗?', ['confirm', 'cancel']).then((res) => {
619
- if (res === 'confirm') {
620
- row.f_operator = this.$login.f.name
621
- row.f_operatorid = this.$login.f.id
622
- row.f_orgid = this.$login.f.orgid
623
- row.f_orgname = this.$login.f.orgs
624
- row.f_depid = this.$login.f.depids
625
- row.f_depname = this.$login.f.deps
626
- this.$resetpost('rs/logic/priceAdjustmentOffset', {data: row}).then(() => {
627
- // this.$dispatch('refresh', '正在处理', row)
628
- this.selfSearch(this.model)
629
- })
630
- }
631
- })
632
- },
633
- priceshow () {
634
- if (this.model.model.f_change_date === undefined || this.model.model.f_change_date === '') {
635
- this.$showAlert('请填写气价变更时间', 'warning', 2000)
636
- this.show = false
637
- } else {
638
- this.show = true
639
- this.f_new_price = ''
640
- this.pricetime_states = ''
641
- this.operatortype = 'batch'
642
- }
643
- },
644
- close () {
645
- this.show = false
646
- this.f_new_price = 0.0
647
- },
648
- async priceadjustment () {
649
- if (this.pricetime_states == '') {
650
- this.$showAlert('请选择调价时间类型!!!', 'warning', 3000)
651
- return
652
- }
653
- if (this.f_new_price == '') {
654
- this.$showAlert('请输入价格!!!', 'warning', 3000)
655
- return
656
- }
657
- if (this.operatortype == 'one') {
658
- this.enter()
659
- } else if (this.operatortype == 'batch') {
660
- this.$showMessage('确认生成补差记录吗?', ['cancel', 'confirm']).then(
661
- (response) => {
662
- if (response === 'confirm') {
663
- this.show = false
664
- this.locking = true
665
- this.getAdjustData()
666
- }
667
- })
668
- }
669
- },
670
- calculation (row) {
671
- this.f_new_price = ''
672
- this.pricetime_states = ''
673
- this.show = true
674
- this.operatorrow = row
675
- this.operatortype = 'one'
676
- },
677
- async enter () {
678
- let param = {
679
- f_state: '有效',
680
- f_new_price: parseFloat(this.f_new_price),
681
- pricetime_states: this.pricetime_states,
682
- f_operator: this.$login.f.name,
683
- f_operatorid: this.$login.f.id,
684
- f_orgid: this.$login.f.orgid,
685
- f_orgname: this.$login.f.orgs,
686
- f_depid: this.$login.f.depids,
687
- f_depname: this.$login.f.deps,
688
- f_start_date: this.model.model.startDate + ' 00:00:00',
689
- f_end_date: this.model.model.endDate + ' 23:59:59',
690
- f_change_date: this.model.model.f_change_date,
691
- row: this.operatorrow
692
- }
693
- await this.$resetpost('rs/logic/priceAdjustment', {data: param}, {resolveMsg: '调价补差成功!', rejectMsg: '调价补差失败!'})
694
- this.operatorrow = {}
695
- this.show = false
696
- this.selfSearch(this.model)
697
- },
698
- async getAdjustData () {
699
- try {
700
- let param = {
701
- f_state: '有效',
702
- f_new_price: parseFloat(this.f_new_price),
703
- pricetime_states: this.pricetime_states,
704
- f_operator: this.$login.f.name,
705
- f_operatorid: this.$login.f.id,
706
- f_orgid: this.$login.f.orgid,
707
- f_orgname: this.$login.f.orgs,
708
- f_depid: this.$login.f.depids,
709
- f_depname: this.$login.f.deps,
710
- f_start_date: this.model.model.startDate + ' 00:00:00',
711
- f_end_date: this.model.model.endDate + ' 23:59:59',
712
- f_change_date: this.model.model.f_change_date, //调价时间
713
- condition: ''
714
- }
715
- let searchCondition = {
716
- data: {
717
- condition: this.condition,
718
- f_change_date: this.model.model.f_change_date === '' ? '1911-01-01' : this.model.model.f_change_date,
719
- startDate: this.model.model.startDate,
720
- endDate: this.model.model.endDate, addSelectParam: '', price_states: 'not'
721
- }
722
- }
723
- param.condition = searchCondition
724
- let res = await this.$resetpost('rs/logic/priceAdjustmentAll', {data: param}, {
725
- resolveMsg: null,
726
- rejectMsg: null
727
- })
728
- if (res.data) {
729
- this.$showMessage(`本次调价用户数:${res.data.allsize},调价成功数量:${res.data.successsize},无需调价数量:${res.data.nodealsize},调价错误数量:${res.data.errorsize}`, ['confirm'])
730
- }
731
- this.close()
732
- this.$refs.paged.$refs.criteria.search()
733
- this.locking = false
734
- this.pricetime_states = ''
735
- this.f_new_price = ''
736
- } catch (error) {
737
- this.$showAlert('生成调价补差表失败!!!', 'error', 3)
738
- this.locking = false
739
- }
740
- },
741
- search () {
742
- this.selfSearch()
743
- },
744
- async selfSearch (args) {
745
- this.f_prices = [{label: '全部', value: ''}]
746
- args.model.addSelectParam = ''
747
- // args.model.joinTable =''
748
- if (this.$refs.paged.$refs.criteria.model.f_change_date == undefined || this.$refs.paged.$refs.criteria.model.f_change_date == '') {
749
- this.$showAlert('请输入[气价变更时间]后进行查询!', 'warning', 2000)
750
- this.model.rows = []
751
- this.pricechange = false
752
- return
753
- }
754
- if (args.model.price_states.toString() === '' || args.model.price_states.toString() === ' >0') {
755
- this.pricechange = false
756
- // args.model.addSelectParam = 'u5.f_surplus_fee,u5.id,u5.f_state,u5.f_new_price,u5.f_old_price,u5.f_change_price,u5.f_whether_pay,u5.f_sell_id,'
757
- // args.model.joinTable = 'left join t_surplus_detail u5 on u5.f_handplan_id = u1.f_handplan_id'
758
- } else {
759
- this.pricechange = true
760
- }
761
- this.condition = `${args.condition} and u2.f_orgid = '${this.f_filialeid}'`
762
- await this.model.search(this.condition, args.model)
763
- let arr2 = this.model.rows.filter((value, index, array) => {
764
- return array.findIndex(item => item.key === value.key && item.f_price === value.f_price) === index
765
- })
766
- let rs = [{label: '全部', value: ''}]
767
- arr2.forEach(function (item) {
768
- console.log('item', item.f_price)
769
- let temp = {
770
- label: item.f_price,
771
- value: item.f_price
772
- }
773
- rs.push(temp)
774
- })
775
- this.f_prices = rs
776
- console.log('this.f_price', this.f_prices)
777
- },
778
- clear () {
779
- Object.keys(this.$refs.paged.$refs.criteria.model).forEach((key) => {
780
- this.$refs.paged.$refs.criteria.model[key] = ''
781
- })
782
- }
783
- },
784
- computed: {},
785
- watch: {
786
- async 'f_filialeid' (val) {
787
- // 更新抄表册
788
- this.$refs.paged.$refs.criteria.model.f_meter_book = []
789
- this.$refs.paged.$refs.criteria.model.f_book_slice_area = []
790
- this.$refs.paged.$refs.criteria.model.f_inputtor = []
791
- this.meterbooks = [{label: '全部', value: ''}]
792
- if (this.f_filialeid) {
793
- this.updateParams()
794
- }
795
- }
796
- }
797
- }
798
- </script>
799
-
800
- <style>
801
- </style>
1
+ <template>
2
+ <div id="unit" class="flex-row">
3
+ <div class="basic-main">
4
+ <div class="flex">
5
+ <criteria-paged :model="model" v-ref:paged>
6
+ <criteria partial='criteria' v-ref:criteria @condition-changed="$parent.selfSearch">
7
+ <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
8
+ <div class="row">
9
+ <div class="form-group col-sm-2">
10
+ <label class="font_normal_body">组织机构</label>
11
+ <res-select
12
+ :initresid='$parent.$parent.curorgid'
13
+ @res-select="$parent.$parent.getorg"
14
+ is-mul="false"
15
+ restype='organization'
16
+ >
17
+ </res-select>
18
+ </div>
19
+ <div class="form-group col-sm-2" >
20
+ <label class="font_normal_body">客户编号</label>
21
+ <input type="text" class="input_search" style="width:60%"
22
+ v-model="model.f_userinfo_code" placeholder='客户编号'
23
+ condition="f_userinfo_code = '{}'" >
24
+ </div>
25
+ <div class="form-group col-sm-2">
26
+ <label class="font_normal_body">客户名称</label>
27
+ <input type="text" class="input_search" style="width:60%"
28
+ v-model="model.f_user_name" placeholder='客户名称'
29
+ condition="f_user_name like '%{}%'">
30
+ </div>
31
+
32
+ <div class="form-group col-sm-2">
33
+ <label class="font_normal_body" style="color: #c52323">气价变更时间</label>
34
+ <datepicker placeholder="气价变更时间"
35
+ style="padding: 2px;width: 60%"
36
+ v-model="model.f_change_date"
37
+ :value.sync="model.f_change_date"
38
+ :format="'yyyy-MM-dd'"
39
+ ></datepicker>
40
+ </div>
41
+ <div class="span" style="float:right;">&nbsp;&nbsp;
42
+ <button class="button_new" style="width: max-content" v-show="$parent.$parent.pricechange" @click="$parent.$parent.priceshow()">批量调价</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
43
+ <button class="button_search" @click="search()" v-el:cx>查询</button>
44
+ <button class="button_clear" @click="$parent.$parent.clear()">清空</button>
45
+ <div style="float: right" class="button_spacing"
46
+ :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"
47
+ @click="$parent.$parent.hidden()"></div>
48
+ </div>
49
+ </div>
50
+ <div class="row" v-show="$parent.$parent.criteriaShow">
51
+ <div class="form-group col-sm-2" >
52
+ <label class="font_normal_body">开始日期</label>
53
+ <datepicker placeholder="开始日期"
54
+ style="width:60%"
55
+ v-model="model.startDate"
56
+ :value.sync="model.startDate"
57
+ :format="'yyyy-MM-dd'"
58
+ ></datepicker>
59
+ </div>
60
+ <div class="form-group col-sm-2" >
61
+ <label class="font_normal_body">结束日期</label>
62
+ <datepicker placeholder="结束日期"
63
+ style="width:60%"
64
+ v-model="model.endDate"
65
+ :value.sync="model.endDate"
66
+ :format="'yyyy-MM-dd'"
67
+ ></datepicker>
68
+ </div>
69
+ <div class="form-group col-sm-2">
70
+ <label class="font_normal_body">客户地址</label>
71
+ <input type="text" class="input_search" style="width:60%" style="width:60%" v-model="model.f_address" placeholder='客户地址'
72
+ condition="u3.f_address like '%{}%'">
73
+ </div>
74
+ <div class="form-group col-sm-2">
75
+ <label class="font_normal_body">电&emsp;&emsp;话</label>
76
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_user_phone" placeholder='电话'
77
+ condition="f_user_phone like '%{}%'">
78
+ </div>
79
+ <div class="form-group col-sm-2">
80
+ <label class="font_normal_body">表&emsp;&emsp;号</label>
81
+ <input type="text" class="input_search" style="width:60%" style="width:60%" v-model="model.f_meternumber" placeholder='表号'
82
+ condition="f_meternumber like '%{}%'">
83
+ </div>
84
+ <div class="form-group col-sm-2">
85
+ <label class="font_normal_body">状&emsp;&emsp;态</label>
86
+ <v-select id="price_states"
87
+ v-model="model.price_states"
88
+ placeholder='请选择'
89
+ style="width: 60%"
90
+ :value.sync="model.price_states"
91
+ :options='$parent.$parent.price_states'
92
+ condition="f_new_price {}"
93
+ close-on-select></v-select>
94
+ </div>
95
+ <div class="form-group col-sm-2">
96
+ <label class="font_normal_body">气表类型</label>
97
+ <v-select id="f_source"
98
+ v-model="model.f_source"
99
+ placeholder='气表类型'
100
+ style="width: 60%"
101
+ :value.sync="model.f_source"
102
+ :options='$parent.$parent.source'
103
+ condition="f_source='{}'"
104
+ close-on-select></v-select>
105
+ </div>
106
+ <div class="form-group col-sm-2">
107
+ <label class="font_normal_body">用户类型</label>
108
+ <v-select id="f_user_tye"
109
+ v-model="model.f_user_type"
110
+ placeholder='用户类型'
111
+ style="width: 60%"
112
+ @change="$parent.$parent.userTypeChange"
113
+ :value.sync="model.f_user_type"
114
+ :options='$parent.$parent.userTypes'
115
+ condition="u2.f_user_type = '{}'"
116
+ close-on-select></v-select>
117
+ </div>
118
+ <div class="form-group col-sm-2">
119
+ <label class="font_normal_body">气&emsp;&emsp;价</label>
120
+ <v-select id="f_price_name"
121
+ v-model="model.price_name"
122
+ placeholder='气价名称'
123
+ style="width: 60%"
124
+ :value.sync="model.price_name"
125
+ :options='$parent.$parent.price_name'
126
+ condition="sp.id = '{}'"
127
+ close-on-select></v-select>
128
+ </div>
129
+ <div class="form-group col-sm-2">
130
+ <label class="font_normal_body">系统气价</label>
131
+ <v-select id="f_price"
132
+ v-model="model.f_price"
133
+ placeholder='系统气价'
134
+ style="width: 60%"
135
+ :value.sync="model.f_price"
136
+ :options='$parent.$parent.f_prices'
137
+ condition="dp.f_price = '{}'"
138
+ close-on-select></v-select>
139
+ </div>
140
+ <div class="col-sm-2 form-group">
141
+ <label class="font_normal_body">抄&ensp;表&ensp;员</label>
142
+ <v-select :value.sync="model.f_inputtor" v-model='model.f_inputtor'
143
+ style="width:60%"
144
+
145
+ :options='$parent.$parent.inputtoreser' placeholder='抄表员'
146
+ @change="$parent.$parent.inputtorchange"
147
+ close-on-select
148
+ v-el:cc></v-select>
149
+ </div>
150
+ <!--表册片区-->
151
+ <div class="col-sm-2 form-group">
152
+ <label class="font_normal_body">表册片区</label>
153
+ <v-select :value.sync="model.f_book_slice_area" v-model="model.f_book_slice_area"
154
+ :options='$parent.$parent.bookSliceArea' placeholder='表册片区'
155
+ multiple
156
+ style="width:60%"
157
+ @change="$parent.$parent.sliceChange"
158
+ close-on-select
159
+ condition="f_book_slice_area in {}"></v-select>
160
+ </div>
161
+ <div class="col-sm-2 form-group">
162
+ <label class="font_normal_body">抄&ensp;表&ensp;册</label>
163
+ <v-select :value.sync="model.f_meter_book" v-model="model.f_meter_book"
164
+ :options='$parent.$parent.meterbooks' placeholder='抄表册'
165
+ multiple
166
+ style="width:60%"
167
+ close-on-select
168
+ condition="f_meter_book_num in {}"></v-select>
169
+ </div>
170
+ </div>
171
+ </div>
172
+ </criteria>
173
+ <data-grid :model="model" partial='list' class="list_area table_sy" v-ref:grid>
174
+ <template partial='head'>
175
+ <tr>
176
+ <th>
177
+ <nobr>序号</nobr>
178
+ </th>
179
+ <th>
180
+ <nobr>客户编号</nobr>
181
+ </th>
182
+ <th>
183
+ <nobr>表号</nobr>
184
+ </th>
185
+ <th>
186
+ <nobr>姓名</nobr>
187
+ </th>
188
+ <th>
189
+ <nobr>用户类型</nobr>
190
+ </th>
191
+ <th>
192
+ <nobr>气表类型</nobr>
193
+ </th>
194
+ <th>
195
+ <nobr>气价名称</nobr>
196
+ </th>
197
+ <!-- <th><nobr>地址</nobr></th>-->
198
+ <th>
199
+ <nobr>系统气价</nobr>
200
+ </th>
201
+ <th>
202
+ <nobr>输入气价</nobr>
203
+ </th>
204
+ <th>
205
+ <nobr>补差单价</nobr>
206
+ </th>
207
+ <th>
208
+ <nobr>补差金额</nobr>
209
+ </th>
210
+ <th>
211
+ <nobr>调价时间</nobr>
212
+ </th>
213
+ <th>
214
+ <nobr>调价时间类型</nobr>
215
+ </th>
216
+ <th>
217
+ <nobr>上期底数</nobr>
218
+ </th>
219
+ <th>
220
+ <nobr>本期底数</nobr>
221
+ </th>
222
+ <th>
223
+ <nobr>用气量</nobr>
224
+ </th>
225
+ <th>
226
+ <nobr>补差气量(调价前)</nobr>
227
+ </th>
228
+ <th>
229
+ <nobr>补差天数(调价前)</nobr>
230
+ </th>
231
+ <th>
232
+ <nobr>补差气量(调价后)</nobr>
233
+ </th>
234
+ <th>
235
+ <nobr>补差天数(调价后)</nobr>
236
+ </th>
237
+ <th>
238
+ <nobr>平均补差气量</nobr>
239
+ </th>
240
+
241
+ <th>
242
+ <nobr>差价来源</nobr>
243
+ </th>
244
+ <th>
245
+ <nobr>本次抄表日期</nobr>
246
+ </th>
247
+ <th>
248
+ <nobr>上次抄表日期</nobr>
249
+ </th>
250
+ <th>
251
+ <nobr>操作时间</nobr>
252
+ </th>
253
+ <th>
254
+ <nobr>操作</nobr>
255
+ </th>
256
+ </tr>
257
+ </template>
258
+ <template partial='body'>
259
+ <td style="text-align: center;">{{$index+1}}</td>
260
+ <th style="text-align: center;">{{row.f_userinfo_code}}</th>
261
+ <th style="text-align: center;">{{row.f_meternumber}}</th>
262
+ <th style="text-align: center;">{{row.f_user_name}}</th>
263
+ <th style="text-align: center;">{{row.f_user_type}}</th>
264
+ <th style="text-align: center;">{{row.f_meter_type}}</th>
265
+ <th style="text-align: center;">{{row.f_price_name}}</th>
266
+ <!-- <th style="text-align: center;">{{row.f_address}}</th>-->
267
+ <th style="text-align: center;">{{row.f_old_price?row.f_old_price:row.f_price}}</th>
268
+ <th style="text-align: center;">
269
+ <div class="form-group" style="margin-bottom:0px;"
270
+ v-if="!row.f_new_price>0">
271
+ <!-- <input type="text" class="form-control" v-model="row.newprice" @blur="$parent.$parent.$parent.enter(row)"-->
272
+ <!-- v-next-el="{id: $index+1}" :id="$index" style="width: 100px;padding: 6px;" :disabled="row.state === '开始'">-->
273
+ <input v-if="false" type="text" class="form-control" v-model="row.newprice"
274
+ @blur="$parent.$parent.$parent.calculation(row)"
275
+ v-next-el="{id: $index+1}" :id="$index" style="width: 100px;padding: 6px;"
276
+ :disabled="row.state === '开始'">
277
+ <button type="button" name="button" class="button_search-2 button_spacing width-60"
278
+ @click.stop="$parent.$parent.$parent.calculation(row) && row.states === 1">单户调价
279
+ </button>
280
+ </div>
281
+ <div v-else>{{row.f_new_price}}</div>
282
+ </th>
283
+ <th style="text-align: center;">{{row.f_change_price}}</th>
284
+ <th style="text-align: center;">{{row.f_surplus_fee}}</th>
285
+ <th style="text-align: center;">{{row.f_change_date}}</th>
286
+ <th style="text-align: center;">{{row.f_changetime_type}}</th>
287
+ <th style="text-align: center;">{{row.f_last_tablebase}}</th>
288
+ <th style="text-align: center;">{{row.f_tablebase}}</th>
289
+ <th style="text-align: center;">{{row.f_tablebase-row.f_last_tablebase}}</th>
290
+ <th style="text-align: center;">{{row.startpregas}}</th>
291
+ <th style="text-align: center;">{{row.startday}}</th>
292
+ <th style="text-align: center;">{{row.endpregas}}</th>
293
+ <th style="text-align: center;">{{row.endday}}</th>
294
+ <th style="text-align: center;">{{row.avgpregas}}</th>
295
+
296
+ <th style="text-align: center;">{{row.f_source}}</th>
297
+ <th style="text-align: center;">{{row.f_input_date}}</th>
298
+ <th style="text-align: center;">{{row.f_last_input_date}}</th>
299
+ <th style="text-align: center;">{{row.f_operate_date}}</th>
300
+ <th style="text-align: center;">
301
+ <button type="button" name="button" class="btn btn-link" v-if="row.f_new_price"
302
+ @click.stop="$parent.$parent.$parent.delectHand(row) && row.states === 1">冲正
303
+ </button>
304
+ <!-- <button type="button" name="button" class="btn btn-link" v-if="!row.f_new_price"-->
305
+ <!-- @click.stop="$parent.$parent.$parent.enter(row) && row.states === 1">补差-->
306
+ <!-- </button>-->
307
+ </th>
308
+ </template>
309
+ </data-grid>
310
+ </criteria-paged>
311
+ <modal :show.sync="show">
312
+ <header slot="modal-header" class="modal-header">
313
+ <h4 class="modal-title">调 价 补 差</h4>
314
+ </header>
315
+ <article slot="modal-body" class="modal-body">
316
+ <div class="row">
317
+ <div class="form-group col-sm-4">
318
+ <label class="font_normal_body">调价时间类型</label>
319
+ <v-select v-model="pricetime_states"
320
+ placeholder='请选择'
321
+ style="width: 60%"
322
+ value-single
323
+ :value.sync="pricetime_states"
324
+ :options='pricetime_statesoptions'></v-select>
325
+ </div>
326
+ <div class="form-group col-sm-4">
327
+ <label class="font_normal_body">价&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格</label>
328
+ <input type="text" class="form-control" v-model="f_new_price">
329
+ </div>
330
+ </div>
331
+ </article>
332
+ <footer slot="modal-footer" class="modal-footer">
333
+ <button class="button_search" @click="priceadjustment">生成调价补差表</button>
334
+ <button type="button" class="btn btn-default" @click='close'>取消</button>
335
+ </footer>
336
+ </modal>
337
+ <work-busy :is-busy="locking" v-show="locking"></work-busy>
338
+ </div>
339
+ </div>
340
+ </div>
341
+ </template>
342
+
343
+ <script>
344
+ import {HttpResetClass, PagedList} from 'vue-client'
345
+ import Vue from 'vue'
346
+ import co from 'co'
347
+
348
+ let readySomething = async function (self) {
349
+ self.$refs.paged.$refs.criteria.model.startDate = self.$login.toStandardDateString()
350
+ self.$refs.paged.$refs.criteria.model.endDate = self.$login.toStandardDateString()
351
+ self.$refs.paged.$refs.criteria.model.f_change_date = ''
352
+ self.$resetpost('rs/sql/getpriceid', {data: {f_filialeids: self.$login.f.orgid}}, {
353
+ resolveMsg: null,
354
+ rejectMsg: null
355
+ }).then((res) => {
356
+ console.log(res.data)
357
+ let rs = []
358
+ for (let i = 0; i < res.data.length; i++) {
359
+ if (res.data[i].f_price_type === '固定气价') {
360
+ let temp = {
361
+ label: res.data[i].f_price_name,
362
+ flage: res.data[i].f_user_type,
363
+ value: res.data[i].id
364
+ }
365
+ rs.push(temp)
366
+ }
367
+ }
368
+ console.log(rs)
369
+ self.pricers = [{label: '全部', value: '', flage: ''}, ...rs]
370
+ self.$showAlert('请输入[气价变更时间]后进行查询!', 'warning', 2000)
371
+ self.pricechange = false
372
+ //self.$refs.paged.$refs.criteria.search()
373
+ })
374
+ }
375
+ let asyncReadyGen = async function (self) {
376
+ // 获取营收参数
377
+ await self.$LoadParams.loadMeterBook(self.f_filialeid)
378
+ // self.loadMeterBooks()
379
+ // await self.$MagGetSaleParam.initinputtor()
380
+ // await self.getinputtores()
381
+ // console.log('-----------------', self.$login.f.orgid)
382
+ // await self.initSlice(self.$login.f.orgid)
383
+ await self.initSlice(self.$login.f.orgid)
384
+ await self.getinputtores()
385
+ await self.$GetSaleParam.initinputtor()
386
+ self.getfield = self.config.excelHeaders
387
+ await self.initmeterbook()
388
+ self.$refs.paged.$refs.cri.model.performDate = self.$login.toStandardDateString()
389
+ self.search()
390
+
391
+ }
392
+
393
+ export default {
394
+ title: '调价补差',
395
+ data () {
396
+ return {
397
+ f_orgid: '',
398
+ pricechange: true,
399
+ criteriaShow: false,
400
+ pricers: [{label: '全部', value: '', flage: ''}],
401
+ price_name: [{label: '全部', value: ''}],
402
+ price_states: [{label: '全部', value: ''}, {label: '已调价', value: ' >0'}, {label: '未调价', value: ' <=0'}],
403
+ pricetime_statesoptions: [{label: '全部', value: ''}, {label: '调价时间前', value: '1'}, {label: '调价时间后', value: '0'}],
404
+ source: [{label: '卡表抄表', value: '卡表抄表'}, {label: '机表抄表', value: '机表抄表'}],
405
+ userTypes: this.$appdata.getParam('用户类型') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')] : [],
406
+ condition: '',
407
+ locking: false,
408
+ model: new PagedList('rs/sql/get_UserCharge', 20, {
409
+ f_change_date: 'this.model.f_change_date === "" ? "1911-01-01" : this.model.f_change_date',
410
+ startDate: 'this.model.startDate',
411
+ endDate: 'this.model.endDate',
412
+ price_states: 'this.model.price_states[0]',
413
+ addSelectParam: 'this.model.addSelectParam'
414
+ }),
415
+ f_new_price: '',
416
+ pricetime_states: '',
417
+ show: false,
418
+ addSelectParam: '',
419
+ meterbooks: [{label: '全部', value: ''}], // 抄表册
420
+ inputtoreser: [{label: '全部', value: ''}],
421
+ bookSliceArea: [],
422
+ inputtores2: [],
423
+ curorgid: [this.$login.f.orgid],
424
+ f_filialeid: this.$login.f.orgid,
425
+ operatortype: '',
426
+ operatorrow: {},
427
+ f_prices: [{label: '全部', value: ''}]
428
+ // joinTable:'',
429
+ }
430
+ },
431
+ ready () {
432
+ readySomething(this).then(() => {
433
+ this.$emit('ready')
434
+ }).catch((error) => {
435
+ this.$emit('error', error)
436
+ })
437
+ this.inputtores2 = this.inputtores
438
+ asyncReadyGen(this)
439
+ },
440
+ methods: {
441
+ async sliceChange () {
442
+ this.$set('$refs.paged.$refs.criteria.model.f_meter_book', [])
443
+ let val2 = this.$refs.paged.$refs.criteria.model.f_book_slice_area
444
+ if (val2.length > 0) {
445
+ let condition = ` 1=1 and f_orgid ='${this.f_filialeid}' and f_book_state='有效' `
446
+ let aaa = '('
447
+ val2.forEach((item) => {
448
+ aaa = aaa + `'${item}',`
449
+ })
450
+ aaa = aaa + `'')`
451
+ condition = condition + ` and f_book_slice_area in ${aaa} `
452
+ let param = {
453
+ items: '*',
454
+ tablename: 't_meter_book',
455
+ condition: condition,
456
+ orderitem: 'id'
457
+ }
458
+ let getMeterBooks = await this.$resetpost('rs/sql/singleTable_OrderBy', {data: param}, {
459
+ resolveMsg: null,
460
+ rejectMsg: '获取营收参数出错!!!'
461
+ })
462
+ if (getMeterBooks.data) {
463
+ if (getMeterBooks.data.length > 0) {
464
+ let rs = []
465
+ getMeterBooks.data.forEach((item) => {
466
+ let temp = {
467
+ label: item.f_book_name,
468
+ value: item.id
469
+ }
470
+ rs.push(temp)
471
+ })
472
+ this.meterbooks = [{label: '全部', value: ''}, ...rs]
473
+ } else {
474
+ this.meterbooks = [{label: '全部', value: ''}]
475
+ }
476
+ }
477
+ } else {
478
+ this.meterbooks = [{label: '全部', value: ''}]
479
+ }
480
+ },
481
+ async initSlice (val) {
482
+ if (val) {
483
+ let getAllArea = await this.$resetpost('/rs/search', {
484
+ source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
485
+ userid: this.$login.f.id
486
+ }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
487
+ let arr = getAllArea.data.filter((res) => {
488
+ return res.parentid == val
489
+ })
490
+ this.bookSliceArea = []
491
+ arr.forEach((res) => {
492
+ this.bookSliceArea.push({label: res.name, value: res.name})
493
+ })
494
+ }
495
+ },
496
+ async inputtorchange () {
497
+ let val = this.$refs.paged.$refs.criteria.model.f_inputtor
498
+ if (val != null && val != '') {
499
+ let param = {
500
+ items: '*',
501
+ tablename: 't_meter_book',
502
+ condition: ` 1=1 and f_inputtor = '${val}' and f_orgid ='${this.f_filialeid}' and f_book_state='有效' `,
503
+ orderitem: 'id'
504
+
505
+ }
506
+ let getMeterBooks = await this.$resetpost('rs/sql/manage_singleTable', {data: param}, {
507
+ resolveMsg: null,
508
+ rejectMsg: '获取营收参数出错!!!'
509
+ })
510
+ if (getMeterBooks.data) {
511
+ if (getMeterBooks.data.length > 0) {
512
+ let rs = []
513
+ getMeterBooks.data.forEach((item) => {
514
+ let temp = {
515
+ label: item.f_book_name,
516
+ value: item.id
517
+ }
518
+ rs.push(temp)
519
+ })
520
+ this.meterbooks = [{label: '全部', value: ''}, ...rs]
521
+ // this.$set('$refs.paged.$refs.criteria.model.f_meter_book',[getMeterBooks.data[0].id]);
522
+ } else {
523
+ this.$set('$refs.paged.$refs.criteria.model.f_meter_book', [])
524
+ this.meterbooks = [{label: '全部', value: ''}]
525
+ }
526
+ } else {
527
+ this.$set('$refs.paged.$refs.criteria.model.f_meter_book', [])
528
+ }
529
+ } else {
530
+ this.$set('$refs.paged.$refs.criteria.model.f_meter_book', [])
531
+ this.meterbooks = [{label: '全部', value: ''}]
532
+ this.initmeterbook()
533
+ }
534
+ },
535
+ async initmeterbook (orgstr) {
536
+ if (orgstr == null) {
537
+ orgstr = this.f_filialeid
538
+ }
539
+ // 获取新的抄表册,先去清理所有的抄表册
540
+ this.$GetSaleParam.meterbooks = []
541
+ // 开始加载新的抄表册
542
+ await this.$LoadParams.loadMeterBook(orgstr)
543
+ this.meterbooks = [{label: '全部', value: ''}, ...this.$GetSaleParam.getMeterBooks()]
544
+ },
545
+ async updateParams () {
546
+ // await this.$MagLoadParams.loadParam(this.f_filialeid)
547
+ this.inputtoreser = []
548
+ this.inputtoreser.push({label: '全部', value: ''})
549
+ await this.initSlice(this.f_filialeid)
550
+ this.inputtoreser = this.$GetSaleParam.getresinputtor(this.f_filialeid)
551
+
552
+ },
553
+ async getinputtores () {
554
+ // 获取抄表员
555
+ let rs = []
556
+ if (this.$login.f.f_gasman.length > 0) {
557
+ for (let i = 0; i < this.$login.f.f_gasman.length; i++) {
558
+ let temp = {
559
+ label: this.$login.f.f_gasman[i].name,
560
+ value: this.$login.f.f_gasman[i].name
561
+ }
562
+ rs.push(temp)
563
+ }
564
+ }
565
+ this.inputtoreser = [{label: '全部', value: ''}, ...rs]
566
+ },
567
+ loadMeterBooks () {
568
+ this.meterbooks = [...this.meterbooks, ...this.$GetSaleParam.getMeterBooks()]
569
+ },
570
+ getorg (val) {
571
+ this.f_filialeid = val[0]
572
+ },
573
+ DateDiffer (Date_end, Date_start) {
574
+ if (Date_start === '') {
575
+ return 1
576
+ }
577
+ Date_start = Date_start + ' 00:00:00'
578
+ let date1 = new Date(Date_start)
579
+ let date2 = new Date(Date_end)
580
+ date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate())
581
+ date2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate())
582
+ const diff = date2.getTime() - date1.getTime()
583
+ const diffDate = diff / (24 * 60 * 60 * 1000)
584
+ return diffDate
585
+ },
586
+ hidden () {
587
+ this.criteriaShow = !this.criteriaShow
588
+ },
589
+ // 用户类型发生改变
590
+ userTypeChange () {
591
+ this.price_name = []
592
+ if (this.$refs.paged.$refs.criteria.model.f_user_type) {
593
+ if (this.$refs.paged.$refs.criteria.model.f_user_type[0]) {
594
+ for (let i = 0; i < this.pricers.length; i++) {
595
+ if (this.pricers[i].flage === this.$refs.paged.$refs.criteria.model.f_user_type[0]) {
596
+ let rs = {
597
+ label: this.pricers[i].label,
598
+ value: this.pricers[i].value
599
+ }
600
+ this.price_name.push(rs)
601
+ }
602
+ }
603
+ }
604
+ }
605
+ // 选择全部时就放进去所有的气价
606
+ if (this.price_name.length === 0) {
607
+ for (let i = 0; i < this.pricers.length; i++) {
608
+ let rs = {
609
+ label: this.pricers[i].label,
610
+ value: this.pricers[i].value
611
+ }
612
+ this.price_name.push(rs)
613
+ }
614
+ }
615
+ },
616
+ // 冲正
617
+ delectHand (row) {
618
+ this.$showMessage('冲正后不可恢复,确定冲正吗?', ['confirm', 'cancel']).then((res) => {
619
+ if (res === 'confirm') {
620
+ row.f_operator = this.$login.f.name
621
+ row.f_operatorid = this.$login.f.id
622
+ row.f_orgid = this.$login.f.orgid
623
+ row.f_orgname = this.$login.f.orgs
624
+ row.f_depid = this.$login.f.depids
625
+ row.f_depname = this.$login.f.deps
626
+ this.$resetpost('rs/logic/priceAdjustmentOffset', {data: row}).then(() => {
627
+ // this.$dispatch('refresh', '正在处理', row)
628
+ this.selfSearch(this.model)
629
+ })
630
+ }
631
+ })
632
+ },
633
+ priceshow () {
634
+ if (this.model.model.f_change_date === undefined || this.model.model.f_change_date === '') {
635
+ this.$showAlert('请填写气价变更时间', 'warning', 2000)
636
+ this.show = false
637
+ } else {
638
+ this.show = true
639
+ this.f_new_price = ''
640
+ this.pricetime_states = ''
641
+ this.operatortype = 'batch'
642
+ }
643
+ },
644
+ close () {
645
+ this.show = false
646
+ this.f_new_price = 0.0
647
+ },
648
+ async priceadjustment () {
649
+ if (this.pricetime_states == '') {
650
+ this.$showAlert('请选择调价时间类型!!!', 'warning', 3000)
651
+ return
652
+ }
653
+ if (this.f_new_price == '') {
654
+ this.$showAlert('请输入价格!!!', 'warning', 3000)
655
+ return
656
+ }
657
+ if (this.operatortype == 'one') {
658
+ this.enter()
659
+ } else if (this.operatortype == 'batch') {
660
+ this.$showMessage('确认生成补差记录吗?', ['cancel', 'confirm']).then(
661
+ (response) => {
662
+ if (response === 'confirm') {
663
+ this.show = false
664
+ this.locking = true
665
+ this.getAdjustData()
666
+ }
667
+ })
668
+ }
669
+ },
670
+ calculation (row) {
671
+ this.f_new_price = ''
672
+ this.pricetime_states = ''
673
+ this.show = true
674
+ this.operatorrow = row
675
+ this.operatortype = 'one'
676
+ },
677
+ async enter () {
678
+ let param = {
679
+ f_state: '有效',
680
+ f_new_price: parseFloat(this.f_new_price),
681
+ pricetime_states: this.pricetime_states,
682
+ f_operator: this.$login.f.name,
683
+ f_operatorid: this.$login.f.id,
684
+ f_orgid: this.$login.f.orgid,
685
+ f_orgname: this.$login.f.orgs,
686
+ f_depid: this.$login.f.depids,
687
+ f_depname: this.$login.f.deps,
688
+ f_start_date: this.model.model.startDate + ' 00:00:00',
689
+ f_end_date: this.model.model.endDate + ' 23:59:59',
690
+ f_change_date: this.model.model.f_change_date,
691
+ row: this.operatorrow
692
+ }
693
+ await this.$resetpost('rs/logic/priceAdjustment', {data: param}, {resolveMsg: '调价补差成功!', rejectMsg: '调价补差失败!'})
694
+ this.operatorrow = {}
695
+ this.show = false
696
+ this.selfSearch(this.model)
697
+ },
698
+ async getAdjustData () {
699
+ try {
700
+ let param = {
701
+ f_state: '有效',
702
+ f_new_price: parseFloat(this.f_new_price),
703
+ pricetime_states: this.pricetime_states,
704
+ f_operator: this.$login.f.name,
705
+ f_operatorid: this.$login.f.id,
706
+ f_orgid: this.$login.f.orgid,
707
+ f_orgname: this.$login.f.orgs,
708
+ f_depid: this.$login.f.depids,
709
+ f_depname: this.$login.f.deps,
710
+ f_start_date: this.model.model.startDate + ' 00:00:00',
711
+ f_end_date: this.model.model.endDate + ' 23:59:59',
712
+ f_change_date: this.model.model.f_change_date, //调价时间
713
+ condition: ''
714
+ }
715
+ let searchCondition = {
716
+ data: {
717
+ condition: this.condition,
718
+ f_change_date: this.model.model.f_change_date === '' ? '1911-01-01' : this.model.model.f_change_date,
719
+ startDate: this.model.model.startDate,
720
+ endDate: this.model.model.endDate, addSelectParam: '', price_states: 'not'
721
+ }
722
+ }
723
+ param.condition = searchCondition
724
+ let res = await this.$resetpost('rs/logic/priceAdjustmentAll', {data: param}, {
725
+ resolveMsg: null,
726
+ rejectMsg: null
727
+ })
728
+ if (res.data) {
729
+ this.$showMessage(`本次调价用户数:${res.data.allsize},调价成功数量:${res.data.successsize},无需调价数量:${res.data.nodealsize},调价错误数量:${res.data.errorsize}`, ['confirm'])
730
+ }
731
+ this.close()
732
+ this.$refs.paged.$refs.criteria.search()
733
+ this.locking = false
734
+ this.pricetime_states = ''
735
+ this.f_new_price = ''
736
+ } catch (error) {
737
+ this.$showAlert('生成调价补差表失败!!!', 'error', 3)
738
+ this.locking = false
739
+ }
740
+ },
741
+ search () {
742
+ this.selfSearch()
743
+ },
744
+ async selfSearch (args) {
745
+ this.f_prices = [{label: '全部', value: ''}]
746
+ args.model.addSelectParam = ''
747
+ // args.model.joinTable =''
748
+ if (this.$refs.paged.$refs.criteria.model.f_change_date == undefined || this.$refs.paged.$refs.criteria.model.f_change_date == '') {
749
+ this.$showAlert('请输入[气价变更时间]后进行查询!', 'warning', 2000)
750
+ this.model.rows = []
751
+ this.pricechange = false
752
+ return
753
+ }
754
+ if (args.model.price_states.toString() === '' || args.model.price_states.toString() === ' >0') {
755
+ this.pricechange = false
756
+ // args.model.addSelectParam = 'u5.f_surplus_fee,u5.id,u5.f_state,u5.f_new_price,u5.f_old_price,u5.f_change_price,u5.f_whether_pay,u5.f_sell_id,'
757
+ // args.model.joinTable = 'left join t_surplus_detail u5 on u5.f_handplan_id = u1.f_handplan_id'
758
+ } else {
759
+ this.pricechange = true
760
+ }
761
+ this.condition = `${args.condition} and u2.f_orgid = '${this.f_filialeid}'`
762
+ await this.model.search(this.condition, args.model)
763
+ let arr2 = this.model.rows.filter((value, index, array) => {
764
+ return array.findIndex(item => item.key === value.key && item.f_price === value.f_price) === index
765
+ })
766
+ let rs = [{label: '全部', value: ''}]
767
+ arr2.forEach(function (item) {
768
+ console.log('item', item.f_price)
769
+ let temp = {
770
+ label: item.f_price,
771
+ value: item.f_price
772
+ }
773
+ rs.push(temp)
774
+ })
775
+ this.f_prices = rs
776
+ console.log('this.f_price', this.f_prices)
777
+ },
778
+ clear () {
779
+ Object.keys(this.$refs.paged.$refs.criteria.model).forEach((key) => {
780
+ this.$refs.paged.$refs.criteria.model[key] = ''
781
+ })
782
+ }
783
+ },
784
+ computed: {},
785
+ watch: {
786
+ async 'f_filialeid' (val) {
787
+ // 更新抄表册
788
+ this.$refs.paged.$refs.criteria.model.f_meter_book = []
789
+ this.$refs.paged.$refs.criteria.model.f_book_slice_area = []
790
+ this.$refs.paged.$refs.criteria.model.f_inputtor = []
791
+ this.meterbooks = [{label: '全部', value: ''}]
792
+ if (this.f_filialeid) {
793
+ this.updateParams()
794
+ }
795
+ }
796
+ }
797
+ }
798
+ </script>
799
+
800
+ <style>
801
+ </style>