list.vue
3.9 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
<template>
<layout-body>
<layout-filter ref="filter" :model="query">
<filter-item label="订单号">
<Input v-model.trim="query.orderCode" />
</filter-item>
<filter-item label="SKN">
<Input v-model.trim="query.productSkn" />
</filter-item>
<filter-item label="SKU">
<Input v-model.trim="query.productSku" />
</filter-item>
<filter-item label="收货人">
<Input v-model.trim="query.consigneeName" />
</filter-item>
<filter-item label="商品名称">
<Input v-model.trim="query.productName" />
</filter-item>
<filter-item label="订单状态">
<Select v-model.trim="query.orderStatus" clearable>
<Option v-for="(option, key) in orderStatusArr" :key="key" :value="key">
{{ option }}
</Option>
</Select>
</filter-item>
<filter-item>
<Button type="primary" @click="search">筛选</Button>
<Button @click="reset">全部</Button>
<Button type="success" @click="exportData">导出</Button>
</filter-item>
</layout-filter>
<layout-list>
<list-tabs @change-tabs="onChangeTabs"></list-tabs>
<data-table :table-data="tableData" :payment-status-arr="paymentStatusArr" :order-status-arr="orderStatusArr">
</data-table>
<Page :total="pageData.total" :current="pageData.current" :page-size="20" show-total @on-change="pageChange">
</Page>
</layout-list>
</layout-body>
</template>
<script>
import { ListTabs, DataTable } from './components';
import { OrderService } from 'services/order';
import _ from 'lodash';
import { OrderConfig } from '../configs';
import qs from 'querystringify';
export default {
components: { ListTabs, DataTable },
data() {
return {
paymentStatusArr: OrderConfig.paymentStatus,
query: {
orderCode: '',
productSkn: '',
productSku: '',
prodName: '',
consigneeName: '',
orderStatus: '',
pageSize: 20,
pageNo: 1,
orderStatusStr: '',
orderStatusType: 0,
},
tableData: [],
orderStatusArr: OrderConfig.orderStatus,
pageData: {
total: 0,
current: 1,
},
};
},
created() {
this.orderService = new OrderService();
this.search();
},
methods: {
onChangeTabs(type) {
this.query.orderStatusType = +type;
this.reset();
},
search() {
this.orderService.orderList(this.query).then(ret => {
this.tableData = _.get(ret, 'data.records', []);
this.pageData.total = _.get(ret, 'data.totalCount', 0);
this.pageData.pageNo = _.get(ret, 'data.pageNo', 1);
});
},
pageChange(page) {
this.pageData.current = page;
this.query.pageNo = page;
this.search();
},
reset() {
this.query.orderCode = '';
this.query.productSkn = '';
this.query.productSku = '';
this.query.prodName = '';
this.query.nickName = '';
this.query.userName = '';
this.query.orderStatus = '';
this.query.pageSize = 20;
this.query.pageNo = 1;
this.search();
},
exportData() {
const querystring = qs.stringify(this.query, true);
const href = `${OrderService.exportOrdersByStatus}${querystring}`;
window.open(href, '_blank');
},
},
};
</script>
<style lang="scss">
table.order-table {
width: 100%;
height: auto;
thead {
background: #000000;
th {
padding: 8px 0;
border: 1px solid #cccccc;
color: #ffffff;
text-align: center;
}
}
tbody {
tr {
height: 35px;
td {
border: 1px solid #cccccc;
border-top: none;
border-right: none;
text-align: center;
padding: 5px;
span {
margin-left: 10px;
margin-right: 20px;
}
}
td:last-child {
border-right: 1px solid #cccccc;
}
}
}
}
</style>