Commit 7b51862f by 李伟康

提交

1 parent 8551ebe2
......@@ -41,7 +41,6 @@
</el-button>
<input
type="file"
style="opacity: 0"
ref="file"
accept=".xlsx, .xlc, .xlm, .xls"
@change="uploadFile"
......@@ -54,15 +53,13 @@
target="_blank"
>下载模板</a>
</div>
<div class="file-info flex">
<template v-if="importObject.name">
<div class="el-icon-success"></div>
文件格式正确({{ importObject.name }})
</template>
</div>
<template v-if="importObject.detailList">
<div class="file-info flex">
<template v-if="importObject.name">
<div class="el-icon-success"></div>
文件格式正确({{ importObject.name }})
</template>
</div>
<div class="table-box">
<GLTable
:tableData="importObject.detailList"
......@@ -76,8 +73,8 @@
<template v-if="!pageObject.disabled">
<el-input
v-model.number.trim="scope.scope.cashBackValue"
:disabled="pageObject.disabled"
@blur="updateTotal(scope.scope, scope.index)"
@blur="updateTotal(scope.scope, scope.index,'cashBackValue')"
maxLength="6"
></el-input>
</template>
<template v-else>
......@@ -91,7 +88,8 @@
<template v-if="!pageObject.disabled">
<el-input
v-model.number.trim="scope.scope.buyValue"
@blur="updateTotal(scope.scope, scope.index)"
@blur="updateTotal(scope.scope, scope.index,'buyValue')"
maxLength="6"
></el-input>
</template>
<template v-else>
......@@ -182,7 +180,10 @@
class="item flex"
>
<div class="label">{{ i.label }}:</div>
<div class="value">
<div
class="value"
:ref="`value-${index}`"
>
<template v-if="i.formatter">
{{ i.formatter(totalForm) }}
</template>
......@@ -257,7 +258,8 @@ export default {
formData: [
{
label: '导入充值人群',
addHtml: 'table'
addHtml: 'table',
name: 'table'
},
],
totalForm: {
......@@ -276,7 +278,6 @@ export default {
name: 'total',
formatter: (cell) => {
const { total } = cell
console.log(total, '====')
return total.reduce((acc, cur) => acc + cur, 0)
}
},
......@@ -285,8 +286,10 @@ export default {
name: 'passageServiceCharge',
formatter: (cell) => {
const { passageService } = cell,
{ passageServiceCharge } = chargeObject
return NP.times(passageService.reduce((acc, cur) => acc + cur, 0), passageServiceCharge).toFixed(2)
{ passageServiceCharge } = chargeObject,
passageSum = passageService.reduce((acc, cur) => acc + cur, 0),
sum = NP.times(passageSum, passageServiceCharge).toFixed(2)
return `${passageSum}*${passageServiceCharge}%=${sum}`
}
},
{
......@@ -294,8 +297,10 @@ export default {
name: 'gasCardServiceCharge',
formatter: (cell) => {
const { gasService } = cell,
{ gasCardServiceCharge } = chargeObject
return NP.times(gasService.reduce((acc, cur) => acc + cur, 0), gasCardServiceCharge).toFixed(2)
{ gasCardServiceCharge } = chargeObject,
gasCardSum = gasService.reduce((acc, cur) => acc + cur, 0),
sum = NP.times(gasCardSum, gasCardServiceCharge).toFixed(2)
return `${gasCardSum}*${gasCardServiceCharge}%=${sum}`
}
},
{
......@@ -382,6 +387,7 @@ export default {
methods: {
async getDetail (id, type) {
try {
this.loading = true
const res = await this.$apis.points.getIntegralDetail({ id }),
{ detailList } = res
detailList.map((row, index) => {
......@@ -399,7 +405,9 @@ export default {
this.importObject = {
detailList
}
this.loading = false
} catch (error) {
this.loading = false
setTimeout(() => this.$router.go(-1), 1e3)
}
},
......@@ -409,11 +417,27 @@ export default {
this.$refs.fromRef.$refs.formRef.validate(async valid => {
if (valid) {
try {
this.$loading()
this.loading = true
const { merchantId, merchantName } = this.configForm,
list = this.importObject.detailList
let detailList = []
list.map(e => {
let oilList = [], couponList = []
e.oilList?.map(o => {
oilList.push({
oilCouponId: o.oilCouponId,
amount: o.amount,
faceValue: o.faceValue,
aliasName: o.aliasName
})
})
e.couponList?.map(c => {
couponList.push({
couponId: c.couponId,
amount: c.amount,
couponName: c.couponName
})
})
detailList.push({
policyNo: e.policyNo,
customerName: e.customerName,
......@@ -421,8 +445,8 @@ export default {
idCardNo: e.idCardNo,
cashBackValue: e.cashBackValue,
buyValue: e.buyValue,
oilList: e.oilList || [],
couponList: e.couponList || []
oilList,
couponList
})
})
let params = {
......@@ -433,16 +457,16 @@ export default {
if (id) params.id = id
const res = await this.$apis.points.updateCustomerIntegral(params)
if (res) {
this.$loading().close()
this.$message({
message: id ? '编辑成功' : '创建成功',
type: 'success'
})
setTimeout(() => this.$router.go(-1), 1e3)
} else throw '创建失败'
}
this.loading = false
} catch (error) {
this.$loading().close()
if (error) this.$message.error(error)
this.loading = false
this.$message.error(error || '操作失败')
}
}
})
......@@ -510,7 +534,7 @@ export default {
chargeObject[e.name] = val
}
})
this.totalKey = Date.now()
this.updateView()
}
} catch (error) {
if (error) this.$message.error(error)
......@@ -533,7 +557,7 @@ export default {
oilList && oilList.map(i => total += NP.times((i.amount || 0), (i.faceValue || 0)))
row.total = total
this.totalForm.total[index] = total
this.totalKey = Date.now()
this.updateView()
},
changeRowConfig ({
oilList,
......@@ -552,7 +576,7 @@ export default {
const { cashBackValue, buyValue } = row,
passageService = NP.plus((cashBackValue || 0), (buyValue || 0))
this.totalForm.passageService[index] = passageService
this.totalKey = Date.now()
this.updateView()
},
setGasService (row, index) {
const { oilList } = row
......@@ -561,14 +585,32 @@ export default {
total += NP.times((i.amount || 0), (i.faceValue || 0))
})
this.totalForm.gasService[index] = total
this.totalKey = Date.now()
this.updateView()
},
updateTotal (row, index) {
console.log(row, index, '====')
updateTotal (row, index, key) {
if (key && !/^[0-9]\d*$/.test(row[key])) row[key] = ''
this.setRowTotal(row, index)
this.setPassageService(row, index)
this.setGasService(row, index)
},
updateView () {
this.totalKey = Date.now()
const REF = this.$refs,
refLength = this.totalFormData.length
this.$nextTick(() => {
let widthList = []
for (let i = 0; i < refLength; i++) {
let [item] = REF[`value-${i}`] || []
if (item) widthList.push(item.offsetWidth)
}
if (widthList.length) {
const width = Math.max.apply(null, widthList)
for (let i = 0; i < refLength; i++) {
let [item] = REF[`value-${i}`] || []
if (item) item.style.width = `${width}px`
}
}
})
}
}
}
......@@ -609,6 +651,16 @@ export default {
}
.value {
min-width: 232px;
.status {
width: 6px;
height: 6px;
border-radius: 4px;
background: #fdb757;
margin-right: 8px;
}
.status-1 {
background: #2cca74;
}
}
}
}
......@@ -634,7 +686,7 @@ export default {
width: 100%;
height: 100%;
}
input {
.input {
cursor: pointer;
position: absolute;
height: 100%;
......@@ -642,6 +694,10 @@ export default {
top: 0px;
left: 0px;
font-size: 0px;
opacity: 0;
}
.is-disabled {
cursor: not-allowed;
}
}
a {
......@@ -689,6 +745,7 @@ export default {
}
.value {
min-width: 90px;
color: #333333;
}
}
}
......
......@@ -6,7 +6,7 @@
:before-close="handleClose"
>
<template #default>
<div class="importObj-content flex">
<div class="importObj-content">
<div class="success item">
<div class="num">{{importObj.successCount}}</div>
有效数据
......@@ -66,6 +66,7 @@ export default {
<style scoped lang='scss'>
.importObj-content {
height: 100%;
display: flex;
align-items: center;
.item {
flex: 1;
......
......@@ -35,6 +35,15 @@
>{{scope.scope.customerNumber}}</div>
</template>
<template
slot="totalIntegral"
slot-scope="scope"
>
<div class="totalIntegral">
{{scope.scope.totalIntegral}}
<div class="service">(含{{scope.scope.totalIntegral}}%手续费)</div>
</div>
</template>
<template
slot="status"
slot-scope="scope"
>
......@@ -76,7 +85,7 @@ export default {
policyNo: '',
customerName: '',
customerPhone: '',
createdDate: []
auditDate: []
},
searchFormData: [
{
......@@ -105,7 +114,7 @@ export default {
},
{
label: '发放时间',
name: 'createdDate',
name: 'auditDate',
type: 'datePicker',
valueFormat: 'yyyy-MM-dd',
isClear: true,
......@@ -152,7 +161,7 @@ export default {
},
{
label: '操作人',
prop: 'createdBy',
prop: 'updatedBy',
minWidth: 150,
},
]
......@@ -204,7 +213,7 @@ export default {
},
getParams () {
let params = JSON.parse(JSON.stringify(this.searchForm))
this.setTimeFormat(params, 'createdDate', 'createdDateBegin', 'createdDateEnd')
this.setTimeFormat(params, 'auditDate', 'auditDateBegin', 'auditDateEnd')
return params
},
setTimeFormat (target, name, start, end) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!