From 391c0cfc4ba595ef26c7a2315c555d8c75afec7d Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 22 八月 2025 11:13:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 small-program/pages/withdrawal/withdrawal.vue |  134 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 125 insertions(+), 9 deletions(-)

diff --git a/small-program/pages/withdrawal/withdrawal.vue b/small-program/pages/withdrawal/withdrawal.vue
index 63b5460..0f9b211 100644
--- a/small-program/pages/withdrawal/withdrawal.vue
+++ b/small-program/pages/withdrawal/withdrawal.vue
@@ -3,7 +3,7 @@
 		<view class="tx-content">
 			<view class="tx-content-title">鍙彁鐜颁綑棰�(鍏�)</view>
 			<view class="tx-content-price">
-				<text>1000.00</text>
+				<text>{{((userInfo.amount|| 0)/100).toFixed(2)}}</text>
 				<view class="tx-content-price-btn" @click="jump">浣欓鏄庣粏</view>
 			</view>
 			<view class="content">
@@ -11,15 +11,19 @@
 					<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" placeholder="璇疯緭鍏ユ彁鐜伴噾棰�" />
-					<view class="content-input-btn">鍏ㄩ儴鎻愮幇</view>
+					<input type="digit" v-model="amount" @input="changeAmount" placeholder="璇疯緭鍏ユ彁鐜伴噾棰�" />
+					<view class="content-input-btn" @click="inputAll">鍏ㄩ儴鎻愮幇</view> 
 				</view>
-				<view class="content-tips">杈撳叆鐨勯噾棰濆凡缁忚秴杩囧彲鎻愮幇閲戦</view>
+				<view class="content-tips">{{tips}}</view>
 				<view class="content-button" @click="submit">2灏忔椂鍒拌处锛岀‘璁ゆ彁鐜�</view>
 			</view>
 		</view>
@@ -27,23 +31,135 @@
 </template>
 
 <script>
+	import { mapState } from 'vuex'
 	export default {
+		computed: {
+			...mapState(['userInfo' ])
+		},
 		data() {
 			return {
-				
+				tips:'',//
+				wxTips:'',
+				canTransfer:false,
+				changing1:false,
+				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() {
-				uni.navigateTo({
-					url: '/pages/withdrawal-successful/withdrawal-successful'
-				})
-			}
+				  if(!this.canTransfer){
+					  uni.showToast({
+					  	title:'鎮ㄧ殑寰俊鐗堟湰杩囦綆锛岃鏇存柊鑷虫渶鏂扮増鏈娇鐢ㄨ鍔熻兘銆�'
+					  })
+					  return;
+				  }
+				  if(this.changing1){
+						return
+				  }
+				  this.changing1 = true
+				  if(this.amount == null || this.amount<=0){
+					  this.tips = '鎻愪氦閲戦蹇呴』澶т簬0锛岃嚦灏戞彁鐜�0.1鍏�'
+					  this.changing1 = false
+					  return
+				  }
+				  if(this.amount *100 > this.userInfo.amount){
+					  this.tips = '杈撳叆鐨勯噾棰濆凡缁忚秴杩囧彲鎻愮幇閲戦'
+					  this.changing1 = false
+					  return
+				  }
+				  this.changing1 = true
+				  var that = this
+				  var param ={amount:this.amount,name:this.name }
+				  that.$u.api.applyWithdrawal(param)
+				  .then(res =>{
+						if(res.code ===200){
+							that.wxMerchantTransfer(res.data);
+							// uni.navigateTo({
+							// 	url: '/pages/withdrawal-successful/withdrawal-successful'
+							// })
+						} 
+				   }).finally(() => {
+						that.changing1 = false
+						that.tips=''
+						that.amount =null
+					})
+			},
+			
 		}
 	}
 </script>

--
Gitblit v1.9.3