-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
206 lines (198 loc) · 9.29 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>租赁计算器</title>
<link rel="stylesheet" href="./layui/css/layui.css">
</head>
<body>
<div class="layui-main">
<fieldset class="layui-elem-field" style="margin-top: 30px;">
<legend><b>租赁计算器</b></legend>
<form class="layui-form" style="margin-top: 20px;">
<!-- 提示:如果你不想用form,你可以换成div等任何一个普通元素 -->
<div class="layui-form-item">
<label class="layui-form-label">租赁时长</label>
<div class="layui-input-inline">
<input type="text" name="renttime" id="renttime" placeholder="请选择租赁时长" readonly="true"
autocomplete="off" lay-verify="required" value="2020-02-01 ~ 2020-09-30"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">租金</label>
<div class="layui-input-inline">
<input type="number" name="rent" placeholder="请填写租金" autocomplete="off"
lay-verify="required|number" value="1000" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">单选框</label>
<div class="layui-input-block">
<input type="radio" name="mode" value="1" title="动态账期" lay-filter="mode1">
<input type="radio" name="mode" value="0" title="固定账期" lay-filter="mode0" checked>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">收租日</label>
<div class="layui-input-inline">
<select name="rentday" lay-filter="rentday">
<option value="1">1号</option>
<option value="2">2号</option>
<option value="3">3号</option>
<option value="4">4号</option>
<option value="5">5号</option>
<option value="6">6号</option>
<option value="7">7号</option>
<option value="8">8号</option>
<option value="9">9号</option>
<option value="10">10号</option>
<option value="11">11号</option>
<option value="12">12号</option>
<option value="13">13号</option>
<option value="14">14号</option>
<option value="15">15号</option>
<option value="16">16号</option>
<option value="17">17号</option>
<option value="18">18号</option>
<option value="19">19号</option>
<option value="20">20号</option>
<option value="21">21号</option>
<option value="22">22号</option>
<option value="23">23号</option>
<option value="24">24号</option>
<option value="25">25号</option>
<option value="26">26号</option>
<option value="27">27号</option>
<option value="28">28号</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">收租提前</label>
<div class="layui-input-block">
<input type="checkbox" name="forward" disabled lay-filter="forward" lay-skin="switch" lay-text="提前|固定">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">收租提前日</label>
<div class="layui-input-inline">
<select name="forwardday" lay-filter="forwardday" disabled>
<option value="1">1日</option>
<option value="2">2日</option>
<option value="3">3日</option>
<option value="4">4日</option>
<option value="5">5日</option>
<option value="6">6日</option>
<option value="7">7日</option>
<option value="8">8日</option>
<option value="9">9日</option>
<option value="10">10日</option>
<option value="11">11日</option>
<option value="12">12日</option>
<option value="13">13日</option>
<option value="14">14日</option>
<option value="15">15日</option>
<option value="16">16日</option>
<option value="17">17日</option>
<option value="18">18日</option>
<option value="19">19日</option>
<option value="20">20日</option>
<option value="21">21日</option>
<option value="22">22日</option>
<option value="23">23日</option>
<option value="24">24日</option>
<option value="25">25日</option>
<option value="26">26日</option>
<option value="27">27日</option>
<option value="28">28日</option>
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="submit">提交计算</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
<!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
</form>
</fieldset>
<!-- 计算器 END -->
<table class="layui-table" id="table"> </table>
</div>
</body>
<script src="./layui/layui.all.js"></script>
<script>
layui.use(['form', 'laydate', 'layer', 'table'], function () {
var form = layui.form,
laydate = layui.laydate,
layer = layui.layer,
table = layui.table,
$ = layui.jquery;
//各种基于事件的操作,下面会有进一步介绍
// 动态
form.on('radio(mode1)', (data) => {
$('input[name=forward]').removeAttr('disabled');
$('select[name=forwardday]').removeAttr('disabled');
form.render();
});
// 固定
form.on('radio(mode0)', (data) => {
$('input[name=forward]').attr('disabled', 'disabled');
$('input[name=forward]').prop('checked', false);
$('select[name=forwardday]').attr('disabled', 'disabled');
form.render();
});
laydate.render({
elem: '#renttime',
range: '~'
});
form.on('submit(submit)', (data) => {
table.render({
elem: '#table',
size: 'sm',
url: 'Example.php',
where: {
compute: 1,
renttime: data.field.renttime,
rent: data.field.rent,
rentday: data.field.rentday,
mode: data.field.mode,
forward: data.field.forward == 'on' ? 1:0,
forwardday: data.field.forwardday
},
cols: [
[{
field: 'index',
width: 80,
title: '周期'
}, {
field: 'start',
width: 150,
title: '开始时间'
}, {
field: 'end',
width: 150,
title: '结束时间',
}, {
field: 'days',
width: 100,
title: '周期时长',
}, {
field: 'pay',
width: 100,
title: '收租日',
}, {
field: 'rent',
width: 100,
title: '租金'
}]
]
});
return false;
});
});
</script>
</html>