调整消费返补页面

This commit is contained in:
wangxiaowei 2024-09-02 14:24:31 +08:00
parent 72c8a25bb2
commit a1dbf2b80a
3 changed files with 186 additions and 195 deletions

@ -202,11 +202,11 @@
.subsidy-item-footer {
.wallet-btn {
background-color: #ff2c3c;
width: 50%;
width: 30%;
height: 60rpx;
line-height: 60rpx;
color: #fff;
margin: 0 25%;
margin: 0 35%;
text-align: center;
border-radius: 40rpx;
margin-top: 30rpx;

@ -1,6 +1,6 @@
<template>
<view>
<mescroll-uni ref="mescrollRef" top="770rpx" @init="mescrollInit" @down="downCallback" @up="upCallback"
<mescroll-uni ref="mescrollRef" :top="current == 0 ? '236rpx' : '770rpx'" @init="mescrollInit" @down="downCallback" @up="upCallback"
:down="downOption" :up="upOption">
<view>
<view class="subsidy-shop-item">
@ -54,6 +54,9 @@
props: {
index: {
type: Number
},
current: {
type: Number
}
},
data() {

@ -1,11 +1,40 @@
<template>
<view>
<view class="withdraw-tabs">
<u-tabs :list="tabsList" :is-scroll="true" :current="currentTab" :bold="true" height="100" font-size="30rpx"
active-color="#333333" inactive-color="#666666" :bar-style="styleTabsBarStyle" @change="changeTab" />
<!-- <u-tabs :list="tabsList" :is-scroll="true" :current="currentTab" :bold="true" height="100" font-size="30rpx"
active-color="#333333" inactive-color="#666666" :bar-style="styleTabsBarStyle" @change="changeTab" /> -->
<view class="tabs">
<u-radio-group v-model="currentTab" class="m-l-20">
<u-radio :name="0" active-color="#fb2d2d">全部</u-radio>
<u-radio :name="1" active-color="#fb2d2d">补贴提现</u-radio>
<u-radio :name="2" active-color="#fb2d2d">充值到本地余额</u-radio>
</u-radio-group>
</view>
<view class="m-b-35">
<!-- <view v-if="currentTab == 0">
<view v-if="currentTab == 1">
<view class="withdraw-money-wrap m-t-20 bg-white">
<view class="flex withdraw-money p-b-20">
<view class="flex flex-1">
<text class="font-size-46 m-r-10 normal">¥</text>
<u-input @input="setMoney" v-model="form.withdrawl_money" placeholder="0.00" :custom-style="{'font-size': '66rpx'}" />
</view>
<view class="flex-col flex-1 text-right">
<text class="xs primary" @tap="form.withdrawl_money=widthDrawConfig.able_withdraw">全部提现</text>
<text class="xs muted m-t-10">可提现金额 ¥ {{widthDrawConfig.able_withdraw ? widthDrawConfig.able_withdraw : 0}}</text>
</view>
</view>
<view class="muted xs m-t-30 rule-ele" v-if="widthDrawConfig.withdrawl_rule">
<u-parse :html="widthDrawConfig.withdrawl_rule"/>
</view>
<button class="withdraw-submit white br60 m-t-40" @tap="startPay" size="lg">确认提交</button>
<view class="text-center m-t-20">
<navigator url="/bundle_b/pages/subsidy_shop/withdrawal_record" hover-class="none">提现记录</navigator>
</view>
</view>
</view>
<view v-if="currentTab == 2">
<view class="withdraw-money-wrap m-t-20 bg-white">
<view class="flex withdraw-money p-b-20">
<view class="flex flex-1">
@ -23,34 +52,11 @@
<view class="muted xs m-t-30 rule-ele" v-if="widthDrawConfig.recharge_rule">
<u-parse :html="widthDrawConfig.recharge_rule"/>
</view>
<button class="withdraw-submit white br60 m-t-40" @tap="onSubmit" size="lg">确认提交</button>
<button class="withdraw-submit white br60 m-t-40" @tap="startPay" size="lg">确认提交</button>
<view class="text-center m-t-20">
<navigator url="/bundle_b/pages/subsidy_shop/recharge_record" hover-class="none">充值记录</navigator>
</view>
</view>
</view> -->
<!-- <view v-if="currentTab == 1"> -->
<view v-if="currentTab == 0">
<view class="withdraw-money-wrap m-t-20 bg-white">
<view class="flex withdraw-money p-b-20">
<view class="flex flex-1">
<text class="font-size-46 m-r-10 normal">¥</text>
<u-input @input="setMoney" v-model="form.withdrawl_money" placeholder="0.00" :custom-style="{'font-size': '66rpx'}" />
</view>
<view class="flex-col flex-1 text-right">
<text class="xs primary" @tap="form.withdrawl_money=widthDrawConfig.able_withdraw">全部提现</text>
<text class="xs muted m-t-10">可提现金额 ¥ {{widthDrawConfig.able_withdraw ? widthDrawConfig.able_withdraw : 0}}</text>
</view>
</view>
<view class="muted xs m-t-30 rule-ele" v-if="widthDrawConfig.withdrawl_rule">
<u-parse :html="widthDrawConfig.withdrawl_rule"/>
</view>
<button class="withdraw-submit white br60 m-t-40" @tap="onSubmit" size="lg">确认提交</button>
<view class="text-center m-t-20">
<navigator url="/bundle_b/pages/subsidy_shop/withdrawal_record" hover-class="none">提现记录</navigator>
</view>
</view>
</view>
</view>
</view>
@ -58,18 +64,18 @@
<view class="unreadBlock" style="position: relative;">
<tabs :current="active" @change="changeShow" bar-width="60" :is-scroll="false">
<tab v-for="(item, index) in order" :key="index" :name="item.name" :num="item.num">
<subsidy-list :i="index" :index="active" @changeUnreadBillions="changeUnreadBillions"></subsidy-list>
<subsidy-list :i="index" :index="active" :current="currentTab" @changeUnreadBillions="changeUnreadBillions"></subsidy-list>
</tab>
</tabs>
</view>
<!-- <pay-keyboard :show="true"></pay-keyboard> -->
<pay-keyboard :showPay="showPay" :money="payMoney" :info="payInfo" @paySuccess="onSubmit" @closeKeyboard="closeKeyboard"></pay-keyboard>
<!-- 充值成功 -->
<u-popup class="pay-popup" v-model="showPopup" closeable round mode="center">
<view class="content bg-white">
<image class="img-icon" src="https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/icon_success.png"></image>
<view class="xxl bold m-t-10">{{tipsText}}</view>
<view class="xxl bold m-t-10">{{tipsText}}</view>
<button class="br60 btn" type="primary" size="md" @tap="onShowPopup">确定</button>
</view>
</u-popup>
@ -94,12 +100,10 @@
data() {
return {
// tabsList: [
// {name: '充值到本地余额'},
// {name: '补贴提现'}
// {name: '全部'},
// {name: '补贴提现'},
// {name: '充值到本地余额'}
// ],
tabsList: [
{name: '补贴提现'}
],
currentTab: 0,
// Tabs滑块样式
styleTabsBarStyle: {
@ -126,7 +130,10 @@
},
showPopup: false,
tipsText: '',
currentTabs: 0
currentTabs: 0,
showPay: false,
payInfo: '',
payMoney: ''
};
},
onLoad(options) {
@ -138,10 +145,86 @@
uni.$off('refreshBillionsWithdrawConfigFun')
},
methods: {
// 准备支付
startPay() {
const data = { ...this.form }
if (this.currentTab == 1){
// 提现
if (!Number(data.withdrawl_money)) {
this.$toast({
title: '请输入提现金额'
});
return;
}
if (!uni.$u.test.amount(data.withdrawl_money)) {
this.$toast({
title: '提现金额格式错误'
});
return;
}
if (Number(data.withdrawl_money) < Number(this.widthDrawConfig.min_withdraw)) {
this.$toast({
title: '最小提现金额为¥' + this.widthDrawConfig.min_withdraw
});
return;
}
if (Number(data.withdrawl_money) > Number(this.widthDrawConfig.able_withdraw)) {
this.$toast({
title: '可提现金额不足'
});
return;
}
this.payMoney = data.withdrawl_money
this.payInfo = '消费返补提现 ¥' + data.withdrawl_money;
} else if(this.currentTab == 2) {
// 充值
if (!Number(data.recharge_money)) {
this.$toast({
title: '请输入充值金额'
});
return;
}
if (!uni.$u.test.amount(data.recharge_money)) {
this.$toast({
title: '充值金额格式错误'
});
return;
}
if (Number(data.recharge_money) < Number(this.widthDrawConfig.min_recharge)) {
this.$toast({
title: '最小充值金额为¥' + this.widthDrawConfig.min_recharge
});
return;
}
if (Number(data.recharge_money) > Number(this.widthDrawConfig.able_withdraw)) {
this.$toast({
title: '可充值金额不足'
});
return;
}
this.payMoney = data.recharge_money
this.payInfo = '充值 ¥' + data.recharge_money + ' 到本地余额'
}
this.showPay = true
},
changeOrderTab(index) {
this.currentTabs = index;
},
closeKeyboard() {
this.showPay = false
},
async getBillionsWithdrawConfigFun() {
const {
code,
@ -163,7 +246,6 @@
changeTab(index) {
this.currentTab = index;
uni.createSelectorQuery().in(this).select('.rule-ele').boundingClientRect(data => {
console.log('data=', data)
if (data) {
// data.height 就是元素的高度
console.log('元素的高度:', data.height);
@ -172,174 +254,72 @@
},
setMoney(value) {
if (this.currentTab == 0) {
// 充值到余额
setTimeout(() => {
this.form.recharge_money = value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');
}, 0)
} else if (this.currentTab == 1) {
if (this.currentTab == 1) {
// 补贴提现
setTimeout(() => {
this.form.withdrawl_money = value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');
}, 0)
} else if (this.currentTab == 2) {
// 充值到余额
setTimeout(() => {
this.form.recharge_money = value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');
}, 0)
}
},
async onSubmit() {
const data = {
...this.form
async onSubmit(flag) {
if (flag) {
const data = { ...this.form }
if (this.currentTab == 1){
uni.showLoading({
title: '加载中...',
mask: true
})
data.money = data.withdrawl_money
const result = await applyBillionsWithdrawl(data);
if (result.code == 1) {
uni.$emit('refreshSubsidyPage')
this.showPopup = true
this.tipsText = '已成功提现¥' + data.withdrawl_money + '至微信零钱'
}
this.form.withdrawl_money = ''
uni.hideLoading()
} else if(this.currentTab == 2) {
uni.showLoading({
title: '加载中...',
mask: true
})
data.money = data.recharge_money
const result = await rechargeBalance(data)
if (result.code == 1) {
uni.$emit('refreshSubsidyPage')
this.showPopup = true
this.tipsText = '已成功充值¥' + data.recharge_money
}
this.form.recharge_money = ''
uni.hideLoading()
}
this.showPay = false
this.getBillionsWithdrawConfigFun();
}
// if (this.currentTab == 0){
// // 充值
// if (!Number(data.recharge_money)) {
// this.$toast({
// title: '请输入充值金额'
// });
// return;
// }
// if (!uni.$u.test.amount(data.recharge_money)) {
// this.$toast({
// title: '充值金额格式错误'
// });
// return;
// }
// if (Number(data.recharge_money) < Number(this.widthDrawConfig.min_recharge)) {
// this.$toast({
// title: '最小充值金额为¥' + this.widthDrawConfig.min_recharge
// });
// return;
// }
// if (Number(data.recharge_money) > Number(this.widthDrawConfig.able_withdraw)) {
// this.$toast({
// title: '可充值金额不足'
// });
// return;
// }
// uni.showLoading({
// title: '加载中...',
// mask: true
// })
// data.money = data.recharge_money
// const result = await rechargeBalance(data)
// if (result.code == 1) {
// uni.$emit('refreshSubsidyPage')
// this.showPopup = true
// this.tipsText = '已成功充值¥' + data.recharge_money
// }
// this.form.recharge_money = ''
// uni.hideLoading()
// } else if(this.currentTab == 1) {
// // 提现
// if (!data.withdrawl_money) {
// this.$toast({
// title: '请输入提现金额'
// });
// return;
// }
// if (!uni.$u.test.amount(data.withdrawl_money)) {
// this.$toast({
// title: '提现金额格式错误'
// });
// return;
// }
// if (data.withdrawl_money < this.widthDrawConfig.min_withdraw) {
// this.$toast({
// title: '最小提现金额为¥' + this.widthDrawConfig.min_withdraw
// });
// return;
// }
// if (data.withdrawl_money > this.widthDrawConfig.able_withdraw) {
// this.$toast({
// title: '可提现金额不足'
// });
// return;
// }
// uni.showLoading({
// title: '加载中...',
// mask: true
// })
// data.money = data.withdrawl_money
// const result = await applyBillionsWithdrawl(data);
// if (result.code == 1) {
// uni.$emit('refreshSubsidyPage')
// this.showPopup = true
// this.tipsText = '已成功提现¥' + data.withdrawl_money + '至微信零钱'
// }
// this.form.withdrawl_money = ''
// uni.hideLoading()
// }
// 提现
if (!data.withdrawl_money) {
this.$toast({
title: '请输入提现金额'
});
return;
}
if (!uni.$u.test.amount(data.withdrawl_money)) {
this.$toast({
title: '提现金额格式错误'
});
return;
}
if (data.withdrawl_money < this.widthDrawConfig.min_withdraw) {
this.$toast({
title: '最小提现金额为¥' + this.widthDrawConfig.min_withdraw
});
return;
}
if (data.withdrawl_money > this.widthDrawConfig.able_withdraw) {
this.$toast({
title: '可提现金额不足'
});
return;
}
uni.showLoading({
title: '加载中...',
mask: true
})
data.money = data.withdrawl_money
const result = await applyBillionsWithdrawl(data);
if (result.code == 1) {
uni.$emit('refreshSubsidyPage')
this.showPopup = true
this.tipsText = '已成功提现¥' + data.withdrawl_money + '至微信零钱'
}
this.form.withdrawl_money = ''
uni.hideLoading()
this.getBillionsWithdrawConfigFun();
},
onShowPopup() {
this.showPopup = !this.showPopup
if (this.currentTab == 0) {
uni.navigateTo({
url: '/bundle_b/pages/subsidy_shop/recharge_record'
})
} else if(this.currentTab == 1) {
if (this.currentTab == 1) {
uni.navigateTo({
url: '/bundle_b/pages/subsidy_shop/withdrawal_record'
})
} else if(this.currentTab == 2) {
uni.navigateTo({
url: '/bundle_b/pages/subsidy_shop/recharge_record'
})
}
},
changeUnreadBillions(e) {
@ -365,6 +345,14 @@
.withdraw-tabs {
border-radius: 10px;
overflow: auto;
.tabs {
background-color: #fff;
display: flex;
align-items: center;
justify-content: flex-start;
height: 112rpx;
}
}
.withdraw-money-wrap {