chooseOrderDialog.vue
9.5 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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<template>
<GLDialog title="选择订单" mode="big" :visible.sync="visible" @before-close="handleClose" @confirmDialog="handleAddConfirm" @onCancel="handleClose">
<div class="order-list">
<div class="flex">
<GLCombiForm :formObj="searchForm" :label-width="'90px'" :form-data="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<!-- <div class="up-btns">
<el-button @click="handleSearch" size="small" type="primary">
查询
</el-button>
</div> -->
</div>
<div class="table-wrap">
<el-table :data="tableData" border>
<el-table-column align="center">
<template slot-scope="scope">
<el-radio v-model="orderId" :label="scope.row.orderCode" @input="getCurrentOrderData">
<span class="order-name">{{ scope.row.orderCode }}</span>
</el-radio>
</template>
</el-table-column>
<el-table-column prop="key" label="序号" align="center" />
<el-table-column label="订单编号" align="center" width="150" prop="orderCode" />
<el-table-column label="订单状态" align="center" prop="status">
<template slot-scope="scope">
<span>{{ statusOpts[scope.row.status] }}</span>
</template>
</el-table-column>
<el-table-column label="订单时间" align="center" width="160" prop="orderTimeStr" />
<el-table-column label="客户姓名" align="center" prop="customerName" />
<el-table-column label="商品名称" align="center" width="180" prop="subOrderList">
<template slot-scope="scope">
<span v-for="(item, index) in scope.row.subOrderList" :key="index">
<p v-if="item.upgradeGoodsId">
<el-tooltip class="item" :content="item.upgradeGoodsName" placement="right">
<span>
{{
item.upgradeGoodsName
? item.upgradeGoodsName.length > 10
? item.upgradeGoodsName.substring(0, 10) + "..."
: item.upgradeGoodsName
: "-"
}}
</span>
</el-tooltip>
</p>
<p v-else>{{ item.baseGoodsName }}</p>
</span>
</template>
</el-table-column>
<el-table-column label="总价" align="center" prop="totalPrice">
<template slot-scope="scope">
<span>
{{ scope.row.totalPrice ? "¥" + scope.row.totalPrice : 0 }}</span>
</template>
</el-table-column>
</el-table>
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page.pageNum" :page-sizes="[10, 20, 30, 40]" :page-size="page.pageSize" :total="total" layout="sizes,total,->,prev,pager,next,jumper" />
</div>
</div>
</GLDialog>
</template>
<script>
// import { Util } from "@/common/util"
// import { deductOrderPage } from "@api/point"
import * as dayjs from 'dayjs'
export default {
data() {
return {
sellerUserId: "",
orderId: "",
tableData: [],
orderData: [],
searchForm: {
customerName: "",
orderCode: "",
status: "",
paySuccessDate: []
},
searchFormSearch: {},
total: 0,
page: {
pageNum: 1,
pageSize: 10
},
showFormData: [
{
label: "客户",
name: "customerName",
type: "input",
isClear: true
},
{
label: "订单编号",
name: "orderCode",
type: "input",
isClear: true
},
{
label: "订单状态",
name: "status",
type: "select",
optionList: [],
optionId: "confId",
optionLabel: "confLabel",
optionsName: "orderStatusList"
},
{
label: "订单日期",
name: "paySuccessDate",
type: "datePicker",
labelWidth: 72,
isClear: true,
pickerOptions: "rangePickerOptions"
}
],
statusOpts: {
1: "待升级",
2: "战败",
3: "待支付",
4: "已支付",
// 5: '已退款',
6: "已评价",
9: "已撤销",
10: "已关闭",
11: "错误订单",
12: "已退款",
13: "待上传"
},
baseData: {
orderStatusList: [
// {
// confId: 1,
// confLabel: "待升级"
// },
// {
// confId: 2,
// confLabel: "战败"
// },
// {
// confId: 3,
// confLabel: "待支付"
// },
{
confId: 4,
confLabel: "已支付"
},
/* {
confId: 5,
confLabel: '已退款'
}, */
// {
// confId: 6,
// confLabel: "已评价"
// },
// {
// confId: 9,
// confLabel: "已撤销"
// },
// {
// confId: 10,
// confLabel: "已关闭"
// },
// {
// confId: 11,
// confLabel: "错误订单"
// },
{
confId: 12,
confLabel: "已退款"
}
]
}
}
},
props: {
visible: {
type: Boolean,
default: false
},
chooseOrderData: {
type: Array,
default: () => []
}
},
computed: {
isVisible: {
get() {
return this.visible
},
set(newVal) { }
}
},
created() {
this.searchForm.userId = this.$route.query.userId
this.searchForm.merchantId = this.$route.query.merchantId
this.getList()
},
mounted() {
this.getOptionsList()
},
methods: {
getList() {
var params = this.getParams()
params = {
...this.page,
...params
}
console.log(params)
console.log(params)
this.$apis.points.deductOrderPage(params).then((res) => {
this.tableData = res.list.map((item, index) => {
item.paySuccessDate = item.paySuccessDate ? dayjs(item.paySuccessDate).format('YYYY-MM-DD HH:mm:ss') : ''
item.key = index + 1 + this.page.pageSize * (this.page.pageNum - 1)
return item
})
this.page.pageNum = res.pageNum
this.page.pageSize = res.pageSize
this.total = res.total
this.init()
})
},
// 每页条数
handleSizeChange(value) {
this.page.pageSize = value
this.getList()
},
// 页码
handleCurrentChange(value) {
this.page.pageNum = value
this.getList()
},
init() {
this.orderId = this.chooseOrderData.length
? this.chooseOrderData[0].orderCode
: ""
this.orderData = this.chooseOrderData
},
getCurrentOrderData(value) {
this.orderData = this.tableData.filter((item) => item.orderCode == value)
},
handleAddConfirm() {
this.$emit("chooseOrder", this.orderData)
},
handleClose() {
this.$emit("dialogClose")
},
handleSearch() {
this.page.pageNum = 1
this.getList()
},
getParams() {
this.searchFormSearch = this.$common.utils.deepClone(this.searchForm)
if (this.searchFormSearch.paySuccessDate && this.searchFormSearch.paySuccessDate.length) {
this.searchFormSearch.paySuccessStartDate = dayjs(this.searchFormSearch.paySuccessDate[0]).format('YYYY-MM-DD') + ' 00:00:00'
this.searchFormSearch.paySuccessEndDate = dayjs(this.searchFormSearch.paySuccessDate[1]).format('YYYY-MM-DD') + ' 23:59:59'
}
delete this.searchFormSearch.paySuccessDate
return this.searchFormSearch
},
getOptionsList(hasAll = true) {
this.showFormData.forEach((item, index) => {
if (item.type === "select") {
if (
hasAll &&
this.baseData[item.optionsName]?.length &&
this.baseData[item.optionsName][0][
this.showFormData[index].optionLabel
] !== "全部"
) {
if (item.optionsName != "parkServiceList") {
// 服务对接由于是多选不应该添加全部选项
const temp = {}
temp[this.showFormData[index].optionId] = ""
temp[this.showFormData[index].optionLabel] = "全部"
this.baseData[item.optionsName].unshift(temp)
}
}
this.$set(
this.showFormData[index],
"optionList",
this.baseData[item.optionsName]
)
}
})
}
}
}
</script>
<style lang='scss' scoped>
.order-list {
height: 540px;
}
.flex {
display: flex;
align-items: center;
justify-content: space-between;
}
.table-wrap {
height: 500px;
overflow-y: auto;
}
.show-search {
display: flex;
align-items: center;
::v-deep .el-form {
display: flex;
align-items: center;
.el-form-item {
display: flex;
width: 100%;
margin-bottom: 0px;
}
.el-col {
width: auto !important;
}
.el-form-item__label {
width: 70px !important;
white-space: nowrap;
}
.el-form-item__content {
width: 170px;
}
}
::v-deep .d2-search-block {
padding: 16px 0 0 !important;
}
}
.order-name {
display: inline-block;
color: transparent;
width: 0;
}
</style>