Commit 3bab88b8 by 杨北旺

更换订单详情表格展示

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