From fb48777cd4c3f086f77b5b26e1d03aebf995f4f5 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期四, 12 九月 2024 18:40:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master-2.0' into master-2.0

---
 sub_pages/customer/self/member-center.vue |  197 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 147 insertions(+), 50 deletions(-)

diff --git a/sub_pages/customer/self/member-center.vue b/sub_pages/customer/self/member-center.vue
index 999f936..1e36a79 100644
--- a/sub_pages/customer/self/member-center.vue
+++ b/sub_pages/customer/self/member-center.vue
@@ -3,7 +3,8 @@
 		<image src="../../../static/images/customer/coupon/member/member-level-bg.png" mode="aspectFit"
 			class="img100 member-level-image"></image>
 		<view class="banner">
-			<banner3d ref="banner3d" v-if="init" :banner-list="bannerList" :swiper-config="swiperConfig"></banner3d>
+			<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">
@@ -15,9 +16,10 @@
 				</view>
 
 			</view> -->
-			<view class="member-infos info bg-white p20 "
-				v-if="currentInfo.customerDTO&&currentInfo.customerDTO.userGrowthRecord
-			&&currentInfo.customerDTO.userGrowthRecord.targetMemberInfos&&currentInfo.customerDTO.userGrowthRecord.targetMemberInfos.length>=1">
+			<!-- 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>
@@ -28,16 +30,52 @@
 						<image class="m-auto icon img100 " mode="scaleToFill"
 							src="../../../static/images/customer/coupon/member/icon-member-info-1.png"></image>
 						<view class="desc">
-							积分达到{{currentInfo.customerDTO.userGrowthRecord.targetMemberInfos[0].targetStartPoint || '-'}}
+							<!-- 积分达到{{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="../../../static/images/customer/coupon/member/icon-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">
 							优惠
-							{{currentInfo.customerDTO.userGrowthRecord.targetMemberInfos[0].targetDiscountAmount || '-'}}元/扎
+							<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>
 
@@ -57,7 +95,7 @@
 				</view>
 			</view>
 			<view class="protocol" @click="goto('/pages/help/content?id=会员协议',false)">会员协议 <uni-icons type="right"
-					size="16" color="#AD790F"></uni-icons>
+					size="14" color="#AD790F"></uni-icons>
 			</view>
 		</view>
 	</view>
@@ -73,10 +111,39 @@
 			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
@@ -97,55 +164,74 @@
 					// 		targetStartPoint: 10001
 					//计算下一个等级的差距
 					let name = this.currentInfo.customerDTO.userGrowthRecord.currentMemberLevel
-
+					var currentindex = -1
+					var j = -1
 					for (var tmp of this.bannerList) {
-						tmp.point = {
-							current: this.currentInfo.customerDTO.userGrowthRecord.currentGrowthValue || 0
-						}
+						j += 1
+						// tmp.point = {
+						// 	current: this.currentInfo.customerDTO.userGrowthRecord.currentGrowthValue || 0
+						// }
 						tmp.currentMsg = ''
 						if (tmp.title === name) {
 							//说明是当前等级,其他待定
 							tmp.currentMsg = '当前等级'
+							currentindex = j
+						}
+
+
+
+					}
+					//重新排序,当前等级第一个
+					var newBannerSort = []
+					for (var i = currentindex; i < 2 * j; i++) {
+						newBannerSort.push(this.bannerList[i % (j + 1)])
+						if (newBannerSort.length >= this.bannerList.length) {
+							break
 						}
 					}
-					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.bannerList = newBannerSort
+
+					// 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
-										}
-									}
-								})
-								break
-							}
-						}
-					})
+					// 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 {
@@ -156,26 +242,36 @@
 					title: '普通会员',
 					// description: '一万年太久,就现在,给你爱',
 					path: '',
-					point: undefined,
+					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: ''
+					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: ''
+					path: '',
+					key: '4',
+					point: {},
+
 				}],
 				swiperConfig: {
 					indicatorDots: true,
@@ -187,7 +283,8 @@
 					circular: true,
 					previousMargin: '58rpx',
 					nextMargin: '58rpx'
-				}
+				},
+				curIndex: 0,
 			}
 		},
 		components: {
@@ -271,7 +368,7 @@
 
 		.protocol {
 			font-weight: 400;
-			font-size: 24rpx;
+			font-size: 28rpx;
 			color: #AD790F;
 			line-height: 34rpx;
 			text-align: center;

--
Gitblit v1.9.3