index.vue
5.41 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
189
190
191
192
193
194
<template>
<div class="equity-wrap">
<div class="find_wrap">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<GLTable ref="table" :noDataImg="url" :searchForm="searchFormTable" :tableParams="tableParams" :getListApi="tableParams.getListApi" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="flex_sc" slot="colorStatus" slot-scope="scope">
<div class="table_point" :style="{'background':colors[scope.scope.orderStatus]}"></div>
<span>{{['已结算', '待结算', '已失效'][scope.scope.orderStatus]}}</span>
</div>
</GLTable>
</div>
</div>
</template>
<script>
function date_format(date) {
var date2 = new Date(date)
var YY = date2.getFullYear() + '-'
var MM = (date2.getMonth() + 1 < 10 ? '0' + (date2.getMonth() + 1) : date2.getMonth() + 1) + '-'
var DD = date2.getDate() < 10 ? '0' + date2.getDate() : date2.getDate()
var hh = (date2.getHours() < 10 ? '0' + date2.getHours() : date2.getHours()) + ':'
var mm = (date2.getMinutes() < 10 ? '0' + date2.getMinutes() : date2.getMinutes()) + ':'
var ss = date2.getSeconds() < 10 ? '0' + date2.getSeconds() : date2.getSeconds()
return YY + MM + DD + ' ' + hh + mm + ss
}
import url from '@/assets/empty.png'
export default {
name: '',
data() {
return {
url: url,
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
},
searchForm: {
orderId: '',
orderStatus: '',
daterange: '',
phone: ''
},
searchFormData: [
{
label: '下单时间',
name: 'daterange',
type: 'datePicker',
isClear: true
},
{
label: '订单号',
name: 'orderId',
type: 'input',
isClear: true
},
{
label: '用户信息',
name: 'phone',
type: 'input',
isClear: true
},
{
label: '订单状态',
name: 'orderStatus',
type: 'select',
optionId: 'confId',
optionLabel: 'confName',
isClear: true,
noFilter: true,
optionList: [
{
confId: 0,
confName: '已结算'
},
{
confId: 1,
confName: '待结算'
},
{
confId: 2,
confName: '已失效'
}
]
}
],
searchFormTable: {},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
date_format,
tableParams: {
listName: 'list',
getListApi: this.$apis.orderApi.getEDJOrderList,
tableColumns: [
{
label: '日期',
width: 200,
formatter: cell => {
return this.date_format(cell.callTime)
}
},
{
label: '用户信息',
prop: 'phone',
width:150,
},
{
label: '订单里程/km',
minWidth:120,
formatter: cell => {
return `${cell.distance}`
}
},
{
label: '实付金额/元',
prop: 'price',
align:'right',
minWidth:120,
formatter(cell){
return cell.price.toFixed(2)
}
},
{
label: '订单总额/元',
minWidth:120,
prop: 'income',
align:'right',
formatter(cell){
return cell.income.toFixed(2)
}
},
{
label: '订单号',
minWidth:200,
prop: 'orderId'
},
{
label: '司机工号',
minWidth:200,
prop: 'driverId'
},
{
label: '订单状态',
prop: 'status',
width:150,
formatter: cell => {
return ['已结算', '待结算', '已失效'][cell.orderStatus]
},
addHtml:'colorStatus'
}
]
},
colors:['#2CCA74','#FDB757','#999999'],
}
},
mounted() {},
methods: {
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchFormTable = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchFormTable.daterange) {
this.searchFormTable.callDateStart = this.searchForm.daterange[0]
this.searchFormTable.callDateEnd = this.searchForm.daterange[1]
} else {
if (this.searchFormTable.callDateStart) delete this.searchFormTable.callDateStart && delete this.searchFormTable.callDateEnd
}
delete this.searchFormTable.daterange
resolve()
})
},
// setTableFinishFun() {
// //接收到的数据为空
// if (!this.$refs.table.data.length) {
// this.$refs.table.setTableHeightFun()
// }
// },
handleReset() {
this.flag = false
this.searchForm = {
orderId: '',
orderStatus: '',
daterange: '',
phone: ''
}
this.handleSearch()
},
handleSearch() {
this.$refs.table.refreshTable()
}
}
}
</script>
<style lang="scss" scoped>
</style>