index.js
4.08 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
var app = getApp(), os = app.globalData.setting;
Component({
data:{
fontcolor:'#6e6d6b',
fontcolor_sele:'#f23030',
backgroundColor:'#ffffff',
list:app.def_list,
cartGoodsNum:0,
active: 0,
},
lifetimes: {
attached: function() {
var th=this;
getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{
var dis=rs.data.data;
if( dis && dis.switch==0){
th.setData({is_no_distri:1})
}
})
//过滤掉分销到期的
getApp().user_tools_endTime(2,function(e){
if(!e) th.setData({is_no_distri:1})
});
//购买的信息用全局缓存
if(getApp().globalData.dis_buy_obj){
var arr = getApp().globalData.dis_buy_obj;
if (arr.length > 0) {
var item=arr[0];
if(item.is_sy==0){
var now = Date.parse(new Date());now = now / 1000;
if(item.end_time<now) th.setData({is_no_distri:1})
}
}
}else{
getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{
if(res.data.code==0){
var arr = res.data.data.pageData;
getApp().globalData.dis_buy_obj=arr;
if (arr.length > 0) {
var item=arr[0];
if(item.is_sy==0){
var now = Date.parse(new Date());now = now / 1000;
if(item.end_time<now) th.setData({is_no_distri:1})
}
}
}
})
}
//购物车显示商品金额
this.setData({cartGoodsNum:getApp().globalData.cartGoodsNum});
var th=this;
var is_read=getApp().globalData.is_read;
var custum_data=getApp().globalData.custum_data;
if(is_read){
if(custum_data){
this.set_list(custum_data);
}
}else{
//全局缓存
if(getApp().globalData.storeFooter) {
var itemList = getApp().globalData.storeFooter;
itemList = JSON.parse(itemList)
//-- 如果是有定义自定义导航的小程序链接 --
if (itemList[0].weappurl && itemList[0].weappurl != "") {
getApp().globalData.custum_data = e.data.data;
var custum_data = e.data.data;
th.set_list(custum_data);
}
}else{
var stoid = os.stoid;
getApp().request.promiseGet("/api/weshop/storeFooter/get/" + stoid, {}).then(res => {
getApp().globalData.is_read = true;
var e = res;
if (e.data.code != -1 && e.data.data && e.data.data.data) {
var itemList = e.data.data.data;
getApp().globalData.storeFooter=itemList;
itemList = JSON.parse(itemList)
//-- 如果是有定义自定义导航的小程序链接 --
if (itemList[0].weappurl && itemList[0].weappurl != "") {
getApp().globalData.custum_data = e.data.data;
var custum_data = e.data.data;
th.set_list(custum_data);
}
}
})
}
}
},
},
methods: {
//设置自定义页面的列表
set_list:function(data){
var itemList = data.data;
itemList = JSON.parse(itemList);
this.setData({
list:itemList,
backgroundColor: data.bkcolor,
fontcolor_sele: data.fontcolor_sele,
fontcolor:data.fontcolor,
is_custum:1
})
},
nav_goto:function(e){
var url=e.currentTarget.dataset.url;
if(!url) return false;
if(url[0]!='/') url='/'+url;
//wx.switchTab({url:url,})
getApp().goto(url);
},
}
})