Przeglądaj źródła

添加 充值 功能

huangbin 4 lat temu
rodzic
commit
cba691deac

+ 2 - 2
src/services/socket/bank/index.ts

@@ -2,7 +2,6 @@ import APP from '@/services';
 import { getAccoutIdList } from '@/services/bus/account';
 import { buildProtoReq50, parseProtoRsp50 } from '@/services/socket/protobuf/buildReq';
 import { Callback } from '@/utils/websocket/index';
-import { sha256 } from 'js-sha256';
 import * as type from './interface/index';
 
 
@@ -29,7 +28,8 @@ export function buildOutMoney(param: type.buildOutMoneyReqParam) {
                 ExchTicket: '', // 交易所流水号
             },
         };
-        Object.assign(params.reqParams, param, { OldTaPWD: sha256.hex(param.OldTaPWD) });
+        // 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, {

+ 3 - 2
src/services/socket/bank/interface/index.ts

@@ -164,12 +164,13 @@ export interface CusBankInfoRsp {
 //  出金请求 参数
 export interface buildOutMoneyReqParam {
     AccountCode: string; // 资金账户
+    Currency?: string;
     CusBankID: string; // 托管银行编号
-    AccountType: number; // 账户类型
+    AccountType?: number; // 账户类型
     BankAccoutNum: string; // 银行卡号
     BankAccoutName: string; // 银行卡户名
     Amount: number; // 出金金额
-    OldTaPWD: string; // 资金密码
+    OldTaPWD?: string; // 资金密码
     extend_info: string; // 扩展信息(JSON串,参考配置要求进行填充)
 }
 

+ 47 - 71
src/views/order/funding_information/components/funding_information_funding_summary/components/funding_information_funding_summary_recharge/index.vue

@@ -20,8 +20,7 @@
               </a-form-item>
             </a-col>
             <a-col :span="24">
-              <a-form-item label="凭证"
-                           name="url">
+              <a-form-item label="凭证">
                 <UploadImg :visible="visible"
                            @upload="uploadImgAction"></UploadImg>
               </a-form-item>
@@ -52,30 +51,21 @@
 </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 { getApplyInOrOutTime } from '../setup';
+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,
@@ -83,13 +73,9 @@ export default defineComponent({
     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);
@@ -97,51 +83,41 @@ export default defineComponent({
         const { rules, formState, formRef } = handleForm();
         // 附件
         const { getFirstImg, uploadImgAction } = getUploadImg();
-        //
+        // 签约银行
+        const { hasSignBank, getSignBank } = 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;
+            }
+            const url = getFirstImg();
+            if (!url) {
+                message.error('请先上传凭证');
+                return;
+            }
+            validateAction<FormState>(formRef, formState).then((res) => {
+                const signBank = getSignBank()!;
+                const extendInfo = { certificatephotourl: url };
+                const param: buildOutMoneyReqParam = {
+                    AccountCode: signBank.accountcode,
+                    Currency: signBank.currency,
+                    CusBankID: signBank.cusbankid,
+                    BankAccoutNum: signBank.bankaccountno2,
+                    BankAccoutName: signBank.bankaccountname2,
+                    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);
+                        }
+                    });
+            });
         }
         return {
             visible,

+ 7 - 6
src/views/order/funding_information/components/funding_information_funding_summary/components/funding_information_funding_summary_recharge/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 }
 }

+ 26 - 0
src/views/order/funding_information/components/funding_information_funding_summary/components/setup.ts

@@ -1,4 +1,7 @@
 import { getSystemParamValueByCode } from "@/hooks/system";
+import { queryBankAccountSign } from "@/services/go/ermcp/qhj";
+import { QueryBankAccountSignQsp } from "@/services/go/ermcp/qhj/interface";
+import { ref } from "vue";
 
 // 获取 充值提现时间段
 export const getApplyInOrOutTime = () => {
@@ -9,4 +12,27 @@ export const getApplyInOrOutTime = () => {
         result = beginTime + '~' + endTime
     }
     return result
+}
+
+// 获取 签约银行
+export const useSignBank = () => {
+    // 签约银行列表
+    const signBanks = ref<QueryBankAccountSignQsp[]>([])
+    if (signBanks.value.length === 0) {
+        queryBankAccountSign().then(res => {
+            // 4: 已签约
+            signBanks.value = res.filter(e => e.signstatus = 4)
+        })
+    }
+    function hasSignBank() {
+        return signBanks.value.length > 0
+    }
+    function getSignBank() {
+        let result = null
+        if (hasSignBank()) {
+            result = signBanks.value[0]
+        }
+        return result
+    }
+    return { signBanks, hasSignBank, getSignBank }
 }