Przeglądaj źródła

add:增加提现前确认,提现后确认并跳转上一页

joe 4 lat temu
rodzic
commit
5d9c38a302
1 zmienionych plików z 71 dodań i 20 usunięć
  1. 71 20
      view/xcx/pages/user_cash/index.js

+ 71 - 20
view/xcx/pages/user_cash/index.js

@@ -7,6 +7,11 @@ import {
 } from '../../api/user.js';
 } from '../../api/user.js';
 
 
 const app = getApp();
 const app = getApp();
+const CASH_CHANNELS = {
+    'weixin': '微信',
+    'bank': '银行卡',
+    'alipay': '支付宝',
+}
 
 
 Page({
 Page({
     /**
     /**
@@ -152,8 +157,12 @@ Page({
             var that = this
             var that = this
             extractBankFee(value).then(res => {
             extractBankFee(value).then(res => {
                 wx.showModal({
                 wx.showModal({
-                    title: '银行卡提现手续费',
-                    content: '您提现' + value.money + '元,手续费为' + res.data.fee + '元,实际到帐' + res.data.valid + '元(手续费为通道费用,非美天旺收取,手续费费率为' + res.data.rate * 100 + '%,最少' + res.data.min + '元,最多' + res.data.max + '元)',
+                    title: '提现确认(含手续费)',
+                    content: '银行卡提现:' + value.money + ' 元\n' 
+                    + '收款人: ' + value.name + '\n'
+                    + '手续费: ' + res.data.fee + ' 元\n' 
+                    + '实际到帐: ' + res.data.valid + ' 元\n'
+                    + '说明:手续费为通道费用,非美天旺收取,手续费费率为 ' + res.data.rate * 100 + '%,最少 ' + res.data.min + ' 元,最多 ' + res.data.max + ' 元。',
                     showCancel: true,
                     showCancel: true,
                     showConfirm: true,
                     showConfirm: true,
                     confirmText: '继续提现',
                     confirmText: '继续提现',
@@ -161,14 +170,29 @@ Page({
                         if (model.confirm) {
                         if (model.confirm) {
                             extractCash(value).then(rs => {
                             extractCash(value).then(rs => {
                                 that.getUserInfo();
                                 that.getUserInfo();
-                                return app.Tips({
-                                    title: rs.msg,
-                                    icon: 'success'
-                                });
+                                return wx.showModal({
+                                    title: '成功',
+                                    content: rs.msg,
+                                    showCancel: false,
+                                    confirmText: '确定',
+                                    complete: () => {
+                                        wx.navigateBack({
+                                          delta: 1,
+                                        })
+                                    }
+                                })
                             }).catch(err => {
                             }).catch(err => {
-                                return app.Tips({
-                                    title: err
-                                });
+                                return wx.showModal({
+                                    title: '失败',
+                                    content: err,
+                                    showCancel: false,
+                                    confirmText: '确定',
+                                    complete: () => {
+                                        wx.navigateBack({
+                                          delta: 1,
+                                        })
+                                    }
+                                })
                             });
                             });
                         }
                         }
                     },
                     },
@@ -194,17 +218,44 @@ Page({
             }
             }
 
 
             var that = this
             var that = this
-            extractCash(value).then(res => {
-                that.getUserInfo();
-                return app.Tips({
-                    title: res.msg,
-                    icon: 'success'
-                });
-            }).catch(err => {
-                return app.Tips({
-                    title: err
-                });
-            });
+            wx.showModal({
+                title: '提现确认',
+                content: CASH_CHANNELS[value.extract_type] + '提现: ' + value.money + ' 元\n'
+                    + '收款人: 微信登录账号\n'
+                    + '手续费: 0 元\n'
+                    + '实际到帐: ' + value.money + ' 元\n',
+                confirmText: '继续提现',
+                success: (model) => {
+                    if (model.confirm) {
+                        extractCash(value).then(res => {
+                            that.getUserInfo();
+                            return wx.showModal({
+                                title: '成功',
+                                content: res.msg,
+                                showCancel: false,
+                                confirmText: '确定',
+                                complete: () => {
+                                    wx.navigateBack({
+                                      delta: 1,
+                                    })
+                                }
+                            })
+                        }).catch(err => {
+                            return wx.showModal({
+                                title: '失败',
+                                content: err,
+                                showCancel: false,
+                                confirmText: '确定',
+                                complete: () => {
+                                    wx.navigateBack({
+                                      delta: 1,
+                                    })
+                                }
+                            })
+                        });
+                    }
+                },
+            })
         }
         }
     },
     },