From 598d0f85044c65b60f494c03538165570d888807 Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Thu, 24 Apr 2025 17:04:49 +0800
Subject: [PATCH] feat: 账户扣款 添加 黄金石油
---
src/views/userlist/components/editCapitaluserdialog.vue | 301 ++++++++++++++++++++++++++++---------------------
1 files changed, 173 insertions(+), 128 deletions(-)
diff --git a/src/views/userlist/components/editCapitaluserdialog.vue b/src/views/userlist/components/editCapitaluserdialog.vue
index c454c63..882c928 100644
--- a/src/views/userlist/components/editCapitaluserdialog.vue
+++ b/src/views/userlist/components/editCapitaluserdialog.vue
@@ -1,28 +1,67 @@
<template>
<div>
- <a-modal title="账户扣入款" :width="500" :visible="editUserdialog" :confirmLoading="editUserDialogloading"
- @ok="OkeditUserdialog" @cancel="CanceleditUserdialog">
+ <a-modal
+ title="账户扣入款"
+ :width="500"
+ :visible="editUserdialog"
+ :confirmLoading="editUserDialogloading"
+ @ok="OkeditUserdialog"
+ @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
+ 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: '请选择扣入款' }] }]">
+ <a-form-item
+ label="扣入款"
+ :labelCol="labelCol"
+ :wrapperCol="wrapperCol"
+ >
+ <a-select
+ placeholder="请选择扣入款"
+ 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
+ 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>
@@ -30,126 +69,132 @@
</div>
</template>
<script>
- import {
- userupdateAmt,
- updateMoney
- } from '@/api/home'
- import pick from 'lodash.pick'
- export default {
- 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})`
- default:
- break
- }
- // return `印度(${value.symbol} ${value.availableBalance})`
- },
- },
- props: {
- getinit: {
- type: Function,
- default: function() {},
- },
- activeArr: {
- type: Array,
- default: [],
- },
- },
- 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', 'accectType'],
- currentDetails: {},
+import { userupdateAmt, updateMoney } from "@/api/home";
+import pick from "lodash.pick";
+export default {
+ 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})`;
+ default:
+ break;
}
+ // return `印度(${value.symbol} ${value.availableBalance})`
},
- methods: {
- getEditorder(val) {
- val.accectType = 'ST'
- 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))
+ },
+ props: {
+ getinit: {
+ type: Function,
+ default: function () {},
+ },
+ activeArr: {
+ type: Array,
+ default: [],
+ },
+ },
+ data() {
+ return {
+ labelCol: {
+ xs: {
+ span: 24,
+ },
+ sm: {
+ span: 7,
+ },
},
- CanceleditUserdialog() {
- this.editUserdialog = false
- const form = this.$refs.editUserform.form
- form.resetFields()
+ wrapperCol: {
+ xs: {
+ span: 24,
+ },
+ sm: {
+ span: 13,
+ },
},
- OkeditUserdialog() {
- const form = this.$refs.editUserform.form
- form.validateFields((errors, values) => {
- console.log(values, 'from', !errors)
- const arr = this.activeArr.filter((item) => item.accectType === values.accectType)
- const amt = values.amt
+ editUserform: this.$form.createForm(this),
+ editUserdialog: false,
+ editUserDialogloading: false,
+ fields: ["amt", "direction", "userId", "accectType"],
+ currentDetails: {},
+ };
+ },
+ methods: {
+ getEditorder(val) {
+ val.accectType = "ST";
+ 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
+ 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,
+ })
+ .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;
})
- updateMoney({
- id: arr[0].id,
- amt: amt,
- type: values.direction
- })
- .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)
- }
- })
- },
+ .catch((res) => {
+ this.editUserDialogloading = false;
+ });
+ } else {
+ console.log(3333);
+ }
+ });
},
- }
-</script>
\ No newline at end of file
+ },
+};
+</script>
--
Gitblit v1.9.3