Просмотр исходного кода

Merge branch 'dev' into master-pro

lishanshan 3 месяцев назад
Родитель
Сommit
a6488170da

+ 9 - 0
src/api/pay.ts

@@ -89,4 +89,13 @@ export function getWithdrawDetail(data: { id: string }) {
       returnResponse: true
     }
   })
+}
+
+// 银行卡认证接口
+export function bankCardAuth(data: { clientApp: string }) {
+  return http.Post('/payment/channelAccounts/withdraw/prepare/coupon', data, {
+    meta: {
+      returnResponse: true
+    }
+  })
 }

+ 3 - 3
src/components/couponList.vue

@@ -186,8 +186,8 @@ onShow(async () => {
         searchValue.value = ''
         await sendCategoryList()
     }
-    // 重新获取优惠券数据
-    await send()
+    // 重新获取优惠券数据(使用 reload 重置分页状态,避免重复数据)
+    await reload()
 })
 
 onUnload(() => {
@@ -642,4 +642,4 @@ async function couponTypeChange(type) {
         padding-top: 150rpx;
     }
 }
-</style>
+</style>

+ 37 - 6
src/pages-B/payment/bankCard-list.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import { ref, computed } from 'vue'
-import { getBankcardList } from '@/api/pay'
+import { getBankcardList, bankCardAuth } from '@/api/pay'
 import { getImageUrl } from '@/utils/imageUtil'
 
 // 响应式状态
@@ -52,12 +52,43 @@ function addBankCard() {
 			})
 		}
 	} else {
-		uni.navigateTo({
-			url: '/pages-B/payment/bankCard-edit'
-		})
+		// uni.navigateTo({
+		// 	url: '/pages-B/payment/bankCard-edit'
+        // })
+        bankCardAuth({ clientApp: "COUPON_CENTER_WECHAT_MINIAPP" }).then((res: any) => {
+          if (res.data.code === 200) {
+            const { status, certificationUrl } = res.data.result;
+            switch (status) {
+              case 'NEED_CERTIFICATION':
+                // 会员注册确认
+                confirmRegister(certificationUrl);
+                break;
+              case 'FAILED':
+                uni.$u.toast('会员认证失败');
+                break;
+              case 'READY':
+                uni.$u.toast('银行卡已绑定,数据同步中...');
+                break;
+            }
+          } else {
+            uni.$u.toast(res.message);
+          }
+        });
 	}
 }
 
+// 会员注册确认-跳转三方链接
+function confirmRegister(url: string) {
+  // #ifdef H5
+  window.location.href = url;
+  // #endif
+  // #ifndef H5
+  uni.navigateTo({
+    url: `/pages-B/payment/web-view?webUrl=${encodeURIComponent(url)}`,
+  });
+  // #endif
+}
+
 // 显示操作菜单
 function showCardActions(card: any) {
 	selectedCard.value = card
@@ -106,7 +137,7 @@ function onActionSelect(action: { name: string }) {
 					<text>●●●●</text>
 					<text>●●●●</text>
 					<text>●●●●</text>
-					<text class="n">{{ card.bankCardNumber ? card.bankCardNumber.substring(12) : '' }}</text>
+					<text class="n">{{ card.bankCardNumber ? card.bankCardNumber.slice(-4) : '' }}</text>
 				</view>
 			</view>
             <view v-if="cardList && cardList.length === 0">
@@ -132,7 +163,7 @@ function onActionSelect(action: { name: string }) {
             </view>
 		</view>
 
-		<view v-if="cardList && cardList.length > 0" class="footer-bar" >
+		<view v-if="btnText !== '更换' && cardList && cardList.length > 0" class="footer-bar" >
 			<u-button               
                 :customStyle="{
                     color: '#fff',

+ 2 - 2
src/pages-B/payment/bankCard-select.vue

@@ -100,11 +100,11 @@ defineExpose({
 					</view>
 
 					<!-- 绑定银行卡 -->
-					<view v-if="showChangeCard" class="card-item add-card" @click="addCard">
+					<!-- <view v-if="showChangeCard" class="card-item add-card" @click="addCard">
 						<image class="bank-icon" :src="getImageUrl('@local/mine/icon-bankadd.png')" mode="aspectFit"></image>
 						<text class="card-name">更换银行卡</text>
 						<up-icon name="arrow-right" color="#C7C6CA" size="32rpx"></up-icon>
-					</view>
+					</view> -->
 				</scroll-view>
 			</view>
 		</view>

+ 4 - 2
src/pages-B/payment/detail-withdraw.vue

@@ -66,7 +66,9 @@ function getData() {
 }
 
 function goBack() {
-	uni.navigateBack()
+	uni.reLaunch({
+        url: '/pages/income/income'
+    })
 }
 
 onLoad((options: any) => {
@@ -77,7 +79,7 @@ onLoad((options: any) => {
 
 <template>
 	<view class="page-container">
-		<u-navbar title="提现详情" :autoBack="true" :placeholder="true" :border-bottom="false" :title-style="{ fontWeight: 'bold' }"></u-navbar>
+		<u-navbar title="提现详情" :autoBack="false" :placeholder="true" :border-bottom="false" :title-style="{ fontWeight: 'bold' }" @back="goBack"></u-navbar>
 
 		<view class="content-wrapper">
 			<!-- 状态图标区域 -->

+ 9 - 25
src/pages-B/payment/withdrawal.vue

@@ -63,11 +63,11 @@ function fetchBankCards() {
 // 选择/修改银行卡
 const bcSelector = ref()
 function selectBankCard() {
-    if (bankCardNumber.value === 0) {
-        uni.navigateTo({ url: '/pages-B/payment/bankCard-edit' })
-    } else {
+    // if (bankCardNumber.value === 0) {
+    //     uni.navigateTo({ url: '/pages-B/payment/bankCard-edit' })
+    // } else {
         bcSelector.value?.open()
-    }
+    // }
 }
 
 // 选择事件回调
@@ -110,7 +110,6 @@ async function applyWithdrawal() {
     const params: netWithdrawResponse = {
         applyAmount: withdrawalAmount.value,
         bankCardId: bankCard.value.id,
-        // callBackUrl: `${domain.value}/pages-B/payment/withdrawal?m=${availableBalance.value}`
     }
     console.log('提交提现申请:', params)
 
@@ -118,37 +117,22 @@ async function applyWithdrawal() {
     uni.showLoading({ title: '提交中' })
 	netWithdraw(params).then((res: any) => {
         if (res.data.code === 200) {
+			uni.hideLoading();
 			uni.showToast({ title: '提交成功', icon: 'success' });
 			setTimeout(() => {
-				uni.hideLoading();
-				uni.reLaunch({
-                    url: '/pages/income/income'
-                });
+                // 跳转提现详情页
+                uni.navigateTo({
+                    url: `/pages-B/payment/detail-withdraw?id=${res.data.result.payoutNo}`, 
+                })
 			}, 1500);
 		} else {
 		  uni.$u.toast(res.data.message);
         }
-        // else if (res.data.code === 99 && res.data.message) {
-		// 	// 白名单接口请求失败-跳转三方链接
-		// 	toThirdPartyLink(res.data.message);
-		// }
 	}).finally(() => {
 		uni.hideLoading();
 	});
 }
 
-// 跳转三方链接
-function toThirdPartyLink(url: string) {
-    // #ifdef H5
-    window.location.href = url
-    // #endif
-    // #ifndef H5
-    uni.navigateTo({
-        url: `/pages-B/payment/web-view?webUrl=${encodeURIComponent(url)}`,
-    })
-    // #endif
-}
-
 // 取主域名
 function extractDomain(url: string): string {
     const regex = /^(https?:\/\/[^\/]+)/

+ 36 - 4
src/pages/income/income.vue

@@ -5,7 +5,7 @@ import { storeToRefs } from 'pinia'
 import { computed, ref, watch } from 'vue'
 import dayjs from 'dayjs'
 import { getAccountCount } from '@/api/home'
-import { getBankSignRecord } from '@/api/pay'
+import { getBankSignRecord, bankCardAuth } from '@/api/pay'
 import { getCouponIssuerAccountByPageMap } from '@/api/income'
 import IncomeItem from '@/components/IncomeItem.vue'
 import MescrollBody from '@/custom-components/custom-mescroll/mescroll-body.vue'
@@ -318,9 +318,41 @@ function goToWithdrawal() {
     // 获取可提现余额
     const money = accountCountData.value?.withdrawableAmount || 0
     const bankNumber = accountCountData.value?.bankNumber || 0
-    uni.navigateTo({
-        url: `/pages-B/payment/withdrawal?m=${money}&bankNumber=${bankNumber}`,
-    })
+    // uni.navigateTo({
+    //     url: `/pages-B/payment/withdrawal?m=${money}&bankNumber=${bankNumber}`,
+    // })
+    bankCardAuth({ clientApp: "COUPON_CENTER_WECHAT_MINIAPP" }).then((res: any) => {
+      if (res.data.code === 200) {
+        const { status, certificationUrl } = res.data.result;
+        switch (status) {
+          case 'NEED_CERTIFICATION':
+            // 会员注册确认
+            confirmRegister(certificationUrl);
+            break;
+          case 'FAILED':
+            uni.$u.toast('会员认证失败');
+            break;
+          case 'READY':
+            // 跳转提现页面
+            uni.navigateTo({ url: `/pages-B/payment/withdrawal?m=${money}&bankNumber=${bankNumber}` });
+            break;
+        }
+      } else {
+        uni.$u.toast(res.message);
+      }
+    });
+}
+
+// 会员注册确认-跳转三方链接
+function confirmRegister(url: string) {
+  // #ifdef H5
+  window.location.href = url;
+  // #endif
+  // #ifndef H5
+  uni.navigateTo({
+    url: `/pages-B/payment/web-view?webUrl=${encodeURIComponent(url)}`,
+  });
+  // #endif
 }
 
 function handleItemClick(item: any) {