From a690229b69cfa0aba5a0352772c2bdc1cf9fdab0 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 25 二月 2026 18:41:12 +0800
Subject: [PATCH] 调试

---
 mini-program/pagesA/pages/withdraw/withdraw.vue |  128 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 108 insertions(+), 20 deletions(-)

diff --git a/mini-program/pagesA/pages/withdraw/withdraw.vue b/mini-program/pagesA/pages/withdraw/withdraw.vue
index af47ca1..4e83961 100644
--- a/mini-program/pagesA/pages/withdraw/withdraw.vue
+++ b/mini-program/pagesA/pages/withdraw/withdraw.vue
@@ -10,8 +10,8 @@
 				<view class="form-a">
 					<view class="form-a-label">鎻愮幇鑷�</view>
 					<view class="form-a-val" @click="jumpBank" >
-						<text v-if="!selectBank || !selectBank.id ">鏆傛棤閾惰淇℃伅锛岀偣鍑绘坊鍔�</text>
-						<text v-if="selectBank && selectBank.id  ">{{selectBank.name}}</text>
+						<text v-if="!selectBank || !selectBank.id " class="text-grey">鏆傛棤閾惰淇℃伅锛岀偣鍑绘坊鍔�</text>
+						<text v-if="selectBank && selectBank.id  ">{{selectBank.bankInfo || ''}}</text>
 						<u-icon name="arrow-right" color="#999999" size="16"></u-icon>
 					</view>
 				</view>
@@ -19,13 +19,28 @@
 				<view class="form-title">鎻愮幇閲戦</view>
 				<view class="form-input">
 					<view class="form-input-dw">锟�</view>
-					<input type="text" placeholder="0" v-model="form.amount" />
+					<input type="text" placeholder="0" v-model="form.amount"  :focus='focus' @blur="focus=false"/>
 					<view class="form-input-tx" @click="inputAll">鍏ㄩ儴鎻愮幇</view>
 				</view>
-				<view class="form-error">杈撳叆鐨勯噾棰濆凡缁忚秴杩囧彲鎻愮幇閲戦</view>
-				<view class="form-btn disable">鎻愪氦鐢宠</view>
+				<view class="form-error">{{tips}}</view>
+				<view class="form-btn disable" v-if="!validForm">鎻愪氦鐢宠</view>
+				<view class="form-btn" v-if="validForm" @click="confirm()">鎻愪氦鐢宠</view>
 			</view>
 		</view>
+		<u-popup :show="show" round="15" :safeAreaInsetBottom="false" mode="center">
+			<view class="tc">
+				<view class="tc-contemt">
+					<view class="tc-contemt-title">鎿嶄綔鎻愮ず</view>
+					<view class="tc-contemt-nr">
+						鎮ㄧ‘璁ゅ彂璧锋娆℃彁鐜扮敵璇峰悧锛�
+					</view>
+				</view>
+				<view class="tc-btn">
+					<view class="tc-btn-item" @click="confirm() ">鎴戝啀鎯虫兂</view>
+					<view class="tc-btn-item" style="color: #004096;" @click="applyDo">纭</view>
+				</view> 
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -33,48 +48,118 @@
 	import { mapState } from 'vuex'
 	export default {
 		computed: {
-			...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken'])
+			...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken']),
+		  validForm() {
+			   this.tips =''
+			 if(! this.selectBank || !this.selectBank.id){
+				this.tips ='璇峰厛閫夋嫨鎮ㄩ渶瑕佹彁鐜扮殑閾惰璐︽埛淇℃伅'
+			 	return false
+			 }
+			 this.form.bankId = this.selectBank.id
+			 if(!this.form.amount ||this.form.amount <=0){
+				this.tips ='璇疯緭鍏ユ彁鐜伴噾棰�'
+				this.focus=true
+			 	return false
+			 }
+			 if(this.form.amount >( this.shop.amount||0)){
+				 this.tips ='杈撳叆鐨勯噾棰濆凡缁忚秴杩囧彲鎻愮幇閲戦'
+				this.focus=true
+				return false
+			 }
+			  return true
+			}
 		},
 		data() {
 			return { 
+				show:false,
+				tips:'',
+				focus:false,
+				valid:false,
 				bankList:[],
 				selectBank:[],
-				id:null, 
-				form{
-					amount:0
-				},
+				form: { amount:null,bankId:null},
 				shop:{},
 				info:{}
-			};
+			}
 		}, 
 		onLoad(options) {
-			this.id = options.id
 			this.info={}
+			this.tips=''
 			this.shop  ={}
 			this.bankList = []
-			this.selectBank=[]
+			this.show=false
+			this.focus=false
+			this.selectBank={}
 			this.checkShopLogin()
 			this.shop = this.shopInfo || {} 
 			this.getBankList()
+			var that =this
+			uni.$on('selectBank',function(data){
+				console.log('鐩戝惉鍒颁簨浠舵潵鑷� selectBank锛�' ,data);
+				that.selectBank = data.info
+			})
 		},
 		methods:{  
+			confirm(){
+				this.tips = '';
+				if(! this.selectBank || !this.selectBank.id){
+					this.tips ='璇峰厛閫夋嫨鎮ㄩ渶瑕佹彁鐜扮殑閾惰璐︽埛淇℃伅'
+					return
+				}
+				this.form.bankId = this.selectBank.id
+				if(!this.form.amount){
+					this.tips ='璇疯緭鍏ユ纭殑鎻愮幇閲戦'
+					this.focus=true
+					return
+				}
+				if(this.form.amount >( this.shop.amount||0)){
+					this.tips ='杈撳叆鐨勯噾棰濆凡缁忚秴杩囧彲鎻愮幇閲戦'
+					this.focus=true
+					return
+				}
+				this.show = !this.show
+			},
+			applyDo(){
+				var that =this
+				this.$u.api.withdrawApply(this.form)
+					.then(res => {
+						if (res.code === 200) { 
+							uni.showToast({
+								title:'鎿嶄綔鎴愬姛',
+								icon:'success'
+							})
+							uni.$emit('accountListReload',{})
+							uni.redirectTo({url:"/pagesA/pages/withdraw-success/withdraw-success?id="+res.data})
+						}
+					}).catch(e=>{
+						uni.showToast({
+							title:'鎿嶄綔澶辫触',
+							icon:'error'
+						})
+					})
+			},
 			inputAll(){
 				this.form.amount = this.shop.amount ||0
 			},
-			jumpBank( ){
+			jumpBank(){
 				if(this.selectBank  && this.selectBank.id){
 					uni.navigateTo({
-						url: '/pagesA/pages/withdraw-select/withdraw-select?id='+id
+						url: '/pagesA/pages/withdraw-select/withdraw-select?item='+JSON.stringify(this.selectBank)
 					})
 				}else{
-					url: '/pagesA/pages/withdraw-select/withdraw-select'
+					uni.navigateTo({
+						url: '/pagesA/pages/withdraw-select/withdraw-select'
+					})
 				}
 			},
 			async getBankList(){
-				let res = await that.$u.api.getShopInfo({tokenType:1  })
+				var that =this
+				let res = await that.$u.api.getBankList({tokenType:1  })
 				if (res.code === 200) {
-					await that.$store.commit('setShopInfo', res.data) 
-					this.shop = res.data || {} 
+					that.bankList = res.data || []
+					if(that.bankList.length>0){
+						that.selectBank = that.bankList[0]
+					}
 				}
 				
 			},
@@ -160,9 +245,12 @@
 						text {
 							font-weight: 400;
 							font-size: 28rpx;
-							color: #999999;
 							margin-right: 20rpx;
 						}
+						.text-grey {
+							color: #999999;
+						}
+
 					}
 				}
 				.form-xian {

--
Gitblit v1.9.3