xuxueyang
2024-09-12 1e2cca44dd7b4cc30f60435d22bc58574f2fd4f0
sub_pages/customer/self/member-center.vue
@@ -68,75 +68,84 @@
<script>
   import banner3d from '@/components/banner3d/banner3d'
   export default {
      async onPullDownRefresh() {
         await this.$store.dispatch('getCurrentInfo')
         uni.stopPullDownRefresh()
      },
      methods: {
      },
      onLoad() {
         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
      async onLoad() {
         await this.$store.dispatch('getCurrentInfo')
         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
            for (var tmp of this.bannerList) {
               tmp.point = {
                  current: this.currentInfo.customerDTO.userGrowthRecord.currentGrowthValue || 0
               }
               tmp.currentMsg = ''
               if (tmp.title === name) {
                  //说明是当前等级,其他待定
                  tmp.currentMsg = '当前等级'
               }
            }
            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,
                  tmp.point = {
                     current: this.currentInfo.customerDTO.userGrowthRecord.currentGrowthValue || 0
                  }
                  tmp.currentMsg = ''
                  if (tmp.title === name) {
                     //说明是当前等级,其他待定
                     tmp.currentMsg = '当前等级'
                  }
               }
               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.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
                              }
                           }
                        }
                     })
                     break
                        })
                        break
                     }
                  }
               }
            })
               })
         }
            }
         })
      },
      data() {
         return {
@@ -208,18 +217,19 @@
            text-align: left;
            font-style: normal;
            padding: 24rpx;
            .icon {
               width: 78rpx;
               height: 78rpx;
               margin: auto;
               display: block;
               margin-bottom: 10rpx;
            }
            .desc{
            .desc {
               text-align: center;
            }
         }