From faa71e1112979d0a7e03ee8297741c1f47d2550f Mon Sep 17 00:00:00 2001
From: PC-20250623MANY\Administrator <344137771@qq.com>
Date: Mon, 25 Aug 2025 18:12:58 +0800
Subject: [PATCH] 添加充值
---
src/views/userlist/index.vue | 93 +++++++++------
src/api/home.js | 8 +
src/views/userlist/components/editCapitaluserdialog.vue | 200 +++++++++++++++++++++++---------
3 files changed, 206 insertions(+), 95 deletions(-)
diff --git a/src/api/home.js b/src/api/home.js
index b4c7cce..a6bbd5b 100644
--- a/src/api/home.js
+++ b/src/api/home.js
@@ -152,3 +152,11 @@
data: qs.stringify(parameter)
})
}
+
+export function updateMoney(parameter) {
+ return request({
+ url: '/agent/user/updateMoney.do',
+ method: 'post',
+ data: qs.stringify(parameter),
+ })
+}
diff --git a/src/views/userlist/components/editCapitaluserdialog.vue b/src/views/userlist/components/editCapitaluserdialog.vue
index a2a649d..498803e 100644
--- a/src/views/userlist/components/editCapitaluserdialog.vue
+++ b/src/views/userlist/components/editCapitaluserdialog.vue
@@ -6,20 +6,37 @@
:visible="editUserdialog"
:confirmLoading="editUserDialogloading"
@ok="OkeditUserdialog"
- @cancel="CanceleditUserdialog">
+ @cancel="CanceleditUserdialog"
+ >
<a-form :form="editUserform" ref="editUserform">
<a-form-item label="用户id" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入用户id" disabled v-decorator="['userId', {}]" />
</a-form-item>
<a-form-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input placeholder="请输入金额" v-decorator="['amt', {rules: [{ required: true, message: '请输入金额', }] }]" />
+ <a-input
+ placeholder="请输入金额"
+ v-decorator="['amt', { rules: [{ required: true, message: '请输入金额' }] }]"
+ />
</a-form-item>
<a-form-item label="扣入款" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select
placeholder="请选择扣入款"
- v-decorator="['direction', { rules: [{ required: true, message: '请选择扣入款', }] }]">
+ v-decorator="['direction', { rules: [{ required: true, message: '请选择扣入款' }] }]"
+ >
<a-select-option value="1">扣款</a-select-option>
<a-select-option value="0">入款</a-select-option>
+ <a-select-option value="2">充值</a-select-option>
+ <!-- <a-select-option value="3">提币</a-select-option> -->
+ </a-select>
+ </a-form-item>
+ <a-form-item label="账户" :labelCol="labelCol" :wrapperCol="wrapperCol">
+ <a-select
+ placeholder="请选择账户"
+ v-decorator="['accectType', { rules: [{ required: true, message: '请选择账户' }] }]"
+ >
+ <a-select-option v-for="item in activeArr" :key="item.id" :value="item.accectType">
+ {{ item | formatDate }}
+ </a-select-option>
</a-select>
</a-form-item>
</a-form>
@@ -27,66 +44,135 @@
</div>
</template>
<script>
-import { userupdateAmt } from '@/api/home'
+import { userupdateAmt, updateMoney } from '@/api/home'
import pick from 'lodash.pick'
export default {
- components: {},
- props: {
- getinit: {
- type: Function,
- default: function () {
- }
- }
+ components: {},
+ filters: {
+ formatDate(value) {
+ switch (value.accectType) {
+ case 'US':
+ return `美元(${value.symbol} ${value.availableBalance})`
+ case 'MAS':
+ return `马来西亚(${value.symbol} ${value.availableBalance})`
+ case 'HK':
+ return `香港(${value.symbol} ${value.availableBalance})`
+ case 'IN':
+ return `印度(${value.symbol} ${value.availableBalance})`
+ case 'SGP':
+ return `新加坡(${value.symbol} ${value.availableBalance})`
+ case 'ST':
+ return `沙特(${value.symbol} ${value.availableBalance})`
+ case 'USDT':
+ return `USDT( ${value.availableBalance})`
+ case 'MEX':
+ return `MEX( ${value.availableBalance})`
+ case 'TW':
+ return `台湾(${value.symbol} ${value.availableBalance})`
+ default:
+ break
+ }
+ // return `印度(${value.symbol} ${value.availableBalance})`
},
- data () {
- return {
- labelCol: {
- xs: { span: 24 },
- sm: { span: 7 }
- },
- wrapperCol: {
- xs: { span: 24 },
- sm: { span: 13 }
- },
- editUserform: this.$form.createForm(this),
- editUserdialog: false,
- editUserDialogloading: false,
- fields: ['amt', 'direction', 'userId'],
- currentDetails: {}
- }
+ },
+ props: {
+ getinit: {
+ type: Function,
+ default: function () {},
},
- methods: {
- getEditorder (val) {
- this.currentDetails = val
- this.editUserdialog = true
- this.fields.forEach(v => this.editUserform.getFieldDecorator(v))
- this.editUserform.setFieldsValue(pick(val, this.fields))
- this.editUserform.setFieldsValue(pick({ userId: val.id }, this.fields))
+ activeArr: {
+ type: Array,
+ default: [],
+ },
+ },
+ data() {
+ return {
+ labelCol: {
+ xs: {
+ span: 24,
},
- CanceleditUserdialog () {
- this.editUserdialog = false
- const form = this.$refs.editUserform.form
- form.resetFields()
+ sm: {
+ span: 7,
},
- OkeditUserdialog () {
- const form = this.$refs.editUserform.form
- form.validateFields((errors, values) => {
- if (!errors) {
- this.editUserDialogloading = true
- userupdateAmt(values).then(res => {
- if (res.status == 0) {
- this.editUserdialog = false
- this.$message.success({ content: res.msg, duration: 2 })
- form.resetFields()
- this.getinit()
- } else {
- this.$message.error({ content: res.msg })
- }
- this.editUserDialogloading = false
- })
- }
- })
- }
+ },
+ wrapperCol: {
+ xs: {
+ span: 24,
+ },
+ sm: {
+ span: 13,
+ },
+ },
+ editUserform: this.$form.createForm(this),
+ editUserdialog: false,
+ editUserDialogloading: false,
+ fields: ['amt', 'direction', 'userId', 'accectType'],
+ currentDetails: {},
}
+ },
+ methods: {
+ getEditorder(val) {
+ val.accectType = ''
+ this.currentDetails = val
+ this.editUserdialog = true
+ this.fields.forEach((v) => this.editUserform.getFieldDecorator(v))
+ this.editUserform.setFieldsValue(pick(val, this.fields))
+ this.editUserform.setFieldsValue(
+ pick(
+ {
+ userId: val.id,
+ },
+ this.fields
+ )
+ )
+ },
+ CanceleditUserdialog() {
+ this.editUserdialog = false
+ const form = this.$refs.editUserform.form
+ form.resetFields()
+ },
+ OkeditUserdialog() {
+ const form = this.$refs.editUserform.form
+ form.validateFields((errors, values) => {
+ console.log(values, 'from', !errors, this.activeArr)
+ const arr = this.activeArr.filter((item) => item.accectType === values.accectType)
+ const amt = values.amt
+
+ console.log(arr)
+ if (!errors) {
+ this.editUserDialogloading = true
+ console.log({
+ id: arr[0].id,
+ amt: amt,
+ type: this.direction,
+ })
+ updateMoney({
+ id: arr[0].id,
+ amt: amt,
+ type: values.direction,
+ accectType: values.accectType,
+ })
+ .then((res) => {
+ if (res.status == 0) {
+ this.editUserdialog = false
+ this.$message.success(res.msg)
+ form.resetFields()
+ this.getinit()
+ } else {
+ this.$message.error({
+ content: res.msg || '划转成功',
+ })
+ }
+ this.editUserDialogloading = false
+ })
+ .catch((res) => {
+ this.editUserDialogloading = false
+ })
+ } else {
+ console.log(3333)
+ }
+ })
+ },
+ },
}
</script>
diff --git a/src/views/userlist/index.vue b/src/views/userlist/index.vue
index 4461577..8baeed8 100644
--- a/src/views/userlist/index.vue
+++ b/src/views/userlist/index.vue
@@ -16,11 +16,8 @@
<a-col :md="12" :lg="6" :sm="24">
<a-form-item label="下级代理">
<a-select v-model="queryParam.agentId" placeholder="请选择下级代理">
- <a-select-option
- v-for="(item, index) in agentlist"
- :key="index"
- :value="item.id"
- >{{ item.agentName }}
+ <a-select-option v-for="(item, index) in agentlist" :key="index" :value="item.id"
+ >{{ item.agentName }}
</a-select-option>
</a-select>
</a-form-item>
@@ -48,14 +45,14 @@
icon="search"
style="margin-left: 8px"
@click=";(queryParam.pageNum = 1), getuserList()"
- >查询</a-button
+ >查询</a-button
>
<a-button
type="primary"
icon="plus"
style="margin-left: 8px"
@click="$refs.adduserdialog.addUserdialog = true"
- >添加账户</a-button
+ >添加账户</a-button
>
</span>
</a-form-item>
@@ -107,6 +104,8 @@
<a-divider type="vertical" />
<a slot="action" href="javascript:;" @click="$refs.editUserbankdialog.getbankinfo(record)">银行卡</a>
<a-divider type="vertical" />
+ <a slot="action" href="javascript:;" @click="getMoneyzj(record)">资金</a>
+ <a-divider type="vertical" />
<a
slot="action"
href="javascript:;"
@@ -114,7 +113,7 @@
currentDetails = record
$refs.audituserdialog.userDialog = true
"
- >实名审核</a
+ >实名审核</a
>
</template>
</a-table>
@@ -124,10 +123,16 @@
<EditUserinfodialog ref="EditUserinfodialog" :getinit="geteditinit" :agentlist="agentlist"></EditUserinfodialog>
<editUserbankdialog ref="editUserbankdialog" :getinit="geteditinit"></editUserbankdialog>
<audituserdialog ref="audituserdialog" :currentDetails="currentDetails" :getinit="geteditinit"></audituserdialog>
+ <editCapitaluserdialog
+ :activeArr="activeArr"
+ ref="editCapitaluserdialog"
+ :getinit="geteditinit"
+ ></editCapitaluserdialog>
</page-header-wrapper>
</template>
<script>
import { agentuserlist, agentgetSecondAgent, agentgetAgentInfo, getMoney } from '@/api/home'
+import editCapitaluserdialog from './components/editCapitaluserdialog'
import adduserdialog from './components/adduserdialog'
import detailuserdialog from './components/detailuserdialog'
import EditUserinfodialog from './components/EditUserinfodialog'
@@ -141,9 +146,10 @@
detailuserdialog,
EditUserinfodialog,
editUserbankdialog,
- audituserdialog
+ audituserdialog,
+ editCapitaluserdialog,
},
- data () {
+ data() {
return {
queryParam: {
agentId: undefined,
@@ -151,36 +157,36 @@
phone: '',
pageNum: 1,
pageSize: 10,
- accountType: 0
+ accountType: 0,
},
labelCol: {
xs: { span: 24 },
- sm: { span: 7 }
+ sm: { span: 7 },
},
wrapperCol: {
xs: { span: 24 },
- sm: { span: 13 }
+ sm: { span: 13 },
},
columns: [
{
title: '用户ID',
dataIndex: 'id',
- align: 'center'
+ align: 'center',
},
{
title: '所属代理(Id)',
scopedSlots: { customRender: 'agentName' },
- align: 'center'
+ align: 'center',
},
{
title: '手机号',
dataIndex: 'phone',
- align: 'center'
+ align: 'center',
},
{
title: '真实姓名',
dataIndex: 'realName',
- align: 'center'
+ align: 'center',
},
{
title: '总资金',
@@ -188,7 +194,7 @@
align: 'center',
customRender: (text, row, index) => {
return text.toFixed(2)
- }
+ },
},
{
title: '可用余额',
@@ -212,26 +218,26 @@
align: 'center',
customRender: (text, row, index) => {
return text == 0 ? '待认证' : text == 1 ? '待审核' : text == 2 ? '认证成功' : text == 3 ? '驳回' : ''
- }
+ },
},
{
title: '交易状态',
dataIndex: 'isLock',
align: 'center',
- scopedSlots: { customRender: 'isLock' }
+ scopedSlots: { customRender: 'isLock' },
},
{
title: '登录状态',
dataIndex: 'isLogin',
align: 'center',
- scopedSlots: { customRender: 'isLogin' }
+ scopedSlots: { customRender: 'isLogin' },
},
{
title: '操作',
key: 'action',
align: 'center',
- scopedSlots: { customRender: 'action' }
- }
+ scopedSlots: { customRender: 'action' },
+ },
], // 表头
dataList: [],
pagination: {
@@ -241,25 +247,36 @@
pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
- showTotal: (total) => `共有 ${total} 条数据` // 分页中显示总的数据
+ showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据
},
loading: false,
agentqueryParam: {
pageNum: 1,
- pageSize: 100
+ pageSize: 100,
},
agentlist: [],
userid: '',
- currentDetails: {}
+ currentDetails: {},
+ activeArr: [],
}
},
- created () {
+ created() {
this.getuserList()
this.getagentlist()
this.getagentuserinfo()
},
methods: {
- async userInfo (val) {
+ getMoneyzj(record) {
+ console.log(record.id)
+ getMoney({ userId: record.id }).then((res) => {
+ if (res.status === 0) {
+ const arr = res.data.filter((item) => item.accectType !== 'ALL')
+ this.activeArr = arr
+ this.$refs.editCapitaluserdialog.getEditorder(record)
+ }
+ })
+ },
+ async userInfo(val) {
const res = await getMoney({ userId: val.id })
if (res.success) {
res.data.map((item) => {
@@ -270,21 +287,21 @@
this.currentDetails = val
this.$refs.detailuserdialog.userDialog = true
},
- geteditinit () {
+ geteditinit() {
this.getuserList()
},
- getinit () {
+ getinit() {
this.queryParam = {
agentId: undefined,
realName: '',
phone: '',
pageNum: 1,
pageSize: 10,
- accountType: 0
+ accountType: 0,
}
this.getuserList()
},
- getuserList () {
+ getuserList() {
var that = this
this.loading = true
agentuserlist(this.queryParam).then((res) => {
@@ -295,27 +312,27 @@
}, 500)
})
},
- getagentuserinfo () {
+ getagentuserinfo() {
agentgetAgentInfo(this.agentqueryParam).then((res) => {
console.log(res)
this.userid = res.data.id
})
},
- getagentlist () {
+ getagentlist() {
agentgetSecondAgent(this.agentqueryParam).then((res) => {
this.agentlist = res.data.list
})
},
- onPageChange (page, pageSize) {
+ onPageChange(page, pageSize) {
this.queryParam.pageNum = page
this.getuserList()
},
- onSizeChange (current, pageSize) {
+ onSizeChange(current, pageSize) {
this.queryParam.pageNum = current
this.queryParam.pageSize = pageSize
this.getuserList()
},
- handleTableChange () {}
- }
+ handleTableChange() {},
+ },
}
</script>
--
Gitblit v1.9.3