lhl преди 3 години
родител
ревизия
be8f450c80
променени са 4 файла, в които са добавени 389 реда и са изтрити 203 реда
  1. 1 1
      pages.json
  2. 375 197
      pages/money/recharge.vue
  3. 12 4
      pages/money/wallet.vue
  4. 1 1
      pages/user/user.vue

+ 1 - 1
pages.json

@@ -437,7 +437,7 @@
 		{
 			"path": "pages/money/recharge",
 			"style": {
-				"navigationBarTitleText": "充值"
+				"navigationBarTitleText": "充值中心"
 			}
 		},
 		{

+ 375 - 197
pages/money/recharge.vue

@@ -1,10 +1,27 @@
 <template>
 	<view class="content">
+		<view class="now">
+			<view>当前余额:</view>
+			<view class="now-money">¥300</view>
+		</view>
+		<view class="add-wrapper">
+			<view class="add-box">
+				<view class="add-log">¥</view>
+				<input type="number" v-model="money" placeholder="请输入充值金额" placeholder-class="place"
+					@keyup="clearNoNum()" />
+			</view>
+			<view class="jg" style="height: 1px; background-color: #E6E6E6;"></view>
+			<view class="add-tags">
+				<view class="tag" v-for="(item,index) in addTags" :key="item" @click="tagClick(index)"
+					:class="{'action':currentIndex === index && money == addTags[index]}"><text>{{item}}</text>元</view>
+			</view>
+		</view>
 		<view class="row-box">
 			<view class="title">充值金额</view>
 			<view class="row">
 				<text class="tit">¥</text>
-				<input class="input" type="number" v-model="money" placeholder="请输入充值金额" placeholder-class="placeholder" />
+				<input class="input" type="number" v-model="money" placeholder="请输入充值金额"
+					placeholder-class="placeholder" />
 			</view>
 		</view>
 
@@ -17,7 +34,9 @@
 						<view class="title-box">
 							<view class="title"><text>支付宝充值</text></view>
 						</view>
-						<view class="right"><radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" /></view>
+						<view class="right">
+							<radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" />
+						</view>
 					</view>
 				</label>
 				<label>
@@ -27,238 +46,397 @@
 							<view class="title"><text>微信充值</text></view>
 							<view class="node"><text>真实姓名(代勇明)</text></view>
 						</view>
-						<view class="right"><radio value="weixin" color=" #5dbc7c" :checked="type == 'weixin'" /></view>
+						<view class="right">
+							<radio value="weixin" color=" #5dbc7c" :checked="type == 'weixin'" />
+						</view>
 					</view>
 				</label>
 				<!-- #endif -->
 			</radio-group>
 		</view>
-		<button class="add-btn up" :class="{ 'active-bg': payLoding }" @click="!payLoding ? confirm() : ''">确认充值</button>
+		<button class="add-btn up" :class="{ 'active-bg': payLoding }"
+			@click="!payLoding ? confirm() : ''">确认充值</button>
 	</view>
 </template>
 
 <script>
-import { getMoneyStyle } from '@/utils/rocessor.js';
-// #ifdef H5
-import { rechargeWechat } from '@/api/wallet.js';
-// #endif
-// #ifdef MP
-import { rechargeRoutine } from '@/api/wallet.js';
-// #endif
-import { mapState } from 'vuex';
-export default {
-	filters: {
+	import {
 		getMoneyStyle
-	},
-	data() {
-		return {
-			type: 'weixin',
-			money: '', //充值金额
-			payLoding: false //是否加载中
-		};
-	},
-	onLoad(options) {},
-	computed: {
-		// #ifdef H5
-		...mapState(['weichatObj'])
-		// #endif
-	},
-	methods: {
-		// 跳转
-		navTo(url) {
-			uni.navigateTo({
-				url: url
-			});
+	} from '@/utils/rocessor.js';
+	// #ifdef H5
+	import {
+		rechargeWechat
+	} from '@/api/wallet.js';
+	// #endif
+	// #ifdef MP
+	import {
+		rechargeRoutine
+	} from '@/api/wallet.js';
+	// #endif
+	import {
+		mapState
+	} from 'vuex';
+	export default {
+		filters: {
+			getMoneyStyle
 		},
-		// 切换选中对象
-		tabRadio(e) {
-			this.type = e;
+		data() {
+			return {
+				type: 'weixin',
+				money: '', //充值金额
+				payLoding: false, //是否加载中
+				addTags: [300, 200, 150, 100, 50],
+				currentIndex: 0,
+				addMoney: 0
+			};
 		},
-		// 提交
-		confirm() {
-			let obj = this;
-			obj.payLoding = true;
+		onLoad(options) {},
+		computed: {
 			// #ifdef H5
-			rechargeWechat({ price: this.money, from: this.type })
-				.then(e => {
-					let da = e.data.data;
-					obj.weichatObj.chooseWXPay({
-						timestamp: da.timestamp,
-						nonceStr: da.nonceStr,
-						package: da.package,
-						signType: da.signType,
-						paySign: da.paySign,
-						success: function(res) {
-							uni.showToast({
-								title: '充值成功',
-								duration: 2000,
-								position: 'top'
-							});
-						}
-					});
-					obj.payLoding = false;
-				})
-				.catch(e => {
-					obj.payLoding = false;
-					console.log(e);
-				});
-			// #endif
-			// #ifdef MP
-			rechargeRoutine({ price: this.money})
-				.then(e => {
-					let da = e.data;
-						wx.requestPayment({
-								timeStamp: da.timestamp,
-								nonceStr: da.nonceStr,
-								package: da.package,
-								signType: da.signType,
-								paySign: da.paySign,
-								success: function(res) {
-									uni.redirectTo({
-										url: '/pages/money/paySuccess'
-									});
-								},
-								
-							})
-					
-					obj.payLoding = false;
-				})
-				.catch(e => {
-					obj.payLoding = false;
-					console.log(e);
-				});
+			...mapState(['weichatObj'])
 			// #endif
 		},
-		//获取订单列表
-		loadData(source) {
-			console.log(source);
-			//这里是将订单挂载到tab列表下
-			let index = this.tabCurrentIndex;
-			let navItem = this.navList[index];
-			let state = navItem.state;
-			if (source === 'tabChange' && navItem.loaded === true) {
-				//tab切换只有第一次需要加载数据
-				return;
-			}
-			if (navItem.loadingType === 'loading') {
-				//防止重复加载
-				return;
-			}
-			navItem.loadingType = 'loading';
-			setTimeout(() => {
-				let orderList = [];
-				orderList.forEach(item => {
-					navItem.orderList.push(item);
+		methods: {
+			// 跳转
+			navTo(url) {
+				uni.navigateTo({
+					url: url
 				});
-				//loaded新字段用于表示数据加载完毕,如果为空可以显示空白页
-				this.$set(navItem, 'loaded', true);
-				//判断是否还有数据, 有改为 more, 没有改为noMore
-				navItem.loadingType = 'more';
-			}, 600);
+			},
+			// 切换选中对象
+			tabRadio(e) {
+				this.type = e;
+			},
+			// 提交
+			confirm() {
+				let obj = this;
+				obj.payLoding = true;
+				// #ifdef H5
+				rechargeWechat({
+						price: this.money,
+						from: this.type
+					})
+					.then(e => {
+						let da = e.data.data;
+						obj.weichatObj.chooseWXPay({
+							timestamp: da.timestamp,
+							nonceStr: da.nonceStr,
+							package: da.package,
+							signType: da.signType,
+							paySign: da.paySign,
+							success: function(res) {
+								uni.showToast({
+									title: '充值成功',
+									duration: 2000,
+									position: 'top'
+								});
+							}
+						});
+						obj.payLoding = false;
+					})
+					.catch(e => {
+						obj.payLoding = false;
+						console.log(e);
+					});
+				// #endif
+				// #ifdef MP
+				rechargeRoutine({
+						price: this.money
+					})
+					.then(e => {
+						let da = e.data;
+						wx.requestPayment({
+							timeStamp: da.timestamp,
+							nonceStr: da.nonceStr,
+							package: da.package,
+							signType: da.signType,
+							paySign: da.paySign,
+							success: function(res) {
+								uni.redirectTo({
+									url: '/pages/money/paySuccess'
+								});
+							},
+
+						})
+
+						obj.payLoding = false;
+					})
+					.catch(e => {
+						obj.payLoding = false;
+						console.log(e);
+					});
+				// #endif
+			},
+			//获取订单列表
+			loadData(source) {
+				console.log(source);
+				//这里是将订单挂载到tab列表下
+				let index = this.tabCurrentIndex;
+				let navItem = this.navList[index];
+				let state = navItem.state;
+				if (source === 'tabChange' && navItem.loaded === true) {
+					//tab切换只有第一次需要加载数据
+					return;
+				}
+				if (navItem.loadingType === 'loading') {
+					//防止重复加载
+					return;
+				}
+				navItem.loadingType = 'loading';
+				setTimeout(() => {
+					let orderList = [];
+					orderList.forEach(item => {
+						navItem.orderList.push(item);
+					});
+					//loaded新字段用于表示数据加载完毕,如果为空可以显示空白页
+					this.$set(navItem, 'loaded', true);
+					//判断是否还有数据, 有改为 more, 没有改为noMore
+					navItem.loadingType = 'more';
+				}, 600);
+			},
+			tagClick(index) {
+				this.currentIndex = index
+				this.money = this.addTags[index]
+
+			},
+			clearNoNum() {
+				this.money = this.money.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
+				switch (this.money) {
+					case '300':
+						this.currentIndex = 0
+						break;
+					case '200':
+						this.currentIndex = 1
+						break;
+					case '150':
+						this.currentIndex = 2
+						break;
+					case '100':
+						this.currentIndex = 3
+						break;
+					case '50':
+						this.currentIndex = 4
+						break;
+				}
+			}
 		}
-	}
-};
+	};
 </script>
 
 <style lang="scss">
-page {
-	height: 100%;
-}
-
-.add-btn {
-	&.modified {
-		color: $base-color;
-	}
-	&.up {
-		background-color: $base-color;
-		color: #fff;
+	page {
+		height: 100%;
 	}
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	width: 690rpx;
-	height: 80rpx;
-	margin: 0 auto;
-	margin-top: 30rpx;
-	font-size: $font-lg;
-	border-radius: 10rpx;
-	// box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
-}
-.row-box {
-	margin-top: 30rpx;
-	padding: 20rpx 30rpx;
-	background: #fff;
-	.title {
-		font-size: $font-base + 2rpx;
-		color: $font-color-dark;
-	}
-	.row {
+
+	.add-btn {
+		&.modified {
+			color: $base-color;
+		}
+
+		&.up {
+			background-color: $base-color;
+			color: #fff;
+		}
+
 		display: flex;
 		align-items: center;
-		position: relative;
+		justify-content: center;
+		width: 690rpx;
 		height: 80rpx;
-		.tit {
-			flex-shrink: 0;
-			width: 40rpx;
-			font-size: 30rpx;
+		margin: 0 auto;
+		margin-top: 30rpx;
+		font-size: $font-lg;
+		border-radius: 10rpx;
+		// box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
+	}
+
+	.row-box {
+		margin-top: 30rpx;
+		padding: 20rpx 30rpx;
+		background: #fff;
+
+		.title {
+			font-size: $font-base + 2rpx;
 			color: $font-color-dark;
 		}
-		.input {
-			flex: 1;
-			font-size: 30rpx;
-			color: $font-color-dark;
+
+		.row {
+			display: flex;
+			align-items: center;
+			position: relative;
+			height: 80rpx;
+
+			.tit {
+				flex-shrink: 0;
+				width: 40rpx;
+				font-size: 30rpx;
+				color: $font-color-dark;
+			}
+
+			.input {
+				flex: 1;
+				font-size: 30rpx;
+				color: $font-color-dark;
+			}
+
+			.iconlocation {
+				font-size: 36rpx;
+				color: $font-color-light;
+			}
+
+			.buttom {
+				color: $font-color;
+				font-size: $font-base;
+			}
 		}
-		.iconlocation {
-			font-size: 36rpx;
-			color: $font-color-light;
+	}
+
+	.list {
+		padding-left: 30rpx;
+		margin-top: 30rpx;
+		background-color: #ffffff;
+
+		.box {
+			display: flex;
+			align-items: center;
+			width: 100%;
+			height: 120rpx;
+			border-bottom: 1px solid $border-color-light;
+
+			.icon {
+				font-size: 48rpx;
+				padding-right: 20rpx;
+			}
+
+			.iconweixin1 {
+				color: #18bf16;
+			}
+
+			.iconzhifubao {
+				color: #08aaec;
+			}
+
+			.title-box {
+				flex-grow: 1;
+				text-align: left;
+
+				.title {
+					font-size: $font-base + 2rpx;
+					color: $font-color-base;
+				}
+
+				.node {
+					font-size: $font-sm;
+					color: $font-color-light;
+				}
+			}
 		}
+	}
 
-		.buttom {
-			color: $font-color;
-			font-size: $font-base;
+	/deep/ .uni-radio-input {
+		width: 45rpx;
+		height: 45rpx;
+	}
+
+	.active-bg {
+		background-color: $color-gray !important;
+	}
+
+	.now {
+		width: 100%;
+		height: 86rpx;
+		padding: 0 26rpx 0 47rpx;
+		display: flex;
+		justify-content: space-between;
+		line-height: 86rpx;
+		background-color: #fff;
+		margin-bottom: 21rpx;
+
+		view {
+			font-size: 28rpx;
+			font-weight: 500;
+			color: #333333;
+		}
+
+		.now-money {
+			font-size: 32rpx;
+			font-weight: bold;
+			color: #901B21;
 		}
 	}
-}
-.list {
-	padding-left: 30rpx;
-	margin-top: 30rpx;
-	background-color: #ffffff;
-	.box {
+
+	.add-wrapper {
+		width: 750rpx;
+		height: 338rpx;
+		padding-left: 30rpx;
+		background: #FFFFFF;
 		display: flex;
+		flex-direction: column;
 		align-items: center;
-		width: 100%;
-		height: 120rpx;
-		border-bottom: 1px solid $border-color-light;
-		.icon {
-			font-size: 48rpx;
-			padding-right: 20rpx;
-		}
-		.iconweixin1 {
-			color: #18bf16;
+
+		.add-box {
+			width: 100%;
+			height: 103rpx;
+			display: flex;
+			flex-direction: row;
+			justify-content: space-between;
+			padding: 0 39rpx 0 10rpx;
+			align-items: center;
+
+			.add-log {
+				font-size: 37rpx;
+				font-weight: bold;
+			}
+
+			input {
+				width: 218rpx;
+				height: 30rpx;
+				font-size: 32rpx;
+				font-weight: 500;
+				color: #000;
+				line-height: 40px;
+				text-align: right;
+
+				.place {
+					color: #BFBFBF;
+				}
+			}
 		}
-		.iconzhifubao {
-			color: #08aaec;
+
+		.jg {
+			width: 100%;
 		}
-		.title-box {
-			flex-grow: 1;
-			text-align: left;
-			.title {
-				font-size: $font-base + 2rpx;
-				color: $font-color-base;
+
+		.add-tags {
+			height: 234rpx;
+			padding-top: 47rpx;
+			padding-bottom: 17rpx;
+			display: flex;
+			flex-direction: row;
+			flex-wrap: wrap;
+
+			// justify-content: space-between;
+			.tag {
+				width: 210rpx;
+				height: 70rpx;
+				background-color: #F0F0F0;
+				border-radius: 4rpx;
+				margin: 0 30rpx 30rpx 0;
+				text-align: center;
+				line-height: 70rpx;
+				font-size: 22rpx;
+
+				text {
+					font-size: 32rpx;
+					font-weight: 500;
+				}
 			}
-			.node {
-				font-size: $font-sm;
-				color: $font-color-light;
+
+			.action {
+				color: #fff;
+				background-color: #901b21;
 			}
 		}
+
 	}
-}
-/deep/ .uni-radio-input {
-	width: 45rpx;
-	height: 45rpx;
-}
-
-.active-bg {
-	background-color: $color-gray !important;
-}
 </style>

+ 12 - 4
pages/money/wallet.vue

@@ -242,13 +242,14 @@ page {
 	}
 }
 .money-box {
-	background-color: $base-color;
-	padding-top: var(--status-bar-height);
+	// background-color: $base-color;
+	// padding-top: var(--status-bar-height);
 	height: 368rpx;
 	color: #ffffff;
 	text-align: center;
 	background-image: url(../../static/img/wallertbg.png);
 	background-size: 100% 100%;
+	margin-top: -1rpx;
 	.text {
 		padding-top: 147rpx;
 		font-size: $font-sm;
@@ -282,7 +283,7 @@ page {
 		align-items: center;
 		height: 100%;
 		font-size: 15px;
-		color: $font-color-dark;
+		color: #999999;
 		position: relative;
 		&.current {
 			color: $base-color;
@@ -343,9 +344,16 @@ page {
 	}
 }
 .add-btn {
+	position: fixed;
+	bottom: 51rpx;
+	right: 39rpx;
 	width: 674rpx;
 	height: 88rpx;
-	background: #FF383E;
+	background: #901B21;
 	border-radius: 44rpx;
+	color: #fff;
+	text-align: center;
+	line-height: 88rpx;
+	font-size: 34rpx;
 }
 </style>

+ 1 - 1
pages/user/user.vue

@@ -72,7 +72,7 @@
 					<view class="tj-item" @click="navTo('/pages/user/award')">
 						<text>我的推广</text>
 						<!-- <text>我的佣金</text> -->
-						<text class="num">{{ userInfo.brokerage_price || '0.00' }}</text>
+						<text class="num">{{ userInfo.brokerage_price || '0' }}</text>
 					</view>
 				</view>
 			</view>