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) {
 
    vc.extends({
        data: {
            printPayFeeInfo: {
                communityName: '',
                receiptId: '',
                receiptIds: '',
                roomName: '',
                amount: 0.00,
                fees: [],
                feeTime: '',
                wechatName: '',
                content: '',
                qrImg: '',
                payObjName: '',
                feeReceipt: [],
                apply: 'N',
                userName: vc.getData('/nav/getUserInfo').name,
                carName: ''
            },
            printFlag: '0'
        },
        _initMethod: function() {
            //vc.component._initPrintPurchaseApplyDateInfo();
 
            $that.printPayFeeInfo.receiptId = vc.getParam('receiptId');
            $that.printPayFeeInfo.receiptIds = vc.getParam('receiptIds');
            $that.printPayFeeInfo.apply = vc.getParam('apply');
 
            //$that.printPayFeeInfo.feeTime = vc.dateTimeFormat(new Date());
 
            $that.printPayFeeInfo.communityName = vc.getCurrentCommunity().name;
 
            $that._loadReceipt();
 
            $that._loadPrintSpec();
        },
        _initEvent: function() {
 
 
        },
        methods: {
            _initPayFee: function() {
 
            },
            _loadReceipt: function() {
 
                var param = {
                    params: {
                        page: 1,
                        row: 30,
                        receiptId: $that.printPayFeeInfo.receiptId,
                        receiptIds: $that.printPayFeeInfo.receiptIds,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                };
 
                //发送get请求
                vc.http.apiGet('/feeReceipt/queryFeeReceipt',
                    param,
                    function(json, res) {
                        var _feeReceiptManageInfo = JSON.parse(json);
                        let _feeReceipt = _feeReceiptManageInfo.data;
                        let _amount = 0;
                        _feeReceipt.forEach(item => {
                            _amount += parseFloat(item.amount)
                        });
 
                        $that.printPayFeeInfo.amount = _amount.toFixed(2);
                        $that.printPayFeeInfo.roomName = _feeReceipt[0].objName;
                        $that.printPayFeeInfo.feeTime = _feeReceipt[0].createTime;
                        // $that.printPayFeeInfo.receiptNum = _feeReceipt[0].receiptId;
                        $that.printPayFeeInfo.payObjName = _feeReceipt[0].payObjName;
                        $that.printPayFeeInfo.feeReceipt = _feeReceipt;
 
                        $that._loadReceiptDetail();
 
                        if (_feeReceipt[0].objType == '6666') {
                            $that.printPayFeeInfo.carName = _feeReceipt[0].objName;
                            //查询车位对应房屋
                            $that._listOwnerCar(_feeReceipt[0].objId);
                        }
 
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _loadReceiptDetail: function() {
 
                let param = {
                    params: {
                        page: 1,
                        row: 100,
                        receiptId: $that.printPayFeeInfo.receiptId,
                        receiptIds: $that.printPayFeeInfo.receiptIds,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                };
                //发送get请求
                vc.http.apiGet('/feeReceipt/queryFeeReceiptDetail',
                    param,
                    function(json, res) {
                        var _feeReceiptManageInfo = JSON.parse(json);
                        let _feeReceiptDetails = _feeReceiptManageInfo.data;
                        $that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].receiptId + "(" + _feeReceiptDetails[0].payOrderId + ")";
                        _feeReceiptDetails.forEach(item => {
                            $that.printPayFeeInfo.feeReceipt.forEach(im => {
                                if (item.receiptId == im.receiptId) {
                                    item.objName = im.objName;
                                    item.feeTypeCd = im.feeTypeCd;
                                }
                            });
 
                            $that._queryFeeDetailDiscount(item.detailId, item);
                        })
                        $that.printPayFeeInfo.fees = _feeReceiptDetails;
 
                        setTimeout(function() {
                            $that.$forceUpdate();
                        }, 2000)
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _queryFeeDetailDiscount: function(_detailId, _item) {
                let param = {
                    params: {
                        page: 1,
                        row: 100,
                        detailId: _detailId,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                };
                //发送get请求
                vc.http.apiGet('/feeDiscount/queryFeeDetailDiscount',
                    param,
                    function(json, res) {
                        let _feeReceiptManageInfo = JSON.parse(json);
                        let _feeReceiptDetails = _feeReceiptManageInfo.data;
                        _feeReceiptDetails.forEach(data => {
                            if (data.discountType == '2002') {
                                _item.discountPrice = parseFloat(data.discountPrice) * -1;
                            }else{
                                _item.discountPrice = 0;
                            }
                        })
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _loadPrintSpec: function() {
                var param = {
                    params: {
                        page: 1,
                        row: 1,
                        specCd: 2020,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                };
 
                //发送get请求
                vc.http.apiGet('/feePrintSpec/queryFeePrintSpec',
                    param,
                    function(json, res) {
                        var _json = JSON.parse(json);
                        var _data = _json.data;
                        if (_data.length > 0) {
                            $that.printPayFeeInfo.content = _data[0].content;
                            $that.printPayFeeInfo.qrImg = _data[0].qrImg;
                            if (_data[0].printName) {
                                $that.printPayFeeInfo.communityName = _data[0].printName;
                            }
                        }
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _printPurchaseApplyDiv: function() {
 
                $that.printFlag = '1';
                console.log('console.log($that.printFlag);', $that.printFlag);
                document.getElementById("print-btn").style.display = "none"; //隐藏
 
                window.print();
                //$that.printFlag = false;
                window.opener = null;
                window.close();
            },
            _closePage: function() {
                window.opener = null;
                window.close();
            },
            _listOwnerCar: function(_carId) {
                let param = {
                        params: {
                            page: 1,
                            row: 1,
                            communityId: vc.getCurrentCommunity().communityId,
                            carId: _carId
                        }
                    }
                    //发送get请求
                vc.http.apiGet('/owner.queryOwnerCars',
                    param,
                    function(json, res) {
                        let _json = JSON.parse(json);
                        let ownerCar = _json.data[0];
                        let _roomName = ownerCar.roomName.replace('栋', '-').replace("单元", '-').replace('室', '');
                        $that.printPayFeeInfo.feeReceipt[0].objName = _roomName;
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
        }
    });
 
})(window.vc);