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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    var TEMP_SEARCH = "simplifyAcceptanceSearch";
    vc.extends({
        data: {
            simplifyAcceptanceInfo: {
                searchType: '1',
                searchValue: '',
                searchPlaceholder: '请输入房屋编号 楼栋-单元-房屋 如1-1-1',
                ownerPhoto: '',
                _currentTab: 'simplifyRoomFee',
                roomId: '',
                ownerId: '',
                ownerRemark: '',
                roomRemark: '',
                name: '',
                idCard: '',
                link: '',
                createTime: '',
                apartmentName: '',
                floorNum: '',
                unitNum: '',
                roomNum: '',
                builtUpArea: '',
                feeCoefficient: '',
                stateName: '',
                roomName: '',
                roomType: '',
                roomSubTypeName: '',
                roomSubType: '',
                roomArea: '',
                sex: '',
                roomRent: '',
                acctAmount:'',
                depositAmount:'0',
                timer: {}
            }
        },
        _initMethod: function () {
            if (!vc.isBack()) {
                return;
            }
            //检查是否有缓存数据
            let _tempData = vc.getData(TEMP_SEARCH);
            if (_tempData == null) {
                return;
            }
            $that.simplifyAcceptanceInfo.searchType = _tempData.searchType;
            $that.simplifyAcceptanceInfo.searchValue = _tempData.searchValue;
            $that.simplifyAcceptanceInfo.searchPlaceholder = _tempData.searchPlaceholder;
            $that._doSearch();
        },
        _initEvent: function () {
            vc.on('simplifyAcceptance', 'chooseRoom', function (_room) {
                vc.copyObject(_room, $that.simplifyAcceptanceInfo);
                $that.simplifyAcceptanceInfo.roomRemark = _room.remark;
                $that.simplifyAcceptanceInfo.roomName = _room.floorNum + '栋' + _room.unitNum + '单元' + _room.roomNum;
                vc.emit('simplifyRoomFee', 'switch', $that.simplifyAcceptanceInfo);
                $that.computeDeposit();
            });
            vc.on('simplifyAcceptance', 'notifyOwner', function (_owner) {
                $that.simplifyAcceptanceInfo.searchValue = _owner.name;
                $that._doSearch();
            });
            vc.on('simplifyAcceptance', 'notifyRoom', function (_room) {
                $that.simplifyAcceptanceInfo.searchValue = _room.floorNum + "-" + _room.unitNum + "-" + _room.roomNum;
                $that._doSearch();
            });
            vc.on('simplifyAcceptance', 'selectRoom', function (_param) {
                $that.simplifyAcceptanceInfo.searchType = '1';
                $that.simplifyAcceptanceInfo.searchValue = _param.roomName;
                $that.simplifyAcceptanceInfo.searchPlaceholder = "请输入房屋编号 楼栋-单元-房屋 如1-1-1";
                $that._doSearch();
            });
            vc.on('simplifyAcceptance', 'doSearch', function (_tab) {
                $that._doSearch();
                setTimeout(function(){
                    $that.changeTab(_tab)
                },2000)
            })
        },
        methods: {
            _changeSearchType: function () {
                switch ($that.simplifyAcceptanceInfo.searchType) {
                    case '1':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入房屋编号 楼栋-单元-房屋 如1-1-1';
                        $that.simplifyAcceptanceInfo.searchValue = "";
                        break;
                    case '2':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入业主名称';
                        $that.simplifyAcceptanceInfo.searchValue = "";
                        break;
                    case '3':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入业主手机号';
                        $that.simplifyAcceptanceInfo.searchValue = "";
                        break;
                    case '4':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入业主身份证';
                        $that.simplifyAcceptanceInfo.searchValue = "";
                        break;
                    case '5':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入业主车牌号';
                        $that.simplifyAcceptanceInfo.searchValue = "";
                        break;
                    case '6':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入家庭成员名称';
                        $that.simplifyAcceptanceInfo.searchValue = "";
                        break;
                    case '7':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入家庭成员电话';
                        $that.simplifyAcceptanceInfo.searchValue = "";
                        break;
                    case '8':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入家庭成员身份证';
                        $that.simplifyAcceptanceInfo.searchValue = "";
                        break;
                    case '9':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入商铺编号 楼栋-商铺 如1-1';
                        break;
                    case '10':
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入合同号';
                        break;
                    default:
                        $that.simplifyAcceptanceInfo.searchPlaceholder = '请输入房屋编号 楼栋-单元-房屋 如1-1-1';
                        $that.simplifyAcceptanceInfo.searchValue = "";
                }
            },
            _doSearch: function () {
                if (!vc.isNotEmpty($that.simplifyAcceptanceInfo.searchValue)) {
                    vc.toast('请输入查询条件');
                    return;
                }
                // 清理信息
                $that._clearData();
                let _param = {
                    params: {
                        searchType: $that.simplifyAcceptanceInfo.searchType,
                        searchValue: $that.simplifyAcceptanceInfo.searchValue,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                }
                vc.http.apiGet('/ownerApi/comprehensiveQuery',
                    _param,
                    function (json, res) {
                        let _ownerJson = JSON.parse(json);
                        if (_ownerJson.code != 0) {
                            vc.toast(_ownerJson.msg);
                            return;
                        }
                        $that.saveTempSearchData();
                        let _owner = _ownerJson.data;
                        vc.copyObject(_owner, $that.simplifyAcceptanceInfo);
                        $that.simplifyAcceptanceInfo.ownerRemark = _owner.remark;
                        $that.simplifyAcceptanceInfo.ownerPhoto = _owner.faceUrl;
                        if (!_owner.hasOwnProperty('rooms')) {
                            return;
                        }
                        let _rooms = _owner.rooms;
                        if (_rooms.length > 1) {
                            vc.emit('searchRoom', 'showOwnerRooms', _rooms);
                            return;
                        }
                        vc.copyObject(_rooms[0], $that.simplifyAcceptanceInfo);
                        $that.simplifyAcceptanceInfo.roomRemark = _rooms[0].remark;
                        $that.simplifyAcceptanceInfo.roomName = _rooms[0].floorNum + '栋' + _rooms[0].unitNum + '单元' + _rooms[0].roomNum + '室';
                        vc.emit('simplifyRoomFee', 'switch', $that.simplifyAcceptanceInfo);
 
                        //todo 计算押金
                        $that.computeDeposit();
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            saveTempSearchData: function () {
                let _searchType = $that.simplifyAcceptanceInfo.searchType;
                let _searchValue = $that.simplifyAcceptanceInfo.searchValue;
                let _searchPlaceholder = $that.simplifyAcceptanceInfo.searchPlaceholder;
                //缓存起来
                vc.saveData(TEMP_SEARCH, {
                    searchType: _searchType,
                    searchValue: _searchValue,
                    searchPlaceholder: _searchPlaceholder
                });
            },
            changeTab: function (_tab) {
                $that.simplifyAcceptanceInfo._currentTab = _tab;
                vc.emit(_tab, 'switch', {
                    ownerId: $that.simplifyAcceptanceInfo.ownerId,
                    ownerName: $that.simplifyAcceptanceInfo.name,
                    roomId: $that.simplifyAcceptanceInfo.roomId,
                    roomName: $that.simplifyAcceptanceInfo.roomName,
                    floorNum: $that.simplifyAcceptanceInfo.floorNum,
                    unitNum: $that.simplifyAcceptanceInfo.unitNum,
                    roomNum: $that.simplifyAcceptanceInfo.roomNum
                })
            },
            _toSimplifyNotepadPage: function () {
                if (!$that.simplifyAcceptanceInfo.ownerId) {
                    vc.toast('请先选择房屋');
                    return;
                }
                vc.jumpToPage('/#/pages/property/simplifyNotepadManage?roomId=' +
                    $that.simplifyAcceptanceInfo.roomId + "&ownerId=" + $that.simplifyAcceptanceInfo.ownerId)
            },
            errorLoadImg: function () {
                $that.simplifyAcceptanceInfo.ownerPhoto = "/img/noPhoto.jpg";
            },
            _clearData: function () {
                let _searchType = $that.simplifyAcceptanceInfo.searchType;
                let _searchValue = $that.simplifyAcceptanceInfo.searchValue;
                let _searchPlaceholder = $that.simplifyAcceptanceInfo.searchPlaceholder;
                $that.simplifyAcceptanceInfo = {
                    searchType: _searchType,
                    searchValue: _searchValue,
                    searchPlaceholder: _searchPlaceholder,
                    ownerPhoto: '',
                    _currentTab: 'simplifyRoomFee',
                    roomId: '',
                    ownerId: '',
                    name: '',
                    idCard: '',
                    link: '',
                    createTime: '',
                    apartmentName: '',
                    floorNum: '',
                    unitNum: '',
                    roomNum: '',
                    builtUpArea: '',
                    feeCoefficient: '',
                    stateName: '',
                    roomName: '',
                    sex: '',
                    ownerRemark: '',
                    roomRemark: '',
                    roomType: '',
                    roomSubTypeName: '',
                    roomSubType: '',
                    roomArea: '',
                    roomRent: '',
                    acctAmount:'',
                    depositAmount:'0',
                };
                $that.changeTab('simplifyRoomFee');
            },
            _simplifyAcceptanceChooseRoom: function () {
                vc.emit('roomTree', 'openRoomTree', {
                    callName: 'simplifyAcceptance'
                })
            },
            _handover: function () {
                vc.jumpToPage('/#/pages/property/handover')
            },
            _simplifyOwnerExitRoom: function () {
                vc.jumpToPage('/#/pages/property/ownerExitRoom')
            },
            _simplifyInputOwner: function () {
                if ($that.simplifyAcceptanceInfo.searchType != "2" && $that.simplifyAcceptanceInfo.searchType != "6"
                    && $that.simplifyAcceptanceInfo.searchType != "1") {
                    return;
                }
                if ($that.simplifyAcceptanceInfo.timer) {
                    clearTimeout($that.simplifyAcceptanceInfo.timer)
                }
                if ($that.simplifyAcceptanceInfo.searchType == "1") {
                    $that.simplifyAcceptanceInfo.timer = setTimeout(() => {
                        vc.emit('inputSearchRoomInfo', 'searchRoom', {
                            callComponent: 'simplifyAcceptance',
                            roomName: $that.simplifyAcceptanceInfo.searchValue
                        });
                    }, 1500)
                    return;
                }
                let _ownerTypeCd = $that.simplifyAcceptanceInfo.searchType == "2" ? '1001' : '1002,1003,1005'
                $that.simplifyAcceptanceInfo.timer = setTimeout(() => {
                    vc.emit('inputSearchOwnerInfo', 'searchOwner', {
                        callComponent: 'simplifyAcceptance',
                        ownerTypeCd: _ownerTypeCd,
                        ownerName: $that.simplifyAcceptanceInfo.searchValue
                    });
                }, 1500)
            },
            _toRefundDepositFee:function(){
                let _roomId = $that.simplifyAcceptanceInfo.roomId;
                let _ownerId = $that.simplifyAcceptanceInfo.ownerId;
                vc.jumpToPage('/#/pages/fee/refundDepositFee?roomId='+_roomId+'&ownerId='+_ownerId)
            },
            computeDeposit:function(){
                let param = {
                    params: {
                        page: 1,
                        row: 100,
                        payerObjId: $that.simplifyAcceptanceInfo.roomId,
                        ownerId: $that.simplifyAcceptanceInfo.ownerId,
                        communityId: vc.getCurrentCommunity().communityId,
                        state:'1400',
                    }
                };
                $that.simplifyAcceptanceInfo.depositAmount = '0';
                //发送get请求
                vc.http.apiGet('/fee.queryFeeDeposit',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        if(_json.code != 0){
                            return;
                        }
                        if(!_json.data || _json.data.length < 1){
                            return ;
                        }
                        let _dispositAmount = 0;
                        _json.data.forEach(_data => {
                            _dispositAmount += parseFloat(_data.receivedAmount);
                        });
                        $that.simplifyAcceptanceInfo.depositAmount = _dispositAmount.toFixed(2);
                    }, function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            }
        }
    });
})(window.vc);