|
@@ -18,14 +18,18 @@
|
|
|
<!-- 收益模块-->
|
|
|
<div class="profit_container text-center">
|
|
|
<view>
|
|
|
- <text class="text-normal margin-xl"><template v-if="filter_date">{{filter_date}}</template><template v-else>{{ filter_list[filter_action - 1].name }}</template>累计收益</text>
|
|
|
+ <text class="text-normal margin-xl">
|
|
|
+ <template v-if="filter_date">{{ filter_date }}</template>
|
|
|
+ <template v-else>{{ filter_list[filter_action - 1].name }}</template>
|
|
|
+ 累计收益
|
|
|
+ </text>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <text class="text-bold text-sl text-price">{{ userinfo.profit }}</text>
|
|
|
+ <text class="text-bold text-sl text-price">{{ total.balance_freeze }}</text>
|
|
|
</view>
|
|
|
<view>
|
|
|
<text class="text-normal ">含待结算
|
|
|
- <text class="text-price">{{ userinfo.unsettle_account }}</text>
|
|
|
+ <text class="text-price">{{ total.balance }}</text>
|
|
|
元
|
|
|
</text>
|
|
|
</view>
|
|
@@ -39,24 +43,24 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 列表-->
|
|
|
- <view class="solid-bottom padding-lr-sm" v-for="item in 3" :key="item">
|
|
|
+ <view class="solid-bottom padding-lr-sm" v-for="(item,index) in balance_list" :key="index">
|
|
|
<van-card>
|
|
|
<view slot="thumb" class="cu-avatar lg round margin-left"
|
|
|
style="background-image:url(https://img.shuimuai.com/web/icon_dingdan.png);"></view>
|
|
|
<view slot="title" class="flex justify-between">
|
|
|
<view>
|
|
|
<text class="text-normal">产品 </text>
|
|
|
- <text>次卡</text>
|
|
|
+ <text>{{ item.goods_name }}</text>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <text class="text-gray text-sm">2018/09/24 10:44</text>
|
|
|
+ <text class="text-gray text-sm">{{ item.create_time }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
<view slot="num" class="flex justify-end">
|
|
|
<view>
|
|
|
<text class="text-normal text-sm margin-right-lg">收益</text>
|
|
|
- <text class="text-xxl">+39.00</text>
|
|
|
+ <text class="text-xxl">+{{ item.rebater }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</van-card>
|
|
@@ -75,6 +79,9 @@
|
|
|
|
|
|
<script>
|
|
|
|
|
|
+import {agentIncomeDetail, agentIncomeList} from "../../../requests/agent";
|
|
|
+import util from '@/utils/index'
|
|
|
+
|
|
|
var $this
|
|
|
export default {
|
|
|
name: "agent_income_container",
|
|
@@ -88,30 +95,37 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
|
- name: "今日"
|
|
|
+ name: "今日",
|
|
|
+ start_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime()).getTime() / 1000),
|
|
|
+ end_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1).getTime() / 1000)
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
|
- name: "昨日"
|
|
|
+ name: "昨日",
|
|
|
+ start_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() - 24 * 60 * 60 * 1000).getTime() / 1000),
|
|
|
+ end_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() - 1000).getTime() / 1000)
|
|
|
},
|
|
|
{
|
|
|
id: 4,
|
|
|
- name: "近七日"
|
|
|
+ name: "近七日",
|
|
|
+ start_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() - 7 * 24 * 60 * 60 * 1000).getTime() / 1000),
|
|
|
+ end_time: Math.round(new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1).getTime() / 1000)
|
|
|
}
|
|
|
],
|
|
|
filter_action: 1,
|
|
|
- userinfo: {
|
|
|
+ total: {
|
|
|
//累计收益
|
|
|
- profit: 16824.50,
|
|
|
+ balance_freeze: 16824.50,
|
|
|
//含待结算
|
|
|
- unsettle_account: 65.00,
|
|
|
+ balance: 65.00,
|
|
|
},
|
|
|
+ balance_list: [],
|
|
|
calendar_show: false,
|
|
|
start_time: "",
|
|
|
end_time: "",
|
|
|
filter_date: "",
|
|
|
//最小日期应该为用户使用的第一个月开始
|
|
|
- min_date:false,
|
|
|
+ min_date: false,
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -119,6 +133,11 @@ export default {
|
|
|
change_filter($id) {
|
|
|
$this.filter_date = ""
|
|
|
$this.filter_action = $id
|
|
|
+ $this.filter_date.forEach(($val, $index) => {
|
|
|
+ if ($val['id'] == $id) {
|
|
|
+ $this.get_income_list($val['start_time'], $val['end_time'])
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 自定义筛选时间
|
|
|
show_datetime_picker() {
|
|
@@ -139,11 +158,32 @@ export default {
|
|
|
$this.filter_date = $this.formatDate(start) + '-' + $this.formatDate(end)
|
|
|
$this.start_time = Math.round(new Date(start).getTime() / 1000)
|
|
|
$this.end_time = Math.round(new Date(end).getTime() / 1000)
|
|
|
+ $this.get_income_list($this.start_time, $this.end_time)
|
|
|
$this.calendar_show = false
|
|
|
+ },
|
|
|
+ // 收益列表
|
|
|
+ get_income_list($start_time, $end_time) {
|
|
|
+ let $params = {}
|
|
|
+ if ($start_time && $end_time) {
|
|
|
+ $params['start_time'] = $start_time
|
|
|
+ $params['end_time'] = $end_time
|
|
|
+ }
|
|
|
+ agentIncomeList($params).then((res) => {
|
|
|
+ let $data = res.data
|
|
|
+ let $result = $data.data;
|
|
|
+ $this.total = $result.total;
|
|
|
+ let $incomes = $result.list;
|
|
|
+ $incomes.forEach(($val, $index) => {
|
|
|
+ $incomes[$index]['create_time'] = util.formatTime($val['create_time'])
|
|
|
+ })
|
|
|
+ $this.balance_list = $incomes
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- $this.min_date = new Date(2020,1,1).getTime()
|
|
|
+ $this.min_date = new Date(2020, 1, 1).getTime()
|
|
|
+ //一开始查询全部
|
|
|
+ $this.get_income_list(false, false)
|
|
|
},
|
|
|
created() {
|
|
|
$this = this
|