90
90
/>
91
91
</el-select >
92
92
</el-form-item >
93
- <!-- TODO 考虑是否移除或重构;这个还是需要的哈 -->
93
+ <!-- TODO 聚合搜索等售后结束后实现 -->
94
94
<el-form-item label =" 聚合搜索" >
95
95
<el-input
96
96
v-show =" true"
132
132
3、然后点击展开和收拢订单项,可以不做哈。
133
133
-->
134
134
<ContentWrap >
135
- <el-table
136
- v-loading =" loading"
137
- :data =" list"
138
- :show-overflow-tooltip =" true"
139
- :stripe =" true"
140
- default-expand-all
141
- >
142
- <el-table-column fixed =" left" type =" expand" >
135
+ <el-table v-loading =" loading" :data =" list" >
136
+ <el-table-column class-name =" order-table-col" >
137
+ <template #header >
138
+ <div class =" flex items-center" style =" width : 100% " >
139
+ <div class =" ml-100px mr-200px" >商品信息</div >
140
+ <div class =" mr-60px" >单价(元)/数量</div >
141
+ <div class =" mr-60px" >售后状态</div >
142
+ <div class =" mr-60px" >实付金额(元)</div >
143
+ <div class =" mr-60px" >买家/收货人</div >
144
+ <div class =" mr-60px" >配送方式</div >
145
+ <div class =" mr-60px" >订单状态</div >
146
+ <div class =" mr-60px" >操作</div >
147
+ </div >
148
+ </template >
143
149
<template #default =" scope " >
144
- <el-table :data =" scope.row.items" :span-method =" spanMethod" border style =" width : 100% " >
145
- <el-table-column label =" 商品信息" min-width =" 300" prop =" spuName" >
150
+ <el-table
151
+ :data =" scope.row.items"
152
+ :header-cell-style =" headerStyle"
153
+ :span-method =" spanMethod"
154
+ border
155
+ style =" width : 100% "
156
+ >
157
+ <el-table-column min-width =" 300" prop =" spuName" >
158
+ <template #header >
159
+ <div
160
+ class =" flex items-center"
161
+ style =" height : 35px ; background-color : #f7f7f7 ; width : 100% "
162
+ >
163
+ <span class =" mr-20px" >订单号:{{ scope.row.no }} </span >
164
+ <span class =" mr-20px" >下单时间:{{ formatDate(scope.row.createTime) }}</span >
165
+ <span >订单来源:</span >
166
+ <dict-tag
167
+ :type =" DICT_TYPE.TERMINAL"
168
+ :value =" scope.row.terminal"
169
+ class =" mr-20px"
170
+ />
171
+ <span >支付方式:</span >
172
+ <dict-tag
173
+ :type =" DICT_TYPE.PAY_CHANNEL_CODE"
174
+ :value =" scope.row.payChannelCode"
175
+ class =" mr-20px"
176
+ />
177
+ <span class =" mr-20px" >支付时间:{{ formatDate(scope.row.payTime) }}</span >
178
+ <span >订单类型:</span >
179
+ <dict-tag :type =" DICT_TYPE.TRADE_ORDER_TYPE" :value =" scope.row.type" />
180
+ </div >
181
+ </template >
146
182
<template #default =" { row } " >
147
183
<div class =" flex items-center" >
148
184
<el-image
163
199
</el-table-column >
164
200
<el-table-column label =" 商品原价*数量" prop =" price" width =" 150" >
165
201
<template #default =" { row } " >
166
- <!-- TODO @puhui999:价格,要有 xxx.00 这种格式 -->
167
- {{ floatToFixed2(row.price) }} 元 * {{ row.count }}
202
+ {{ floatToFixed2(row.price) }} 元 / {{ row.count }}
168
203
</template >
169
204
</el-table-column >
170
- <el-table-column label =" 合计" prop =" payPrice" width =" 150" >
171
- <template #default =" { row } " >{{ floatToFixed2(row.payPrice) }}元</template >
172
- </el-table-column >
173
205
<el-table-column label =" 售后状态" prop =" afterSaleStatus" width =" 120" >
174
206
<template #default =" { row } " >
175
207
<dict-tag
180
212
</el-table-column >
181
213
<el-table-column align =" center" label =" 实际支付" min-width =" 120" prop =" payPrice" >
182
214
<template #default >
183
- <!-- TODO @puhui999:价格,要有 xxx.00 这种格式 -->
184
215
{{ floatToFixed2(scope.row.payPrice) + '元' }}
185
216
</template >
186
217
</el-table-column >
233
264
</el-button >
234
265
<template #dropdown >
235
266
<el-dropdown-menu >
236
- <!-- TODO puhui999:可以判断下状态 + 物流类型,展示【发货】按钮 -->
237
- <el-dropdown-item command =" delivery" >
267
+ <!-- 判断下 物流类型 + 状态,快递 + 待发货时展示【发货】按钮 -->
268
+ <el-dropdown-item
269
+ v-if =" scope.row.deliveryType === 1 && scope.row.status === 10"
270
+ command =" delivery"
271
+ >
238
272
<Icon icon =" ep:takeaway-box" />
239
273
发货
240
274
</el-dropdown-item >
251
285
</el-table >
252
286
</template >
253
287
</el-table-column >
254
- <el-table-column align =" center" label =" 订单号" min-width =" 110" prop =" no" />
255
- <el-table-column align =" center" label =" 订单类型" min-width =" 100" >
256
- <template #default =" { row } " >
257
- <dict-tag :type =" DICT_TYPE.TRADE_ORDER_TYPE" :value =" row.type" />
258
- </template >
259
- </el-table-column >
260
- <el-table-column align =" center" label =" 订单来源" min-width =" 145" >
261
- <template #default =" { row } " >
262
- <dict-tag v-if =" row.terminal" :type =" DICT_TYPE.TERMINAL" :value =" row.terminal" />
263
- <span v-else >{{ row.terminal }}</span >
264
- </template >
265
- </el-table-column >
266
- <el-table-column
267
- :formatter =" dateFormatter"
268
- align =" center"
269
- label =" 支付时间"
270
- min-width =" 180"
271
- prop =" payTime"
272
- />
273
- <el-table-column align =" center" label =" 支付类型" min-width =" 120" prop =" payChannelCode" >
274
- <template #default =" { row } " >
275
- <dict-tag
276
- v-if =" row.payChannelCode"
277
- :type =" DICT_TYPE.PAY_CHANNEL_CODE"
278
- :value =" row.payChannelCode"
279
- />
280
- </template >
281
- </el-table-column >
282
- <el-table-column align =" center" label =" 订单状态" min-width =" 100" prop =" status" >
283
- <template #default =" { row } " >
284
- <dict-tag
285
- v-if =" row.status !== ''"
286
- :type =" DICT_TYPE.TRADE_ORDER_STATUS"
287
- :value =" row.status"
288
- />
289
- <span v-else >{{ row.status }}</span >
290
- </template >
291
- </el-table-column >
292
- <el-table-column
293
- :formatter =" dateFormatter"
294
- align =" center"
295
- label =" 创建时间"
296
- min-width =" 180"
297
- prop =" createTime"
298
- />
299
288
</el-table >
300
289
<!-- 分页 -->
301
290
<Pagination
315
304
import type { FormInstance , TableColumnCtx } from ' element-plus'
316
305
import OrderDeliveryForm from ' ./components/OrderDeliveryForm.vue'
317
306
import OrderUpdateRemarkForm from ' ./components/OrderUpdateRemarkForm.vue'
318
- import { dateFormatter } from ' @/utils/formatTime'
319
307
import * as TradeOrderApi from ' @/api/mall/trade/order'
320
308
import * as PickUpStoreApi from ' @/api/mall/trade/delivery/pickUpStore'
321
309
import { DICT_TYPE , getIntDictOptions , getStrDictOptions } from ' @/utils/dict'
310
+ import { formatDate } from ' @/utils/formatTime'
322
311
import { floatToFixed2 } from ' @/utils'
323
312
import { createImageViewer } from ' @/components/ImageViewer'
324
313
import * as DeliveryExpressApi from ' @/api/mall/trade/delivery/express'
@@ -364,27 +353,43 @@ const searchList = ref([
364
353
{ value: ' userMobile' , label: ' 用户电话' }
365
354
])
366
355
356
+ const headerStyle = ({ row , columnIndex }: any ) => {
357
+ // 表头第一行第一列占 8
358
+ if (columnIndex === 0 ) {
359
+ row [columnIndex ].colSpan = 8
360
+ } else {
361
+ // 其余的不要
362
+ row [columnIndex ].colSpan = 0
363
+ return {
364
+ display: ' none'
365
+ }
366
+ }
367
+ }
368
+
367
369
interface SpanMethodProps {
368
370
row: TradeOrderApi .OrderItemRespVO
369
371
column: TableColumnCtx <TradeOrderApi .OrderItemRespVO >
370
372
rowIndex: number
371
373
columnIndex: number
372
374
}
373
375
374
- const spanMethod = ({ rowIndex , columnIndex }: SpanMethodProps ) => {
375
- const colIndex = [4 , 5 , 6 , 7 ]
376
- // 处理列
376
+ const spanMethod = ({ row , rowIndex , columnIndex }: SpanMethodProps ) => {
377
+ const len = list .value .find (
378
+ (order ) => order .items ?.findIndex ((item ) => item .id === row .id ) !== - 1
379
+ )?.items ?.length
380
+ // 要合并的列,从零开始
381
+ const colIndex = [3 , 4 , 5 , 6 ]
377
382
if (colIndex .includes (columnIndex )) {
378
- // 处理被合并的行
383
+ // 除了第一行其余的不要
379
384
if (rowIndex !== 0 ) {
380
385
return {
381
386
rowspan: 0 ,
382
387
colspan: 0
383
388
}
384
389
}
385
- // TODO puhui:合并的行数需要动态计算
390
+ // 动态合并行
386
391
return {
387
- rowspan: 2 ,
392
+ rowspan: len ,
388
393
colspan: 1
389
394
}
390
395
}
@@ -403,9 +408,9 @@ const getList = async () => {
403
408
}
404
409
405
410
/** 搜索按钮操作 */
406
- const handleQuery = () => {
411
+ const handleQuery = async () => {
407
412
queryParams .pageNo = 1
408
- getList ()
413
+ await getList ()
409
414
}
410
415
411
416
/** 重置按钮操作 */
@@ -457,3 +462,8 @@ onMounted(async () => {
457
462
deliveryExpressList .value = await DeliveryExpressApi .getSimpleDeliveryExpressList ()
458
463
})
459
464
</script >
465
+ <style lang="scss" scoped>
466
+ :deep(.order-table-col > .cell ) {
467
+ padding : 0px ;
468
+ }
469
+ </style >
0 commit comments