view={api:new ec.api("product"),cart:{alterAmount:function(el,mins){input=$(el).parents(".amount").find("input");var amount=parseInt(input.val());amount+=mins||0;amount=amount>=0?amount:0;input.val(amount)},getInfo:function(el){var res=[];var priceItem=$(el).parents(".price-box").find("tbody tr");priceItem.each(function(){var proItem={};var num=parseInt($(this).find("input").val());if(num>0&&num<=1e3){proItem.PriceRID=$(this).attr("data-id");proItem.Amount=num;res.push(proItem)}});return res},insert:function(el){var info=this.getInfo(el);var btnText=$(el).find("span");if(info.length<=0)ec.notifyQ(L.G("请输入1-1000之间的产品数量"));else{ec.btnLoading(btnText,L.G("添加中..."));new ec.api("cart").put("insert",info,function(r){ec.btnLoading(btnText,L.G("加入购物车"));ec.notify(L.G("成功添加至购物车中"));ec.hideWindow("cart_simple_layer");$(".cart-amount").html(r.length)},function(){ec.btnLoading(btnText,L.G("加入购物车"))})}}},price:{toggle:function(num){var v=$("#"+num+"_priceBox").is(":visible");if(!v)this.renderGetData(num);else this.render(false,num)},renderGetData:function(num){var self=this;new ec.api((L.route+"/product").replace("/","")).put("getprice/"+num,function(r){self.render(true,num,r)})},render:function(v,num,html){var product=$("#"+num+"_box");$("#"+num+"_priceBox").remove();var l=$("#product_data thead .title th").length;product.toggleClass("active",v);product.find(".buttons span").html(L.G(v?"收回":"价格库存"));product.find(".buttons i").toggleClass("ico16-cirlceup");html='