Commit 356d66c2 by 李伟康

增加分页

1 parent 323601ef
...@@ -85,10 +85,13 @@ ...@@ -85,10 +85,13 @@
<div class="table-box"> <div class="table-box">
<div class="table"> <div class="table">
<GLTable <GLTable
:tableData="importObject.detailList" :tableData="importObject.detailList[pageNum - 1]"
:tableParams="tableParams" :tableParams="tableParams"
:hasPage="false"
ref="listRef" ref="listRef"
:pageConf="pageConf"
:tableTotal="totalForm.customerTotal"
:pageSizes="[50]"
@refreshTable="refreshTable"
> >
<template <template
slot="cashBackValue" slot="cashBackValue"
...@@ -290,6 +293,7 @@ export default { ...@@ -290,6 +293,7 @@ export default {
return { return {
NP, NP,
loading: false, loading: false,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
relateStoreVisible: false, relateStoreVisible: false,
rule: { rule: {
merchantId: [{ required: true, message: '请选择商户', trigger: 'change' }], merchantId: [{ required: true, message: '请选择商户', trigger: 'change' }],
...@@ -297,8 +301,10 @@ export default { ...@@ -297,8 +301,10 @@ export default {
required: true, trigger: 'change', validator: (rule, value, callback) => { required: true, trigger: 'change', validator: (rule, value, callback) => {
const { detailList } = this.importObject const { detailList } = this.importObject
if (detailList && detailList.length) { if (detailList && detailList.length) {
detailList.map(e => { detailList.map(i => {
if (e.cashBackValue < 1 && e.buyValue < 1) callback(new Error('返现金额和商品兑换积分二者至少需填写一个正整数的数值')) i.map(e => {
if (e.cashBackValue < 1 && e.buyValue < 1) callback(new Error('返现金额和商品兑换积分二者至少需填写一个正整数的数值'))
})
}) })
callback() callback()
} else callback(new Error('请导入充值人群')) } else callback(new Error('请导入充值人群'))
...@@ -450,7 +456,8 @@ export default { ...@@ -450,7 +456,8 @@ export default {
chargeObject: { chargeObject: {
gasCardServiceCharge: 0, gasCardServiceCharge: 0,
passageServiceCharge: 0 passageServiceCharge: 0
} },
pageNum: 1
} }
}, },
mounted () { mounted () {
...@@ -458,6 +465,9 @@ export default { ...@@ -458,6 +465,9 @@ export default {
if (id) this.getDetail(id, type) if (id) this.getDetail(id, type)
}, },
methods: { methods: {
refreshTable ({ pageNum }) {
this.pageNum = pageNum
},
async getDetail (id, type) { async getDetail (id, type) {
try { try {
this.loading = true this.loading = true
...@@ -482,10 +492,12 @@ export default { ...@@ -482,10 +492,12 @@ export default {
passageServiceCharge: res.integralRate passageServiceCharge: res.integralRate
}) })
this.totalForm.customerTotal = detailList.length this.totalForm.customerTotal = detailList.length
const list = this.splitArray(detailList, 50)
this.importObject = { this.importObject = {
detailList detailList: list
} }
this.loading = false this.loading = false
this.pageNum = 1
this.setTableHeight(detailList) this.setTableHeight(detailList)
} catch (error) { } catch (error) {
this.loading = false this.loading = false
...@@ -502,32 +514,34 @@ export default { ...@@ -502,32 +514,34 @@ export default {
const { merchantId, merchantName } = this.configForm, const { merchantId, merchantName } = this.configForm,
list = this.importObject.detailList list = this.importObject.detailList
let detailList = [] let detailList = []
list.map(e => { list.map(i => {
let oilList = [], couponList = [] i.map(e => {
e.oilList?.map(o => { let oilList = [], couponList = []
oilList.push({ e.oilList?.map(o => {
oilCouponId: o.oilCouponId, oilList.push({
amount: o.amount, oilCouponId: o.oilCouponId,
faceValue: o.faceValue, amount: o.amount,
aliasName: o.aliasName faceValue: o.faceValue,
aliasName: o.aliasName
})
}) })
}) e.couponList?.map(c => {
e.couponList?.map(c => { couponList.push({
couponList.push({ couponId: c.couponId,
couponId: c.couponId, amount: c.amount,
amount: c.amount, couponName: c.couponName
couponName: c.couponName })
})
detailList.push({
policyNo: e.policyNo,
customerName: e.customerName,
customerPhone: e.customerPhone,
idCardNo: e.idCardNo,
cashBackValue: e.cashBackValue || 0,
buyValue: e.buyValue || 0,
oilList,
couponList
}) })
})
detailList.push({
policyNo: e.policyNo,
customerName: e.customerName,
customerPhone: e.customerPhone,
idCardNo: e.idCardNo,
cashBackValue: e.cashBackValue || 0,
buyValue: e.buyValue || 0,
oilList,
couponList
}) })
}) })
let params = { let params = {
...@@ -577,8 +591,9 @@ export default { ...@@ -577,8 +591,9 @@ export default {
detailList.map((row, index) => { detailList.map((row, index) => {
this.updateTotal(row, index) this.updateTotal(row, index)
}) })
const list = this.splitArray(detailList, 50)
this.importObject = { this.importObject = {
detailList, detailList: list,
name: file.name name: file.name
} }
this.$message({ this.$message({
...@@ -586,6 +601,7 @@ export default { ...@@ -586,6 +601,7 @@ export default {
type: 'success' type: 'success'
}) })
this.totalForm.customerTotal = detailList.length this.totalForm.customerTotal = detailList.length
this.pageNum = 1
this.validateField('table') this.validateField('table')
this.setTableHeight(detailList) this.setTableHeight(detailList)
} else this.importObj = { } else this.importObj = {
...@@ -605,9 +621,7 @@ export default { ...@@ -605,9 +621,7 @@ export default {
} }
}, },
setTableHeight (detailList = []) { setTableHeight (detailList = []) {
const { listRef } = this.$refs, const { listRef } = this.$refs
{ id } = this.pageObject,
height = id ? 56 : 67.39
if (listRef) { if (listRef) {
let length = detailList.length let length = detailList.length
listRef.tableHeightValues = `${(length > 10 ? 10 : length) * 56 + 56}px` listRef.tableHeightValues = `${(length > 10 ? 10 : length) * 56 + 56}px`
...@@ -722,6 +736,14 @@ export default { ...@@ -722,6 +736,14 @@ export default {
return name == 'oilList' ? `${i.aliasName}*${i.amount} (${NP.times(i.amount, i.faceValue)}积分)` : `${i.couponName}*${i.amount}` return name == 'oilList' ? `${i.aliasName}*${i.amount} (${NP.times(i.amount, i.faceValue)}积分)` : `${i.couponName}*${i.amount}`
}) || [] }) || []
}, },
splitArray (arr, size) {
let result = [],
newArr = JSON.parse(JSON.stringify(arr))
for (let i = 0; i < newArr.length; i += size) {
result.push(newArr.slice(i, i + size))
}
return result
}
} }
} }
...@@ -873,4 +895,13 @@ export default { ...@@ -873,4 +895,13 @@ export default {
color: #5850ff; color: #5850ff;
cursor: pointer; cursor: pointer;
} }
/deep/.el-pagination__sizes {
width: 88px;
.el-select {
width: 100%;
.el-input {
width: 100%;
}
}
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!