quanwei
2026-01-17 e1e2fe5710a5b5cd9c19bd3aa99c998a1a613ca8
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
<template>
    <view class="user-datail" :data-theme='theme()' :class="theme() || ''" v-if="!loading">
        <view class="top_box">
            <view class="user-header p20">
                <view class="user-info">
                    <view class="photo">
                        <image :src="user.avatarUrl" mode="aspectFill"></image>
                    </view>
                    <view class="info">
                        <view class="name">{{ user.nickName }}</view>
                    </view>
                </view>
            </view>
            <view class="top-tabbar">
                <scroll-view scroll-x="true" scroll-with-animation="true">
                    <view class="type-list d-s-c">
                        <view :class="type_active == item.type ? 'tab-item active' : 'tab-item '" v-for="(item, index) in types" :key="index" @click="tabTypeFunc(item.type)">
                            {{ item.name }}
                        </view>
                    </view>
                </scroll-view>
            </view>
        </view>
        <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" lower-threshold="50">
            <Points :user_id="user_id"></Points>
        </scroll-view>
            
    </view>
</template>
 
<script>
    import Popup from '@/components/uni-popup.vue'
    import Points from './user/points.vue'
    export default {
        components: {
            Points
        },
        data() {
            return {
                loading: true,
                /*兑换券详情*/
                user: {},
                // 选择的优惠内容
                type_active: 'points',
                types: [
                    {
                        type: 'points',
                        name: '小票积分'
                    }
                ],
                scrollviewHigh: ''
            };
        },
        props: ['user_id'],
        onLoad(e) {
            
        },
        mounted() {
            this.init();
            /*获取订单详情*/
            this.getData();
        },
        methods: {
            /*初始化*/
            init() {
                let _this = this;
                uni.getSystemInfo({
                    success(res) {
                        _this.scrollviewHigh = res.windowHeight - 103;
                    }
                });
            },
            /*tab切换*/
            tabTypeFunc(e) {
                if(e!=this.type_active){
                    this.type_active = e;
                }
            },
            /*获取数据*/
            getData() {
                let self = this;
                uni.showLoading({
                    title: '加载中'
                });
                self._get(
                    'user.qrcode/detail', {
                        user_id: self.user_id
                    },
                    function(res) {
                        self.loading = false;
                        self.user = res.data.user;
                        
                        // self.extractStore = res.data.order.extractStore;
                        uni.hideLoading();
                    },
                    function(res) {
                        uni.switchTab({
                            url:'/pages/index/index'
                        })
                    }
                );
            },
 
            /*核销*/
            onSubmitExtract(user_coupon_id) {
                let self = this;
                if (self.project_id === '') {
                    uni.showToast({
                        title: '请选择优惠项目',
                        duration: 2000,
                        icon:'none'
                    });
                    return;
                }
                wx.showModal({
                    title: "提示",
                    content: "您确定要核销吗?",
                    success: function(o) {
                        o.confirm && self._post(
                            'store.coupon/extract', {
                                user_coupon_id: user_coupon_id,
                                project_id: self.project_id
                            },
                            function(res) {
                                uni.showToast({
                                    title: res.msg,
                                    duration: 2000,
                                    icon: 'success',
                                });
                                setTimeout(function () {
                                    self.gotoPage('/pages/index/index');
                                }, 2000);
                            }
                        );
                    }
                });
            },
            /*点击单选*/
            radioChange(e) {
                let self = this;
                self.project_id = e;
            },
        }
    };
</script>
 
<style lang="scss" scoped>
    .user-header {
        position: relative;
        height: 100%;
        @include background_color('background_color');
    }
    
    .user-header .user-info {
        display: flex;
        justify-content: flex-start;
        align-items: center;
    }
    
    .user-header .photo,
    .user-header .photo image {
        width: 50rpx;
        height: 50rpx;
        border-radius: 50%;
    }
    
    .user-header .photo {
        border: 2rpx solid #ffffff;
    }
    
    .user-header .info {
        padding-left: 20rpx;
        box-sizing: border-box;
        overflow: hidden;
        color: #FFFFFF;
    }
    
    .user-header .info .name {
        font-size: 26rpx;
    }
</style>