Ver Fonte

Merge branch 'master' of http://47.101.159.18:3000/Muchinfo/THJ_Mobile

li.shaoyi há 3 anos atrás
pai
commit
0b439dfa90

+ 19 - 0
public/proto/thj.proto

@@ -556,4 +556,23 @@ message THJRedPacketLotteryRsp {
 		optional double RedPacketAmount = 5; // 中奖红包金额
 		optional uint32 GearLevel = 6; // 档位
 		optional string ClientSerialNo = 7; // 客户端流水号
+}
+
+// 账户资金信息请求 0 4 6
+message AccountFundInfoReq {
+	optional MessageHead Header = 1; // MessageHead
+	optional uint64 OrderId = 2; // uint64 查询委托单号
+	optional uint64 AccountId = 3; // uint64 查询资金账号
+	optional uint32 QueryBitMask = 4; // uint32 查询位掩码
+}
+// 账户资金信息响应 0 4 7
+message AccountFundInfoRsp {
+	optional MessageHead Header = 1; // MessageHead 消息头
+	optional int32 RetCode = 2; // int32 返回码
+	optional string RetDesc = 3; // string 描述信息
+	optional uint64 OrderId = 4; // uint64 查询委托单号
+	optional uint64 AccountId = 5; // uint64 查询资金账号
+	optional double AvailableMargin = 6; // double 可用保证金,查询位掩码: 1
+	optional double AvailableOutMoney = 7; // double 可出资金,查询位掩码: 2
+	optional int32 IsCleanAccount = 8; // int32 是否是干净账户,查询位掩码: 4
 }

+ 31 - 5
src/business/bank/index.ts

@@ -1,7 +1,7 @@
 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 { queryHisAmountLog, t2bBankWithdraw, queryBankAccountSign, t2bBankDeposit, queryAccountInOutApply, queryCusBankSignBank, t2bBankSign, t2bBankCancelSign, accountFundInfoReq } from '@/services/api/bank'
 import { decryptAES } from '@/utils/websocket/crypto'
 import moment from "moment";
 
@@ -137,7 +137,7 @@ export function useBankAccountSign() {
 }
 
 // 提现请求
-export function doWithdraw() {
+export function useDoWithdraw() {
 
     /// 获取UserId
     const { getUserId } = useLoginStore()
@@ -204,7 +204,7 @@ export function doWithdraw() {
 }
 
 // 充值请求
-export function doDeposit() {
+export function useDoDeposit() {
     /// 获取UserId
     const { getUserId } = useLoginStore()
     const loading = shallowRef(false)
@@ -261,7 +261,7 @@ export function doDeposit() {
 }
 
 /// 银行签约请求
-export function doBankSign() {
+export function useDoBankSign() {
 
     const loading = shallowRef(false)
     const { getUserInfo } = useUserStore()
@@ -279,6 +279,7 @@ export function doBankSign() {
         AccountCode: getFirstAccountId().toString(),
         CertID: decryptAES(getUserInfo()?.cardnum ?? ''),
         CertType: getUserInfo()?.cardtypeid.toString(),
+        BankAccountName: getUserInfo()?.customername
 
     })
 
@@ -329,7 +330,7 @@ export function doBankSign() {
 }
 
 /// 银行解约请求
-export function doCancelBankSign() {
+export function useDoCancelBankSign() {
     /// 获取UserId
     const { getUserId } = useLoginStore()
     const loading = shallowRef(false)
@@ -391,3 +392,28 @@ export function doCancelBankSign() {
         sign
     }
 }
+
+/// 账户资金信息请求
+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
+    }
+}

+ 3 - 1
src/constants/funcode.ts

@@ -25,7 +25,9 @@ export enum FunCode {
     t2bBankWithdrawReq = 589837, // 出金请求
     t2bBankWithdrawRsp = 589838, // 出金应答
     t2bBankDepositReq = 589843, // 入金请求
-    t2bBankDepositRsp = 589844, //入金应答
+    t2bBankDepositRsp = 589844,   //入金应答
+    AccountFundInfoReq = 262150,   /// 账户资金信息请求(0, 4, 6)
+    AccountFundInfoRsp = 262151,  /// 账户资金信息响应(0, 4, 7)
 
     UserReceiveInfoReq = 1900545, // 新增修改收货地址请求
     UserReceiveInfoRsp = 1900546, // 新增修改收货地址请求响应

+ 3 - 3
src/packages/mobile/views/bank/sign/components/edit/index.vue

@@ -10,7 +10,7 @@
                     :optionProps="{ label: 'bankname', value: 'bankid' }" />
                 <Field name="BankNo" label="银行卡号" v-model="formData.BankAccountNo" placeholder="请输入银行卡账号"
                     :rules="formRules.BankAccountNo" />
-                <Field name="AccountName" label="姓名" v-model="formData.BankAccountName" placeholder="请输入银行卡账户名"
+                <Field name="AccountName" label="姓名" readonly v-model="formData.BankAccountName" placeholder="请输入银行卡账户名"
                     :rules="formRules.BankAccountName" />
                 <Field name="BranchBankName" label="支行名称" v-model="formData.OpenBankName" placeholder="请输入银行卡支行名称"
                     :rules="formRules.OpenBankName" />
@@ -30,13 +30,13 @@
 import { shallowRef } from 'vue'
 import { CellGroup, Button, Field, Form, FormInstance, FieldRule, Toast } from 'vant'
 import { fullloading, dialog } from '@/utils/vant'
-import { doBankSign, } from '@/business/bank'
+import { useDoBankSign, } from '@/business/bank'
 import { useNavigation } from '@/hooks/navigation'
 import AppSelect from '@mobile/components/base/select/index.vue'
 import { validateRules } from '@/constants/regex'
 
 const { router } = useNavigation()
-const { formData, onSubmit, banklist } = doBankSign()
+const { formData, onSubmit, banklist } = useDoBankSign()
 const formRef = shallowRef<FormInstance>()
 
 // 表单验证规则

+ 2 - 2
src/packages/mobile/views/bank/wallet/components/deposit/index.vue

@@ -22,14 +22,14 @@
 <script lang="ts" setup>
 import { ref } from 'vue'
 import { Form, Field, CellGroup, Button, Uploader, FieldRule, FormInstance, Toast } from 'vant'
-import { doDeposit } from '@/business/bank'
+import { useDoDeposit } from '@/business/bank'
 import { fullloading, dialog } from '@/utils/vant';
 import { useNavigation } from '@/hooks/navigation'
 import axios from 'axios';
 import { getServiceUrl } from '@/services/http';
 
 const formRef = ref<FormInstance>()
-const { formData, onSubmit, extendInfo } = doDeposit()
+const { formData, onSubmit, extendInfo } = useDoDeposit()
 const { router } = useNavigation()
 
 /// 证件正面地址

+ 16 - 3
src/packages/mobile/views/bank/wallet/components/withdraw/index.vue

@@ -2,7 +2,12 @@
     <app-view class="g-form">
         <Form ref="formRef" class="g-form__container" @submit="formSubmit">
             <CellGroup inset>
-                <Field label="提现金额" v-model="formData.Amount" placeholder="请填写提现金额" :rules="formRules.Amount" />
+                <Field label="提现金额" v-model="formData.Amount" :rules="formRules.Amount" >
+                    <template #input>
+                        <input v-model="formData.Amount" placeholder="请填写提现金额" />
+                        <span>可出金额:{{ fund.AvailableOutMoney }}</span>
+                    </template>
+                </Field>
                 <Field label="开户银行">
                     <template #input>
                         {{ sign.bankname }}
@@ -34,13 +39,15 @@
 </template>
 
 <script lang="ts" setup>
-import { doWithdraw } from '@/business/bank';
+import { useDoWithdraw, useAccountFundInfo } from '@/business/bank';
 import { Form, Field, CellGroup, FormInstance, Button, FieldRule, Toast } from 'vant'
 import { shallowRef } from 'vue'
 import { fullloading, dialog } from '@/utils/vant'
 import { useNavigation } from '@/hooks/navigation'
 
-const { formData, onSubmit, sign } = doWithdraw()
+const { formData, onSubmit, sign } = useDoWithdraw()
+/// 资金账户信息
+const { fund } = useAccountFundInfo()
 const { router } = useNavigation()
 const formRef = shallowRef<FormInstance>()
 
@@ -49,6 +56,12 @@ const formRules: { [key in keyof Proto.t2bBankWithdrawReq]?: FieldRule[] } = {
     Amount: [{
         required: true,
         message: '请输入出金金额',
+        validator: (val) => {
+            if (val <= (fund.value.AvailableOutMoney ?? 0.0)) {
+                return true
+            }
+            return '超过可出金额'
+        }
     }]
 }
 

+ 23 - 3
src/packages/mobile/views/home/components/mine/index.vue

@@ -41,9 +41,8 @@
           </div>
         </div>
         <div class="button">
-          <Button size="small" @click="router.push({ name: 'bank-wallet', query: { tab: '0' } })" round>提现</Button>
-          <Button type="primary" size="small" color="#00577C"
-            @click="router.push({ name: 'bank-wallet', query: { tab: '1' } })" round>充值</Button>
+          <Button size="small" @click="doInOutMoney" round>提现</Button>
+          <Button type="primary" size="small" color="#00577C" @click="doInOutMoney" round>充值</Button>
         </div>
       </div>
     </div>
@@ -125,18 +124,39 @@ import { useLoginStore, useAccountStore } from '@/stores'
 import { useAuth } from '@/business/auth'
 import AppIconfont from '@mobile/components/base/iconfont/index.vue'
 import { queryUserAccount } from '@/services/api/account'
+import { useBankAccountSign } from '@/business/bank'
 
 const { router, routerTo } = useNavigation()
 const { getLoginId, getUserId, getFirstAccountId } = useLoginStore()
 const { logout } = useAuth()
 const { accountInfo } = useAccountStore()
 const headerRef = shallowRef<HTMLDivElement>()
+const { getBankAccountList, dataList } = useBankAccountSign()
+
+getBankAccountList()
 
 const onReady = (el: HTMLDivElement) => {
   // 设置背景图位置
   headerRef.value?.style.setProperty('background-position', `0 -${el.clientHeight}px`)
 }
 
+/// 进行出入金操作判断
+const doInOutMoney = (active: number) => {
+
+  console.log('xxxx', dataList.value)
+  /// 当前未签约
+  if (dataList.value.length === 0 || dataList.value[0].signstatus === 1 ) {
+    dialog('当前未签约,请先进行账户签约才进行出入金操作')
+    return
+  }
+
+  if (active == 0) {
+    router.push({ name: 'bank-wallet', query: { tab: '0' } })
+  } else {
+    router.push({ name: 'bank-wallet', query: { tab: '1' } })
+  }
+}
+
 // 检查是否已实名认证
 const hasAuth = () => {
   fullloading((hideLoading) => {

+ 8 - 1
src/services/api/bank/index.ts

@@ -4,9 +4,16 @@ import { tradeServerRequest } from '@/services/socket/trade'
 import { TradeParams } from '@/services/socket/trade/interface'
 
 /**
+ * 账户资金信息请求
+ */
+export function accountFundInfoReq(params: TradeParams<Partial<Proto.AccountFundInfoReq>, Proto.AccountFundInfoRsp>) {
+    return tradeServerRequest('AccountFundInfoReq', 'AccountFundInfoRsp', params);
+}
+
+/**
  * 银行签约
  */
-export function t2bBankSign(params: TradeParams<Partial<Proto.t2bBankSignReq>, Proto.t2bBankSignRsp>) {
+ export function t2bBankSign(params: TradeParams<Partial<Proto.t2bBankSignReq>, Proto.t2bBankSignRsp>) {
     return tradeServerRequest('t2bBankSignReq', 't2bBankSignRsp', params);
 }
 

+ 1 - 1
src/services/socket/trade/index.ts

@@ -97,7 +97,7 @@ export async function tradeServerRequest<Req, Rsp>(reqKey: keyof typeof FunCode,
             }
             default: {
                 // 银行 业务 以 Status 作为判断依据
-                if (Status === 0) {
+                if (Status === 0 || Status == 6007) {
                     success && success(res);
                     return Promise.resolve();
                 }

+ 20 - 0
src/types/proto/bank.d.ts

@@ -175,5 +175,25 @@ declare global {
             CerterCheckDate: string; // 中心对账日期
             NetAddr: string; // 网络地址(当这里有网址时,应自动跳转网页)
         }
+
+        // 账户资金信息请求 0 4 6
+        interface AccountFundInfoReq {
+            Header?: IMessageHead;
+            OrderId: number;       // uint64 查询委托单号
+            AccountId: number;     // uint64 查询资金账号
+            QueryBitMask: number; // uint32 查询位掩码
+        }
+
+        // 账户资金信息响应 0 4 7
+        interface AccountFundInfoRsp {
+            Header?: IMessageHead;
+            RetCode: number; // int32 返回码
+            RetDesc: string; // string 描述信息
+            OrderId: number; // uint64 查询委托单号
+            AccountId: number; // uint64 查询资金账号
+            AvailableMargin: number; // double 可用保证金,查询位掩码: 1
+            AvailableOutMoney: number; // double 可出资金,查询位掩码: 2
+            IsCleanAccount: number; // int32 是否是干净账户,查询位掩码: 4
+        }
     }
 }