Commit 85fedc07 by 李伟康

提交

1 parent e2e62ce9
......@@ -54,17 +54,18 @@
>下载模板</a>
</div>
<template v-if="importObject.detailList">
<div class="file-info flex">
<template v-if="importObject.name">
<template v-if="importObject.name">
<div class="file-info flex">
<div class="el-icon-success"></div>
文件格式正确({{ importObject.name }})
</template>
</div>
</div>
</template>
<div class="table-box">
<GLTable
:tableData="importObject.detailList"
:tableParams="tableParams"
:hasPage="false"
ref="listRef"
>
<template
slot="cashBackValue"
......@@ -102,16 +103,23 @@
>
<template v-if="scope.scope.oilList && scope.scope.oilList.length">
<div class="flex">
<div class="list">
<template v-for="(i, index) in scope.scope.oilList">
<template>
<div
:key="index"
class="item flex"
>{{ i.aliasName }}*{{ i.amount }} ({{ NP.times(i.amount, i.faceValue) }}积分)</div>
</template>
</template>
</div>
<span>{{ filterData(scope.scope.oilList,'oilList').slice(0, 1).join('、') }}</span>
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.oilList,'oilList')"
:key="index"
>
{{item}}
</div>
<span
class="more-info"
slot="reference"
>...({{ scope.scope.oilList.length }})</span>
</el-popover>
<template v-if="!pageObject.disabled">
<el-button
type="text"
......@@ -138,16 +146,23 @@
>
<template v-if="scope.scope.couponList && scope.scope.couponList.length">
<div class="flex">
<div class="list">
<template v-for="(i, index) in scope.scope.couponList">
<template>
<div
:key="index"
class="item flex"
>{{ i.couponName }}*{{ i.amount }}</div>
</template>
</template>
</div>
<span>{{ filterData(scope.scope.couponList,'couponList').slice(0, 1).join('、') }}</span>
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.couponList,'couponList')"
:key="index"
>
{{item}}
</div>
<span
class="more-info"
slot="reference"
>...({{ scope.scope.couponList.length }})</span>
</el-popover>
<template v-if="!pageObject.disabled">
<el-button
type="text"
......@@ -224,10 +239,6 @@
import NP from 'number-precision'
import pointsConfig from './components/pointsConfig.vue'
import importErrDialog from './components/importErrDialog.vue'
let chargeObject = {
gasCardServiceCharge: 0,
passageServiceCharge: 0
}
export default {
components: {
pointsConfig,
......@@ -286,9 +297,9 @@ export default {
name: 'passageServiceCharge',
formatter: (cell) => {
const { passageService } = cell,
{ passageServiceCharge } = chargeObject,
{ passageServiceCharge } = this.chargeObject,
passageSum = passageService.reduce((acc, cur) => acc + cur, 0),
sum = NP.times(passageSum, NP.divide(passageServiceCharge, 100)).toFixed(2)
sum = NP.times(passageSum, passageServiceCharge, 0.01).toFixed(2)
return `${passageSum}*${passageServiceCharge}%=${sum}`
}
},
......@@ -297,9 +308,9 @@ export default {
name: 'gasCardServiceCharge',
formatter: (cell) => {
const { gasService } = cell,
{ gasCardServiceCharge } = chargeObject,
{ gasCardServiceCharge } = this.chargeObject,
gasCardSum = gasService.reduce((acc, cur) => acc + cur, 0),
sum = NP.times(gasCardSum, NP.divide(gasCardServiceCharge, 100)).toFixed(2)
sum = NP.times(gasCardSum, gasCardServiceCharge, 0.01).toFixed(2)
return `${gasCardSum}*${gasCardServiceCharge}%=${sum}`
}
},
......@@ -308,9 +319,9 @@ export default {
name: 'sum',
formatter: (cell) => {
const { total, gasService, passageService } = cell,
{ gasCardServiceCharge, passageServiceCharge } = chargeObject,
gasPrice = NP.times(gasService.reduce((acc, cur) => acc + cur, 0), NP.divide(gasCardServiceCharge, 100)),
passagePrice = NP.times(passageService.reduce((acc, cur) => acc + cur, 0), NP.divide(passageServiceCharge, 100)),
{ gasCardServiceCharge, passageServiceCharge } = this.chargeObject,
gasPrice = NP.times(gasService.reduce((acc, cur) => acc + cur, 0), gasCardServiceCharge, 0.01),
passagePrice = NP.times(passageService.reduce((acc, cur) => acc + cur, 0), passageServiceCharge, 0.01),
totalPrice = total.reduce((acc, cur) => acc + cur, 0)
return NP.plus(gasPrice, passagePrice, totalPrice).toFixed(2)
......@@ -322,7 +333,7 @@ export default {
{
label: '保单号',
prop: 'policyNo',
minWidth: 100
minWidth: 200
},
{
label: '用户姓名',
......@@ -332,7 +343,7 @@ export default {
{
label: '身份证号',
prop: 'idCardNo',
minWidth: 100
minWidth: 200
},
{
label: '用户手机号',
......@@ -341,13 +352,13 @@ export default {
},
{
label: '返现金额',
minWidth: 200,
minWidth: 128,
addHtml: 'cashBackValue',
},
{
label: '商品兑换积分',
addHtml: 'buyValue',
minWidth: 200
minWidth: 128
},
{
label: '赠送油券',
......@@ -376,20 +387,29 @@ export default {
disabled: false,
batchNo: '',
status: ''
},
chargeObject: {
gasCardServiceCharge: 0,
passageServiceCharge: 0
}
}
},
mounted () {
const { id, type } = this.$route.query
if (id) this.getDetail(id, type)
this.getMerchantCharge()
else this.getMerchantCharge()
},
methods: {
async getDetail (id, type) {
try {
this.loading = true
const res = await this.$apis.points.getIntegralDetail({ id }),
{ detailList } = res
{ detailList, merchantId, merchantName } = res
this.configForm = {
merchantId,
merchantName
}
this.getMerchantCharge()
detailList.map((row, index) => {
this.setRowTotal(row, index)
this.setPassageService(row, index)
......@@ -406,6 +426,7 @@ export default {
detailList
}
this.loading = false
this.setTableHeight(detailList)
} catch (error) {
this.loading = false
setTimeout(() => this.$router.go(-1), 1e3)
......@@ -478,12 +499,14 @@ export default {
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = async event => {
this.loading = true
this.$refs.file.value = ''
const imgFile = event.target.result,
[, arrBase64] = imgFile.split(','),
splitStr = file.name.split('.'),
fileUrl = splitStr.at(-1) + '@' + arrBase64,
{ code, message, data } = await this.$apis.points.importCustomerIntegral({ file: fileUrl })
this.loading = false
if (code == 0) {
const { importStatue,
detailList,
......@@ -504,6 +527,7 @@ export default {
})
this.totalForm.customerTotal = detailList.length
this.validateField('table')
this.setTableHeight(detailList)
} else this.importObj = {
errorCount,
errorUrl,
......@@ -511,14 +535,25 @@ export default {
show: true
}
}
else throw message || ''
else this.$message.error(message)
}
} catch (error) {
this.loading = false
this.$refs.file.value = ''
if (error) this.$message.error(error)
}
},
setTableHeight (detailList = []) {
const { listRef } = this.$refs,
{ id } = this.pageObject,
height = id ? 56 : 67.39
if (listRef) {
let length = detailList.length
listRef.tableHeightValues = `${(length > 10 ? 10 : length) * height + 56}px`
} else setTimeout(() => {
this.setTableHeight(detailList)
}, 100)
},
validateField (id) {
this.$refs.fromRef.$refs.formRef.validateField(id)
},
......@@ -529,8 +564,9 @@ export default {
if (res) {
this.totalFormData.map(e => {
if (['gasCardServiceCharge', 'passageServiceCharge'].includes(e.name)) {
e.label = e.label.replace(/\d+/g, res[e.name] || 0)
chargeObject[e.name] = res[e.name] || 0
const val = res[e.name] || 0
e.label = e.label.replace(/\d+/g, val)
this.chargeObject[e.name] = val
}
})
this.updateView()
......@@ -610,7 +646,12 @@ export default {
}
}
})
}
},
filterData (list, name) {
return list?.map(i => {
return name == 'oilList' ? `${i.aliasName}*${i.amount} (${NP.times(i.amount, i.faceValue)}积分)` : `${i.couponName}*${i.amount}`
}) || []
},
}
}
</script>
......@@ -707,20 +748,24 @@ export default {
}
}
.file-info {
height: 32px;
height: 20px;
font-size: 14px;
color: #999999;
align-items: center;
margin-top: 10px;
.el-icon-success {
color: #67c23a;
line-height: 32px;
line-height: 20px;
margin-right: 4px;
}
}
.table-box {
width: 864px;
min-width: 864px;
max-width: calc(100vw - 446px);
background: #f9f9f9;
border-radius: 4px;
padding: 20px;
margin-top: 10px;
/deep/ .el-input {
width: 100%;
}
......@@ -752,4 +797,9 @@ export default {
display: flex;
align-items: center;
}
.more-info {
white-space: nowrap;
color: #5850ff;
cursor: pointer;
}
</style>
\ No newline at end of file
......@@ -23,18 +23,23 @@
<template v-if="scope.scope.oilList && scope.scope.oilList.length">
<div class="flex">
<div class="list">
<template v-for="(i,index) in scope.scope.oilList">
<template>
<div
:key="index"
class="item flex"
>
{{i.aliasName}}*{{i.amount}} ({{NP.times(i.amount, i.faceValue)}}积分)
</div>
</template>
</template>
</div>
<span>{{ filterData(scope.scope.oilList,'oilList').slice(0, 1).join('、') }}</span>
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.oilList,'oilList')"
:key="index"
>
{{item}}
</div>
<span
class="more-info"
slot="reference"
>...({{ scope.scope.oilList.length }})</span>
</el-popover>
</div>
</template>
<template v-else>
......@@ -47,18 +52,23 @@
>
<template v-if="scope.scope.couponList && scope.scope.couponList.length">
<div class="flex">
<div class="list">
<template v-for="(i,index) in scope.scope.couponList">
<template>
<div
:key="index"
class="item flex"
>
{{i.couponName}}*{{i.amount}}
</div>
</template>
</template>
</div>
<span>{{ filterData(scope.scope.couponList,'couponList').slice(0, 1).join('、') }}</span>
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.couponList,'couponList')"
:key="index"
>
{{item}}
</div>
<span
class="more-info"
slot="reference"
>...({{ scope.scope.couponList.length }})</span>
</el-popover>
</div>
</template>
<template v-else>
......@@ -94,7 +104,7 @@ export default {
{
label: '保单号',
prop: 'policyNo',
minWidth: 100
minWidth: 200
},
{
label: '用户姓名',
......@@ -103,7 +113,7 @@ export default {
},
{
label: '身份证号',
minWidth: 100,
minWidth: 200,
prop: 'idCardNo',
},
{
......@@ -150,17 +160,27 @@ export default {
methods: {
beforeSearchFn () {
return new Promise(resolve => {
this.searchForm.batchNo = this.detailObj.batchNo
this.searchForm.recordId = this.detailObj.recordId
this.loading = false
resolve()
})
},
handleClose () {
this.$emit('update:detailObj', {})
}
},
filterData (list, name) {
return list?.map(i => {
return name == 'oilList' ? `${i.aliasName}*${i.amount} (${NP.times(i.amount, i.faceValue)}积分)` : `${i.couponName}*${i.amount}`
}) || []
},
}
}
</script>
<style scoped lang='scss'>
.more-info {
white-space: nowrap;
color: #5850ff;
cursor: pointer;
}
</style>
\ No newline at end of file
......@@ -13,8 +13,12 @@
type="default"
plain
@click="jump"
size="small"
>客户积分充值</el-button>
<el-button @click="handleExport">导出
<el-button
@click="handleExport"
size="small"
>导出
</el-button>
</div>
<div class="tabelList">
......@@ -24,6 +28,7 @@
:searchForm="tableSearchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
>
<template
slot="customerNumber"
......@@ -31,7 +36,7 @@
>
<div
class="link"
@click="openDetail(scope.scope.batchNo)"
@click="openDetail(scope.scope.id)"
>{{scope.scope.customerNumber}}</div>
</template>
<template
......@@ -85,7 +90,8 @@ export default {
policyNo: '',
customerName: '',
customerPhone: '',
auditDate: []
auditDate: [],
merchantId: this.$globalState.session.merchantId
},
searchFormData: [
{
......@@ -197,8 +203,14 @@ export default {
mounted () {
},
methods: {
beforeSearchFn () {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
handleSearch () {
this.tableSearchForm = this.getParams()
// this.tableSearchForm = this.getParams()
this.$refs.listRef.refreshTable()
},
handleReset () {
......@@ -231,10 +243,10 @@ export default {
}
})
},
openDetail (batchNo) {
openDetail (recordId) {
this.detailObj = {
show: true,
batchNo
recordId
}
},
editForm (row, type = '') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!