<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="../Day08/js/jquery-3.2.1.min.js"></script>
<script src="../Day08/js/angular.min.js"></script>
<script src="../Day08/js/angular-route.js"></script>
<script type="text/javascript"></script>
<script>
var app = angular.module("Lj",[]);
app.controller("cont",function($scope){
$scope.px = '-id';
$scope.stus = [{id:2,shopname:'手机',name:'曹操',tel:15151515151,money:4990,city:"北京",regdate:new Date(),zt:"已发货"},
{id:10,shopname:'电脑',name:'张三',tel:15915915915,money:8451,city:"上海",regdate:new Date(),zt:"未发货"},
{id:5,shopname:'平板',name:'小乔',tel:45646416541,money:5615,city:"重庆",regdate:new Date(),zt:"已发货"},
{id:6,shopname:'音响',name:'李四',tel:49865248956,money:2155,city:"天津",regdate:new Date(),zt:"未发货"},
{id:4,shopname:'电宝',name:'金柯',tel:78946465165,money:4856,city:"北京",regdate:new Date(),zt:"已发货"},
];
$scope.formShow = false;
$scope.formShowFun = function(){
if($scope.formShow){
$scope.formShow = false;
}else{
$scope.formShow = true;
}
}
$scope.newid = "";
$scope.newname = "";
$scope.newhname = "";
$scope.newtel = "";
$scope.newprice = "";
$scope.newcity = "";
$scope.newtype = "";
$scope.checkSub = [];
$scope.divShow = false;
$scope.sub = function(){
$scope.checkSub = [];
if($scope.newid == "" || $scope.newid == null){
$scope.checkSub.push("产品编号为空")
}else if(isNaN($scope.newid)){
$scope.checkSub.push("产品编号不是整数")
}
}
$scope.dele = function(){
var count = 0;
for(var i=0; i<$scope.stus.length; i++){
if($scope.stus[i].ck){
count++;
$scope.stus.splice(i,1);
i--;
}
}
if(count == 0){
alert("请选择")
}
}
$scope.ckAll = function(){
for(var i=0; i<$scope.stus.length;i++){
$scope.stus[i].ck = $scope.flag;
}
}
$scope.delete = function($index){
if($index>=0){
if(confirm("是否删除"+$scope.stus[$index].name)){
$scope.stus.splice($index,1);
}
}
}
$scope.fh = function(){
var plsc = [];
for(var i=0; i<$scope.stus.length; i++){
if($scope.stus[i].ck){
if($scope.stus[i].zt == "未发货"){
plsc.push($scope.stus[i].zt);
$scope.stus[i].zt="已发货";
}else{
plsc.push($scope.stus[i].zt);
}
}
}
if(plsc.length == 0){
alert("请选择")
}
}
$scope.yue=function(m){
var currentd=m.getMonth()+1; //0-11
//获取开始日期
var start=$scope.selmonth1;
//获取结束月份
var end=$scope.selmonth2;
if(start==undefined&&end==undefined){
return true;
}
else if(currentd>=start&¤td<=end){
return true;
}
return false;
}
});
</script>
<style>
.box{
width: 1400px;
height: 600px;
margin: 0 auto;
border: solid 2px red;
}
.box select{
width: 80px;
height: 23px;
margin-top: 10px;
margin-bottom: 10px;
}
#but1{
background: pink;
}
#but2{
background: plum;
}
#but3{
background: palevioletred;
}
table{
width: 1400px;
margin-top: 10px;
text-align: center;
}
tr:nth-child(odd){
background: yellow;
}
tr:nth-child(even){
background: greenyellow;
}
</style>
</head>
<body ng-app="Lj" ng-controller="cont">
<div class="box">
<input type="text" placeholder="用户名搜索" ng-model="selname"/>
<input type="text" placeholder="手机号搜索" ng-model="seltel"/>
<select ng-model="selcity">
<option ng-selected="true">选择城市</option>
<option>北京</option>
<option>上海</option>
<option>重庆</option>
<option>天津</option>
</select>
<select ng-model="selzt">
<option ng-selected="true">选择状态</option>
<option>已发货</option>
<option>未发货</option>
</select>
<select ng-model="selmonth1">
<option ng-selected="true">开始月份</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>-
<select ng-model="selmonth2">
<option ng-selected="true">结束月份</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select ng-model="px">
<option ng-selected="true">ID排序</option>
<option value="-id">ID降序</option>
<option value="+id">ID升序</option>
</select><br />
<input type="button" value="新增用户" id="but1" ng-click="formShow = true"/>
<input type="button" value="批量发货" id="but3" ng-click="fh()"/>
<input type="button" value="批量删除" id="but2" ng-click="dele()"/>
<span >敏感词:抢劫,小偷</span>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" ng-click="ckAll()" ng-model="flag"/></td>
<td>ID</td>
<td>商品名</td>
<td>用户名</td>
<td>手机号</td>
<td>价格</td>
<td>城市</td>
<td>下单时间</td>
<td>状态</td>
<td>操作</td>
</tr>
<tr ng-repeat="s in stus|filter:{name:selname}|filter:{level:sellevel}|orderBy:px|
filter:{city:selcity}|filter:{zt:selzt}|filter:{tel:seltel}" ng-show="yue(g.regdate)">
<td><input type="checkbox" ng-model="s.ck"/></td>
<td>{{s.id}}</td>
<td>{{s.shopname}}
<span ng-show="f">
<input ng-model="s.shopname" />
</span>
</td>
<td>{{s.name}}
<span ng-show="f">
<input ng-model="s.name" />
</span>
</td>
<td>{{s.tel}}
<span ng-show="f">
<input ng-model="s.tel" />
</span>
</td>
<td>{{s.money|currency:"¥"}}
<span ng-show="f">
<input ng-model="s.money" />
</span>
<!--</td>-->
<td>{{s.city}}
<span ng-show="f">
<input ng-model="s.city" />
</span>
</td>
<td>{{s.regdate|date:"yyyy-MM-dd hh:mm:ss"}}
<span ng-show="f">
<input ng-model="s.regdate" />
</span>
</td>
<td>
<a href="" ng-show="s.zt=='未发货'" ng-click="s.zt='已发货'" class="aaa">发货</a>
<span ng-show="s.zt == '已发货'">{{s.zt}}</span>
<span ng-show="f">
<input ng-model="s.zt" />
</span>
</td>
<td>
<input type="button" value="修改" ng-click="f=true" style="background: red;"/>
<span ng-show="f"> <button ng-click="f=false" style="background: yellow;">保存</button></span>
<input type="button" value="删除" ng-click="delete($index)" style="background: red;"/>
</td>
</tr>
</table>
<form style="border: 2px solid red; width: 300px; margin: 10px auto;" ng-show="formShow">
<h3>添加商品</h3>
商品id:<input type="text" placeholder="商品id" ng-model="newid"/><br />
商品名称:<input type="text" placeholder="商品名称" ng-model="newname"/><br />
用户名:<input type="text" placeholder="用户名" ng-model="newhname"/><br />
手机号:<input type="text" placeholder="手机号" ng-model="newtel"/><br />
价格:<input type="text" placeholder="价格" ng-model="newprice"/><br />
城市:<input type="text" placeholder="城市" ng-model="newcity"/><br />
状态:<input type="text" placeholder="状态" ng-model="newtype"/><br />
<div style="border: 1px solid blueviolet; width: 250px;background-color: plum;"ng-show="divShow">
<ul>
<li ng-repeat="chenk in checkSub">{{chenk}}</li>
</ul>
</div><br />
<input type="button" value="添加" ng-click="sub()"/>
</form>
</div>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="../Day08/js/jquery-3.2.1.min.js"></script>
<script src="../Day08/js/angular.min.js"></script>
<script src="../Day08/js/angular-route.js"></script>
<script type="text/javascript"></script>
<script>
var app = angular.module("Lj",[]);
app.controller("cont",function($scope){
$scope.px = '-id';
$scope.stus = [{id:2,shopname:'手机',name:'曹操',tel:15151515151,money:4990,city:"北京",regdate:new Date(),zt:"已发货"},
{id:10,shopname:'电脑',name:'张三',tel:15915915915,money:8451,city:"上海",regdate:new Date(),zt:"未发货"},
{id:5,shopname:'平板',name:'小乔',tel:45646416541,money:5615,city:"重庆",regdate:new Date(),zt:"已发货"},
{id:6,shopname:'音响',name:'李四',tel:49865248956,money:2155,city:"天津",regdate:new Date(),zt:"未发货"},
{id:4,shopname:'电宝',name:'金柯',tel:78946465165,money:4856,city:"北京",regdate:new Date(),zt:"已发货"},
];
$scope.formShow = false;
$scope.formShowFun = function(){
if($scope.formShow){
$scope.formShow = false;
}else{
$scope.formShow = true;
}
}
$scope.newid = "";
$scope.newname = "";
$scope.newhname = "";
$scope.newtel = "";
$scope.newprice = "";
$scope.newcity = "";
$scope.newtype = "";
$scope.checkSub = [];
$scope.divShow = false;
$scope.sub = function(){
$scope.checkSub = [];
if($scope.newid == "" || $scope.newid == null){
$scope.checkSub.push("产品编号为空")
}else if(isNaN($scope.newid)){
$scope.checkSub.push("产品编号不是整数")
}
}
$scope.dele = function(){
var count = 0;
for(var i=0; i<$scope.stus.length; i++){
if($scope.stus[i].ck){
count++;
$scope.stus.splice(i,1);
i--;
}
}
if(count == 0){
alert("请选择")
}
}
$scope.ckAll = function(){
for(var i=0; i<$scope.stus.length;i++){
$scope.stus[i].ck = $scope.flag;
}
}
$scope.delete = function($index){
if($index>=0){
if(confirm("是否删除"+$scope.stus[$index].name)){
$scope.stus.splice($index,1);
}
}
}
$scope.fh = function(){
var plsc = [];
for(var i=0; i<$scope.stus.length; i++){
if($scope.stus[i].ck){
if($scope.stus[i].zt == "未发货"){
plsc.push($scope.stus[i].zt);
$scope.stus[i].zt="已发货";
}else{
plsc.push($scope.stus[i].zt);
}
}
}
if(plsc.length == 0){
alert("请选择")
}
}
$scope.yue=function(m){
var currentd=m.getMonth()+1; //0-11
//获取开始日期
var start=$scope.selmonth1;
//获取结束月份
var end=$scope.selmonth2;
if(start==undefined&&end==undefined){
return true;
}
else if(currentd>=start&¤td<=end){
return true;
}
return false;
}
});
</script>
<style>
.box{
width: 1400px;
height: 600px;
margin: 0 auto;
border: solid 2px red;
}
.box select{
width: 80px;
height: 23px;
margin-top: 10px;
margin-bottom: 10px;
}
#but1{
background: pink;
}
#but2{
background: plum;
}
#but3{
background: palevioletred;
}
table{
width: 1400px;
margin-top: 10px;
text-align: center;
}
tr:nth-child(odd){
background: yellow;
}
tr:nth-child(even){
background: greenyellow;
}
</style>
</head>
<body ng-app="Lj" ng-controller="cont">
<div class="box">
<input type="text" placeholder="用户名搜索" ng-model="selname"/>
<input type="text" placeholder="手机号搜索" ng-model="seltel"/>
<select ng-model="selcity">
<option ng-selected="true">选择城市</option>
<option>北京</option>
<option>上海</option>
<option>重庆</option>
<option>天津</option>
</select>
<select ng-model="selzt">
<option ng-selected="true">选择状态</option>
<option>已发货</option>
<option>未发货</option>
</select>
<select ng-model="selmonth1">
<option ng-selected="true">开始月份</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>-
<select ng-model="selmonth2">
<option ng-selected="true">结束月份</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select ng-model="px">
<option ng-selected="true">ID排序</option>
<option value="-id">ID降序</option>
<option value="+id">ID升序</option>
</select><br />
<input type="button" value="新增用户" id="but1" ng-click="formShow = true"/>
<input type="button" value="批量发货" id="but3" ng-click="fh()"/>
<input type="button" value="批量删除" id="but2" ng-click="dele()"/>
<span >敏感词:抢劫,小偷</span>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" ng-click="ckAll()" ng-model="flag"/></td>
<td>ID</td>
<td>商品名</td>
<td>用户名</td>
<td>手机号</td>
<td>价格</td>
<td>城市</td>
<td>下单时间</td>
<td>状态</td>
<td>操作</td>
</tr>
<tr ng-repeat="s in stus|filter:{name:selname}|filter:{level:sellevel}|orderBy:px|
filter:{city:selcity}|filter:{zt:selzt}|filter:{tel:seltel}" ng-show="yue(g.regdate)">
<td><input type="checkbox" ng-model="s.ck"/></td>
<td>{{s.id}}</td>
<td>{{s.shopname}}
<span ng-show="f">
<input ng-model="s.shopname" />
</span>
</td>
<td>{{s.name}}
<span ng-show="f">
<input ng-model="s.name" />
</span>
</td>
<td>{{s.tel}}
<span ng-show="f">
<input ng-model="s.tel" />
</span>
</td>
<td>{{s.money|currency:"¥"}}
<span ng-show="f">
<input ng-model="s.money" />
</span>
<!--</td>-->
<td>{{s.city}}
<span ng-show="f">
<input ng-model="s.city" />
</span>
</td>
<td>{{s.regdate|date:"yyyy-MM-dd hh:mm:ss"}}
<span ng-show="f">
<input ng-model="s.regdate" />
</span>
</td>
<td>
<a href="" ng-show="s.zt=='未发货'" ng-click="s.zt='已发货'" class="aaa">发货</a>
<span ng-show="s.zt == '已发货'">{{s.zt}}</span>
<span ng-show="f">
<input ng-model="s.zt" />
</span>
</td>
<td>
<input type="button" value="修改" ng-click="f=true" style="background: red;"/>
<span ng-show="f"> <button ng-click="f=false" style="background: yellow;">保存</button></span>
<input type="button" value="删除" ng-click="delete($index)" style="background: red;"/>
</td>
</tr>
</table>
<form style="border: 2px solid red; width: 300px; margin: 10px auto;" ng-show="formShow">
<h3>添加商品</h3>
商品id:<input type="text" placeholder="商品id" ng-model="newid"/><br />
商品名称:<input type="text" placeholder="商品名称" ng-model="newname"/><br />
用户名:<input type="text" placeholder="用户名" ng-model="newhname"/><br />
手机号:<input type="text" placeholder="手机号" ng-model="newtel"/><br />
价格:<input type="text" placeholder="价格" ng-model="newprice"/><br />
城市:<input type="text" placeholder="城市" ng-model="newcity"/><br />
状态:<input type="text" placeholder="状态" ng-model="newtype"/><br />
<div style="border: 1px solid blueviolet; width: 250px;background-color: plum;"ng-show="divShow">
<ul>
<li ng-repeat="chenk in checkSub">{{chenk}}</li>
</ul>
</div><br />
<input type="button" value="添加" ng-click="sub()"/>
</form>
</div>
</body>
</html>