分销统计优化
parent
bea59d35d8
commit
2f4842a41e
|
|
@ -484,13 +484,6 @@
|
|||
"navigationBarTitleText": "推广返利"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "statistics/statistics",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "数据统计"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "extraction/extraction",
|
||||
"style": {
|
||||
|
|
|
|||
|
|
@ -529,13 +529,20 @@
|
|||
var goods = this.popup_search_goods_list[value.out_value];
|
||||
var temp_data = this.recommend_data;
|
||||
var spec_str = JSON.stringify(value.spec);
|
||||
// 数据判断处理
|
||||
var status = true;
|
||||
for(var i in temp_data.detail_list) {
|
||||
if(temp_data.detail_list[i]['goods_id'] == goods['id'] && temp_data.detail_list[i]['spec'] == spec_str) {
|
||||
status = false;
|
||||
break;
|
||||
if((temp_data.detail_list || null) == null) {
|
||||
temp_data.detail_list = [];
|
||||
}
|
||||
if(temp_data.detail_list.length > 0) {
|
||||
for(var i in temp_data.detail_list) {
|
||||
if(temp_data.detail_list[i]['goods_id'] == goods['id'] && temp_data.detail_list[i]['spec'] == spec_str) {
|
||||
status = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 追加到关联商品中
|
||||
if(status) {
|
||||
temp_data.detail_list.push({
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
.container .item {
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.container .title {
|
||||
border-style: solid;
|
||||
border-width: 0 0 0 3px;
|
||||
}
|
||||
|
|
@ -1,170 +0,0 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="padding-main">
|
||||
<!-- 推广客户 -->
|
||||
<view class="container padding-main border-radius-main bg-white">
|
||||
<view class="title border-color-main padding-left-lg text-size fw-b">推广客户</view>
|
||||
<view class="margin-top-lg oh tc">
|
||||
<block v-for="(item, index) in stats_user_data_list" :key="index">
|
||||
<view class="item fl padding-main">
|
||||
<view class="cr-base">{{item.name}}</view>
|
||||
<view class="single-text margin-top-sm">
|
||||
<text class="text-size">{{item.value}}</text>
|
||||
<text class="cr-gray margin-left-sm">人</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 返利概况 -->
|
||||
<view class="container padding-main border-radius-main bg-white spacing-mt">
|
||||
<view class="title border-color-main padding-left-lg text-size fw-b">返利概况</view>
|
||||
<view class="margin-top-lg oh tc">
|
||||
<block v-for="(item, index) in stats_profit_data_list" :key="index">
|
||||
<view class="item fl padding-main">
|
||||
<view class="cr-base">{{item.name}}</view>
|
||||
<view class="single-text margin-top-sm">
|
||||
<text :class="'fw-b text-size '+item.ent">{{currency_symbol}}{{item.value}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '加载中...',
|
||||
data_bottom_line_status: true,
|
||||
stats_user_data_list: [
|
||||
{name: "已推广用户总数", value: 0},
|
||||
{name: "已消费用户总数", value: 0}
|
||||
],
|
||||
stats_profit_data_list: [
|
||||
{name: "返佣总额", value: '0.00', ent: "cr-base"},
|
||||
{name: "待生效", value: '0.00', ent: "cr-yellow"},
|
||||
{name: "待结算", value: '0.00', ent: "cr-blue"},
|
||||
{name: "已结算", value: '0.00', ent: "cr-green"}
|
||||
],
|
||||
user_data: null,
|
||||
profit_data: null,
|
||||
// 基础配置
|
||||
currency_symbol: app.globalData.data.currency_symbol
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentBottomLine
|
||||
},
|
||||
props: {},
|
||||
|
||||
onShow() {
|
||||
// 数据加载
|
||||
this.init();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化配置
|
||||
init_config(status) {
|
||||
if ((status || false) == true) {
|
||||
this.setData({
|
||||
currency_symbol: app.globalData.get_config('currency_symbol')
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
init() {
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
});
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("index", "statistics", "distribution"),
|
||||
method: 'POST',
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
|
||||
// 用户统计
|
||||
var temp_stats_user = this.stats_user_data_list;
|
||||
temp_stats_user[0]['value'] = data.user_total.user_count || 0;
|
||||
temp_stats_user[1]['value'] = data.user_total.valid_user_count || 0;
|
||||
|
||||
// 收益统计
|
||||
var temp_stats_profit = this.stats_profit_data_list;
|
||||
temp_stats_profit[0]['value'] = data.user_profit_total_price || '0.00';
|
||||
temp_stats_profit[1]['value'] = data.user_profit_stay_price || '0.00';
|
||||
temp_stats_profit[2]['value'] = data.user_profit_vaild_price || '0.00';
|
||||
temp_stats_profit[3]['value'] = data.user_profit_already_price || '0.00';
|
||||
|
||||
// 数据设置
|
||||
this.setData({
|
||||
stats_user_data_list: temp_stats_user,
|
||||
stats_profit_data_list: temp_stats_profit,
|
||||
user_data: data.user_chart || null,
|
||||
profit_data: data.profit_chart || null,
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_msg: ''
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'init')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: '服务器请求出错'
|
||||
});
|
||||
app.globalData.showToast('服务器请求出错');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './statistics.css';
|
||||
</style>
|
||||
|
|
@ -41,6 +41,33 @@
|
|||
.superior .superior-content image {
|
||||
width: 40rpx !important;
|
||||
height: 40rpx !important;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计数据
|
||||
*/
|
||||
.stats-container .item {
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.stats-container-3 .item {
|
||||
width: 33.33%;
|
||||
}
|
||||
.stats-container-4 .item {
|
||||
width: 25%;
|
||||
}
|
||||
.stats-container .title {
|
||||
border-style: solid;
|
||||
border-width: 0 0 0 3px;
|
||||
}
|
||||
.stats-container .stats-switch-submit {
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
line-height: 44rpx;
|
||||
padding: 0 40rpx 0 20rpx;
|
||||
}
|
||||
.popup-time-container .quit-time .item {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 上级用户 -->
|
||||
<view v-if="(superior || null) != null" class="superior bg-white border-radius-main margin-horizontal-main margin-bottom-main oh">
|
||||
<view class="superior-title cr-white fw-b va-m fl">上级用户</view>
|
||||
|
|
@ -38,6 +38,53 @@
|
|||
<view class="notice-content">
|
||||
<view v-for="(item, index) in data_base.user_center_notice" :key="index" class="item">{{item}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 数据统计 -->
|
||||
<view v-if="stats_user_promotion_data_list.length > 0 || stats_base_data_list.length > 0 || stats_profit_data_list.length > 0" class="padding-horizontal-main oh">
|
||||
<view class="stats-container padding-main border-radius-main bg-white pr spacing-mb">
|
||||
<view class="title border-color-main padding-left-lg text-size fw-b">基础统计</view>
|
||||
<button type="default" size="mini" class="br-gray cr-gray bg-white round arrow-bottom pa stats-switch-submit" @tap="popup_time_event">{{popup_time_value.name}}</button>
|
||||
<!-- 推广统计 -->
|
||||
<view v-if="stats_user_promotion_data_list.length > 0" class="stats-container-3 margin-top-lg oh tc">
|
||||
<block v-for="(item, index) in stats_user_promotion_data_list" :key="index">
|
||||
<view class="item fl padding-main">
|
||||
<view class="cr-base">{{item.name}}</view>
|
||||
<view class="single-text margin-top-sm">
|
||||
<text :class="'fw-b text-size '+item.ent">{{item.value}}</text>
|
||||
<text v-if="(item.unit || null) != null" class="cr-grey text-size-xs margin-left-sm">人</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 基础统计 -->
|
||||
<view v-if="stats_base_data_list.length > 0" class="margin-top padding-top oh tc br-t-dashed">
|
||||
<block v-for="(item, index) in stats_base_data_list" :key="index">
|
||||
<view class="item fl padding-main">
|
||||
<view class="cr-base">{{item.name}}</view>
|
||||
<view class="single-text margin-top-sm">
|
||||
<text :class="'fw-b text-size '+item.ent">{{((item.first || null) == null) ? '' : item.first}}{{item.value}}</text>
|
||||
<text v-if="(item.unit || null) != null" class="cr-grey text-size-xs margin-left-sm">人</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 返佣统计 -->
|
||||
<view v-if="stats_profit_data_list.length > 0" class="stats-container padding-main border-radius-main bg-white pr spacing-mb">
|
||||
<view class="title border-color-main padding-left-lg text-size fw-b">返佣统计</view>
|
||||
<view class="margin-top-lg oh tc">
|
||||
<block v-for="(item, index) in stats_profit_data_list" :key="index">
|
||||
<view class="item fl padding-main">
|
||||
<view class="cr-base">{{item.name}}</view>
|
||||
<view class="single-text margin-top-sm">
|
||||
<text :class="'fw-b text-size '+item.ent">{{currency_symbol}}{{item.value}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 导航 -->
|
||||
|
|
@ -63,7 +110,45 @@
|
|||
<view v-if="(profit_ladder || null) != null" class="padding-horizontal-main padding-bottom-main">
|
||||
<text class="cr-blue">{{profit_ladder.msg}}</text>
|
||||
<navigator url="/pages/plugins/distribution/poster/poster" hover-class="none" class="bg-green cr-white dis-inline-block round padding-top-xs padding-bottom-xs padding-horizontal-main">去推广</navigator>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 时间选择弹窗 -->
|
||||
<component-popup :propShow="popup_time_status" propPosition="bottom" @onclose="popup_time_close_event">
|
||||
<view class="padding-horizontal-main padding-top-main bg-white">
|
||||
<view class="close oh">
|
||||
<view class="fr" @tap.stop="popup_time_close_event">
|
||||
<icon type="clear" size="46rpx"></icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="popup-time-container page-bottom-fixed">
|
||||
<form @submit="form_submit" class="form-container">
|
||||
<view v-if="(time_data || null) != null" class="quit-time oh">
|
||||
<block v-for="(item, index) in time_data" :key="index">
|
||||
<view class="item fl padding-main bs-bb">
|
||||
<view class="br-gray cr-gray text-size-xs round padding-top-xs padding-bottom-xs padding-horizontal-main tc" :data-index="index" @tap="quit_time_event">{{item.name}}</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">开始时间</view>
|
||||
<view class="br-b">
|
||||
<uni-datetime-picker @change="time_start_change_event" v-model="popup_time_value.start" :border="false" :showFirstIcon="false" :hide-second="true" type="datetime" placeholder="开始时间" placeholder-class="cr-grey" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-gorup bg-white">
|
||||
<view class="form-gorup-title">结束时间</view>
|
||||
<view class="br-b">
|
||||
<uni-datetime-picker @change="time_end_change_event" v-model="popup_time_value.end" :border="false" :showFirstIcon="false" :hide-second="true" type="datetime" placeholder="结束时间" placeholder-class="cr-grey" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-fixed padding-main">
|
||||
<button class="bg-main br-main cr-white round text-size" type="default" form-type="submit" hover-class="none" :disabled="form_submit_disabled_status">查询</button>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
</view>
|
||||
</component-popup>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
|
|
@ -73,27 +158,40 @@
|
|||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from "../../../../components/no-data/no-data";
|
||||
|
||||
import componentNoData from "../../../../components/no-data/no-data";
|
||||
import componentPopup from "../../../../components/popup/popup";
|
||||
var currency_symbol = app.globalData.currency_symbol();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_msg: '',
|
||||
currency_symbol: currency_symbol,
|
||||
avatar: app.globalData.data.default_user_head_src,
|
||||
nickname: '用户名',
|
||||
data_base: null,
|
||||
user_level: null,
|
||||
extraction: null,
|
||||
superior: null,
|
||||
profit_ladder: null,
|
||||
nav_list: [],
|
||||
avatar: app.globalData.data.default_user_head_src,
|
||||
nickname: "用户名"
|
||||
nav_list: [],
|
||||
time_data: null,
|
||||
base_data: null,
|
||||
user_promotion_data: null,
|
||||
profit_data: null,
|
||||
stats_user_promotion_data_list: [],
|
||||
stats_base_data_list: [],
|
||||
stats_profit_data_list: [],
|
||||
popup_time_status: false,
|
||||
form_submit_disabled_status: false,
|
||||
popup_time_value: {name: '自定义', start: '', end: '', index: ''},
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData
|
||||
componentNoData,
|
||||
componentPopup
|
||||
},
|
||||
props: {},
|
||||
|
||||
|
|
@ -159,14 +257,28 @@
|
|||
success: res => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var data = res.data.data;
|
||||
// 选择时间处理
|
||||
var time_data = data.time_data || null;
|
||||
var temp_value = this.popup_time_value;
|
||||
if(time_data != null) {
|
||||
var temp = time_data[data.default_day];
|
||||
temp_value.start = temp.start;
|
||||
temp_value.end = temp.end;
|
||||
temp_value.name = temp.name;
|
||||
}
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
user_level: data.user_level || null,
|
||||
extraction: data.extraction || null,
|
||||
superior: data.superior || null,
|
||||
profit_ladder: data.profit_ladder || null,
|
||||
nav_list: data.nav_list || [],
|
||||
nav_list: data.nav_list || [],
|
||||
time_data: time_data,
|
||||
stats_user_promotion_data_list: data.stats_user_promotion_data_list || [],
|
||||
stats_base_data_list: data.stats_base_data_list || [],
|
||||
stats_profit_data_list: data.stats_profit_data_list || [],
|
||||
popup_time_value: temp_value,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
|
|
@ -209,6 +321,100 @@
|
|||
this.setData({
|
||||
avatar: app.globalData.data.default_user_head_src
|
||||
});
|
||||
},
|
||||
|
||||
// 时间选择开启弹层
|
||||
popup_time_event(e) {
|
||||
this.setData({
|
||||
popup_time_status: true
|
||||
});
|
||||
},
|
||||
|
||||
// 时间选择关闭弹层
|
||||
popup_time_close_event(e) {
|
||||
this.setData({
|
||||
popup_time_status: false
|
||||
});
|
||||
},
|
||||
|
||||
// 时间快捷选择
|
||||
quit_time_event(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
var item = this.time_data[index];
|
||||
var temp_value = this.popup_time_value;
|
||||
temp_value.start = item.start;
|
||||
temp_value.end = item.end;
|
||||
temp_value.index = index;
|
||||
this.setData({
|
||||
popup_time_value: temp_value
|
||||
});
|
||||
},
|
||||
|
||||
// 自定义开始时间事件
|
||||
time_start_change_event(e) {
|
||||
var temp_value = this.popup_time_value;
|
||||
temp_value.start = e;
|
||||
temp_value.index = '';
|
||||
this.setData({
|
||||
popup_time_value: temp_value
|
||||
});
|
||||
},
|
||||
|
||||
// 自定义结束时间事件
|
||||
time_end_change_event(e) {
|
||||
var temp_value = this.popup_time_value;
|
||||
temp_value.end = e;
|
||||
temp_value.index = '';
|
||||
this.setData({
|
||||
popup_time_value: temp_value
|
||||
});
|
||||
},
|
||||
|
||||
// 数据提交
|
||||
form_submit(e) {
|
||||
this.setData({
|
||||
form_submit_disabled_status: true
|
||||
});
|
||||
uni.showLoading({
|
||||
title: '查询中...'
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("stats", "user", "distribution"),
|
||||
method: 'POST',
|
||||
data: this.popup_time_value,
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var temp_value = this.popup_time_value;
|
||||
temp_value.name = (temp_value.index || null) == null ? (((temp_value.start || null) == null && (temp_value.end || null) == null) ? '全部' : '自定义') : this.time_data[temp_value.index]['name'];
|
||||
this.setData({
|
||||
popup_time_status: false,
|
||||
form_submit_disabled_status: false,
|
||||
stats_user_promotion_data_list: data.stats_user_promotion_data_list || [],
|
||||
stats_base_data_list: data.stats_base_data_list || [],
|
||||
popup_time_value: temp_value,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
form_submit_disabled_status: false
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
form_submit_disabled_status: false
|
||||
});
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast('服务器请求出错');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue