Skip to content

Commit b920648

Browse files
committed
优化代码
1 parent 3b40b69 commit b920648

4 files changed

Lines changed: 255 additions & 5 deletions

File tree

public/components/property/simplifyRoomFee/simplifyRoomFee.html

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@
2121
</select>
2222
</div>
2323
<div class="col-lg-2 padding-lr-xs" v-if="simplifyRoomFeeInfo.roomId">
24-
<select class="custom-select custom-select-sm" v-model="simplifyRoomFeeInfo.state" @change="_changeSimplifyRoomConfigId()">
25-
<option selected value="">请选择状态</option>
24+
<select class="custom-select custom-select-sm" v-model="simplifyRoomFeeInfo.state"
25+
@change="_changeSimplifyRoomConfigId()">
26+
<option selected value="">请选择状态</option>
2627
<option value="2008001">收费中</option>
2728
<option value="2009001">收费结束</option>
2829
</select>
2930
</div>
3031
<div class="col-lg-6 text-right" v-if="simplifyRoomFeeInfo.roomId">
32+
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px"
33+
v-on:click="_openTempImportRoomFeeModal()">
34+
临时收费
35+
</button>
3136
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px"
3237
v-on:click="_openProxyFeeModal()">
3338
代收费用
@@ -71,18 +76,21 @@
7176
<td class="text-center">{{fee.startTime}}</td>
7277
<td class="text-center">{{_getEndTime(fee)}}</td>
7378
<td class="text-center">{{_getDeadlineTime(fee)}}</td>
74-
<td class="text-center" v-if="fee.computingFormula == '5005'" :title="_simplifyRoomGetFeeOwnerInfo(fee.feeAttrs)">
79+
<td class="text-center" v-if="fee.computingFormula == '5005'"
80+
:title="_simplifyRoomGetFeeOwnerInfo(fee.feeAttrs)">
7581
<div>上期度数:{{fee.preDegrees}}</div>
7682
<div>本期度数:{{fee.curDegrees}} </div>
7783
<div>单价:{{fee.squarePrice}} </div>
7884
<div>附加费:{{fee.additionalAmount}}</div>
7985
</td>
80-
<td class="text-center" v-else-if="fee.computingFormula == '6006'" :title="_simplifyRoomGetFeeOwnerInfo(fee.feeAttrs)">
86+
<td class="text-center" v-else-if="fee.computingFormula == '6006'"
87+
:title="_simplifyRoomGetFeeOwnerInfo(fee.feeAttrs)">
8188
<div>用量:{{_getAttrValue(fee.feeAttrs,'390006')}}</div>
8289
<div>单价:{{fee.squarePrice}} </div>
8390
<div>附加费:{{fee.additionalAmount}}</div>
8491
</td>
85-
<td class="text-center" width="150" v-else-if="fee.feeTypeCd == '888800010017'" :title="_simplifyRoomGetFeeOwnerInfo(fee.feeAttrs)">
92+
<td class="text-center" width="150" v-else-if="fee.feeTypeCd == '888800010017'"
93+
:title="_simplifyRoomGetFeeOwnerInfo(fee.feeAttrs)">
8694
<div>算法:{{_getAttrValue(fee.feeAttrs,'390005')}}</div>
8795
<div>用量:{{_getAttrValue(fee.feeAttrs,'390003')}}</div>
8896
</td>
@@ -121,5 +129,7 @@
121129
</div>
122130
</div>
123131

132+
<vc:create path="property/tempImportRoomFee"></vc:create>
133+
124134

125135
</div>

public/components/property/simplifyRoomFee/simplifyRoomFee.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@
155155
feeId: _fee.feeId
156156
});
157157
},
158+
_openTempImportRoomFeeModal:function(){
159+
vc.emit('tempImportRoomFee', 'openImportRoomFeeModal',{
160+
roomId: $that.simplifyRoomFeeInfo.roomId,
161+
roomName: $that.simplifyRoomFeeInfo.roomName,
162+
ownerName: $that.simplifyRoomFeeInfo.name
163+
})
164+
},
158165
clearSimplifyRoomFeeInfo: function () {
159166
let _feeConfigs = $that.roomCreateFeeAddInfo.feeTypeCds;
160167
$that.simplifyRoomFeeInfo = {
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<div id="tempImportRoomFeeModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
2+
<div class="modal-dialog modal-lg">
3+
<div class="modal-content">
4+
<div class="modal-body">
5+
<h3 class="m-t-none m-b ">临时收费</h3>
6+
<div class="ibox-content">
7+
<div>
8+
<div>
9+
<div class="form-group row">
10+
<label class="col-sm-2 col-form-label">费用类型</label>
11+
<div class="col-sm-10">
12+
<select class="custom-select" v-model="tempImportRoomFeeInfo.feeTypeCd"
13+
@change="_changeFeeTypeCd(tempImportRoomFeeInfo.feeTypeCd)">
14+
<option selected disabled value="">必填,请选择费用类型</option>
15+
16+
<option v-for="(item,index) in tempImportRoomFeeInfo.feeTypeCds" :key="index"
17+
v-bind:value="item.statusCd" >
18+
{{item.name}}
19+
</option>
20+
</select></div>
21+
</div>
22+
<div class="form-group row">
23+
<label class="col-sm-2 col-form-label">费用对象</label>
24+
<div class="col-sm-10">
25+
<input v-model="tempImportRoomFeeInfo.objName" type="text" disabled="disabled"
26+
placeholder="必填,请填写费用对象" class="form-control ">
27+
</div>
28+
</div>
29+
<div class="form-group row">
30+
<label class="col-sm-2 col-form-label">费用名称</label>
31+
<div class="col-sm-10">
32+
<input v-model="tempImportRoomFeeInfo.feeName" type="text"
33+
placeholder="必填,请填写费用对象" class="form-control ">
34+
</div>
35+
</div>
36+
<div class="form-group row">
37+
<label class="col-sm-2 col-form-label">收费金额</label>
38+
<div class="col-sm-10">
39+
<input v-model="tempImportRoomFeeInfo.amount" type="text"
40+
placeholder="必填,请填写费用对象" class="form-control ">
41+
</div>
42+
</div>
43+
<div class="form-group row">
44+
<label class="col-sm-2 col-form-label">开始时间</label>
45+
<div class="col-sm-10">
46+
<input v-model="tempImportRoomFeeInfo.startTime" type="text"
47+
placeholder="必填,请填写开始时间" class="form-control tempImportFeeStartTime">
48+
</div>
49+
</div>
50+
<div class="form-group row">
51+
<label class="col-sm-2 col-form-label">结束时间</label>
52+
<div class="col-sm-10">
53+
<input v-model="tempImportRoomFeeInfo.endTime" type="text"
54+
placeholder="必填,请填写结束时间" class="form-control tempImportFeeEndTime">
55+
</div>
56+
</div>
57+
<div class="ibox-content">
58+
<button class="btn btn-primary float-right" type="button" v-on:click="_saveTempImportFeeInfo()"><i
59+
class="fa fa-check"></i>&nbsp;提交
60+
</button>
61+
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
62+
data-dismiss="modal">取消
63+
</button>
64+
</div>
65+
</div>
66+
</div>
67+
</div>
68+
</div>
69+
</div>
70+
</div>
71+
</div>
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
(function (vc) {
2+
3+
vc.extends({
4+
data: {
5+
tempImportRoomFeeInfo: {
6+
communityId: vc.getCurrentCommunity().communityId,
7+
feeTypeCd: '',
8+
feeTypeCds: [],
9+
feeName: '',
10+
objName: '',
11+
objId: '',
12+
amount: '',
13+
startTime: '',
14+
endTime: ''
15+
}
16+
},
17+
_initMethod: function () {
18+
vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
19+
vc.component.tempImportRoomFeeInfo.feeTypeCds = _data;
20+
});
21+
vc.initDate('tempImportFeeStartTime', function (_startTime) {
22+
$that.tempImportRoomFeeInfo.startTime = _startTime;
23+
});
24+
vc.initDate('tempImportFeeEndTime', function (_endTime) {
25+
$that.tempImportRoomFeeInfo.endTime = _endTime;
26+
let start = Date.parse(new Date($that.tempImportRoomFeeInfo.startTime))
27+
let end = Date.parse(new Date($that.tempImportRoomFeeInfo.endTime))
28+
if (start - end >= 0) {
29+
vc.toast("结束时间必须大于开始时间")
30+
$that.tempImportRoomFeeInfo.endTime = '';
31+
}
32+
});
33+
},
34+
_initEvent: function () {
35+
vc.on('tempImportRoomFee', 'openImportRoomFeeModal',
36+
function (_room) {
37+
$that.clearTempImportRoomFeeInfo();
38+
$that.tempImportRoomFeeInfo.objId = _room.roomId;
39+
$that.tempImportRoomFeeInfo.objName = _room.roomName;
40+
$('#tempImportRoomFeeModel').modal('show');
41+
42+
});
43+
},
44+
methods: {
45+
46+
tempImportRoomFeeValidate() {
47+
return vc.validate.validate({
48+
tempImportRoomFeeInfo: vc.component.tempImportRoomFeeInfo
49+
},
50+
{
51+
'tempImportRoomFeeInfo.communityId': [{
52+
limit: "required",
53+
param: "",
54+
errInfo: "数据异常还没有入驻小区"
55+
}
56+
],
57+
'tempImportRoomFeeInfo.feeTypeCd': [{
58+
limit: "required",
59+
param: "",
60+
errInfo: "费用类型不能为空"
61+
}
62+
],
63+
'tempImportRoomFeeInfo.feeName': [
64+
{
65+
limit: "required",
66+
param: "",
67+
errInfo: "费用名称不能为空"
68+
}
69+
],
70+
'tempImportRoomFeeInfo.objId': [
71+
{
72+
limit: "required",
73+
param: "",
74+
errInfo: "费用对象不能为空"
75+
}
76+
],
77+
'tempImportRoomFeeInfo.startTime': [
78+
{
79+
limit: "required",
80+
param: "",
81+
errInfo: "开始时间不能为空"
82+
},
83+
{
84+
limit: "date",
85+
param: "",
86+
errInfo: "开始时间格式错误"
87+
},
88+
],
89+
'tempImportRoomFeeInfo.endTime': [
90+
{
91+
limit: "required",
92+
param: "",
93+
errInfo: "结束时间不能为空"
94+
},
95+
{
96+
limit: "date",
97+
param: "",
98+
errInfo: "结束时间格式错误"
99+
},
100+
],
101+
102+
'tempImportRoomFeeInfo.amount': [
103+
{
104+
limit: "required",
105+
param: "",
106+
errInfo: "金额不能为空"
107+
},
108+
{
109+
limit: "money",
110+
param: "",
111+
errInfo: "金额格式错误"
112+
},
113+
],
114+
});
115+
},
116+
clearTempImportRoomFeeInfo: function () {
117+
var _feeTypeCds = vc.component.tempImportRoomFeeInfo.feeTypeCds;
118+
vc.component.tempImportRoomFeeInfo = {
119+
communityId: vc.getCurrentCommunity().communityId,
120+
feeTypeCd: '',
121+
feeTypeCds: _feeTypeCds,
122+
feeName: '',
123+
objName: '',
124+
objId: '',
125+
amount: '',
126+
startTime: '',
127+
endTime: ''
128+
};
129+
},
130+
_saveTempImportFeeInfo: function () {
131+
if (!vc.component.tempImportRoomFeeValidate()) {
132+
vc.toast(vc.validate.errInfo);
133+
return;
134+
}
135+
vc.component.tempImportRoomFeeInfo.communityId = vc.getCurrentCommunity().communityId;
136+
137+
vc.http.post(
138+
'importRoomFee','importTempData',
139+
JSON.stringify(vc.component.tempImportRoomFeeInfo),
140+
{
141+
emulateJSON: true
142+
},
143+
function (json, res) {
144+
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
145+
let _json = JSON.parse(json);
146+
if (_json.code == 0) {
147+
//关闭model
148+
$('#tempImportRoomFeeModel').modal('hide');
149+
vc.emit('listRoomFee', 'notify', {});
150+
vc.emit('simplifyRoomFee', 'notify', {});
151+
}
152+
vc.message(_json.msg);
153+
},
154+
function (errInfo, error) {
155+
console.log('请求失败处理');
156+
vc.message(errInfo);
157+
});
158+
},
159+
}
160+
});
161+
162+
})(window.vc);

0 commit comments

Comments
 (0)