hwq 3 سال پیش
والد
کامیت
63d8f27f38
6فایلهای تغییر یافته به همراه270 افزوده شده و 131 حذف شده
  1. 77 5
      pages/collection/bank.vue
  2. 82 91
      pages/collection/collection.vue
  3. 96 34
      pages/collection/zfb.vue
  4. 7 1
      pages/money/award.vue
  5. 4 0
      pages/user/assets.vue
  6. 4 0
      pages/user/user.vue

+ 77 - 5
pages/collection/bank.vue

@@ -3,25 +3,97 @@
 		<view class="box">
 			<view class="item ">
 				<text>姓名</text>
-				<input type="text" value="" placeholder="请输入真实姓名" />
+				<input type="text" v-model="name" value="" placeholder="请输入真实姓名" />
 			</view>
 			<view class="item top">
 				<text>银行卡号</text>
-				<input type="text" value="" placeholder="请输入银行卡账号" />
+				<input type="text" v-model="id" value="" placeholder="请输入银行卡账号" />
 			</view>
 			<view class="item">
 				<text>所属银行</text>
-				<input type="text" value="" placeholder="请输入银行" />
+				<input type="text" v-model="idName" value="" placeholder="请输入银行" />
 			</view>
 		</view>
-		<view class="button">确认</view>
+		<view class="button" @click="confirm()">确认</view>
 	</view>
 </template>
 
 <script>
+import { userEdit } from '@/api/set.js';
+import { orderData,getUserInfo } from '@/api/user.js';
+import { mapState, mapMutations } from 'vuex';
 export default {
+	computed: {
+		...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
+	},
 	data() {
-		return {};
+		return {
+			name:'',
+			id:'',
+			idName:'',
+		};
+	},
+	onLoad() {
+		if(this.userInfo.bank_code != null){
+			this.id = this.userInfo.bank_code
+		}
+		if(this.userInfo.bank_name != null){
+			this.idName = this.userInfo.bank_name
+		}
+		if(this.userInfo.bank_user_name != null){
+			this.name = this.userInfo.bank_user_name
+		}
+	},
+	methods: {
+		...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
+		confirm() {
+			let obj = this;
+			if (!obj.name) {
+				return this.$api.msg('请输入提款人姓名');
+			}
+			if (!obj.idName) {
+				return this.$api.msg('请输入所属银行');
+			}
+			if (!obj.id) {
+				return this.$api.msg('请输入银行卡号');
+			}
+			userEdit({
+				bank_user_name: obj.name,
+				bank_name: obj.idName,
+				bank_code: obj.id
+			}).then(e => {
+				obj.$api.msg('修改成功');
+				obj.getUserInfo();
+			});
+		},
+		// 更新用户信息
+		getUserInfo() {
+			getUserInfo({})
+				.then(({ data }) => {
+					console.log(data)
+					this.setUserInfo(data);
+					// 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
+					orderData({})
+						.then(({ data }) => {
+							this.setOrderInfo(data);
+							uni.navigateBack({
+								delta: 1
+							});
+						})
+						.catch(e => {
+							this.setOrderInfo({
+								complete_count: 0, //完成
+								received_count: 0, //待收货
+								unshipped_count: 0, //待发货
+								order_count: 0, //订单总数
+								unpaid_count: 0 //待付款
+							});
+						});
+				})
+				.catch(e => {
+					console.log(e);
+				});
+		},
 	}
 };
 </script>

+ 82 - 91
pages/collection/collection.vue

@@ -3,39 +3,24 @@
 		<view class="collection-box">
 			<view class="collection-item">
 				<view class="left">
-					<view class="img">
-						<image src="../../static/user/mybank.png" mode=""></image>
-					</view>
-					<view class="bank">
-						银行卡
-					</view>
+					<view class="img"><image src="../../static/user/mybank.png" mode=""></image></view>
+					<view class="bank">银行卡</view>
 				</view>
 				<view class="gg" @click="nav('/pages/collection/bank')">
-					<view class="status">
-						未添加
-					</view>
-					
-					<view class="img1" @click="nav('')">
-						<text class="iconfont iconenter"></text>
-					</view>
+					<view class="status" v-if="bankData.fullname != null">{{ bankData.fullname}}</view>
+					<view class="status" v-else>未添加</view>
+					<view class="img1"><text class="iconfont iconenter"></text></view>
 				</view>
 			</view>
 			<view class="collection-item">
 				<view class="left">
-					<view class="img">
-						<image src="../../static/user/zfb.png" mode=""></image>
-					</view>
-					<view class="bank">
-						支付宝
-					</view>
+					<view class="img"><image src="../../static/user/zfb.png" mode=""></image></view>
+					<view class="bank">支付宝</view>
 				</view>
 				<view class="gg" @click="nav('/pages/collection/zfb')">
-					<view class="status">
-						未添加
-					</view>
-					<view class="img1">
-						<text class="iconfont iconenter"></text>
-					</view>
+					<view class="status" v-if="aliData.fullname != null">{{aliData.fullname}}</view>
+					<view class="status" v-else>未添加</view>
+					<view class="img1"><text class="iconfont iconenter"></text></view>
 				</view>
 			</view>
 			<!-- <view class="collection-item">
@@ -61,91 +46,97 @@
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-
-			};
-		},
-		onLoad() {
-			this.loadData();
-		},
-		methods: {
-			loadData(){
-				
-			},
-			nav(url){
-				uni.navigateTo({
-					url
-				})
-			}
+import { mapState, mapMutations } from 'vuex';
+export default {
+	data() {
+		return {
+			aliData: {fullname:'',alino:''},
+			bankData: {fullname:'',bank:'',bankno:''},
+		};
+	},
+	computed: {
+		...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
+	},
+	onShow() {
+		this.aliData.fullname = this.userInfo.alipay_name;
+		console.log(this.aliData.fullname);
+		this.aliData.alino = this.userInfo.alipay_code
+		this.bankData.fullname = this.userInfo.bank_user_name;
+		this.bankData.bank = this.userInfo.bank_name;
+		this.bankData.bankno = this.userInfo.bank_code;
+	},
+	methods: {
+		nav(url) {
+			uni.navigateTo({
+				url
+			});
 		}
 	}
+};
 </script>
 <style lang="scss">
-	page,
-	.content {
-		height: 100%;
-		margin: 0;
-		height: 0;
-	}
+page,
+.content {
+	height: 100%;
+	margin: 0;
+	height: 0;
+}
 
-	.collection-box {
-		background: #FFFFFF;
-		margin: 50rpx 20rpx;
-		width: 710rpx;
+.collection-box {
+	background: #ffffff;
+	margin: 50rpx 20rpx;
+	width: 710rpx;
+	display: flex;
+	flex-direction: column;
+
+	.collection-item {
+		margin: 35rpx 30rpx;
 		display: flex;
-		flex-direction: column;
+		justify-content: space-between;
 
-		.collection-item {
-			margin: 35rpx 30rpx;
+		.left {
 			display: flex;
-			justify-content: space-between;
-
-			.left {
-				display: flex;
 
-				.img {
-					height: 40rpx;
-					width: 40rpx;
+			.img {
+				height: 40rpx;
+				width: 40rpx;
 
-					image {
-						height: 100%;
-						width: 100%;
-					}
-				}
-
-				.bank {
-					margin-left: 25rpx;
-					font-size: 26rpx;
-					font-family: PingFang SC;
-					font-weight: 500;
-					color: #333333;
+				image {
+					height: 100%;
+					width: 100%;
 				}
 			}
 
-			.gg {
-				display: flex;
+			.bank {
+				margin-left: 25rpx;
+				font-size: 26rpx;
+				font-family: PingFang SC;
+				font-weight: 500;
+				color: #333333;
+			}
+		}
 
-				.status {
-					font-size: 26rpx;
-					font-family: PingFang SC;
-					font-weight: 500;
-					color: #999999;
-					margin-right: 20rpx;
-				}
+		.gg {
+			display: flex;
 
-				.img1 {
-					width: 15rpx;
-					height: 25rpx;
+			.status {
+				font-size: 26rpx;
+				font-family: PingFang SC;
+				font-weight: 500;
+				color: #999999;
+				margin-right: 20rpx;
+			}
 
-					image {
-						width: 100%;
-						height: 100%;
+			.img1 {
+				width: 15rpx;
+				height: 25rpx;
 
-					}
+				image {
+					width: 100%;
+					height: 100%;
 				}
 			}
 		}
 	}
+}
 </style>

+ 96 - 34
pages/collection/zfb.vue

@@ -3,46 +3,110 @@
 		<view class="box">
 			<view class="item top">
 				<text>真实姓名</text>
-				<input type="text" value="" placeholder="请输入真实姓名" />
+				<input type="text" v-model="name" value="" placeholder="请输入真实姓名" />
 			</view>
 			<view class="item">
 				<text>支付宝账号</text>
-				<input type="text" value="" placeholder="请输入支付宝账号" />
+				<input type="text" v-model="id" value="" placeholder="请输入支付宝账号" />
 			</view>
 		</view>
-		<view class="button">
-			确认
-		</view>
+		<view class="button" @click="confirm()">确认</view>
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			};
+import { orderData, getUserInfo } from '@/api/user.js';
+import { mapState, mapMutations } from 'vuex';
+import { userEdit } from '@/api/set.js';
+export default {
+	computed: {
+		...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
+	},
+	data() {
+		return {
+			name: '',
+			id: ''
+		};
+	},
+	onLoad() {
+		if (this.userInfo.alipay_code != null) {
+			this.id = this.userInfo.alipay_code;
+		}
+		if (this.userInfo.alipay_name != null) {
+			this.name = this.userInfo.alipay_name;
 		}
+	},
+	methods: {
+		...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
+		confirm() {
+			let obj = this;
+			if (!obj.name) {
+				return this.$api.msg('请输入提款人姓名');
+			}
+			if (!obj.id) {
+				return this.$api.msg('请输入支付宝账号');
+			}
+			userEdit({
+				alipay_name: obj.name,
+				alipay_code: obj.id
+			})
+				.then(e => {
+					obj.$api.msg('修改成功');
+					obj.getUserInfo();
+				})
+				.catch(e => {
+					console.log(e);
+				});
+		},
+		// 更新用户信息
+		getUserInfo() {
+			getUserInfo({})
+				.then(({ data }) => {
+					console.log(data)
+					this.setUserInfo(data);
+					// 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
+					orderData({})
+						.then(({ data }) => {
+							this.setOrderInfo(data);
+							uni.navigateBack({
+								delta: 1
+							});
+						})
+						.catch(e => {
+							this.setOrderInfo({
+								complete_count: 0, //完成
+								received_count: 0, //待收货
+								unshipped_count: 0, //待发货
+								order_count: 0, //订单总数
+								unpaid_count: 0 //待付款
+							});
+						});
+				})
+				.catch(e => {
+					console.log(e);
+				});
+		},
 	}
+};
 </script>
 
 <style lang="scss">
-page , .content{
+page,
+.content {
 	height: 100%;
 	padding: 0;
 	margin: 0;
 }
-.top{
-		border-bottom: 1rpx solid #F3F3F3;
+.top {
+	border-bottom: 1rpx solid #f3f3f3;
 }
-.box{
-	background: #FFFFFF;
+.box {
+	background: #ffffff;
 	margin: 20rpx 0 70rpx 0;
-	.item{
-		
+	.item {
 		display: flex;
 		align-items: center;
-		text{
+		text {
 			margin: 0 40rpx 0 25rpx;
 			width: 150rpx;
 			font-size: 30rpx;
@@ -51,7 +115,7 @@ page , .content{
 			color: #333333;
 			line-height: 100rpx;
 		}
-		input{
+		input {
 			font-size: 28rpx;
 			font-family: PingFang SC;
 			font-weight: 400;
@@ -59,20 +123,18 @@ page , .content{
 			line-height: 100rpx;
 		}
 	}
-
 }
-	.button{
-		text-align: center;
-		width: 560rpx;
-		height: 80rpx;
-		background: linear-gradient(0deg, #2E58FF, #32C6FF);
-		border-radius: 40rpx;
-		font-size: 30rpx;
-		font-family: PingFangSC;
-		font-weight: 500;
-		color: #FFFFFF;
-		line-height: 80rpx;
-		margin: 0 auto;
-	}
-
+.button {
+	text-align: center;
+	width: 560rpx;
+	height: 80rpx;
+	background: linear-gradient(0deg, #2e58ff, #32c6ff);
+	border-radius: 40rpx;
+	font-size: 30rpx;
+	font-family: PingFangSC;
+	font-weight: 500;
+	color: #ffffff;
+	line-height: 80rpx;
+	margin: 0 auto;
+}
 </style>

+ 7 - 1
pages/money/award.vue

@@ -35,7 +35,8 @@
 							</view>
 						</view>
 						<view class="money">
-							<text>{{ (item.pm == 0 ? '-' : '+') + item.number * 1 }}</text>
+							<view>{{ (item.pm == 0 ? '-' : '+') + item.number * 1 }}</view>
+							<view v-if="item.status == 0" class="status">待发放</view>
 						</view>
 					</view>
 					<uni-load-more :status="tabItem.loadingType"></uni-load-more>
@@ -309,8 +310,13 @@ page {
 			}
 		}
 		.money {
+			text-align: right;
 			color: #fd5b23;
 			font-size: $font-lg;
+			.status {
+				color: $font-color-light;
+				color: $font-color-light - 2rpx;
+			}
 		}
 	}
 }

+ 4 - 0
pages/user/assets.vue

@@ -87,6 +87,9 @@ export default {
 	},
 	methods: {
 		getWallet() {
+			uni.showLoading({
+				title: '加载中'
+			});
 			wallet({}).then(({ data }) => {
 				console.log(data);
 				const obj = this;
@@ -117,6 +120,7 @@ export default {
 						obj.wjb = data.back[e].money.money * 1;
 					}
 				});
+				uni.hideLoading();
 			});
 		},
 		nav(url) {

+ 4 - 0
pages/user/user.vue

@@ -200,6 +200,9 @@ export default {
 	methods: {
 		...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
 		loadBaseData() {
+			uni.showLoading({
+				title: '加载中'
+			});
 			console.log(this.userInfo);
 			getUserInfo({}).then(({ data }) => {
 				this.setUserInfo(data);
@@ -223,6 +226,7 @@ export default {
 					}
 					ar.push(data.back[e]);
 				});
+				uni.hideLoading();
 			});
 		},
 		server() {