订单用户表1(用户查询 、手机号查询 、选择城市 、选择状态、月份查询 、ID排序 、添加数据、批量发货、批量删除)
来源:互联网 发布:田中真弓等级知乎 编辑:程序博客网 时间:2024/06/03 14:51
依赖:
-----------------------------------------------------------------------------------
效果:
-----------------------------------------------------------------------------------
代码:
<!DOCTYPE html><html ng-app="OrderApp"><head> <meta charset="UTF-8"> <title>订单管理</title> <script type="text/javascript" src="jquery.1.12.4.js"></script> <script type="text/javascript" src="angular-1.3.0.js"></script> <script type="text/javascript" src="data.js"></script> <style type="text/css"> * { font-size: 14px; margin: 0; padding: 0; } body { padding: 16px 32px; } .filter { position: relative; width: 800px; height: 40px; margin: 0 auto; } .filter input { width: 152px; height: 24px; border: 1px solid #999; border-radius: 4px; padding-left: 8px; } .filter select { width: 86px; height: 24px; border: 1px solid #999; border-radius: 4px; } .buttons { width: 800px; height: 40px; margin: 0 auto; } .buttons button { width: 80px; height: 24px; background-color: green; border: 0; border-radius: 4px; color: white; } .buttons .remove_btn { background-color: red; } .list { width: 800px; margin: 0 auto; } .list table tr { height: 32px; } .list thead tr { background-color: #777; } .list tbody tr:nth-child(odd) { background-color: #ccc; } .list tbody tr:nth-child(even) { background-color: #fff; } .list button { width: 40px; height: 18px; line-height: 18px; background-color: green; border: 0; border-radius: 4px; color: white; font-size: 8px; } .form { width: 460px; border: 1px solid #999; margin: 0 auto; } .form div { clear: both; } .form .formErr { border: 1px solid red; } .form .label { display: block; float: left; width: 80px; height: 40px; line-height: 40px; text-align: end; } .form .txt { display: block; float: left; width: 340px; height: 40px; line-height: 40px; padding-left: 16px; } .form input { width: 312px; height: 24px; border: 1px solid #999; border-radius: 4px; padding-left: 8px; } .form select { width: 86px; height: 24px; border: 1px solid #999; border-radius: 4px; } .form button { width: 56px; height: 24px; background-color: green; border: 0; border-radius: 4px; color: white; } .form .errTips { width: 226px; background-color: lightpink; color: darkred; border-radius: 4px; margin-left: 96px; margin-top: 6px; margin-bottom: 4px; padding: 16px 48px; } </style> <script type="text/javascript"> // 全选/全不选 $(function () { $("input[name='check_all']").click(function () { var checked = this.checked; // 获取 <input type="checkbox" name="check_all"/> 中checked属性的值 $("input[name='order_id[]']").each(function () { this.checked = checked; // 依次设置每一个 <input type="checkbox" name="order_id[]"/> 中checked属性的值 }); }); }); var app = angular.module("OrderApp", []); app.controller("OrderCtrl", function ($scope) { $scope.data = data; var id = 12; $scope.filterByMonth = function (order) { if ($scope.filter_begin_month == undefined || $scope.filter_begin_month == "") { return true; } if ($scope.filter_end_month == undefined || $scope.filter_end_month == "") { return true; } var beginMonth = parseInt($scope.filter_begin_month); var endMonth = parseInt($scope.filter_end_month); if (beginMonth > endMonth) { return true; } var month = order.dtCreated.substr(0, order.dtCreated.indexOf("-")); month = parseInt(month); return (month >= beginMonth && month <= endMonth); }; // 发货 $scope.deliver = function (id) { for (var i in $scope.data) { if ($scope.data[i].id == id) { $scope.data[i].status = "已发货"; } } }; // 批量发货 $scope.batchDeliver = function () { $("input[name='order_id[]']:checked").each(function () { $scope.deliver(this.id); }); }; // 删除 $scope.remove = function (id) { for (var i in $scope.data) { if ($scope.data[i].id == id) { $scope.data.splice(i, 1); } } }; // 批量删除 $scope.batchRemove = function () { $("input[name='order_id[]']:checked").each(function () { $scope.remove(this.id); }); }; $scope.isShowAddOrderForm = false; $scope.showAddOrderForm = function () { $scope.isShowAddOrderForm = true; }; $scope.errTips = []; $scope.submitAddOrderForm = function () { $scope.errTips = []; $scope.goodsNameClassName = ""; $scope.userNameClassName = ""; $scope.phoneClassName = ""; $scope.hasErr = false; //判断不能为空 if ($scope.goodsName == undefined || $scope.goodsName == "" || $scope.goodsName.trim() == "") { $scope.errTips.push("商品名不能为空!"); $scope.goodsNameClassName = "formErr"; $scope.hasErr = true; } if ($scope.userName == undefined || $scope.userName == "" || $scope.userName.trim() == "") { $scope.errTips.push("用户名不能为空!"); $scope.userNameClassName = "formErr"; $scope.hasErr = true; } if ($scope.phone == undefined || $scope.phone == "" || $scope.phone.trim() == "") { $scope.errTips.push("手机号不能为空!"); $scope.phoneClassName = "formErr"; $scope.hasErr = true; } if ($scope.city == undefined || $scope.city == "" || $scope.city.trim() == "") { $scope.errTips.push("请选择城市!"); $scope.hasErr = true; } if ($scope.goodsName.trim().length < 6 || $scope.goodsName.trim().length > 20) { $scope.errTips.push("商品名必须是6-20个字符!"); $scope.goodsNameClassName = "formErr"; $scope.hasErr = true; } if ($scope.userName.trim().length < 4 || $scope.userName.trim().length > 16) { $scope.errTips.push("用户名必须是4-16个字符!"); $scope.userNameClassName = "formErr"; $scope.hasErr = true; } if ($scope.phone.trim().length != 11) { $scope.errTips.push("手机号格式不正确!"); $scope.phoneClassName = "formErr"; $scope.hasErr = true; } if ($scope.hasErr) { return; } $scope.data.push({ id: ++id, goodsName: $scope.goodsName, userName: $scope.userName, phone: $scope.phone, price: 4550.00, city: $scope.city, dtCreated: "10-16 10:00", status: "待发货" }); }; }); </script></head><body ng-controller="OrderCtrl"><div class="filter"> <input type="text" placeholder="用户名搜索" ng-model="filter_user_name"/> <input type="text" placeholder="手机号搜索" ng-model="filter_phone"/> <select class="choose_city" ng-model="filter_city"> <option value="">选择城市</option> <option value="北京">北京</option> <option value="上海">上海</option> <option value="天津">天津</option> <option value="重庆">重庆</option> </select> <select class="choose_status" ng-model="filter_status"> <option value="">选择状态</option> <option value="待发货">待发货</option> <option value="已发货">已发货</option> <option value="已收货">已收货</option> </select> <select class="choose_time_begin_month" ng-model="filter_begin_month"> <option value="">开始月份</option> <option value="1">01</option> <option value="2">02</option> <option value="3">03</option> <option value="4">04</option> <option value="5">05</option> <option value="6">06</option> <option value="7">07</option> <option value="8">08</option> <option value="9">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> - <select class="choose_time_end_month" ng-model="filter_end_month"> <option value="">结束月份</option> <option value="1">01</option> <option value="2">02</option> <option value="3">03</option> <option value="4">04</option> <option value="5">05</option> <option value="6">06</option> <option value="7">07</option> <option value="8">08</option> <option value="9">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> <select class="id_order" ng-model="id_order_type"> <option value="">ID排序</option> <option value="id">ID正序</option> <option value="-id">ID倒序</option> </select></div><div class="buttons"> <button class="add_btn" ng-click="showAddOrderForm();">新增订单</button> <button class="deliver_btn" ng-click="batchDeliver()">批量发货</button> <button class="remove_btn" ng-click="batchRemove()">批量删除</button></div><div class="list"> <table width="800px" cellspacing="0" rules="cols" border="1px"> <thead> <tr> <th width="4%"> <input type="checkbox" name="check_all"/> </th> <th width="6%">ID</th> <th width="12%">商品名</th> <th width="10%">用户名</th> <th width="14%">手机号</th> <th width="10%">价格</th> <th width="10%">城市</th> <th width="18%">下单时间</th> <th width="8%">状态</th> <th width="8%">操作</th> </tr> </thead> <tbody> <tr align="center" ng-repeat="order in data | filter: {userName: filter_user_name} | filter: {phone: filter_phone} | filter: {city: filter_city} | filter: {status: filter_status} | filter: filterByMonth | orderBy: id_order_type"> <td> <input type="checkbox" name="order_id[]" id="{{ order.id }}"/> </td> <td>{{ order.id }}</td> <td>{{ order.goodsName }}</td> <td>{{ order.userName }}</td> <td>{{ order.phone }}</td> <td>{{ order.price | currency: "¥"}}</td> <td>{{ order.city }}</td> <td>{{ order.dtCreated }}</td> <td> <span ng-show="order.status=='待发货'" ng-click="deliver(order.id)"> <a href="javascript: void(0);">发货</a> </span> <span ng-show="order.status=='已发货'">已发货</span> <span ng-show="order.status=='已收货'">已收货</span> </td> <td> <a href="javascript: void(0);" ng-click="remove(order.id)">删除</a> </td> </tr> </tbody> </table></div><div class="form" ng-show="isShowAddOrderForm"> <div> <span class="label">新增订单</span> <span class="txt"></span> </div> <div> <span class="label">商品名</span> <span class="txt"> <input type="text" placeholder="6-20个字符" ng-model="goodsName" ng-class="goodsNameClassName"/> </span> </div> <div> <span class="label">用户名</span> <span class="txt"> <input type="text" placeholder="4-16个字符" ng-model="userName" ng-class="userNameClassName"/> </span> </div> <div> <span class="label">手机号</span> <span class="txt"><input type="text" ng-model="phone" ng-class="phoneClassName"/></span> </div> <div> <span class="label">城市</span> <span class="txt"> <select ng-model="city"> <option value="">选择城市</option> <option value="北京">北京</option> <option value="上海">上海</option> <option value="天津">天津</option> <option value="重庆">重庆</option> </select> </span> </div> <div class="errTips" ng-show="hasErr"> <ul> <li ng-repeat="msg in errTips">{{ msg }}</li> </ul> </div> <div> <span class="label"></span> <span class="txt"><button ng-click="submitAddOrderForm()">提交</button></span> </div> <div style="clear: both"></div></div></body></html>
阅读全文
0 0
- 订单用户表1(用户查询 、手机号查询 、选择城市 、选择状态、月份查询 、ID排序 、添加数据、批量发货、批量删除)
- 订单用户表2(用户名查询、手机号查询、选择城市、选择状态、选择月份、ID排序、添加数据、批量发货、批量删除、敏感字、修改数据)
- 用户表(查询数据 、添加数据 、排序 、点击删除 、修改密码 、批量删除 、全部删除)
- 简单快递 : 实现模糊搜索 选择城市搜索 选择状态搜索 升降排序 批量发货 批量删除 修改商品名字 新增订单时候,敏感字替换
- 模糊查询,批量删除, 添加用户,隔行变色,排序,过滤器
- 商品增加和查询、排序、批量删除、批量发货
- 商品订单:数据的判断、添加,批量删除,排序,模糊查询
- AngularJS 用户名查询、年龄查询、性别查询、全部删除、批量删除、添加用户、修改密码
- 初学Html5+CSS之表格添加用户+删除用户+修改数据+删除全部+批量删除+查询数据+内容判断
- 商品订单(增删改查):新增订单;批量删除,发货;模糊查询,下拉菜单内容过滤(含时间);全选反选,列名排序
- Angular用户查询,按条件排序,批量删除,添加,敏感字屏蔽
- (angularjs) 数据的增删改查(添加用户,查询年龄,批量删除,全部删除,修改密码) 类似题
- Mybatis批量查询,批量添加,批量删除
- 删除所有链接\批量删除DB\查询某个用户进程ID执行的操作
- 删除所有链接\批量删除DB\查询某个用户进程ID执行的操作
- 全选批量删除 添加 查询
- 姓名查询 年龄排序 添加用户 删除
- 购物车排序、批量删除、查询(死数据)
- 文件传输基础——Java IO流
- Android BLE总结
- BZOJ1085(SCOI2005)[骑士精神]--IDA*
- java通过JDBC链接SQLServer2012
- POJ P1160 Post Office
- 订单用户表1(用户查询 、手机号查询 、选择城市 、选择状态、月份查询 、ID排序 、添加数据、批量发货、批量删除)
- UVALive 7661The Size of the Smallest Hole(dfs)
- recyclerview 点击事件
- 使用JQuery编写AJax实现异步请求
- Python读取xml文件(xml.etree.ElementTree)
- 基于ugui的血条(资料备份)
- 个人笔记
- leetcode---rotate-list---链表
- LintCode/LeetCode全排列系列问题--Permutations I 和 II, N-Queens I 和 II,数独问题