付款账号同步

This commit is contained in:
zhonghua.li
2026-08-22 19:44:10 +08:00
parent 570b007848
commit 2a48d80a7a
6 changed files with 662 additions and 6 deletions

View File

@@ -0,0 +1,48 @@
import request from '@/utils/request'
export function getLbPayeeAccountList(params) {
return request({
url: '/lbPayeeAccount/list',
method: 'get',
params
})
}
export function addLbPayeeAccount(data) {
return request({
url: '/lbPayeeAccount/add',
method: 'post',
data
})
}
export function updateLbPayeeAccount(data) {
return request({
url: '/lbPayeeAccount/update',
method: 'put',
data
})
}
export function deleteLbPayeeAccount(id) {
return request({
url: `/lbPayeeAccount/delete/${id}`,
method: 'delete'
})
}
export function fetchAndSavePayeeAccount(params) {
return request({
url: '/lbPayeeAccount/fetchAndSave',
method: 'post',
params
})
}
export function fetchAllAndSavePayeeAccount(params) {
return request({
url: '/lbPayeeAccount/fetchAllAndSave',
method: 'post',
params
})
}

View File

@@ -45,3 +45,11 @@ export function syncLbUserFromHxr(params) {
params
})
}
export function updateLbUserCoupon(params) {
return request({
url: '/lbUserCoupon/updateCoupon',
method: 'post',
params
})
}

View File

@@ -192,6 +192,12 @@ export const constantRoutes = [
name: 'LbCouponManage',
component: () => import('@/views/lb-business/coupon-manage/index'),
meta: { title: '优惠券管理', icon: 'el-icon-discount' }
},
{
path: 'payee-account',
name: 'LbPayeeAccount',
component: () => import('@/views/lb-business/payee-account/index'),
meta: { title: '收款账号', icon: 'el-icon-wallet' }
}
]
}

View File

@@ -68,6 +68,11 @@
<div class="org-chain-cell">{{ scope.row.orgChain || '-' }}</div>
</template>
</el-table-column>
<el-table-column label="当天购买单数" prop="todayBuyCount" min-width="110">
<template slot-scope="scope">
{{ scope.row.todayBuyCount != null ? scope.row.todayBuyCount : '-' }}
</template>
</el-table-column>
<el-table-column label="更新时间" prop="updateTime" min-width="170">
<template slot-scope="scope">
{{ formatDateTime(scope.row.updateTime) }}
@@ -177,7 +182,7 @@
<el-input
v-model="urgeTreeFilterText"
clearable
placeholder="搜索姓名、用户ID、电话、加入日期、最后成交日期"
placeholder="搜索姓名、用户ID、电话、加入日期、最后成交日期、最大订单"
prefix-icon="el-icon-search"
class="urge-tree-filter"
/>
@@ -207,6 +212,8 @@
<span class="urge-tree-node-meta">电话{{ data.phone || '-' }}</span>
<span class="urge-tree-node-meta">加入日期{{ data.joinDate || '-' }}</span>
<span class="urge-tree-node-meta">最后成交日期{{ data.lastTradeDate || '-' }}</span>
<span class="urge-tree-node-meta">最大订单{{ data.maxOrder != null ? data.maxOrder : '-' }}</span>
<span class="urge-tree-node-meta">当天购买单数{{ data.todayBuyCount != null ? data.todayBuyCount : '-' }}</span>
</span>
</el-tree>
<el-empty v-else description="暂无数据,请点击刷新加载" />
@@ -298,7 +305,7 @@
<el-input
v-model="sumTotalMoneyFilterText"
clearable
placeholder="搜索姓名、用户ID、电话、累计交易金额、自身交易金额"
placeholder="搜索姓名、用户ID、电话、累计交易金额、自身交易金额、当天购买单数"
prefix-icon="el-icon-search"
class="sum-total-money-filter"
/>
@@ -321,6 +328,7 @@
<span class="sum-total-money-node-meta">电话{{ data.phone || '-' }}</span>
<span class="sum-total-money-node-meta sum-total-money-amount">累计交易金额¥ {{ formatMoney(data.tradeMoneySum) }}</span>
<span class="sum-total-money-node-meta sum-total-money-self">自身交易金额¥ {{ formatMoney(data.selfTradeMoney) }}</span>
<span class="sum-total-money-node-meta">当天购买单数{{ data.todayBuyCount != null ? data.todayBuyCount : '-' }}</span>
</span>
</el-tree>
<el-empty v-else description="暂无数据,请点击刷新加载" />
@@ -758,7 +766,7 @@ export default {
if (!value) return true
const keyword = String(value).trim().toLowerCase()
if (!keyword) return true
const fields = [data.name, data.userId, data.phone, data.joinDate, data.lastTradeDate]
const fields = [data.name, data.userId, data.phone, data.joinDate, data.lastTradeDate, data.maxOrder]
return fields.some((field) => field != null && String(field).toLowerCase().includes(keyword))
},
isUrgeTreeLeafNode(data) {
@@ -944,7 +952,7 @@ export default {
if (!value) return true
const keyword = String(value).trim().toLowerCase()
if (!keyword) return true
const fields = [data.name, data.userId, data.phone, data.tradeMoneySum, data.selfTradeMoney]
const fields = [data.name, data.userId, data.phone, data.tradeMoneySum, data.selfTradeMoney, data.todayBuyCount]
return fields.some((field) => field != null && String(field).toLowerCase().includes(keyword))
},
formatMoney(amount) {

View File

@@ -0,0 +1,473 @@
<template>
<div class="app-container">
<el-card class="filter-container" shadow="never">
<el-form :model="queryParams" :inline="true" label-width="100px">
<el-form-item label="用户ID">
<el-input v-model="queryParams.userId" clearable placeholder="请输入用户ID" style="width: 160px" />
</el-form-item>
<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.bank" clearable placeholder="请输入开户银行" style="width: 160px" />
</el-form-item>
<el-form-item label="银行卡号">
<el-input v-model="queryParams.account" clearable placeholder="请输入银行卡号" style="width: 180px" />
</el-form-item>
<el-form-item label="手机号">
<el-input v-model="queryParams.phone" clearable placeholder="请输入手机号" style="width: 160px" />
</el-form-item>
<el-form-item label="支付宝账号">
<el-input v-model="queryParams.accountAlipay" clearable placeholder="请输入支付宝账号" style="width: 180px" />
</el-form-item>
<el-form-item label="支付宝手机">
<el-input v-model="queryParams.phoneAlipay" clearable placeholder="请输入支付宝手机号" style="width: 160px" />
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="createdAtRange"
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-button type="success" icon="el-icon-download" @click="handleOpenFetch">获取支付信息</el-button>
<el-button type="warning" icon="el-icon-s-operation" :loading="fetchAllLoading" @click="handleFetchAll">获取全部收付款账号</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="id" width="80" align="center" />
<el-table-column label="用户ID" prop="userId" width="90" align="center" />
<el-table-column label="用户名" prop="username" min-width="120" show-overflow-tooltip />
<el-table-column label="开户银行" prop="bank" min-width="140" show-overflow-tooltip />
<el-table-column label="银行卡号" prop="account" min-width="180" show-overflow-tooltip />
<el-table-column label="手机号" prop="phone" min-width="130" show-overflow-tooltip />
<el-table-column label="支付宝账号" prop="accountAlipay" min-width="150" show-overflow-tooltip />
<el-table-column label="支付宝手机" prop="phoneAlipay" min-width="130" show-overflow-tooltip />
<el-table-column label="二维码" width="80" align="center">
<template slot-scope="scope">
<el-image
v-if="scope.row.qrcode"
:src="scope.row.qrcode"
:preview-src-list="[scope.row.qrcode]"
style="width: 40px; height: 40px"
fit="cover"
preview-teleported
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createdAt" min-width="160">
<template slot-scope="scope">
{{ formatDateTime(scope.row.createdAt) }}
</template>
</el-table-column>
<el-table-column label="更新时间" prop="updatedAt" min-width="160">
<template slot-scope="scope">
{{ formatDateTime(scope.row.updatedAt) }}
</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="680px" top="5vh" @close="resetForm">
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="120px">
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="用户ID" prop="userId">
<el-input v-model.number="form.userId" placeholder="请输入用户ID" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户名" prop="username">
<el-input v-model="form.username" placeholder="请输入用户名" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="开户银行" prop="bank">
<el-input v-model="form.bank" placeholder="请输入开户银行" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="银行卡号" prop="account">
<el-input v-model="form.account" placeholder="请输入银行卡号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="支付宝账号" prop="accountAlipay">
<el-input v-model="form.accountAlipay" placeholder="请输入支付宝账号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="支付宝手机" prop="phoneAlipay">
<el-input v-model="form.phoneAlipay" placeholder="请输入支付宝手机号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="二维码">
<el-input v-model="form.qrcode" placeholder="请输入二维码图片路径" />
</el-form-item>
</el-col>
</el-row>
</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>
<el-dialog title="获取支付信息" :visible.sync="fetchDialogVisible" width="480px" top="10vh">
<el-form ref="fetchForm" :model="fetchForm" :rules="fetchFormRules" label-width="100px">
<el-form-item label="手机号码" prop="phone">
<el-input v-model="fetchForm.phone" placeholder="请输入手机号码" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="fetchDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="fetchLoading" @click="handleFetchSubmit">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
addLbPayeeAccount,
deleteLbPayeeAccount,
fetchAllAndSavePayeeAccount,
fetchAndSavePayeeAccount,
getLbPayeeAccountList,
updateLbPayeeAccount
} from '@/api/lb-payee-account'
import { getBusinessHeaders } from '@/utils/business-headers'
const DEFAULT_FORM = () => ({
id: null,
userId: null,
username: '',
bank: '',
account: '',
phone: '',
accountAlipay: '',
qrcode: '',
phoneAlipay: ''
})
export default {
name: 'LbPayeeAccount',
data() {
return {
loading: false,
submitLoading: false,
fetchLoading: false,
fetchAllLoading: false,
list: [],
total: 0,
createdAtRange: [],
dialogVisible: false,
dialogTitle: '',
isEdit: false,
fetchDialogVisible: false,
fetchForm: {
phone: ''
},
fetchFormRules: {
phone: [{ required: true, message: '请输入手机号码', trigger: 'blur' }]
},
queryParams: {
current: 1,
size: 10,
userId: '',
username: '',
bank: '',
account: '',
phone: '',
accountAlipay: '',
phoneAlipay: ''
},
form: DEFAULT_FORM(),
formRules: {
userId: [{ type: 'number', message: '用户ID必须为数字', trigger: 'blur' }],
account: [{ required: true, message: '请输入银行卡号', trigger: 'blur' }]
}
}
},
created() {
this.fetchList()
},
methods: {
fetchList() {
this.loading = true
getLbPayeeAccountList(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,
userId: this.queryParams.userId || undefined,
username: this.queryParams.username || undefined,
bank: this.queryParams.bank || undefined,
account: this.queryParams.account || undefined,
phone: this.queryParams.phone || undefined,
accountAlipay: this.queryParams.accountAlipay || undefined,
phoneAlipay: this.queryParams.phoneAlipay || undefined
}
const range = this.createdAtRange || []
if (range[0]) params.createdAtStart = range[0]
if (range[1]) params.createdAtEnd = 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,
userId: '',
username: '',
bank: '',
account: '',
phone: '',
accountAlipay: '',
phoneAlipay: ''
}
this.createdAtRange = []
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,
userId: row.userId != null ? Number(row.userId) : null,
username: row.username || '',
bank: row.bank || '',
account: row.account || '',
phone: row.phone || '',
accountAlipay: row.accountAlipay || '',
qrcode: row.qrcode || '',
phoneAlipay: row.phoneAlipay || ''
}
this.dialogVisible = true
this.$nextTick(() => {
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
})
},
handleDelete(row) {
this.$confirm('确定删除该收款账号吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => deleteLbPayeeAccount(row.id))
.then((res) => {
this.$message.success((res && res.message) || '删除成功')
this.fetchList()
})
.catch(() => {})
},
handleOpenFetch() {
this.fetchForm = { phone: '' }
this.fetchDialogVisible = true
this.$nextTick(() => {
this.$refs.fetchForm && this.$refs.fetchForm.clearValidate()
})
},
getTenantIdFromBusinessHeaders() {
const headers = getBusinessHeaders()
const value = headers && headers['X-Tenant-Id']
return value ? String(value).trim() : ''
},
handleFetchSubmit() {
this.$refs.fetchForm.validate((valid) => {
if (!valid) return
const tenantId = this.getTenantIdFromBusinessHeaders()
if (!tenantId) {
this.$message.error('未获取到租户ID请先登录或配置业务请求头中的租户')
return
}
this.fetchLoading = true
fetchAndSavePayeeAccount({
phone: this.fetchForm.phone,
tenantId
}).then((res) => {
this.$message.success((res && res.message) || '获取支付信息成功')
this.fetchDialogVisible = false
this.fetchList()
}).finally(() => {
this.fetchLoading = false
})
})
},
handleFetchAll() {
const tenantId = this.getTenantIdFromBusinessHeaders()
this.$confirm(
tenantId
? `确定要获取租户 ${tenantId} 下所有用户的收付款账号吗?`
: '确定要获取所有用户的收付款账号吗?',
'确认',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
this.fetchAllLoading = true
const params = {}
if (tenantId) {
params.tenantId = tenantId
}
fetchAllAndSavePayeeAccount(params).then((res) => {
this.$message.success((res && res.message) || '获取全部收付款账号成功')
this.fetchList()
}).finally(() => {
this.fetchAllLoading = false
})
}).catch(() => {})
},
handleSubmit() {
this.$refs.dataForm.validate((valid) => {
if (!valid) return
const payload = this.buildPayload()
this.submitLoading = true
const req = this.isEdit ? updateLbPayeeAccount(payload) : addLbPayeeAccount(payload)
req.then((res) => {
this.$message.success((res && res.message) || (this.isEdit ? '更新成功' : '新增成功'))
this.dialogVisible = false
this.fetchList()
}).finally(() => {
this.submitLoading = false
})
})
},
buildPayload() {
const payload = { ...this.form }
if (!this.isEdit) {
delete payload.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 = DEFAULT_FORM()
},
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>

View File

@@ -77,6 +77,15 @@
>
同步用户
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
:loading="couponLoading"
style="margin-left: 12px"
@click="openCouponDialog"
>
清理优惠卷
</el-button>
</el-card>
<el-card class="table-container" shadow="never">
@@ -102,6 +111,11 @@
<el-table-column label="优惠券" prop="coupon" min-width="90" show-overflow-tooltip />
<el-table-column label="个人奖金" prop="selfBonus" min-width="90" show-overflow-tooltip />
<el-table-column label="推广奖金" prop="shareBonus" min-width="90" show-overflow-tooltip />
<el-table-column label="注册时间" prop="joinTime" min-width="160" show-overflow-tooltip>
<template slot-scope="scope">
{{ formatDateTime(scope.row.joinTime) }}
</template>
</el-table-column>
<el-table-column label="状态" width="80" align="center">
<template slot-scope="scope">
{{ formatStatusLabel(scope.row.status) }}
@@ -374,6 +388,32 @@
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">确定</el-button>
</div>
</el-dialog>
<el-dialog title="清理优惠卷" :visible.sync="couponDialogVisible" width="520px" @close="resetCouponForm">
<el-form ref="couponFormRef" :model="couponForm" :rules="couponFormRules" label-width="100px">
<el-form-item label="租户" prop="tenantId">
<el-select
v-model="couponForm.tenantId"
filterable
clearable
placeholder="请选择租户"
style="width: 100%"
:loading="tenantLoading"
>
<el-option
v-for="item in tenantOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="couponDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="couponLoading" @click="submitUpdateCoupon">确定</el-button>
</div>
</el-dialog>
</div>
</template>
@@ -383,8 +423,10 @@ import {
deleteLbUser,
getLbUserList,
syncLbUserFromHxr,
updateLbUser
updateLbUser,
updateLbUserCoupon
} from '@/api/lb-user'
import { getAllTenantList } from '@/api/tenant'
import { getBusinessHeaders } from '@/utils/business-headers'
function emptyForm() {
@@ -483,10 +525,21 @@ export default {
form: emptyForm(),
formRules: {
id: [{ validator: requireId, trigger: 'blur' }]
}
},
couponDialogVisible: false,
couponLoading: false,
couponForm: {
tenantId: ''
},
couponFormRules: {
tenantId: [{ required: true, message: '请选择租户', trigger: 'change' }]
},
tenantLoading: false,
tenantOptions: []
}
},
created() {
this.getTenantOptions()
this.fetchList()
},
methods: {
@@ -620,6 +673,66 @@ export default {
const value = headers && headers['X-Tenant-Id']
return value ? String(value).trim() : ''
},
getTenantOptions() {
this.tenantLoading = true
getAllTenantList()
.then((response) => {
if (response && (response.code === 20000 || response.code === 200)) {
const tenantList = Array.isArray(response.data) ? response.data : (response.data && response.data.data ? response.data.data : [])
this.tenantOptions = tenantList.map((item) => ({
value: item.id,
label: item.tenantName ? `${item.tenantName} (${item.tenantCode || '-'})` : (item.tenantCode || item.id)
}))
} else {
this.tenantOptions = []
}
})
.catch(() => {
this.tenantOptions = []
})
.finally(() => {
this.tenantLoading = false
})
},
openCouponDialog() {
const defaultTenantId = this.getTenantIdFromBusinessHeaders()
this.couponForm = {
tenantId: defaultTenantId || ''
}
this.couponDialogVisible = true
this.$nextTick(() => {
this.$refs.couponFormRef && this.$refs.couponFormRef.clearValidate()
})
},
resetCouponForm() {
this.couponForm = { tenantId: '' }
this.$refs.couponFormRef && this.$refs.couponFormRef.resetFields()
},
submitUpdateCoupon() {
this.$refs.couponFormRef.validate((valid) => {
if (!valid) return
const tenantId = (this.couponForm.tenantId || '').trim()
if (!tenantId) {
this.$message.error('请选择租户')
return
}
this.couponLoading = true
updateLbUserCoupon({ tenantId })
.then((res) => {
const isSuccess = res && (res.success === true || res.code === 200 || res.code === 20000)
if (!isSuccess) {
this.$message.error((res && res.message) || '清理优惠卷失败')
return
}
this.$message.success((res && res.message) || '清理优惠卷成功')
this.couponDialogVisible = false
this.fetchList()
})
.finally(() => {
this.couponLoading = false
})
})
},
handleSyncFromHxr() {
const tenantId = this.getTenantIdFromBusinessHeaders()
if (!tenantId) {