<!--订单详情-->
|
<template>
|
<filter-dialog ref="table" :show.sync="showDialog" :title="title" :tableData="tableData"
|
:total="total" :form="listQuery" :formLabel="formLabel"
|
@page-info-change="handPageInfoChange" @selected="handSelected"
|
@close="handleDialogClose" :loading="loading" :appendToBody="appendToBody"
|
dataKey="orderId">
|
<template slot="condition">
|
<el-button type="primary" size="mini" @click="handleFilter">查询</el-button>
|
<el-button size="mini" @click="resetQuery">重置</el-button>
|
</template>
|
<template slot="columns">
|
<el-table-column label="订单编号" prop="orderId" width="170px" show-overflow-tooltip>
|
</el-table-column>
|
<el-table-column :label="formLabel[1].label" width="160px" :prop="formLabel[1].prop"
|
show-overflow-tooltip></el-table-column>
|
<el-table-column label="商品名称" prop="spuName" show-overflow-tooltip></el-table-column>
|
<el-table-column label="商品主编码" prop="spuNum" show-overflow-tooltip></el-table-column>
|
<el-table-column label="商品数量" width="100px" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{title === '已售数量详情' ? scope.row.stock : scope.row.lockStock}}
|
</template>
|
</el-table-column>
|
<slot></slot>
|
</template>
|
</filter-dialog>
|
</template>
|
<script>
|
import filterDialog from '@/components/filterDialog/filterDialog.vue'
|
import { getArrayLable } from '@/utils/getArrayLable'
|
import orderStatus from '@/utils/constant/orderStatus'
|
|
export default {
|
components: { filterDialog },
|
props: {
|
title: {
|
type: String,
|
default: null
|
},
|
/**
|
* 是否嵌套弹出框
|
*/
|
appendToBody: {
|
type: Boolean,
|
default: false
|
},
|
// 请求api
|
orderDetail: {
|
type: Object
|
}
|
},
|
data () {
|
return {
|
showDialog: false,
|
orderStatus,
|
listQuery: {
|
orderIds: null,
|
orderStatus: null,
|
timeSlot: []
|
},
|
tableData: [],
|
total: 0,
|
loading: false,
|
formLabel: [
|
{
|
model: 'orderIds',
|
label: '订单编号',
|
type: 'input',
|
sm: 10
|
},
|
{
|
model: 'timeSlot',
|
label: '下单时间',
|
prop: 'createTime',
|
type: 'date',
|
flag: 'daterange',
|
valueFormat: 'yyyy-MM-dd',
|
sm: 10
|
}
|
],
|
selectedRows: null
|
}
|
},
|
methods: {
|
// 弹出框打开关闭事件
|
toggleDialog () {
|
this.showDialog = !this.showDialog
|
if (this.showDialog) {
|
this.listQuery.timeSlot = []
|
this.listQuery.orderIds = null
|
this.$nextTick(() => {
|
this.formLabel[1].label = this.title === '已售数量详情' ? '出库时间' : '下单时间'
|
this.formLabel[1].prop = this.title === '已售数量详情' ? 'createTime' : 'orderTime'
|
})
|
}
|
},
|
/**
|
* 获取数组的label
|
*/
|
getArrayLable,
|
/**
|
* '获取选中的数据
|
*/
|
handSelected (rows) {
|
this.selectedRows = rows
|
},
|
/**
|
* 弹出框关闭事件处理
|
*/
|
handleDialogClose () {
|
if (this.selectedRows) {
|
this.$emit('hand-selected-row-data', this.selectedRows)
|
}
|
},
|
/**
|
* 搜索条件变更处理
|
*/
|
handleFilter () {
|
if (!this.listQuery.orderIds) {
|
this.listQuery.orderIds = null
|
}
|
this.$refs.table.changeCondition()
|
},
|
/**
|
* 重置
|
*/
|
resetQuery () {
|
this.listQuery.timeSlot = []
|
this.listQuery.orderIds = null
|
this.$refs.table.reloadCurrent()
|
},
|
/**
|
* 分页信息改变时,列表查询
|
*/
|
handPageInfoChange (pageInfo) {
|
this.queryList(pageInfo)
|
},
|
/**
|
* 查询列表
|
*/
|
queryList (pageInfo) {
|
this.loading = true
|
const param = JSON.parse(JSON.stringify(this.listQuery))
|
if (param.timeSlot && param.timeSlot.length) {
|
param.startTime = param.timeSlot[0] + ' 00:00:00'
|
param.endTime = param.timeSlot[1] + ' 23:59:59'
|
}
|
param.orderIds = this.listQuery.orderIds?.length && this.listQuery.orderIds.split(',')
|
delete param.timeSlot
|
|
this.orderDetail.questApi({ ...param, ...this.orderDetail.params, current: pageInfo.pageNum, size: pageInfo.pageSize }, false)
|
.then((res) => {
|
if (res.data) {
|
this.tableData = res.data.records
|
this.total = res.data.total
|
this.loading = false
|
} else {
|
this.loading = false
|
}
|
})
|
.catch(() => {
|
this.loading = false
|
})
|
}
|
}
|
}
|
</script>
|