hejie 3 سال پیش
والد
کامیت
1db48e8033

+ 7 - 0
src/pages.json

@@ -119,6 +119,13 @@
             }
             
         }
+        ,{
+            "path" : "pages/top-up/index",
+            "style":{
+            	"navigationBarTitleText": "充值"
+            }
+            
+        }
     ],
 	"tabBar": {
 	    "color": "#505050",

+ 240 - 0
src/pages/top-up/index.vue

@@ -0,0 +1,240 @@
+<template>
+	<view class="container">
+		<view class="list flex_r flex_ac flex_jb mar_t16">
+			<view class="list_name">充值类型:</view>
+			<view class="title_select">
+				<picker @change="bindPickerChange" :value="index" :range="array">
+					<view class="flex_r flex_ac flex_je" style="width: 300rpx;">
+						<view class="select_name">{{array[index]}}</view>
+						<image style="width: 25rpx;height: 25rpx;margin-left: 15rpx;" src="/static/down.png" mode="">
+						</image>
+					</view>
+				</picker>
+			</view>
+		</view>
+		<view class="list flex_r flex_ac flex_jb mar_t16" v-if="index == 0">
+			<view class="list_name">当前余额:</view>
+			<view class="list_text flex_r flex_ac"><text>¥</text>{{detail.qxMoney}}</view>
+		</view>
+		<view class="list flex_r flex_ac flex_jb mar_t16" v-if="index == 1">
+			<view class="list_name">当前拼团金:</view>
+			<view class="list_text flex_r flex_ac"><text>¥</text>{{detail.qxMoney}}</view>
+		</view>
+		<view class="list flex_r flex_ac flex_jb mar_t16">
+			<view class="list_name">充值金额:</view>
+			<view class="list_text flex_r flex_ac">
+				<input type="text" v-model="price" placeholder="自定义金额" />
+			</view>
+		</view>
+
+		<view class="option flex_c mar_t16">
+			<view class="list_name">充值方式</view>
+			<view class="option_con flex_r flex_ac flex_jb mar_t16">
+				<view class="way_con flex_r flex_ac">
+					<image class="way_img" src="/static/weixin_icon.png" mode=""></image>
+					<view class="way_text">微信支付</view>
+				</view>
+				<view class="way_radio" :class="isSelect == 1 ? 'select_way' : ''"></view>
+			</view>
+		</view>
+
+		<view class="btn flex_r flex_ac flex_jc" @tap="confimTopUp">立即充值</view>
+	</view>
+</template>
+
+<script>
+	let app = getApp();
+	// let reqApi = new ReqApi();
+	var appEv = app.$vm.$options;
+	// var toPayOpre = new ToPayOpre();
+	// import {
+	// 	ReqApi,
+	// 	ToPayOpre
+	// } from "../../utils/reqTools.js";
+	import { get, post, u_post } from "@/request/api.js";
+	export default {
+		data() {
+			return {
+				price: '',
+				isSelect: 1,
+				detail: {},
+				array: ['余额充值', '拼团金充值'],
+				index: 0
+			};
+		},
+		onLoad: function() {
+			this.loadData()
+		},
+		methods: {
+			loadData: function() {
+				let that = this;
+				var type = Number(that.index) + 1 // 1获取余额数据  2 获取拼团金数据
+				let data = {
+					type: type
+				}
+				u_post("ShuZiTeaYW/cashWithd/clickCash", data).then((res) => {
+				  if (res.status == 200) {
+				   this.detail = res
+				    // this.BannerImg = res.list;
+				  }
+				});
+				// const info = reqApi.clickCash(data)
+				// if (info) {
+				// 	info.then(res => {
+				// 		if (res.data.status == 200) {
+				// 			that.detail = res.data
+				// 		}
+				// 	})
+				// }
+			},
+			confimTopUp: function() {
+				let that = this;
+				var type = Number(that.index) + 2 // 2 充值余额  3 充值拼团金
+				let data = {
+					type: type,
+					price: this.price
+				}
+				const info = reqApi.spellPricePayment(data)
+				if (info) {
+					info.then(res => {
+						if (res.data.status == 200) {
+							if (res.data.payParam) {
+								toPayOpre.toPay(res.data.payParam, (res) => {
+									if (!res) {
+										// 支付成功
+										appEv.errTips('支付成功')
+										that.price = '';
+										that.loadData()
+									} else {
+										// 支付失败
+										appEv.errTips('支付失败')
+										that.price = '';
+										that.loadData()
+									}
+								});
+							} else {
+								appEv.errTips('支付信息失效,请稍后重试')
+							}
+						} else {
+							appEv.errTips(res.data.msg)
+						}
+					})
+				}
+			},
+
+			bindPickerChange: function(e) {
+				this.index = e.target.value
+				this.loadData();
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	// 页面配置
+	page {
+		background: #F4F4F4;
+	}
+
+	// 页面配置-end
+
+	// 页面内容
+	.option_con {
+		width: 100%;
+		overflow: hidden;
+	}
+
+	.way_img {
+		width: 52rpx;
+		height: 52rpx;
+		margin-right: 8rpx;
+	}
+
+	.way_text {
+		font-size: 22rpx;
+		color: #333333;
+		font-family: "SourceHanSansCN-Medium";
+	}
+
+	.list_text input {
+		font-size: 28rpx;
+		color: #333333;
+		text-align: right;
+		margin-left: 20rpx;
+	}
+
+	.list {
+		width: 100%;
+		height: 86rpx;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+		background: #fff;
+	}
+
+	.list_text {
+		font-family: "SourceHanSansCN-Bold";
+		font-weight: bold;
+		font-size: 36rpx;
+		color: #17BB87;
+	}
+
+	.list_name {
+		color: #333333;
+		font-size: 28rpx;
+		font-family: "SourceHanSansCN-Medium";
+		font-weight: 500;
+	}
+
+	.option {
+		width: 100%;
+		overflow: hidden;
+		padding: 20rpx 30rpx 60rpx;
+		box-sizing: border-box;
+		background: #fff;
+	}
+
+	.list_text text {
+		font-family: "SourceHanSansCN-Medium";
+		font-size: 22rpx;
+		font-weight: 500rpx;
+		color: #17BB87;
+	}
+
+	.way_radio {
+		width: 39rpx;
+		height: 35rpx;
+		background: url("~@/static/weixuanzhong.png");
+		background-repeat: no-repeat;
+		background-size: 35rpx 35rpx;
+		background-position: center center;
+	}
+
+	.btn {
+		width: 689rpx;
+		height: 92rpx;
+		background: #17BB87;
+		color: #fff;
+		font-size: 42rpx;
+		font-family: "SourceHanSansCN-Medium";
+		font-weight: 500;
+		margin: 132rpx auto 0;
+		border-radius: 10rpx;
+	}
+
+	.select_name {
+		width: 80%;
+		text-align: end;
+		font-family: SourceHanSansCN-Medium;
+		color: #494949;
+		font-size: 28rpx;
+	}
+
+	.select_way {
+		background: url("~@/static/xuanzhong_icon.png");
+		background-repeat: no-repeat;
+		background-size: 39rpx 35rpx;
+		background-position: center center;
+	}
+
+	// 页面内容-end
+</style>

BIN
src/static/down.png


BIN
src/static/weixin_icon.png


BIN
src/static/weixuanzhong.png


BIN
src/static/weixuanzhong_icon.png


BIN
src/static/xuanzhong_icon.png