Commit cb2e462f16915027a613784965f5c2aa5119451d
1 parent
44a03623
1. 底部导航的优化, 以及显示购物车圆圈数量
2. 分类点击跳转返回 3. 组件点击返回不加载更多的动画效果
Showing
17 changed files
with
334 additions
and
175 deletions
app.js
@@ -5,131 +5,34 @@ var api = require("./api/api.js") | @@ -5,131 +5,34 @@ var api = require("./api/api.js") | ||
5 | 5 | ||
6 | //公共方法和变量 | 6 | //公共方法和变量 |
7 | App({ | 7 | App({ |
8 | - editTabBar: function (taht,stoid,url) { | ||
9 | - var that=this; | ||
10 | - var th = taht | ||
11 | - //使用getCurrentPages可以获取当前加载中所有的页面对象的一个数组,数组最后一个就是当前页面。 | ||
12 | - var custum_data=this.globalData.custum_data; | ||
13 | - var isIpx=this.globalData.isIpx; | ||
14 | - var is_read=this.globalData.is_read; | ||
15 | - //var curPageArr = getCurrentPages(); //获取加载的页面 | ||
16 | - //var curPage = curPageArr[curPageArr.length - 1]; //获取当前页面的对象 | ||
17 | - var curPage=th; | ||
18 | - var pagePath = curPage.route; //当前页面url | ||
19 | - if (pagePath.indexOf('/') != 0) { | ||
20 | - pagePath = '/' + pagePath; | ||
21 | - } | ||
22 | - if(is_read){ | ||
23 | - if(custum_data){ | ||
24 | - that.set_custom_nav(custum_data,isIpx,pagePath,url,curPage); | ||
25 | - }else{ | ||
26 | - var tabBar = { | ||
27 | - 'iscustom':2, | ||
28 | - 'url':url, | ||
29 | - 'active':pagePath, | ||
30 | - 'isIpx':isIpx, | ||
31 | - cartGoodsNum:this.globalData.cartGoodsNum | ||
32 | - } | ||
33 | - curPage.setData({ | ||
34 | - tabBar:tabBar, | ||
35 | - isIpx:isIpx, | ||
36 | - cartGoodsNum:this.globalData.cartGoodsNum | ||
37 | - }) | ||
38 | - } | ||
39 | - | ||
40 | - }else{ | ||
41 | - var isIpx = false; | ||
42 | - wx.getSystemInfo({ | ||
43 | - success: (res) => { | ||
44 | - // console.log(res) | ||
45 | - let modelmes = res.model; //手机品牌 | ||
46 | - if (modelmes.indexOf('iPhone X') != -1) { //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来 | ||
47 | - isIpx = true | ||
48 | - } | ||
49 | - //缓存住,下次就不调用接口了 | ||
50 | - that.globalData.isIpx=isIpx; | ||
51 | - getApp().request.promiseGet("/api/weshop/storeFooter/get/"+stoid, { | ||
52 | - }).then(res => { | ||
53 | - this.globalData.is_read=true; | ||
54 | - var e = res; | ||
55 | - if(e.data.code != -1){ | ||
56 | - that.globalData.custum_data=e.data.data; | ||
57 | - | ||
58 | - var itemList = that.globalData.custum_data.data; | ||
59 | - itemList = JSON.parse(itemList) | ||
60 | - | ||
61 | - if(!itemList[0].weappurl){ | ||
62 | - that.globalData.custum_data=null; | ||
63 | - var tabBar = { | ||
64 | - 'iscustom':2, | ||
65 | - 'url':url, | ||
66 | - 'active':pagePath, | ||
67 | - 'isIpx':isIpx, | ||
68 | - cartGoodsNum:this.globalData.cartGoodsNum | ||
69 | - } | ||
70 | - curPage.setData({ | ||
71 | - tabBar:tabBar, | ||
72 | - isIpx:isIpx, | ||
73 | - cartGoodsNum:this.globalData.cartGoodsNum | ||
74 | - }) | ||
75 | - }else{ | ||
76 | - that.set_custom_nav(e.data.data,isIpx,pagePath,url,curPage); | ||
77 | - } | ||
78 | - | ||
79 | - }else{ | ||
80 | - var tabBar = { | ||
81 | - 'iscustom':2, | ||
82 | - 'url':url, | ||
83 | - 'active':pagePath, | ||
84 | - 'isIpx':isIpx, | ||
85 | - cartGoodsNum:this.globalData.cartGoodsNum | ||
86 | - } | ||
87 | - curPage.setData({ | ||
88 | - tabBar:tabBar, | ||
89 | - isIpx:isIpx, | ||
90 | - cartGoodsNum:this.globalData.cartGoodsNum | ||
91 | - }) | ||
92 | - } | ||
93 | - | ||
94 | - }) | ||
95 | - }, | ||
96 | - }) | ||
97 | - } | ||
98 | - | ||
99 | - | ||
100 | - }, | ||
101 | - set_custom_nav(data,isIpx,pagePath,url,curPage){ | ||
102 | - //缓存住,下次就不调用接口了 | ||
103 | - var itemList = data.data; | ||
104 | - itemList = JSON.parse(itemList) | ||
105 | - //使用getCurrentPages可以获取当前加载中所有的页面对象的一个数组,数组最后一个就是当前页面。 | ||
106 | - for (var i = 0; i < itemList.length; i++) { | ||
107 | - itemList[i].active = false; | ||
108 | - if (itemList[i].weappurl == pagePath) { | ||
109 | - itemList[i].active = true; //根据页面地址设置当前页面状态 | ||
110 | - } | ||
111 | - } | ||
112 | - | ||
113 | - //如果当服务端返回的值有数据就渲染数据到页面 | ||
114 | - var tabBar = { | ||
115 | - 'iscustom':1, | ||
116 | - 'url':url, | ||
117 | - 'active':pagePath, | ||
118 | - 'list':itemList, | ||
119 | - 'backgroundColor': data.bkcolor, | ||
120 | - 'selectedColor' : data.fontcolor_sele, | ||
121 | - 'color':data.fontcolor, | ||
122 | - 'length':itemList.length, | ||
123 | - 'isIpx':isIpx, | ||
124 | - cartGoodsNum:this.globalData.cartGoodsNum | ||
125 | - } | ||
126 | - curPage.setData({ | ||
127 | - tabBar:tabBar, | ||
128 | - isIpx:isIpx, | ||
129 | - cartGoodsNum:this.globalData.cartGoodsNum | ||
130 | - }) | ||
131 | - }, | ||
132 | 8 | ||
9 | + def_list:[ | ||
10 | + { | ||
11 | + "weappurl": "pages/index/index/index", | ||
12 | + "nav_name": "首页", | ||
13 | + "src": t.imghost+"/miniapp/images/bar/index.png", | ||
14 | + "src_sele": t.imghost+"/miniapp/images/bar/index_on.png", | ||
15 | + }, | ||
16 | + { | ||
17 | + "weappurl": "pages/goods/categoryList/categoryList", | ||
18 | + "nav_name": "分类", | ||
19 | + "src": t.imghost+"/miniapp/images/bar/fl.png", | ||
20 | + "src_sele": t.imghost+"/miniapp/images/bar/fl_on.png" | ||
21 | + }, | ||
22 | + { | ||
23 | + "weappurl": "pages/cart/cart/cart", | ||
24 | + "nav_name": "购物车", | ||
25 | + "src": t.imghost+"/miniapp/images/bar/car.png", | ||
26 | + "src_sele": t.imghost+"/miniapp/images/bar/car_on.png" | ||
27 | + }, | ||
28 | + { | ||
29 | + "weappurl": "pages/user/index/index", | ||
30 | + "nav_name": "我的", | ||
31 | + "src": t.imghost+"/miniapp/images/bar/user.png", | ||
32 | + "src_sele": t.imghost+"/miniapp/images/bar/user_on.png" | ||
33 | + } | ||
34 | + ], | ||
35 | + | ||
133 | globalData: { | 36 | globalData: { |
134 | cartGoodsNum:0, //购物车总数量 | 37 | cartGoodsNum:0, //购物车总数量 |
135 | isTabBar :false, | 38 | isTabBar :false, |
@@ -142,7 +45,7 @@ App({ | @@ -142,7 +45,7 @@ App({ | ||
142 | config2: null, //门店配置 | 45 | config2: null, //门店配置 |
143 | code: null, | 46 | code: null, |
144 | heigth:0, | 47 | heigth:0, |
145 | - user_id:null,// 3674923,// 4379287,// null,// 5682068, | 48 | + user_id:6519826,// 3674923,// 4379287,// null,// 5682068, |
146 | buy_now:null, | 49 | buy_now:null, |
147 | picklist:null, //门店列表 | 50 | picklist:null, //门店列表 |
148 | wuliuprice: null, //物流价格表 | 51 | wuliuprice: null, //物流价格表 |
@@ -168,6 +71,7 @@ App({ | @@ -168,6 +71,7 @@ App({ | ||
168 | auth: o, | 71 | auth: o, |
169 | request: a, | 72 | request: a, |
170 | onLaunch: function() { | 73 | onLaunch: function() { |
74 | + wx.hideTabBar(); | ||
171 | this.initExt(); | 75 | this.initExt(); |
172 | var t = this.globalData.setting; | 76 | var t = this.globalData.setting; |
173 | //console.log(t) | 77 | //console.log(t) |
@@ -208,7 +112,6 @@ App({ | @@ -208,7 +112,6 @@ App({ | ||
208 | console.log(t); | 112 | console.log(t); |
209 | t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt=1; | 113 | t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt=1; |
210 | 114 | ||
211 | - | ||
212 | }, | 115 | }, |
213 | 116 | ||
214 | //首页的第一次登录 | 117 | //首页的第一次登录 |
@@ -433,13 +336,9 @@ App({ | @@ -433,13 +336,9 @@ App({ | ||
433 | "/pages/cart/cart/cart","/pages/user/index/index"]; | 336 | "/pages/cart/cart/cart","/pages/user/index/index"]; |
434 | if(arr_tabbar.indexOf(url)!=-1){ | 337 | if(arr_tabbar.indexOf(url)!=-1){ |
435 | if(url.indexOf("categoryList?type=1")!=-1) this.globalData.cat_type=1; | 338 | if(url.indexOf("categoryList?type=1")!=-1) this.globalData.cat_type=1; |
436 | - if(url.indexOf("categoryList?type=2")!=-1) this.globalData.cat_type=2; | ||
437 | - if (getCurrentPages().length > 9) { | ||
438 | - wx.redirectTo({url: url,}) //跳到tabbar页 | ||
439 | - }else{ | ||
440 | - wx.navigateTo({url: url,}) //跳到tabbar页 | ||
441 | - } | ||
442 | - | 339 | + if(url.indexOf("categoryList?type=2")!=-1) this.globalData.cat_type=2; |
340 | + wx.switchTab({url: url,}) //跳到tabbar页 | ||
341 | + | ||
443 | }else{ | 342 | }else{ |
444 | if (getCurrentPages().length > 9) { | 343 | if (getCurrentPages().length > 9) { |
445 | wx.redirectTo({url: url,}) //跳到非tabbar页 | 344 | wx.redirectTo({url: url,}) //跳到非tabbar页 |
@@ -527,6 +426,7 @@ App({ | @@ -527,6 +426,7 @@ App({ | ||
527 | requestCardNum: function(th) { | 426 | requestCardNum: function(th) { |
528 | if(!this.globalData.user_id) return false; | 427 | if(!this.globalData.user_id) return false; |
529 | this.request.get("/api/weshop/cart/page", { | 428 | this.request.get("/api/weshop/cart/page", { |
429 | + isShoeLoading:false, | ||
530 | data: { | 430 | data: { |
531 | store_id: this.globalData.setting.stoid, | 431 | store_id: this.globalData.setting.stoid, |
532 | user_id: this.globalData.user_id, | 432 | user_id: this.globalData.user_id, |
@@ -540,14 +440,13 @@ App({ | @@ -540,14 +440,13 @@ App({ | ||
540 | num += e.data.data.pageData[i].goods_num; | 440 | num += e.data.data.pageData[i].goods_num; |
541 | } | 441 | } |
542 | } | 442 | } |
543 | - | ||
544 | - | 443 | + getApp().globalData.cartGoodsNum=num; |
545 | /*--- | 444 | /*--- |
546 | wx.setTabBarBadge({ //tabbar右上角添加文本 | 445 | wx.setTabBarBadge({ //tabbar右上角添加文本 |
547 | index: 2, ////tabbar下标 | 446 | index: 2, ////tabbar下标 |
548 | text: '' + num //显示的内容 | 447 | text: '' + num //显示的内容 |
549 | });--*/ | 448 | });--*/ |
550 | - th.setData({['tabBar.cartGoodsNum']:num}); | 449 | + th.getTabBar().setData({cartGoodsNum:num}); |
551 | } | 450 | } |
552 | }); | 451 | }); |
553 | }, | 452 | }, |
@@ -606,7 +505,39 @@ App({ | @@ -606,7 +505,39 @@ App({ | ||
606 | str = str.replace(reg, ''); | 505 | str = str.replace(reg, ''); |
607 | } | 506 | } |
608 | return str; | 507 | return str; |
609 | - } | 508 | + }, |
509 | + | ||
510 | + getPageIndex:function(curPage){ | ||
511 | + | ||
512 | + var pagePath = curPage.route; //当前页面url | ||
513 | + if (pagePath.indexOf('/') != 0) { | ||
514 | + pagePath = '/' + pagePath; | ||
515 | + } | ||
516 | + | ||
517 | + var index=0; | ||
518 | + | ||
519 | + if(this.globalData.custum_data){ | ||
520 | + var itemList = this.globalData.custum_data.data; | ||
521 | + itemList = JSON.parse(itemList); | ||
522 | + for(var i in itemList){ | ||
523 | + var item=itemList[i] | ||
524 | + if(pagePath.indexOf(item.weappurl)!=-1){ | ||
525 | + index=i;break; | ||
526 | + } | ||
527 | + } | ||
528 | + | ||
529 | + }else{ | ||
530 | + var itemList=this.def_list; | ||
531 | + for(var i in itemList){ | ||
532 | + var item=itemList[i] | ||
533 | + if(pagePath.indexOf(item.weappurl)!=-1){ | ||
534 | + index=i;break; | ||
535 | + } | ||
536 | + } | ||
537 | + } | ||
538 | + return index; | ||
539 | + | ||
540 | + } | ||
610 | 541 | ||
611 | 542 | ||
612 | }); | 543 | }); |
app.json
@@ -107,7 +107,6 @@ | @@ -107,7 +107,6 @@ | ||
107 | ] | 107 | ] |
108 | 108 | ||
109 | }], | 109 | }], |
110 | - | ||
111 | "permission": { | 110 | "permission": { |
112 | "scope.userLocation": { | 111 | "scope.userLocation": { |
113 | "desc": "获取你的位置信息" | 112 | "desc": "获取你的位置信息" |
@@ -121,6 +120,48 @@ | @@ -121,6 +120,48 @@ | ||
121 | "backgroundColor": "#ffffff", | 120 | "backgroundColor": "#ffffff", |
122 | "enablePullDownRefresh": true | 121 | "enablePullDownRefresh": true |
123 | }, | 122 | }, |
123 | + | ||
124 | + "tabBar": { | ||
125 | + "custom":true, | ||
126 | + "color": "#6e6d6b", | ||
127 | + "selectedColor": "#f23030", | ||
128 | + "borderStyle": "white", | ||
129 | + "backgroundColor": "#ffffff", | ||
130 | + "list": [ | ||
131 | + { | ||
132 | + "pagePath": "pages/index/index/index", | ||
133 | + "text": "首页", | ||
134 | + "iconPath": "packageA/images/bar/index.png", | ||
135 | + "selectedIconPath": "packageA/images/bar/index_on.png" | ||
136 | + }, | ||
137 | + { | ||
138 | + "pagePath": "pages/goods/categoryList/categoryList", | ||
139 | + "text": "分类", | ||
140 | + "iconPath": "packageA/images/bar/fl.png", | ||
141 | + "selectedIconPath": "packageA/images/bar/fl_on.png" | ||
142 | + }, | ||
143 | + { | ||
144 | + "pagePath": "pages/cart/cart/cart", | ||
145 | + "text": "购物车", | ||
146 | + "iconPath": "packageA/images/bar/car.png", | ||
147 | + "selectedIconPath": "packageA/images/bar/car_on.png" | ||
148 | + }, | ||
149 | + { | ||
150 | + "pagePath": "pages/user/index/index", | ||
151 | + "text": "我的", | ||
152 | + "iconPath": "packageA/images/bar/user.png", | ||
153 | + "selectedIconPath": "packageA/images/bar/user_on.png" | ||
154 | + } | ||
155 | + ] | ||
156 | + }, | ||
157 | + | ||
124 | "debug": false, | 158 | "debug": false, |
125 | - "sitemapLocation": "sitemap.json" | 159 | + "sitemapLocation": "sitemap.json", |
160 | + "usingComponents": { | ||
161 | + "customtabbar":"custom-tab-bar/index" | ||
162 | + } | ||
163 | + | ||
164 | + | ||
165 | + | ||
166 | + | ||
126 | } | 167 | } |
127 | \ No newline at end of file | 168 | \ No newline at end of file |
components/diy_goodsGroup/diy_goodsGroup.js
@@ -319,6 +319,7 @@ Component({ | @@ -319,6 +319,7 @@ Component({ | ||
319 | card_init: function() { | 319 | card_init: function() { |
320 | var th = this,os=getApp().globalData.setting; | 320 | var th = this,os=getApp().globalData.setting; |
321 | getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { | 321 | getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { |
322 | + isShowLoading:false, | ||
322 | success: function(e) { | 323 | success: function(e) { |
323 | getApp().globalData.userInfo = e.data.data; | 324 | getApp().globalData.userInfo = e.data.data; |
324 | getApp().getConfig2(function(e) { | 325 | getApp().getConfig2(function(e) { |
components/goods_list/goods_list.js
@@ -34,6 +34,7 @@ Component({ | @@ -34,6 +34,7 @@ Component({ | ||
34 | init: function () { | 34 | init: function () { |
35 | var th = this; | 35 | var th = this; |
36 | getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { | 36 | getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { |
37 | + isShowLoading:false, | ||
37 | success: function (e) { | 38 | success: function (e) { |
38 | getApp().globalData.userInfo = e.data.data; | 39 | getApp().globalData.userInfo = e.data.data; |
39 | getApp().getConfig2(function (e) { | 40 | getApp().getConfig2(function (e) { |
@@ -93,6 +94,7 @@ Component({ | @@ -93,6 +94,7 @@ Component({ | ||
93 | if (that.data.is_no_more == 0) return false; | 94 | if (that.data.is_no_more == 0) return false; |
94 | var curPage = that.data.curPage; | 95 | var curPage = that.data.curPage; |
95 | getApp().request.get('/api/weshop/goods/page?page', { | 96 | getApp().request.get('/api/weshop/goods/page?page', { |
97 | + isShowLoading:false, | ||
96 | data: { | 98 | data: { |
97 | is_mainshow: 1, | 99 | is_mainshow: 1, |
98 | isonsale: 1, | 100 | isonsale: 1, |
custom-tab-bar/index.js
0 → 100644
1 | +var app = getApp(), os = app.globalData.setting; | ||
2 | + | ||
3 | +Component({ | ||
4 | + data:{ | ||
5 | + fontcolor:'#6e6d6b', | ||
6 | + fontcolor_sele:'#f23030', | ||
7 | + backgroundColor:'#ffffff', | ||
8 | + active:-1, | ||
9 | + list:app.def_list, | ||
10 | + cartGoodsNum:0, | ||
11 | + }, | ||
12 | + | ||
13 | + | ||
14 | + lifetimes: { | ||
15 | + attached: function() { | ||
16 | + | ||
17 | + //购物车显示商品金额 | ||
18 | + this.setData({cartGoodsNum:getApp().globalData.cartGoodsNum}); | ||
19 | + var th=this; | ||
20 | + | ||
21 | + var is_read=getApp().globalData.is_read; | ||
22 | + var custum_data=getApp().globalData.custum_data; | ||
23 | + if(is_read){ | ||
24 | + if(custum_data){ | ||
25 | + this.set_list(custum_data); | ||
26 | + } | ||
27 | + }else{ | ||
28 | + var stoid=os.stoid | ||
29 | + getApp().request.promiseGet("/api/weshop/storeFooter/get/"+stoid, { | ||
30 | + }).then(res => { | ||
31 | + getApp().globalData.is_read=true; | ||
32 | + var e = res; | ||
33 | + if(e.data.code != -1){ | ||
34 | + var itemList = e.data.data.data; | ||
35 | + itemList = JSON.parse(itemList) | ||
36 | + //如果是有定义自定义导航的小程序链接 | ||
37 | + if(itemList[0].weappurl && itemList[0].weappurl!=""){ | ||
38 | + getApp().globalData.custum_data=e.data.data; | ||
39 | + var custum_data=e.data.data; | ||
40 | + th.set_list(custum_data); | ||
41 | + } | ||
42 | + | ||
43 | + } | ||
44 | + | ||
45 | + }) | ||
46 | + } | ||
47 | + }, | ||
48 | + }, | ||
49 | + | ||
50 | + | ||
51 | + methods: { | ||
52 | + //设置自定义页面的列表 | ||
53 | + set_list:function(data){ | ||
54 | + var itemList = data.data; | ||
55 | + itemList = JSON.parse(itemList); | ||
56 | + this.setData({ | ||
57 | + list:itemList, | ||
58 | + backgroundColor: data.bkcolor, | ||
59 | + fontcolor_sele: data.fontcolor_sele, | ||
60 | + fontcolor:data.fontcolor, | ||
61 | + }) | ||
62 | + | ||
63 | + }, | ||
64 | + | ||
65 | + nav_goto:function(e){ | ||
66 | + var url=e.currentTarget.dataset.url; | ||
67 | + if(!url) return false; | ||
68 | + if(url[0]!='/') url='/'+url; | ||
69 | + wx.switchTab({url:url,}) | ||
70 | + } | ||
71 | + | ||
72 | + } | ||
73 | + | ||
74 | + | ||
75 | +}) | ||
0 | \ No newline at end of file | 76 | \ No newline at end of file |
custom-tab-bar/index.json
0 → 100644
custom-tab-bar/index.wxml
0 → 100644
1 | +<!-- 如果是自定义的话 --> | ||
2 | +<view class="main_bar" style=" background: {{backgroundColor}}; font-size: 30rpx;"> | ||
3 | + <block wx:for="{{list}}" wx:for-index="idx"> | ||
4 | + <view data-url="{{item.weappurl}}" bindtap="nav_goto" class="tabbar_item" data-act="{{active==idx?1:0}}" | ||
5 | + style="width:{{100 / list.length}}%;color: {{active==idx?fontcolor_sele:fontcolor}};"> | ||
6 | + <view wx:if="{{item.nav_name=='购物车'}}" class="cart_num" >{{cartGoodsNum}} </view> | ||
7 | + <view class="tab_img" style="margin-top: 10rpx;"> | ||
8 | + <view class="nav_imgage" style="background-image: url({{active==idx?item.src_sele:item.src}});"></view> | ||
9 | + </view> | ||
10 | + <view style="height:20px;line-height:15px; margin-top: 10rpx;"> | ||
11 | + {{item.nav_name}} | ||
12 | + </view> | ||
13 | + </view> | ||
14 | + </block> | ||
15 | +</view > | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
0 | \ No newline at end of file | 23 | \ No newline at end of file |
custom-tab-bar/index.wxss
0 → 100644
1 | +.main_bar{ | ||
2 | + width:100%; border-top: 1rpx solid #ebebeb; position: fixed; bottom: 0; left: 0; z-index: 10000; | ||
3 | +} | ||
4 | +.tabbar_item{ | ||
5 | + position:relative;height:100%;float:left;text-align:center;padding:5px 0; | ||
6 | +} | ||
7 | +.tab_img{display: flex; justify-content: center;align-items: center} | ||
8 | +.nav_imgage{ | ||
9 | + height: 56rpx; width: 56rpx;background-position: center;background-repeat: no-repeat;background-size: auto 85%; | ||
10 | +} | ||
11 | +.cart_num{ | ||
12 | + top:0;background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;line-height:40rpx;height: 40rpx;position: absolute;z-index: 100;right:30rpx; | ||
13 | +} | ||
0 | \ No newline at end of file | 14 | \ No newline at end of file |
pages/cart/cart/cart.js
@@ -54,14 +54,21 @@ Page({ | @@ -54,14 +54,21 @@ Page({ | ||
54 | 54 | ||
55 | }, | 55 | }, |
56 | onShow: function() { | 56 | onShow: function() { |
57 | + | ||
58 | + if (typeof this.getTabBar === 'function' && this.getTabBar()) { | ||
59 | + var index=getApp().getPageIndex(this); | ||
60 | + this.getTabBar().setData({ | ||
61 | + active: index //数字是当前页面在tabbar的索引 | ||
62 | + }) | ||
63 | + | ||
64 | + getApp().requestCardNum(this); | ||
65 | + } | ||
66 | + | ||
57 | var th = this; | 67 | var th = this; |
58 | //调用底部导航 | 68 | //调用底部导航 |
59 | - t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); | 69 | + //t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); |
60 | this.getCardList(); | 70 | this.getCardList(); |
61 | - //--强行等待,让购物车的数量能够正确的线上 | ||
62 | - setTimeout(function () { | ||
63 | - if(getApp().globalData.user_id) getApp().requestCardNum(th); | ||
64 | - },500) | 71 | + |
65 | 72 | ||
66 | //--获取是否又秒杀活动-- | 73 | //--获取是否又秒杀活动-- |
67 | getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { | 74 | getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { |
@@ -1300,7 +1307,13 @@ Page({ | @@ -1300,7 +1307,13 @@ Page({ | ||
1300 | var prom_id=e.currentTarget.dataset.prom_id; | 1307 | var prom_id=e.currentTarget.dataset.prom_id; |
1301 | var url="/pages/goods/goodsList/goodsList?prom_type=3&prom_id="+prom_id; | 1308 | var url="/pages/goods/goodsList/goodsList?prom_type=3&prom_id="+prom_id; |
1302 | getApp().goto(url); | 1309 | getApp().goto(url); |
1303 | - } | ||
1304 | - | ||
1305 | - | 1310 | + }, |
1311 | + | ||
1312 | + //导航跳转 | ||
1313 | + nav_goto:function(e){ | ||
1314 | + var url=e.currentTarget.dataset.url; | ||
1315 | + if(!url || url=='') return; | ||
1316 | + if(url[0]!='/') url='/'+url; | ||
1317 | + getApp().goto(url); | ||
1318 | + } | ||
1306 | }); | 1319 | }); |
1307 | \ No newline at end of file | 1320 | \ No newline at end of file |
pages/cart/cart/cart.wxml
1 | -<import src="../../tabbar/tabbar.wxml" /> | 1 | +<!-- <import src="../../tabbar/tabbar.wxml" /> |
2 | <template is="tabBar" data="{{tabBar}}" /> | 2 | <template is="tabBar" data="{{tabBar}}" /> |
3 | - | 3 | + --> |
4 | <!-- 广告图片 --> | 4 | <!-- 广告图片 --> |
5 | <navigator class="picture" url="/pages/activity/seckill_list/seckill_list" wx:if="{{is_has_flash}}"> | 5 | <navigator class="picture" url="/pages/activity/seckill_list/seckill_list" wx:if="{{is_has_flash}}"> |
6 | <image class="picture" src="{{iurl}}miniapp/images/stores/Seckill.png"></image> | 6 | <image class="picture" src="{{iurl}}miniapp/images/stores/Seckill.png"></image> |
pages/goods/categoryList/categoryList.js
@@ -66,6 +66,8 @@ Page({ | @@ -66,6 +66,8 @@ Page({ | ||
66 | is_show_class:false,//是否添加新样式 | 66 | is_show_class:false,//是否添加新样式 |
67 | status_show:0, | 67 | status_show:0, |
68 | currentTab: 0, //预设当前项的值 | 68 | currentTab: 0, //预设当前项的值 |
69 | + | ||
70 | + load:0, | ||
69 | }, | 71 | }, |
70 | 72 | ||
71 | 73 | ||
@@ -171,15 +173,26 @@ Page({ | @@ -171,15 +173,26 @@ Page({ | ||
171 | } | 173 | } |
172 | }); | 174 | }); |
173 | }, | 175 | }, |
174 | - | ||
175 | onShow:function(){ | 176 | onShow:function(){ |
177 | + | ||
178 | + if (typeof this.getTabBar === 'function' && this.getTabBar()) { | ||
179 | + var index=getApp().getPageIndex(this); | ||
180 | + this.getTabBar().setData({ | ||
181 | + active: index //数字是当前页面在tabbar的索引 | ||
182 | + }); | ||
183 | + getApp().requestCardNum(this); | ||
184 | + } | ||
185 | + | ||
186 | + | ||
176 | var that=this; | 187 | var that=this; |
177 | //调用底部导航 | 188 | //调用底部导航 |
178 | - t.editTabBar(that,getApp().globalData.setting.stoid,getApp().globalData.url); | 189 | + //t.editTabBar(that,getApp().globalData.setting.stoid,getApp().globalData.url); |
179 | //this.requestFirstCategoris(); | 190 | //this.requestFirstCategoris(); |
180 | setTimeout(function () { | 191 | setTimeout(function () { |
181 | - if (getApp().globalData.user_id) getApp().requestCardNum(that); | 192 | + //if (getApp().globalData.user_id) getApp().requestCardNum(that); |
182 | },500) | 193 | },500) |
194 | + | ||
195 | + if(this.data.load) return false; | ||
183 | 196 | ||
184 | getApp().getConfig2(function (e) { | 197 | getApp().getConfig2(function (e) { |
185 | 198 | ||
@@ -256,6 +269,8 @@ Page({ | @@ -256,6 +269,8 @@ Page({ | ||
256 | }else if(that.data.is_show_pp && that.data.select_classify_on == 220){ | 269 | }else if(that.data.is_show_pp && that.data.select_classify_on == 220){ |
257 | that.setData({ status_show: 2 }); | 270 | that.setData({ status_show: 2 }); |
258 | } | 271 | } |
272 | + | ||
273 | + that.data.load=1; | ||
259 | }) | 274 | }) |
260 | 275 | ||
261 | }, | 276 | }, |
@@ -531,8 +546,11 @@ Page({ | @@ -531,8 +546,11 @@ Page({ | ||
531 | arr.push(item); | 546 | arr.push(item); |
532 | } | 547 | } |
533 | } | 548 | } |
534 | - //进行排序 | ||
535 | - arr.sort(compare("zm")); | 549 | + //进行排序,只有是默认排序的时候,才按首字母排序 |
550 | + if(parseInt(s.data.is_used_share)==0){ | ||
551 | + arr.sort(compare("zm")); | ||
552 | + } | ||
553 | + | ||
536 | for(var i=0;i< arr.length;i++){ | 554 | for(var i=0;i< arr.length;i++){ |
537 | for(var j=0;j<arr[i].array.length;j++){ | 555 | for(var j=0;j<arr[i].array.length;j++){ |
538 | if(arr[i].array[j].logo == ""){ | 556 | if(arr[i].array[j].logo == ""){ |
@@ -981,6 +999,14 @@ Page({ | @@ -981,6 +999,14 @@ Page({ | ||
981 | var ob = { "card_list": new_arr, "name_map": card_name_map }; | 999 | var ob = { "card_list": new_arr, "name_map": card_name_map }; |
982 | func(ob); | 1000 | func(ob); |
983 | }) | 1001 | }) |
984 | - } | 1002 | + }, |
1003 | + | ||
1004 | + //导航跳转 | ||
1005 | + nav_goto:function(e){ | ||
1006 | + var url=e.currentTarget.dataset.url; | ||
1007 | + if(!url || url=='') return; | ||
1008 | + if(url[0]!='/') url='/'+url; | ||
1009 | + getApp().goto(url); | ||
1010 | + } | ||
985 | 1011 | ||
986 | }); | 1012 | }); |
987 | \ No newline at end of file | 1013 | \ No newline at end of file |
pages/goods/categoryList/categoryList.wxml
1 | -<import src="../../tabbar/tabbar.wxml" /> | ||
2 | -<template is="tabBar" data="{{tabBar}}" /> | 1 | +<!-- <import src="../../tabbar/tabbar.wxml" /> |
2 | +<template is="tabBar" data="{{tabBar}}" /> --> | ||
3 | 3 | ||
4 | <!-- 风格1 --> | 4 | <!-- 风格1 --> |
5 | <block wx:if="{{is_used_share==0}}"> | 5 | <block wx:if="{{is_used_share==0}}"> |
@@ -101,7 +101,7 @@ | @@ -101,7 +101,7 @@ | ||
101 | <block wx:elif="{{is_used_share == 1}}"> | 101 | <block wx:elif="{{is_used_share == 1}}"> |
102 | <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 102 | <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> |
103 | <!-- 新版分类头部 --> | 103 | <!-- 新版分类头部 --> |
104 | - <view class="xc-search-box flex-center white_b" style="position:fixed;top:0;z-index:99999"> | 104 | + <view class="xc-search-box flex-center white_b" style="position:fixed;top:0;z-index:99"> |
105 | <view class="share-height t-c" bindtap="getScancode" > | 105 | <view class="share-height t-c" bindtap="getScancode" > |
106 | <image class="scanning_black-img"src="{{iurl}}/miniapp/images/goodscategory/scanning_black.png"></image> | 106 | <image class="scanning_black-img"src="{{iurl}}/miniapp/images/goodscategory/scanning_black.png"></image> |
107 | <view class="fs24"> | 107 | <view class="fs24"> |
@@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
120 | <!-- 分类项目内容 22 --> | 120 | <!-- 分类项目内容 22 --> |
121 | <view class="flex project_height" style="margin-left:-10rpx;margin-bottom:120rpx" id="two_type"> | 121 | <view class="flex project_height" style="margin-left:-10rpx;margin-bottom:120rpx" id="two_type"> |
122 | <!-- 分类项目的类型 --> | 122 | <!-- 分类项目的类型 --> |
123 | - <view class="project_type" style="background-color:#eee;height:88%;overflow-y:auto;position:fixed;left:0;z-index:999999;top:126rpx;"> | 123 | + <view class="project_type" style="background-color:#eee;height:88%;overflow-y:auto;position:fixed;left:0;z-index:99;top:126rpx;"> |
124 | <view class="project_type-frame" style="margin-bottom:120rpx;"> | 124 | <view class="project_type-frame" style="margin-bottom:120rpx;"> |
125 | <view wx:if="{{is_show_gb}}" class="{{status_show == 1?'':''}}"> | 125 | <view wx:if="{{is_show_gb}}" class="{{status_show == 1?'':''}}"> |
126 | <!-- <view style="{{status_show == 1?'position: absolute;height: 52rpx;width: 6rpx;background-color: red;left: 0; margin-top: 24rpx;':''}}"></view> --> | 126 | <!-- <view style="{{status_show == 1?'position: absolute;height: 52rpx;width: 6rpx;background-color: red;left: 0; margin-top: 24rpx;':''}}"></view> --> |
@@ -273,7 +273,7 @@ | @@ -273,7 +273,7 @@ | ||
273 | <block wx:elif="{{is_used_share == 2}}"> | 273 | <block wx:elif="{{is_used_share == 2}}"> |
274 | <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 274 | <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> |
275 | <!-- 头部 --> | 275 | <!-- 头部 --> |
276 | - <view class="xc-search-box flex-center white_b" id="navbar" style="position:fixed;top:0;z-index:99999"> | 276 | + <view class="xc-search-box flex-center white_b" id="navbar" style="position:fixed;top:0;z-index:99"> |
277 | <view class="share-height t-c" bindtap="getScancode" > | 277 | <view class="share-height t-c" bindtap="getScancode" > |
278 | <image class="scanning_black-img"src="{{iurl}}/miniapp/images/goodscategory/scanning_black.png"></image> | 278 | <image class="scanning_black-img"src="{{iurl}}/miniapp/images/goodscategory/scanning_black.png"></image> |
279 | <view class="fs24"> | 279 | <view class="fs24"> |
@@ -291,7 +291,7 @@ | @@ -291,7 +291,7 @@ | ||
291 | <!-- 分类项目内容 --> | 291 | <!-- 分类项目内容 --> |
292 | <view class="flex project_height" style="margin-left:-10rpx;"> | 292 | <view class="flex project_height" style="margin-left:-10rpx;"> |
293 | <!-- 分类项目的类型 --> | 293 | <!-- 分类项目的类型 --> |
294 | - <view class="project_type" style="background-color:#eee;height:88%;overflow-y:auto;position:fixed;left:0;z-index:999999;top:126rpx;" id="thress_type3"> | 294 | + <view class="project_type" style="background-color:#eee;height:88%;overflow-y:auto;position:fixed;left:0;z-index:99;top:126rpx;" id="thress_type3"> |
295 | <view class="project_type-frame" style="margin-bottom:120rpx;"> | 295 | <view class="project_type-frame" style="margin-bottom:120rpx;"> |
296 | <view wx:if="{{is_show_gb}}"> | 296 | <view wx:if="{{is_show_gb}}"> |
297 | <view bindtap="click_classify" class="tab-bar-item {{select_classify_on==223 ? 'active' : ''}}" data-current="223" data-index="223" data-name="国家" wx:if="{{is_country}}"> | 297 | <view bindtap="click_classify" class="tab-bar-item {{select_classify_on==223 ? 'active' : ''}}" data-current="223" data-index="223" data-name="国家" wx:if="{{is_country}}"> |
pages/goods/goodsInfo/goodsInfo.wxml
@@ -825,7 +825,7 @@ | @@ -825,7 +825,7 @@ | ||
825 | <view>收藏</view> | 825 | <view>收藏</view> |
826 | </view> | 826 | </view> |
827 | <view class="shopping-cart cart-ico new_split"> | 827 | <view class="shopping-cart cart-ico new_split"> |
828 | - <navigator url="/pages/cart/cart/cart"> | 828 | + <navigator open-type="switchTab" url="/pages/cart/cart/cart"> |
829 | <image class="sc-img" src="{{iurl}}/miniapp/images/shopping-cart.png"></image> | 829 | <image class="sc-img" src="{{iurl}}/miniapp/images/shopping-cart.png"></image> |
830 | <view class="cart-num ellipsis-1"> {{cartGoodsNum}} </view> | 830 | <view class="cart-num ellipsis-1"> {{cartGoodsNum}} </view> |
831 | <view>购物车</view> | 831 | <view>购物车</view> |
pages/index/index/index.js
@@ -94,8 +94,8 @@ Page({ | @@ -94,8 +94,8 @@ Page({ | ||
94 | }) | 94 | }) |
95 | 95 | ||
96 | //调用底部导航 | 96 | //调用底部导航 |
97 | - getApp().globalData.url=th.data.url | ||
98 | - t.editTabBar(th,o.stoid,th.data.url); | 97 | + //getApp().globalData.url=th.data.url |
98 | + //t.editTabBar(th,o.stoid,th.data.url); | ||
99 | 99 | ||
100 | await this.init_load(); | 100 | await this.init_load(); |
101 | //显示的时候要开启计时器 | 101 | //显示的时候要开启计时器 |
@@ -171,6 +171,15 @@ Page({ | @@ -171,6 +171,15 @@ Page({ | ||
171 | }, | 171 | }, |
172 | 172 | ||
173 | async onShow() { | 173 | async onShow() { |
174 | + if (typeof this.getTabBar === 'function' && this.getTabBar()) { | ||
175 | + var index=getApp().getPageIndex(this); | ||
176 | + this.getTabBar().setData({ | ||
177 | + active: index //数字是当前页面在tabbar的索引 | ||
178 | + }) | ||
179 | + | ||
180 | + getApp().requestCardNum(this); | ||
181 | + } | ||
182 | + | ||
174 | var th = this | 183 | var th = this |
175 | }, | 184 | }, |
176 | //当隐藏的时候就关闭计时器 | 185 | //当隐藏的时候就关闭计时器 |
@@ -832,6 +841,16 @@ Page({ | @@ -832,6 +841,16 @@ Page({ | ||
832 | if(!url || url=='') return; | 841 | if(!url || url=='') return; |
833 | if(url[0]!='/') url='/'+url; | 842 | if(url[0]!='/') url='/'+url; |
834 | getApp().goto(url); | 843 | getApp().goto(url); |
835 | - } | 844 | + }, |
845 | + | ||
846 | + //导航跳转 | ||
847 | + nav_goto:function(e){ | ||
848 | + var url=e.currentTarget.dataset.url; | ||
849 | + if(!url || url=='') return; | ||
850 | + if(url[0]!='/') url='/'+url; | ||
851 | + getApp().goto(url); | ||
852 | + } | ||
853 | + | ||
854 | + | ||
836 | 855 | ||
837 | }); | 856 | }); |
838 | \ No newline at end of file | 857 | \ No newline at end of file |
pages/index/index/index.wxml
1 | -<import src="../../tabbar/tabbar.wxml" /> | ||
2 | -<template is="tabBar" data="{{tabBar}}"/> | ||
3 | - | 1 | +<!-- <import src="../../tabbar/tabbar.wxml" /> --> |
2 | +<!-- <template is="tabBar" data="{{tabBar}}"/> --> | ||
4 | <!--普通界面--> | 3 | <!--普通界面--> |
5 | <wxs module="filter" src="../../../utils/filter.wxs"></wxs> | 4 | <wxs module="filter" src="../../../utils/filter.wxs"></wxs> |
6 | <view class="container rel" wx:if="{{ishow}}"> | 5 | <view class="container rel" wx:if="{{ishow}}"> |
pages/user/index/index.js
@@ -76,6 +76,16 @@ Page({ | @@ -76,6 +76,16 @@ Page({ | ||
76 | * 生命周期函数--监听页面显示 | 76 | * 生命周期函数--监听页面显示 |
77 | */ | 77 | */ |
78 | onShow: function() { | 78 | onShow: function() { |
79 | + | ||
80 | + | ||
81 | + if (typeof this.getTabBar === 'function' && this.getTabBar()) { | ||
82 | + var index=getApp().getPageIndex(this); | ||
83 | + this.getTabBar().setData({ | ||
84 | + active: index //数字是当前页面在tabbar的索引 | ||
85 | + }); | ||
86 | + | ||
87 | + getApp().requestCardNum(this); | ||
88 | + } | ||
79 | 89 | ||
80 | this.is_assistance(); | 90 | this.is_assistance(); |
81 | var stoid = app_d.setting.stoid; | 91 | var stoid = app_d.setting.stoid; |
@@ -85,7 +95,6 @@ Page({ | @@ -85,7 +95,6 @@ Page({ | ||
85 | cur_g_num = 0; | 95 | cur_g_num = 0; |
86 | 96 | ||
87 | //调用底部导航 | 97 | //调用底部导航 |
88 | - getApp().editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); | ||
89 | getApp().get_isbuy(th.setappdata); | 98 | getApp().get_isbuy(th.setappdata); |
90 | setTimeout(function () { | 99 | setTimeout(function () { |
91 | if (getApp().globalData.user_id) getApp().requestCardNum(th); | 100 | if (getApp().globalData.user_id) getApp().requestCardNum(th); |
@@ -638,9 +647,14 @@ Page({ | @@ -638,9 +647,14 @@ Page({ | ||
638 | 647 | ||
639 | } | 648 | } |
640 | }) | 649 | }) |
641 | - } | ||
642 | - | ||
643 | - | ||
644 | - | 650 | + }, |
651 | + | ||
652 | + //导航跳转 | ||
653 | + nav_goto:function(e){ | ||
654 | + var url=e.currentTarget.dataset.url; | ||
655 | + if(!url || url=='') return; | ||
656 | + if(url[0]!='/') url='/'+url; | ||
657 | + getApp().goto(url); | ||
658 | + } | ||
645 | 659 | ||
646 | }) | 660 | }) |
pages/user/index/index.wxml
1 | -<import src="../../tabbar/tabbar.wxml" /> | ||
2 | -<template is="tabBar" data="{{tabBar}}" /> | 1 | +<!-- <import src="../../tabbar/tabbar.wxml" /> |
2 | +<template is="tabBar" data="{{tabBar}}" /> --> | ||
3 | 3 | ||
4 | <view class="xc-page" style="margin-bottom:{{isIpx ? '168rpx' : '100rpx'}}"> | 4 | <view class="xc-page" style="margin-bottom:{{isIpx ? '168rpx' : '100rpx'}}"> |
5 | <view class="xc-user"> | 5 | <view class="xc-user"> |