| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- var app = new Vue({
- el: '#app',
- data: {
- submitting: false,
- // 详情
- info: {},
- payType: 1,
- // 提交参数
- params: {
- money: '',
- account: '',
- realname: '',
- mobile: '',
- bank: '',
- bankname: '',
- },
- },
- created: function () {
- this.getInfo();
- },
- updated: function () {
- $(".weui-money").blur(function () {
- var money = $.trim($(this).val());
- var patt = /^(\d+\.\d{1,2}|\d+)$/gi;
- if (!patt.test(money)) {
- money = !isNaN(parseFloat(money)) ? moneyFormat(parseFloat(money), 2) : '0.00';
- }
- $(this).val(money);
- })
- },
- methods: {
- // 获取用户信息
- getInfo: function () {
- var _this = this;
- var id = getParam('id');
- $.post('/weixin/member/getMemberInfo', {id: id}, function (res) {
- if (res.code == 'success') {
- _this.info = res.data
- } else if (res.code == 'login') {
- login(res.data.url);
- } else if(res.code == 'exception'){
- showAlert(res.message);
- } else {
- $.toast(res.message, 'text');
- }
- }, "json");
- },
- // 提交
- doSubmit: function () {
- var _this = this;
- if (_this.submitting) {
- return false;
- }
- if (_this.params.money <= 0 || _this.params.money == null) {
- $.toast('请输入提现金额', 'text');
- return false;
- }
- if (_this.params.realname == '' || _this.params.realname == null) {
- $.toast('请填写收款人姓名', 'text');
- return false;
- }
- if (_this.params.mobile == '' || _this.params.mobile == null) {
- $.toast('请填写收款人电话', 'text');
- return false;
- }
- if (this.payType == 1) {
- if (_this.params.account == '' || _this.params.account == null) {
- $.toast('请填写收款微信号', 'text');
- return false;
- }
- } else {
- if (_this.params.bank == '' || _this.params.bank == null) {
- $.toast('请填写开户行', 'text');
- return false;
- }
- if (_this.params.account == '' || _this.params.account == null) {
- $.toast('请填写银行卡号', 'text');
- return false;
- }
- if (_this.params.bankname == '' || _this.params.bankname == null) {
- $.toast('请填写开户人姓名', 'text');
- return false;
- }
- }
- if (confirm('确认申请提现?')) {
- $.showLoading('数据提交中...');
- _this.params.payType = _this.payType;
- $.post('/weixin/member/doWidthdraw', _this.params, function (res) {
- $.hideLoading();
- if (res.code == 'success') {
- $.toast('提现申请成功,请耐心等候审核...');
- setTimeout(function () {
- _this.params = {
- money: '',
- account: '',
- realname: '',
- mobile: '',
- bank: '',
- bankname: '',
- };
- _this.getInfo();
- }, 500)
- } else if (res.code == 'login') {
- login(res.data.url);
- } else {
- $.toast(res.message, 'text');
- }
- }, 'json');
- }
- }
- }
- });
|