1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- var url = require('../constant/url.js')
- import Net from './../tool/net.js'
- var net = new Net()
- var app = getApp()
- function getRedDot() {
- net.connectNeedLogin({
- url: url.app_host + url.getPersonalPageCount,
- data: {},
- success: (err, res) => {
- var all = 0
- if (res.data.buy > 99) {
- app.redDotArray[0] = '99+'
- } else {
- app.redDotArray[0] = String(res.data.buy)
- }
- all += res.data.buy
- if (res.data.wage > 99) {
- app.redDotArray[1] = '99+'
- } else {
- app.redDotArray[1] = String(res.data.wage)
- }
- all += res.data.wage
- if (res.data.added > 99) {
- app.redDotArray[2] = '99+'
- } else {
- app.redDotArray[2] = String(res.data.added)
- }
- all += res.data.added
- if (res.data.material_flow > 99) {
- app.redDotArray[3] = '99+'
- } else {
- app.redDotArray[3] = String(res.data.material_flow)
- }
- all += res.data.material_flow
- var pages = getCurrentPages()
- var page = pages[0]
- if (typeof page.refreshRedDot === 'function') {
- page.refreshRedDot()
- }
- if (all > 99) {
- all = '99+'
- } else {
- all = String(all)
- }
- app.tabRedDot = all
- if (typeof page.getTabBar === 'function' &&
- page.getTabBar()) {
- page.getTabBar().setData({
- redDot: all
- })
- }
-
- app.bankCardTips = {}
- outer:
- for (var i = 0; i < res.data.sbuids.length; i++) {
- var id = res.data.sbuids[i]
- for (var j = 0; j < app.globalData.customerList.length; j++) {
- var customer = app.globalData.customerList[j]
- if (id == customer.id) {
- app.bankCardTips = {
- 't': '请添加 ' + customer.user_name + ' 的银行卡,否则会影响流水费返还。',
- 'c': customer
- }
- break outer
- }
- }
- }
-
- if (typeof page.judgeBankCardTips === 'function') {
- page.judgeBankCardTips()
- }
- },
- fail: (err, res) => {
- }
- }, true)
- }
- module.exports = {
- getRedDot: getRedDot,
- }
|