|

楼主 |
发表于 2016-1-21 18:03:58
|
显示全部楼层
// 添加商品至购物车
Model.prototype.button4Click = function(event) {
var self = this;
var id = this.params.id;
var catid = this.params.catid;
var carDataNum = this.comp("car_num");
// console.log(id + " " + catid);
$.ajax({
async : false,
url : server.path + server.addcart,
type : "get",
dataType : "json",
crossDomain : true,
xhrFields : {
withCredentials : true
},
data : {
id : id,
catid : catid,
quantity : 1
},
success : function(data) {
if (data.status_code == "10000") {
carDataNum.refreshData("carNum");
console.log(data.msg);
self.comp("car_pop_up").show();
setTimeout(function() {
$("[xid=car_pop_up]").hide();
}, 1000);
} else {
// self.comp("news_msg").set({
// "title" : "提示",
// "message" : data.msg
// });
// self.comp("news_msg").show();
}
},
error : function(xhr) {
// self.comp("news_msg").set({
// "title" : "提示",
// "message" : "网络错误,请检查您的网络!"
// });
// self.comp("news_msg").show();
}
});
}; |
|