$scope.save= function () { | |
var ii=$scope.add_id; | |
var spm=$scope.add_gname; | |
var yhm=$scope.add_uname; | |
var dh=$scope.add_tel; | |
var jg=$scope.add_price; | |
var cs=$scope.add_city; | |
if(cs==null||cs==""){ | |
$scope.e=1; | |
}else{ | |
$scope.e=0; | |
} | |
if(spm==null||spm==""){ | |
$scope.a=true; | |
}else{ | |
$scope.a=false; | |
} | |
if(ii==null||ii==""){ | |
$scope.ff=true; | |
}else{ | |
$scope.ff=false; | |
} | |
if (yhm==null||yhm=="") { | |
$scope.b=true; | |
} else{ | |
$scope.b=false; | |
} | |
if (dh==null||dh=="") { | |
$scope.c=true; | |
} else{ | |
$scope.c=false; | |
} | |
if ( jg==null||jg=="") { | |
$scope.d=true; | |
} else{ | |
$scope.d=false; | |
} | |
if(ii==null||ii==""||spm==null||spm==""||yhm==null||yhm==""||dh==null||dh==""||jg==null||jg==""||cs==null||cs==""){ | |
}else{ | |
var va = { | |
ck:false, | |
id:$scope.add_id, | |
gname:$scope.add_gname, | |
uname:$scope.add_uname, | |
tel:$scope.add_tel, | |
price:$scope.add_price, | |
city:$scope.add_city, | |
regdate:new Date(), | |
state:'未发货' | |
}; | |
$scope.message.push(va); | |
$scope.fa=false; | |
} | |
} |
<!--这是添加的隐藏--> | |
<div ng-show="f" id="add"> | |
<h3>新增订单</h3> | |
<table> | |
<tr> | |
<td>商品</td> | |
<td> | |
<input ng-model="add_id" type="text" placeholder="输入id号" /> | |
<span ng-show="ff">id号不能为空</span> | |
</td> | |
</tr> | |
<tr> | |
<td>商品</td> | |
<td> | |
<input ng-model="add_gname" type="text" placeholder="输入商品名" /> | |
<span ng-show="a">商品名不能为空</span> | |
</td> | |
</tr> | |
<tr> | |
<td>用户名</td> | |
<td> | |
<input ng-model="add_uname" type="text" placeholder="输入用户名" /> | |
<span ng-show="b">用户名不能为空</span> | |
</td> | |
</tr> | |
<tr> | |
<td>手机号</td> | |
<td> | |
<input ng-model="add_tel" ng-model="add_uname" type="text" placeholder="输入手机号" /> | |
<span ng-show="c">手机号不能为空</span> | |
</td> | |
</tr> | |
<tr> | |
<td>价格</td> | |
<td><input ng-model="add_price" type="text" placeholder="输入价格" /> | |
<span ng-show="d">价格不能为空</span> | |
</td> | |
</tr> | |
<tr> | |
<td>城市</td> | |
<td> | |
<select ng-model="add_city"> | |
<option value="">请输入城市</option> | |
<option>北京</option> | |
<option>上海</option> | |
<option>天津</option> | |
<option>广州</option> | |
<option>河北</option> | |
<option>河南</option> | |
<option>山东</option> | |
</select><span ng-show="e">城市不能为空</span> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<button ng-click="save()" style="background-color: aquamarine;">保存</button> | |
</td> | |
</tr> | |
</table> | |
</div> |