<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="js/angular.min.js"></script>
<script src="js/jquery-1.8.3.js"></script>
<style>
span{color: red;}
</style>
<script>
angular.module("myapp",[])
.controller("ctrl",function($scope,$http){
$http.get("http://result.eolinker.com/lKgJQ8Zec38423e5603b8e055d1193a8127c0c060bb1b55?uri=goodstest")
.success(function(a){
$scope.datas=a;
})
$scope.qx=function(){
for(var i in $scope.datas){
$scope.datas[i].ck=$scope.qq
}
}
$scope.Alldel=function(){
for(var i = 0;i<$scope.datas.length;i++){
if($scope.datas[i].ck){
$scope.datas.splice(i,1);
i--;
}
}
}
$scope.tj=function(){
if ($scope.gname==null) {
$scope.a=true;
}
if ($scope.uname==null) {
$scope.b=true;
}
if ($scope.tel==null) {
$scope.c=true;
}
if ($scope.price==null) {
$scope.d=true;
}if ($scope.pro==null) {
$scope.e=true;
}else{
$scope.a=false;
$scope.b=false;
$scope.c=false;
$scope.d=false;
$scope.e=false;
$scope.sj=new Date();
$scope.datas.push({id:$scope.datas.length+1,gname:$scope.gname,uname:$scope.uname,tel:$scope.tel,price:$scope.price,city:$scope.city,regdate:$scope.sj,state:"未发货",
provice:$scope.pro,city:$scope.city})
$scope.e=false;
}
}
$scope.show=function(){
$scope.ss1=$scope.sname;
$scope.sss1=$scope.stel;
$scope.s1=$scope.state;
}
$scope.xg=function(g){
$scope.xg1=g;
$scope.qqq=true;
}
})
</script>
<title></title>
</head>
<body ng-app="myapp" ng-controller="ctrl">
<button ng-click="jj=true">新增订单</button>
<button ng-click="Alldel()">批量删除</button>
{{datas}}
<table border="1">
<input type="text" ng-model="gname" placeholder="按商品名称查询"/>
<input type="text" ng-model="tel" placeholder="按商品手机查询"/>
<select ng-model="state">
<option>已发货</option>
<option>未发货</option>
</select>
<button ng-click="show()">搜索</button>
<tr>
<td><input type="checkbox" ng-model="qq" ng-click="qx()"></td>
<td>编号<button ng-click="px='id';sj=!sj">排序</button></td>
<td>商品名</td>
<td>用户名</td>
<td>手机号</td>
<td>价格<button ng-click="px='price';sj=!sj">排序</button></td>
<td>城市</td>
<td>下单时间</td>
<td>状态</td>
<td>操作</td>
</tr>
<tr ng-repeat="a in datas|filter:{gname:ss1,tel:sss1,state:s1}|orderBy:px:sj">
<td><input type="checkbox" ng-model="a.ck"></td>
<td>{{a.id}}</td>
<td>{{a.gname}}</td>
<td>{{a.uname}}</td>
<td>{{a.tel}}</td>
<td>{{a.price|currency:"¥"}}</td>
<td>{{a.provice}}-{{a.city}}</td>
<td>{{a.regdate|date:"yyyy-mm-dd hh:mm:dd"}}</td>
<td>
<p ng-show="a.state=='已发货'" style="background: red;">
已发货
</p>
<p ng-show="a.state=='未发货'" style="background: yellow;">
<a ng-click="a.state='已发货'" href="#">
未发货
</a>
</p>
</td>
<td><button ng-click="xg(a)">修改</button></td>
</tr>
</table>
<form ng-show="jj">
商品名:<input ng-model="gname" /><span ng-show="a">商品不能为空</span><br />
用户名: <input ng-model="uname" /><span ng-show="b">用户名不能为空</span><br />
手机号: <input ng-model="tel" /><span ng-show="c">手机号不能为空</span><br />
价格: <input ng-model="price" /><span ng-show="d">价格不能为空</span><br />
请选择省份:<select ng-model="pro" id="b1" onchange="qq()"><br />
<option>北京</option>
<option>上海</option>
<option>辽宁</option>
</select>
请选择城市:<select ng-model="city" id="b2">
<option value="">请选择</option>
</select> <span ng-show="e">城市不能为空</span>
<button ng-click="tj()">保存</button>
</form>
<form ng-show="qqq">
商品名:<input ng-model="xg1.gname" />
用户名: <input ng-model="xg1.uname" />
手机号: <input ng-model="xg1.tel" />
价格: <input ng-model="xg1.price" />
请选择省份:<select ng-model="xg1.provice"><br />
<option>北京</option>
<option>上海</option>
<option>辽宁</option>
</select>
请选择城市:<select ng-model="xg1.city">
<option ng-show="xg1.provice=='北京'">朝阳</option>
<option ng-show="xg1.provice=='北京'">海淀</option>
<option ng-show="xg1.provice=='北京'">昌平</option>
<option ng-show="xg1.provice=='上海'">长宁</option>
<option ng-show="xg1.provice=='上海'">外滩</option>
<option ng-show="xg1.provice=='上海'">徐家汇</option>
<option ng-show="xg1.provice=='辽宁'">大连</option>
<option ng-show="xg1.provice=='辽宁'">营口</option>
<option ng-show="xg1.provice=='辽宁'">沈阳</option>
</select>
<button ng-click="qqq=false">保存</button>
</form>
</body>
<script>
function qq(){
var cs = [{pro:"北京",city:["海淀","大兴","昌平"]},
{pro:"上海",city:["长宁","外滩","东方明珠"]},
{pro:"辽宁",city:["大连","朝阳","营口"]}];
var p=$("#b1").val();
var ct=[];
for(var i in cs){
if(p==cs[i].pro){
ct=cs[i].city;
}
}
$("#b2 option").remove();
for(var i in ct){
var op=$("<option>"+ct[i]+"</option>");
$("#b2").append(op);
}
}
</script>
</html>
<html>
<head>
<meta charset="UTF-8">
<script src="js/angular.min.js"></script>
<script src="js/jquery-1.8.3.js"></script>
<style>
span{color: red;}
</style>
<script>
angular.module("myapp",[])
.controller("ctrl",function($scope,$http){
$http.get("http://result.eolinker.com/lKgJQ8Zec38423e5603b8e055d1193a8127c0c060bb1b55?uri=goodstest")
.success(function(a){
$scope.datas=a;
})
$scope.qx=function(){
for(var i in $scope.datas){
$scope.datas[i].ck=$scope.qq
}
}
$scope.Alldel=function(){
for(var i = 0;i<$scope.datas.length;i++){
if($scope.datas[i].ck){
$scope.datas.splice(i,1);
i--;
}
}
}
$scope.tj=function(){
if ($scope.gname==null) {
$scope.a=true;
}
if ($scope.uname==null) {
$scope.b=true;
}
if ($scope.tel==null) {
$scope.c=true;
}
if ($scope.price==null) {
$scope.d=true;
}if ($scope.pro==null) {
$scope.e=true;
}else{
$scope.a=false;
$scope.b=false;
$scope.c=false;
$scope.d=false;
$scope.e=false;
$scope.sj=new Date();
$scope.datas.push({id:$scope.datas.length+1,gname:$scope.gname,uname:$scope.uname,tel:$scope.tel,price:$scope.price,city:$scope.city,regdate:$scope.sj,state:"未发货",
provice:$scope.pro,city:$scope.city})
$scope.e=false;
}
}
$scope.show=function(){
$scope.ss1=$scope.sname;
$scope.sss1=$scope.stel;
$scope.s1=$scope.state;
}
$scope.xg=function(g){
$scope.xg1=g;
$scope.qqq=true;
}
})
</script>
<title></title>
</head>
<body ng-app="myapp" ng-controller="ctrl">
<button ng-click="jj=true">新增订单</button>
<button ng-click="Alldel()">批量删除</button>
{{datas}}
<table border="1">
<input type="text" ng-model="gname" placeholder="按商品名称查询"/>
<input type="text" ng-model="tel" placeholder="按商品手机查询"/>
<select ng-model="state">
<option>已发货</option>
<option>未发货</option>
</select>
<button ng-click="show()">搜索</button>
<tr>
<td><input type="checkbox" ng-model="qq" ng-click="qx()"></td>
<td>编号<button ng-click="px='id';sj=!sj">排序</button></td>
<td>商品名</td>
<td>用户名</td>
<td>手机号</td>
<td>价格<button ng-click="px='price';sj=!sj">排序</button></td>
<td>城市</td>
<td>下单时间</td>
<td>状态</td>
<td>操作</td>
</tr>
<tr ng-repeat="a in datas|filter:{gname:ss1,tel:sss1,state:s1}|orderBy:px:sj">
<td><input type="checkbox" ng-model="a.ck"></td>
<td>{{a.id}}</td>
<td>{{a.gname}}</td>
<td>{{a.uname}}</td>
<td>{{a.tel}}</td>
<td>{{a.price|currency:"¥"}}</td>
<td>{{a.provice}}-{{a.city}}</td>
<td>{{a.regdate|date:"yyyy-mm-dd hh:mm:dd"}}</td>
<td>
<p ng-show="a.state=='已发货'" style="background: red;">
已发货
</p>
<p ng-show="a.state=='未发货'" style="background: yellow;">
<a ng-click="a.state='已发货'" href="#">
未发货
</a>
</p>
</td>
<td><button ng-click="xg(a)">修改</button></td>
</tr>
</table>
<form ng-show="jj">
商品名:<input ng-model="gname" /><span ng-show="a">商品不能为空</span><br />
用户名: <input ng-model="uname" /><span ng-show="b">用户名不能为空</span><br />
手机号: <input ng-model="tel" /><span ng-show="c">手机号不能为空</span><br />
价格: <input ng-model="price" /><span ng-show="d">价格不能为空</span><br />
请选择省份:<select ng-model="pro" id="b1" onchange="qq()"><br />
<option>北京</option>
<option>上海</option>
<option>辽宁</option>
</select>
请选择城市:<select ng-model="city" id="b2">
<option value="">请选择</option>
</select> <span ng-show="e">城市不能为空</span>
<button ng-click="tj()">保存</button>
</form>
<form ng-show="qqq">
商品名:<input ng-model="xg1.gname" />
用户名: <input ng-model="xg1.uname" />
手机号: <input ng-model="xg1.tel" />
价格: <input ng-model="xg1.price" />
请选择省份:<select ng-model="xg1.provice"><br />
<option>北京</option>
<option>上海</option>
<option>辽宁</option>
</select>
请选择城市:<select ng-model="xg1.city">
<option ng-show="xg1.provice=='北京'">朝阳</option>
<option ng-show="xg1.provice=='北京'">海淀</option>
<option ng-show="xg1.provice=='北京'">昌平</option>
<option ng-show="xg1.provice=='上海'">长宁</option>
<option ng-show="xg1.provice=='上海'">外滩</option>
<option ng-show="xg1.provice=='上海'">徐家汇</option>
<option ng-show="xg1.provice=='辽宁'">大连</option>
<option ng-show="xg1.provice=='辽宁'">营口</option>
<option ng-show="xg1.provice=='辽宁'">沈阳</option>
</select>
<button ng-click="qqq=false">保存</button>
</form>
</body>
<script>
function qq(){
var cs = [{pro:"北京",city:["海淀","大兴","昌平"]},
{pro:"上海",city:["长宁","外滩","东方明珠"]},
{pro:"辽宁",city:["大连","朝阳","营口"]}];
var p=$("#b1").val();
var ct=[];
for(var i in cs){
if(p==cs[i].pro){
ct=cs[i].city;
}
}
$("#b2 option").remove();
for(var i in ct){
var op=$("<option>"+ct[i]+"</option>");
$("#b2").append(op);
}
}
</script>
</html>
1924

被折叠的 条评论
为什么被折叠?



