blocCon.vue
4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<template>
<div class="bloc-chart-container">
<div class="mid_line">
<img src="../../assets/scrm_bar_table_icon.png">
</div>
<div class="chart_wrapper">
<line-chart :width="width" ref="myline" echartId="myline" @changeDate="changeCurDate"></line-chart>
</div>
<div class="table-wrapper">
<div class="top_line flex_scb">
<span :style="[{ 'font-size': todayName.length > 20 ? '12px' : '' }]" class="h7_title">{{ todayName }},各门店明细</span>
<div class="right_wrap flex_scb">
<el-radio size="mini" v-model="orderByType" :label="1" @change="changeType(1)">
<span class="h15_title">按分账金额排序</span>
</el-radio>
<el-radio size="mini" v-model="orderByType" :label="2" @change="changeType(2)">
<span class="h15_title">按分润金额排序</span>
</el-radio>
</div>
</div>
<div class="table_widget">
<GLTable ref="table" :hasPage="false" max-height="270" :tableData="productValueInfo" :tableParams="tableParams"></GLTable>
</div>
</div>
<div v-if="!show" class="openBtn h18_title" @click="showContainer">
<span>展开详情</span>
<img src="../../assets/down_icon.png" />
</div>
</div>
</template>
<script>
import line from '../../components/service-echart/line.vue'
import { orderTotalOfJT } from '../../api/modules/rules'
import { converterApi } from '../../api/modules/converter'
import utils from '../../util/util'
export default {
name: '',
components: {
'line-chart': line
},
props: {
show: {
type: Boolean,
default: false
},
width:{
type:Number,
default:400
}
},
data() {
return {
radio: 0,
tableData: [],
tableParams: {
tableOption: false,
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '分润金额 / (实际)分账金额',
prop: 'money'
}
]
},
//集团
todayName: '',
orderByType: 1,
productValueInfo: [],
productList: []
}
},
mounted() {
this.todayName = utils.dateFormat(new Date(), 'YYYY年MM月DD日')
this.today = utils.dateFormat(new Date())
const { session } = this.$globalState
if (session.accountLevel != 4) {
this.orderDataInfoOfJT(this.today, this.today)
}
},
methods: {
showContainer() {
this.show = true
this.$emit('showRanking', true)
},
// 切换radio
changeType(type) {
this.orderByType = type
this.orderDataInfoOfJT(this.curStartTime, this.curEndTime)
},
// 集团统计
orderDataInfoOfJT(start, end) {
let method = orderTotalOfJT()
let para = {
routerMethod: method,
beginDateStr: start,
endDateStr: end,
reportType: 2,
orderByType: this.orderByType //1 分账 2分润
}
converterApi(para).then(res => {
this.productValueInfo = res.map(item => {
item.money = `¥${item.profitMoney} / ¥${item.divisionMoney}`
return item
})
this.curStartTime = start
this.curEndTime = end
})
},
// 更换时间折线图
changeTimeForLine(start, end) {
this.$refs.myline.couponsChartData(start, end)
this.todayName = `${utils.dateFormat(start, 'YYYY年MM月DD日')}至${utils.dateFormat(end, 'YYYY年MM月DD日')}`
},
// 获取点击的日期
changeCurDate(e){
this.todayName = utils.dateFormat(new Date(e), 'YYYY年MM月DD日')
this.orderDataInfoOfJT(e,e)
}
}
}
</script>
<style lang="scss" scoped>
.bloc-chart-container {
height: 400px;
position: relative;
display: flex;
.mid_line {
// width: 1px;
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, 0);
height: 350px;
display: flex;
align-items: center;
// background: #e8e8ea;
>img{
width: 18px;
height: 155px;
}
}
.chart_wrapper {
width: 50%;
height: 350px;
// background: #999;
display: flex;
align-items: center;
justify-content: center;
}
.table-wrapper {
width: 50%;
height: 350px;
box-sizing: border-box;
padding: 13px 22px 0 20px;
.top_line {
.right_wrap {
width: 50%;
}
}
.table_widget {
margin-top: 7px;
}
}
}
.openBtn {
position: absolute;
left: 50%;
transform: translate(-50%, 0);
bottom: 10px;
cursor: pointer;
display: flex;
align-items: center;
> img {
margin-left: 5px;
width: 10px;
height: 9px;
}
}
// .bloc-chart-container /deep/ .el-table__body-wrapper {
// height: 270px;
// overflow-y: scroll;
// }
</style>