liaoxujun@qq.com
2024-03-05 f0ca9fb79a91544c037c55a291be00e8c469bf34
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
<template>
    <view style="width:100%;height: 100%;">
        <u-toast ref="uToast" /><u-no-network></u-no-network>
        <u-navbar title="代理面板" safeAreaInsetTop fixed placeholder>
            <view class="coreshop-navbar-left-slot" slot="left">
                <u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
                <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
                <u-icon name="home" size="22" @click="goHome"></u-icon>
            </view>
            <view slot="right">
            </view>
        </u-navbar>
        <view>
            <!-- 用户资料 -->
            <view class="user-card coreshop-bg-blue">
                <view class="card-top coreshop-flex coreshop-justify-between">
                    <view class="coreshop-flex coreshop-align-center">
                        <view class="head-img-box"><image class="head-img" :src="userInfo.avatarImage" mode=""></image></view>
                        <view class="coreshop-flex coreshop-flex-direction coreshop-align-start">
                            <view class="user-name">{{ userInfo.nickName }}</view>
                            <view class="user-info-box coreshop-flex coreshop-align-center">
                                <view class="coreshop-flex coreshop-align-center" v-if="info.gradeName">
                                    <text class="cu-tag bg-purple sm radius">{{ info.gradeName }}</text>
                                </view>
                            </view>
                        </view>
                    </view>
                    <view class="coreshop-flex coreshop-flex-direction coreshop-align-start">
                        <view class="coreshop-flex coreshop-flex-direction coreshop-align-center">
                            <view class="log-btn" @click="navigateToHandle(utilityMenus.balance.router)">明细</view>
                            <view class="coreshop-margin-top-10" @click="onEye">
                                <u-icon color="#fff" v-if="showMoney" name="eye-fill"></u-icon>
                                <u-icon color="#fff" v-else name="eye-off"></u-icon>
                            </view>
                        </view>
                    </view>
                </view>
                <view class="card-bottom coreshop-flex coreshop-justify-between">
                    <view class="flex-sub coreshop-flex coreshop-flex-direction coreshop-align-start">
                        <view class="item-title">已结算金额</view>
                        <view class="item-detail">{{ showMoney ? info.settlementAmount || '0.00' : '***' }}</view>
                    </view>
                    <view class="flex-sub coreshop-flex coreshop-flex-direction coreshop-align-start" style="align-items: center;">
                        <view class="item-title">待入账佣金</view>
                        <view class="item-detail">{{ showMoney ? info.freezeAmount || '0.00' : '***' }}</view>
                    </view>
                    <view class="flex-sub coreshop-flex coreshop-flex-direction coreshop-align-start" style="align-items: flex-end;">
                        <view class="item-title">本月订单数</view>
                        <view class="item-detail">{{ showMoney ? info.currentMonthOrder || '0.00' : '***' }}</view>
                    </view>
                </view>
            </view>
 
            <view class="coreshop-list menu card-menu">
                <view class="coreshop-list-item arrow" v-for="(menu, index) in utilityMenus" :key="index" @tap="navigateToHandle(menu.router)">
                    <view class="content">
                        <image :src="menu.icon" class="png" mode="aspectFit"></image>
                        <text class="coreshop-text-grey">{{ menu.name }}</text>
                    </view>
                </view>
                <!-- 分享二维码 -->
                <view class="coreshop-list-item arrow" @click="$u.throttle(createPoster, 500)">
                    <view class="content">
                        <image src="/static/images/distribution/distribution_icon7.png" class="png" mode="aspectFit"></image>
                        <text class="coreshop-text-grey">邀请海报</text>
                    </view>
                </view>
            </view>
 
        </view>
    </view>
</template>
<script>
    
    export default {
        
        data() {
            return {
                showMoney: true, //是否显示金额
                siteName: this.$store.state.config.shopName,
                utilityMenus: {
                    invite: {
                        name: '我的推广',
                        icon: '/static/images/distribution/distribution_icon1.png',
                        router: '/pages/member/agent/team/team'
                    },
                    balance: {
                        name: '佣金明细',
                        icon: '/static/images/distribution/distribution_icon2.png',
                        router: '/pages/member/agent/commissionDetails/commissionDetails'
                    },
                    order: {
                        name: '代理订单',
                        icon: '/static/images/distribution/distribution_icon3.png',
                        router: '/pages/member/agent/order/order'
                    },
                    myStore: {
                        name: '我的店铺',
                        icon: '/static/images/distribution/distribution_icon4.png',
                        router: '/pages/member/agent/myStore/myStore'
                    },
                    storeSetting: {
                        name: '店铺设置',
                        icon: '/static/images/distribution/distribution_icon5.png',
                        router: '/pages/member/agent/storeSetting/storeSetting'
                    },
                    ranking: {
                        name: '代理排行',
                        icon: '/static/images/distribution/distribution_icon6.png',
                        router: '/pages/member/agent/rankings/rankings'
                    },
                    //shareLog: {
                    //    name: '分享记录',
                    //    icon: '/static/images/distribution/distribution_icon8.png',
                    //    router: '/pages/member/agent/shareLog/shareLog'
                    //},
                },
                info: {}, //经销商信息
                userInfo: {}, // 用户信息
                shareUrl: this.$globalConstVars.shareUrl
            }
        },
        onShow() {
            var _this = this;
            if (_this.$store.state.config.agentStore != '1') {
                delete this.utilityMenus.myStore;
                delete this.utilityMenus.storeSetting;
            }
            _this.$u.api.getAgentInfo().then(res => {
                if (res.status) {
                    _this.info = res.data;
                    if (res.data.verifyStatus != 1) { //审核通过
                        _this.$u.route({ type: 'redirectTo', url: '/pages/member/agent/index/index' });
                    }
                    if (_this.$store.state.config.agentStore == '1') {
                        _this.utilityMenus.myStore.router = '/pages/member/agent/myStore/myStore?store=' + _this.info.store;
                    }
                    this.getShareUrl();
 
                } else {
                    //报错了
                    _this.$u.toast(res.msg);
                }
            });
        },
        onLoad() {
            this.initData()
        },
        methods: {
            // 是否显示金额
            onEye() {
                this.showMoney = !this.showMoney;
            },
            navigateToHandle(pageUrl) {
                this.$u.route({ url: pageUrl })
            },
            initData() {
                // 获取用户信息
                var _this = this
                this.$u.api.userInfo().then(res => {
                    if (res.status) {
                        _this.userInfo = res.data
                    }
                })
            },
            //去提现
            goWithdraw() {
                this.$u.route('/pages/member/balance/withdrawCash/withdrawCash')
            },
            //获取分享URL
            getShareUrl() {
                let data = {
                    client: this.$globalConstVars.shareClient.wxMiNiProgram,
                    url: this.$globalConstVars.shareUrl,
                    type: this.$globalConstVars.shareModel.url,
                    page: this.$globalConstVars.shareType.agent,
                    params: {
                        store: this.info.store
                    },
                };
                let userToken = this.$db.get('userToken');
                if (userToken && userToken != '') {
                    data['token'] = userToken;
                }
                this.$u.api.share(data).then(res => {
                    this.shareUrl = res.data
                });
            },
            // 生成邀请海报
            createPoster() {
                let data = {
                    client: this.$globalConstVars.shareClient.wxMiNiProgram,
                    url: this.$globalConstVars.shareUrl,
                    type: this.$globalConstVars.shareModel.poster,
                    params: {
                        store: this.info.store
                    },
                    page: this.$globalConstVars.shareType.agent,
                }
                let userToken = this.$db.get('userToken')
                if (userToken && userToken != '') {
                    data.token = userToken
                }
                this.$u.api.share(data).then(res => {
                    if (res.status) {
                        data.params.posterUrl = res.data;
                        data.params.shareType = this.$globalConstVars.shareType.agent;
                        this.$u.route('/pages/share/shareNewPoster/shareNewPoster' + uni.$u.queryParams(data.params))
                    } else {
                        this.$u.toast(res.msg)
                    }
                })
            },
        },
        //分享
        onShareAppMessage(res) {
            return {
                title: this.$store.state.config.shareTitle,
                imageUrl: this.$store.state.config.shareImage,
                path: this.shareUrl
            }
        },
        onShareTimeline(res) {
            return {
                title: this.$store.state.config.shareTitle,
                imageUrl: this.$store.state.config.shareImage,
                path: this.shareUrl
            }
        },
    }
</script>
<style lang="scss" scoped>
    @import "panel.scss";
</style>