Browse Source

feat: 提现相关接口调试

liangan 2 weeks ago
parent
commit
44637d30f0
5 changed files with 65 additions and 23 deletions
  1. 9 2
      src/api/wallet.ts
  2. 2 0
      src/pages.json
  3. 11 9
      src/pages/income/income.vue
  4. 1 0
      src/pages/wallet/myWallet.vue
  5. 42 12
      src/pages/wallet/withdraw.vue

+ 9 - 2
src/api/wallet.ts

@@ -1,16 +1,23 @@
 import { http } from '@/utils/http'
 
 /**
- * 查询账号钱包信息
+ * 查询收益账户信息
  * @returns
  */
 export function getWalletInfo() {
   return http.get<any>(`/cif/account/api/getAccountInfo`)
 }
 /**
- * 查询账号钱包信息
+ * 查询收益记录
  * @returns
  */
 export function envelopeList(data: any) {
   return http.post<any>(`/cif/api/red/envelope/list`, data)
 }
+/**
+ * 账户提现(钱包/收益账户)
+ * @returns
+ */
+export function withdrawAdd(data: any) {
+  return http.post<any>(`/cif/api/withdraw/record/add`, data)
+}

+ 2 - 0
src/pages.json

@@ -74,6 +74,7 @@
       "path": "pages/income/income",
       "type": "page",
       "layout": "default",
+      "needLogin": true,
       "style": {
         "navigationBarTitleText": "Revenue Center",
         "navigationBarBackgroundColor": "#fff"
@@ -234,6 +235,7 @@
       "path": "pages/wallet/myWallet",
       "type": "page",
       "layout": "default",
+      "needLogin": true,
       "style": {
         "navigationBarTitleText": "My Wallet",
         "navigationBarBackgroundColor": "#fff"

+ 11 - 9
src/pages/income/income.vue

@@ -1,6 +1,7 @@
 <route lang="json5">
   {
     layout: 'default',
+    needLogin: true,
     style: {
       navigationBarTitleText: 'Revenue Center',
       navigationBarBackgroundColor: '#fff',
@@ -16,6 +17,7 @@ import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
 
 import { getWalletInfo as _getWalletInfo, envelopeList } from '@/api/wallet'
 import { formatNumber } from '@/utils'
+import { toPage } from '@/utils/page'
 
 defineOptions({
   name: 'Income', // 收益
@@ -72,7 +74,7 @@ onShow(() => {
               {{ formatNumber(walletInfo.totalEarnings) }}
             </view>
           </view>
-          <view>
+          <view @click="toPage('/pages/wallet/myWallet')">
             <view class="text-22rpx">
               Account Balance
             </view>
@@ -139,13 +141,13 @@ onShow(() => {
         </view>
       </view>
       <view class="mb-20rpx flex items-center justify-between gap-22rpx text-center text-32rpx">
-        <view class="flex-1 rounded-16rpx bg-[rgba(var(--wot-color-theme-rgb),0.5)] py-32rpx shadow-[4rpx_4rpx_8rpx_0rpx_rgba(0,0,0,0.5)]">
+        <view class="flex-1 rounded-16rpx bg-[rgba(var(--wot-color-theme-rgb),0.5)] py-32rpx shadow-[4rpx_4rpx_8rpx_0rpx_rgba(0,0,0,0.5)]" @click="toPage('/pages/myOrders/myOrders')">
           <text class="pr-16rpx">
             My Group Data
           </text>
           <wd-icon name="chevron-right-circle" size="32rpx" />
         </view>
-        <view class="flex-1 rounded-16rpx bg-#FEE750/50 py-32rpx shadow-[4rpx_4rpx_8rpx_0rpx_rgba(0,0,0,0.5)]">
+        <view class="flex-1 rounded-16rpx bg-#FEE750/50 py-32rpx shadow-[4rpx_4rpx_8rpx_0rpx_rgba(0,0,0,0.5)]" @click="toPage('/pages/wallet/withdraw', { balance: walletInfo.balance, type: 2 })">
           <text class="pr-16rpx">
             Withdraw Now
           </text>
@@ -157,7 +159,7 @@ onShow(() => {
           Revenue Record
         </view>
         <view class="mb-20rpx">
-          <wd-radio-group v-model="dayType" shape="button">
+          <wd-radio-group v-model="dayType" shape="button" @change="() => queryList(1, 20)">
             <wd-radio :value="1">
               DT
             </wd-radio>
@@ -177,20 +179,20 @@ onShow(() => {
         </view>
         <view class="rounded-16rpx bg-white px-20rpx">
           <view
-            v-for="i in dataList" :key="i" class="py-20rpx"
-            :class="{ 'border-b-1 border-b-solid border-b-#E1E1E1': i !== 3 }"
+            v-for="(item, index) in dataList" :key="item.id" class="py-20rpx"
+            :class="{ 'border-b-1 border-b-solid border-b-#E1E1E1': index !== dataList.length - 1 }"
           >
             <view class="mb-8rpx flex items-center justify-between text-24rpx">
               <text class="truncate">
-                Group Buying Reward:PPB123456789Reward:PPB123456789Reward:PPB123456789
+                Group Buying Reward:PPB123456789
               </text>
               <text class="flex-shrink-0 pl-16rpx">
-                ৳ 8
+                ৳ {{ formatNumber(item.amount) }}
               </text>
             </view>
             <view class="flex items-center justify-between text-22rpx">
               <text class="text-#5B5B5B">
-                2025/05/05 12:30:30
+                {{ item.updateTime }}
               </text>
               <wd-text type="success" text="Completed" />
             </view>

+ 1 - 0
src/pages/wallet/myWallet.vue

@@ -1,6 +1,7 @@
 <route lang="json5" type="page">
 {
   layout: 'default',
+  needLogin: true,
   style: {
     navigationBarTitleText: 'My Wallet',
     navigationBarBackgroundColor: '#fff',

+ 42 - 12
src/pages/wallet/withdraw.vue

@@ -9,19 +9,48 @@
 </route>
 
 <script lang="ts" setup>
+import { withdrawAdd } from '@/api/wallet'
+import { formatNumber } from '@/utils'
+import { getPageParams, toPage } from '@/utils/page'
+import { toast } from '@/utils/toast'
+
 defineOptions({
   name: 'Withdraw', // 提现
 })
+const queryParams = ref<any>({})
 // 表单数据
 const formData = ref({
-  username: '',
-  password: '',
+  amount: '',
+  bank: '',
+  bankAccountName: '',
+  bankAccount: '',
+  channel: 1,
+  currency: 1,
 })
-function toPage(url: string) {
-  uni.navigateTo({
-    url,
-  })
+async function submit() {
+  if (!formData.value.bank) {
+    toast.info('Please enter Bank Name')
+    return
+  }
+  if (!formData.value.bankAccountName) {
+    toast.info('Please enter Bank Account Name')
+    return
+  }
+  if (!formData.value.bankAccount) {
+    toast.info('Please enter Bank Account No.')
+    return
+  }
+  if (!formData.value.amount) {
+    toast.info('Please enter Withdrawal Amount')
+    return
+  }
+  const res = await withdrawAdd({ ...formData.value, accountType: queryParams.value.type })
+  console.log(res)
 }
+onLoad((options) => {
+  const params = getPageParams(options)
+  queryParams.value = params
+})
 </script>
 
 <template>
@@ -48,7 +77,7 @@ function toPage(url: string) {
         </text>
         <text class="text-48rpx font-bold">
-          5,000
+          {{ formatNumber(queryParams.balance) }}
         </text>
       </view>
     </view>
@@ -59,26 +88,26 @@ function toPage(url: string) {
       <wd-form ref="form" :model="formData" custom-class="mb-28rpx">
         <view class="mb-40rpx space-y-32rpx">
           <wd-input
-            v-model="formData.username"
+            v-model="formData.bank"
             placeholder="Bank Name"
             no-border
             custom-class="bandhu-auth-input-field"
           />
           <wd-input
-            v-model="formData.password"
+            v-model="formData.bankAccountName"
             placeholder="Bank Account Name"
             no-border
             custom-class="bandhu-auth-input-field"
           />
           <wd-input
-            v-model="formData.password"
+            v-model="formData.bankAccount"
             placeholder="Bank Account No."
             no-border
             custom-class="bandhu-auth-input-field"
           />
           <view class="flex items-center gap-20rpx">
             <wd-input
-              v-model="formData.password"
+              v-model="formData.amount"
               placeholder="Withdrawal Amount"
               no-border
               custom-class="flex-1 bandhu-auth-input-field"
@@ -87,12 +116,13 @@ function toPage(url: string) {
               type="error"
               plain
               custom-class="bandhu-auth-secondary-btn"
+              @click="formData.amount = queryParams.balance"
             >
               All Amounts
             </wd-button>
           </view>
         </view>
-        <wd-button plain block custom-class="h-80rpx!">
+        <wd-button plain block custom-class="h-80rpx!" @click="submit">
           Submit
         </wd-button>
       </wd-form>