899 lines
26 KiB
JavaScript
899 lines
26 KiB
JavaScript
// pages/member/rankingListSecond/rankingListSecond.js
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
// 标记 防止重复加载 招商员 招商中心切换
|
|
currentBaseTabIndex: "0",
|
|
is_enterprise_content: false,
|
|
is_enterprise_center_content: false,
|
|
// 标记 防止重复加载 招商员 切换
|
|
currentEnterpriseTabIndex: '0',
|
|
is_enterprise_first_content: false,
|
|
is_enterprise_second_content: false,
|
|
is_enterprise_third_content: false,
|
|
// 标记 防止重复加载 招商中心 切换
|
|
currentEnterpriseCenterTabIndex: '0',
|
|
is_enterprise_center_first_content: false,
|
|
is_enterprise_center_second_content: false,
|
|
is_enterprise_center_third_content: false,
|
|
active: '',
|
|
active1: '',
|
|
active2: '',
|
|
active2show: false,
|
|
enterpriseBaseActiveName: 'enterprise', // 招商员 招商中心切换
|
|
// 招商员数据
|
|
enterpriseInfo_1: {},
|
|
enterpriseRatioDatas: [],
|
|
enterpriseSupplier: 0,
|
|
enterpriseActiveName: 'enterprise_first',
|
|
enterprise_first_content: [],
|
|
enterprise_second_content: [],
|
|
enterprise_third_content: [],
|
|
enterprise_store_number: 0,
|
|
// 招商员数据
|
|
// 招商中心数据
|
|
enterpriseCenterInfo_1: {},
|
|
enterpriseCenterRatioDatas: [],
|
|
enterpriseCenterSupplier: 0,
|
|
enterpriseCenterActiveName: 'enterprise_center_first',
|
|
enterprise_center_first_content: [],
|
|
enterprise_center_second_content: [],
|
|
enterprise_center_third_content: [],
|
|
enterprise_level_title: '',
|
|
enterprise_level_li: '',
|
|
erchants_name: '',
|
|
erchants_ratio: '',
|
|
// 门店人数
|
|
store_number: 0,
|
|
// 招商中心数据
|
|
|
|
isLoadMore: true, //判断是否要加载更多的标志
|
|
total_page: 0, //总页数
|
|
page: 1, //分页数,当前页数
|
|
total_page2: 0, // 待优化。。。
|
|
page2: 1,
|
|
total_page3: 0,
|
|
page3: 1,
|
|
total_page4: 0,
|
|
page4: 1,
|
|
total_page5: 0,
|
|
page5: 5,
|
|
total_page6: 0,
|
|
page6: 1,
|
|
// 自定义语言
|
|
merchant_center:"",
|
|
merchant_people:"",
|
|
merchant_reward:"",
|
|
merchant_title:"",
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {
|
|
let currentBaseTabIndex = options.selectIndex || 0;
|
|
this.data.currentBaseTabIndex = currentBaseTabIndex;
|
|
this.setData({active:currentBaseTabIndex});
|
|
if (this.data.currentBaseTabIndex == 1 && !this.data.active2show) {
|
|
this.setData({
|
|
active2show: true
|
|
});
|
|
}
|
|
|
|
try {
|
|
// 推广中心是否开启该功能,没开启跳转到指定路径
|
|
let basic_info = wx.getStorageSync("yz_basic_info");
|
|
let stop_info = basic_info.popularize_page.mini.vue_route;
|
|
for (let i = 0; i < stop_info.length; i++) {
|
|
if (stop_info[i] == 'enterprise_index') {
|
|
console.log(basic_info.popularize_page.mini.mini_url + "跳转的路径");
|
|
wx.showToast({
|
|
title: '未开启推广权限',
|
|
duration: 2000,
|
|
icon: 'none',
|
|
success: function() {
|
|
setTimeout(() => {
|
|
wx.redirectTo({
|
|
url: basic_info.popularize_page.mini.mini_url,
|
|
});
|
|
}, 1000);
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
}
|
|
} catch (e) {
|
|
console.log(e);
|
|
}
|
|
this.setDataByTabIndex();
|
|
this.getEnterpriseInfo_4('', 1);
|
|
this.initLang();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {
|
|
this.getEnterpriseInfo_2();
|
|
this.getEnterpriseInfo_1();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
if (this.data.isLoadMore) {
|
|
this.getMoreData();
|
|
} else {
|
|
wx.showToast({
|
|
title: '没有更多数据',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {},
|
|
// 获取数据
|
|
|
|
// 设置选择后的数据
|
|
setDataByTabIndex() {
|
|
if (this.data.currentBaseTabIndex == '0' && !this.data.is_enterprise_content) {
|
|
this.data.is_enterprise_content = true;
|
|
this.getEnterpriseData();
|
|
} else if (this.data.currentBaseTabIndex == '1' && this.data.is_enterprise_center_content) {
|
|
this.getEnterpriseCenterData(); // 判断是否是招商中心
|
|
} else if (this.data.currentBaseTabIndex == '1' && !this.data.is_enterprise_center_content) {
|
|
console.log("走哪里");
|
|
this.isEnterpriseCenter(); // 判断是否是招商中心
|
|
}
|
|
},
|
|
// tab 点击
|
|
enterpriseBaseHandleClick(val) {
|
|
if (this.data.currentBaseTabIndex == val.detail.index) {
|
|
return;
|
|
} else {
|
|
this.data.currentBaseTabIndex = val.detail.index;
|
|
}
|
|
if (this.data.currentBaseTabIndex == 1 && !this.data.active2show) {
|
|
this.setData({
|
|
active2show: true
|
|
});
|
|
}
|
|
this.setDataByTabIndex();
|
|
},
|
|
|
|
// ---------招商中心---------//
|
|
|
|
isEnterpriseCenter() {
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.get-center-permission');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
if (resdata.result === 1) {
|
|
if (resdata.data.status == -1) {
|
|
this.data.is_enterprise_center_content = false;
|
|
// 不是招商中心 跳转去申请
|
|
wx.navigateTo({
|
|
url: '/packageB/member/enterprise/enterprose_center_apply/enterprose_center_apply'
|
|
});
|
|
return;
|
|
} else if (resdata.data.status == 1) {
|
|
// 是招商中心 获取数据
|
|
this.data.is_enterprise_center_content = true;
|
|
this.getEnterpriseCenterData(); // 获取招商中心全部信息
|
|
}
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
|
|
// 获取招商中心全部信息
|
|
getEnterpriseCenterData() {
|
|
this.getEnterpriseCenterInfo_1(); // 获取招商中心信息
|
|
this.getEnterpriseCenterInfo_2(); // 获取招商中心统计信息
|
|
this.getEnterpriseCenterInfo_3(); // 获取招商中心 供应商人数
|
|
this.setEnterpriseCenterDataByTabIndex(); // 获取招商中心分红信息
|
|
this.getStoreNumber(); // 获取招商中心我的门店数量
|
|
},
|
|
// 获取招商中心我的门店数量
|
|
getStoreNumber() {
|
|
let json = {};
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.store.list.getStoreCount');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: json,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
if (resdata.result === 1) {
|
|
this.setData({
|
|
store_number: resdata.data.store_count
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
gotoStoreList(e) {
|
|
let num = e.currentTarget.dataset.num;
|
|
wx.navigateTo({
|
|
url: '/packageB/member/enterprise/enterprise_store/enterprise_store?type=' + num
|
|
});
|
|
},
|
|
// 获取招商中心信息
|
|
getEnterpriseCenterInfo_1() {
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.merchant-center');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
if (resdata.result === 1) {
|
|
this.setData({
|
|
enterpriseCenterInfo_1: resdata.data
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
|
|
// 获取招商中心统计信息
|
|
getEnterpriseCenterInfo_2() {
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.merchant.get-merchant-statistic');
|
|
urlStr += '&merchant_type=1';
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
if (resdata.result === 1) {
|
|
// 清空数据源
|
|
this.setData({
|
|
enterpriseCenterRatioDatas: []
|
|
});
|
|
// 组装数据
|
|
let arr = [];
|
|
let itemDay = {};
|
|
itemDay.money = resdata.data.today;
|
|
itemDay.data = '今日';
|
|
itemDay.name = 'data';
|
|
arr.push(itemDay);
|
|
let itemYesterday = {};
|
|
itemYesterday.money = resdata.data.yesterday;
|
|
itemYesterday.data = '昨日';
|
|
itemYesterday.name = 'data';
|
|
arr.push(itemYesterday);
|
|
let itemWeek = {};
|
|
itemWeek.money = resdata.data.this_week;
|
|
itemWeek.data = '本周';
|
|
itemWeek.name = 'data';
|
|
arr.push(itemWeek);
|
|
let itemMonth = {};
|
|
itemMonth.money = resdata.data.this_month;
|
|
itemMonth.data = '本月累计'+this.data.merchant_reward;
|
|
itemMonth.name = 'mounth';
|
|
arr.push(itemMonth);
|
|
this.setData({
|
|
enterpriseCenterRatioDatas: arr
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
|
|
// 获取招商中心 供应商人数
|
|
getEnterpriseCenterInfo_3() {
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.merchant-center-supplier');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
if (resdata.result === 1) {
|
|
this.setData({
|
|
enterpriseCenterSupplier: resdata.data.total
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
|
|
// 获取招商中心结算信息
|
|
getEnterpriseCenterInfo_4(status, pages) {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.merchant.get-merchant-list');
|
|
urlStr += '&merchant_type=1' + '&status=' + status + '&page=' + pages;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
this.setData({
|
|
isLoadMore: true
|
|
});
|
|
if (resdata.result === 1) {
|
|
if (pages == 1) {
|
|
if (this.data.currentEnterpriseCenterTabIndex == '0') {
|
|
this.setData({
|
|
enterprise_center_first_content: resdata.data.data,
|
|
total_page4: resdata.data.last_page
|
|
});
|
|
if (!that.data.total_page4) {
|
|
this.setData({
|
|
total_page4: 0
|
|
});
|
|
}
|
|
} else if (this.data.currentEnterpriseCenterTabIndex == '1') {
|
|
this.setData({
|
|
enterprise_center_second_content: resdata.data.data,
|
|
total_page5: resdata.data.last_page
|
|
});
|
|
if (!that.data.total_page5) {
|
|
this.setData({
|
|
total_page5: 0
|
|
});
|
|
}
|
|
} else if (this.data.currentEnterpriseCenterTabIndex == '2') {
|
|
this.setData({
|
|
enterprise_center_third_content: resdata.data.data,
|
|
total_page6: resdata.data.last_page
|
|
});
|
|
if (!that.data.total_page6) {
|
|
this.setData({
|
|
total_page6: 0
|
|
});
|
|
}
|
|
}
|
|
} else {
|
|
var nextPageData = resdata.data.data;
|
|
if (this.data.currentEnterpriseCenterTabIndex == '0') {
|
|
let enterprise_center_first_content = [...that.data.enterprise_center_first_content, ...nextPageData];
|
|
that.setData({
|
|
enterprise_center_first_content,
|
|
total_page4: resdata.data.last_page
|
|
});
|
|
} else if (this.data.currentEnterpriseCenterTabIndex == '1') {
|
|
let enterprise_center_second_content = [...that.data.enterprise_center_second_content, ...nextPageData];
|
|
that.setData({
|
|
enterprise_center_second_content,
|
|
total_page5: resdata.data.last_page
|
|
});
|
|
} else if (this.data.currentEnterpriseCenterTabIndex == '2') {
|
|
let enterprise_center_third_content = [...that.data.enterprise_center_third_content, ...nextPageData];
|
|
that.setData({
|
|
enterprise_center_third_content,
|
|
total_page6: resdata.data.last_page
|
|
});
|
|
}
|
|
}
|
|
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
|
|
// 招商中心切换标签
|
|
enterpriseCenterHandleClick(tab) {
|
|
if (this.data.currentEnterpriseCenterTabIndex == tab.detail.index) {
|
|
return;
|
|
} else {
|
|
this.data.currentEnterpriseCenterTabIndex = tab.detail.index;
|
|
this.setWatchMore2(tab.detail.index);
|
|
}
|
|
this.setEnterpriseCenterDataByTabIndex();
|
|
},
|
|
|
|
// 设置选择后的数据 招商中心
|
|
setEnterpriseCenterDataByTabIndex() {
|
|
if (this.data.currentEnterpriseCenterTabIndex == '0' && !this.data.is_enterprise_center_first_content) {
|
|
this.data.is_enterprise_center_first_content = true;
|
|
this.getEnterpriseCenterInfo_4('', 1);
|
|
} else if (this.data.currentEnterpriseCenterTabIndex == '1' && !this.data.is_enterprise_center_second_content) {
|
|
this.data.is_enterprise_center_second_content = true;
|
|
this.getEnterpriseCenterInfo_4('1', 1);
|
|
} else if (this.data.currentEnterpriseCenterTabIndex == '2' && !this.data.is_enterprise_center_third_content) {
|
|
this.data.is_enterprise_center_third_content = true;
|
|
this.getEnterpriseCenterInfo_4('0', 1);
|
|
}
|
|
},
|
|
|
|
// ---------招商中心---------//
|
|
// ---------招商员---------//
|
|
|
|
// 获取招商员全部信息
|
|
getEnterpriseData() {
|
|
this.getEnterpriseInfo_1(); // 获取招商员信息
|
|
this.getEnterpriseInfo_2(); // 获取招商员统计信息
|
|
this.getEnterpriseInfo_3(); // 获取招商员 供应商人数
|
|
this.setEnterpriseDataByTabIndex(); // 获取招商员分红信息
|
|
this.getEnterpriseStoreNumber(); // 获取招商员我的门店数量
|
|
},
|
|
// 获取招商员我的门店数量
|
|
getEnterpriseStoreNumber() {
|
|
let json = {};
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.store.list.getStoreCountByStaff');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: json,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
if (resdata.result === 1) {
|
|
this.setData({
|
|
enterprise_store_number: resdata.data.store_count
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
// 获取招商员信息
|
|
getEnterpriseInfo_1() {
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.merchant-staff');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
if (resdata.result === 1) {
|
|
this.setData({
|
|
enterpriseInfo_1: resdata.data,
|
|
erchants_name: resdata.data.realname,
|
|
erchants_ratio: resdata.data.bonus_ratio,
|
|
enterprise_level_title: resdata.data.has_one_staff_level ? resdata.data.has_one_staff_level.level_name : '',
|
|
enterprise_level_li: resdata.data.has_one_staff_level ? resdata.data.has_one_staff_level.bonus_ratio : ''
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
|
|
// 获取招商员统计信息
|
|
getEnterpriseInfo_2() {
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.merchant.get-merchant-statistic');
|
|
urlStr += '&merchant_type=0';
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
if (resdata.result === 1) {
|
|
this.setData({
|
|
enterpriseRatioDatas: []
|
|
});
|
|
// 组装数据
|
|
let arr = [];
|
|
let itemDay = {};
|
|
itemDay.money = resdata.data.today;
|
|
itemDay.data = '今日';
|
|
itemDay.name = 'data';
|
|
arr.push(itemDay);
|
|
let itemYesterday = {};
|
|
itemYesterday.money = resdata.data.yesterday;
|
|
itemYesterday.data = '昨日';
|
|
itemYesterday.name = 'data';
|
|
arr.push(itemYesterday);
|
|
let itemWeek = {};
|
|
itemWeek.money = resdata.data.this_week;
|
|
itemWeek.data = '本周';
|
|
itemWeek.name = 'data';
|
|
arr.push(itemWeek);
|
|
let itemMonth = {};
|
|
itemMonth.money = resdata.data.this_month;
|
|
itemMonth.data = '本月累计'+this.data.merchant_reward;
|
|
itemMonth.name = 'mounth';
|
|
arr.push(itemMonth);
|
|
this.setData({
|
|
enterpriseRatioDatas: arr
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
|
|
// 获取招商员 供应商人数
|
|
getEnterpriseInfo_3() {
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.merchant-staff-supplier');
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
if (resdata.result === 1) {
|
|
this.setData({
|
|
enterpriseSupplier: resdata.data.total
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
|
|
// 获取招商员结算信息
|
|
getEnterpriseInfo_4(status, pages) {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss('plugin.merchant.frontend.merchant.get-merchant-list');
|
|
urlStr += '&merchant_type=0' + '&status=' + status + '&page=' + pages;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: (res) => {
|
|
let resdata = res.data;
|
|
this.setData({
|
|
isLoadMore: true
|
|
});
|
|
if (resdata.result === 1) {
|
|
if (pages == 1) {
|
|
if (this.data.currentEnterpriseTabIndex == '0') {
|
|
this.setData({
|
|
enterprise_first_content: resdata.data.data,
|
|
total_page: resdata.data.last_page
|
|
});
|
|
if (!that.data.total_page) {
|
|
this.setData({
|
|
total_page: 0
|
|
});
|
|
}
|
|
} else if (this.data.currentEnterpriseTabIndex == '1') {
|
|
this.setData({
|
|
enterprise_second_content: resdata.data.data,
|
|
total_page2: resdata.data.last_page
|
|
});
|
|
if (!that.data.total_page2) {
|
|
this.setData({
|
|
total_page2: 0
|
|
});
|
|
}
|
|
} else if (this.data.currentEnterpriseTabIndex == '2') {
|
|
this.setData({
|
|
enterprise_third_content: resdata.data.data,
|
|
total_page3: resdata.data.last_page
|
|
});
|
|
if (!that.data.total_page3) {
|
|
this.setData({
|
|
total_page3: 0
|
|
});
|
|
}
|
|
}
|
|
} else {
|
|
var nextPageData = resdata.data.data;
|
|
if (this.data.currentEnterpriseTabIndex == '0') {
|
|
let enterprise_first_content = [...that.data.enterprise_first_content, ...nextPageData];
|
|
that.setData({
|
|
enterprise_first_content,
|
|
total_page: resdata.data.last_page
|
|
});
|
|
} else if (this.data.currentEnterpriseTabIndex == '1') {
|
|
let enterprise_second_content = [...that.data.enterprise_second_content, ...nextPageData];
|
|
that.setData({
|
|
enterprise_second_content,
|
|
total_page2: resdata.data.last_page
|
|
});
|
|
} else if (this.data.currentEnterpriseTabIndex == '2') {
|
|
let enterprise_third_content = [...that.data.enterprise_third_content, ...nextPageData];
|
|
that.setData({
|
|
enterprise_third_content,
|
|
total_page3: resdata.data.last_page
|
|
});
|
|
}
|
|
}
|
|
} else {
|
|
wx.showToast({
|
|
title: resdata.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
|
|
setWatchMore(tab) {
|
|
switch (tab) {
|
|
case 0:
|
|
if (this.data.page >= this.data.total_page) {
|
|
return;
|
|
} else {
|
|
this.setData({
|
|
isLoadMore: true
|
|
});
|
|
}
|
|
break;
|
|
case 1:
|
|
if (this.data.page2 >= this.data.total_page2) {
|
|
return;
|
|
} else {
|
|
this.setData({
|
|
isLoadMore: true
|
|
});
|
|
}
|
|
break;
|
|
case 2:
|
|
if (this.data.page3 >= this.data.total_page3) {
|
|
return;
|
|
} else {
|
|
this.setData({
|
|
isLoadMore: true
|
|
});
|
|
}
|
|
break;
|
|
default:
|
|
console.log("error:: 找不到匹配项");
|
|
break;
|
|
}
|
|
},
|
|
setWatchMore2(tab) {
|
|
switch (tab) {
|
|
case 0:
|
|
if (this.data.page4 >= this.data.total_page4) {
|
|
return;
|
|
} else {
|
|
this.setData({
|
|
isLoadMore: true
|
|
});
|
|
}
|
|
break;
|
|
case 1:
|
|
if (this.data.page5 >= this.data.total_page5) {
|
|
return;
|
|
} else {
|
|
this.setData({
|
|
isLoadMore: true
|
|
});
|
|
}
|
|
break;
|
|
case 2:
|
|
if (this.data.page6 >= this.data.total_page6) {
|
|
return;
|
|
} else {
|
|
this.setData({
|
|
isLoadMore: true
|
|
});
|
|
}
|
|
break;
|
|
default:
|
|
console.log("error:: 找不到匹配项");
|
|
break;
|
|
}
|
|
},
|
|
|
|
// 招商员切换标签
|
|
enterpriseHandleClick(tab) {
|
|
if (this.data.currentEnterpriseTabIndex == tab.detail.index) {
|
|
return;
|
|
} else {
|
|
this.data.currentEnterpriseTabIndex = tab.detail.index;
|
|
this.setWatchMore(tab.detail.index);
|
|
}
|
|
this.setEnterpriseDataByTabIndex();
|
|
},
|
|
|
|
// 设置选择后的数据 招商员
|
|
setEnterpriseDataByTabIndex() {
|
|
if (this.data.currentEnterpriseTabIndex == '0' && !this.data.is_enterprise_first_content) {
|
|
this.data.is_enterprise_first_content = true;
|
|
this.getEnterpriseInfo_4('', 1);
|
|
} else if (this.data.currentEnterpriseTabIndex == '1' && !this.data.is_enterprise_second_content) {
|
|
this.data.is_enterprise_second_content = true;
|
|
this.getEnterpriseInfo_4('1', 1);
|
|
} else if (this.data.currentEnterpriseTabIndex == '2' && !this.data.is_enterprise_third_content) {
|
|
this.data.is_enterprise_third_content = true;
|
|
this.getEnterpriseInfo_4('0', 1);
|
|
}
|
|
},
|
|
// 跳转到我的供应商
|
|
goTosupper(e) {
|
|
var num = e.currentTarget.dataset.num;
|
|
wx.navigateTo({
|
|
url: '/packageB/member/enterprise/enterprise_center_supplier/enterprise_center_supplier?type='+num
|
|
});
|
|
},
|
|
// ---------招商员---------//
|
|
getMoreData() {
|
|
let that = this;
|
|
this.setData({
|
|
isLoadMore: false
|
|
});
|
|
if (this.data.currentBaseTabIndex == "0") {
|
|
switch (this.data.currentEnterpriseTabIndex) {
|
|
case "0":
|
|
if (that.data.page >= that.data.total_page) {
|
|
return;
|
|
} else {
|
|
let pages = this.data.page;
|
|
pages += 1;
|
|
this.setData({
|
|
page: pages
|
|
});
|
|
that.getEnterpriseInfo_4("", that.data.page);
|
|
}
|
|
break;
|
|
case "1":
|
|
if (that.data.page2 >= that.data.total_page2) {
|
|
return;
|
|
} else {
|
|
let pages = this.data.page2;
|
|
pages += 1;
|
|
this.setData({
|
|
page2: pages
|
|
});
|
|
that.getEnterpriseInfo_4("1", that.data.page2);
|
|
}
|
|
break;
|
|
case "2":
|
|
if (that.data.page3 >= that.data.total_page3) {
|
|
return;
|
|
} else {
|
|
let pages = this.data.page3;
|
|
pages += 1;
|
|
this.setData({
|
|
page3: pages
|
|
});
|
|
that.getEnterpriseInfo_4("0", that.data.page3);
|
|
}
|
|
break;
|
|
default:
|
|
console.log("error:: 找不到匹配项");
|
|
break;
|
|
}
|
|
} else if (this.data.currentBaseTabIndex == "1") {
|
|
switch (this.data.currentEnterpriseCenterTabIndex) {
|
|
case "0":
|
|
if (that.data.page4 >= that.data.total_page4) {
|
|
return;
|
|
} else {
|
|
let pages = this.data.page4;
|
|
pages += 1;
|
|
this.setData({
|
|
page4: pages
|
|
});
|
|
that.getEnterpriseCenterInfo_4("", that.data.page4);
|
|
}
|
|
break;
|
|
case "1":
|
|
if (that.data.page5 >= that.data.total_page5) {
|
|
return;
|
|
} else {
|
|
let pages = this.data.page5;
|
|
pages += 1;
|
|
this.setData({
|
|
page5: pages
|
|
});
|
|
that.getEnterpriseCenterInfo_4("1", that.data.page5);
|
|
}
|
|
break;
|
|
case "2":
|
|
if (that.data.page6 >= that.data.total_page6) {
|
|
return;
|
|
} else {
|
|
let pages = this.data.page6;
|
|
pages += 1;
|
|
this.setData({
|
|
page6: pages
|
|
});
|
|
that.getEnterpriseCenterInfo_4("0", that.data.page6);
|
|
}
|
|
break;
|
|
default:
|
|
console.log("error:: 找不到匹配项");
|
|
break;
|
|
}
|
|
}
|
|
|
|
},
|
|
initLang(){
|
|
var value = wx.getStorageSync('mailLanguage');
|
|
if (value) {
|
|
let mailLanguage = JSON.parse(value);
|
|
// Do something with return value
|
|
this.setData({
|
|
merchant_center : mailLanguage.merchant.merchant_center || "招商中心",
|
|
merchant_people : mailLanguage.merchant.merchant_people || "招商员",
|
|
merchant_reward : mailLanguage.merchant.merchant_reward || "分红",
|
|
merchant_title : mailLanguage.merchant.title || "招商",
|
|
});
|
|
wx.setNavigationBarTitle({
|
|
title: this.data.merchant_title,
|
|
});
|
|
}
|
|
|
|
},
|
|
});
|