From 3d0927bf11cc9233c8c3275f382b78f4c25ce7d2 Mon Sep 17 00:00:00 2001 From: devil Date: Mon, 6 Jan 2020 19:37:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- application/tags.php | 31 +++++++++++++++++ public/appmini/old/alipay/app.js | 34 +++++++++++++++++++ public/appmini/old/alipay/pages/cart/cart.js | 17 ++++++++++ .../appmini/old/alipay/pages/index/index.js | 9 +++++ public/appmini/old/alipay/pages/user/user.js | 8 +++++ public/appmini/old/weixin/app.js | 2 +- public/appmini/old/weixin/app.json | 4 +-- 8 files changed, 104 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d64e0577e..100844c32 100755 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ .idea .htaccess *payment_*_respond.php -*payment_*_notify.php \ No newline at end of file +*payment_*_notify.php +.swan diff --git a/application/tags.php b/application/tags.php index adc212456..326660071 100755 --- a/application/tags.php +++ b/application/tags.php @@ -36,6 +36,7 @@ return array ( array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', 1 => 'app\\plugins\\coupon\\Hook', + 2 => 'app\\plugins\\distribution\\Hook', ), 'plugins_service_navigation_header_handle' => array ( @@ -62,14 +63,17 @@ return array ( 'plugins_service_goods_spec_extends_handle' => array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', + 1 => 'app\\plugins\\distribution\\Hook', ), 'plugins_view_admin_user_save' => array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', + 1 => 'app\\plugins\\distribution\\Hook', ), 'plugins_service_user_save_handle' => array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', + 1 => 'app\\plugins\\distribution\\Hook', ), 'plugins_service_goods_save_handle' => array ( @@ -95,11 +99,13 @@ return array ( array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', 1 => 'app\\plugins\\coupon\\Hook', + 2 => 'app\\plugins\\distribution\\Hook', ), 'plugins_service_header_navigation_top_right_handle' => array ( 0 => 'app\\plugins\\membershiplevelvip\\Hook', 1 => 'app\\plugins\\coupon\\Hook', + 2 => 'app\\plugins\\distribution\\Hook', ), 'plugins_js' => array ( @@ -124,10 +130,35 @@ return array ( 'plugins_service_order_status_change_history_success_handle' => array ( 0 => 'app\\plugins\\coupon\\Hook', + 1 => 'app\\plugins\\distribution\\Hook', ), 'plugins_service_user_register_end' => array ( 0 => 'app\\plugins\\coupon\\Hook', ), + 'plugins_service_order_aftersale_audit_handle_end' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_service_site_extraction_address_list' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_service_buy_order_insert_end' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_view_goods_detail_base_buy_nav_min_inside' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_view_goods_detail_photo_within' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_view_goods_detail_base_bottom' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), ); ?> \ No newline at end of file diff --git a/public/appmini/old/alipay/app.js b/public/appmini/old/alipay/app.js index 01642cd52..92b5b6f8d 100644 --- a/public/appmini/old/alipay/app.js +++ b/public/appmini/old/alipay/app.js @@ -683,6 +683,40 @@ App({ return (user == false) ? null : user.alipay_openid || null; }, + /** + * 设置导航reddot + * index tabBar 的哪一项,从左边算起(0开始) + * type 0 移出, 1 添加 (默认 0 移出) + */ + set_tab_bar_reddot(index, type) { + if (index !== undefined && index !== null) + { + if ((type || 0) == 0) + { + my.hideTabBarRedDot({ index: Number(index) }); + } else { + my.showTabBarRedDot({ index: Number(index) }); + } + } + }, + + /** + * 设置导航车badge + * index tabBar 的哪一项,从左边算起(0开始) + * type 0 移出, 1 添加 (默认 0 移出) + * value 显示的文本,超过 4 个字符则显示成 ...(type参数为1的情况下有效) + */ + set_tab_bar_badge(index, type, value) { + if (index !== undefined && index !== null) + { + if ((type || 0) == 0) { + my.removeTabBarBadge({ index: Number(index) }); + } else { + my.setTabBarBadge({ index: Number(index), "text": value.toString() }); + } + } + }, + // 窗口背景色设置 set_nav_bg_color_main() { // 窗口和下拉顶部背景色 diff --git a/public/appmini/old/alipay/pages/cart/cart.js b/public/appmini/old/alipay/pages/cart/cart.js index c01b5e67c..436767d90 100644 --- a/public/appmini/old/alipay/pages/cart/cart.js +++ b/public/appmini/old/alipay/pages/cart/cart.js @@ -98,6 +98,14 @@ Page({ common_is_exhibition_mode_btn_text: data.common_is_exhibition_mode_btn_text || '立即咨询', customer_service_tel: data.customer_service_tel || null, }); + + // 导航购物车处理 + var cart_total = data.common_cart_total || 0; + if (cart_total <= 0) { + app.set_tab_bar_badge(2, 0); + } else { + app.set_tab_bar_badge(2, 1, cart_total); + } } else { this.setData({ data_list_loding_status: 2, @@ -279,6 +287,15 @@ Page({ swipe_index: null, data_list_loding_status: temp_data_list.length == 0 ? 0 : this.data.data_list_loding_status, }); + + // 导航购物车处理 + var cart_total = res.data.data || 0; + if (cart_total <= 0) { + app.set_tab_bar_badge(2, 0); + } else { + app.set_tab_bar_badge(2, 1, cart_total); + } + app.showToast(((type == 'delete') ? '删除成功' : '收藏成功'), 'success'); } else { if (app.is_login_check(res.data)) { diff --git a/public/appmini/old/alipay/pages/index/index.js b/public/appmini/old/alipay/pages/index/index.js index a3b84ce79..e76164068 100644 --- a/public/appmini/old/alipay/pages/index/index.js +++ b/public/appmini/old/alipay/pages/index/index.js @@ -72,6 +72,15 @@ Page({ common_app_mini_alipay_scene: data.common_app_mini_alipay_scene || null, }); + // 导航购物车处理 + var cart_total = data.common_cart_total || 0; + if (cart_total <= 0) + { + app.set_tab_bar_badge(2, 0); + } else { + app.set_tab_bar_badge(2, 1, cart_total); + } + // 在线客服开启,用户openid if(this.data.common_app_is_online_service == 1) { diff --git a/public/appmini/old/alipay/pages/user/user.js b/public/appmini/old/alipay/pages/user/user.js index 9f552dca2..6006a30d3 100644 --- a/public/appmini/old/alipay/pages/user/user.js +++ b/public/appmini/old/alipay/pages/user/user.js @@ -119,6 +119,14 @@ Page({ common_app_mini_alipay_scene: data.common_app_mini_alipay_scene || null, }); + // 导航购物车处理 + var cart_total = data.common_cart_total || 0; + if (cart_total <= 0) { + app.set_tab_bar_badge(2, 0); + } else { + app.set_tab_bar_badge(2, 1, cart_total); + } + // 在线客服开启,用户openid if(this.data.common_app_is_online_service == 1) { diff --git a/public/appmini/old/weixin/app.js b/public/appmini/old/weixin/app.js index 7a194b4c0..ca5a8e449 100755 --- a/public/appmini/old/weixin/app.js +++ b/public/appmini/old/weixin/app.js @@ -648,7 +648,7 @@ App({ if ((type || 0) == 0) { wx.removeTabBarBadge({ index: Number(index) }); } else { - wx.setTabBarBadge({ "index": Number(index), "text": value.toString() }); + wx.setTabBarBadge({ index: Number(index), "text": value.toString() }); } } }, diff --git a/public/appmini/old/weixin/app.json b/public/appmini/old/weixin/app.json index 12fe28d56..cb59c6222 100755 --- a/public/appmini/old/weixin/app.json +++ b/public/appmini/old/weixin/app.json @@ -1,7 +1,7 @@ { - "pages": ["pages/index/index", + "pages": [ "pages/user-membervip/user-membervip", - + "pages/index/index", "pages/goods-category/goods-category", "pages/cart/cart", "pages/user/user", -- GitLab