Commit d2324703 by 李伟康

提交

1 parent 89ef5ac1
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<el-button <el-button
size="small" size="small"
@click="relateStoreVisible = true" @click="relateStoreVisible = true"
:disabled="pageObject.disabled" :disabled="pageObject.id"
> >
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
选择商户 选择商户
...@@ -75,13 +75,13 @@ ...@@ -75,13 +75,13 @@
target="_blank" target="_blank"
>下载模板</a> >下载模板</a>
</div> </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"> <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"> <div class="table-box">
<GLTable <GLTable
:tableData="importObject.detailList" :tableData="importObject.detailList"
...@@ -95,8 +95,8 @@ ...@@ -95,8 +95,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>
...@@ -110,7 +110,8 @@ ...@@ -110,7 +110,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>
...@@ -201,7 +202,10 @@ ...@@ -201,7 +202,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>
...@@ -234,7 +238,7 @@ ...@@ -234,7 +238,7 @@
<select-store <select-store
:dialogVisible.sync="relateStoreVisible" :dialogVisible.sync="relateStoreVisible"
:storeSelected="selectedList" :storeSelected="selectedList"
:merchantInfo="configForm.merchantId" :merchantInfo="configForm"
@handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose" @handleRelateStoreClose="handleRelateStoreClose"
/> />
...@@ -320,8 +324,10 @@ export default { ...@@ -320,8 +324,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}`
} }
}, },
{ {
...@@ -329,8 +335,10 @@ export default { ...@@ -329,8 +335,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}`
} }
}, },
{ {
...@@ -431,6 +439,7 @@ export default { ...@@ -431,6 +439,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) => {
...@@ -452,7 +461,9 @@ export default { ...@@ -452,7 +461,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)
} }
}, },
...@@ -462,11 +473,27 @@ export default { ...@@ -462,11 +473,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,
...@@ -474,8 +501,8 @@ export default { ...@@ -474,8 +501,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 = {
...@@ -486,16 +513,16 @@ export default { ...@@ -486,16 +513,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 || '操作失败')
} }
} }
}) })
...@@ -570,7 +597,7 @@ export default { ...@@ -570,7 +597,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)
...@@ -593,7 +620,7 @@ export default { ...@@ -593,7 +620,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,
...@@ -612,7 +639,7 @@ export default { ...@@ -612,7 +639,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
...@@ -621,12 +648,32 @@ export default { ...@@ -621,12 +648,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] = ''
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`
}
}
})
} }
} }
...@@ -766,6 +813,7 @@ export default { ...@@ -766,6 +813,7 @@ export default {
} }
.value { .value {
min-width: 90px; min-width: 90px;
color: #333333;
} }
} }
} }
......
...@@ -159,28 +159,24 @@ export default { ...@@ -159,28 +159,24 @@ export default {
}, },
methods: { methods: {
init () { init () {
this.merchantId = this.merchantInfo this.merchantId = String(this.merchantInfo.merchantId)
this.merchantName = this.merchantInfo.merchantName
this.getList() this.getList()
}, },
getList (pageCon) { getList (pageCon) {
console.log(pageCon, 'pageCon')
pageCon && (this.pageConfig = pageCon) pageCon && (this.pageConfig = pageCon)
var params = { var params = {
merchantId: this.merchantId, merchantId: this.merchantId,
...this.searchForm, ...this.searchForm,
...this.pageConfig ...this.pageConfig
} }
console.log(this.$apis)
this.$apis.common.getMerchantList(params).then(res => { this.$apis.common.getMerchantList(params).then(res => {
console.log(res)
this.storeList = res.list this.storeList = res.list
this.total = res.total this.total = res.total
let nowIndex = this.pageConfig.pageSize * (this.pageConfig.currentPage - 1) let nowIndex = this.pageConfig.pageSize * (this.pageConfig.currentPage - 1)
console.log(nowIndex)
this.storeList.forEach((item, index) => { this.storeList.forEach((item, index) => {
item.idx = index + 1 + nowIndex item.idx = index + 1 + nowIndex
}) })
console.log(this.storeList)
}) })
}, },
getTable () { getTable () {
...@@ -192,7 +188,6 @@ export default { ...@@ -192,7 +188,6 @@ export default {
this.$refs.staffRef.tableHeightValues = '460px' this.$refs.staffRef.tableHeightValues = '460px'
}, },
handleClick (val) { handleClick (val) {
console.log(val)
this.merchantId = val.merchantNo this.merchantId = val.merchantNo
this.merchantName = val.merchantName this.merchantName = val.merchantName
}, },
...@@ -204,10 +199,12 @@ export default { ...@@ -204,10 +199,12 @@ export default {
this.$emit('handleRelateStoreClose') this.$emit('handleRelateStoreClose')
}, },
handleConfirm () { handleConfirm () {
this.$emit('handleRelateStoreConfirm', { const { merchantId, merchantName } = this
merchantId: this.merchantId, if (merchantId && merchantName) this.$emit('handleRelateStoreConfirm', {
merchantName: this.merchantName merchantId,
merchantName
}) })
else this.handleClose()
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!