Commit 46881609bd6d8892f72b4b59d2a2f76e121bb09e

Authored by wangfan
1 parent 538dc0ab

seller-Invitation

1 // components/book/tabBar/tabBar.js 1 // components/book/tabBar/tabBar.js
2 import util from '../../../utils/util' 2 import util from '../../../utils/util'
  3 +import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
3 Component({ 5 Component({
4 /** 6 /**
5 * 组件的属性列表 7 * 组件的属性列表
@@ -13,6 +15,7 @@ Component({ @@ -13,6 +15,7 @@ Component({
13 */ 15 */
14 data: { 16 data: {
15 pi:0, 17 pi:0,
  18 + dot:0,
16 }, 19 },
17 attached(){ 20 attached(){
18 let pages=getCurrentPages(); 21 let pages=getCurrentPages();
@@ -28,6 +31,9 @@ Component({ @@ -28,6 +31,9 @@ Component({
28 } 31 }
29 } 32 }
30 }, 33 },
  34 + ready(){
  35 + this.hasDot()
  36 + },
31 /** 37 /**
32 * 组件的方法列表 38 * 组件的方法列表
33 */ 39 */
@@ -41,6 +47,15 @@ Component({ @@ -41,6 +47,15 @@ Component({
41 url:url, 47 url:url,
42 }) 48 })
43 } 49 }
44 - } 50 + },
  51 + hasDot(){
  52 + App.Reserve.GetNewCustomerTotal().then(res => {
  53 + let dot=res.data.total||0
  54 + this.setData({
  55 + dot:dot
  56 + })
  57 + this.triggerEvent('NewCustomer',{total:dot})
  58 + });
  59 + }
45 } 60 }
46 }) 61 })
@@ -16,7 +16,9 @@ @@ -16,7 +16,9 @@
16 --> 16 -->
17 <formids class="item flex-vc" bindtap="redirectTo" data-url="/pages/manager-invitation/setting/index"> 17 <formids class="item flex-vc" bindtap="redirectTo" data-url="/pages/manager-invitation/setting/index">
18 <view class="flex-vc {{pi==2?'checked':''}}"> 18 <view class="flex-vc {{pi==2?'checked':''}}">
19 - <view class="icon setting"></view> 19 + <view class="icon setting">
  20 + <view class="dot" wx:if="{{dot>0}}"></view>
  21 + </view>
20 <view class="text">我的</view> 22 <view class="text">我的</view>
21 </view> 23 </view>
22 </formids> 24 </formids>
@@ -20,11 +20,21 @@ @@ -20,11 +20,21 @@
20 .tabBar .item{ 20 .tabBar .item{
21 width: 50%; 21 width: 50%;
22 } 22 }
  23 +.dot{
  24 + position: absolute;
  25 + width: 16rpx;
  26 + height: 16rpx;
  27 + background-color: #F05522;
  28 + border-radius: 50%;
  29 + right:-14rpx;
  30 + top:-8rpx;
  31 +}
23 .tabBar .icon{ 32 .tabBar .icon{
24 width: 34rpx; 33 width: 34rpx;
25 height: 32rpx; 34 height: 32rpx;
26 margin-bottom: 12rpx; 35 margin-bottom: 12rpx;
27 background-size: 100% 100%; 36 background-size: 100% 100%;
  37 + position: relative;
28 } 38 }
29 .tabBar .icon image{ 39 .tabBar .icon image{
30 width: 100%; 40 width: 100%;
@@ -23,11 +23,13 @@ Page({ @@ -23,11 +23,13 @@ Page({
23 enter_params: {}, 23 enter_params: {},
24 onLoad: function (options) { 24 onLoad: function (options) {
25 this.enter_params = util.cache('enter_params'); 25 this.enter_params = util.cache('enter_params');
26 - App.Reserve.SellerInfo(this.enter_params).then(res=>{  
27 - this.setData({  
28 - hasSalesman:res.data.hasSalesman==1 26 + if(this.enter_params){
  27 + App.Reserve.SellerInfo(this.enter_params).then(res=>{
  28 + this.setData({
  29 + hasSalesman:res.data.hasSalesman==1
  30 + })
29 }) 31 })
30 - }) 32 + }
31 this.seller_id=options.seller_id||this.enter_params.seller_id; 33 this.seller_id=options.seller_id||this.enter_params.seller_id;
32 this.getMembers(); 34 this.getMembers();
33 App.Reserve.GetNewCustomerTotal({},'clean'); 35 App.Reserve.GetNewCustomerTotal({},'clean');
@@ -69,9 +71,9 @@ Page({ @@ -69,9 +71,9 @@ Page({
69 }, 71 },
70 getMembers(hasReachBottom=false){ 72 getMembers(hasReachBottom=false){
71 App.Reserve.Members({ 73 App.Reserve.Members({
72 - sid: this.seller_id, 74 + sid: this.seller_id||'xxxx',
73 //manager_id:this.enter_params.manager_id, 75 //manager_id:this.enter_params.manager_id,
74 - manager_openid:this.enter_params.seller_openid, 76 + //manager_openid:this.enter_params.seller_openid,
75 offset: this.offset, 77 offset: this.offset,
76 limit: this.limit, 78 limit: this.limit,
77 }).then(res => { 79 }).then(res => {
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 import util from '../../../utils/util'; 2 import util from '../../../utils/util';
3 import App from '../../../utils/api'; 3 import App from '../../../utils/api';
4 const {regeneratorRuntime} = global 4 const {regeneratorRuntime} = global
  5 +import PubSub from '../../../utils/PubSub'
5 Page({ 6 Page({
6 7
7 /** 8 /**
@@ -9,6 +10,7 @@ Page({ @@ -9,6 +10,7 @@ Page({
9 */ 10 */
10 data: { 11 data: {
11 hasSellerBook:false, 12 hasSellerBook:false,
  13 + NewCustomerTotal:0,
12 }, 14 },
13 15
14 /** 16 /**
@@ -23,6 +25,13 @@ Page({ @@ -23,6 +25,13 @@ Page({
23 }) 25 })
24 } 26 }
25 }) 27 })
  28 + PubSub.on(
  29 + 'flushNewCustomer',
  30 + data=>{
  31 + console.log('flushNewCustomer',data)
  32 + this.selectComponent('#tabBar').hasDot();
  33 + }
  34 + )
26 }, 35 },
27 36
28 /** 37 /**
@@ -65,6 +74,10 @@ Page({ @@ -65,6 +74,10 @@ Page({
65 } 74 }
66 75
67 }) 76 })
68 - 77 + },
  78 + NewCustomer(e){
  79 + this.setData({
  80 + NewCustomerTotal:e.detail.total
  81 + })
69 } 82 }
70 }) 83 })
@@ -25,10 +25,11 @@ @@ -25,10 +25,11 @@
25 </view> 25 </view>
26 </view> 26 </view>
27 </formids> 27 </formids>
28 - <formids url="/pages/manager-invitation/crm/index"> 28 + <formids url="/pages/book/crm/index">
29 <view class="row flex-lr" style="padding-top: 34rpx;"> 29 <view class="row flex-lr" style="padding-top: 34rpx;">
30 <view>我的客户</view> 30 <view>我的客户</view>
31 <view class="flex-rr"> 31 <view class="flex-rr">
  32 + <text class="right" wx:if="{{NewCustomerTotal>0}}" style="color: #F05522;">新增{{NewCustomerTotal}}位</text>
32 <view class="more"></view> 33 <view class="more"></view>
33 </view> 34 </view>
34 </view> 35 </view>
@@ -50,4 +51,4 @@ @@ -50,4 +51,4 @@
50 </view> 51 </view>
51 </formids> 52 </formids>
52 </view> 53 </view>
53 -<tabBar></tabBar> 54 +<tabBar bindNewCustomer="NewCustomer" id="tabBar"></tabBar>