|
|
@@ -1,6 +1,6 @@
|
|
|
const app = getApp();
|
|
|
import wxh from '../../utils/wxh.js';
|
|
|
-import { getIndexData, getCoupons, getTemlIds, getLiveList } from '../../api/api.js';
|
|
|
+import { getIndexData, getCoupons, getTemlIds, getLiveList, getNotifications } from '../../api/api.js';
|
|
|
import { CACHE_SUBSCRIBE_MESSAGE } from '../../config.js';
|
|
|
import { getCategoryList, getProductHot, getProductslist } from '../../api/store.js';
|
|
|
import { getCouponReceive} from '../../api/user.js';
|
|
|
@@ -98,6 +98,7 @@ Page({
|
|
|
wxh.selfLocation(1);
|
|
|
this.getCategoryData();
|
|
|
// this.getCoupon();
|
|
|
+ this.getNotification();
|
|
|
this.get_host_product();
|
|
|
this.get_product_list();
|
|
|
this.setData({
|
|
|
@@ -149,6 +150,7 @@ Page({
|
|
|
onShow: function () {
|
|
|
// this.getCoupon();
|
|
|
this.getIndexConfig();
|
|
|
+ this.getNotification();
|
|
|
// this.getSeckillTime();
|
|
|
|
|
|
var activity = this.data.activities[this.data.tapActive];
|
|
|
@@ -380,6 +382,24 @@ Page({
|
|
|
// });
|
|
|
});
|
|
|
},
|
|
|
+ getNotification: function() {
|
|
|
+ var that = this;
|
|
|
+ getNotifications().then(res=>{
|
|
|
+ var unread = res.data.unread;
|
|
|
+ if(unread > 0) {
|
|
|
+ wx.setTabBarBadge({
|
|
|
+ index: 2,
|
|
|
+ text: res.data.unread.toString()
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wx.removeTabBarBadge({
|
|
|
+ index: 2,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
receiveCoupon: function (e) {
|
|
|
if (!app.globalData.isLog) {
|
|
|
this.setData({
|