|
|
@@ -1,9 +1,9 @@
|
|
|
-import { reactive, shallowRef } from 'vue'
|
|
|
+import { reactive, shallowRef, computed } from 'vue'
|
|
|
import { useDataTable } from '@/hooks/datatable'
|
|
|
import { useLoginStore, useUserStore } from '@/stores'
|
|
|
-import { queryHisAmountLog, t2bBankWithdraw, queryBankAccountSign, t2bBankDeposit, queryAccountInOutApply, queryCusBankSignBank, t2bBankSign, t2bBankCancelSign } from '@/services/api/bank'
|
|
|
-import { formatDate } from '@/filters'
|
|
|
-import { Model } from 'echarts'
|
|
|
+import { queryHisAmountLog, t2bBankWithdraw, queryBankAccountSign, t2bBankDeposit, queryAccountInOutApply, queryCusBankSignBank, t2bBankSign, t2bBankCancelSign, accountFundInfoReq } from '@/services/api/bank'
|
|
|
+import { decryptAES } from '@/utils/websocket/crypto'
|
|
|
+import moment from "moment";
|
|
|
|
|
|
// 历史资金流水列表
|
|
|
export function useBankStatementList() {
|
|
|
@@ -50,7 +50,7 @@ export function getAccountInOutApplyList() {
|
|
|
const getAccouuntInOutApplyList = () => {
|
|
|
loading.value = true
|
|
|
return queryAccountInOutApply({
|
|
|
- data:{
|
|
|
+ data: {
|
|
|
userid: getUserId()
|
|
|
},
|
|
|
success: (res) => {
|
|
|
@@ -64,12 +64,12 @@ export function getAccountInOutApplyList() {
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
- loading,
|
|
|
+ loading,
|
|
|
dataList,
|
|
|
- total,
|
|
|
- pageIndex,
|
|
|
- pageSize,
|
|
|
- pageCount,
|
|
|
+ total,
|
|
|
+ pageIndex,
|
|
|
+ pageSize,
|
|
|
+ pageCount,
|
|
|
getAccouuntInOutApplyList
|
|
|
}
|
|
|
}
|
|
|
@@ -93,26 +93,29 @@ export function getCusBankSignBankList() {
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
- loading,
|
|
|
+ loading,
|
|
|
dataList,
|
|
|
- total,
|
|
|
- pageIndex,
|
|
|
- pageSize,
|
|
|
- pageCount,
|
|
|
+ total,
|
|
|
+ pageIndex,
|
|
|
+ pageSize,
|
|
|
+ pageCount,
|
|
|
getCusBankSignBankList
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 查询当前已经签约信息列表
|
|
|
-export function getBankAccountList() {
|
|
|
- const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.BankAccountSignRsp>()
|
|
|
+export function useBankAccountSign() {
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
+ const { dataList } = useDataTable<Model.BankAccountSignRsp>()
|
|
|
const loading = shallowRef(false)
|
|
|
|
|
|
const getBankAccountList = () => {
|
|
|
loading.value = true
|
|
|
return queryBankAccountSign({
|
|
|
+ data: {
|
|
|
+ userid: getUserId()
|
|
|
+ },
|
|
|
success: (res) => {
|
|
|
- total.value = res.total
|
|
|
dataList.value = res.data
|
|
|
},
|
|
|
complete: () => {
|
|
|
@@ -121,57 +124,70 @@ export function getBankAccountList() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ const bankInfo = computed(() => {
|
|
|
+ return dataList.value[0]
|
|
|
+ })
|
|
|
+
|
|
|
return {
|
|
|
- loading,
|
|
|
+ loading,
|
|
|
dataList,
|
|
|
- total,
|
|
|
- pageIndex,
|
|
|
- pageSize,
|
|
|
- pageCount,
|
|
|
+ bankInfo,
|
|
|
getBankAccountList
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 提现请求
|
|
|
-export function doWithdraw() {
|
|
|
+export function useDoWithdraw() {
|
|
|
|
|
|
/// 获取UserId
|
|
|
- const {getUserId} = useLoginStore()
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
const loading = shallowRef(false)
|
|
|
|
|
|
/// 获取当前是否已签约
|
|
|
const bankAccountSign = shallowRef<Model.BankAccountSignRsp[]>([])
|
|
|
|
|
|
+ const sign = computed<Partial<Model.BankAccountSignRsp>>(() => {
|
|
|
+ if (bankAccountSign.value.length) {
|
|
|
+ return bankAccountSign.value[0]
|
|
|
+ }
|
|
|
+ return {}
|
|
|
+ })
|
|
|
+
|
|
|
/// 查询签约信息
|
|
|
const request = queryBankAccountSign({
|
|
|
data: {
|
|
|
userid: getUserId()
|
|
|
},
|
|
|
- success:(res)=>{
|
|
|
- bankAccountSign.value=res.data,
|
|
|
- ({
|
|
|
- bankaccountname2:formData.BankAccoutName,
|
|
|
- branchbankname: formData.BranchBankName,
|
|
|
- accountcode: formData.AccountCode,
|
|
|
- cusbankid: formData.CusBankID,
|
|
|
- bankid: formData.OpenCardBankId
|
|
|
- }=res.data[0])
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.length) {
|
|
|
+ bankAccountSign.value = res.data
|
|
|
+ const data = res.data[0]
|
|
|
+ formData.Currency = data.currency
|
|
|
+ formData.CusBankID = data.cusbankid
|
|
|
+ formData.BankAccoutName = data.bankaccountname
|
|
|
+ formData.OpenCardBankId = data.bankid
|
|
|
+ formData.AccountCode = data.accountcode
|
|
|
+ formData.BranchBankName = data.branchbankname
|
|
|
+ formData.BankAccoutName = data.bankaccountname2
|
|
|
+ formData.BankAccoutNum = data.bankaccountno2
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
const formData = reactive<Partial<Proto.t2bBankWithdrawReq>>({
|
|
|
AccountType: 0,
|
|
|
- ExtOperatorID: new Date().getTime(),
|
|
|
- AppDateTime: formatDate(Date(), 'yyyy-MM-dd HH:mm:ss'),
|
|
|
- extend_info: JSON.stringify({"sex": 1})
|
|
|
+ AppDateTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ extend_info: JSON.stringify({ "sex": 1 })
|
|
|
})
|
|
|
|
|
|
const onSubmit = async () => {
|
|
|
await request
|
|
|
loading.value = true
|
|
|
+
|
|
|
return t2bBankWithdraw({
|
|
|
data: {
|
|
|
...formData,
|
|
|
+ ExtOperatorID: new Date().getTime()
|
|
|
},
|
|
|
complete: () => {
|
|
|
loading.value = false
|
|
|
@@ -180,40 +196,40 @@ export function doWithdraw() {
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
- loading,
|
|
|
- onSubmit,
|
|
|
- formData,
|
|
|
- bankAccountSign
|
|
|
+ loading,
|
|
|
+ onSubmit,
|
|
|
+ formData,
|
|
|
+ sign
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 充值请求
|
|
|
-export function doDeposit(url: string) {
|
|
|
+export function useDoDeposit() {
|
|
|
/// 获取UserId
|
|
|
- const {getUserId} = useLoginStore()
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
const loading = shallowRef(false)
|
|
|
/// 获取当前是否已签约
|
|
|
- const bankAccountSign = shallowRef<Model.BankAccountSignRsp[]>([])
|
|
|
-
|
|
|
- const formData = reactive<Partial<Proto.t2bBankDepositReq>>({
|
|
|
- ExtOperatorID: new Date().getTime(),
|
|
|
- extend_info: JSON.stringify({'certificate_photo_url': url, "sex": 1})
|
|
|
- })
|
|
|
+ const sign = shallowRef<Model.BankAccountSignRsp[]>([])
|
|
|
+ /// 常量信息
|
|
|
+ const extendInfo = { certificate_photo_url: '', sex: 1 }
|
|
|
+ /// formData
|
|
|
+ const formData = reactive<Partial<Proto.t2bBankDepositReq>>({})
|
|
|
|
|
|
const request = queryBankAccountSign({
|
|
|
data: {
|
|
|
userid: getUserId()
|
|
|
},
|
|
|
- success:(res)=>{
|
|
|
- bankAccountSign.value=res.data,
|
|
|
- ({
|
|
|
- amount: formData.Amount,
|
|
|
- cusbankid: formData.CusBankID,
|
|
|
- currency: formData.Currency,
|
|
|
- bankaccountname2: formData.BankAccoutName,
|
|
|
- bankaccountno2: formData.BankAccoutNum,
|
|
|
- accountcode: formData.AccountCode
|
|
|
- })
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.length) {
|
|
|
+ sign.value = res.data
|
|
|
+ const data = res.data[0]
|
|
|
+ formData.Currency = data.currency
|
|
|
+ formData.CusBankID = data.cusbankid
|
|
|
+ formData.BankAccoutName = data.bankaccountname2
|
|
|
+ formData.OpenCardBankId = data.bankid
|
|
|
+ formData.AccountCode = data.accountcode
|
|
|
+ formData.BankAccoutNum = data.bankaccountno2
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
@@ -222,7 +238,9 @@ export function doDeposit(url: string) {
|
|
|
loading.value = true
|
|
|
return t2bBankDeposit({
|
|
|
data: {
|
|
|
- ...formData
|
|
|
+ ...formData,
|
|
|
+ ExtOperatorID: new Date().getTime(),
|
|
|
+ extend_info: JSON.stringify(extendInfo)
|
|
|
},
|
|
|
complete: () => {
|
|
|
loading.value = false
|
|
|
@@ -231,59 +249,80 @@ export function doDeposit(url: string) {
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
- loading,
|
|
|
- onSubmit,
|
|
|
+ loading,
|
|
|
+ onSubmit,
|
|
|
+ extendInfo,
|
|
|
formData,
|
|
|
- bankAccountSign
|
|
|
+ sign
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// 银行签约请求
|
|
|
-export function doBankSign() {
|
|
|
+export function useDoBankSign() {
|
|
|
|
|
|
const loading = shallowRef(false)
|
|
|
- const {getUserInfo} = useUserStore()
|
|
|
- const {getFirstAccountId} = useLoginStore()
|
|
|
+ const { getUserInfo } = useUserStore()
|
|
|
+ const { getFirstAccountId } = useLoginStore()
|
|
|
+
|
|
|
+ /// 托管银行信息
|
|
|
+ const cusSignBank = shallowRef<Model.CusBankSignBankRsp>()
|
|
|
+ /// 查询签约银行信息
|
|
|
+ const request = queryCusBankSignBank({
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.length) {
|
|
|
+ const data = res.data[0]
|
|
|
+ cusSignBank.value = data
|
|
|
+ formData.Currency = data.currency
|
|
|
+ formData.CusBankID = data.cusbankid
|
|
|
+ formData.TradeDate = data.tradedate
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ /// 银行列表
|
|
|
+ const banklist = computed(() => {
|
|
|
+ return (cusSignBank.value?.Banklst ?? []).filter(e => e.status == 0)
|
|
|
+ })
|
|
|
+
|
|
|
+ const { getBankAccountList, bankInfo } = useBankAccountSign()
|
|
|
+ /// 判断是否有签约信息 有就做修改
|
|
|
+ getBankAccountList().then(()=>{
|
|
|
+ ({
|
|
|
+ currency:formData.Currency,
|
|
|
+ cusbankid:formData.CusBankID,
|
|
|
+ accountcode:formData.AccountCode,
|
|
|
+ accountname:formData.BankAccountName,
|
|
|
+ branchbankname: formData.OpenBankName,
|
|
|
+ bankaccountno: formData.BankAccountNo,
|
|
|
+ bankid:formData.OpenBankAccId,
|
|
|
+ }=bankInfo.value)
|
|
|
+ })
|
|
|
|
|
|
/// 数据
|
|
|
- const formData = reactive <Partial<Proto.t2bBankSignReq>>({
|
|
|
+ const formData = reactive<Partial<Proto.t2bBankSignReq>>({
|
|
|
AccountType: 1,
|
|
|
IsForce: 0,
|
|
|
AgentCertType: 0,
|
|
|
- OperateType: 1,
|
|
|
+ OperateType: bankInfo.value ? 1 : 2,
|
|
|
BankCardType: 0,
|
|
|
BankAccountType: 1,
|
|
|
- extend_info: JSON.stringify({"sex": 1}),
|
|
|
- ExtOperatorID: new Date().getTime(),
|
|
|
+ extend_info: JSON.stringify({ "sex": 1 }),
|
|
|
AccountCode: getFirstAccountId().toString(),
|
|
|
- CertID: getUserInfo()?.cardnum,
|
|
|
- CertType: getUserInfo()?.cardtypeid.toString()
|
|
|
- })
|
|
|
-
|
|
|
- const cusSignBank = shallowRef<Model.CusBankSignBankRsp[]>([])
|
|
|
-
|
|
|
- /// 查询签约银行信息
|
|
|
- const request = queryCusBankSignBank({
|
|
|
- success: (res) => {
|
|
|
- cusSignBank.value = res.data,
|
|
|
- ({
|
|
|
- accountName: formData.AccountName,
|
|
|
- branchBankName: formData.OpenBankName,
|
|
|
- bankNo: formData.BankAccountNo,
|
|
|
- currency: formData.Currency,
|
|
|
- tradedate: formData.TradeDate,
|
|
|
- bankid: formData.OpenBankAccId,
|
|
|
- cusbankid: formData.CusBankID
|
|
|
- })
|
|
|
- }
|
|
|
+ CertID: decryptAES(getUserInfo()?.cardnum ?? ''),
|
|
|
+ CertType: getUserInfo()?.cardtypeid.toString(),
|
|
|
+ BankAccountName: getUserInfo()?.customername,
|
|
|
})
|
|
|
|
|
|
const onSubmit = async () => {
|
|
|
await request
|
|
|
loading.value = true
|
|
|
+
|
|
|
return t2bBankSign({
|
|
|
data: {
|
|
|
- ...formData
|
|
|
+ ...formData,
|
|
|
+ ExtOperatorID: new Date().getTime(),
|
|
|
+ AccountName: formData.BankAccountName,
|
|
|
+ ExBankName: banklist.value.find(obj => obj.bankid === formData.OpenBankAccId)?.bankname
|
|
|
},
|
|
|
complete: () => {
|
|
|
loading.value = false
|
|
|
@@ -294,53 +333,59 @@ export function doBankSign() {
|
|
|
return {
|
|
|
loading,
|
|
|
formData,
|
|
|
- cusSignBank,
|
|
|
- onSubmit
|
|
|
+ banklist,
|
|
|
+ onSubmit,
|
|
|
+ bankInfo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// 银行解约请求
|
|
|
-export function doCancelBankSign() {
|
|
|
+export function useDoCancelBankSign() {
|
|
|
+ const { getBankAccountList, bankInfo } = useBankAccountSign()
|
|
|
+
|
|
|
/// 获取UserId
|
|
|
- const {getUserId} = useLoginStore()
|
|
|
const loading = shallowRef(false)
|
|
|
+
|
|
|
+ /// 表单信息
|
|
|
+ const formData = reactive<Partial<Proto.t2bBankCancelSignReq>>({
|
|
|
+ IsForce: 0,
|
|
|
+ })
|
|
|
/// 获取当前是否已签约
|
|
|
- const bankAccountSign = shallowRef<Model.BankAccountSignRsp[]>([])
|
|
|
- const formData = reactive<Partial<Proto.t2bBankCancelSignReq>>({})
|
|
|
-
|
|
|
- /// 请求签约信息
|
|
|
- const request = queryBankAccountSign({
|
|
|
- data: {
|
|
|
- userid: getUserId()
|
|
|
- },
|
|
|
- success:(res)=>{
|
|
|
- bankAccountSign.value=res.data,
|
|
|
- ({
|
|
|
- cusbankid: formData.CusBankID,
|
|
|
- currency: formData.Currency,
|
|
|
- tradedate: formData.TradeDate,
|
|
|
- accountcode: formData.AccountCode,
|
|
|
- bankaccountno: formData.BankChildAcc,
|
|
|
- bankaccountname: formData.BankChildAccName
|
|
|
- })
|
|
|
- }
|
|
|
+ const sign = shallowRef<Model.BankAccountSignRsp[]>([])
|
|
|
+
|
|
|
+ getBankAccountList().then(()=>{
|
|
|
+ ({
|
|
|
+ currency:formData.Currency,
|
|
|
+ cusbankid:formData.CusBankID,
|
|
|
+ accountcode:formData.AccountCode,
|
|
|
+ }=bankInfo.value)
|
|
|
+
|
|
|
})
|
|
|
|
|
|
- const formSubmit = async () => {
|
|
|
- await request
|
|
|
- const { cusbankid, currency, accountcode, bankaccountno, bankaccountname } = bankAccountSign.value[0]
|
|
|
+ // /// 请求签约信息
|
|
|
+ // const request = queryBankAccountSign({
|
|
|
+ // data: {
|
|
|
+ // userid: getUserId()
|
|
|
+ // },
|
|
|
+ // success: (res) => {
|
|
|
+ // if (res.data.length) {
|
|
|
+ // sign.value = res.data
|
|
|
+ // const data = res.data[0]
|
|
|
+ // formData.Currency = data.currency,
|
|
|
+ // formData.CusBankID = data. cusbankid,
|
|
|
+ // formData.AccountCode = data. accountcode
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+
|
|
|
+ const cancelSubmit = async () => {
|
|
|
+ // await request
|
|
|
loading.value = true
|
|
|
/// 发起请求
|
|
|
return t2bBankCancelSign({
|
|
|
data: {
|
|
|
- IsForce: 0,
|
|
|
- ExtOperatorID: new Date().getTime(),
|
|
|
...formData,
|
|
|
- CusBankID: cusbankid,
|
|
|
- Currency: currency,
|
|
|
- AccountCode: accountcode,
|
|
|
- BankChildAcc: bankaccountno,
|
|
|
- BankChildAccName: bankaccountname
|
|
|
+ ExtOperatorID: new Date().getTime(),
|
|
|
},
|
|
|
complete: () => {
|
|
|
loading.value = false
|
|
|
@@ -349,9 +394,35 @@ export function doCancelBankSign() {
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
- loading,
|
|
|
- formSubmit,
|
|
|
+ loading,
|
|
|
+ cancelSubmit,
|
|
|
formData,
|
|
|
- bankAccountSign
|
|
|
+ sign,
|
|
|
+ bankInfo
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/// 账户资金信息请求
|
|
|
+export function useAccountFundInfo() {
|
|
|
+ /// 获取UserId
|
|
|
+ const { getFirstAccountId } = useLoginStore()
|
|
|
+
|
|
|
+ /// 数据
|
|
|
+ const fund = shallowRef<Partial<Proto.AccountFundInfoRsp>>({})
|
|
|
+
|
|
|
+ /// 账户资金信息
|
|
|
+ accountFundInfoReq({
|
|
|
+ data: {
|
|
|
+ QueryBitMask: 2,
|
|
|
+ OrderId: new Date().getTime(),
|
|
|
+ AccountId: getFirstAccountId(),
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ fund.value = res
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ return {
|
|
|
+ fund
|
|
|
}
|
|
|
}
|