rk
2 天以前 4f4538356403d620b9bd510fd45729a251291942
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<template>
    <view class="profile-page">
        <view class="profile-header">
            <image class="avatar" src="/static/images/ic_pic@2x.png" mode="aspectFill"></image>
            <view class="profile-info">
                <view class="profile-name">{{ displayMobile }}</view>
                <button open-type="getPhoneNumber" @getphonenumber="getPhone" v-if="displayMobile === '绑定手机号'"></button>
                <!-- <view class="profile-mobile">{{ displayName }}</view> -->
            </view>
        </view>
 
        <view class="menu-card">
            <view class="menu-item" v-for="item in menuList" :key="item.id" @click="handleMenu(item)">
                <view class="menu-text">{{ item.name }}</view>
                <image class="menu-arrow" src="/static/icon/ar_detail@2x.png" mode="aspectFit"></image>
                <!-- #ifdef MP-WEIXIN -->
                <button v-if="item.id === 5" class="contact-trigger" open-type="contact" @click.stop></button>
                <!-- #endif -->
            </view>
        </view>
 
        <view class="logout-btn" @click="logout" v-if="userInfo && userInfo.mobile">退出登录</view>
        
        <!-- 自行车-确认结算 -->
        <u-popup :show="show3" :closeOnClickOverlay="true" mode="bottom" bgColor="#fff" :round="10" @close="show3 = false">
            <template>
                <view class="deposit1">
                    <view class="deposit_text">
                        <text>温馨提示</text>
                        <text class="red">结算后,如果继续骑行会重新开始计费</text>
                        <text class="red">确认结算么?</text>
                    </view>
                    <view class="deposit_footer">
                        <view class="deposit_footer_item" @click="show3 = false">再等等</view>
                        <view class="deposit_footer_item c" @click="settlement1">立即结算</view>
                    </view>
                </view>
            </template>
        </u-popup>
    </view>
</template>
 
<script>
    import { mapState } from 'vuex'
 
    export default {
        computed: {
            ...mapState(['userInfo']),
            // displayName() {
            //     return this.userInfo.nickName || this.userInfo.nickname || this.userInfo.name || '未登录用户'
            // },
            displayMobile() {
                const mobile = this.userInfo.mobile || ''
                if (!mobile) {
                    return '绑定手机号'
                }
                return mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
            }
        },
        data() {
            return {
                show3: false,
                isDisabled: true,
                menuList: [
                    { id: 1, name: '结算退押金' },
                    { id: 2, name: '消费明细', url: '/pages/consumptionDetails/consumptionDetails' },
                    { id: 3, name: '车辆计价规则', url: '/pages/pricingRules/pricingRules' },
                    { id: 4, name: '抖音兑换说明' },
                    { id: 5, name: '联系客服' },
                    { id: 6, name: '运营中心' }
                ]
            }
        },
        methods: {
            // 获取手机号
            getPhone(e) {
                var that = this;
                if (e.detail.errMsg === 'getPhoneNumber:ok') {
                    uni.login({
                        provider: 'weixin',
                        success: function(loginRes) {
                            let {
                                code
                            } = loginRes;
                            that.$u.api.wxLogin({
                                code
                            }).then(res => {
                                that.$store.commit('setToken', res.data.token)
                                that.$u.api.wxPhone({
                                    encryptedData: e.detail.encryptedData,
                                    iv: e.detail.iv,
                                    sessionKey: res.data.sessionKey
                                }).then(result => {
                                    if (result.code === 200) {
                                        that.$store.commit('setUserInfo', result.data.userResponse)
                                    }
                                })
                            })
                        }
                    });
                }
            },
            // 结算
            settlement1() {
                if (this.isDisabled) {
                    this.isDisabled = false
                    this.$u.api.goodsOrderSettlement({}).then(res => {
                        if (res.code === 200) {
                            uni.showToast({ title: '结算申请提交成功,请耐心等待退款!', icon: 'none', duration: 2000 });
                        }
                    }).finally(() => {
                        this.show3 = false
                        this.isDisabled = true
                    })
                }
            },
            handleMenu(item) {
                if (item.url) {
                    uni.navigateTo({
                        url: item.url
                    })
                    return
                }
                // 结算退押金
                if (item.id === 1) {
                    if (!this.userInfo.mobile) return
                    this.$u.api.home()
                        .then(res => {
                            if (res.code === 200) {
                                let info = res.data
                                
                                if (info.rideStatus === 1) {
                                    uni.showToast({ title: '骑行中不能结算押金', icon: 'none', duration: 2000 })
                                    return
                                } 
                                if (info.depositStatus === 1) {
                                    this.show3 = true
                                } else if (info.depositStatus === 2) {
                                    uni.showToast({ title: '结算申请提交成功,请耐心等待退款!', icon: 'none', duration: 2000 });
                                } else {
                                    uni.showToast({ title: '您暂无押金,无需结算!', icon: 'none', duration: 2000 });
                                }
                                
                            }
                        })
                    return
                }
 
                if (item.id === 4) {
                    uni.navigateTo({
                        url: '/pages/explanation/explanation'
                    })
                    return
                }
 
                if (item.id === 5) {
                    return
                }
 
                if (item.id === 6) {
                    uni.navigateTo({
                        url: this.userInfo.sysuser ? '/pagesA/pages/operation/operation' : '/pages/operationLogin/operationLogin'
                    })
                }
            },
            logout() {
                this.$u.api.accountLogout()
                    .then(res => {
                        if (res.code === 200) {
                            let user = JSON.parse(JSON.stringify(this.userInfo))
                            user.mobile = ''
                            this.$store.commit('setUserInfo', user)
                            uni.reLaunch({
                                url: '/pages/index/index'
                            })
                        }
                    })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .deposit1 {
        width: 100%;
        min-height: 470rpx;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 40rpx 20rpx;
        box-sizing: border-box;
        background: linear-gradient(360deg, #FFFFFF 0%, #FFFFFF 58%, #D0FFFD 100%);
        box-shadow: 0rpx -6rpx 16rpx 0rpx rgba(0, 0, 0, 0.1);
        border-radius: 32rpx 32rpx 0rpx 0rpx;
    
        .deposit_text {
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
    
            .red {
                color: #FC2525 !important;
                font-size: 30rpx !important;
            }
    
            text {
                &:nth-child(1) {
                    font-size: 32rpx;
                    font-family: PingFangSC-Medium, PingFang SC;
                    font-weight: 500;
                    color: #222222;
                }
    
                &:nth-child(2) {
                    font-size: 30rpx;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #333333;
                    margin-top: 40rpx;
                }
    
                &:nth-child(3) {
                    font-size: 26rpx;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #01B6AD;
                    margin-top: 20rpx;
                }
            }
        }
    
        .deposit_footer {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: 30rpx;
    
            .c {
                background-color: #01B6AD !important;
                color: #ffffff !important;
            }
    
            .deposit_footer_item {
                flex: 1;
                height: 96rpx;
                line-height: 96rpx;
                text-align: center;
                border-radius: 46rpx;
                border: 1rpx solid #01B6AD;
                font-size: 32rpx;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #01B6AD;
    
                &:first-child {
                    margin-right: 22rpx;
                }
            }
        }
    }
    
    .profile-page {
        width: 100%;
        min-height: 100vh;
        padding: 30rpx;
        box-sizing: border-box;
        background: #ffffff;
    }
 
    .profile-header {
        display: flex;
        align-items: center;
        padding-top: 6rpx;
    }
 
    .avatar {
        width: 92rpx;
        height: 92rpx;
        border-radius: 46rpx;
        flex-shrink: 0;
    }
 
    .profile-info {
        margin-left: 20rpx;
        min-width: 0;
        position: relative;
    }
    
    .profile-info button {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 999;
        opacity: 0;
    }
 
    .profile-name {
        font-weight: 600;
        font-size: 36rpx;
        color: #222222;
    }
 
    .profile-mobile {
        margin-top: 10rpx;
        font-weight: 400;
        font-size: 26rpx;
        color: #666666;
    }
 
    .menu-card {
        margin-top: 62rpx;
        background: #F8F9FB;
        border-radius: 24rpx;
        overflow: hidden;
    }
 
    .menu-item {
        height: 106rpx;
        padding: 0 28rpx 0 30rpx;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 2rpx solid #E5E5E5;
        position: relative;
 
        &:last-child {
            border-bottom: 0;
        }
    }
 
    .contact-trigger {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        opacity: 0;
        border: 0;
        background: transparent;
        z-index: 2;
    }
 
    .contact-trigger::after {
        border: 0;
    }
 
    .menu-text {
        font-weight: 500;
        font-size: 30rpx;
        color: #222222;
    }
 
    .menu-arrow {
        width: 30rpx;
        height: 30rpx;
        flex-shrink: 0;
    }
 
    .logout-btn {
        width: 200rpx;
        height: 72rpx;
        margin: 70rpx auto 0;
        border-radius: 36rpx;
        border: 1rpx solid #999999;
        font-weight: 400;
        font-size: 28rpx;
        color: #333333;
        line-height: 72rpx;
        text-align: center;
        box-sizing: border-box;
        background: #ffffff;
    }
</style>