抵扣金管理
This commit is contained in:
340
src/views/lb-business/deduction-manage/index.vue
Normal file
340
src/views/lb-business/deduction-manage/index.vue
Normal file
@@ -0,0 +1,340 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card class="filter-container" shadow="never">
|
||||
<el-form :model="queryParams" :inline="true" label-width="90px">
|
||||
<el-form-item label="用户姓名">
|
||||
<el-input v-model="queryParams.userName" clearable placeholder="请输入用户姓名" style="width: 160px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户电话">
|
||||
<el-input v-model="queryParams.userPhone" clearable placeholder="请输入用户电话" style="width: 160px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="createTimeRange"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始"
|
||||
end-placeholder="结束"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
style="width: 360px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-delete" @click="resetQuery">清空</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="action-container" shadow="never">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||
</el-card>
|
||||
|
||||
<el-card class="table-container" shadow="never">
|
||||
<el-table v-loading="loading" :data="list" style="width: 100%">
|
||||
<el-table-column label="用户姓名" prop="userName" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="用户电话" prop="userPhone" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="抵扣金额" prop="dikouAmt" min-width="100" align="right">
|
||||
<template slot-scope="scope">
|
||||
{{ formatAmount(scope.row.dikouAmt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="原始文本" prop="originalText" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column label="创建时间" prop="createTime" min-width="160">
|
||||
<template slot-scope="scope">
|
||||
{{ formatDateTime(scope.row.createTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="修改时间" prop="updateTime" min-width="160">
|
||||
<template slot-scope="scope">
|
||||
{{ formatDateTime(scope.row.updateTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
|
||||
<el-button type="text" style="color:#F56C6C;" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
:current-page="queryParams.current"
|
||||
:page-size="queryParams.size"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="640px" @close="resetForm">
|
||||
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="100px">
|
||||
<el-form-item label="用户姓名" prop="userName">
|
||||
<el-input v-model="form.userName" placeholder="请输入用户姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户电话" prop="userPhone">
|
||||
<el-input v-model="form.userPhone" placeholder="请输入用户电话" />
|
||||
</el-form-item>
|
||||
<el-form-item label="抵扣金额" prop="dikouAmt">
|
||||
<el-input-number
|
||||
v-model="form.dikouAmt"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
placeholder="请输入抵扣金额"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="原始文本">
|
||||
<el-input
|
||||
v-model="form.originalText"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入原始文本信息"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addLbDeductionAmount,
|
||||
deleteLbDeductionAmount,
|
||||
getLbDeductionAmountList,
|
||||
updateLbDeductionAmount
|
||||
} from '@/api/lb-deduction-amount'
|
||||
import { getBusinessHeaders } from '@/utils/business-headers'
|
||||
|
||||
export default {
|
||||
name: 'LbDeductionManage',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
submitLoading: false,
|
||||
list: [],
|
||||
total: 0,
|
||||
createTimeRange: [],
|
||||
dialogVisible: false,
|
||||
dialogTitle: '',
|
||||
isEdit: false,
|
||||
queryParams: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
userName: '',
|
||||
userPhone: ''
|
||||
},
|
||||
form: {
|
||||
id: '',
|
||||
userName: '',
|
||||
userPhone: '',
|
||||
dikouAmt: undefined,
|
||||
originalText: ''
|
||||
},
|
||||
formRules: {
|
||||
userName: [{ required: true, message: '请输入用户姓名', trigger: 'blur' }],
|
||||
userPhone: [{ required: true, message: '请输入用户电话', trigger: 'blur' }],
|
||||
dikouAmt: [{ required: true, message: '请输入抵扣金额', trigger: 'change' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchList()
|
||||
},
|
||||
methods: {
|
||||
getTenantIdFromBusinessHeaders() {
|
||||
const headers = getBusinessHeaders()
|
||||
const value = headers && headers['X-Tenant-Id']
|
||||
return value ? String(value).trim() : ''
|
||||
},
|
||||
fetchList() {
|
||||
this.loading = true
|
||||
getLbDeductionAmountList(this.buildListParams())
|
||||
.then((res) => {
|
||||
if (res && (res.code === 20000 || res.code === 200 || res.success === true)) {
|
||||
this.list = Array.isArray(res.data) ? res.data : []
|
||||
this.total = typeof res.total === 'number'
|
||||
? res.total
|
||||
: (res.page && typeof res.page.total === 'number' ? res.page.total : this.list.length)
|
||||
} else {
|
||||
this.list = []
|
||||
this.total = 0
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.list = []
|
||||
this.total = 0
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
buildListParams() {
|
||||
const params = {
|
||||
current: this.queryParams.current,
|
||||
size: this.queryParams.size,
|
||||
userName: this.queryParams.userName || undefined,
|
||||
userPhone: this.queryParams.userPhone || undefined
|
||||
}
|
||||
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||
if (tenantId) params.tenantId = tenantId
|
||||
const range = this.createTimeRange || []
|
||||
if (range[0]) params.createTimeStart = range[0]
|
||||
if (range[1]) params.createTimeEnd = range[1]
|
||||
Object.keys(params).forEach((key) => {
|
||||
if (params[key] === undefined || params[key] === '') delete params[key]
|
||||
})
|
||||
return params
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.current = 1
|
||||
this.fetchList()
|
||||
},
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
current: 1,
|
||||
size: 10,
|
||||
userName: '',
|
||||
userPhone: ''
|
||||
}
|
||||
this.createTimeRange = []
|
||||
this.fetchList()
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.queryParams.size = size
|
||||
this.fetchList()
|
||||
},
|
||||
handleCurrentChange(current) {
|
||||
this.queryParams.current = current
|
||||
this.fetchList()
|
||||
},
|
||||
handleAdd() {
|
||||
this.dialogTitle = '新增抵扣金'
|
||||
this.isEdit = false
|
||||
this.resetFormData()
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
||||
})
|
||||
},
|
||||
handleEdit(row) {
|
||||
this.dialogTitle = '编辑抵扣金'
|
||||
this.isEdit = true
|
||||
this.form = {
|
||||
id: row.id || '',
|
||||
userName: row.userName || '',
|
||||
userPhone: row.userPhone || '',
|
||||
dikouAmt: row.dikouAmt === null || row.dikouAmt === undefined ? undefined : Number(row.dikouAmt),
|
||||
originalText: row.originalText || ''
|
||||
}
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$confirm('确定删除这条抵扣金记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => deleteLbDeductionAmount(row.id))
|
||||
.then((res) => {
|
||||
this.$message.success((res && res.message) || '删除成功')
|
||||
this.fetchList()
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.dataForm.validate((valid) => {
|
||||
if (!valid) return
|
||||
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||
if (!tenantId) {
|
||||
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||
return
|
||||
}
|
||||
const payload = { ...this.buildPayload(), tenantId }
|
||||
this.submitLoading = true
|
||||
const req = this.isEdit ? updateLbDeductionAmount(payload) : addLbDeductionAmount(payload)
|
||||
req.then((res) => {
|
||||
this.$message.success((res && res.message) || (this.isEdit ? '更新成功' : '新增成功'))
|
||||
this.dialogVisible = false
|
||||
this.fetchList()
|
||||
}).finally(() => {
|
||||
this.submitLoading = false
|
||||
})
|
||||
})
|
||||
},
|
||||
buildPayload() {
|
||||
const payload = {
|
||||
userName: this.form.userName,
|
||||
userPhone: this.form.userPhone,
|
||||
dikouAmt: this.form.dikouAmt,
|
||||
originalText: this.form.originalText || undefined
|
||||
}
|
||||
if (this.isEdit) payload.id = this.form.id
|
||||
Object.keys(payload).forEach((key) => {
|
||||
if (payload[key] === undefined || payload[key] === '') delete payload[key]
|
||||
})
|
||||
return payload
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs.dataForm && this.$refs.dataForm.resetFields()
|
||||
this.resetFormData()
|
||||
},
|
||||
resetFormData() {
|
||||
this.form = {
|
||||
id: '',
|
||||
userName: '',
|
||||
userPhone: '',
|
||||
dikouAmt: undefined,
|
||||
originalText: ''
|
||||
}
|
||||
},
|
||||
formatAmount(val) {
|
||||
if (val === null || val === undefined || val === '') return '-'
|
||||
const n = Number(val)
|
||||
return Number.isNaN(n) ? String(val) : n.toFixed(2)
|
||||
},
|
||||
formatDateTime(dateTime) {
|
||||
if (!dateTime) return '-'
|
||||
const date = new Date(String(dateTime).replace('T', ' '))
|
||||
if (Number.isNaN(date.getTime())) return String(dateTime)
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
const hours = String(date.getHours()).padStart(2, '0')
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
.filter-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.action-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
.el-pagination {
|
||||
margin-top: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,96 +2,96 @@
|
||||
<div class="app-container">
|
||||
<el-tabs v-model="activeTab" class="department-user-tabs" @tab-click="handleTabClick">
|
||||
<el-tab-pane label="部门人员列表" name="list">
|
||||
<el-card class="filter-container" shadow="never">
|
||||
<el-form :model="queryParams" :inline="true" label-width="100px">
|
||||
<el-form-item label="姓名">
|
||||
<el-input v-model="queryParams.name" clearable placeholder="请输入姓名" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="电话">
|
||||
<el-input v-model="queryParams.phone" clearable placeholder="请输入电话" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID">
|
||||
<el-input v-model="queryParams.userId" clearable placeholder="请输入用户ID" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="父级ID">
|
||||
<el-input v-model="queryParams.parentId" clearable placeholder="请输入父级ID" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-delete" @click="resetQuery">清空</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="filter-container" shadow="never">
|
||||
<el-form :model="queryParams" :inline="true" label-width="100px">
|
||||
<el-form-item label="姓名">
|
||||
<el-input v-model="queryParams.name" clearable placeholder="请输入姓名" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="电话">
|
||||
<el-input v-model="queryParams.phone" clearable placeholder="请输入电话" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID">
|
||||
<el-input v-model="queryParams.userId" clearable placeholder="请输入用户ID" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="父级ID">
|
||||
<el-input v-model="queryParams.parentId" clearable placeholder="请输入父级ID" style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-delete" @click="resetQuery">清空</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="action-container" shadow="never">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||
<el-date-picker
|
||||
v-model="syncDateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="同步开始日期"
|
||||
end-placeholder="同步结束日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 280px; margin-left: 12px"
|
||||
/>
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="el-icon-refresh"
|
||||
:loading="syncLoading"
|
||||
@click="handleSyncFromDailyUserTrade"
|
||||
>
|
||||
自动同步
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-connection"
|
||||
:loading="syncParentChainLoading"
|
||||
style="margin-left: 12px"
|
||||
@click="handleSyncFromLbUser"
|
||||
>
|
||||
构建父链
|
||||
</el-button>
|
||||
</el-card>
|
||||
<el-card class="action-container" shadow="never">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||
<el-date-picker
|
||||
v-model="syncDateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="同步开始日期"
|
||||
end-placeholder="同步结束日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 280px; margin-left: 12px"
|
||||
/>
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="el-icon-refresh"
|
||||
:loading="syncLoading"
|
||||
@click="handleSyncFromDailyUserTrade"
|
||||
>
|
||||
自动同步
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-connection"
|
||||
:loading="syncParentChainLoading"
|
||||
style="margin-left: 12px"
|
||||
@click="handleSyncFromLbUser"
|
||||
>
|
||||
构建父链
|
||||
</el-button>
|
||||
</el-card>
|
||||
|
||||
<el-card class="table-container" shadow="never">
|
||||
<el-table v-loading="loading" :data="list" style="width: 100%">
|
||||
<el-table-column label="用户ID" prop="userId" min-width="70" show-overflow-tooltip />
|
||||
<el-table-column label="姓名" prop="name" min-width="84" show-overflow-tooltip />
|
||||
<el-table-column label="电话" prop="phone" min-width="84" show-overflow-tooltip />
|
||||
<el-table-column label="加入日期" prop="joinDate" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.joinDate || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="组织链" prop="orgChain" min-width="440" class-name="org-chain-column">
|
||||
<template slot-scope="scope">
|
||||
<div class="org-chain-cell">{{ scope.row.orgChain || '-' }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" prop="updateTime" min-width="170">
|
||||
<template slot-scope="scope">
|
||||
{{ formatDateTime(scope.row.updateTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="220">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
|
||||
<el-button type="text" @click="handleFindParent(scope.row)">找上级</el-button>
|
||||
<el-button type="text" style="color:#F56C6C;" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-card class="table-container" shadow="never">
|
||||
<el-table v-loading="loading" :data="list" style="width: 100%">
|
||||
<el-table-column label="用户ID" prop="userId" min-width="70" show-overflow-tooltip />
|
||||
<el-table-column label="姓名" prop="name" min-width="84" show-overflow-tooltip />
|
||||
<el-table-column label="电话" prop="phone" min-width="84" show-overflow-tooltip />
|
||||
<el-table-column label="加入日期" prop="joinDate" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.joinDate || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="组织链" prop="orgChain" min-width="440" class-name="org-chain-column">
|
||||
<template slot-scope="scope">
|
||||
<div class="org-chain-cell">{{ scope.row.orgChain || '-' }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" prop="updateTime" min-width="170">
|
||||
<template slot-scope="scope">
|
||||
{{ formatDateTime(scope.row.updateTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="220">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
|
||||
<el-button type="text" @click="handleFindParent(scope.row)">找上级</el-button>
|
||||
<el-button type="text" style="color:#F56C6C;" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
:current-page="queryParams.current"
|
||||
:page-size="queryParams.size"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</el-card>
|
||||
<el-pagination
|
||||
:current-page="queryParams.current"
|
||||
:page-size="queryParams.size"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="催办招商" name="urge">
|
||||
@@ -352,7 +352,7 @@ import { getBusinessHeaders } from '@/utils/business-headers'
|
||||
|
||||
function getDefaultUrgeTreeQueryParams() {
|
||||
return {
|
||||
isActive: 1,
|
||||
isActive: 1,
|
||||
lastTradeDate: '2026-04-26'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user