myWall.vue 4.1 KB
<template>
	<view v-if="showMyWall">
		<view class="moneyWrap">
			<view class="money">
				<view class="moneyNum">
					¥<text>{{myMoney.Money}}</text>
				</view>
				<view class="moneyBal">
					钱包余额
				</view>
				<view class="moneyHandle">
					<text @click="href('moneyDetail')">收益明细</text>
					|
					<text @click="href('moneyRecord')">提现记录</text>
				</view>
			</view>	
		</view>
		
		<view class="moneyHadleWrap">
			<view class="titleDesc">
				<view class="titleLabel"></view>
				提现
			</view>
			<view class="moneyInput">
				<input type="number" @input="validateNumber" v-model="money" placeholder="请输入金额"/>
			</view>
			<view class="titleDesc">
				<view class="titleLabel"></view>
				规则说明
			</view>
			<view class="desc">
				<parse :content="myMoney.Content" :imageProp="{'domain':'www.mall.com'}"></parse>
			</view>
		</view>
		<view style="height: 160rpx;"></view>
		<view class="bottomWrap">
			<view class="confirmBtn" @click="confirm">
				确认提现
			</view>
		</view>
		
	</view>
</template>

<script>
	import parse from '../../components/gaoyia-parse/parse.vue'
	export default{
		data(){
			return{
				money:'',
				myMoney:{},
				showMyWall:false
			}
		},
		components:{
			parse
		},
		onShow() {
			this.getData()
		},
		methods:{
			confirm(){
				if(this.money == ''){
					uni.showToast({
						title:'请输入提现金额',
						icon:'none'
					})
					return
				}
				if(this.money > this.myMoney.Money){
					uni.showToast({
						title:'体现金额高于钱包余额',
						icon:'none'
					})
					return
				}
				if(this.money < this.myMoney.SmallMoney){
					uni.showToast({
						title:'体现金额低于最少提现金额',
						icon:'none'
					})
					return
				}
				this.$request('/api/Config/OutMoney',{money:this.money},2).then((res)=>{
					if(res.code == 1){
						this.getData()
						setTimeout(()=>{
							uni.showToast({
								title:'提现成功'
							})
						},1000)
					}
					
					
					
				})
			},
			validateNumber(e){
				let val = e.detail.value
				val = val.replace(/[^\d.]/g, "");  //清除“数字”和“.”以外的字符
				val = val.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
				val = val.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
				val = val.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');//只能输入两个小数
				if (val.indexOf(".") < 0 && val != "") {//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
					val = parseFloat(val);
				}
				//重新赋值给input
				this.$nextTick(() => {
					this.money= val
				})
			},
			getData(){
				this.$request('/api/Config/MyMoneyBad').then((res)=>{
					this.myMoney = res.data
					this.showMyWall = true
				})
			},
			href(url){
				this.$href(url)
			}
		}
	}
</script>

<style>
	.moneyWrap{width: 100%;height: 356rpx;background: url(../../static/image/Frame-150@2x.png) no-repeat;background-size: 100% 356rpx;display: flex;justify-content: center;align-items: center;color: #fff;text-align: center;}
	.moneyWrap .money{width: 306rpx;}
	.moneyNum text{font-size: 72rpx;}
	.moneyBal{font-size: 28rpx;}
	.moneyHandle{font-size: 28rpx;display: flex;align-items: center;justify-content: space-between;margin-top: 32rpx;}
	
	.moneyHadleWrap{padding: 32rpx;}
	.titleDesc{display: flex;align-items: center;font-size: 28rpx;}
	.titleLabel{
		height: 32rpx;
		width: 8rpx;
		border-radius: 2px;
		background-image: linear-gradient(to top, #fff , #491716);
		margin-right: 10rpx;
	}
	.moneyInput{border: 1px solid #C8C9CC;border-radius: 14rpx;width: 100%;height: 96rpx;display: flex;align-items: center;margin: 10rpx 0;}
	.moneyInput input{width: 100%;margin-left: 10rpx;font-size: 28rpx;}
	.desc{color: #646566;font-size: 28rpx;line-height: 44rpx;margin-top: 10rpx;WORD-WRAP:break-word;TABLE-LAYOUT:fixed;word-break:break-all;}
	
	.bottomWrap{width: 100%;height: 160rpx;position: fixed;bottom: 0;background: #fff;z-index: 9;display: flex;justify-content: center;align-items: center;}
	.confirmBtn{background: #894746;border-radius: 4px;color: #fff;font-size: 32rpx;text-align: center;line-height: 80rpx;height: 80rpx;width: 686rpx;}
</style>