陶杰
2024-11-01 c6f83537de95f3c5e591cd2eff90f1163f38f118
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
<template>
    <view class="member-center">
        <image src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/81/81af45f51aef43f2bf490970e09a51edmember-level-bg.png" mode="aspectFit"
            class="img100 member-level-image"></image>
        <view class="banner">
            <banner3d @changeIndex="changeIndex" ref="banner3d" v-if="init" :banner-list="bannerList"
                :swiper-config="swiperConfig"></banner3d>
        </view>
        <view class="p20" style="padding-top: 0rpx;">
            <!--     <view class="info bg-white p20">
                <view class="flex">
                    <view>成长值规则</view>
                    <view class="m-l-a m-r-0 text-right desc-gray" @click="goto('/pages/help/content?id=会员协议',false)">
                        点击查看会员协议
                    </view>
                </view>
 
            </view> -->
            <!-- v-if="currentInfo.customerDTO&&currentInfo.customerDTO.userGrowthRecord
            &&currentInfo.customerDTO.userGrowthRecord.targetMemberInfos&&currentInfo.customerDTO.userGrowthRecord.targetMemberInfos.length>=1"
             -->
            <view class="member-infos info bg-white p20 ">
                <view class="text-center w-fit flex m-auto top-title ">
                    <view class="left-line"></view>
                    <view class="title">会员权益</view>
                    <view class="right-line"></view>
                </view>
                <view class="desc-info flex m-t-12" style="padding: 42rpx;">
                    <view class="m-t-12 flex1">
                        <image class="m-auto icon img100 " mode="scaleToFill"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/a4/a4adabdf9b1342fb8c3a28f3b8ad5dedicon-member-info-1.png"></image>
                        <view class="desc">
                            <!-- 积分达到{{currentInfo.customerDTO.userGrowthRecord.currentGrowthValue || '-'}} -->
                            积分达到{{bannerList[curIndex].point.startPoint || '0'}}
                        </view>
                    </view>
                    <view class="m-t-12 flex1">
                        <image class="m-auto icon img100" mode="scaleToFill"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/3a/3a6af67a278d4e46af5c6d802409457ficon-member-info-2.png"></image>
 
                        <!-- createName: "孙凯悦"
createTime: "2024-09-10 14:47:29"
discountAmount: null
discountRatio: 95
discountType: "ratio"
discountTypeStr: "百分比"
downgradeValue: 30
endPoint: 15000
growthValue: 1
id: 34
name: "金卡会员7"
startPoint: 10000
updateTime: "2024-09-12 14:09:19"
 -->
 
 
                        <view class="desc">
                            优惠
                            <span v-if="bannerList[curIndex].point.discountType=='ratio'">
                                <!-- currentInfo.customerDTO.userGrowthRecord.currentDiscountType=='ratio' -->
                                <!-- {{(currentInfo.customerDTO.userGrowthRecord.currentDiscountRatio) || '-'}}%/扎 -->
                                {{ ((bannerList[curIndex].point.discountRatio)/10).toFixed(1) || '-'}}折/扎
                            </span>
                            <span v-else>
                                {{bannerList[curIndex].point.discountAmount || '0'}}元/扎
                                <!-- {{currentInfo.customerDTO.userGrowthRecord.currentDiscountAmount || '-'}}元/扎 -->
                            </span>
                            <!--     serGrowthRecord: {currentMemberLevel: "银卡会员", currentGrowthValue: 4941, currentDiscountType:
                            "ratio",…}
                            currentDiscountAmount: 0
                            currentDiscountRatio: 5
                            currentDiscountType: "ratio"
                            currentDiscountTypeStr: "百分比"
                            currentGrowthValue: 4941
                            currentMemberLevel: "银卡会员" -->
 
                            <!-- {{currentInfo.customerDTO.userGrowthRecord.targetMemberInfos[0].targetDiscountAmount || '-'}}元/扎 -->
 
                        </view>
                    </view>
 
                </view>
                <!--             </view>
            <view class="info bg-white p20 m-t-20 member-infos"> -->
                <view class="text-center w-fit flex m-auto top-title m-t-20">
                    <view class="left-line"></view>
                    <view class="title">成长值获取规则</view>
                    <view class="right-line"></view>
                </view>
                <view class="m-t-12 desc-info">
                    <template v-if="bannerList[curIndex].point.growthValueDesc">
                        {{bannerList[curIndex].point.growthValueDesc}}
                    </template>
                    <template v-else>
                        <!-- 每消费1元,即可获得1成长值。
                        成长值将在订单交易完成后,根据实际交易金额进行赠送。
                        消费越多,获得的成长值越多,享受更高等级的会员权益。
                        快来参与消费,累积成长值,解锁更多专属福利吧! -->
                    </template>
                </view>
            </view>
            <view class="protocol" @click="goto('/pages/help/content?id=会员协议',false)">会员协议 <uni-icons type="right"
                    size="14" color="#AD790F"></uni-icons>
            </view>
        </view>
    </view>
 
    </view>
</template>
 
<script>
    import banner3d from '@/components/banner3d/banner3d'
    export default {
        async onPullDownRefresh() {
            await this.$store.dispatch('getCurrentInfo')
            uni.stopPullDownRefresh()
        },
        methods: {
            changeIndex(index) {
                console.log('changeIndex', index, this.bannerList)
                this.curIndex = index || 0
                this.$forceUpdate()
            }
        },
        async onLoad() {
            await this.$store.dispatch('getCurrentInfo')
            const {
                code,
                data
            } = await this.$http.request('get', '/api/member/list')
            if (code == 0 && data && data.records) {
                console.log('member-data', data)
                //循环赋值吧。用name包含来兼容
                for (var tmp of this.bannerList) {
                    for (var info of data.records) {
                        if (info.name && info.name.indexOf(tmp.title) >= 0) {
                            // 设置value
                            tmp.point = {
                                ...info,
                                current: this.currentInfo.customerDTO.userGrowthRecord
                                    .currentGrowthValue || 0
                            }
 
                            break
 
                        }
                    }
                }
            }
            consumptionAmount: 1
 
            this.$nextTick(() => {
                if (this.currentInfo.customerDTO && this.currentInfo.customerDTO.userGrowthRecord && this
                    .currentInfo
                    .customerDTO.userGrowthRecord.currentMemberLevel) {
                    // userGrowthRecord: {currentMemberLevel: "普通会员", currentGrowthValue: 6919,…}
                    // currentGrowthValue: 6919
                    // currentMemberLevel: "普通会员"
                    //     targetMemberInfos: [{targetMemberLevel: "金卡会员", targetStartPoint: 15001, targetGap: 8082, targetDiscountAmount: 0.4},…]
                    //         0: {targetMemberLevel: "金卡会员", targetStartPoint: 15001, targetGap: 8082, targetDiscountAmount: 0.4}
                    //         targetDiscountAmount: 0.4
                    //         targetGap: 8082
                    //         targetMemberLevel: "金卡会员"
                    //         targetStartPoint: 15001
                    //         1: {targetMemberLevel: "钻石会员", targetStartPoint: 10001, targetGap: 3082, targetDiscountAmount: 0.5}
                    //         targetDiscountAmount: 0.5
                    //         targetGap: 3082
                    //         targetMemberLevel: "钻石会员"
                    //         targetStartPoint: 10001
                    //计算下一个等级的差距
                    let name = this.currentInfo.customerDTO.userGrowthRecord.currentMemberLevel
                    var currentindex = -1
                    var j = -1
                    for (var tmp of this.bannerList) {
                        j += 1
                        // tmp.point = {
                        //     current: this.currentInfo.customerDTO.userGrowthRecord.currentGrowthValue || 0
                        // }
                        tmp.currentMsg = ''
                        if (tmp.title === name) {
                            //说明是当前等级,其他待定
                            tmp.currentMsg = '当前等级'
                            currentindex = j
                        }
 
 
 
                    }
                    //重新排序,当前等级第一个
                    console.log('会员列表v0',this.bannerList)
                    var newBannerSort = []
                    for (var i = currentindex; i <= 2 * j; i++) {
                        newBannerSort.push(this.bannerList[i % (j + 1)])
                        if (newBannerSort.length >= this.bannerList.length) {
                            break
                        }
                    }
                    this.bannerList = newBannerSort
                    console.log('会员列表',this.bannerList)
                    // if (this.currentInfo.customerDTO.userGrowthRecord.targetMemberInfos) {
                    //     var t = -1
                    //     for (var tmp of this.bannerList) {
                    //         t += 1
                    //         for (var k of this.currentInfo.customerDTO.userGrowthRecord.targetMemberInfos) {
                    //             if (tmp.title === k.targetMemberLevel) {
                    //                 console.log('eq', k, tmp)
                    //                 tmp.point = {
                    //                     current: this.currentInfo.customerDTO.userGrowthRecord
                    //                         .currentGrowthValue || 0,
                    //                     end: k.targetStartPoint || 0,
                    //                 }
                    //             }
                    //         }
                    //     }
                    // }
 
                    this.init = true
                    // this.$nextTick(() => {
                    //     // var name = this.currentInfo.customerDTO.userGrowthRecord.currentMemberLevel
                    //     var index = -1
                    //     for (var tmp of this.bannerList) {
                    //         index += 1
                    //         if (tmp.title === name) {
                    //             // this.$refs.banner3d.swiperChange({
                    //             //     mp: {
                    //             //         detail: {
                    //             //             current: index
                    //             //         }
                    //             //     }
                    //             // })
                    //             this.$refs.banner3d.swiperChangeIndex(index)
 
                    //             break
                    //         }
                    //     }
                    // })
 
                }
            })
 
        },
        data() {
            return {
                init: false,
                bannerList: [{
                    bg: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/74/74cae150ea44463f92abbe1f9dd3c561fKcsrp0hOcNYa1cfb5eb753e56876fddcba7ea1e1a32.png',
                    picture: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/ef/ef96604518db467fbd344c08e48d1fac8jZdk1ED0Yq023d4f86c2ec36975c981ba522c2bfe3f.png',
                    title: '普通会员',
                    // description: '一万年太久,就现在,给你爱',
                    path: '',
                    point: {},
                    key: '1',
                }, {
                    bg: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/25/2534864ad275400b9e8db4042b87bfeaBv7NbzOZG0ptc7fca5df83dcd97fd02b4027518cc593.png',
                    picture: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/07/075db9222f7a41e981c5b263d7210ed5Ztljs5yDHKILd37c3399011f84f401b755477bb8a323.png',
                    title: '银卡会员',
                    // description: '花中樱,鱼乃鲷花中樱,鱼乃鲷',
                    path: '',
                    key: '2',
                    point: {},
 
                    // currentMsg:''
                }, {
                    bg: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/4d/4d8ab63e75ca462fa9e3bb480ff2da68ID5KnLIH9DwM23f9a04d99cc1f3306a8655c1eff34bf.png',
                    picture: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/f1/f192b651606045ddba5c5f04a34a00c2R8MmH6mVsprH81cab47fbe889222f6088f4ca2cf20d5.png',
                    title: '金卡会员',
                    // description: '取材自湘西苗族传统的烟熏文化',
                    path: '',
                    key: '3',
                    point: {},
 
                }, {
                    bg: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/db/db6b0cefdbb949cca9c8da824a5ebdebXsPsk2ROfxZu22f9b09e3feece76753b0df971fdc301.png',
                    picture: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/c9/c94d8f444af94b899d1e1593cebb933eDyZyhyoyDxTRaf60a4d692f097e5d790cdb88fae9d0c.png',
                    title: '钻石会员',
                    // description: '在自己的小世界里,日日好日,夜夜好清宵',
                    path: '',
                    key: '4',
                    point: {},
 
                }],
                swiperConfig: {
                    indicatorDots: true,
                    indicatorColor: 'rgba(255, 255, 255, .4)',
                    indicatorActiveColor: 'rgba(255, 255, 255, 1)',
                    autoplay: false,
                    interval: 3000,
                    duration: 300,
                    circular: true,
                    previousMargin: '58rpx',
                    nextMargin: '58rpx'
                },
                curIndex: 0,
            }
        },
        components: {
            banner3d
        },
 
    }
</script>
 
<style lang="scss" scoped>
    .member-center {
        position: relative;
 
        .member-infos {
            // width: 670rpx;
            padding: 32rpx 58rpx;
            background: linear-gradient(213deg, #F7ECC6 0%, #EEE5CE 100%);
            border-radius: 16rpx;
 
            .desc-info {
                background: #FFFFFF;
                border-radius: 16rpx;
                opacity: 0.55;
                font-size: 24rpx;
                color: #AD790F;
                line-height: 34rpx;
                text-align: left;
                font-style: normal;
                padding: 24rpx;
 
                .icon {
                    width: 78rpx;
                    height: 78rpx;
                    margin: auto;
                    display: block;
                    margin-bottom: 10rpx;
 
                }
 
                .desc {
                    text-align: center;
 
                }
            }
 
            .top-title {
                .left-line {
                    min-width: 54rpx;
                    height: 6rpx;
                    background: linear-gradient(270deg, rgba(226, 157, 17, 0) 0%, #E39D10 100%);
                    border-radius: 4rpx;
                    display: inline-block;
                    margin-right: 20rpx;
                    vertical-align: middle;
                    margin-top: 23rpx;
                }
 
                .right-line {
                    min-width: 54rpx;
                    height: 6rpx;
                    background: linear-gradient(270deg, rgba(226, 157, 17, 0) 0%, #E39D10 100%);
                    border-radius: 4rpx;
                    margin-left: 20rpx;
                    display: inline-block;
                    vertical-align: middle;
                    margin-top: 23rpx;
 
 
                }
 
                .title {
                    font-weight: 600;
                    font-size: 36rpx;
                    color: #AD790F;
                    line-height: 50rpx;
                    text-align: left;
                    font-style: normal;
                }
            }
        }
 
        .protocol {
            font-weight: 400;
            font-size: 28rpx;
            color: #AD790F;
            line-height: 34rpx;
            text-align: center;
            margin-top: 32rpx;
        }
 
        .banner {
            position: relative;
            z-index: 10;
            padding-top: 160rpx;
        }
 
        .member-level-image {
            width: 750rpx;
            min-height: 530rpx;
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            z-index: 1;
        }
    }
</style>