Authored by dongjunjie

$http插件代替Ajax

... ... @@ -130,21 +130,16 @@
//获取店铺的经营指标:一个自然日内有效订单商品件数、有效订单商品金额
fetchData1: function() {
var self = this;
$.ajax({
type:"post",
url:"/report/getShopBusinessOverview",
dataType:'json',
data:{
dateId: util.dateFormat(new Date(),"YYYYMMdd")
},
success:function(rs) {
self.buyNumbers = rs.data.buyNumbers;
self.orderAmount = rs.data.orderAmount;
},
error:function(error) {
console.log(error)
}
})
this.$http.post("/report/getShopBusinessOverview", {
dateId: util.dateFormat(new Date(),"YYYYMMdd")
}).then(function (response) {
var rs = response.data;
self.buyNumbers = rs.data.buyNumbers;
self.orderAmount = rs.data.orderAmount;
}, function (response) {
var rs = response.data;
console.log(rs.message);
});
},
//获取店铺的品牌排名,当前等级、排名、上升名词
... ... @@ -154,22 +149,17 @@
day.setDate(day.getDate()-1); //前一天
self.rankDate = util.dateFormat(day, "MM月dd日");
$.ajax({
type:"post",
url:"/report/getShopBrandRank",
dataType:'json',
data:{
dateId: util.dateFormat(day, "YYYYMMdd")
},
success:function(rs) {
self.rankNow = rs.data.rankNow;
self.rankChange = rs.data.rankChange;
self.rankLevel = rs.data.rankLevel;
},
error:function(error) {
console.log(error)
}
})
this.$http.post("/report/getShopBrandRank", {
dateId: util.dateFormat(day,"YYYYMMdd")
}).then(function (response) {
var rs = response.data;
self.rankNow = rs.data.rankNow;
self.rankChange = rs.data.rankChange;
self.rankLevel = rs.data.rankLevel;
}, function (response) {
var rs = response.data;
console.log(rs.message);
});
}
}
}
... ...
var Vue = require("vue");
Vue.use(require('vue-resource'));
new Vue({
el: 'body',
... ...
... ... @@ -23,7 +23,6 @@
"glob": "^7.0.3"
},
"devDependencies": {
"vue": "^1.0.24",
"autoprefixer-loader": "^3.2.0",
"babel-core": "^6.9.0",
"babel-loader": "^6.2.4",
... ... @@ -50,10 +49,12 @@
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"vinyl-fs": "^2.4.3",
"vue": "^1.0.24",
"vue-hot-reload-api": "^1.3.2",
"vue-html-loader": "^1.2.2",
"vue-loader": "^8.4.0",
"vue-resource": "^0.7.3",
"vue-style-loader": "^1.0.0",
"webpack": "^1.13.0"
}
}
}
\ No newline at end of file
... ...