Commit 845722aa by wusiyi

feat:客户余额管理新增编辑备注,优化操作日志

parent 2b17f357
......@@ -24,9 +24,7 @@ export function customerBalanceDelete(params) {
}
// 客户余额管理 查询全部操作日志
export function getLogListApi(params) {
return axios.post(
'/business/customerBalanceOptLogs/list?customerBalanceId=' + params
)
return axios.post('business/customerBalanceOptLogs/list_page', params)
}
// 客户余额管理 分页查询全部扣费明细
export function getChargerRecordsApi(params) {
......
......@@ -88,18 +88,44 @@
align="center"
width="150"
:show-overflow-tooltip="true"></el-table-column>
<!-- <el-table-column
<el-table-column
label="折扣(%)"
prop="discountRate"
align="center"
width="150"
:show-overflow-tooltip="true"></el-table-column> -->
:show-overflow-tooltip="true">
<template slot-scope="scope">
<div class="cell-flex">
<span class="cell-left">{{ scope.row.discountRate }}</span>
<span class="cell-right">
<i
class="el-icon-edit-outline"
style="cursor: pointer; color: #e6a23c; font-size: 20px"
title="编辑"
@click="editDiscountRate(scope.row)" />
</span>
</div>
</template>
</el-table-column>
<el-table-column
label="授信额度(元)"
prop="lineCredit"
align="center"
width="150"
:show-overflow-tooltip="true"></el-table-column>
:show-overflow-tooltip="true">
<template slot-scope="scope">
<div class="cell-flex">
<span class="cell-left">{{ scope.row.lineCredit }}</span>
<span class="cell-right">
<i
class="el-icon-edit-outline"
style="cursor: pointer; color: #e6a23c; font-size: 20px"
title="编辑"
@click="editLineCredit(scope.row)" />
</span>
</div>
</template>
</el-table-column>
<el-table-column
label="余额(元)"
prop="balance"
......@@ -128,7 +154,7 @@
label="操作"
align="center"
header-align="center"
width="130"
width="100"
fixed="right">
<template slot-scope="scope">
<div
......@@ -139,11 +165,6 @@
font-size: 20px;
">
<i
class="el-icon-edit"
style="cursor: pointer; color: #e6a23c"
title="编辑"
@click="handleEdit(scope.row)"></i>
<i
class="el-icon-coin"
title="手动充值"
@click="handleRecharge(scope.row)"
......@@ -173,61 +194,109 @@
@size-change="sizeChange"
@current-change="onCurrentChange"></el-pagination>
</div>
<!-- 编辑 弹窗 -->
<!-- 编辑折扣 弹窗 -->
<el-dialog
title="编辑"
:visible.sync="editVisible"
title="修改折扣"
:visible.sync="editDiscountVisible"
width="700px"
@submit.native.prevent
:close-on-click-modal="false">
<el-form
:model="editForm"
:model="editDiscountForm"
size="small"
ref="editForm"
ref="editDiscountForm"
label-width="150px"
label-position="right">
<!-- <el-form-item
<el-form-item
label="折扣(%)"
type="number"
prop="discountRate"
:rules="[{ validator: validateDiscount, trigger: 'blur' }]">
:rules="[
{ required: 'true', message: '请输入折扣', trigger: 'blur' },
{
validator: validateDiscount,
trigger: 'blur'
},
{ validator: validateDiscountSame, trigger: 'blur' }
]">
<el-input
type="number"
min="0"
max="100"
v-model="editForm.discountRate"
v-model="editDiscountForm.discountRate"
size="small"
placeholder="请输入折扣" />
</el-form-item> -->
</el-form-item>
<el-form-item
label="备注"
prop="remark"
:rules="[
{ required: 'true', message: '请输入备注', trigger: 'blur' },
{ max: 100, message: '不能超过100字', trigger: 'blur' }
]">
<el-input
type="textarea"
class="textRemark"
size="small"
v-model="editDiscountForm.remark" />
</el-form-item>
</el-form>
<span slot="footer">
<el-button @click="editDiscountVisible = false" size="small">
取消
</el-button>
<el-button @click="editDiscountSave" type="primary" size="small">
保存
</el-button>
</span>
</el-dialog>
<!-- 编辑授信额度 弹窗 -->
<el-dialog
title="修改授信额度"
:visible.sync="editLineCreditVisible"
width="700px"
@submit.native.prevent
:close-on-click-modal="false">
<el-form
:model="editLineCreditForm"
size="small"
ref="editLineCreditForm"
label-width="150px"
label-position="right">
<el-form-item
label="授信额度(元)"
type="number"
prop="lineCredit"
:rules="[{ validator: validateBalance, trigger: 'blur' }]">
:rules="[
{ required: 'true', message: '请输入授信额度', trigger: 'blur' },
{ validator: validateBalance, trigger: 'blur' },
{ validator: validateLineCreditSame, trigger: 'blur' }
]">
<el-input
type="number"
min="0"
v-model="editForm.lineCredit"
size="small"
placeholder="请输入授信额度" />
v-model="editLineCreditForm.lineCredit"
size="small" />
</el-form-item>
<el-form-item label="余额(元)" prop="balance">
<el-input
v-model="editForm.balance"
size="small"
:disabled="true"
style="cursor: not-allow" />
</el-form-item>
<el-form-item label="消费金额(元)" prop="consumptionAmount">
<el-form-item
label="备注"
prop="remark"
:rules="[
{ required: 'true', message: '请输入备注', trigger: 'blur' },
{ max: 100, message: '不能超过100字', trigger: 'blur' }
]">
<el-input
v-model="editForm.consumptionAmount"
type="textarea"
class="textRemark"
size="small"
:disabled="true" />
v-model="editLineCreditForm.remark" />
</el-form-item>
</el-form>
<span slot="footer">
<el-button @click="editVisible = false" size="small">取消</el-button>
<el-button @click="editSave" type="primary" size="small">
<el-button @click="editLineCreditVisible = false" size="small">
取消
</el-button>
<el-button @click="editLineCreditSave" type="primary" size="small">
保存
</el-button>
</span>
......@@ -263,6 +332,19 @@
size="small"
placeholder="请输入充值金额(元)" />
</el-form-item>
<el-form-item
label="备注"
prop="remark"
:rules="[
{ required: 'true', message: '请输入备注', trigger: 'blur' },
{ max: 100, message: '不能超过100字', trigger: 'blur' }
]">
<el-input
type="textarea"
class="textRemark"
size="small"
v-model="rechargeForm.remark" />
</el-form-item>
</el-form>
<span slot="footer">
<el-button @click="rechargeVisible = false" size="small">
......@@ -276,7 +358,10 @@
<!-- 操作日志 弹窗 -->
<el-dialog title="操作日志" :visible.sync="logVisible" width="900px">
<ul style="color: #333; font-size: 14px; height: 600px; overflow: auto">
<li v-for="(item, index) in logList" :key="index" style="height: 30px">
<li
v-for="(item, index) in logList"
:key="index"
style="padding-top: 10px">
({{ index + 1 }})
{{
item.createTime.replace('T', ' ') +
......@@ -287,6 +372,16 @@
}}
</li>
</ul>
<div class="pagination">
<el-pagination
layout="sizes, total, prev, pager, next, jumper"
background
:total="totalLog"
:page-size="logPageSize"
:current-page="currentLogPage"
@size-change="logSizeChange"
@current-change="onLogCurrentChange" />
</div>
</el-dialog>
<!-- 扣费明细 弹窗 -->
<el-dialog
......@@ -309,7 +404,7 @@
</el-form-item>
<el-form-item label="支付款项">
<el-select
style="width: 150px"
style="width: 200px"
v-model="searchRecordsForm.chargeType"
clearable
placeholder="请选择支付款项">
......@@ -322,7 +417,7 @@
</el-form-item>
<el-form-item label="支付方式">
<el-select
style="width: 150px"
style="width: 200px"
clearable
v-model="searchRecordsForm.payMode"
placeholder="请选择支付方式">
......@@ -469,12 +564,12 @@ export default {
return {
searchForm: {},
rechargeForm: {},
editForm: {},
editDiscountForm: {},
editLineCreditForm: {},
searchRecordsForm: {},
balanceList: [],
logList: [],
chargerRecordsList: [],
namespace: '',
selection: [],
payModeListMap: {
1: '支付宝',
......@@ -485,14 +580,19 @@ export default {
2: 'POD(US)',
3: '一件定制'
},
currentRow: {},
loading: false,
totalAmount: 0,
total: 0,
currentPage: 1,
pageSize: 50,
editVisible: false,
editDiscountVisible: false,
editLineCreditVisible: false,
rechargeVisible: false,
logVisible: false,
totalLog: 0,
logPageSize: 50,
currentLogPage: 1,
recordsVisible: false,
totalRecords: 0,
currentRecordsPage: 1,
......@@ -531,6 +631,17 @@ export default {
this.currentRecordsPage = currentPage
this.getChargerLog()
},
// 操作日志分页
logSizeChange(pageSize) {
this.logPageSize = pageSize
this.currentLogPage = 1
this.getLogs()
},
onLogCurrentChange(currentPage) {
this.currentLogPage = currentPage
this.getLogs()
},
// 获取列表数据
async getList() {
this.loading = true
......@@ -548,25 +659,50 @@ export default {
this.loading = false
}
},
// 编辑
async handleEdit(row) {
this.editForm = row
this.editVisible = true
// 编辑折扣
async editDiscountRate(row) {
this.currentRow = row
this.editDiscountForm = JSON.parse(JSON.stringify(row))
this.editDiscountVisible = true
},
// 编辑折扣提交
async editDiscountSave() {
this.$refs.editDiscountForm.validate(async (valid) => {
if (!valid) {
return
}
try {
await editCustomerBalanceApi({ ...this.editDiscountForm })
} catch (e) {
console.log(e)
} finally {
this.editDiscountVisible = false
this.currentPage = 1
this.editDiscountForm = {}
await this.getList()
}
})
},
// 编辑授信额度
async editLineCredit(row) {
this.currentRow = row
this.editLineCreditForm = JSON.parse(JSON.stringify(row))
this.editLineCreditVisible = true
},
// 编辑提交
async editSave() {
this.$refs.editForm.validate(async (valid) => {
// 编辑授信额度提交
async editLineCreditSave() {
this.$refs.editLineCreditForm.validate(async (valid) => {
if (!valid) {
return
}
try {
await editCustomerBalanceApi({ ...this.editForm })
await editCustomerBalanceApi({ ...this.editLineCreditForm })
} catch (e) {
console.log(e)
} finally {
this.editVisible = false
this.editLineCreditVisible = false
this.currentPage = 1
this.editForm = {}
this.editLineCreditForm = {}
await this.getList()
}
})
......@@ -624,28 +760,51 @@ export default {
if (value === '' || value === null || value === undefined) {
callback()
} else if (Number(value) < 0) {
callback(new Error('值不能小于0'))
callback(new Error('金额不能小于0'))
} else {
callback()
}
},
validateLineCreditSame(rule, value, callback) {
if (this.currentRow.lineCredit === value) {
callback(new Error('授信额度未修改'))
} else {
callback()
}
},
// 折扣校验
// validateDiscount(rule, value, callback) {
// if (value === '' || value === null || value === undefined) {
// callback()
// } else if (Number(value) < 0 || Number(value) > 100) {
// callback(new Error('值需要介于0到100之间'))
// } else {
// callback()
// }
// },
validateDiscount(rule, value, callback) {
if (value === '' || value === null || value === undefined) {
callback()
} else if (Number(value) < 0 || Number(value) > 100) {
callback(new Error('折扣需要介于0到100之间'))
} else {
callback()
}
},
validateDiscountSame(rule, value, callback) {
if (this.currentRow.discountRate === value) {
callback(new Error('折扣未修改'))
} else {
callback()
}
},
// 查看操作日志
async handleLog(row) {
handleLog(row) {
this.currentRow = row
this.getLogs()
},
async getLogs() {
try {
const res = await getLogListApi(row.id)
this.logList = res.data
const res = await getLogListApi({
customerBalanceId: this.currentRow.id,
pageSize: this.logPageSize,
currentPage: this.currentLogPage
})
this.logList = res.data.records
if (this.logList.length) {
this.logVisible = true
this.totalLog = res.data.total
} else {
this.$message.warning('暂无数据')
}
......@@ -654,7 +813,7 @@ export default {
}
},
handleChargerLog(row) {
this.namespace = row.namespace
this.currentRow = row
this.getChargerLog()
},
getChargeTypeText(type) {
......@@ -666,20 +825,22 @@ export default {
const data = {
pageSize: this.recordsPageSize,
currentPage: this.currentRecordsPage,
namespace: this.namespace,
namespace: this.currentRow.namespace,
...this.searchRecordsForm
}
if (this.searchRecordsForm.daterange?.length) {
data.createTimeStart = this.searchRecordsForm.daterange[0]
data.createTimeEnd = this.searchRecordsForm.daterange[1]
}
const res = await getChargerRecordsApi(data)
const [res, totalRes] = await Promise.all([
getChargerRecordsApi(data),
getChargerRecordsTotalApi(data)
])
this.chargerRecordsList = res.data.records
const totalRes = await getChargerRecordsTotalApi(data)
this.totalAmount = totalRes.data.feesSum
if (this.chargerRecordsList.length) {
this.totalRecords = res.data.total
this.totalAmount = totalRes.data.feesSum
this.chargerRecordsList.forEach((item) => {
item.bizNo = item.bizNo.replaceAll(',', '\n')
})
......@@ -747,35 +908,55 @@ export default {
content: '';
}
}
}
.recordsDialog {
margin: 10px;
.pagination {
.cell-flex {
display: flex;
align-items: center;
justify-content: center; /* 让el-pagination居中 */
position: relative;
min-height: 50px; /* 根据实际高度调整 */
width: 100%;
padding: 0 8px;
.cell-left,
.cell-right {
display: flex;
justify-content: center;
}
.cell-left {
width: 80%;
}
.cell-right {
width: 20%;
}
}
}
.pagination {
display: flex;
align-items: center;
justify-content: center; /* 让el-pagination居中 */
position: relative;
min-height: 50px; /* 根据实际高度调整 */
}
.recordsDialog {
margin: 0px;
.total-amount {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
/* 可加padding或字体样式 */
color: #333;
font-size: 14px;
}
&::v-deep {
.el-dialog {
height: 85vh !important;
height: 100vh !important;
display: flex;
flex-direction: column;
margin: 0 auto;
margin-top: 10vh !important;
margin-top: 0vh !important;
}
.el-dialog__body {
flex: 1 1 0%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment