瀏覽代碼

修改资金账号

huangbin 4 年之前
父節點
當前提交
2f79858878

+ 36 - 3
src/services/bus/account.ts

@@ -1,6 +1,7 @@
 import APP from '@/services';
 import { getLoginData } from '@/services/bus/login';
 import { LongType } from '@/services/socket/login/interface/index';
+import { AccountListItem } from '../dataCenter/interafce/account';
 
 /**
  * 获取资金账号列表
@@ -16,6 +17,28 @@ export const getAccoutIdList = (): string => {
     }, '');
 };
 
+// taaccounttype: number;//账号类型 - 1:外部账号 2:内部账号 3:内部做市自营账号 4:内部做市接单账号
+type taaccounttype = 1 | 2 | 3 | 4
+export function getAccountTypeList(type: taaccounttype[]): AccountListItem[] {
+    return APP.get('accountList').filter((e: AccountListItem) => type.includes(e.taaccounttype as taaccounttype))
+}
+
+// 获取内部资金账号
+// 先判断当前选中的资金账号是否为内部账号,是的话取当前的账号,不是的话,取内部账号列表里的第一个
+export function getInTaAccount(): number {
+    const seleced = getSelectedAccount()
+    let result: number = seleced.accountid
+    if (seleced.taaccounttype !== 2) {
+        const list = getAccountTypeList([2])
+        if (list.length) {
+            result = list[0].accountid
+        } else {
+            throw new Error('未获取到内部资金账号,请确认!')
+        } ''
+    }
+    return result
+}
+
 /**
  * 获取第一个资金账号
  * @rerurn long型 | null
@@ -94,9 +117,19 @@ export function getCanUserMoney() {
     return result;
 }
 
+// 获取选中的资金账号信息
+export function getSelectedAccount(): AccountListItem {
+    return APP.get('selectedAccount')
+}
+
+// 设置当前中的资金账号
+export function setSelectedAccount(value: AccountListItem) {
+    APP.set('selectedAccount', value)
+}
+
 /**
- * 获取选中的资金账号(目前 写死第一个,后期账号切换的时候在进行修改)
+ * 获取选中的资金账号
  */
-export function getSelectedAccountId(): LongType | null {
-    return getAccount_longType()
+export function getSelectedAccountId(): number {
+    return getSelectedAccount().accountid
 }

+ 2 - 1
src/services/dataCenter/index.ts

@@ -1,5 +1,5 @@
 import { reactive, toRefs } from 'vue';
-import { LastUpdateTimeModel, LoginaccountModel, MarketrunModal, TradeDateModel, UserAccountModel, UserInfoModel } from './initDataModel/account';
+import { LastUpdateTimeModel, LoginaccountModel, MarketrunModal, SelectedAccountModel, TradeDateModel, UserAccountModel, UserInfoModel } from './initDataModel/account';
 import { NeedClearSourceDataType, NoClearSourceDataType } from './interface';
 
 /**
@@ -26,6 +26,7 @@ const needClearSourceData: NeedClearSourceDataType = {
     // checkTokenTimeDiff: Math.floor(Math.random() * 6 + 5) * 60 * 1000,
     checkTokenTimeDiff: 1 * 60 * 1000,
     accountList: [],
+    selectedAccount: new SelectedAccountModel(),
     areaRoleMarketList: [],
     taAccountMarketList: [],
     lastUpdateTime: new LastUpdateTimeModel(),

+ 62 - 1
src/services/dataCenter/initDataModel/account.ts

@@ -1,4 +1,4 @@
-import { LastUpdateTime, TradeDate } from '@/services/dataCenter/interafce/account';
+import { AccountListItem, LastUpdateTime, TradeDate } from '@/services/dataCenter/interafce/account';
 import { Marketrun } from '@/services/go/commonMarket/interface';
 import { Loginaccount, Useraccount, Userinfo } from '@/services/go/useInfo/interface';
 
@@ -164,4 +164,65 @@ export class MarketrunModal implements Marketrun {
     tradedate = '';//当前交易日(服务) 资金结算完成即变更,供交易服务使用
     tradedate2 = '';//当前交易日(行情) 在第一个市场待开市时变更为TradeDate,供行情及终端系统使用
     updatetime = '';//更新时间
+}
+
+export class SelectedAccountModel implements AccountListItem {
+    accountflag = 0;//账户标识 - number;
+    //\1 (默认为number;
+    //, 当上级账户与本账户的关联用户均为自己时更新为1)
+    accountid = 0;//资金账户ID
+    accountname = '';//账户名称
+    balance = 0;//期初余额
+    capitalbalance = 0;//本金余额[外部子账户实际出入金余额]
+    changeflag = 0;//变动标志(当前账户资金有任何变动更新为1系统结算时更新number;
+    //;供清算时使用) number;
+    //:无变动 1:有变动
+    changetime = '';//账户状态变更时间
+    closepl = 0;//今日平仓盈亏
+    creditdecrease = 0;//今日授信减少
+    creditincrease = 0;//今日授信增加
+    currencyid = 0;//货币ID
+    currentbalance = 0;//期末余额
+    freezecharge = 0;//手续费冻结
+    freezemargin = 0;//冻结保证金
+    fromaccountid = 0;//所属上级账户
+    inamount = 0;//今日入金金额(包括三方入金)
+    ismain = 0;//是否母账号 number;
+    //:不是母账户 1:是母账户
+    ismarketaccount = 0;//是否机构接单账号 number;
+    //:不是 1:是
+    isreckonaccount = 0;//是否机构分润账号 number;
+    //:不是 1:是
+    mortgagecredit = 0;//授信金额
+    orifreezecharge = 0;//期初手续费冻结
+    orifreezemargin = 0;//期初冻结保证金
+    orimortgagecredit = 0;//期初授信金额
+    oriothercredit = 0;//期初其它授信金额
+    oriotherfreezemargin = 0;//期初其他冻结保证金(出金冻结资金 交割买方冻结 申购冻结 全款买入 商城买入)
+    orioutamountfreeze = 0;//期初出金冻结
+    oriusedmargin = 0;//期初占用保证金
+    othercredit = 0;//其它授信金额
+    othercreditdecrease = 0;//今日其它授信减少
+    othercreditincrease = 0;//今日其它授信增加
+    otherfreezemargin = 0;//其他冻结保证金(交割买方冻结 申购冻结 全款买入 商城买入)
+    otherincome = 0;//其他收入(交割收款 申购收款 全款卖出 商城卖出 买家退货 会员手续费收入)
+    otherpay = 0;//其他支出(交割付款 申购付款 全款买入 商城买入 卖家退货)
+    outamount = 0;//今日出金金额(包括三方出金)
+    outamountfreeze = 0;//出金冻结
+    outthreshold = 0;//出金阈值
+    parentaccountid = 0;//所属根账号
+    paycharge = 0;//今日手续费支出
+    relatedaccountstatus = 0;//关联用户交易权限状态 - 1:正常(可交易) 2:受限(可平仓,不可建仓) 3:冻结(不可交易)
+    relateduserid = 0;//关联用户
+    serivcegroup = 0;//服务分组
+    signstatus = 0;//签约状态 - 1:未签约 2:签约待审核 3:签约中 4:已签约 5:解约待审核 6:解约中 7:已解约 8:已解绑 9:绑卡中
+    sublevelpath = '';//账号层级路径(逗号分隔,首尾加逗号)
+    taaccounttype = 0;//账号类型 - 1:外部账号 2:内部账号 3:内部做市自营账号 4:内部做市接单账号
+    thirdinamount = 0;//今日三方入金
+    thirdoutamount = 0;//今日三方出金
+    tradestatus = 0;//交易状态 - 1:正常 2:受限 3:冻结 4:禁止建仓(人工受限) 5:禁止交易(人工冻结) 6:待激活 7:已注销
+    tradestatuschangetime = '';//激活时间
+    transferamount = 0;//今日划转金额(母子账号资金划转,从划入账号为正,从账号划出为负)
+    usedmargin = 0;//占用保证金
+    userid = 0;//用户ID
 }

+ 1 - 0
src/services/dataCenter/interface.ts

@@ -44,6 +44,7 @@ export interface NeedClearSourceDataType {
     queryClientFixedADConfigs: advert.fixedADConfigs[]; //首页图片广告
     checkTokenTimeDiff: number; // 轮休校验token时间差
     accountList: AccountListItem[]; // 资金账户列表
+    selectedAccount: AccountListItem; // 当前选中的资金账号
     areaRoleMarketList: any[]; // 机构角色市场权限
     taAccountMarketList: any[]; // 资金账号市场权限
     lastUpdateTime: LastUpdateTime; // 时间戳集合

+ 8 - 5
src/services/go/TaAccount/index.ts

@@ -1,8 +1,8 @@
 import APP from '@/services';
+import { setSelectedAccount } from '@/services/bus/account';
 import { getLongTypeLoginID } from "@/services/bus/login";
+import { GetTaAccountsReq, QueryAmountLogReq, QueryAmountLogRsp, Taaccount } from "@/services/go/TaAccount/interface";
 import { commonSearch_go } from "..";
-import {ErmcpBizGroupEx} from "@/services/go/ermcp/account/interface";
-import {GetTaAccountsReq, QueryAmountLogReq, QueryAmountLogRsp, Taaccount} from "@/services/go/TaAccount/interface";
 
 /**
  *  获取资金账户信息
@@ -11,6 +11,9 @@ export function getTaAccount() {
     const loginID = getLongTypeLoginID()?.toNumber()
     return commonSearch_go('/TaAccount/GetTaAccounts', { loginID }).then(res => {
         APP.set('accountList', res);
+        if (res.length) {
+            setSelectedAccount(res[0])
+        }
         return 'ok'
     }).catch(err => { throw new Error(`获取资金账户信息失败:${err}`) })
 }
@@ -20,8 +23,8 @@ export function getTaAccount() {
  * 资金流水查询(当前)
  * @param req
  */
-export function queryAmountLog(req: QueryAmountLogReq) : Promise<QueryAmountLogRsp> {
-    return commonSearch_go('/TaAccount/QueryAmountLog', req ).catch((err) => {
+export function queryAmountLog(req: QueryAmountLogReq): Promise<QueryAmountLogRsp> {
+    return commonSearch_go('/TaAccount/QueryAmountLog', req).catch((err) => {
         throw new Error(`资金流水查询(当前): ${err}`);
     });
 }
@@ -32,7 +35,7 @@ export function queryAmountLog(req: QueryAmountLogReq) : Promise<QueryAmountLogR
  * @param req
  */
 export function getTaAccounts(req: GetTaAccountsReq): Promise<Taaccount> {
-    return commonSearch_go('/TaAccount/GetTaAccounts',  req ).catch((err) => {
+    return commonSearch_go('/TaAccount/GetTaAccounts', req).catch((err) => {
         throw new Error(`获取资金账户信息: ${err}`);
     });
 }

+ 1 - 2
src/services/go/ermcp/qhj/index.ts

@@ -118,8 +118,7 @@ export function queryParentAreaList(): Promise<QhjParentAreaList[]> {
  * @param req
  */
 export function queryPayOrder(req: QueryPayOrderReq): Promise<QhjPayOrder[]> {
-    const accountid = getSelectedAccountId()?.toNumber()
-    req.accountid = accountid as number
+    req.accountid = getSelectedAccountId()
     return commonSearch_go('/Qhj/QueryPayOrder', req).catch((err) => {
         throw new Error(`查询待付款单据: ${err}`);
     });

+ 1 - 1
src/services/go/wrtrade/index.ts

@@ -111,7 +111,7 @@ export function queryWrTradeDetail(req: QueryWrTradeDetailReq): Promise<WrTradeD
  * @param req
  */
 export function queryHoldLB(): Promise<WrHoldLB[]> {
-    const accountid = Number(getSelectedAccountId())
+    const accountid = getSelectedAccountId()
     return commonSearch_go('/WrTrade2/QueryHoldLB', { accountid }).catch((err) => {
         throw new Error(`查询仓单持有记录: ${err}`);
     });

+ 1 - 1
src/views/information/warehouse-info/compoments/disable/index.vue

@@ -106,7 +106,7 @@ export default defineComponent({
                 okText: '确认停用',
                 cancelText: '取消',
                 onOk() {
-                    const accountid = getSelectedAccountId()?.toNumber();
+                    const accountid = getSelectedAccountId();
                     const req: WarehouseStateChangeReq = {
                         accountid: accountid === undefined ? 0 : accountid,
                         warehouseid: props.selectedRow.autoid,

+ 1 - 1
src/views/information/warehouse-info/compoments/recover/index.vue

@@ -106,7 +106,7 @@ export default defineComponent({
                 okText: '确认恢复',
                 cancelText: '取消',
                 onOk() {
-                    const accountid = getSelectedAccountId()?.toNumber();
+                    const accountid = getSelectedAccountId();
                     const req: WarehouseStateChangeReq = {
                         accountid: accountid === undefined ? 0 : accountid,
                         warehouseid: props.selectedRow.autoid,

+ 1 - 1
src/views/market/spot_trade/components/buy-sell-market/components/delisting/index.vue

@@ -66,7 +66,7 @@ export default defineComponent({
             // 摘卖方向
             const param: HdWRDealOrderReq = {
                 UserID: getUserId(), // uint32 用户ID
-                AccountID: Number(getSelectedAccountId() as Long), // uint64 资金账号
+                AccountID: getSelectedAccountId(), // uint64 资金账号
                 RelatedWRTradeOrderID: props.selectedRow.wrtradeorderid, // uint64 关联委托单号(摘牌委托关联挂牌委托单ID)
                 WRTransferUserID: props.selectedRow.userid, // uint32 仓单受让用户
                 OrderQty: num.value, // uint64 委托数量

+ 1 - 0
src/views/market/spot_trade/components/buy-sell-market/index.vue

@@ -83,6 +83,7 @@ import { LineChartOutlined } from '@ant-design/icons-vue';
 import { handleModalComponent } from '@/common/setup/asyncComponent';
 import { PropType, ref } from 'vue';
 import { handleSpotBtnList } from '../../setup';
+import { addSubscribeQuotation } from '@/services/socket/quota';
 
 export default defineComponent({
     emits: ['cancel'],

+ 9 - 9
src/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_floating_price/index.vue

@@ -51,16 +51,16 @@ export default defineComponent({
                 wrpricetype: 2,
                 haswr: 1,
             };
-            queryTable(queryOrderQuote, param).then((res) => {
-                uuid = uuidv4();
-                // 订阅行情
-                const list: subscribeInfoType[] = res.map((el) => {
-                    return { exchangeCode: 250, goodsCode: el.goodscode, subState: 0 };
-                });
-                addSubscribeQuotation(uuid, list);
-            });
+            // queryTable(queryOrderQuote, param).then((res) => {
+            //     uuid = uuidv4();
+            //     // 订阅行情
+            //     const list: subscribeInfoType[] = res.map((el) => {
+            //         return { exchangeCode: 250, goodsCode: el.goodscode, subState: 0 };
+            //     });
+            //     addSubscribeQuotation(uuid, list);
+            // });
         };
-        onMounted(() => {});
+        // onMounted(() => {});
         // 表格通用逻辑
         const param: ComposeTableParam = {
             queryFn: queryTableAction,

+ 6 - 9
src/views/order/spot_warran/components/spot_warrant_spot_details/components/listing/index.vue

@@ -143,7 +143,7 @@ import { defineComponent, PropType, ref } from 'vue';
 import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
 import Drawer from '@/common/components/drawer/index.vue';
 import { QueryWrPositionReq, WrHoldLB, WrPosition } from '@/services/go/wrtrade/interface';
-import { getUserId } from '@/services/bus/account';
+import { getInTaAccount, getUserId } from '@/services/bus/account';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { hdWROrder } from '@/services/proto/warehousetrade';
 import { v4 as uuidv4 } from 'uuid';
@@ -157,7 +157,7 @@ import { getMarketRunByTradeMode } from '@/services/bus/market';
 import { message } from 'ant-design-vue';
 import { getGoodsGroupsByTradeMode } from '@/services/bus/goods';
 import { TradeMode } from '@/common/constants/enumCommon';
-import {WRGoodsInfo} from "@/services/proto/warehousetrade/interface";
+import { WRGoodsInfo } from '@/services/proto/warehousetrade/interface';
 
 export default defineComponent({
     name: ModalEnum.spot_warrant_spot_details_listed,
@@ -180,17 +180,16 @@ export default defineComponent({
             const marketInfo = getMarketRunByTradeMode(17);
             if (marketInfo) {
                 validateAction<ListingForm>(formRef, formState).then((res) => {
-
                     const wrGoodsInfo: WRGoodsInfo = {
                         GoodsID: res.goodsid as number, // uint32 配置商品ID
-                        GoodsCode: "", // string 配置商品代码
+                        GoodsCode: findGoodsCode(res.goodsid as number) as string, // string 配置商品代码
                         PriceFactor: 1, // double 商品价格系数
                         PriceMove: 0, // double 商品升贴水值
                         WeightRatio: 1, // double 商品重量系数
-                    }
+                    };
 
                     const param = {
-                        AccountID: data.accountid.toString(), // 默认内部资金账号第一个
+                        AccountID: getInTaAccount(), // 默认内部资金账号第一个
                         ClientSerialNo: uuidv4(), // 客户端流水号
                         // OperateSrc: 2,
                         ClientType: 4,
@@ -225,9 +224,7 @@ export default defineComponent({
                         Remark: '222', // 备注
                         ApplyID: 0, // 申请ID
                         CanPart: 1, // 是否允许部份摘牌0:不允许;1:允许
-                        WRTradeGoods: [
-                            wrGoodsInfo
-                        ],
+                        WRTradeGoods: [wrGoodsInfo],
                         wrstandardid: props.selectedRow.wrstandardid,
                         HasWr: 1,
                     };