Forráskód Böngészése

mp: 放开银行卡提现,添加手续费提示确认窗口,增加提现参数自动记忆

joe 4 éve
szülő
commit
1467e1e2ee

+ 6 - 0
view/xcx/api/user.js

@@ -133,6 +133,12 @@ export function extractBank() {
     return request.get('extract/bank');
 }
 
+/**
+ * 提现银行卡手续费
+ */
+export function extractBankFee(data) {
+    return request.post('extract/bank_fee', data)
+}
 /**
  * 活动状态
  */

+ 0 - 1
view/xcx/pages/index/index.js

@@ -641,7 +641,6 @@ Page({
 
     onPageScroll: throttle(function (obj) {
         if (this.data.activeTabIndex <= 0 || this.data.activeTabIndex > this.data.prodCates.children.length) {
-            console.log('impossiable err')
             return
         }
 

+ 96 - 34
view/xcx/pages/user_cash/index.js

@@ -2,6 +2,7 @@
 import {
     extractCash,
     extractBank,
+    extractBankFee,
     getUserInfo
 } from '../../api/user.js';
 
@@ -37,6 +38,11 @@ Page({
         array: [], //提现银行
         commissionCount: 0.00, //可提现金额
         minPrice: 0.0, // 最低提现金额
+
+        wxName: '', // 微信实名
+        bankCardNo: '', // 银行卡号
+        bankUser: '', // 银行户名
+        bankName: '', // 银行名称
         userInfo: [],
         isClone: false
     },
@@ -58,10 +64,23 @@ Page({
         extractBank().then(res => {
             var array = res.data.extractBank;
             array.unshift("请选择银行");
+
+            var idx = 0;
+            for (var i = 0; i < array.length; i++) {
+                if (array[i] == res.data.bankName) {
+                    idx = i
+                }
+            }
+
             that.setData({
                 array: array,
                 commissionCount: res.data.commissionCount,
                 minPrice: res.data.minPrice,
+                wxName: res.data.wxpayName,
+                bankCardNo: res.data.bankCardNo,
+                bankName: res.data.bankName,
+                bankUser: res.data.bankUser,
+                index: idx,
             });
         });
     },
@@ -81,7 +100,7 @@ Page({
     },
 
     swichNav: function (e) {
-        if (e.currentTarget.dataset.current != 1) {
+        if (e.currentTarget.dataset.current > 1) {
             wx.showToast({
                 title: '暂未开放',
                 image: '',
@@ -100,52 +119,95 @@ Page({
     },
 
     subCash: function (e) {
-        let that = this,
-            value = e.detail.value;
-        if (that.data.currentTab == 0) { //银行卡
+        let value = e.detail.value;
+
+        if (value.money.length == 0) {
+            return app.Tips({
+                title: '请填写提现金额'
+            });
+        }
+        if (Number(value.money) > Number(this.data.commissionCount)) {
+            return app.Tips({
+                title: '提现金额不能大于' + this.data.commissionCount
+            });
+        } else if (Number(value.money) < Number(this.data.minPrice)) {
+            return app.Tips({
+                title: '提现金额不能小于' + this.data.minPrice
+            })
+        }
+
+        if (this.data.currentTab == 0) { //银行卡
             if (value.name.length == 0) return app.Tips({
                 title: '请填写持卡人姓名'
             });
             if (value.cardnum.length == 0) return app.Tips({
                 title: '请填写卡号'
             });
-            if (that.data.index == 0) return app.Tips({
+            if (this.data.index == 0) return app.Tips({
                 title: "请选择银行"
             });
             value.extract_type = 'bank';
-            value.bankname = that.data.array[that.data.index];
-        } else if (that.data.currentTab == 1) { //微信
-            value.extract_type = 'weixin';
-            if (value.name.length == 0) return app.Tips({
-                title: '请填写微信号'
+            value.bankname = this.data.array[this.data.index];
+
+            var that = this
+            extractBankFee(value).then(res => {
+                wx.showModal({
+                    title: '银行卡提现手续费',
+                    content: '您提现' + value.money + '元,手续费为' + res.data.fee + '元,实际到帐' + res.data.valid + '元(手续费为通道费用,非美天旺收取,手续费费率为' + res.data.rate * 100 + '%,最少' + res.data.min + '元,最多' + res.data.max + '元)',
+                    showCancel: true,
+                    showConfirm: true,
+                    confirmText: '继续提现',
+                    success: (model) => {
+                        if (model.confirm) {
+                            extractCash(value).then(rs => {
+                                that.getUserInfo();
+                                return app.Tips({
+                                    title: rs.msg,
+                                    icon: 'success'
+                                });
+                            }).catch(err => {
+                                return app.Tips({
+                                    title: err
+                                });
+                            });
+                        }
+                    },
+                })
+            }).catch(err => {
+                return app.Tips({
+                    title: err
+                });
             });
-            value.weixin = value.name;
-        } else if (that.data.currentTab == 2) { //支付宝
-            value.extract_type = 'alipay';
-            if (value.name.length == 0) return app.Tips({
-                title: '请填写账号'
+        } else {
+            if (this.data.currentTab == 1) { //微信
+                value.extract_type = 'weixin';
+                if (value.name.length == 0) return app.Tips({
+                    title: '请填写微信实名'
+                });
+                value.weixin = value.name;
+            } else if (this.data.currentTab == 2) { //支付宝
+                value.extract_type = 'alipay';
+                if (value.name.length == 0) return app.Tips({
+                    title: '请填写账号'
+                });
+                value.alipay_code = value.name;
+            }
+
+            var that = this
+            extractCash(value).then(res => {
+                that.getUserInfo();
+                return app.Tips({
+                    title: res.msg,
+                    icon: 'success'
+                });
+            }).catch(err => {
+                return app.Tips({
+                    title: err
+                });
             });
-            value.alipay_code = value.name;
         }
-        if (value.money.length == 0) return app.Tips({
-            title: '请填写提现金额'
-        });
-        if (Number(value.money) > Number(that.data.commissionCount)) return app.Tips({
-            title: '提现金额不能大于' + that.data.commissionCount
-        });
-        extractCash(value).then(res => {
-            that.getUserInfo();
-            return app.Tips({
-                title: res.msg,
-                icon: 'success'
-            });
-        }).catch(err => {
-            return app.Tips({
-                title: err
-            });
-        });
     },
-    
+
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 18 - 19
view/xcx/pages/user_cash/index.wxml

@@ -11,17 +11,19 @@
         <view hidden='{{currentTab != 0}}' class='list'>
             <form bindsubmit="subCash">
                 <view class='item acea-row row-between-wrapper'>
-                    <view class='name'>持卡人</view>
-                    <view class='input'><input placeholder='请输入持卡人姓名' placeholder-class='placeholder'
-                            name="name"></input></view>
+                    <view class='name'>卡号</view>
+                    <view class='input'>
+                        <input type='number' placeholder='请填写卡号' placeholder-class='placeholder' name="cardnum" value="{{bankCardNo}}"></input>
+                    </view>
                 </view>
                 <view class='item acea-row row-between-wrapper'>
-                    <view class='name'>卡号</view>
-                    <view class='input'><input type='number' placeholder='请填写卡号' placeholder-class='placeholder'
-                            name="cardnum"></input></view>
+                    <view class='name'>户名</view>
+                    <view class='input'>
+                        <input placeholder='请输入持卡人姓名' placeholder-class='placeholder' name="name" value="{{bankUser}}"></input>
+                    </view>
                 </view>
                 <view class='item acea-row row-between-wrapper'>
-                    <view class='name'>行</view>
+                    <view class='name'>开户行</view>
                     <view class='input'>
                         <picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
                             <text class='Bank'>{{array[index]}}</text>
@@ -30,9 +32,10 @@
                     </view>
                 </view>
                 <view class='item acea-row row-between-wrapper'>
-                    <view class='name'>提现</view>
-                    <view class='input'><input placeholder='最低提现金额{{minPrice}}元' placeholder-class='placeholder'
-                            name="money" type='digit'></input></view>
+                    <view class='name'>提现金额</view>
+                    <view class='input'>
+                        <input placeholder='最低提现金额{{minPrice}}元' placeholder-class='placeholder' name="money" type='digit'></input>
+                    </view>
                 </view>
                 <view class='tip'>当前可提现金额: {{userInfo.commissionCount}}</view>
                 <button formType="submit" class='bnt bg-color'>提现</button>
@@ -41,14 +44,12 @@
         <view hidden='{{currentTab != 1}}' class='list'>
             <form bindsubmit="subCash">
                 <view class='item acea-row row-between-wrapper'>
-                    <view class='name'>微信号</view>
-                    <view class='input'><input placeholder='输入微信号,默认为登录账号' placeholder-class='placeholder'
-                            name="name"></input></view>
+                    <view class='name'>微信实名</view>
+                    <view class='input'><input placeholder='输入授权微信的认证实名' placeholder-class='placeholder' name="name" value="{{wxName}}"></input></view>
                 </view>
                 <view class='item acea-row row-between-wrapper'>
                     <view class='name'>提现金额</view>
-                    <view class='input'><input placeholder='最低提现金额{{minPrice}}元' placeholder-class='placeholder'
-                            name="money" type='digit'></input></view>
+                    <view class='input'><input placeholder='最低提现金额{{minPrice}}元' placeholder-class='placeholder' name="money" type='digit'></input></view>
                 </view>
                 <view class='tip'>当前可提现金额: {{userInfo.commissionCount}}</view>
                 <button formType="submit" class='bnt bg-color'>提现</button>
@@ -58,13 +59,11 @@
             <form bindsubmit="subCash">
                 <view class='item acea-row row-between-wrapper'>
                     <view class='name'>账号</view>
-                    <view class='input'><input placeholder='请填写您的支付宝账号' placeholder-class='placeholder'
-                            name="name"></input></view>
+                    <view class='input'><input placeholder='请填写您的支付宝账号' placeholder-class='placeholder' name="name"></input></view>
                 </view>
                 <view class='item acea-row row-between-wrapper'>
                     <view class='name'>提现</view>
-                    <view class='input'><input placeholder='最低提现金额{{minPrice}}元' placeholder-class='placeholder'
-                            name="money" type='digit'></input></view>
+                    <view class='input'><input placeholder='最低提现金额{{minPrice}}元' placeholder-class='placeholder' name="money" type='digit'></input></view>
                 </view>
                 <view class='tip'>当前可提现金额: {{userInfo.commissionCount}}</view>
                 <button formType="submit" class='bnt bg-color'>提现</button>