choose_goods(url, obj,function(res){
if(res.btn==3&&res.status==1){
console.log(res);
}
});
function choose_goods(url, obj,callback) { var o = $(obj); var garr = new Array(); garr['status'] = 0; layer.open({ type: 2, title: "选择商品", shadeClose: true, shade: 0.3, maxmin: true, //开启最大化最小化按钮 area: ['900px', '580px'], fixed: false, //不固定 btn: ['新增商品', '选中', '选中并关闭', '取消'], //btn: ['btn1','btn2','btn3', 'btn4'], content: url, btn1: function (index, layero) {garr['btn'] = 1; garr['status'] = 1; callback(garr); return false; }, btn2: function (index, layero) { garr['btn'] = 2; //按钮【按钮二】的回调 garr['status'] = 1; callback(garr); return false; }, btn3: function (index, layero) { garr['btn'] = 3; garr['status'] = 0; //获取商品信息 $.get("/admin/basic/one_goods.html", { id: goodid }, function (data, state) { if (data.status == 1) { garr['status'] = 1; garr['data'] = data; layer.close(index); callback(garr); } }) return false; }, btn4: function (index, layero) { layer.close(index); return false; }, }); }