|
|
@@ -3,11 +3,11 @@ import Toast from "../../../miniprogram_npm/@vant/weapp/toast/toast"
|
|
|
import services from "../../../services/index"
|
|
|
import { queryBankAccountSign } from "../../../services/api/account/index"
|
|
|
import { sendMsgToMQ } from "../../../services/api/common/index"
|
|
|
-import { accountid, isEncrypted, loginQuery, protoHeader, timetample, userid } from "../../../services/utils"
|
|
|
+import { accountid, getErrorMsg, isEncrypted, loginQuery, protoHeader, timetample, userid } from "../../../services/utils"
|
|
|
import { formatDate, isnullstr } from "../../../utils/util"
|
|
|
-import { hideLoading, showLoading } from "../../../utils/message/index"
|
|
|
+import { hideLoading, showLoading, showModel } from "../../../utils/message/index"
|
|
|
+import { encryptBody } from "../../../utils/websocket/crypto"
|
|
|
|
|
|
-// mMine/pages/inoutgold/index.ts
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
@@ -58,7 +58,15 @@ Page({
|
|
|
onButtonPressed(e: any) {
|
|
|
switch (e.currentTarget.id) {
|
|
|
case "submit": /// 提交申请
|
|
|
- this.data.active == 0 ? this.doInMoneyApply() : this.doOutMoneyApply()
|
|
|
+ if (this.data.active == 0) {
|
|
|
+ showModel(() => {
|
|
|
+ this.doInMoneyApply()
|
|
|
+ }, '提示', '确定要进行入金操作吗?')
|
|
|
+ } else {
|
|
|
+ showModel(() => {
|
|
|
+ this.doOutMoneyApply()
|
|
|
+ }, '提示', '确定要进行出金操作吗?')
|
|
|
+ }
|
|
|
break;
|
|
|
default: /// 全部
|
|
|
this.setData({ outamount: this.data.enableOutAmount })
|
|
|
@@ -117,22 +125,23 @@ Page({
|
|
|
return
|
|
|
}
|
|
|
hideLoading(() => {
|
|
|
+ const sign = res.data.filter(obj => {
|
|
|
+ return obj.signstatus === 2 || obj.signstatus === 3 || obj.signstatus === 4
|
|
|
+ })[0]
|
|
|
/// 数据赋值
|
|
|
this.setData({
|
|
|
- bankAccountSign: res.data[0],
|
|
|
- sign: res.data.map(obj=>{
|
|
|
- return {
|
|
|
- bankname: obj.bankname,
|
|
|
- cardno: isnullstr(obj.cardno),
|
|
|
- bankaccountname: isnullstr(obj.bankaccountname),
|
|
|
- branchbankname: isnullstr(obj.branchbankname)
|
|
|
- }
|
|
|
- })[0]
|
|
|
+ bankAccountSign: sign,
|
|
|
+ sign: {
|
|
|
+ bankname: sign.bankname,
|
|
|
+ cardno: isnullstr(sign.cardno),
|
|
|
+ bankaccountname: isnullstr(sign.bankaccountname),
|
|
|
+ branchbankname: isnullstr(sign.branchbankname)
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
fail: (emsg) => {
|
|
|
- hideLoading(() => {}, '托管银行请求失败,原因:'+emsg)
|
|
|
+ hideLoading(() => {}, emsg, 'error')
|
|
|
},
|
|
|
complete: () => {}
|
|
|
})
|
|
|
@@ -144,31 +153,32 @@ Page({
|
|
|
/// loding....
|
|
|
showLoading(()=>{
|
|
|
/// 参数信息
|
|
|
- const param = {
|
|
|
+ const info = JSON.stringify({
|
|
|
/// 头部
|
|
|
Header: protoHeader(FunCode.AccountFundInfoReq),
|
|
|
/// uint32 查询位掩码
|
|
|
QueryBitMask: 2,
|
|
|
/// uint64 查询资金账号
|
|
|
AccountId: accountid(),
|
|
|
- }
|
|
|
+ })
|
|
|
/// 发送请求
|
|
|
sendMsgToMQ({
|
|
|
data: {
|
|
|
isEncrypted: isEncrypted(),
|
|
|
funCodeReq: FunCode.AccountFundInfoReq,
|
|
|
- funCodeRsp: FunCode.AccountFundInfoReq,
|
|
|
- data: JSON.stringify(param)
|
|
|
+ funCodeRsp: FunCode.AccountFundInfoRsp,
|
|
|
+ data: encryptBody(info)
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- /// 请求失败
|
|
|
- if (res.code != 0) {
|
|
|
- hideLoading(()=>{}, '账户资金信息请求失败,原因:'+res.msg, 'error')
|
|
|
+ /// 解析对象
|
|
|
+ const data = JSON.parse(res.data.data)
|
|
|
+ if (data.RetCode != 0) {
|
|
|
+ hideLoading(() => {}, getErrorMsg(data.RetCode), 'error')
|
|
|
return
|
|
|
}
|
|
|
},
|
|
|
fail: (emsg) => {
|
|
|
- hideLoading(()=>{}, '账户资金信息请求失败,原因:'+emsg, 'error')
|
|
|
+ hideLoading(()=>{}, emsg, 'error')
|
|
|
}
|
|
|
})
|
|
|
}, '账户资金信息请求中......')
|
|
|
@@ -181,15 +191,15 @@ Page({
|
|
|
/// showLoading
|
|
|
showLoading(()=>{
|
|
|
/// 参数信息
|
|
|
- const param = {
|
|
|
+ const info = JSON.stringify({
|
|
|
/// 头部
|
|
|
Header: protoHeader(FunCode.T2bBankDepositReq),
|
|
|
/// 外部操作流水号
|
|
|
- ExtOperatorID: timetample(),
|
|
|
+ ExtOperatorID: timetample().toString(),
|
|
|
/// 托管银行编号
|
|
|
CusBankID: this.data.bankAccountSign.cusbankid,
|
|
|
/// 金额
|
|
|
- Amount: this.data.inamount,
|
|
|
+ Amount: Number(this.data.inamount),
|
|
|
/// 币种
|
|
|
Currency: this.data.bankAccountSign.currency,
|
|
|
/// 银行卡号
|
|
|
@@ -199,20 +209,21 @@ Page({
|
|
|
/// 资金账户
|
|
|
AccountCode: this.data.bankAccountSign.accountcode,
|
|
|
/// 扩展信息(JSON串,参考配置要求进行填充)
|
|
|
- Extend_Info: {"sex": 1, "certificate_photo_url": this.data.filePath},
|
|
|
- }
|
|
|
+ extend_info: JSON.stringify({"sex": 1, "certificate_photo_url": this.data.filePath}),
|
|
|
+ })
|
|
|
/// 发送请求
|
|
|
sendMsgToMQ({
|
|
|
data: {
|
|
|
isEncrypted: isEncrypted(),
|
|
|
funCodeReq: FunCode.T2bBankDepositReq,
|
|
|
funCodeRsp: FunCode.T2bBankDepositRsp,
|
|
|
- data: JSON.stringify(param)
|
|
|
+ data: encryptBody(info)
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- /// 请求失败
|
|
|
- if (res.code != 0) {
|
|
|
- hideLoading(()=>{}, '入金申请请求失败,原因:'+res.msg, 'error')
|
|
|
+ /// 解析对象
|
|
|
+ const data = JSON.parse(res.data.data)
|
|
|
+ if (data.Status != 0) {
|
|
|
+ hideLoading(() => {}, getErrorMsg(data.Status), 'error')
|
|
|
return
|
|
|
}
|
|
|
/// 请求成功
|
|
|
@@ -222,7 +233,7 @@ Page({
|
|
|
}, '入金申请请求成功', 'success')
|
|
|
},
|
|
|
fail: (emsg) => {
|
|
|
- hideLoading(()=>{}, '入金申请请求失败,原因:'+emsg, 'error')
|
|
|
+ hideLoading(()=>{}, emsg, 'error')
|
|
|
}
|
|
|
})
|
|
|
}, '入金请求中......')
|
|
|
@@ -235,15 +246,15 @@ Page({
|
|
|
/// loding....
|
|
|
showLoading(()=>{
|
|
|
/// 参数信息
|
|
|
- const param = {
|
|
|
+ const info = JSON.stringify({
|
|
|
/// 头部
|
|
|
Header: protoHeader(FunCode.T2bBankWithdrawReq),
|
|
|
/// 外部操作流水号
|
|
|
- ExtOperatorID: timetample(),
|
|
|
+ ExtOperatorID: timetample().toString(),
|
|
|
/// 托管银行编号
|
|
|
CusBankID: this.data.bankAccountSign.cusbankid,
|
|
|
/// 金额
|
|
|
- Amount: this.data.outamount,
|
|
|
+ Amount: Number(this.data.outamount),
|
|
|
/// 币种
|
|
|
Currency: this.data.bankAccountSign.currency,
|
|
|
/// 银行卡号
|
|
|
@@ -253,7 +264,7 @@ Page({
|
|
|
/// 资金账户
|
|
|
AccountCode: this.data.bankAccountSign.accountcode,
|
|
|
/// 扩展信息(JSON串,参考配置要求进行填充)
|
|
|
- Extend_Info: {"sex": 1},
|
|
|
+ extend_info: JSON.stringify({"sex": 1}),
|
|
|
/// 银行卡行号
|
|
|
OpenCardBankId: this.data.bankAccountSign.bankid,
|
|
|
/// 收款支行名称
|
|
|
@@ -262,19 +273,20 @@ Page({
|
|
|
AppDateTime: formatDate(new Date()),
|
|
|
/// 账户类型
|
|
|
AccountType: 0
|
|
|
- }
|
|
|
+ })
|
|
|
/// 发送请求
|
|
|
sendMsgToMQ({
|
|
|
data: {
|
|
|
isEncrypted: isEncrypted(),
|
|
|
funCodeReq: FunCode.T2bBankWithdrawReq,
|
|
|
funCodeRsp: FunCode.T2bBankWithdrawRsp,
|
|
|
- data: JSON.stringify(param)
|
|
|
+ data: encryptBody(info)
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- /// 请求失败
|
|
|
- if (res.code != 0) {
|
|
|
- hideLoading(()=>{}, '出金申请请求失败,原因:'+res.msg, 'error')
|
|
|
+ /// 解析对象
|
|
|
+ const data = JSON.parse(res.data.data)
|
|
|
+ if (data.Status != 0) {
|
|
|
+ hideLoading(() => {}, getErrorMsg(data.Status), 'error')
|
|
|
return
|
|
|
}
|
|
|
/// 请求成功
|
|
|
@@ -284,7 +296,7 @@ Page({
|
|
|
}, '出金申请请求成功', 'success')
|
|
|
},
|
|
|
fail: (emsg) => {
|
|
|
- hideLoading(()=>{}, '出金申请请求失败,原因:'+emsg, 'error')
|
|
|
+ hideLoading(()=>{}, emsg, 'error')
|
|
|
}
|
|
|
})
|
|
|
}, '出金请求中......')
|
|
|
@@ -333,7 +345,7 @@ Page({
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
- onLoad() {
|
|
|
+ onLoad(options: any) {
|
|
|
/// 查询账户签约信息
|
|
|
this.queryBankAccountSign()
|
|
|
/// 资金账户查询
|
|
|
@@ -342,8 +354,9 @@ Page({
|
|
|
const start = loginQuery().systemParams.filter(obj => { return obj.paramcode === "012" })[0].paramvalue
|
|
|
/// 开始结束时间
|
|
|
const end = loginQuery().systemParams.filter(obj => { return obj.paramcode === "013" })[0].paramvalue
|
|
|
+ const id = options.id
|
|
|
/// 显示时间
|
|
|
- this.setData({ time: start+'-'+end })
|
|
|
+ this.setData({ time: start+'-'+end, active: id })
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -357,7 +370,7 @@ Page({
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow() {
|
|
|
-
|
|
|
+ this.setData({ active: this.data.active })
|
|
|
},
|
|
|
|
|
|
/**
|