order.vue
9.33 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<template>
<div class="live-room">
<div class="live-room container">
<div class="flex">
<el-form :inline="true" style="width: 100%" :model="searchForm" label-width="70px" label-position="right">
<el-row>
<el-form-item size="small" label="订单编号">
<el-input :size="size" v-model="searchForm.orderCode" placeholder="请输入订单编号" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="名称" style="margin-left: 20px">
<el-input :size="size" v-model="searchForm.packageName" placeholder="请输入名称" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="类型" style="margin-left: -10px">
<el-select size="small" v-model="searchForm.orderType" :disabled="merchantModel == 1 && accountLevel == 1" placeholder="请选择">
<el-option v-for="item in orderTypeList" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item size="small" label="用户信息">
<el-input :size="size" v-model="searchForm.userInfo" placeholder="请输入用户名或手机号" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="下单时间" style="margin-left: 20px">
<el-date-picker :size="size" v-model="searchForm.daterange" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions || {}"></el-date-picker>
</el-form-item>
<el-form-item size="small" class="fr-mr0">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary" @click="handleExport">导出</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
</el-row>
</el-form>
</div>
<div class="choseRow">
<div class="choseItem" :class="{ active: currentIndex == index + 1 }" v-for="(item, index) in choseList" :key="index" @click="tabClick(index + 1)">
{{ item }}
</div>
</div>
<GLTable ref="memberOrderRef" v-if="isReload" :noDataImg="url" @setTableFinishFun="setTableFinishFun" :searchForm="searchFormTable" :tableParams="tableParams" :getListApi="getListApi" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<!-- <span slot="shareImgUrl" slot-scope="scope">
<img class="img-60" :src="scope.scope.shareImgUrl" />
</span> -->
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
<!-- <el-button type="text" @click="handleDetail(scope.scope)" v-if="scope.scope.orderType == 1">详情</el-button>
<el-button type="text" style="color:#eee" v-else>详情</el-button> -->
<GLButton @click="handleDetail(scope.scope)" fn="订单详情" type="text" v-if="scope.scope.orderType == 1">详情</GLButton>
<GLButton style="color: #eee" fn="订单详情" type="text" v-else>详情</GLButton>
</span>
</GLTable>
</div>
</div>
</template>
<script>
import { orderTypesList, orderStatusList, exportFn } from '@/common/constant'
import url from '@/assets/empty.png'
import { getOrderListApi, orderExportApi } from '@/api/modules/order'
export default {
data() {
return {
merchantModel: 1, //集团:1,门店:2
accountLevel: 0, //1,2,3,4工厂,省代,市代,门店
url: url,
isReload: true,
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
},
size: 'small',
searchForm: {
orderStatus: '', //默认查询全部
// name: '',
// daterange:''
orderType: ''
},
choseList: ['全部', '待收货', '已完成', '退款|售后'],
currentIndex: 1,
searchFormTable: {},
orderTypeList: [
{
dictValue: '',
dictLabel: '全部'
},
{
dictValue: 1,
dictLabel: '套餐'
},
{
dictValue: 2,
dictLabel: '会员卡'
}
],
// 表格组件
getListApi: getOrderListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '名称',
prop: 'packageName',
width: '180'
// formatter: cellValue => {
// return cellValue.startTime + '-' + cellValue.endTime
// }
},
{
label: '类型',
prop: 'orderType',
formatter: cellValue => {
return this.baseDataList.orderTypesList.find(item => item.confId == cellValue.orderType).confName
}
},
{
label: '价格',
prop: 'originalPrice'
},
{
label: '实收金额',
prop: 'realPayPrice'
},
{
label: '订单状态',
prop: 'orderStatus',
width: '80',
formatter: cellValue => {
return this.baseDataList.orderStatusList.find(item => item.confId == cellValue.orderStatus).confName
}
},
{
label: '下单时间',
prop: 'createDate',
width: 95
},
{
label: '用户信息',
prop: 'accountName'
},
{
label: '订单号',
prop: 'orderCode'
}
]
},
baseDataList: {
orderTypesList: orderTypesList,
orderStatusList: orderStatusList
}
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
console.log('kkk',this.$globalState)
this.merchantModel = this.$globalState.session.merchantModel
this.accountLevel = this.$globalState.session.accountLevel
if (this.merchantModel == 1 && this.accountLevel == 1) {
this.searchForm.orderType = 2
}
}
},
mounted() {},
methods: {
tabClick(index) {
this.currentIndex = index
switch (index) {
case 1:
delete this.searchForm['orderStatus[0]']
delete this.searchForm['orderStatus[1]']
delete this.searchForm['orderStatus[2]']
this.searchForm.orderStatus = ''
break
case 2:
delete this.searchForm.orderStatus
delete this.searchForm['orderStatus[1]']
delete this.searchForm['orderStatus[2]']
this.searchForm['orderStatus[0]'] = 2
break
case 3:
delete this.searchForm.orderStatus
delete this.searchForm['orderStatus[1]']
delete this.searchForm['orderStatus[2]']
this.searchForm['orderStatus[0]'] = 3
break
case 4:
delete this.searchForm.orderStatus
this.searchForm['orderStatus[0]'] = 4
this.searchForm['orderStatus[1]'] = 5
this.searchForm['orderStatus[2]'] = 6
break
}
this.handleSearch()
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (params.daterange) {
params.startTime = this.searchForm.daterange[0] + ' 00:00:00'
params.endTime = this.searchForm.daterange[1] + ' 23:59:59'
} else {
if (params.beginTime) delete params.beginTime && delete params.endTime
}
delete params.daterange
return params
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchFormTable = this.getParams()
resolve()
})
},
handleDetail(row) {
this.$router.push({
path: '/memberCenter/orderDetail',
query: {
id: row.id,
detail: row
}
})
},
handleExport(row) {
var params = this.getParams()
orderExportApi(params).then(res => {
exportFn(res)
})
},
handleSearch() {
this.$refs.memberOrderRef.refreshTable()
},
setTableFinishFun() {
//接收到的数据为空
if (!this.$refs.memberOrderRef.data.length) {
this.$refs.memberOrderRef.setTableHeightFun()
}
},
handleReset() {
this.isReload = false
this.currentIndex = 1
this.searchForm = {}
this.searchForm.orderStatus = '' //默认查询全部
// this.handleSearch()
this.$nextTick(() => {
this.isReload = true
})
}
}
}
</script>
<style lang="scss" scoped>
/deep/.el-input--small .el-input__inner {
width: 215px;
}
.el-range-editor.is-active,
.el-range-editor.is-active:hover {
border-color: #5850ff;
width: 215px;
}
.el-range-editor--small.el-input__inner {
width: 215px;
}
.container {
.choseRow {
display: flex;
height: 34px;
.choseItem {
cursor: pointer;
width: 120px;
height: 34px;
line-height: 34px;
text-align: center;
font-size: 14px;
font-weight: 400;
color: #333333;
}
.active {
color: #5850ff;
background-color: #f4f6fc;
}
}
}
</style>