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/add-bank-card/add-bank-card.vue |  164 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 151 insertions(+), 13 deletions(-)

diff --git a/mini-program/pagesA/pages/add-bank-card/add-bank-card.vue b/mini-program/pagesA/pages/add-bank-card/add-bank-card.vue
index 5c1d88b..4209836 100644
--- a/mini-program/pagesA/pages/add-bank-card/add-bank-card.vue
+++ b/mini-program/pagesA/pages/add-bank-card/add-bank-card.vue
@@ -1,42 +1,181 @@
 <template>
 	<view class="box">
 		<view class="item">
-			<view class="item-label">鎴峰悕</view>
+			<view class="item-label"><text style="color: red;">*</text> 鎴峰悕</view>
 			<view class="item-input">
-				<input type="text" placeholder="璇疯緭鍏ュ紑鎴蜂汉濮撳悕" />
+				<input type="text"  :focus='focus' @blur="focus=false"  v-model="form.name" placeholder="璇疯緭鍏ュ紑鎴蜂汉濮撳悕" />
 			</view>
 		</view>
 		<view class="item">
-			<view class="item-label">璐﹀彿</view>
+			<view class="item-label"><text style="color: red;">*</text>璐﹀彿</view>
 			<view class="item-input">
-				<input type="text" placeholder="璇疯緭鍏ラ摱琛屽崱鍙�" />
+				<input type="number" :focus='focus1' @blur="focus1=false"  v-model="form.bankAccount" placeholder="璇疯緭鍏ラ摱琛屽崱鍙�" />
 			</view>
 		</view>
 		<view class="item">
-			<view class="item-label">閾惰</view>
+			<view class="item-label"><text style="color: red;">*</text>閾惰</view>
 			<view class="item-input">
-				<input type="text" placeholder="璇疯緭鍏ュ紑鎴疯鏀鍚嶇О" />
+				<input type="text" :focus='focus2' @blur="focus2=false"  v-model="form.bankName" placeholder="璇疯緭鍏ュ紑鎴疯鏀鍚嶇О" />
 			</view>
 		</view>
 		<view class="item" style="display: flex; align-items: center; justify-content: space-between;">
 			<view class="item-label" style="color: #222222;">璁句负榛樿閾惰</view>
-			<u-switch v-model="value" activeColor="#004096"></u-switch>
+			<u-switch v-model="form.isDefault" :activeValue="1" :inactiveValue="0" activeColor="#004096"></u-switch>
 		</view>
 		<view style="width: 100%; height: calc(env(safe-area-inset-bottom) + 108rpx);"></view>
 		<!-- <view class="button disable">淇濆瓨</view> -->
 		<view class="footer">
-			<view class="footer-btn1">鍒犻櫎閾惰</view>
-			<view class="footer-btn2">纭</view>
+			<view class="footer-btn1" v-if="form.id" @click="confirm()">鍒犻櫎閾惰</view>
+			<view class="footer-btn2" @click="confirmEdit()">纭</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: red;" @click="confirmDel">纭鍒犻櫎</view>
+				</view> 
+			</view>
+		</u-popup>
 	</view>
 </template>
 
 <script>
+	import { mapState } from 'vuex'
 	export default {
+		computed: {
+			...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken'])
+		},
 		data() {
-			return {
-				value: 0
+			return { 
+				id:null,  
+				shop:{},
+				show:false,
+				focus:false,
+				focus1:false,
+				focus2:false,
+				loading:false,
+				form:{
+					id:null,
+					bankName:null,
+					bankAccount:null,
+					name:null,
+					isDefault:0
+				}
 			};
+		}, 
+		onLoad(options) {
+			this.form={}
+			this.shop  ={}
+			this.show =false
+			this.focus=false
+			this.focus1=false
+			this.focus2=false
+			this.loading=false
+			this.checkShopLogin()
+			this.shop = this.shopInfo || {} 
+			this.form={
+					id:null,
+					bankName:null,
+					bankAccount:null,
+					name:null,
+					isDefault:0
+				}
+			if(options.item){
+				try{
+					var tt = JSON.parse(options.item)
+			console.log("tt",tt)
+					this.form.id=tt.id||''
+					this.form.bankName=tt.bankName ||''
+					this.form.bankAccount=tt.bankAccount||''
+					this.form.name=tt.name||''
+					this.form.isDefault=tt.isDefault||0
+				}catch(e){
+				}
+			}
+			if(this.form.id){
+				uni.setNavigationBarTitle({
+					title:'缂栬緫鎻愮幇閾惰鍗�'
+				})
+			}else{
+				uni.setNavigationBarTitle({
+					title:'娣诲姞鎻愮幇閾惰鍗�'
+				})
+			}
+		},
+		methods:{
+			confirm(){
+				this.show = !this.show
+			},
+			confirmEdit(){
+			
+				if(!this.form.name){
+					uni.showToast({
+						'title': '璇疯緭鍏ユ埛鍚�',icon:'none'
+					})
+					this.focus=true
+					this.loading=false
+					return
+				}
+				if(!this.form.bankAccount){
+					uni.showToast({
+						'title': '璇疯緭鍏ヨ处鍙�',icon:'none'
+					})
+					this.focus1=true
+					this.loading=false
+					return
+				}
+				 if(!this.form.bankName){
+				 	uni.showToast({
+				 		'title': '璇疯緭鍏ラ摱琛屼俊鎭�',icon:'none'
+				 	})
+				 	this.focus2=true
+				 	this.loading=false
+				 	return
+				 }
+				  
+				var that =this
+				this.$u.api.saveBank(this.form)
+					.then(res => {
+						if (res.code === 200) { 
+							uni.showToast({
+								title:'鎿嶄綔鎴愬姛',
+								icon:'success'
+							})
+							uni.$emit('editBank',{})
+							uni.navigateBack({delta:1})
+						}
+					}).catch(e=>{
+						uni.showToast({
+							title:'鎿嶄綔澶辫触',
+							icon:'error'
+						})
+					})
+			},
+			async confirmDel(){
+				this.show = !this.show
+				var that =this
+				this.form.tokenType =1
+				let res = await that.$u.api.deleteBank({ id: this.form.id ,tokenType:1  });
+				if (res.code === 200 ) { 
+					this.show = false
+					uni.$emit('editBank',{})
+					uni.navigateBack({delta:1})
+				}   
+			},
+			async checkShopLogin(){
+				var that =this
+				if( this.shopInfo ==null || this.shopInfo.id==null ||  this.shopToken==null || this.shopToken==''){
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+				} 
+			}
 		}
 	}
 </script>
@@ -115,8 +254,7 @@
 				input {
 					width: 100%;
 					font-weight: 400;
-					font-size: 30rpx;
-					color: #999999;
+					font-size: 30rpx; 
 				}
 			}
 		}

--
Gitblit v1.9.3