You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
7.0 KiB
HTML
170 lines
7.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<!-- import CSS -->
|
|
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
|
<title>充值</title>
|
|
</head>
|
|
<body>
|
|
<div id="app">
|
|
<el-container>
|
|
<el-header style="text-align: center;">充值</el-header>
|
|
<el-main>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form ref="form" :model="form" label-width="80px">
|
|
<el-form-item label="姓名">
|
|
<el-input v-model="form.name"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="手机号">
|
|
<el-input v-model="form.mobile"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="身份证号">
|
|
<el-input v-model="form.cardNo"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="银行卡号">
|
|
<el-input v-model="form.bankCardNo"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="充值金额">
|
|
<el-input-number v-model="form.amount" :min="1" :max="100000" label="充值金额"></el-input-number>
|
|
</el-form-item>
|
|
<el-form-item label="备注">
|
|
<el-input type="textarea" v-model="form.remark"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="recharge">立即充值</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-col>
|
|
</el-row>
|
|
</el-main>
|
|
</el-container>
|
|
<el-dialog title="绑卡验证码" :visible.sync="bindConfirmVisible" width="30%">
|
|
<el-form :model="bindConfirmForm" label-width="80px">
|
|
<el-form-item label="验证码">
|
|
<el-input v-model="bindConfirmForm.smsCode" autocomplete="off"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="bindConfirmVisible = false">取 消</el-button>
|
|
<el-button type="primary" @click="bindConfirm">确 定</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
<el-dialog title="支付验证码" :visible.sync="payConfirmVisible" width="30%">
|
|
<el-form :model="payConfirmForm" label-width="80px">
|
|
<el-form-item label="验证码">
|
|
<el-input v-model="payConfirmForm.smsCode" autocomplete="off"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="payConfirmVisible = false">取 消</el-button>
|
|
<el-button type="primary" @click="payConfirm">确 定</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</body>
|
|
<!-- import Vue before Element -->
|
|
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
|
|
<!-- import JavaScript -->
|
|
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
|
<script src="https://unpkg.com/axios@1.1.2/dist/axios.min.js"></script>
|
|
<script>
|
|
new Vue({
|
|
el: '#app',
|
|
data() {
|
|
return {
|
|
bindConfirmVisible: false,
|
|
bindConfirmForm: {
|
|
smsCode: '',
|
|
smsNo: '',
|
|
memberId: ''
|
|
},
|
|
payConfirmVisible: false,
|
|
payConfirmForm: {
|
|
smsCode: '',
|
|
memberId: '',
|
|
token: '',
|
|
protocol: ''
|
|
},
|
|
form: {
|
|
name: '',
|
|
mobile: '',
|
|
cardNo: '',
|
|
bankCardNo: '',
|
|
amount: 1,
|
|
remark: ''
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
recharge() {
|
|
axios.post('/recharge/recharge', this.form)
|
|
.then( (response) => {
|
|
console.log(response);
|
|
let result = response.data
|
|
if (result.code != 1000) {
|
|
return this.$message.error(response.data.message);
|
|
}
|
|
if (result.data.nextStep == 'confirm-bind') {
|
|
this.bindConfirmVisible = true;
|
|
this.bindConfirmForm.memberId = result.data.memberId;
|
|
this.bindConfirmForm.smsNo = result.data.bizData.smsNo;
|
|
console.log(this.bindConfirmForm)
|
|
} else if (result.data.nextStep == 'confirm-pay') {
|
|
this.payConfirmVisible = true;
|
|
this.payConfirmForm.memberId = result.data.memberId;
|
|
this.payConfirmForm.protocol = result.data.bizData.protocol;
|
|
this.payConfirmForm.token = result.data.bizData.token;
|
|
console.log(this.payConfirmForm)
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
this.$message.error('请求错误');
|
|
console.log(error);
|
|
});
|
|
console.log('submit!');
|
|
},
|
|
bindConfirm() {
|
|
axios.post('/recharge/confirm-bind-card', this.bindConfirmForm)
|
|
.then( (response) => {
|
|
console.log(response);
|
|
let result = response.data
|
|
if (result.code != 1000) {
|
|
return this.$message.error(response.data.message);
|
|
}
|
|
this.bindConfirmVisible = false;
|
|
this.recharge();
|
|
})
|
|
.catch((error) => {
|
|
this.$message.error('请求错误');
|
|
console.log(error);
|
|
});
|
|
console.log('submit!');
|
|
},
|
|
payConfirm() {
|
|
axios.post('/recharge/confirm-pay', this.payConfirmForm)
|
|
.then( (response) => {
|
|
console.log(response);
|
|
let result = response.data
|
|
if (result.code != 1000) {
|
|
return this.$message.error(response.data.message);
|
|
}
|
|
this.payConfirmVisible = false;
|
|
this.$message.success('支付成功');
|
|
this.$alert('请记住您的订单号:' + result.data.bizData.outTradeNo , '支付成功', {
|
|
confirmButtonText: '确定',
|
|
callback: action => {
|
|
}
|
|
});
|
|
})
|
|
.catch((error) => {
|
|
this.$message.error('请求错误');
|
|
console.log(error);
|
|
});
|
|
console.log('submit!');
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
</html> |