zhaojs
2023-05-19 a4c501780fb7c2179e7842cffda65756947ba951
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
<template style="background:#fff">
    <view class="invite-code-container colCen borderBox">
        <view class="model-title rowCenCen">
            请输入邀请码
        </view>
        <view class="grey-input-content rowCen borderBox">
            <input class="iptclas" type="text" v-model="inviteCode" placeholder="请填写邀请码" placeholder-class="pla-input"/>
        </view>
        <view class="model-tips" v-if="appInfo.isOpenOfficialCode==1">
            <view>填写邀请码有助于您的购物返佣哦!</view>
        </view>
        
        <template v-if="isShowCode">
        <view class="copy-bar rowCenBet borderBox" v-if="appInfo.isOpenOfficialCode==1">
            <view class="left-code">
                {{appInfo.officialInvitationCode}}
            </view>
            <view class="copybtn rowCenCen" @tap="useCode()">
                <view>使用邀请码</view>
            </view>
        </view>
        </template>
        <view @click="setCode" class="login-btn rowCenCen" :class="inviteCode?'colorfulbtn':''" >
            <view class="btn-font"  >
                确定
            </view>
        </view>
        
        <view class="yqmtip rowCenCen">
            <span @click="showinvite">没有邀请码?</span>
        </view>
        <u-popup v-model="inviterShow" mode="center" border-radius="32" v-if="inviterShow" :mask-close-able='true'>
            <inviter-model ref='invitermodel' @rewrite='rewriteCode' @setInvite='setCodebtn'></inviter-model>
        </u-popup>
    
    </view>
</template>
 
<script>
        import inviterModel from '../../components/inviterModel.vue'
        import util from '../../utils/utils.js'
    export default {
        components: {
            inviterModel
        },
        data(){
            return{
                isShowCode:false,
                inviteCode:'',
                appInfo:'',
                inviterShow:false
            }
        },
        mounted() {
            this.appInfo = uni.getStorageSync('appInfo')
        },
        methods: {
            useCode()
            {
                this.inviteCode=this.appInfo.officialInvitationCode;
            },
            rewriteCode()
            {
                this.inviterShow=false;
            },
            setCodebtn(){
                this.inviterShow=false;
                this.getuserInfo()
            },
            showinvite() {
                var that=this;
                uni.showModal({
                    title: '温馨提示',
                    content: "您可向推荐您使用大返官的好友获取邀请码~",
                    cancelText:'没有推荐人',
                    confirmText:'联系推荐人',
                    success:function(res)
                    {
                        that.isShowCode=res.cancel;
                        console.log(that.isShowCode)
                    }
                });
            },
            getuserInfo() {
                var that = this;
                this.$u.api.getUserInfo({}).then(e => {
                    console.log(e)
                    util.setCache('userInfo', e.data.userinfo);
                    if (e.data.userinfo.isPwd == 'N') {
                        uni.redirectTo({
                            url: './setPass'
                        })
                    } else {
                        uni.switchTab({
                          url: '../index/index'
                        })
                    }
                }).catch(function (err) {
                    console.log(err)
                })
            },
            setCode()
            {
                var that=this;
                if(this.inviteCode)
                {
                    this.$u.api.getInviteInfo({
                        invite_code:this.inviteCode
                    }).then(e => {
                        console.log(e)
                        if(e.code != 0) return that.$alert(e.msg)
                        uni.setStorageSync('inviterInfo',e.data)
                        this.inviterShow = true
                    }).catch(function (err) {
                    })
                }
            }
 
        }
    }
</script>
 
<style lang="scss">
    body
    {
        background: #fff;
    }
    
    .yqmtip
    {
        width: 100%;
        position: fixed;
        bottom: 100rpx;
        bottom: calc(100rpx + constant(safe-area-inset-bottom));
        bottom: env(100rpx + constant(safe-area-inset-bottom));
        left: 0;
        z-index: 1;
        color: #999999;
    }
    .login-btn {
                width: 100%;
                height: 86rpx;
                background: #E2E2E2;
                border-radius: 43rpx;
                margin-top: 80rpx;
                pointer-events: none;
 
                .btn-font {
                    font-size: 30rpx;
                    font-weight: 500;
                    color: #FFFFFF;
                }
            }
            .colorfulbtn {
                background: #FD002F;
                pointer-events: auto;
            }
    .invite-code-container{
        background: #FFFFFF;
        padding: 0 46rpx;
        .model-title{
            width: 100%;
            height: 135rpx;
            font-size: 54rpx;
            font-weight: 500;
            color: #333333;
            margin-top: 250rpx;
        }
        .grey-input-content{
            width: 100%;
            height: 90rpx;
            background: #F8F8F8;
            border-radius: 45rpx;
            padding: 0 21rpx;
            margin-bottom: 35rpx;
            .iptclas{
                flex: 1;
            }
            .pla-input{
                font-size: 28rpx;
                font-weight: 500;
                color: #999999;
            }
        }
        
        .btn-bar{
            width: 100%;
            margin-bottom: 50rpx;
            .close-btn{
                width: 263rpx;
                height: 90rpx;
                background: #F7F7F7;
                border: 1rpx solid #CBCBC9;
                border-radius: 45rpx;
                font-size: 28rpx;
                font-weight: 500;
                color: #999999;
            }
            .next-btn{
                width: 263rpx;
                height: 90rpx;
                background: #CBCBC9;
                border-radius: 45rpx;
                font-size: 28rpx;
                font-weight: 500;
                color: #FFFFFF;
            }
            .pinkbtn{
                background-color: #FD002F;
            }
        }
        
        .model-tips{
            width: 100%;
            font-size: 24rpx;
            font-weight: 500;
            color: #999999;
            margin-bottom: 25rpx;
        }
        
        .copy-bar{
            width: 100%;
            height: 72rpx;
            background: #F8F8F8;
            border-radius: 12rpx;
            margin-bottom: 30rpx;
            padding: 0 20rpx;
            .left-code{
                font-size: 26rpx;
                font-weight: 500;
                color: #FF002C;
            }
            .copybtn{
                width: 158rpx;
                height: 54rpx;
                background: #FFFFFF;
                border-radius: 12rpx;
                font-size: 26rpx;
                font-weight: 500;
                color: #333333;
            }
        }
    }
</style>