From d98b610bd0793dd5d29f623400a1d0a81bb55334 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期四, 21 八月 2025 17:46:27 +0800
Subject: [PATCH] 优化

---
 small-program/pages/withdrawal/withdrawal.vue |   93 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 85 insertions(+), 8 deletions(-)

diff --git a/small-program/pages/withdrawal/withdrawal.vue b/small-program/pages/withdrawal/withdrawal.vue
index 765f968..0f9b211 100644
--- a/small-program/pages/withdrawal/withdrawal.vue
+++ b/small-program/pages/withdrawal/withdrawal.vue
@@ -11,13 +11,17 @@
 					<text>鎻愮幇鍒拌处</text>
 					<text>寰俊闆堕挶</text>
 				</view>
+				<view class="content-title">鐪熷疄濮撳悕</view>
+				<view class="content-input" style="margin-bottom: 40rpx;"> 
+					<input style="font-weight: 500;" type="text" v-model="name"  @input="changeName" placeholder="寰俊瀹炲悕璁よ瘉濮撳悕" /> 
+				</view>
 				<view class="content-title">鎻愮幇閲戦</view>
 				<view class="content-input">
 					<view class="content-input-icon">
 						<image src="/static/icon/ic_money@2x.png" mode="widthFix"></image>
 					</view>
-					<input type="number" v-model="amount" @input="changeAmount" placeholder="璇疯緭鍏ユ彁鐜伴噾棰�" />
-					<view class="content-input-btn" @click="inputAll">鍏ㄩ儴鎻愮幇</view>
+					<input type="digit" v-model="amount" @input="changeAmount" placeholder="璇疯緭鍏ユ彁鐜伴噾棰�" />
+					<view class="content-input-btn" @click="inputAll">鍏ㄩ儴鎻愮幇</view> 
 				</view>
 				<view class="content-tips">{{tips}}</view>
 				<view class="content-button" @click="submit">2灏忔椂鍒拌处锛岀‘璁ゆ彁鐜�</view>
@@ -35,23 +39,95 @@
 		data() {
 			return {
 				tips:'',//
+				wxTips:'',
+				canTransfer:false,
 				changing1:false,
-				amount: null
+				amount: null,
+				name:''
 			};
+		},
+		onLoad(){
+			this.name = this.userInfo.name
+			var that =this
+			that.canTransfer = false
+			if (wx.canIUse('requestMerchantTransfer')) {
+				//that.tips='鎮ㄧ殑寰俊鐗堟湰鏀寔璇ュ姛鑳�'
+				that.canTransfer = true
+			}else{
+				that.tips='鎮ㄧ殑寰俊鐗堟湰杩囦綆锛岃鏇存柊鑷虫渶鏂扮増鏈娇鐢ㄨ鍔熻兘'
+				uni.showToast({
+					title:'鎮ㄧ殑寰俊鐗堟湰杩囦綆锛岃鏇存柊鑷虫渶鏂扮増鏈娇鐢ㄨ鍔熻兘銆�'
+				})
+			}
+			/* wx.ready(function () {
+			  wx.checkJsApi({
+			    jsApiList: ['requestMerchantTransfer'],
+			    success: function (res) {
+			      if (res.checkResult['requestMerchantTransfer']) {
+						that.canTransfer = true
+			      } else {
+					  that.tips='鎮ㄧ殑寰俊鐗堟湰杩囦綆锛岃鏇存柊鑷虫渶鏂扮増鏈娇鐢ㄨ鍔熻兘'
+					  uni.showToast({
+					  	title:'鎮ㄧ殑寰俊鐗堟湰杩囦綆锛岃鏇存柊鑷虫渶鏂扮増鏈娇鐢ㄨ鍔熻兘銆�'
+					  })
+			      }
+			    }
+			  });
+			}); */
 		},
 		methods: {
 			jump() {
 				uni.navigateTo({
 					url: '/pages/balance-details/balance-details'
 				})
-			},
+			}, 
 			inputAll(){
 				this.amount = ((this.userInfo.amount|| 0)/100).toFixed(2)
 			},
 			changeAmount(){
 				this.tips=''
 			},
+			wxMerchantTransfer(param){	
+				wx.requestMerchantTransfer({
+				    mchId: param.mchId,
+				    appId: param.appId,
+				    package: param.packageInfo,
+				    success: (res) => {
+				      // res.err_msg灏嗗湪椤甸潰灞曠ず鎴愬姛鍚庤繑鍥炲簲鐢ㄦ椂杩斿洖ok锛屽苟涓嶄唬琛ㄤ粯娆炬垚鍔�
+					  console.log(res)
+				      uni.navigateTo({
+				      	url: '/pages/withdrawal-successful/withdrawal-successful'
+				      })
+				    },
+				    fail: (res) => {
+					  console.log("22222222222222",res)
+				      uni.showToast({
+				      	title:'瀵逛笉璧凤紝鎻愮幇澶辫触銆�'+res.err_msg
+				      })
+				    },
+				  });
+				/* WeixinJSBridge.invoke('requestMerchantTransfer',param,
+				  function (res) {
+					if (res.err_msg === 'requestMerchantTransfer:ok') {
+					  // res.err_msg灏嗗湪椤甸潰灞曠ず鎴愬姛鍚庤繑鍥炲簲鐢ㄦ椂杩斿洖success锛屽苟涓嶄唬琛ㄤ粯娆炬垚鍔�
+					  uni.navigateTo({
+					  	url: '/pages/withdrawal-successful/withdrawal-successful'
+					  })
+					}else{ 
+						uni.showToast({
+							title:'瀵逛笉璧凤紝鎻愮幇澶辫触銆�'+res.err_msg
+						})
+					}
+				  }
+				);	 */			      
+			},
 			submit() {
+				  if(!this.canTransfer){
+					  uni.showToast({
+					  	title:'鎮ㄧ殑寰俊鐗堟湰杩囦綆锛岃鏇存柊鑷虫渶鏂扮増鏈娇鐢ㄨ鍔熻兘銆�'
+					  })
+					  return;
+				  }
 				  if(this.changing1){
 						return
 				  }
@@ -68,13 +144,14 @@
 				  }
 				  this.changing1 = true
 				  var that = this
-				  var param ={amount:this.amount }
+				  var param ={amount:this.amount,name:this.name }
 				  that.$u.api.applyWithdrawal(param)
 				  .then(res =>{
 						if(res.code ===200){
-							uni.navigateTo({
-								url: '/pages/withdrawal-successful/withdrawal-successful'
-							})
+							that.wxMerchantTransfer(res.data);
+							// uni.navigateTo({
+							// 	url: '/pages/withdrawal-successful/withdrawal-successful'
+							// })
 						} 
 				   }).finally(() => {
 						that.changing1 = false

--
Gitblit v1.9.3