zhangjiaqing
8 天以前 1cef3adee31c6934c0da4b4f0b8a6f5ac03b364f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            returnPayFeeManageInfo: {
                returnPayFees: [],
                total: 0,
                records: 1,
                moreCondition: false,
                returnPayFeeStates: '',
                name: '',
                auditReturnFeeId: '',
                returnPayFee: '',
                conditions: {
                    communityId: vc.getCurrentCommunity().communityId,
                    feeId: '',
                    detailId: '',
                    userCode: '',
                    state: '1000',
                    feeTypeCd: '',
                    payerObjName: '',
                    startTime: '',
                    endTime: '',
                    auditPersonName: '',
                    applyPersonName: ''
                }
            }
        },
        _initMethod: function () {
            // 初始化方法(时间插件)
            $that._initReturnPayFeeManageDateInfo();
            $that._listReturnPayFees(DEFAULT_PAGE, DEFAULT_ROWS);
            vc.getDict('return_pay_fee', "state", function (_data) {
                $that.returnPayFeeManageInfo.returnPayFeeStates = _data;
            });
            vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
                $that.returnPayFeeManageInfo.feeTypes = _data;
            });
        },
        _initEvent: function () {
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that._listReturnPayFees(_currentPage, DEFAULT_ROWS);
            });
            vc.on('returnPayFeeManage', 'notifyAuditInfo', function (_auditInfo) {
                $that._auditReturnPayFeeState(_auditInfo);
            });
        },
        methods: {
            // 新增初始化时间插件方法
            _initReturnPayFeeManageDateInfo: function () {
                $('.startTime').datetimepicker({
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd hh:ii:ss',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true
                });
                $('.startTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".startTime").val();
                        $that.returnPayFeeManageInfo.conditions.startTime = value;
                    });
                $('.endTime').datetimepicker({
                    language: 'zh-CN',
                    fontAwesome: 'fa',
                    format: 'yyyy-mm-dd hh:ii:ss',
                    initTime: true,
                    initialDate: new Date(),
                    autoClose: 1,
                    todayBtn: true
                });
                $('.endTime').datetimepicker()
                    .on('changeDate', function (ev) {
                        var value = $(".endTime").val();
                        var start = Date.parse(new Date($that.returnPayFeeManageInfo.conditions.startTime))
                        var end = Date.parse(new Date(value))
                        if (start - end >= 0) {
                            vc.toast("计费终止时间必须大于计费起始时间")
                            $(".endTime").val('')
                        } else {
                            $that.returnPayFeeManageInfo.conditions.endTime = value;
                        }
                    });
                //防止多次点击时间插件失去焦点
                document.getElementsByClassName('form-control startTime')[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
 
                document.getElementsByClassName("form-control endTime")[0].addEventListener('click', myfunc)
 
                function myfunc(e) {
                    e.currentTarget.blur();
                }
            },
            _listReturnPayFees: function (_page, _rows) {
                $that.returnPayFeeManageInfo.conditions.page = _page;
                $that.returnPayFeeManageInfo.conditions.row = _rows;
                var param = {
                    params: $that.returnPayFeeManageInfo.conditions
                };
                param.params.detailId = param.params.detailId.trim();
                param.params.payerObjName = param.params.payerObjName.trim();
                param.params.applyPersonName = param.params.applyPersonName.trim();
                param.params.auditPersonName = param.params.auditPersonName.trim();
                vc.http.apiGet('/returnPayFee.listReturnPayFees',
                    param,
                    function (json) {
                        let _json = JSON.parse(json);
                        $that.returnPayFeeManageInfo.total = _json.total;
                        // $that.returnPayFeeManageInfo.records = parseInt(_returnPayFeeManageInfo.total/_rows +1);
                        $that.returnPayFeeManageInfo.records = _json.records;
                        if (_json.data != null && _json.data.length > 0) {
                            _json.data.forEach(item => {
                                if (item.feeAccountDetailDtoList != null && item.feeAccountDetailDtoList.length > 0) {
                                    item.feeAccountDetailDtoList.forEach(item2 => {
                                        if (item2.state == '1001' || item2.state == '1003') { //无抵扣或积分抵扣
                                            return;
                                        } else {
                                            item.receivedAmount = (parseFloat(item.receivedAmount) - parseFloat(item2.amount)).toFixed(2);
                                        }
                                    })
                                }
                            });
                        }
                        $that.returnPayFeeManageInfo.returnPayFees = _json.data;
                        vc.emit('pagination', 'init', {
                            total: $that.returnPayFeeManageInfo.records,
                            dataCount: $that.returnPayFeeManageInfo.total,
                            currentPage: _page
                        });
                    },
                    function () {
                        console.log('请求失败处理');
                    }
                );
            },
            //查询
            _queryReturnPayFeeMethod: function () {
                $that._listReturnPayFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetReturnPayFeeMethod: function () {
                $that.returnPayFeeManageInfo.conditions.detailId = "";
                $that.returnPayFeeManageInfo.conditions.feeTypeCd = "";
                $that.returnPayFeeManageInfo.conditions.state = "";
                $that.returnPayFeeManageInfo.conditions.payerObjName = "";
                $that.returnPayFeeManageInfo.conditions.startTime = "";
                $that.returnPayFeeManageInfo.conditions.endTime = "";
                $that.returnPayFeeManageInfo.conditions.applyPersonName = "";
                $that.returnPayFeeManageInfo.conditions.auditPersonName = "";
                $that._listReturnPayFees(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _auditReturnPayFeeState: function (_auditInfo) {
                $that.returnPayFeeManageInfo.returnPayFee.state = _auditInfo.state;
                $that.returnPayFeeManageInfo.returnPayFee.payableAmount = 0.0;
                //$that.returnPayFeeManageInfo.returnPayFee.remark = _auditInfo.remark;
                let _returnPayFee = $that.returnPayFeeManageInfo.returnPayFee;
                vc.http.apiPost(
                    '/returnPayFee.updateReturnPayFee',
                    JSON.stringify(_returnPayFee), {
                        emulateJSON: true
                    },
                    function (json, res) {
                        let _json = JSON.parse(json);
                        if (_json.code == 0) {
                            $that._listReturnPayFees(DEFAULT_PAGE, DEFAULT_ROWS);
                            vc.toast("审核成功");
                            return;
                        } else {
                            vc.toast(_json.msg);
                        }
                    },
                    function (errInfo, error) {
                        vc.toast(errInfo);
                    });
            },
            _tryRefundMoney: function (_rPayFee) {
                let _returnPayFee = {
                    detailId:_rPayFee.detailId,
                    communityId:vc.getCurrentCommunity().communityId
                }
                vc.http.apiPost(
                    '/returnPayFee.tryRefundMoney',
                    JSON.stringify(_returnPayFee), {
                        emulateJSON: true
                    },
                    function (json, res) {
                        let _json = JSON.parse(json);
                        if (_json.code == 0) {
                            $that._listReturnPayFees(DEFAULT_PAGE, DEFAULT_ROWS);
                            vc.toast("提交退款");
                            return;
                        } else {
                            vc.toast(_json.msg);
                        }
                    },
                    function (errInfo, error) {
                        vc.toast(errInfo);
                    });
            },
            _moreCondition: function () {
                if ($that.returnPayFeeManageInfo.moreCondition) {
                    $that.returnPayFeeManageInfo.moreCondition = false;
                } else {
                    $that.returnPayFeeManageInfo.moreCondition = true;
                }
            },
            _exportFee: function () {
                vc.jumpToPage('/callComponent/exportReportFee/exportData?pagePath=returnPayFeeManage&' + vc.objToGetParam($that.returnPayFeeManageInfo.conditions));
            },
            _openReturnPayFeeAuditModel(_payFee) {
                $that.returnPayFeeManageInfo.returnPayFee = _payFee;
                vc.emit('audit', 'openAuditModal', {});
            },
            _toReturnFeeDetail: function (_payFee) {
                vc.jumpToPage('/#/pages/property/propertyFee?feeId=' + _payFee.feeId);
            }
        }
    });
})(window.vc);