Commit 7b51862f by 李伟康

提交

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