xiaol 6 months ago
parent
commit
1a4d4dcfbf

+ 34 - 1
api/set.js

@@ -53,4 +53,37 @@ export function applelogin(data) {
 		data
 	});
 }
-// #endif
+// #endif
+//获取银行卡列表
+export function getBank(data) {
+	return request({
+		url: '/api/bank',
+		method: 'get',
+		data
+	});
+}
+//获取银行卡信息
+export function bankInfo(data) {
+	return request({
+		url: `/api/bank/${data.id}`,
+		method: 'get',
+		data
+	});
+}
+//添加、编辑银行卡信息
+export function addBank(data) {
+	return request({
+		url: `/api/bank/${data.id}`,
+		method: 'post',
+		data
+	});
+}
+
+//删除银行卡信息
+export function delBank(data) {
+	return request({
+		url: `/api/bank/del/${data.id}`,
+		method: 'post',
+		data
+	});
+}

+ 1 - 1
package-lock.json

@@ -1,5 +1,5 @@
 {
-  "name": "PKR",
+  "name": "yzf",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {

+ 8 - 0
pages.json

@@ -241,6 +241,14 @@
 					"navigationBarTextStyle": "white"
 				}
 			},
+			{
+				"path": "set/editBank",
+				"style": {
+					"navigationBarTitleText": "银行卡信息",
+					"navigationBarBackgroundColor": "#051137",
+					"navigationBarTextStyle": "white"
+				}
+			},
 			{
 				"path": "transfer",
 				"style": {

+ 0 - 11
pages/index/personal.vue

@@ -11,17 +11,6 @@
 				<view class="login_name"><input class="uni-input" type="idcard" v-model="idCard"
 						placeholder="请输入身份证号" /></view>
 			</view>
-			<!-- <view class="login_input flex">
-			<view class="login_name"><text>手机号</text></view>
-			<view class="login_name"><input class="uni-input" type="number" v-model="phone" placeholder="请输入手机号" /></view>
-		</view> -->
-			<!-- <view class="login_input flex">
-			<view class="login_name"><text>验证码</text></view>
-			<view class="login_name flex_item">
-				<input style="width: 310rpx;" class="uni-input" type="number" v-model="vcode" placeholder="请输入验证码" />
-				<view class="" style="font-size: 26rpx;color: #0C5AFA;">获取验证码</view>
-			</view>
-		</view> -->
 		</view>
 		<view class="uploadText">身份证照片(正反两面)</view>
 		<view class="flex upLoadBox">

+ 168 - 4
pages/user/set/bindBank.vue

@@ -1,8 +1,172 @@
 <template>
+	<view class="container">
+		<view class="listTpl flex" v-if="list.length > 0" v-for="item,index in list">
+			<view class="infoTpl">
+				<view class="tplName flex_item">
+					<image src="../../../static/image/img34.png" style="width: 40rpx;position: relative;top:10rpx;" mode="widthFix"></image>
+					<view class="titleBox">
+						<view class="name">{{item.bank}}</view>
+						<view class="tip">持卡人:{{item.bank_real_name}}</view>
+					</view>
+				</view>
+				<view class="cardNum flex_item">
+					<view class="num" v-if="!item.show">{{item.bank_code1}}</view>
+					<view class="num1" v-else>{{item.bank_code}}</view>
+					<view @click="showChange(index,item.show)">
+						<image :src="item.show?'/static/image/img35.png':'/static/image/img36.png'" style="width: 50rpx;" mode="widthFix"></image>
+					</view>
+				</view>
+			</view>
+			<view class="tplTip flex_item" @click="edit(item.id,'edit')">
+				<view class="edit">去修改</view>
+				<uni-icons type="right" color="#fff"></uni-icons>
+			</view>
+			<view class="del" @click="del(item.id)">
+				<image src="/static/image/img37.png" style="width: 32rpx;" mode="widthFix"></image>
+			</view>
+		</view>
+		<view  class="noData" v-if="list.length == 0">暂无银行卡数据~</view>
+		<view class="submission">
+			<button class="golden" type="golden" hover-class="none" @click="edit(0,'add')">添加银行卡</button>
+		</view>
+	</view>
 </template>
-
 <script>
+	import { getBank,delBank } from '@/api/set.js';
+	export default {
+		data() {
+			return{
+				list:[],
+			};
+		},
+		onLoad() {},
+		onShow() {
+			this.getList()
+		},
+		methods: {
+			showChange(index,show){
+				this.list[index].show = !show
+			},
+			getList(){
+				let obj = this
+				getBank({
+					page:1,
+					limit:100
+				}).then(res => {
+					let data = res.data.list
+					let reg = /^(.{4})(?:\d+)(.{4})$/
+					data.forEach(item => {
+						item.show = false
+						item.bank_code1 = item.bank_code.replace(reg, "**** **** **** $2")
+					})
+					obj.list = data
+				});
+			},
+			del(id){
+				let obj = this
+				uni.showModal({
+					title: '提示',
+					content: '您确定要删除该银行卡吗?',
+					success: (res) => {
+						if(res.confirm) {
+							delBank({
+								id:id
+							}).then(res => {
+								uni.showToast({
+									title: res.msg,
+									icon: 'none',
+									duration: 1000
+								})
+								setTimeout(function () {
+									obj.getList()
+								}, 100);
+							});
+						} else {
+							console.log('cancel') //点击取消之后执行的代码
+						}
+					}
+				})
+			},
+			edit(id,type){
+				if(type == 'add'){
+					uni.navigateTo({
+						url:'/pages/user/set/editBank'
+					})
+				}else{
+					uni.navigateTo({
+						url:'/pages/user/set/editBank?id='+id
+					})
+				}
+			}
+		},
+	};
 </script>
-
-<style>
-</style>
+<style lang="scss" scoped>
+	.container{
+		padding: 25rpx 25rpx;
+		
+	}
+	.del{
+		position: absolute;
+		right: 35rpx;
+		top: 35rpx;
+	}
+	.listTpl{
+		color: #fff;
+		background: #1F2A4A;
+		padding: 36rpx 38rpx;
+		border-radius: 20rpx;
+		margin-bottom: 25rpx;
+		position: relative;
+		.infoTpl{
+			.tplName{
+				align-items: flex-start;
+				.titleBox{
+					padding-left: 25rpx;
+					.name{
+						font-weight: bold;
+						font-size: 30rpx;
+						color: #FFFFFF;
+					}
+					.tip{
+						font-weight: 500;
+						font-size: 25rpx;
+						color: rgba(255, 255, 255, 0.64);
+						padding-top: 12rpx;
+					}
+				}
+			}
+			.cardNum{
+				font-weight: bold;
+				color: #FFFFFF;
+				padding-top: 50rpx;
+				padding-bottom: 20rpx;
+				.num{
+					margin-right: 35rpx;
+					font-size: 45rpx;
+				}
+				.num1{
+					margin-right: 35rpx;
+					font-size: 38rpx;
+				}
+			}
+		}
+	}
+	.noData{
+		color: rgba(255, 255, 255, 0.64);
+		font-size: 25rpx;
+		padding: 30rpx 0rpx;
+		text-align: center;
+	}
+	.submission {
+		padding: 80rpx 25rpx;
+	
+		.golden {
+			background: #0C5AFA;
+			color: #ffffff;
+		}
+	}
+	.edit{
+		font-size: 30rpx;
+	}
+</style>

+ 166 - 0
pages/user/set/editBank.vue

@@ -0,0 +1,166 @@
+<template>
+	<view class="container">
+		<view class="login_text">
+			<view class="login_input flex" style="padding-top: 45rpx;">
+				<view class="login_name">姓名</view>
+				<view class="login_name"><input class="uni-input" type="text" v-model="info.bank_real_name"
+						placeholder="请输入真实姓名" /></view>
+			</view>
+			<view class="login_input flex">
+				<view class="login_name"><text>银行</text></view>
+				<view class="login_name"><input class="uni-input" type="idcard" v-model="info.bank"
+						placeholder="请输入银行" /></view>
+			</view>
+			<view class="login_input flex">
+				<view class="login_name"><text>银行卡账号</text></view>
+				<view class="login_name"><input class="uni-input" type="idcard" v-model="info.bank_code"
+						placeholder="请输入银行卡账号" /></view>
+			</view>
+			<view class="login_input flex">
+				<view class="login_name"><text>开户行</text></view>
+				<view class="login_name"><input class="uni-input" type="idcard" v-model="info.bank_name"
+						placeholder="请输入开户行" /></view>
+			</view>
+		</view>
+		<view class="submission">
+			<button class="golden" type="golden" hover-class="none" @click="submission">确认</button>
+		</view>
+	</view>
+</template>
+<script>
+	import { bankInfo,addBank } from '@/api/set.js';
+	export default {
+		data() {
+			return{
+				info:{
+					id:'',
+					bank_real_name:'',
+					bank_code:'',
+					bank:'',
+					bank_name:'',
+					default:0
+				}
+			};
+		},
+		onLoad(option) {
+			if(option.id){
+				this.info.id = option.id
+				this.getList()
+			}
+			// getMoneyLog({
+			// 		page: navItem.page,
+			// 		limit: navItem.limit
+			// 	},navItem.type)
+		},
+		onShow() {},
+		methods: {
+			getList(){
+				let obj = this
+				bankInfo({
+					id:obj.info.id
+				}).then(res => {
+					obj.info = res.data.info
+				});
+			},
+			submission(){
+				let obj = this
+				if(!obj.info.bank_real_name){
+					uni.showToast({
+						title: '请输入真实姓名',
+						icon: 'none',
+					})
+					return
+				}
+				if(!obj.info.bank){
+					uni.showToast({
+						title: '请输入银行',
+						icon: 'none',
+					})
+					return
+				}
+				if(!obj.info.bank_code){
+					uni.showToast({
+						title: '请输入银行卡号',
+						icon: 'none',
+					})
+					return
+				}
+				if(obj.info.bank_code.length < 16){
+					uni.showToast({
+						title: '请输入正确的银行卡号',
+						icon: 'none',
+					})
+					return
+				}
+				if(!obj.info.bank_name){
+					uni.showToast({
+						title: '请输入开户行',
+						icon: 'none',
+					})
+					return
+				}
+				let data = ''
+				if(obj.info.id){
+					data = {
+						bank:obj.info.bank,//银行
+						bank_name:obj.info.bank_name,//开户行
+						bank_code:obj.info.bank_code,//银行卡号
+						real_name:obj.info.bank_real_name,//开户人
+						default:0,//1设为默认,0取消默认
+						id:obj.info.id
+					}
+				}else{
+					data = {
+						bank:obj.info.bank,//银行
+						bank_name:obj.info.bank_name,//开户行
+						bank_code:obj.info.bank_code,//银行卡号
+						real_name:obj.info.bank_real_name,//开户人
+						default:0,//1设为默认,0取消默认
+					}
+				}
+				addBank(data).then(res => {
+					uni.showToast({
+						title: res.msg,
+						icon: 'none',
+						duration: 1000
+					})
+					setTimeout(function () {
+						uni.navigateTo({
+							url:'/pages/user/set/bindBank'
+						})
+					}, 1000);
+				});
+			},
+		},
+	};
+</script>
+<style lang="scss" scoped>
+	.login_text {
+		width: 100%;
+		// padding: 25rpx 0rpx;
+		font-size: 28rpx !important;
+		padding: 0rpx 25rpx;
+	}
+	
+	.login_input {
+		border-bottom: 1px solid #464755;
+		padding: 35rpx;
+	}
+	.uni-input {
+		width: 450rpx;
+		text-align: left !important;
+		font-size: 26rpx;
+	}
+	.submission {
+		padding: 80rpx 25rpx;
+	
+		.golden {
+			background: #0C5AFA;
+			color: #ffffff;
+		}
+	}
+	
+	.login_name {
+		color: #ffffff;
+	}
+</style>

+ 2 - 2
pages/user/set/set.vue

@@ -67,7 +67,7 @@
 					<uni-icons type="right" :color='iconColor'></uni-icons>
 				</view>
 			</view>
-			<view class="flex item">
+			<!-- <view class="flex item">
 				<view class="left flex-start">
 					<uni-icons type="wallet" :size="iconSize" :color="listColor"></uni-icons>
 					<text class="title">
@@ -77,7 +77,7 @@
 				<view class="right">
 					<uni-icons type="right" :color='iconColor'></uni-icons>
 				</view>
-			</view>
+			</view> -->
 		</view>
 		<view class="list-cell log-out-btn" @click="toLogout">
 			<text class="cell-tit">{{$t('accountSettings.a9')}}</text>

+ 1 - 0
pages/user/set/shareQrCode.vue

@@ -219,6 +219,7 @@
 					// #ifdef MP
 					type: 1,
 					// #endif
+					url:''
 				})
 					.then(res => {
 						uni.hideLoading();

BIN
static/image/img34.png


BIN
static/image/img35.png


BIN
static/image/img36.png


BIN
static/image/img37.png