123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- // lionfish_comshop/pages/groupCenter/index.js
- var app = getApp();
- var status = require('../../utils/index.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- waitSendNum: 0,
- waitSignNum: 0,
- waitPickNum: 0,
- completeNum: 0,
- disUserId: "",
- communityName: "",
- communityId: "",
- distribution: "",
- estimate: "",
- lastMonth: "",
- isShow: true,
- currentTab: 0,
- show_on_one:0,
- dialogShow: 0,
- effectValidOrderNum: 0,
- groupInfo: {
- group_name: '社区',
- owner_name: '团长'
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let that = this;
- status.setGroupInfo().then((groupInfo) => {
- let owner_name = groupInfo && groupInfo.owner_name || '团长';
- wx.setNavigationBarTitle({
- title: `${owner_name}中心`,
- })
- that.setData({ groupInfo })
- });
- this.loadPage();
- },
- loadPage: function () {
- let that = this;
- status.loadStatus().then(function () {
- let appLoadStatus = app.globalData.appLoadStatus;
- if (appLoadStatus == 0) {
- wx.redirectTo({
- url: "/lionfish_comshop/pages/auth/index"
- })
- } else if (appLoadStatus == 2) {
- // wx.redirectTo({
- // url: "/lionfish_comshop/pages/position/community"
- // })
- }
- that.setData({
- appLoadStatus: appLoadStatus,
- community: app.globalData.community
- })
- });
- this.load_community_data();
- },
- load_community_data:function(){
- var token = wx.getStorageSync('token');
- var that = this;
- app.util.request({
- 'url': 'entry/wxapp/user',
- 'data': {
- controller: 'community.get_community_info',
- 'token': token
- },
- dataType: 'json',
- success: function (res) {
- if (res.data.code == 0) {
- let communityData = res.data;
- that.setData({
- member_info: communityData.member_info,
- community_info: communityData.community_info,
- commission_info: communityData.commission_info,
- total_order_count: communityData.total_order_count || 0,
- total_member_count: communityData.total_member_count || 0,
- today_order_count: communityData.today_order_count || 0,
- today_effect_order_count: communityData.today_effect_order_count || 0,
- today_pay_order_count: communityData.today_pay_order_count || 0,
- today_pre_total_money: communityData.today_pre_total_money || 0,
- waitSendNum: communityData.wait_send_count || 0,
- waitSignNum: communityData.wait_qianshou_count || 0,
- waitPickNum: communityData.wait_tihuo_count || 0,
- completeNum: communityData.has_success_count || 0,
- open_community_addhexiaomember: communityData.open_community_addhexiaomember,
- open_community_head_leve: communityData.open_community_head_leve
- });
- } else {
- //is_login
- wx.reLaunch({
- url: '/lionfish_comshop/pages/user/me',
- })
- }
- }
- })
- },
- /**
- * 扫描
- */
- goScan: function(){
- wx.scanCode({
- success(res) {
- console.log(res)
- if (res.scanType == 'WX_CODE' && res.path != '')
- {
- //path: "lionfish_comshop/pages/groupCenter/pendingDeliveryOrders?scene=36"
- wx.navigateTo({
- url: "/" + res.path
- });
- }
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- var that = this;
- // wx.showLoading({
- // title: "加载中...",
- // mask: true
- // });
- console.log(app.globalData.userInfo)
- this.setData({
- avatarUrl: app.globalData.userInfo.avatarUrl
- });
- var show_on_one = this.data.show_on_one;
- if (show_on_one > 0)
- {
- this.load_community_data();
- }
- this.setData({
- show_on_one: 1
- })
- },
- /**
- * 获取数据
- */
- getData: function(){
- // todo
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 跳转订单
- */
- goOrder: function (e) {
- let status = e.currentTarget.dataset.status;
- wx.navigateTo({
- url: "/lionfish_comshop/pages/groupCenter/groupList?tab=" + status
- });
- },
- /**
- * 跳转编辑
- */
- goEdit: function () {
- wx.navigateTo({
- url: "/lionfish_comshop/pages/groupCenter/setting?id=" + this.data.community_info.id
- });
- },
- /**
- * 导航切换
- */
- switchNav: function (e) {
- if (this.data.currentTab === 1 * e.target.dataset.current) return false;
- this.setData({
- currentTab: 1 * e.target.dataset.current
- });
- },
- /**
- * 导航切换监控
- */
- bindChange: function (e) {
- this.setData({
- currentTab: 1 * e.detail.current
- });
- for (var i = 0; i < 4; i++) {
- if (this.data.currentTab === i) {
- this.setData({
- effectEstimate: this.data.effectList[i].estimate,
- effectSettle: this.data.effectList[i].settle,
- effectValidOrderNum: this.data.effectList[i].validOrderNum
- });
- }
- }
- },
- /**
- * 数据说明
- */
- showExplain: function (t) {
- var e = t.currentTarget.dataset.type;
- this.setData({
- dialogShow: e
- }), "1" === e && this.setData({
- explainContent: "佣金收入指已经结算并完成打款的佣金,您可在结算记录模块查看具体的结算明细。",
- explainTitle: "佣金收入说明"
- }), "2" === e && this.setData({
- explainContent: "预估佣金指当前即将产生的分销收益,包含待确定、已确定的分销佣金,您可在分销记录模块查看具体的分销明细。",
- explainTitle: "预估佣金说明"
- }), "3" === e && this.setData({
- explainContent: "有效订单数指您负责社区的用户发生实际购买的订单数量,不包含取消付款的订单。",
- explainTitle: "有效订单数说明"
- });
- },
- /**
- * 数据说明确认按钮
- */
- confirmMessage: function () {
- this.setData({
- dialogShow: null
- });
- },
- goLink: function(t){
- // var a = t.currentTarget.dataset.url;
- // wx.navigateTo({
- // url: a
- // });
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- }
- })
|