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
| (function(vc) {
|
| vc.extends({
| data: {
| handoverInfo: {
| name: '',
| age: '',
| link: '',
| sex: '',
| ownerTypeCd: '',
| remark: '',
| ownerId: '',
| idCard: '',
| rooms: [],
| fees:[]
| }
| },
| _initMethod: function() {
|
| },
| _initEvent: function() {
| vc.on('handover', 'selectRoom', function(param) {
| $that.listRoom(param.roomId);
| })
|
| vc.on('handover', 'chooseOwner', function(param) {
| vc.copyObject(param,$that.handoverInfo);
| })
|
| vc.on('handover','notifyFeeConfig',function(fee){
| $that.handoverInfo.fees.push(fee);
| })
| },
| methods: {
| handoverValidate() {
| return vc.validate.validate({
| handoverInfo: $that.handoverInfo
| }, {
| 'handoverInfo.name': [{
| limit: "required",
| param: "",
| errInfo: "姓名不能为空"
| },
| {
| limit: "maxin",
| param: "2,64",
| errInfo: "姓名长度必须在2位至64位"
| },
| ],
| // 'handoverInfo.age': [{
| // limit: "required",
| // param: "",
| // errInfo: "年龄不能为空"
| // },
| // {
| // limit: "num",
| // param: "",
| // errInfo: "年龄不是有效的数字"
| // },
| // ],
| 'handoverInfo.sex': [{
| limit: "required",
| param: "",
| errInfo: "性别不能为空"
| }],
| 'handoverInfo.link': [{
| limit: "required",
| param: "",
| errInfo: "手机号不能为空"
| }],
| 'handoverInfo.idCard': [{
| limit: "idCard",
| param: "",
| errInfo: "身份证格式错误"
| }],
| });
| },
| saveHandoverInfo: function() {
| if (!$that.handoverValidate()) {
| vc.toast(vc.validate.errInfo);
| return;
| }
| $that.handoverInfo.communityId = vc.getCurrentCommunity().communityId;
| vc.http.apiPost(
| '/owner.saveHandover',
| JSON.stringify($that.handoverInfo), {
| emulateJSON: true
| },
| function(json, res) {
| let _json = JSON.parse(json);
| if (_json.code == 0) {
| //关闭model
| vc.toast('提交成功');
| $that._goBack();
| return;
| }
| vc.toast(_json.msg);
|
| },
| function(errInfo, error) {
| console.log('请求失败处理');
|
| vc.toast(errInfo);
|
| });
| },
| clearAddHandoverInfo: function() {
| $that.handoverInfo = {
| name: '',
| age: '',
| link: '',
| sex: '',
| ownerTypeCd: '',
| remark: '',
| ownerId: '',
| idCard: '',
| rooms: [],
| fees:[]
| };
| },
| _goBack: function() {
| vc.goBack();
| },
| _selectRoom: function() {
| vc.emit('roomTree','openRoomTree',{
| callName:'handover'
| })
| },
| _openDelRoomModel: function(_room) {
| let _tmpRooms = [];
| $that.handoverInfo.rooms.forEach(item => {
| if (item.roomId != _room.roomId) {
| _tmpRooms.push(item);
| }
| });
| $that.handoverInfo.rooms = _tmpRooms;
| },
| _openDelFeeModel:function(){
|
| },
| _selectOwner: function() {
| vc.emit('searchOwner', 'openSearchOwnerModel', {});
| },
| listRoom: function(_roomId) {
| var param = {
| params: {
| page:1,
| row:1,
| roomId:_roomId,
| communityId:vc.getCurrentCommunity().communityId
| }
| };
| //发送get请求
| vc.http.apiGet('/room.queryRooms',
| param,
| function(json, res) {
| let listRoomData = JSON.parse(json);
| let room = listRoomData.rooms[0];
| if(room.state != '2002'){
| vc.toast('房屋不是未销售状态,请先退房');
| return;
| }
|
| $that.handoverInfo.rooms.push(room);
|
| },
| function(errInfo, error) {
| console.log('请求失败处理');
| }
| );
| },
| _createFeeOrder:function(){
| vc.emit('selectFeeConfig', 'openSelectFeeConfigModal',{
| call:'handover'
| })
| },
| _openDelFeeModel: function(_room) {
| let _tmpFees = [];
| $that.handoverInfo.fees.forEach(item => {
| if (item.configId != _room.configId) {
| _tmpFees.push(item);
| }
| });
| $that.handoverInfo.fees = _tmpFees;
| },
| }
| });
|
| })(window.vc);
|
|