基于jQuery实现咖啡订单管理简单应用

2020-05-23 06:21:47易采站长站整理

这款应用主要实现以下几个功能:

1.在表格中输入客户姓名并选择咖啡,点击“Add”能够把数据传至table。
2.table的每生成一行新数据,其status列都会出现一个小咖啡图标,表示正在制作中。
3.点击这个小咖啡图标,可以变成一个绿色的勾勾,表示该订单已经完成。
4.点击Export可以把表格数据导出为CSV文件。

HTML:


<div class="container-fluid">
<h1>Coffee Orders</h1>
<hr>
<div class="row">
<!-- order form -->
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 order-form">
<form class="form-inline" role="form">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-user" aria-hidden="true"></i></div>
<input type="text" class="form-control order-name" id="name" required="required" placeholder="Name">
</div>
<select class="selectpicker" id="drink">
<option>Latte</option>
<option>Moccha</option>
<option>Cappuchino</option>
<option>Fat White</option>
</select>
</div>
<button type="button" class="btn btn-primary add-order">Add</button>
<button type="reset" class="btn btn-primary pull-right">Reset</button>
</form>
</div>
<!-- order list -->
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8 order-list">
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Order</th>
<th>Status</th>
</tr>
</thead>
<tbody></tbody>
</table>
<div>
<a class="pull-right export" data-export="export">Export to CSV</a>
</div>
</div>
</div>
<hr>
<div class="time">
Order List of <span class="today"></span>
</div>
</div>
<footer>
Designed By <a href="http://blog.csdn.net/alenhhy" rel="external nofollow" target="_blank">Alen Hu</a>
</footer>

*使用了bootstrap3框架
*选择咖啡的部分,我使用了一款叫bootstrap-select的插件,可以完美兼容bootstrap的UI,但是写CSS的时候要注意一下,得通过浏览器F12查看DOM后,方可根据DOM来写,否则直接写select和option是没用的。