personcenter.js
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
new Vue({
el:'#personcenter',
data: {
persontype:[],
personinfo:[],
cartnum:0
},
created: function() {
this.details();
this.num();
},
methods: {
//获取信息
details: function() {
var that = this;
var url = '/UserCenter/index'
var params = {
unique_id: localStorage.getItem('unique_id')
}
ajaxsend(url, params, function(res) {
/*console.log(JSON.stringify(res))*/
console.log(res);
var data=res.data;
var icon=data.icon;
that.persontype=icon;
that.personinfo=data.user_info;
console.log(that.personinfo);
})
},
//购物车数量
num:function(){
var that=this;
var url='/CountNum/countCart';
var params = {
unique_id: localStorage.getItem('unique_id')
}
ajaxsend(url, params, function(res) {
/*console.log(JSON.stringify(res))*/
console.log(res);
var data=res.data;
console.log(data[0].count)
that.cartnum=data[0].count;
console.log(that.cartnum);
})
},
//关于我们
aboutus:function(){
window.location.href=linkPath+'/about.html'
},
jump:function(obj){
console.log(obj);
var status=obj.status;
var state="";
if(status=="未付款"){
state=1;
window.location.href=linkPath+'/myorder/myorder.html?state='+state;
}else if(status=="制作中"){
state=2;
window.location.href=linkPath+'/myorder/myorder.html?state='+state;
}else if(status=="待取货"){
state=3;
window.location.href=linkPath+'/myorder/myorder.html?state='+state;
}else if(status=="待评价"){
state=4;
window.location.href=linkPath+'/myorder/myorder.html?state='+state;
}else if(status=="已完成"){
state=5;
window.location.href=linkPath+'/myorder/myorder.html?state='+state;
}
}
},
})