bayi hai 1 ano
pai
achega
5dd1b997d3

+ 45 - 8
salesperson/pages/withdrawal/index.js

@@ -1,14 +1,51 @@
-// salesperson/pages/withdrawal/index.js
+import {
+    getSaleData
+} from '~/api/sale'
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
-
+        allIncome: {},
+        money: '',
+        errMsg: ''
     },
-    onShow() {
-
+    async onShow() {
+        let allIncome = await getSaleData()
+        this.setData({
+            allIncome
+        })
+    },
+    withdrawalFun() {
+        if (this.data.money <= 0) {
+            this.setData({
+                errMsg: '请输入要提现的金额'
+            })
+            return
+        }
+        if (this.data.money > this.data.allIncome.withdraw / 100) {
+            this.setData({
+                errMsg: '可提现金额不足'
+            })
+            return
+        }
+        if (this.data.money > 500 || this.data.money < 50) {
+            this.setData({
+                errMsg: '转出金额超限'
+            })
+            return
+        }
+    },
+    clearMoney() {
+        console.log('11');
+        this.setData({
+            money: "",
+            errMsg: ""
+        });
+    },
+    setMoney({
+        detail
+    }) {
+        this.setData({
+            money: detail.value
+        });
     },
     jump({
         currentTarget

+ 8 - 1
salesperson/pages/withdrawal/index.less

@@ -42,13 +42,20 @@
             }
 
             .close {
+                padding: 0 10rpx 0 20rpx;
                 font-size: 46rpx;
                 color: #979797;
             }
         }
 
+        .warning {
+            margin-top: 10rpx;
+            font-size: 22rpx;
+            color: #FF0000;
+        }
+
         .amount {
-            margin: 40rpx 0 18rpx;
+            margin: 30rpx 0 18rpx;
             font-size: 24rpx;
             font-weight: bold
         }

+ 8 - 4
salesperson/pages/withdrawal/index.wxml

@@ -1,3 +1,5 @@
+<wxs src="../../../utils/filter.wxs" module="filters" />
+
 <view class="container">
     <view class="withdrawal">
         <image src="../../image/money.png" class="mimg" />
@@ -5,13 +7,15 @@
             <view class="title">提现金额</view>
             <view class="inputBox">
                 <view class="icon">¥</view>
-                <input class="input" type="number" placeholder="可提现金额 1200元" maxlength="5" />
-                <view class="close">×</view>
+                <input class="input" type="number" placeholder="可提现金额{{filters.twoDecimal(allIncome.withdraw)}}元"
+                    maxlength="5" value="{{money}}" bindinput="setMoney" />
+                <view class="close" bindtap="clearMoney">×</view>
             </view>
-            <view class="amount">可提现金额 ¥ 1200.00</view>
+            <view class="warning" wx:if="{{errMsg!=''}}">{{errMsg}}</view>
+            <view class="amount">可提现金额 ¥{{filters.twoDecimal(allIncome.withdraw)}}</view>
             <view class="tips">单笔转账最高500元,单日转账最高20,000元</view>
         </view>
-        <button class="resetBtn submit">
+        <button class="resetBtn submit" bindtap="withdrawalFun">
             提现
         </button>
         <view class="tips2">

+ 7 - 1
salesperson/pages/withdrawal/index.wxss

@@ -37,11 +37,17 @@
   flex: 1;
 }
 .withdrawal .formBox .inputBox .close {
+  padding: 0 10rpx 0 20rpx;
   font-size: 46rpx;
   color: #979797;
 }
+.withdrawal .formBox .warning {
+  margin-top: 10rpx;
+  font-size: 22rpx;
+  color: #FF0000;
+}
 .withdrawal .formBox .amount {
-  margin: 40rpx 0 18rpx;
+  margin: 30rpx 0 18rpx;
   font-size: 24rpx;
   font-weight: bold;
 }