|
|
@@ -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 { decryptAES } from '@/utils/websocket/crypto'
|
|
|
+import moment from "moment";
|
|
|
|
|
|
// 历史资金流水列表
|
|
|
export function useBankStatementList() {
|
|
|
@@ -142,36 +142,48 @@ export function doWithdraw() {
|
|
|
/// 获取当前是否已签约
|
|
|
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])
|
|
|
+ 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'),
|
|
|
+ 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
|
|
|
@@ -183,37 +195,40 @@ export function doWithdraw() {
|
|
|
loading,
|
|
|
onSubmit,
|
|
|
formData,
|
|
|
- bankAccountSign
|
|
|
+ sign
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 充值请求
|
|
|
-export function doDeposit(url: string) {
|
|
|
+export function doDeposit() {
|
|
|
/// 获取UserId
|
|
|
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 extendInfo = {
|
|
|
+ certificate_photo_url: '',
|
|
|
+ sex: 1
|
|
|
+ }
|
|
|
+
|
|
|
+ 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
|
|
|
- })
|
|
|
+ if (res.data.length) {
|
|
|
+ bankAccountSign.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 +237,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
|
|
|
@@ -233,6 +250,7 @@ export function doDeposit(url: string) {
|
|
|
return {
|
|
|
loading,
|
|
|
onSubmit,
|
|
|
+ extendInfo,
|
|
|
formData,
|
|
|
bankAccountSign
|
|
|
}
|
|
|
@@ -254,10 +272,10 @@ export function doBankSign() {
|
|
|
BankCardType: 0,
|
|
|
BankAccountType: 1,
|
|
|
extend_info: JSON.stringify({ "sex": 1 }),
|
|
|
- ExtOperatorID: new Date().getTime(),
|
|
|
AccountCode: getFirstAccountId().toString(),
|
|
|
- CertID: getUserInfo()?.cardnum,
|
|
|
- CertType: getUserInfo()?.cardtypeid.toString()
|
|
|
+ CertID: decryptAES(getUserInfo()?.cardnum ?? ''),
|
|
|
+ CertType: getUserInfo()?.cardtypeid.toString(),
|
|
|
+
|
|
|
})
|
|
|
|
|
|
/// 托管银行信息
|
|
|
@@ -279,10 +297,13 @@ export function doBankSign() {
|
|
|
const onSubmit = async () => {
|
|
|
await request
|
|
|
loading.value = true
|
|
|
- console.log(cusSignBank)
|
|
|
+
|
|
|
return t2bBankSign({
|
|
|
data: {
|
|
|
- ...formData
|
|
|
+ ...formData,
|
|
|
+ ExtOperatorID: new Date().getTime(),
|
|
|
+ AccountName: formData.BankAccountName,
|
|
|
+ ExBankName: cusSignBank.value?.Banklst.find(obj => obj.bankid === formData.OpenBankAccId)?.bankname
|
|
|
},
|
|
|
complete: () => {
|
|
|
loading.value = false
|
|
|
@@ -303,10 +324,16 @@ export function doCancelBankSign() {
|
|
|
/// 获取UserId
|
|
|
const { getUserId } = useLoginStore()
|
|
|
const loading = shallowRef(false)
|
|
|
- /// 获取当前是否已签约
|
|
|
- const bankAccountSign = shallowRef<Model.BankAccountSignRsp[]>([])
|
|
|
+
|
|
|
/// 表单信息
|
|
|
const formData = reactive<Partial<Proto.t2bBankCancelSignReq>>({})
|
|
|
+ /// 获取当前是否已签约
|
|
|
+ const bankAccountSign = shallowRef<Model.BankAccountSignRsp[]>([])
|
|
|
+ /// 当前已签约
|
|
|
+ const sign = computed<Partial<Model.BankAccountSignRsp>>(() => {
|
|
|
+ if (bankAccountSign.value.length) { return bankAccountSign.value[0] }
|
|
|
+ return {}
|
|
|
+ })
|
|
|
|
|
|
/// 请求签约信息
|
|
|
const request = queryBankAccountSign({
|
|
|
@@ -314,33 +341,33 @@ export function doCancelBankSign() {
|
|
|
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
|
|
|
- })
|
|
|
+ if (res.data.length) {
|
|
|
+ bankAccountSign.value = res.data
|
|
|
+ const data = res.data[0]
|
|
|
+ formData.CusBankID = data.cusbankid
|
|
|
+ formData.Currency = data.currency
|
|
|
+ formData.AccountCode = data.accountcode
|
|
|
+ formData.BankChildAccName = data.accountname2
|
|
|
+ formData.BankChildAcc = data.bankaccountno2
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
const formSubmit = async () => {
|
|
|
await request
|
|
|
- const { cusbankid, currency, accountcode, bankaccountno, bankaccountname } = bankAccountSign.value[0]
|
|
|
+ const { cusbankid, currency, accountcode, bankaccountno2, bankaccountname2 } = bankAccountSign.value[0]
|
|
|
loading.value = true
|
|
|
/// 发起请求
|
|
|
return t2bBankCancelSign({
|
|
|
data: {
|
|
|
+ ...formData,
|
|
|
IsForce: 0,
|
|
|
ExtOperatorID: new Date().getTime(),
|
|
|
- ...formData,
|
|
|
CusBankID: cusbankid,
|
|
|
Currency: currency,
|
|
|
AccountCode: accountcode,
|
|
|
- BankChildAcc: bankaccountno,
|
|
|
- BankChildAccName: bankaccountname
|
|
|
+ BankChildAcc: bankaccountno2,
|
|
|
+ BankChildAccName: bankaccountname2
|
|
|
},
|
|
|
complete: () => {
|
|
|
loading.value = false
|
|
|
@@ -352,6 +379,6 @@ export function doCancelBankSign() {
|
|
|
loading,
|
|
|
formSubmit,
|
|
|
formData,
|
|
|
- bankAccountSign
|
|
|
+ sign
|
|
|
}
|
|
|
}
|