|
@@ -5,16 +5,20 @@
|
|
|
<view class="title">选择充值金额</view>
|
|
|
<p>当前余额{{detail.balance}}</p>
|
|
|
<view class="rechargeMain">
|
|
|
- <view class="recharge-item" :class="moneyActiveClass == item.id ? 'active' : ''"
|
|
|
- v-for="(item,index) in moneyList" :key="item.id" @click="moneyClick(item,item.id)">
|
|
|
+ <view class="recharge-item" :class="otherNum&&moneyActiveClass == item.id ? 'active' : ''"
|
|
|
+ v-for="(item,index) in moneyList" :key="item.id" @click="moneyClick(item.id,item)">
|
|
|
{{item.rechargeAmount}}
|
|
|
<view class="amount">赠20元</view>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
<p>其他充值金额</p>
|
|
|
- <view class="recharge-input">
|
|
|
- <u-input v-model="value1" type="text" :border="true" />
|
|
|
+ <view
|
|
|
+
|
|
|
+ @click="moneyClick(-1)"
|
|
|
+ :class="!otherNum&&moneyActiveClass == -1? 'active' : ''"
|
|
|
+ class="recharge-input self-stop">
|
|
|
+ <u-input v-model="otherNum" @input="ckInput" type="text" :border="true" />
|
|
|
</view>
|
|
|
<view class="title">选择支付方式</view>
|
|
|
<view class="recharge-radio">
|
|
@@ -52,6 +56,7 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ selectItem:{},
|
|
|
userId: '',
|
|
|
detail: {},
|
|
|
moneyActiveClass: 1,
|
|
@@ -71,6 +76,7 @@
|
|
|
],
|
|
|
// u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
|
|
|
value2: '微信支付',
|
|
|
+ otherNum:"",
|
|
|
value1: '',
|
|
|
checked: true,
|
|
|
}
|
|
@@ -83,6 +89,31 @@
|
|
|
this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ckInput(text){
|
|
|
+ if(text.indexOf('.')>0){
|
|
|
+
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.otherNum=text.substring(0,text.indexOf('.'))
|
|
|
+ uni.showToast({
|
|
|
+ title:"请输入正整数"
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ var t =Number(text);
|
|
|
+ if(t<1){
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.otherNum='';
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ if(t>500){
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.otherNum=500;
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
submit() {
|
|
|
uni.showLoading({
|
|
|
title: "加载中",
|
|
@@ -144,6 +175,7 @@
|
|
|
if (this.moneyList.length > 0) {
|
|
|
this.selectItem = this.moneyList[0];
|
|
|
this.moneyActiveClass = this.moneyList[0].id
|
|
|
+ console.log(this.moneyActiveClass)
|
|
|
|
|
|
}
|
|
|
uni.hideLoading()
|
|
@@ -155,9 +187,10 @@
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- moneyClick(item, index) {
|
|
|
+ moneyClick(index,item) {
|
|
|
this.moneyActiveClass = index;
|
|
|
- this.selectItem = item
|
|
|
+ this.selectItem=item;
|
|
|
+
|
|
|
},
|
|
|
// 选中某个单选框时,由radio时触发
|
|
|
radioChange(e) {
|
|
@@ -171,9 +204,18 @@
|
|
|
this.checked = !this.checked;
|
|
|
},
|
|
|
rechargeNow() {
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/user/finance/rechargeRes'
|
|
|
- })
|
|
|
+ if(this.moneyActiveClass==-1&&!this.otherNum){
|
|
|
+ this.submitForm.chargeStrategy=0;
|
|
|
+ this.submitForm.amount=0
|
|
|
+ }else{
|
|
|
+ this.submitForm.chargeStrategy=2;
|
|
|
+ if(this.otherNum){
|
|
|
+ this.submitForm.amount=this.otherNum
|
|
|
+ }else{
|
|
|
+ this.submitForm.amount=this.moneyActiveClass
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(this.submitForm)
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
@@ -214,7 +256,13 @@
|
|
|
color: #666;
|
|
|
margin-top: 4px;
|
|
|
}
|
|
|
-
|
|
|
+ .self-stop.active{
|
|
|
+
|
|
|
+ background-color: #EFFFF7;
|
|
|
+ border-color: #00B962;
|
|
|
+ color: #00B962;
|
|
|
+
|
|
|
+ }
|
|
|
.rechargeMain {
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|