فهرست منبع

添加 入金功能

huangbin 4 سال پیش
والد
کامیت
d871eefb66

+ 62 - 13
src/common/methods/request/resultInfo.ts

@@ -45,22 +45,71 @@ export function commonResultInfo(fn: Promise<any>, sign: ResultInfo, loading: Re
  * @param messageInfo
  * @returns
  */
-export async function requestResultLoadingAndInfo(fn: Function, param: any, loading: Ref<boolean>, messageInfo: [string, string] = ['成功', '失败']) {
+export async function requestResultLoadingAndInfo(fn: any, param: any, loading: Ref<boolean>, messageInfo: [string, string] = ['成功', '失败']) {
     console.log('请求接口参数: ', param);
     const [sucInfo, errInfo] = messageInfo
     loading.value = true;
-    try {
-        const result = await param ? fn(param) : fn()
-        message.success(sucInfo)
-        loading.value = false;
-        return Promise.resolve(result);
-    } catch (err) {
-        loading.value = false;
-        console.warn(`${fn}调用失败: ${err}`);
-        const temp = errInfo + err
-        message.error(temp)
-        return Promise.resolve(temp)
-    }
+    return new Promise((resolve, reject) => {
+        if (param) {
+            fn(param).then((res: any) => {
+                message.success(sucInfo)
+                loading.value = false;
+                resolve(res);
+            }).catch((err: string) => {
+                loading.value = false;
+                const msg = '您的申请已提交,请稍后查询结果!'
+                if (err === msg) {
+                    message.success(msg)
+                    resolve('ok');
+                } else {
+                    console.warn(`${fn}调用失败: ${err}`);
+                    const temp = errInfo + err
+                    message.error(temp)
+                    reject(temp)
+                }
+            })
+        } else {
+            fn().then((res: any) => {
+                message.success(sucInfo)
+                loading.value = false;
+                resolve(res);
+            }).catch((err: string) => {
+                loading.value = false;
+                const msg = '您的申请已提交,请稍后查询结果!'
+                if (err === msg) {
+                    message.success(msg)
+                    resolve('ok');
+                } else {
+                    console.warn(`${fn}调用失败: ${err}`);
+                    const temp = errInfo + err
+                    message.error(temp)
+                    reject(temp)
+                }
+            })
+        }
+    })
+
+
+    // try {
+    //     let result = await param ? fn(param) : fn()
+    //     if (!!result && (typeof result === 'object' || result === 'function') && typeof result.then === 'function') {
+    //         result = await result.then()
+    //     }
+    //     // result.then(res => {
+    //     //     console.log('rreeeeeee', res)
+    //     // })
+    //     console.log('请求结果:', result)
+    //     console.log('请求结果:', typeof result)
+    //     message.success(sucInfo)
+    //     loading.value = false;
+    //     return Promise.resolve(result);
+    // } catch (err) {
+    //     loading.value = false;
+    //     console.warn(`${fn}调用失败: ${err}`);
+    //     const temp = errInfo + err
+    //     message.error(temp)
+    //     return Promise.resolve(temp)
+    // }
 }
 
 /**

+ 45 - 1
src/services/socket/bank/index.ts

@@ -3,6 +3,7 @@ import { getAccoutIdList } from '@/services/bus/account';
 import { buildProtoReq50, parseProtoRsp50 } from '@/services/socket/protobuf/buildReq';
 import { Callback } from '@/utils/websocket/index';
 import * as type from './interface/index';
+import { BuildInMoneyReq } from './interface/index';
 
 
 /**
@@ -30,7 +31,6 @@ export function buildOutMoney(param: type.buildOutMoneyReqParam) {
         };
         // Object.assign(params.reqParams, param, { OldTaPWD: sha256.hex(param.OldTaPWD) });
         Object.assign(params.reqParams, param);
-        console.log('params', params);
         const package50 = buildProtoReq50(params);
         APP.sendTradingServer(package50, undefined, {
             onSuccess: (res) => {
@@ -49,6 +49,50 @@ export function buildOutMoney(param: type.buildOutMoneyReqParam) {
 }
 
 /**
+ * 构建入金请求包的方法
+ * @param param
+ * @returns
+ */
+export function buildInMoney(param: BuildInMoneyReq) {
+    return new Promise((resolve, reject) => {
+        const params = {
+            protobufName: 't2bBankDepositReq',
+            funCodeName: 't2bBankDepositReq',
+            reqParams: {
+                ExtOperatorID: Date.now(), // 外部操作流水号
+                ExchId: '', // 交易所编号
+                Currency: 'RMB', // 币种
+                BankChildAccount: '', // 银行子账号
+                BankChildAccountName: '', // 银行子账号名
+                OpenCardBankId: '', // 银行卡行号
+                AppDateTime: null, // 申请日期和时间
+                Desc: '', // 备注
+                IdentifyCode: null, // 验证码
+                BranchBankName: null, // 收款支行名称
+                Remark: '', // 备注
+                ExchTicket: '', // 交易所流水号
+            },
+        };
+        // Object.assign(params.reqParams, param, { OldTaPWD: sha256.hex(param.OldTaPWD) });
+        Object.assign(params.reqParams, param);
+        const package50 = buildProtoReq50(params);
+        APP.sendTradingServer(package50, undefined, {
+            onSuccess: (res) => {
+                const { isSuccess, result } = parseProtoRsp50(res, 't2bBankDepositRsp');
+                if (isSuccess) {
+                    resolve('ok');
+                } else {
+                    reject(result);
+                }
+            },
+            onFail: (err) => {
+                reject(err.message)
+            },
+        } as Callback);
+    });
+}
+
+/**
  * 签约请求
  */
 export const requestBankSign = (param: type.t2bBankSignReq): Promise<type.t2bBankSignRsp[]> => {

+ 25 - 5
src/services/socket/bank/interface/index.ts

@@ -163,15 +163,35 @@ export interface CusBankInfoRsp {
 
 //  出金请求 参数
 export interface buildOutMoneyReqParam {
-    AccountCode: string; // 资金账户
+    AccountCode?: string; // 资金账户
     Currency?: string;
-    CusBankID: string; // 托管银行编号
+    CusBankID?: string; // 托管银行编号
     AccountType?: number; // 账户类型
-    BankAccoutNum: string; // 银行卡号
-    BankAccoutName: string; // 银行卡户名
+    BankAccoutNum?: string; // 银行卡号
+    BankAccoutName?: string; // 银行卡户名
     Amount: number; // 出金金额
     OldTaPWD?: string; // 资金密码
-    extend_info: string; // 扩展信息(JSON串,参考配置要求进行填充)
+    extend_info?: string; // 扩展信息(JSON串,参考配置要求进行填充)
+}
+
+export interface BuildInMoneyReq {
+    ExtOperatorID: number; // 外部操作流水号
+    Amount: number; // 金额
+    CusBankID: string; // 托管银行编号
+    ExchId?: string; // 交易所编号
+    TradeDate?: string; // 交易日
+    ExchTicket?: string; // 交易所流水号
+    AccountCode?: string; // 资金账户
+    BusinessNo?: string; // 银行业务编号
+    BankChildAccount?: string; // 银行子账号
+    BankChildAccountName?: string; // 银行子账号名
+    OldTaPWD?: string; // 资金密码
+    Currency?: string; // 币种
+    Remark?: string; // 备注
+    OpenCardBankId?: string; // 银行卡行号
+    BankAccoutNum?: string; // 银行卡号
+    BankAccoutName?: string; // 银行卡户名
+    extend_info?: string; // 扩展信息(JSON串, 参考配置要求进行填充
 }
 
 export interface buildSearchMoneyOutInParam {

+ 8 - 14
src/views/order/funding_information/components/funding_information_funding_summary/components/funding_information_funding_summary_recharge/index.vue

@@ -59,8 +59,8 @@ import { validateAction } from '@/common/setup/form';
 import { _closeModal } from '@/common/setup/modal/modal';
 import { getUploadImg } from '@/common/setup/upload';
 import { Taaccount } from '@/services/go/TaAccount/interface';
-import { buildOutMoney } from '@/services/socket/bank';
-import { buildOutMoneyReqParam } from '@/services/socket/bank/interface';
+import { buildInMoney } from '@/services/socket/bank';
+import { BuildInMoneyReq, buildOutMoneyReqParam } from '@/services/socket/bank/interface';
 import { message } from 'ant-design-vue';
 import { defineComponent, PropType, ref } from 'vue';
 import { getApplyInOrOutTime, useSignBank } from '../setup';
@@ -68,7 +68,7 @@ import { FormState } from './interface';
 import { handleForm } from './setup';
 
 export default defineComponent({
-    name: ModalEnum.commodity_contract_summary_transfer,
+    name: 'funding_information_funding_summary_recharge',
     components: { Drawer, UploadImg },
     emits: ['cancel', 'update'],
     props: {
@@ -98,7 +98,8 @@ export default defineComponent({
             validateAction<FormState>(formRef, formState).then((res) => {
                 const signBank = getSignBank()!;
                 const extendInfo = { certificatephotourl: url };
-                const param: buildOutMoneyReqParam = {
+                const param: BuildInMoneyReq = {
+                    ExtOperatorID: Date.now(), // 外部操作流水号
                     AccountCode: signBank.accountcode,
                     Currency: signBank.currency,
                     CusBankID: signBank.cusbankid,
@@ -107,16 +108,9 @@ export default defineComponent({
                     Amount: res.price,
                     extend_info: JSON.stringify(extendInfo),
                 };
-                const sucessMsg = '您的申请已提交,请稍后查询结果!';
-                requestResultLoadingAndInfo(buildOutMoney, param, loading, [sucessMsg, '充值失败:'])
-                    .then(() => {
-                        cancel(true);
-                    })
-                    .catch((err) => {
-                        if (err === sucessMsg) {
-                            cancel(true);
-                        }
-                    });
+                requestResultLoadingAndInfo(buildInMoney, param, loading, ['充值成功', '充值失败:']).then(() => {
+                    cancel(true);
+                });
             });
         }
         return {

+ 64 - 71
src/views/order/funding_information/components/funding_information_funding_summary/components/funding_information_funding_summary_withdraw/index.vue

@@ -11,14 +11,37 @@
               :rules="rules">
         <div class="formBar">
           <a-row :gutter="24">
-            <a-col :span="12">
-              <a-form-item label="充值金额"
+            <a-col :span="24">
+              <a-form-item label="提现金额"
                            name="price">
                 <a-input-number class="commonInput"
                                 v-model:value="formState.price"
                                 style="width: 100%" />
               </a-form-item>
             </a-col>
+            <a-col :span="24">
+              <a-form-item label="银行卡号">
+                <span class="white ml8">{{getItemSignBankValue('bankname')}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="开会银行">
+                <span class="white ml8">{{getItemSignBankValue('bankaccountno')}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="姓名">
+                <span class="white ml8">{{getItemSignBankValue('accountname')}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="支行名称">
+                <span class="white ml8">{{getItemSignBankValue('branchbankname')}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <span class="red">充值提现时间段:{{getApplyInOrOutTime()}}</span>
+            </a-col>
           </a-row>
         </div>
         <a-row :gutter="24">
@@ -31,7 +54,7 @@
                         @click="submit">提交
               </a-button>
               <a-button key="submit"
-                        class="cancelBtn"
+                        class="ml10 cancelBtn"
                         @click="cancel">取消</a-button>
             </a-form-item>
           </a-col>
@@ -42,92 +65,60 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, ref } from 'vue';
 import Drawer from '@/common/components/drawer/index.vue';
-import { WrPerformancePlan, WrPosition } from '@/services/go/wrtrade/interface';
+import UploadImg from '@/common/components/uploadImg/index.vue';
 import { ModalEnum } from '@/common/constants/modalNameEnum';
-import { _closeModal } from '@/common/setup/modal/modal';
-import { handleForm } from './setup';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { validateAction } from '@/common/setup/form';
-import { FormState } from './interface';
-import UploadImg from '@/common/components/uploadImg/index.vue';
+import { _closeModal } from '@/common/setup/modal/modal';
 import { getUploadImg } from '@/common/setup/upload';
-import { PerformanceContractedApplyReq, PerformanceDelayApplyReq } from '@/services/proto/performance/interface';
-import { getSelectedAccount, getSelectedAccountId, getUserId } from '@/services/bus/account';
-import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
-import { performanceContractedApply, performanceDelayApply } from '@/services/proto/performance';
-import { BuyOrSell, DelistingType, PriceType } from '@/common/constants/enumCommon';
-import Long from 'long';
-import { OrderReq } from '@/services/socket/order/interface';
-import { v4 as uuidv4 } from 'uuid';
-import moment from 'moment';
-import { geLoginID_number } from '@/services/bus/login';
-import { LongType } from '@/services/socket/login/interface';
-import { Order } from '@/services/socket/order';
-import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
+import { QueryBankAccountSignQsp } from '@/services/go/ermcp/qhj/interface';
+import { Taaccount } from '@/services/go/TaAccount/interface';
+import { buildOutMoney } from '@/services/socket/bank';
+import { buildOutMoneyReqParam } from '@/services/socket/bank/interface';
+import { message } from 'ant-design-vue';
+import { defineComponent, PropType, ref } from 'vue';
+import { getApplyInOrOutTime, useSignBank } from '../setup';
+import { FormState } from './interface';
+import { handleForm } from './setup';
 
 export default defineComponent({
-    name: ModalEnum.commodity_contract_summary_transfer,
+    name: 'funding_information_funding_summary_withdraw',
     components: { Drawer, UploadImg },
     emits: ['cancel', 'update'],
     props: {
         selectedRow: {
-            type: Object as PropType<QueryTradePositionRsp>,
+            type: Object as PropType<Taaccount>,
             default: {},
         },
-        tableList: {
-            type: Array as PropType<QueryTradePositionRsp[]>,
-            default: [],
-        },
     },
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const { rules, formState, formRef } = handleForm();
+        // 签约银行
+        const { hasSignBank, getSignBank, getItemSignBankValue } = useSignBank();
+
         function submit() {
-            // 挂牌请求 通过合约汇总 挂牌转让
-            // validateAction<FormState>(formRef, formState).then((res) => {
-            //     const param: OrderReq = {
-            //         ClientSerialNo: uuidv4(), // 客户端流水号
-            //         ClientOrderTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), // 客户端委托时间
-            //         ClientType: 4, // 终端类型
-            //         LoginID: geLoginID_number()!, // 登陆账号
-            //         AccountID: getSelectedAccountId(), // 交易账号
-            //         GoodsID: res.goodsid, // 商品ID
-            //         MarketID: getSelectedGoods().marketid, // 市场ID
-            //         ValidType: 1, // 校验类型 当日有效
-            //         OperateType: 1, // 操作类型: 申请
-            //         OrderSrc: 1, // 单据来源: 客户端下单
-            //         OrderPrice: res.price, // 委托价格                      (需要填入)
-            //         OperatorID: Number(geLoginID_number()),
-            //         // MarketMaxSub: number // 市价允许最大偏差(做市)
-            //         OrderQty: res.num, // 委托数量                          (需要填入)
-            //         BuyOrSell: 1, // 买卖方向  0 买 1 卖
-            //         BuildType: 2, // 下单类型  1 建 2 平
-            //         // CurtQuotePrice: 0, // 保留,计算冻结金额使用
-            //         // SpPrice: 0 ,// 止盈价格
-            //         // SlPrice: 0 , // 止损价格
-            //         PriceMode: PriceType.limit, // 取价方式
-            //         TimevalidType: 1, // 时间有效类型 单日有效
-            //         TriggerType: 1, // 预埋单触发类型
-            //         // TriggerPrice: number // 预埋单触发价格
-            //         ListingSelectType: 1, // 挂牌点选类型 1:挂牌 2:摘牌 3:先摘后挂
-            //         DelistingType: DelistingType.selected, // 摘牌类型 2:点选成交
-            //         // RelatedID: number // 关联单号
-            //         OptionType: 1, // 期权类型(1:认购(看涨)2:认沽(看跌))
-            //         // Premium: number // 权利金
-            //         // TriggerOperator: number // 触发条件(1:大于等于2:小于等于)
-            //         // ServiceTime: string // 服务端时间
-            //         // CouponTypeID: number // 优惠券类型ID(买方)
-            //         // UsedQty: number // 使用数量
-            //         // ValidTime: string // 指定有效日期
-            //         // ReceiveInfoID: number // 收货地址ID
-            //         OrderFlag: 1,
-            //     };
-            //     requestResultLoadingAndInfo(Order, param, loading, ['挂牌成功', '挂牌失败:']).then(() => {
-            //         cancel(true);
-            //     });
-            // });
+            if (!hasSignBank()) {
+                message.error('请先签约银行!');
+                return;
+            }
+            validateAction<FormState>(formRef, formState).then((res) => {
+                const signBank = getSignBank()!;
+                const param: buildOutMoneyReqParam = {
+                    AccountCode: signBank.accountcode,
+                    Currency: signBank.currency,
+                    CusBankID: signBank.cusbankid,
+                    BankAccoutNum: signBank.bankaccountno2,
+                    BankAccoutName: signBank.bankaccountname2,
+                    Amount: res.price,
+                    extend_info: '',
+                };
+                requestResultLoadingAndInfo(buildOutMoney, param, loading, ['提现成功', '提现失败:']).then(() => {
+                    cancel(true);
+                });
+            });
         }
         return {
             visible,
@@ -137,6 +128,8 @@ export default defineComponent({
             rules,
             formState,
             formRef,
+            getApplyInOrOutTime,
+            getItemSignBankValue,
         };
     },
 });

+ 7 - 6
src/views/order/funding_information/components/funding_information_funding_summary/components/funding_information_funding_summary_withdraw/setup.ts

@@ -1,3 +1,5 @@
+import { validateCommon } from "@/common/setup/validate";
+import { RuleObject } from "ant-design-vue/lib/form/interface";
 import { reactive, ref, UnwrapRef } from "vue";
 import { FormState } from "./interface";
 
@@ -7,14 +9,13 @@ export function handleForm() {
         price: 0,
         url: '',
     })
+    const v_price = async (rule: RuleObject, value: number) => {
+        return validateCommon(value, '请输入提现金额');
+    };
     const rules = {
         price: [
-            { require, message: '请输入挂牌价', trigger: 'blur', type: 'number' },
-        ],
-        url: [
-            // { require, message: '请输入挂牌数量', trigger: 'blur', type: 'number' },
-            // { message: '挂牌数量小于1', min: 1, type: 'number' }
-        ],
+            { require, trigger: 'blur', type: 'number', validator: v_price },
+        ]
     }
     return { rules, formState, formRef }
 }

+ 9 - 1
src/views/order/funding_information/components/funding_information_funding_summary/components/setup.ts

@@ -34,5 +34,13 @@ export const useSignBank = () => {
         }
         return result
     }
-    return { signBanks, hasSignBank, getSignBank }
+    function getItemSignBankValue(key: keyof QueryBankAccountSignQsp) {
+        let result: string | number = '--'
+        const signBank = getSignBank();
+        if (signBank) {
+            result = signBank[key]
+        }
+        return result
+    }
+    return { signBanks, hasSignBank, getSignBank, getItemSignBankValue }
 }

+ 42 - 2
src/views/order/funding_information/components/funding_information_funding_summary/index.vue

@@ -18,7 +18,7 @@
         <BtnList :btnList="btnList"
                  :record="record"
                  class="btn-list-sticky"
-                 @click="openComponent" />
+                 @click="openComponentAction" />
       </template>
       <template #balance="{record}">
         <span>{{canUseMoney(record)}}</span>
@@ -50,6 +50,7 @@
 </template>
 
 <script lang="ts">
+import { BtnListType } from '@/common/components/btnList/interface';
 import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
 import { getTaacountStatus } from '@/common/constants/enumsName';
 import { BtnList, defineComponent, queryTableList } from '@/common/export/commonTable';
@@ -64,7 +65,9 @@ import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
 import { getTaAccounts } from '@/services/go/TaAccount';
 import { GetTaAccountsReq, Taaccount } from '@/services/go/TaAccount/interface';
 import Bus from '@/utils/eventBus/index';
+import { message } from 'ant-design-vue';
 import { defineAsyncComponent, ref } from 'vue';
+import { useSignBank } from './components/setup';
 import { tableColumns, useHazardRates } from './setup';
 
 export default defineComponent({
@@ -101,8 +104,32 @@ export default defineComponent({
             tableName: 'table_pcweb_spot_trade_bottom_funding_info_summary',
             recordList: getRecordItemTab(),
         };
+
+        const {
+            contextMenu,
+            openContext,
+            closeContext, // 右键
+            columns,
+            registerColumn,
+            updateColumn, // 表头
+            expandedRowKeys,
+            selectedRow,
+            Rowclick, // 表格折腾面板数据与单击、双击事件
+            componentId,
+            closeComponent,
+            openComponent, // 控制异步组件
+            btnList, // 表格按钮
+        } = handleComposeOrderTable<Taaccount>(param);
+        // 签约银行
+        const { hasSignBank } = useSignBank();
+        function openComponentAction(item: BtnListType, record: Taaccount) {
+            if (hasSignBank()) {
+                openComponent(item, record);
+            } else {
+                message.error('请先签约银行!');
+            }
+        }
         return {
-            ...handleComposeOrderTable<Taaccount>(param),
             loading,
             tableList,
             getCanUseMoney,
@@ -114,6 +141,19 @@ export default defineComponent({
             getTaacountStatus,
             netWorth,
             canUseMoney,
+            contextMenu,
+            openContext,
+            closeContext, // 右键
+            columns,
+            registerColumn,
+            updateColumn, // 表头
+            expandedRowKeys,
+            selectedRow,
+            Rowclick, // 表格折腾面板数据与单击、双击事件
+            componentId,
+            closeComponent,
+            openComponentAction, // 控制异步组件
+            btnList, // 表格按钮
         };
     },
 });