Commit 3bab88b8 by 杨北旺

更换订单详情表格展示

1 parent 163fe92c
<!-- 表格+分页 -->
<template>
<div class="d2-table">
<el-table
<!-- <el-table
:ref="tableParams.mutiSelectName + 'MutiTable' || 'mutiTable'"
:data="getListApi ? data : tableData"
:row-key="tableParams.mutiSelectUniqueKey || ''"
......@@ -96,8 +96,8 @@
</el-table>
<template v-if="$slots.custom">
<slot name="custom"></slot>
</template>
</template> -->
<!--
<el-pagination
v-if="hasPage"
background
......@@ -109,7 +109,7 @@
:total="getListApi ? total : tableTotal"
:layout="layout"
>
</el-pagination>
</el-pagination> -->
</div>
</template>
......@@ -119,185 +119,185 @@ export default {
data () {
return {
loading: false,
data: [],
// 页码
page: {
pageSize: 10,
// pageNum: 1
currentPage: 1
},
total: 10,
// 排序
sortColum: '',
sort: '',
// 多选数组
mutiSelectArr: {}
}
},
props: {
// 搜索条件
searchForm: {
type: Object,
default: () => { }
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => []
},
tableTotal: {
type: Number,
default: 0
},
// 获取列表接口
getListApi: {
type: Function,
default: null
},
// 搜索前操作
beforeSearchFn: {
type: Function,
default: () => {
return new Promise((resolve, reject) => {
resolve()
})
}
},
// 分页,默认有
hasPage: {
type: Boolean,
default: true
},
// 分页组件配置
layout: {
type: String,
default: 'sizes,total,->,prev,pager,next,jumper'
},
// 序号,默认有
hasNum: {
type: Boolean,
default: true
},
tableParams: {
type: Object,
default: () => {
return {
// 多选-判断来自哪个页面
// mutiSelectName: {
// type: String,
// default: ''
// },
// 多选-唯一标识
// mutiSelectUniqueKey: {
// type: String,
// default: ''
// },
// 搜索按钮id;new Date().getTime() + parseInt(Math.random() * 1000)
// btnId: {
// type: String,
// default: ''
// },
// 后端返回列表参数名
listName: {
type: String,
default: ''
},
// 标签-默认标签名为tag;若有多个,那么需要在表格栏的列中加“tagName”
// tag: {
// type: Array,
// default: () => []
// },
// 表格操作,默认没有
// tableOption: {
// type: Object,
// default: null
// },
// 表格栏
tableColumns: {
type: Array,
default: () => []
}
}
}
// loading: false,
// data: [],
// // 页码
// page: {
// pageSize: 10,
// // pageNum: 1
// currentPage: 1
// },
// total: 10,
// // 排序
// sortColum: '',
// sort: '',
// // 多选数组
// mutiSelectArr: {}
}
},
mounted () {
const btn = document.getElementById(this.tableParams.btnId)
btn && btn.addEventListener('click', this.refreshEmit)
this.getListApi && this.refreshTable()
},
// props: {
// // 搜索条件
// searchForm: {
// type: Object,
// default: () => { }
// },
// // 表格数据-外部传入
// tableData: {
// type: Array,
// default: () => []
// },
// tableTotal: {
// type: Number,
// default: 0
// },
// // 获取列表接口
// getListApi: {
// type: Function,
// default: null
// },
// // 搜索前操作
// beforeSearchFn: {
// type: Function,
// default: () => {
// return new Promise((resolve, reject) => {
// resolve()
// })
// }
// },
// // 分页,默认有
// hasPage: {
// type: Boolean,
// default: true
// },
// // 分页组件配置
// layout: {
// type: String,
// default: 'sizes,total,->,prev,pager,next,jumper'
// },
// // 序号,默认有
// hasNum: {
// type: Boolean,
// default: true
// },
// tableParams: {
// type: Object,
// default: () => {
// return {
// // 多选-判断来自哪个页面
// // mutiSelectName: {
// // type: String,
// // default: ''
// // },
// // 多选-唯一标识
// // mutiSelectUniqueKey: {
// // type: String,
// // default: ''
// // },
// // 搜索按钮id;new Date().getTime() + parseInt(Math.random() * 1000)
// // btnId: {
// // type: String,
// // default: ''
// // },
// // 后端返回列表参数名
// listName: {
// type: String,
// default: ''
// },
// // 标签-默认标签名为tag;若有多个,那么需要在表格栏的列中加“tagName”
// // tag: {
// // type: Array,
// // default: () => []
// // },
// // 表格操作,默认没有
// // tableOption: {
// // type: Object,
// // default: null
// // },
// // 表格栏
// tableColumns: {
// type: Array,
// default: () => []
// }
// }
// }
// }
// },
// mounted () {
// const btn = document.getElementById(this.tableParams.btnId)
// btn && btn.addEventListener('click', this.refreshEmit)
// this.getListApi && this.refreshTable()
// },
methods: {
// 排序
sortChange ({ column, prop, order }) {
this.sortColum = order ? prop : ''
this.sort = order
this.refreshTable()
},
// methods: {
// // 排序
// sortChange ({ column, prop, order }) {
// this.sortColum = order ? prop : ''
// this.sort = order
// this.refreshTable()
// },
// 多选
handleSelect (val) {
this.mutiSelectArr[this.tableParams.mutiSelectName] = val
},
// // 多选
// handleSelect (val) {
// this.mutiSelectArr[this.tableParams.mutiSelectName] = val
// },
// 清空多选
clearMutiSelect () {
this.mutiSelectArr[this.tableParams.mutiSelectName] = []
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
},
// // 清空多选
// clearMutiSelect () {
// this.mutiSelectArr[this.tableParams.mutiSelectName] = []
// this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
// },
// 发布事件,以期查询条件改变后,页面图表需要刷新
refreshEmit () {
this.$emit('searchChange')
this.refreshTable(true, true)
},
// // 发布事件,以期查询条件改变后,页面图表需要刷新
// refreshEmit () {
// this.$emit('searchChange')
// this.refreshTable(true, true)
// },
refreshTable (clearMuti = true, resetCurrentPage = false, callBack) {
this.beforeSearchFn().then(res => {
// console.log(res)
// 清空多选
clearMuti && this.clearMutiSelect()
this.loading = true
resetCurrentPage && (this.page.currentPage = 1)
var params = {
pageNum: this.page.currentPage,
pageStart: (this.page.currentPage - 1) * this.page.pageSize,
...this.page,
...this.searchForm
}
if (this.sort) {
params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0
}
// refreshTable (clearMuti = true, resetCurrentPage = false, callBack) {
// this.beforeSearchFn().then(res => {
// // console.log(res)
// // 清空多选
// clearMuti && this.clearMutiSelect()
// this.loading = true
// resetCurrentPage && (this.page.currentPage = 1)
// var params = {
// pageNum: this.page.currentPage,
// pageStart: (this.page.currentPage - 1) * this.page.pageSize,
// ...this.page,
// ...this.searchForm
// }
// if (this.sort) {
// params.sortColum = this.sortColum
// params.sort = this.sort === 'descending' ? 1 : 0
// }
Object.keys(params).map(key => {
if (!params[key]) delete params[key]
})
// console.log(params)
this.getListApi(params).then(({ data }) => {
this.data = data[this.tableParams.listName]
this.total = data.total
this.loading = false
if (callBack && typeof callBack == 'function') callBack()
}).catch(() => {
this.loading = false
})
}).catch(() => { })
},
// Object.keys(params).map(key => {
// if (!params[key]) delete params[key]
// })
// // console.log(params)
// this.getListApi(params).then(({ data }) => {
// this.data = data[this.tableParams.listName]
// this.total = data.total
// this.loading = false
// if (callBack && typeof callBack == 'function') callBack()
// }).catch(() => {
// this.loading = false
// })
// }).catch(() => { })
// },
// 每页条数
handleSizeChange (value) {
this.page.pageSize = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
},
// // 每页条数
// handleSizeChange (value) {
// this.page.pageSize = value
// this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
// },
// 页码
handleCurrentChange (value) {
this.page.currentPage = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
}
}
// // 页码
// handleCurrentChange (value) {
// this.page.currentPage = value
// this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
// }
// }
}
</script>
......
......@@ -43,7 +43,14 @@
</template>
</div>
<div class="tableWrap">
<d2-table :tableParams="tableParams" :tableData="tableData" :hasNum="false" :hasPage="false"></d2-table>
<GLTable v-if="tableData.length" :tableParams="tableParams" :tableData="tableData" :hasNum="false" :hasPage="false">
<div slot="imgText" slot-scope="scope">
<img class="goods-img" :src="scope.scope.goodsImage">
<div class="goods-info">{{scope.scope.brandName}}</div>
<div class="goods-info" v-if="scope.scope.appearance">{{scope.scope.productName}}{{scope.scope.denomination}}</div>
<div class="goods-info" v-else>{{scope.scope.productName}}{{scope.scope.productName}}</div>
</div>
</GLTable>
</div>
<div class="price-box">
<div class="price-item">
......@@ -132,50 +139,48 @@ export default {
tableColumns: [
{
label: '商品信息',
prop:'appearance',
addHtml:'imgText'
// minWidth: '300',
formatter: cell => {
let str = cell.appearance == 2 ? `<div>${cell.productName}${cell.denomination}</div>` : `<div>${cell.productName}</div>`
return `<div class="goods">
<div class="goods-img">
<img src="${cell.goodsImage}" >
</div>
<div class="goods-info">
<div>${cell.brandName}</div>
${str}
</div>
</div>`
}
// formatter: cell => {
// let str = cell.appearance == 2 ? `<div>${cell.productName}${cell.denomination}</div>` : `<div>${cell.productName}</div>`
// return `<div class="goods">
// <div class="goods-img">
// <img src="${cell.goodsImage}" >
// </div>
// <div class="goods-info">
// <div>${cell.brandName}</div>
// ${str}
// </div>
// </div>`
// }
},
{
label: '充值账号',
// prop: 'rechargeNumber',
prop: 'rechargeNumber'
},
{
label: '商品形态',
prop: 'appearanceDesc'
// minWidth: '200'
},
{
label: '单价/元',
prop: 'orderPrices'
// minWidth: '200'
prop: 'orderPrices',
align:'right'
},
{
label: '数量',
// minWidth: '200',
formatter: () => {
return 1
}
},
{
label: '小计/元',
prop: 'orderPrices'
// minWidth: '200'
prop: 'orderPrices',
align:'right'
},
{
label: '订单状态',
// minWidth: '200',
formatter: cell => {
return cell.appearance == 1 ? this.statusEnum[cell.orderStatus] : this.qb_statusEnum[cell.orderStatus]
}
......@@ -185,7 +190,6 @@ export default {
}
},
mounted() {
console.log(this.$route, '11111111')
this.params = { orderCode: this.$route.query.orderCode }
this.thirdOrderCode = this.$route.query.thirdOrderCode
this.getDetail(this.params)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!