index.vue
8.35 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<!-- -->
<template>
<div class="pending">
<div class="tab_show">
<el-tabs v-model="formInline.state" @tab-click="handleClick">
<el-tab-pane label="全部" :name="''" />
<el-tab-pane label="待付款" name="1" />
<el-tab-pane label="待发货" name="2" />
<el-tab-pane label="已发货" name="3" />
<el-tab-pane label="已完成" name="4" />
<el-tab-pane label="已关闭" name="5" />
</el-tabs>
<!-- 搜索 -->
<div class="formSearch">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item>
<div style="padding-top:6px">
<el-input v-model="formInline.search" placeholder="请输入内容" size="mini">
<el-select
slot="prepend"
v-model="formInline.searchType"
style="width:130px"
placeholder="请选择"
size="mini"
>
<el-option label="订单id" value="1" />
<el-option label="买家账户" value="2" />
<el-option label="收件人姓名" value="3" />
<el-option label="收件人手机号" value="4" />
<!-- <el-option label="商品ID" value="5" /> -->
</el-select>
</el-input>
</div>
</el-form-item>
<el-form-item label="商户名称">
<el-input v-model="formInline.shopName" placeholder="请输入" size="mini"/>
</el-form-item>
<!-- <el-form-item label="售后状态">
<el-select v-model="formInline.afterState" placeholder="请选择售后状态">
<el-option label="全部" :value="null" />
<el-option label="无售后" value="0" />
<el-option label="售后中" value="1" />
<el-option label="售后成功" value="2" />
<el-option label="售后关闭" value="3" />
</el-select>
</el-form-item> -->
<el-form-item label="下单时间">
<el-date-picker
v-model="formInline.dates"
type="daterange"
size="mini"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item>
<el-button plain @click="search" size="mini" style="background-color: #3F9B6A;color: #fff;">查询</el-button>
<el-button plain @click="orderDataExport" style="background-color: #3F9B6A;color: #fff;" size="mini">导出订单</el-button>
</el-form-item>
</el-form>
</div>
<!-- 表格 -->
<div class="tableBox">
<el-table
ref="multipleTable"
v-loading="tableLoading"
:data="tableData"
border
:header-cell-style="{fontSize: '12px', backgroundColor: '#FAFAFA',color:'#000',fontWeight: 'normal'}"
tooltip-effect="dark"
style="width: 100%"
>
<el-table-column label="订单id" width="150">
<template slot-scope="scope">{{ scope.row.orderId }}</template>
</el-table-column>
<el-table-column prop="number" label="商品数量" width="100" />
<el-table-column prop="shopName" label="商户名称" width="220" show-overflow-tooltip />
<el-table-column prop="customerName" label="下单账户" show-overflow-tooltip />
<el-table-column prop="receiveName" label="收件人" show-overflow-tooltip />
<el-table-column prop="receivePhone" label="手机号" show-overflow-tooltip />
<el-table-column prop="price" label="支付金额(元)" width="120" />
<el-table-column prop="createTime" label="下单时间" show-overflow-tooltip />
<el-table-column label="订单状态" show-overflow-tooltip>
<template slot-scope="scope">
<span v-if="scope.row.state == 1" :style="{color: '#E6A23C'}">待付款</span>
<span v-if="scope.row.state == 2" :style="{color: '#F56C6C'}">待发货</span>
<span v-if="scope.row.state == 3" :style="{color: '#409EFF'}">已发货</span>
<span v-if="scope.row.state == 4" :style="{color: '#67C23A'}">已完成</span>
<span v-if="scope.row.state == 5" :style="{color: '#909399'}">已关闭</span>
</template>
</el-table-column>
<el-table-column label="操作" show-overflow-tooltip>
<template slot-scope="scope">
<div class="btnList">
<el-button type="text" @click="seeMore(scope.row)">查看</el-button>
</div>
</template>
</el-table-column>
</el-table>
<div class="fenye">
<el-pagination
:current-page="formInline.page"
:page-sizes="[10, 20, 50, 100]"
:page-size="10"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
<el-dialog
title="订单详情"
:visible.sync="detailVisible"
width="74%"
center
:close-on-click-modal="false"
>
<OrderDetail :detailRow="form" @cancel="cancel" />
</el-dialog>
</div>
</template>
<script>
import OrderDetail from '@/views/order/ordersel/pendDetails.vue'
import { orderGetAll , orderExport} from '@/api/order'
import { async } from 'q';
export default {
components: { OrderDetail },
data () {
// 这里存放数据
return {
activeName: 'first',
formInline: {
searchType: '1',
search: '', // 搜索字段
state: '',
// afterState: '', // 售后状态 0-无售后 1-售后中 2-售后成功 3-售后关闭
dates: [], // 下单时间数组
page: 1,
shopName: '',
pageSize: 10
},
total: 1,
tableData: [],
tableLoading: false,
detailVisible: false,
form: {}
}
},
// 生命周期 - 挂载完成(可以访问DOM元素)
mounted() {
this.getAll(this.formInline)
this.handleClick({ name: '' })
},
// 方法集合
methods: {
handleSizeChange (val) {
this.formInline.pageSize = val
this.getAll(this.formInline)
},
handleCurrentChange (val) {
this.formInline.page = val
this.getAll(this.formInline)
},
handleClick (tab, event) {
this.page = 1
this.formInline.state = tab.name
this.formInline.page = 1
this.getAll(this.formInline)
},
// 查询
search () {
this.total = 1
this.formInline.page = 1
this.getAll(this.formInline)
},
// 详情
seeMore (row) {
this.detailVisible = true
this.form = row
// this.$router.push({
// name: 'pendDetails',
// params: { orderId: row.orderId }
// })
},
cancel () {
this.detailVisible = false
},
// 初始化查询所有数据
async getAll (formInline) {
this.tableLoading = true
const res = await orderGetAll(formInline)
this.tableData = res.data.list
this.total = res.data.total
this.tableLoading = false
},
// 导出订单
async orderDataExport() {
this.$message({
message: '数据导出中,请勿重复操作!',
type: 'success'
})
const res = await orderExport(this.formInline)
if(!res){
return
}
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
const fileName = '订单数据明细表.xls'
if ('download' in document.createElement('a')) {
// 非IE下载
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
} else {
// IE10+下载
navigator.msSaveBlob(blob, fileName)
}
},
}
}
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类
@import url("../../../styles/elDialog.scss");
.tab_show {
padding-left: 30px;
background-color:#fff;
}
.pending{
min-height:90vh;
}
</style>