購物車實現批量刪除 單獨
$scope.items=[
{bianhao:1234,name:"ipad",price:3400,kucun:10,check:false},
{bianhao:1244,name:"aphone",price:6400,kucun:100,check:false},
{bianhao:1334,name:"mypad",price:4400,kucun:20,check:false},
{bianhao:8234,name:"zpad",price:8400,kucun:130,check:false},
]
/*排序*/
$scope.orderName="bianhao";
$scope.order=false;
$scope.paixu=function (column) {
if($scope.orderName==column)
{
$scope.order=!$scope.order;
}else{
$scope.order=false;
}
$scope.orderName=column;
};
$scope.getClass=function (column) {
if($scope.orderName==column)
{
return "top"
}
}
$scope.chk=false;
$scope.xuanz=false;
$scope.check=function (val) {
if (val){
$scope.xuanz=true;
}else{
$scope.xuanz=false;
}
}
$scope.checkD=false;
$scope.xuan1=[];
$scope.xuan=function (xuan1,bianhao) {
console.log(bianhao);
$scope.checkD=xuan1;
if (xuan1){
$scope.xuan1.push(bianhao);
}
}
$scope.del=function () {
//判斷是否確認刪除
if($scope.xuanz||$scope.checkD){
var b=confirm("確認刪除");
if (b){
//刪除所有商品資訊
if($scope.chk){
$scope.items.splice(0,$scope.items.length);
//讓商品資訊管理頁面為空白頁面
}else{
for(var i=$scope.xuan1.length-1;i>=0;i--){
console.log($scope.xuan1[i]);
for(var j=0;j<$scope.items.length;j++){
console.log($scope.items[j].bianhao==$scope.xuan1[i]);
if($scope.items[j].bianhao==$scope.xuan1[i]){
$scope.items.splice(j,1);
}
}