rk
昨天 611d7b93462deeb994dc89ab7c5b39bbcf5f2596
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<template>
    <view class="box">
        <view class="bg">
            <view class="bg-a">可提现余额(元)</view>
            <view class="bg-b">
                <text>{{((countData.balance || 0)/ 100 || 0).toFixed(2)}}</text>
                <text></text>
            </view>
            <view class="form">
                <view class="form-a">
                    <view class="form-a-label">提现至支付宝账号</view>
                    <view class="form-a-val">
                        <input type="text" placeholder="请输入提现账号" v-model="form.aliAccount" />
                    </view>
                </view>
                <view class="form-a">
                    <view class="form-a-label">账号姓名</view>
                    <view class="form-a-val">
                        <input type="text" placeholder="请输入账号姓名" v-model="form.aliName" />
                    </view>
                </view>
                <view class="form-title">提现金额</view>
                <view class="form-input">
                    <view class="form-input-dw">¥</view>
                    <input type="text" placeholder="0" v-model="form.amount" :focus='focus' @blur="focus = false"/>
                    <view class="form-input-tx" @click="inputAll">全部提现</view>
                </view>
                <view class="form-btn" @click="confirm()">提交申请</view>
            </view>
        </view>
        <u-popup :show="show" round="15" :safeAreaInsetBottom="false" mode="center">
            <view class="tc">
                <view class="tc-contemt">
                    <view class="tc-contemt-title">操作提示</view>
                    <view class="tc-contemt-nr">
                        您确认发起此次提现申请吗?
                    </view>
                </view>
                <view class="tc-btn">
                    <view class="tc-btn-item" @click="confirm() ">我再想想</view>
                    <view class="tc-btn-item" style="color: #004096;" @click="applyDo">确认</view>
                </view> 
            </view>
        </u-popup>
    </view>
</template>
 
<script>
    import { mapState } from 'vuex'
    export default {
        computed: {
            ...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken'])
        },
        data() {
            return { 
                show:false,
                tips:'',
                focus:false,
                valid:false,
                bankList:[],
                form: { amount: null, aliAccount: null, aliName: null },
                shop:{},
                info:{},
                countData: {}
            }
        }, 
        onLoad(options) {
            this.show = false
            this.focus = false
            this.form.aliAccount = this.shopInfo.aliAccount
            this.form.aliName = this.shopInfo.aliName
            this.getShopStatistics()
        },
        methods:{  
            // 获取门店钱包统计
            getShopStatistics(){
                this.$u.api.shopStatistics({}).then(res=>{
                    if(res.code == 200){
                        this.countData = res.data
                    }
                })
            },
            confirm(){
                if(!this.form.amount){
                    this.tips ='请输入提现金额'
                    this.focus = true
                    return
                }
                if(this.form.amount > (this.countData.balance / 100 || 0)){
                    this.tips ='输入的金额已经超过可提现金额'
                    this.focus = true
                    return
                }
                this.show = !this.show
            },
            applyDo(){
                var that =this
                if (!this.form.aliAccount) {
                    uni.showToast({ title: '请输入支付宝账号', icon: 'none' })
                    return
                }
                if (!this.form.aliName) {
                    uni.showToast({ title: '请输入姓名', icon: 'none' })
                    return
                }
                this.$u.api.shopApply(this.form)
                    .then(res => {
                        if (res.code === 200) { 
                            uni.showToast({ title:'操作成功', icon:'success' })
                            uni.$emit('accountListReload')
                            uni.redirectTo({ url: "/shop/pages/withdraw-success/withdraw-success?id=" + res.data })
                        }
                    }).catch(e=>{
                        uni.showToast({ title:'操作失败', icon:'error' })
                    })
            },
            inputAll(){
                this.form.amount = this.countData.balance ? (this.countData.balance / 100 || 0) : 0
            }
        }
    }
</script>
 
<style>
    page {
        background-color: #F9F9FB;
    }
</style>
<style lang="scss" scoped>
    .box {
        width: 100%;
        .bg {
            width: 100%;
            padding: 30rpx;
            box-sizing: border-box;
            height: 240rpx;
            background: #004096;
            .bg-a {
                font-weight: 400;
                font-size: 26rpx;
                color: #FFFFFF;
            }
            .bg-b {
                display: flex;
                align-items: baseline;
                margin-top: 14rpx;
                text {
                    &:nth-child(1) {
                        font-weight: 600;
                        font-size: 48rpx;
                        color: #FFFFFF;
                    }
                    &:nth-child(2) {
                        font-weight: 600;
                        font-size: 26rpx;
                        color: #FFFFFF;
                    }
                }
            }
            .form {
                width: 100%;
                background: #FFFFFF;
                box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(0,0,0,0.08);
                border-radius: 20rpx;
                margin-top: 30rpx;
                padding: 10rpx 30rpx 30rpx 30rpx;
                box-sizing: border-box;
                .form-a {
                    width: 100%;
                    height: 102rpx;
                    border-bottom: 1rpx solid #E5E5E5;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    .form-a-label {
                        flex-shrink: 0;
                        margin-right: 30rpx;
                        font-weight: 400;
                        font-size: 30rpx;
                        color: #666666;
                    }
                    .form-a-val {
                        height: 100%;
                        input {
                            width: 300rpx;
                            height: 100%;
                            text-align: right;
                            font-weight: 500;
                            font-size: 28rpx;
                            color: #333333;
                            // margin: 0 30rpx;
                        }
                        // text {
                        //     font-weight: 400;
                        //     font-size: 28rpx;
                        //     color: #333333;
                        // }
                        // image {
                        //     width: 32rpx;
                        //     height: 32rpx;
                        //     margin-right: 10rpx;
                        // }
                    }
                }
                .form-title {
                    font-weight: 500;
                    font-size: 34rpx;
                    color: #111111;
                    margin-top: 40rpx;
                }
                .form-input {
                    width: 100%;
                    height: 116rpx;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    border-bottom: 1rpx solid #E5E5E5;
                    .form-input-dw {
                        flex-shrink: 0;
                        font-weight: bold;
                        font-size: 30rpx;
                    }
                    input {
                        flex: 1;
                        height: 100%;
                        font-weight: 500;
                        font-size: 40rpx;
                        color: #111111;
                        margin: 0 30rpx;
                    }
                    .form-input-tx {
                        flex-shrink: 0;
                        font-weight: 400;
                        font-size: 30rpx;
                        color: #004096;
                    }
                }
                .form-error {
                    font-weight: 400;
                    font-size: 26rpx;
                    color: #E4001D;
                    margin-top: 30rpx;
                }
                .disable {
                    color: #CCCCCC !important;
                    background: #EFEFEF !important;
                }
                .form-btn {
                    width: 100%;
                    height: 88rpx;
                    line-height: 88rpx;
                    text-align: center;
                    background: #004096;
                    border-radius: 44rpx;
                    font-weight: 500;
                    font-size: 32rpx;
                    color: #FFFFFF;
                    margin-top: 48rpx;
                }
            }
        }
    }
</style>