Commit da8673a7 by 前端

余额统计模块需求代码提交

1 parent fcaebbfc
......@@ -14,3 +14,21 @@ export function dfBalanceMonthStatListStatYear(data) {
data.method = `${path}dfBalanceMonthStat.listStatYear`
return request(data, RequestMethods.POST)
}
// 余额-其他(明细列表)
export function dfBalanceMonthOtherDetailPage(data) {
data.method = `${path}dfBalanceMonthOtherDetail.page`
return request(data, RequestMethods.POST)
}
// 余额-其他(删除)
export function dfBalanceMonthOtherDetailDelete(data) {
data.method = `${path}dfBalanceMonthOtherDetail.delete`
return request(data, RequestMethods.POST)
}
// 余额-其他(新增/更新)
export function dfBalanceMonthOtherDetailInsertOrUpdate(data) {
data.method = `${path}dfBalanceMonthOtherDetail.insertOrUpdate`
return request(data, RequestMethods.POST)
}
<!-- 弹窗 -->
<template>
<div>
<el-dialog :title="title" :visible.sync="isVisible" :show-close="showClose" :before-close="handleClose"
:close-on-click-modal="false" :width="width">
<el-dialog :title="title"
:visible.sync="isVisible"
:show-close="showClose"
:before-close="handleClose"
:close-on-click-modal="false"
:width="width"
:append-to-body="appendToBody">
<span slot="title">
{{ title }}
<span class="dialog-sub-title">
......@@ -12,11 +17,14 @@
<slot />
<div slot="footer">
<slot name="btn-start" />
<el-button type="primary" v-if="isShowFooter" @click="handleConfirm"
<el-button type="primary"
v-if="isShowFooter"
@click="handleConfirm"
:loading="$store.state.d2admin.loading.value">
{{ btnOkLabel }}
</el-button>
<el-button v-if="!noCancel" @click="handleClose"> 取消 </el-button>
<el-button v-if="!noCancel"
@click="handleClose"> 取消 </el-button>
<slot name="btn-middle" />
</div>
</el-dialog>
......@@ -57,6 +65,11 @@ export default {
isShowFooter: {
type: Boolean,
default: true
},
appendToBody: {
// 是否将自身插入至 body 元素,有嵌套的弹窗时一定要设置
type: Boolean,
default: false
}
},
......
......@@ -10,7 +10,7 @@
@confirmDialog="handleClose">
<div class="merchantInfo">
<span class="merchantName">{{ recordInfo.merchantName }}</span><span
class="merchantId">{{ recordInfo.merchantId }}</span>
class="merchantId">{{ recordInfo.merchantId }}</span>
</div>
<div>
<div class="header"
......@@ -42,9 +42,24 @@
:before-search-fn="beforeSearchFn"
:has-page="false"
:has-num="false">
<div slot="other"
slot-scope="scope">
<template>
<span
style="marginRight:10px">{{ (scope.scope.otherAmount || scope.scope.otherAmount == 0) ? scope.scope.otherAmount.toFixed(2) : '-' }}</span>
<el-button type="text"
@click="gotoManage(scope.scope)">管理</el-button>
</template>
</div>
</d2-table>
</div>
</div>
<!-- 管理其他变更明细 -->
<manage-other-dialog :manage-visible="manageVisible"
v-if="manageVisible"
:info="rowData"
:stat-year="searchForm.statYear"
@dialogClose="manageDialogClose" />
</d2-dialog>
</template>
......@@ -53,10 +68,11 @@ import { Util, deepClone } from '@/common/util'
import { mapActions, mapState } from 'vuex'
import { dfBalanceMonthStatListStatYear } from '@api/balanceStatistics'
import { rangePickerOptions_year_2023 } from '@/common/format'
import manageOtherDialog from './manageOtherDialog'
export default {
name: 'DetailDialog',
components: {
manageOtherDialog
},
data() {
return {
......@@ -97,6 +113,10 @@ export default {
return (cellValue.usedDfQuota || cellValue.usedDfQuota == 0) ? cellValue.usedDfQuota.toFixed(2) : '-'
}
}, {
label: "其他",
prop: "other",
addHtml: "other"
}, {
label: '余额',
prop: 'remnantQuota',
formatter: (cellValue) => {
......@@ -107,7 +127,9 @@ export default {
},
baseData: {
}
},
manageVisible: false,
rowData: {}
}
},
......@@ -160,6 +182,16 @@ export default {
handleClose() {
this.$emit('dialogClose')
},
// 管理其他变更明细
gotoManage(scope) {
this.rowData = scope
this.manageVisible = !this.manageVisible
},
manageDialogClose() {
this.manageVisible = !this.manageVisible
}
}
......
<!-- 管理其他变更明细弹窗 -->
<template>
<d2-dialog title="管理其他变更明细"
:is-visible="manageVisible"
class="manageOtherDialog"
width="70%"
:no-cancel="true"
btn-ok-label="关闭"
@closeDialog="handleClose"
@confirmDialog="handleClose"
:append-to-body="true">
<div class="merchantInfo">
<span class="merchantName">{{ info.merchantName }}</span><span
class="merchantId">{{ info.merchantId }}</span>
<span class="merchantYear">{{ statYear+'年'+info.statMonth+'月' }} <el-button type="primary"
size="small"
icon="el-icon-plus"
@click="addRow">新增</el-button></span>
</div>
<div>
<div class="header"
slot="header">
</div>
<div class="d2-container-content">
<d2-table ref="recordTable"
:table-data="tableData"
:search-form="searchFormSearch"
:table-params="tableParams"
:before-search-fn="beforeSearchFn"
:has-page="false">
<div slot="otherAmount"
slot-scope="scope">
<template v-if="scope.scope.isEdit">
<span><el-input v-model="scope.scope.otherAmount"
style="width: 80%;"
placeholder="请输入金额"
@input="checkAmount" /></span>
</template>
<template v-else>
<span>{{ (scope.scope.otherAmount || scope.scope.otherAmount == 0) ? scope.scope.otherAmount.toFixed(2) : '-' }}</span>
</template>
</div>
<div slot="remark"
slot-scope="scope">
<template v-if="scope.scope.isEdit">
<span><el-input v-model="scope.scope.remark"
style="width: 80%;"
placeholder="请输入变更说明"
maxlength="50" /></span>
</template>
<template v-else>
<el-tooltip class="item"
:content="scope.scope.remark"
placement="right">
<span>
{{
scope.scope.remark
? scope.scope.remark.length > 10
? scope.scope.remark.substring(0, 10) + "..."
: scope.scope.remark
: "-"
}}
</span>
</el-tooltip>
</template>
</div>
<div slot="tableOpt"
slot-scope="scope">
<template v-if="scope.scope.isEdit">
<span><el-button type="text"
@click="add(scope.scope)">保存</el-button><el-button type="text"
@click="cancel(scope.scope)">取消</el-button></span>
</template>
<template v-else>
<span><el-button type="text"
@click="del(scope.scope)">删除</el-button></span>
</template>
</div>
</d2-table>
</div>
</div>
</d2-dialog>
</template>
<script>
import { Util, deepClone } from '@/common/util'
import { mapActions, mapState } from 'vuex'
import { dfBalanceMonthOtherDetailPage, dfBalanceMonthOtherDetailInsertOrUpdate, dfBalanceMonthOtherDetailDelete } from '@api/balanceStatistics'
import BigNumber from 'bignumber.js'
export default {
name: 'ManageOtherDialog',
components: {
},
data() {
return {
countObj: {},
searchForm: {
statYearMonth: '',
merchantId: ''
},
searchFormSearch: {},
searchSelectObj: {},
// getListApi: getReportByGoods,
tableData: [],
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: false,
tableColumns: [{
label: '金额',
prop: 'otherAmount',
addHtml: "otherAmount"
// formatter: (cellValue) => {
// return (cellValue.otherAmount || cellValue.otherAmount == 0) ? cellValue.otherAmount.toFixed(2) : '-'
// }
}, {
label: '变更说明',
prop: 'remark',
addHtml: "remark"
}, {
label: "操作人",
prop: "updatedBy"
}, {
label: '操作时间',
prop: 'updatedDate',
width: '150px',
formatter: (cellValue) => {
return cellValue.updatedDate ? Util.dateFormate(cellValue.updatedDate, 'YYYY-MM-DD HH:mm:ss') : '--'
}
}, {
label: '操作',
prop: 'tableOpt',
addHtml: "tableOpt"
}
]
},
addForm: {}
}
},
props: {
manageVisible: {
type: Boolean,
default: false
},
info: {
type: Object,
default: () => { }
},
statYear: {
type: String,
default: ''
}
},
computed: {
},
mounted() {
console.log('info', this.info)
if (this.info) {
this.searchForm.statYearMonth = this.info.statYearMonth
this.searchForm.merchantId = this.info.merchantId
}
this.getList()
},
methods: {
...mapActions({
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
beforeSearchFn() {
return new Promise(resolve => {
this.searchFormSearch = deepClone(this.searchForm)
resolve()
})
},
addRow() {
const newRow = {
otherAmount: '',
remark: '',
isEdit: true
}
this.addForm = newRow
this.tableData.unshift(newRow)
},
getList() {
var params = deepClone(this.searchForm)
dfBalanceMonthOtherDetailPage(params).then(res => {
this.tableData = res.list
})
},
add(row) {
// this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
// if (valid) {
// var infoForm = deepClone(this.infoForm)
var params = {}
const info = this.info
params.merchantId = info.merchantId
params.statYearMonth = info.statYearMonth
if (row.otherAmount == '') {
this.$message({
message: "请输入金额,范围-999999~999999的数字,支持小数点后2位",
type: "warning",
showClose: true
})
return
} else {
params.otherAmount = row.otherAmount
}
if (row.remark == '') {
this.$message({
message: "请输入变更说明",
type: "warning",
showClose: true
})
return
} else {
params.remark = row.remark
}
dfBalanceMonthOtherDetailInsertOrUpdate(params).then(res => {
this.notice.okTips()
this.getList()
})
// }
// })
},
checkAmount(newVal) {
this.addForm.otherAmount = this.limitPriceForNegative(newVal)
if (this.addForm.otherAmount && !isNaN(this.addForm.otherAmount)) {
// const dfQuota = new BigNumber(this.infoForm.dfQuota)
const unDfQuota = new BigNumber(this.addForm.otherAmount)
// console.log(dfQuota)
console.log(unDfQuota)
// this.infoForm.usedYearQuota = dfQuota.plus(unDfQuota).toString()
} else {
// this.infoForm.usedYearQuota = deepClone(this.paramsObj.usedYearQuota)
}
},
cancel(row) {
var index = this.tableData.indexOf(row)
if (index > -1) {
this.tableData.splice(index, 1)
}
},
del(row) {
this.$confirm('是否确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
closeOnClickModal: false
}).then(() => {
dfBalanceMonthOtherDetailDelete({ id: row.id }).then(res => {
this.notice.okTips()
this.getList()
})
}).catch(err => {
console.log(err)
})
},
handleClose() {
this.$emit('dialogClose')
},
// 允许输入负数的输入框限制
limitPriceForNegative(newValue) {
// 用来检索整数且不超过七位数
const limitDigit = /[0-9]{1,6}/
// 用来检索小数且小数点后不超过两位数
const limitDigitdot = /[0-9]{1,6}.[\d]{0,2}/
if (newValue) {
newValue = newValue + ""
let nn = ""
// 正负判断
if (newValue.match("-")) {
nn = newValue.match("-")[0]
}
// 小数判断
if (newValue.indexOf(".") != -1) {
if (newValue.match(limitDigitdot)) {
nn = nn + newValue.match(limitDigitdot)[0] || ""
}
} else {
if (newValue.match(limitDigit)) {
nn = nn + newValue.match(limitDigit)[0] || ""
}
}
return nn
}
}
}
}
</script>
<style lang="scss" scoped>
.merchantInfo {
margin-bottom: 20px;
.merchantName {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 15px;
color: #333333;
}
.merchantId {
margin-left: 10px;
}
.merchantYear {
float: right;
margin-right: 10px;
}
}
.count-txt {
font-weight: 700;
color: #2a58ad;
margin: 0 2px;
}
.manageOtherDialog .el-dialog {
margin-top: 20vh !important;
min-width: 700px;
// z-index: 9999;
}
.manageOtherDialog .btn-tips img {
width: 18px;
height: 15px;
margin-right: 9px;
vertical-align: bottom;
}
.manageOtherDialog .btn-tips {
display: inline-block;
font-size: 12px;
height: 14px;
line-height: 14px;
background-color: #fff2e5;
color: #999999;
margin-right: 24px;
padding: 6.5px 10px;
}
.show-search {
margin-left: -65px;
}
</style>
......@@ -110,6 +110,13 @@ export default {
return (cellValue.totalUsedDfQuota || cellValue.totalUsedDfQuota == 0) ? parseFloat(cellValue.totalUsedDfQuota).toFixed(2) : '-'
}
}, {
label: '累计其他金额',
prop: 'totalOtherAmount',
width: '150px',
formatter: (cellValue) => {
return (cellValue.totalOtherAmount || cellValue.totalOtherAmount == 0) ? parseFloat(cellValue.totalOtherAmount).toFixed(2) : '-'
}
}, {
label: '累计余额',
prop: 'totalRemnantQuota',
width: '150px',
......@@ -131,6 +138,13 @@ export default {
return (cellValue.lastMonthUsedDfQuota || cellValue.lastMonthUsedDfQuota == 0) ? parseFloat(cellValue.lastMonthUsedDfQuota).toFixed(2) : '-'
}
}, {
label: '上月其他金额',
prop: 'lastMonthOtherAmount',
width: '150px',
formatter: (cellValue) => {
return (cellValue.lastMonthOtherAmount || cellValue.lastMonthOtherAmount == 0) ? parseFloat(cellValue.lastMonthOtherAmount).toFixed(2) : '-'
}
}, {
label: '上月余额',
prop: 'lastMonthRemnantQuota',
width: '150px',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!