lgh 1 gadu atpakaļ
vecāks
revīzija
ae91667948

+ 16 - 0
apis/main.js

@@ -26,4 +26,20 @@ export const getOrderPage = (data) => {
 	})
 }
 
+// 购买套餐
+export const doPay = (data) => {
+	return request.post({
+		url: '/increase/agent/customer/doPay',
+		data: data
+	})
+}
+
+// 购买套餐
+export const changeAvatar = (data) => {
+	return request.post({
+		url: '/increase/agent/customer/changeAvatar',
+		data: data
+	})
+}
+
 

+ 1 - 1
apis/user.js

@@ -16,7 +16,7 @@ export const login = (data) => {
 		data: data
 	})
 }
-// 登录
+// 获取验证码
 export const sendCode = (data) => {
 	return request.post({
 		url: '/increase/agent/customer/sendCode',

+ 1 - 1
components/no-data/no-data.vue

@@ -50,7 +50,7 @@
 		width: 100%;
 		height: 100%;
 		z-index: 996;
-		padding-top: 160rpx;
+		padding-top: 130rpx;
 	}
 
 	.status-img {

+ 56 - 12
pages/accountRecharge/index.vue

@@ -1,7 +1,7 @@
 <template>
     <view class="account">
         <view class="search flex aic">
-            <u-search placeholder="请输入充值账户" searchIconColor="#2A200A" placeholderColor="#959AA3" bgColor="#F2F3F7" v-model="searchValue" :showAction="false" maxlength="30" height="60rpx" @search="searchMobile"></u-search>
+            <u-search placeholder="请输入充值账户" searchIconColor="#2A200A" placeholderColor="#959AA3" bgColor="#F2F3F7" v-model="searchValue" :showAction="false" maxlength="30" height="60rpx" @search="upCallback"></u-search>
             <view class="date flex aic" @click="show = true">
                 <text>日期</text>
                 <re-icon name="icon-xiala" :customStyle="{ fontSize: '10rpx',marginLeft:'10rpx'}"></re-icon>
@@ -9,23 +9,25 @@
         </view>
         <view class="tabulation">
             <mescroll-body height="100%" ref="mescrollRef" bottom="200" @init="mescrollInit" @down="downCallback" :up="upOption" @up="upCallback">
-                <view class="list">
-                    <view class="list-item">
+                <view class="list" v-if="list.length">
+                    <view class="list-item" v-for="(item,index) in list" :key="index">
                         <view class="top flex aic jcsb">
-                            <text class="word">充值游戏币</text>
-                            <text class="money">+3456</text>
+                            <text class="word">{{item.packageName}}</text>
+                            <text class="money">+{{item.totalAmount}}</text>
                         </view>
                         <view class="btom flex-column">
                             <text>充值账户:178 8394 2382</text>
-                            <text>充值账户:178 8394 2382</text>
-                            <text>充值账户:178 8394 2382</text>
-                            <text>充值账户:178 8394 2382</text>
-                            <text>充值账户:178 8394 2382</text>
-                            <text>充值账户:178 8394 2382</text>
+                            <text>有效期至:{{item.expireTime}}</text>
+                            <text>赠送用户明细:{{item.trafficSize}}</text>
+                            <text>套餐金额:{{item.trafficPrice}}</text>
+                            <text>套餐折扣:178 8394 2382</text>
+                            <text>实付金额:178 8394 2382</text>
+                            <text>预估收益:178 8394 2382</text>
+                            <text>充值时间:{{item.payTime}}</text>
                         </view>
                     </view>
                 </view>
-                <no-data :statusType="2" :top="0" tipsText="暂无数据"></no-data>
+                <no-data :statusType="2" :top="0" tipsText="暂无数据" v-if="!isInit&&!list.length"></no-data>
             </mescroll-body>
         </view>
         <u-datetime-picker ref="datetimePicker" closeOnClickOverlay :show="show" v-model="value" mode="date" @confirm="confirm" @close="show = false" @cancel="show = false"></u-datetime-picker>
@@ -34,23 +36,65 @@
 <script>
 import MescrollMixin from "@/plugins/mescroll/components/mescroll-uni/mescroll-mixins.js"
 import MescrollBody from '@/plugins/mescroll/components/mescroll-uni/mescroll-uni.vue'
+import { getOrderPage } from '@/apis/main'
 export default {
     components: {
         MescrollBody
     },
     data(){
         return{
+            isInit: true, // 初次进入页面
             show:false,
             searchValue:'',
-            value: Number(new Date())
+            value: Number(new Date()),
+            list:[]
         }
     },
+    onShow(){
+        if(!this.isInit){
+            this.initPage()
+        }
+        
+    },
     mixins: [MescrollMixin],
     methods: {
+        // 初始化
+		initPage() {
+            this.$nextTick(()=> {
+                this.mescroll.resetUpScroll()
+			    this.mescroll.scrollTo(0, 300)
+            })
+			
+		},
         confirm(e) {
             console.log('confirm', e)
             this.show = false
             this.date = e.value[0].label
+            this.$nextTick(() => {
+                this.mescroll.resetUpScroll()
+                this.mescroll.scrollTo(0, 300)
+            })
+        },
+        // 获取数据
+        async upCallback(page){
+            const res = await getOrderPage({
+                current:page.num,
+                size:page.size,
+                username:this.searchValue
+            })
+            if (res) {
+                //设置列表数据
+                if (page.num === 1) { //如果是第一页需手动制空列表
+                    this.list = res.records
+                } else {
+                    this.list = this.list.concat(res.records) //追加新数据
+                }
+                this.mescroll.endSuccess(res.records.length, res.total > this.list.length)
+            }else{
+                this.mescroll.endErr()
+            }
+            uni.hideLoading()
+            this.isInit = false
         }
     },
 

+ 68 - 35
pages/gallery/index.vue

@@ -5,16 +5,16 @@
 		<view class="content">
 			<view class="news">
 				<view class="info flex">
-					<re-image imgSrc="/" width="104" height="104"></re-image>
+					<image :src="avatar || defaultAvatar" class="img" width="104" height="104"></image>
 					<view class="info-text flex-column jcsa">
 						<view class="info-top flex">
-							<view class="name">王安安</view>
+							<view class="name">{{name}}</view>
 							<view class="level flex aic">
 								<re-image imgSrc="/retail/main/ic_chuji.png" width="40" height="44"></re-image>
-								<view class="level-text">初级</view>
+								<view class="level-text">{{lvName}}</view>
 							</view>
 						</view>
-						<view class="phone">13630639549</view>
+						<view class="phone">{{username}}</view>
 					</view>
 				</view>
 				<view class="news-total flex jcsa">
@@ -37,7 +37,7 @@
 					<span class="title-line"></span>
 					套餐充值
 				</view>
-				<view class="timer">
+				<!-- <view class="timer">
 					赠送游戏币倒计时
 					<span>
 						<span class="lb" id="day">2</span>
@@ -47,44 +47,44 @@
 						<span class="lb" id="mins">56</span>
 					</span>
-				</view>
+				</view> -->
 			</view>
 			<view class="list-wrapper">
-				<view class="list-item">
+				<view class="list-item" v-for="(item,index) in list" :key="index">
 					<view class="item-wrapper">
-						<view class="sub-title ${item.subTitle ? 'show' : ''}">2</view>
+						<view class="sub-title" v-if="item.name">{{item.name}}</view>
 						<view class="big">
 							<view class="">
 								<view class="flex jcsb aic">
 									<view>
-										<span class="strong">122</span><span class="strong-text">游戏币</span>
+										<span class="strong">{{item.gameCurrency}}</span><span class="strong-text">游戏币</span>
 									</view>
 									<view>
 										<span class="symbol">¥</span>
-										<span class="list-price">23</span>
+										<span class="list-price">{{item.discountPrice}}</span>
 									</view>
 								</view>
-								<view class="original">¥344</view>
+								<view class="original">¥{{item.price}}</view>
 							</view>
 							<view class="msg flex jcsb aic">
 								<view class="msg-left">
-									<span class="zeng ">赠</span>
-									<span class="og"><span class="num">233</span>游戏币</span>
+									<span class="zeng" v-if="item.additionalGameCurrency || item.grabTimes">赠</span>
+									<span class="og" v-if="item.additionalGameCurrency"><span class="num">{{item.additionalGameCurrency}}</span>游戏币</span>
 									<!-- <span class="og">
 										<span class="">+</span>
 										<span class="">2M</span>
 									</span> -->
-									<span class="og red">
+									<span class="og red" v-if="item.additionalGameCurrency && item.grabTimes">
 										<span class=""
 											style="margin-left:2px">+</span>
 										<view class="red-box">
 											<re-image width="30" imgSrc="/retail/main/ic_putonghb.png"></re-image>
-											<span>红包机会x2</span>
+											<span>红包机会x{{item.grabTimes}}</span>
 										</view>
 									</span>
 								</view>
-								<span class="time-text">23天有效</span>
-								<view class="pay-btn" @click="toMall">去充值</view>
+								<span class="time-text">{{item.expireDays}}天有效</span>
+								<view class="pay-btn" @click="toMall(item.id)">去充值</view>
 							</view>
 						</view>
 					</view>
@@ -95,11 +95,9 @@
 </template>
 
 <script>
-	import {
-		toRpx
-	} from '@/utils/calculate.js'
 	import defaultConfig from '@/config/default.js'
-	import { statistics,packagePage } from '@/apis/main'
+	import { packagePage } from '@/apis/main'
+	import { getUserInfo } from '@/apis/user'
 	export default {
 		components: {},
 		computed: {
@@ -112,10 +110,15 @@
 				bannerImage: defaultConfig.ossImgUrl + '/retail/main/img_bgtop.png',
 				title: 'Hello',
 				navBarHeight: uni.getStorageSync('navBarHeight'),
-				sumPayNum: uni.getStorageSync('sumPayNum'),// 总销订单
-				sumGameCurrency: uni.getStorageSync('sumGameCurrency'),// 总销游戏币
-				sumIncome: uni.getStorageSync('sumIncome'),//预估总收益,
+				sumPayNum: uni.getStorageSync('userInfo').sumPayNum,// 总销订单
+				sumGameCurrency: uni.getStorageSync('userInfo').sumGameCurrency,// 总销游戏币
+				sumIncome: uni.getStorageSync('userInfo').sumIncome,//预估总收益,
+				avatar:uni.getStorageSync('avatar'),
+				defaultAvatar:'../../static/image/img_touxiang.png',
+				name:uni.getStorageSync('userInfo').name,
+				lvName:uni.getStorageSync('userInfo').lvName,
 				list:[],
+				username:uni.getStorageSync('username'),
 			}
 		},
 		onLoad() {
@@ -123,22 +126,43 @@
 		},
 
 		methods: {
-			toMall(){
+			 updateAvatarFromStorage() {  
+				// 从本地存储同步获取 avatar 并更新组件状态  
+				this.avatar = uni.getStorageSync('avatar');  
+			},
+			// async getInfo(){
+			// 	const res = await getUserInfo()
+			// 	if(res){
+			// 		const { avatar,sumPayNum,sumPay,sumIncome,sumGameCurrency,name } = res
+			// 		this.avatar = avatar || '../../static/image/img_touxiang.png'
+			// 		this.sumPayNum = sumPayNum
+			// 		this.sumGameCurrency = sumGameCurrency
+			// 		this.sumIncome = sumIncome
+			// 		this.name = name
+			// 		uni.setStorageSync('avatar',avatar)
+			// 		uni.setStorageSync('sumPayNum',sumPayNum)
+			// 		uni.setStorageSync('sumGameCurrency',sumGameCurrency)
+			// 		uni.setStorageSync('sumIncome',sumIncome)
+			// 		uni.setStorageSync('name',name)
+			// 	}
+			// },
+			toMall(id){
 				uni.navigateTo({
-					url: '/pages/mall/mallRecharge/index'
+					url: '/pages/mall/mallRecharge/index?id='+ id
 				})
 			},
 			
 			async getData(){
 				const res = await packagePage()
 				if(res){
-					this.list = res.data.records
+					this.list = res.records
 				}
 				
 			}
 		},
 		onShow() {
 			this.getData()
+			this.updateAvatarFromStorage()
 		},
 	}
 </script>
@@ -152,15 +176,13 @@
 		position: absolute;
 		top: 0;
 		bottom: 0;
-
 		.logo {
 			margin-top: 16rpx;
 			margin-left: 24rpx;
 		}
 
 		.content {
-			padding: 0 32rpx;
-
+			padding: 0 32rpx 120rpx;
 			.news {
 				background: #FFFFFF;
 				box-shadow: 0rpx 6rpx 16rpx 0rpx #E3E6F2;
@@ -169,6 +191,13 @@
 				padding: 40rpx;
 
 				.info {
+					.img{
+						flex-shrink: 0;
+						width: 104rpx;
+						height: 104rpx;
+						border-radius: 8rpx;
+						margin-right: 20rpx;
+					}
 					.info-text {
 						.info-top {
 							.name {
@@ -265,7 +294,7 @@
 
 			.list-wrapper {
 				margin-top: 40rpx;
-
+				
 				.list-item {
 					margin-bottom: 20rpx;
 					position: relative;
@@ -299,7 +328,7 @@
 							padding: 6rpx 16rpx;
 							font-size: 24rpx;
 							color: #fff;
-							line-height: 11rpx;
+							line-height: 22rpx;
 							background: #FF6400;
 							border-radius: 24rpx 0rpx 24rpx 0rpx;
 						}
@@ -339,17 +368,20 @@
 							}
 
 							.strong-text {
-								font-size: 24rpx;
+								font-size: 28rpx;
 								color: #564C47;
 								line-height: 28rpx;
 								font-weight: normal;
 							}
-
+							.hide{
+								display: none;
+							}
 							.msg {
 								margin-top: 4rpx;
 								font-size: 32rpx;
 								color: #2C2B28;
 
+								
 								.msg-left {
 									width: calc(100% - 150rpx);
 									display: flex;
@@ -357,7 +389,7 @@
 									white-space: nowrap;
 									overflow: hidden;
 									font-weight: normal;
-									font-size: 24rpx;
+									font-size: 28rpx;
 									.num{
 
 									}
@@ -377,6 +409,7 @@
 										align-items: center;
 									}
 								}
+								
 
 								.time-text {
 									position: absolute;

+ 15 - 9
pages/login/index.vue

@@ -29,7 +29,7 @@
 	import { toRpx } from '@/utils/calculate.js'
 	import defaultConfig from '@/config/default.js'
     import { navigateTo,phoneValidate,filterPhone,openFilterPhone } from '@/utils/utils.js'
-	import { login,sendCode } from '@/apis/user'
+	import { login,sendCode,getUserInfo } from '@/apis/user'
 	export default {
 		components: {},
 		computed: {
@@ -66,16 +66,20 @@
 			async toLogin(){
 				const res = await login({
 					channel:1,
-					phone:this.phone,
+					username:this.phone,
 					code:this.code,
 				})
+				const { accessToken,username } = res
+				uni.setStorageSync('accessToken', accessToken)
+				uni.setStorageSync('username', username)
+				const userInfo = await getUserInfo()
+				uni.setStorageSync('userInfo',userInfo)
+				uni.setStorageSync('avatar',userInfo.avatar)
 				uni.showToast({
-					title:'登录成功'
-				})
-				setTimeout(() => {
-					uni.redirectTo({
-						url:'/pages/gallery/index'
-					})
+					title: '登录成功'
+				});
+				uni.reLaunch({
+					url:'/pages/gallery/index'
 				})
 			},
             bindPhone() {
@@ -110,7 +114,9 @@
 					})
 					uni.hideLoading();
 					// 这里此提示会被this.start()方法中的提示覆盖
-					uni.showToast('验证码已发送');
+					uni.showToast({
+						title: '验证码已发送'
+					});
 					// 通知验证码组件内部开始倒计时
 					this.$refs.uCode.start();
 				} else {

+ 66 - 19
pages/mall/mallRecharge/index.vue

@@ -17,40 +17,37 @@
 			<view class="info-top">
 				<view class="top-nums flex jcsb aic">
 					<view>
-						<span class="yxb-num">888</span>
+						<span class="yxb-num">{{data.gameCurrency}}</span>
 						<span class="yxb-text">游戏币</span>
 					</view>
 					<view>
 						<span class="price-text">¥</span>
-						<span class="price-num">23</span>
+						<span class="price-num">{{data.discountPrice}}</span>
 					</view>
 				</view>
 				<view class="info-msg flex jcsb aic">
 					<view class="msg-left">
-						<span class="zeng ${additionalGameCurrency || grabTimes || trafficSize ? 'show' : 'hide'}">赠</span>
-						<span class="${additionalGameCurrency ? 'show' : 'hide'}">
-							<span class="game-num">1000</span>游戏币
-						</span>
+						<span class="zeng"  v-if="data.additionalGameCurrency || data.grabTimes">赠</span>
+						<span class="game-num" v-if="data.additionalGameCurrency">{{data.additionalGameCurrency}}游戏币</span>
 						<!-- <span class="og">
 							<span class="${additionalGameCurrency && trafficSize ? 'show' : 'hide'}">+</span>
 							<span class="bold ${trafficSize ? 'show' : 'hide'}">2M</span>
 						</span> -->
-						<span class="og red ${grabTimes? '' : 'hide'}">
-							<span class="${additionalGameCurrency && grabTimes? 'show' : 'hide'}"
-								style="margin-left:2px">+</span>
+						<span class="og red" v-if="data.additionalGameCurrency && data.grabTimes">
+							<span style="margin-left:2px">+</span>
 							<view class="red-box">
-								<!-- <image class="red_img"/> -->
-								<span>红包机会x2</span>
+								<re-image width="30" imgSrc="/retail/main/ic_putonghb.png"></re-image>
+								<span>红包机会x{{data.grabTimes}}</span>
 							</view>
 						</span>
 					</view>
-					<span class="time-text">30天有效</span>
+					<span class="time-text">{{data.expireDays}}天有效</span>
 				</view>
 			</view>
 			<view class="info-btm">
 				<view class="date-wrapper flex jcsb aic">
 					<view>立即生效</view>
-					<view class="date-box">2023年10月23</view>
+					<view class="date-box">{{date}}</view>
 				</view>
 				<!-- <view class="jubaopen-ctrl margin-top-20 flex jcsb aic jbp">
 					<view class="jubaop">
@@ -96,23 +93,73 @@
 				<view>
 					<span class="btn-price-text1">应付款:</span>
 					<span class="btn-price-text2">¥</span>
-					<span class="price-num btn-price-num"></span>
+					<span class="price-num btn-price-num">{{data.discountPrice}}</span>
 				</view>
-				<u-button class="primary-btn" id="buyBtn">确认支付</u-button>
+				<u-button class="primary-btn" id="buyBtn" @click="confirm()">确认支付</u-button>
 			</view>
 		</view>
 	</view>
 </template>
 <script>
-	export default{
+	import { doPay,getPackageDetail } from '@/apis/main'
+	import { wxPay } from '@/utils/pay.js'
+	export default {
 		// components:{
 		// 	'u-input': () => import('@/plugins/uview-ui/components/u-input') 
 		// }
 		data(){
 			return{
-				phone:''
+				phone:'',
+				id:'',
+				data:'',
+				date: ''
 			}
 			
+		},
+		onLoad(params){
+			this.id = params.id
+			this.getData()
+			this.getDate()
+		},
+		methods: {
+			// 获取日期
+			getDate() {
+				let today = new Date();
+				let year = today.getFullYear();
+				let month = today.getMonth() + 1;
+				let day = today.getDate();
+				let formattedDate = year + "年" + month + "月" + day + "日";
+				this.date = formattedDate
+			},
+			async getData() {
+				uni.showLoading()
+				const res = await getPackageDetail({id:this.id})
+				if(res){
+					this.data = res
+				}
+				uni.hideLoading();
+
+			},
+			// 确认支付
+			async confirm(){
+				uni.showLoading();
+				let params = {
+					orderNo: '',
+					packageId: '',
+					payChannel: 1,
+					payType: 1,
+					phone: this.phone,
+				}
+				const res = await doPay(params)
+				uni.hideLoading();
+				const payRes = await wxPay(res)
+				if (payRes) {
+					uni.navigateTo({
+						url: `/pages/mall/mallSuccess/index`
+					})
+				}
+				
+			}
 		}
 	}
 	// const data = reactive({
@@ -209,8 +256,8 @@
 					width: calc(100% - 142rpx);
 					display: flex;
 					align-items: center;
-					font-weight: normal;
-					font-size: 32rpx;
+					font-weight: bold;
+					font-size: 28rpx;
 
 					.game-num{
 						font-weight: bold;

+ 104 - 95
pages/mall/mallSuccess/index.vue

@@ -1,102 +1,111 @@
 <template>
-    <view class="success">
-        <!-- <view class="bgc"></view> -->
-        <view class="content">
-                    <view><nav-bar title="none" icon="none" background="transparent" border-color="transparent" ></nav-bar></view>
-
-            <view class="sur flex-column aic">
-                <re-image imgSrc="/retail/mall/img_quancoin.png" width="240" height="240"></re-image>
-                <view class="texts flex-column">
-                    <text class="suce-text">充值成功</text>
-                    <text>支付金额:</text>
-                    <text>购买游戏币:</text>
-                </view>
-                <view class="btns">
-                    <u-button class="order" @click="toOrder">查看订单</u-button>
-                    <u-button class="home" @click="toHome">返回首页</u-button>
-                </view>
-            </view>
-        </view>
-    </view>
+	<view class="success">
+		<!-- <view class="bgc"></view> -->
+		<view class="content">
+			<view>
+				<nav-bar title="none" icon="none" background="transparent" border-color="transparent"></nav-bar>
+			</view>
+			<view class="sur flex-column aic">
+				<re-image imgSrc="/retail/mall/img_quancoin.png" width="240" height="240"></re-image>
+				<view class="texts flex-column">
+					<text class="suce-text">充值成功</text>
+					<text>支付金额:</text>
+					<text>购买游戏币:</text>
+				</view>
+				<view class="btns">
+					<u-button class="order" @click="toOrder">查看订单</u-button>
+					<u-button class="home" @click="toHome">返回首页</u-button>
+				</view>
+			</view>
+		</view>
+	</view>
 </template>
 <script>
-export default {
-    data(){
-        return{
+	export default {
+		data() {
+			return {
 
-        }
-    },
-    methods: {
-        // 返回订单
-        toOrder(){
-            uni.navigateTo({
-                url: '/pages/mall/mallRecharge/index'
-            })
-        },
-        toHome(){
-            uni.switchTab({
-                url: '/pages/gallery/index'
-            })
-        }
-    },
-}
+			}
+		},
+		methods: {
+			// 返回订单
+			toOrder() {
+				uni.navigateTo({
+					url: '/pages/mall/mallRecharge/index'
+				})
+			},
+			toHome() {
+				uni.switchTab({
+					url: '/pages/gallery/index'
+				})
+			}
+		},
+	}
 </script>
 <style lang="scss" scoped>
-.success{
-    width: 100%;
-    position: relative;
-    .bgc{
-        // position: absolute;
-       
-    }
-    .content{
-        // z-index: 9;
-         width: 100%;
-        height: 544rpx;
-        background: linear-gradient( 180deg, #FFF4D6 0%, rgba(255,251,193,0.62) 40%, rgba(255,221,202,0.32) 100%);
-        padding: 32rpx;
-        .sur{
-            width: 100%;
-            padding: 56rpx 0 64rpx;
-            background: #FFFFFF;
-            border-radius: 24rpx;
-            .texts{
-                margin-top: 48rpx;
-                font-weight: 500;
-                font-size: 28rpx;
-                color: #2C2B28;
-                .suce-text{
-                    font-weight: bold;
-                    font-size: 40rpx;
-                    text-align: center;
-                    margin-bottom: 32rpx;
-                }
-            }
-            .btns{
-                margin-top: 64rpx;
-                button{
-                    width: 414rpx;
-                    height: 96rpx;
-                }
-                .order{
-                    background: linear-gradient( 140deg, #FF8500 0%, #FFA600 100%);
-                    border-radius: 48rpx;
-                    font-weight: bold;
-                    font-size: 40rpx;
-                    color: #FFFFFF;
-                    margin-bottom: 32rpx;
-                }
-                .home{
-                    background: #FFFFFF;
-                    border-radius: 48rpx;
-                    border: 2rpx solid #9FA2B2;
-                    font-weight: 500;
-                    font-size: 40rpx;
-                    color: #2C2B28;
-                }
-            }
-        }
-    }
-}
-    
+	.success {
+		width: 100%;
+		position: relative;
+
+		.bgc {
+			// position: absolute;
+
+		}
+
+		.content {
+			// z-index: 9;
+			width: 100%;
+			height: 544rpx;
+			background: linear-gradient(180deg, #FFF4D6 0%, rgba(255, 251, 193, 0.62) 40%, rgba(255, 221, 202, 0.32) 100%);
+			padding: 32rpx;
+
+			.sur {
+				width: 100%;
+				padding: 56rpx 0 64rpx;
+				background: #FFFFFF;
+				border-radius: 24rpx;
+
+				.texts {
+					margin-top: 48rpx;
+					font-weight: 500;
+					font-size: 28rpx;
+					color: #2C2B28;
+
+					.suce-text {
+						font-weight: bold;
+						font-size: 40rpx;
+						text-align: center;
+						margin-bottom: 32rpx;
+					}
+				}
+
+				.btns {
+					margin-top: 64rpx;
+
+					button {
+						width: 414rpx;
+						height: 96rpx;
+					}
+
+					.order {
+						background: linear-gradient(140deg, #FF8500 0%, #FFA600 100%);
+						border-radius: 48rpx;
+						font-weight: bold;
+						font-size: 40rpx;
+						color: #FFFFFF;
+						margin-bottom: 32rpx;
+					}
+
+					.home {
+						background: #FFFFFF;
+						border-radius: 48rpx;
+						border: 2rpx solid #9FA2B2;
+						font-weight: 500;
+						font-size: 40rpx;
+						color: #2C2B28;
+					}
+				}
+			}
+		}
+	}
 </style>

+ 29 - 11
pages/my/index.vue

@@ -4,16 +4,16 @@
 		<view class="content">
 			<view class="news flex jcsb">
 				<view class="info flex">
-					<view style="width:128rpx;height:128rpx"><image class="img" :src="avatar" @tap="chooseImage"></image></view>
+					<view style="width:128rpx;height:128rpx"><image class="img" :src="avatar || defaultAvatar" @tap="chooseImage"></image></view>
 					<view class="info-text flex-column jcsa">
 						<view class="info-top flex aic">
-							<view class="name">王安安</view>
+							<view class="name">{{info.name}}</view>
 							<view class="level flex aic">
 								<re-image imgSrc="/retail/main/ic_chuji.png" width="54" height="60"></re-image>
-								<view class="level-text">初级</view>
+								<view class="level-text">{{info.lvName}}</view>
 							</view>
 						</view>
-						<view class="phone">13630639549</view>
+						<view class="phone">{{info.username}}</view>
 					</view>
 				</view>
 				<view class="right" @click="logOut"><re-image imgSrc="/retail/my/ic_more.png" width="24" height="24" class="more"></re-image></view>
@@ -41,18 +41,16 @@
 		</view>
 		<u-popup :show="show" @close="close" @open="open">
             <view class="safe-area-inset-bottom">
-                <view class="login-out">退出登录</view>
+                <view class="login-out" @click="outLogin">退出登录</view>
             </view>
 		</u-popup>
 	</view>
 </template>
 
 <script>
-	import {
-		toRpx
-	} from '@/utils/calculate.js'
+	import { toRpx } from '@/utils/calculate.js'
 	import defaultConfig from '@/config/default.js'
-
+	import { changeAvatar } from '@/apis/main'
 	export default {
 		components: {},
 		computed: {
@@ -64,8 +62,10 @@
 			return {
 				show:false,
 				bannerImage: defaultConfig.ossImgUrl + '/retail/my/img_myBgc.png',
-				avatar: '../../static/image/img_touxiang.png',
-				navBarHeight: uni.getStorageSync('navBarHeight')
+				defaultAvatar: '../../static/image/img_touxiang.png',
+				navBarHeight: uni.getStorageSync('navBarHeight'),
+				info: uni.getStorageSync('userInfo'),
+				avatar: uni.getStorageSync('avatar'),
 			}
 		},
 		onLoad() {
@@ -73,6 +73,14 @@
 		},
 
 		methods: {
+			outLogin(){
+				uni.removeStorageSync('accessToken')
+				uni.removeStorageSync('userInfo')
+				uni.removeStorageSync('name')
+				uni.redirectTo({
+					url: '/pages/login/index'
+				})
+			},
 			toAccount(){
 				uni.navigateTo({
 					url: '/pages/accountRecharge/index'
@@ -87,9 +95,19 @@
 					success: function (res) {
 						// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
 						that.avatar  =  res.tempFilePaths[0];
+						that.upAvatar(that.avatar)
+						
 					}
 				});
 			},
+			// 更换头像
+			async upAvatar(avatar) {
+				await changeAvatar({avatar:avatar})
+				uni.setStorageSync('avatar',avatar)
+				uni.showToast({
+					title:'更换成功'
+				})
+			},
 			logOut(){
 				this.show = true
 			},

+ 33 - 10
pages/statistics/index.vue

@@ -6,29 +6,29 @@
 		<view class="content">
 			<view class="news">
 				<view class="info flex">
-					<re-image imgSrc="/" width="104" height="104"></re-image>
+					<image :src="avatar || defaultAvatar" class="img"></image>
 					<view class="info-text flex-column jcsa">
 						<view class="info-top flex">
-							<view class="name">王安安</view>
+							<view class="name">{{info.name}}</view>
 							<view class="level flex aic">
 								<re-image imgSrc="/retail/main/ic_chuji.png" width="40" height="44"></re-image>
-								<view class="level-text">初级</view>
+								<view class="level-text">{{info.lvName}}</view>
 							</view>
 						</view>
-						<view class="phone">13630639549</view>
+						<view class="phone">{{info.username}}</view>
 					</view>
 				</view>
 				<view class="news-total flex jcsa">
 					<view class="total-item">
-						<view class="item-num">156</view>
+						<view class="item-num">{{info.sumPayNum}}</view>
 						<view class="item-text">总销订单</view>
 					</view>
 					<view class="total-item">
-						<view class="item-num">156</view>
+						<view class="item-num">{{info.sumGameCurrency}}</view>
 						<view class="item-text">总销游戏币</view>
 					</view>
 					<view class="total-item">
-						<view class="item-num orange">¥156</view>
+						<view class="item-num orange">¥{{info.sumIncome}}</view>
 						<view class="item-text">预估总收益</view>
 					</view>
 				</view>
@@ -74,8 +74,8 @@
 				</view>
 			</view>
 			<view class="grade">
-				<view class="per-top flex jcsb">
-					<view class="left flex aic">
+				<view class="per-top">
+					<view class="left_dec flex aic">
 						<re-image width="40" height="40" imgSrc="/retail/statistics/ic_yeji.png"></re-image><text style="margin-left: 16rpx">分销等级说明</text>
 					</view>
 					<rich-text :nodes="nodes"></rich-text>
@@ -127,7 +127,15 @@
 				income:'',
 				orderNum:'',
 				sumGameCurrency:'',
-				sumPay:''
+				sumPay:'',
+				info: uni.getStorageSync('userInfo'),
+				// sumPayNum: uni.getStorageSync('userInfo').sumPayNum,// 总销订单
+				// sumGameCurrency: uni.getStorageSync('userInfo').sumGameCurrency,// 总销游戏币
+				// sumIncome: uni.getStorageSync('userInfo').sumIncome,//预估总收益,
+				avatar: uni.getStorageSync('avatar'),
+				// name:uni.getStorageSync('userInfo').name,
+				defaultAvatar:'../../static/image/img_touxiang.png',
+				username:uni.getStorageSync('username'),
 			}
 		},
 		onLoad() {
@@ -135,6 +143,10 @@
 		},
 
 		methods: {
+			updateAvatarFromStorage() {  
+				// 从本地存储同步获取 avatar 并更新组件状态  
+				this.avatar = uni.getStorageSync('avatar');  
+			},
 			changeHandler(e) {
 				console.log(e,'e');
                 const {
@@ -175,6 +187,7 @@
 		onShow() {
 			this.getData()
 			this.getRule()
+			this.updateAvatarFromStorage()
 		},
 	}
 </script>
@@ -205,6 +218,13 @@
 				padding: 40rpx;
 
 				.info {
+					.img{
+						flex-shrink: 0;
+						width: 104rpx;
+						height: 104rpx;
+						border-radius: 8rpx;
+						margin-right: 20rpx;
+					}
 					.info-text {
 						.info-top {
 							.name {
@@ -315,6 +335,9 @@
 				background: linear-gradient( 135deg, #FFDFDF 0%, #FFE4A4 100%);
 				border-radius: 24rpx;
 				margin-top: 22rpx;
+				.left_dec{
+					margin-bottom: 28rpx;
+				}
 			}
 		}
 

+ 3 - 2
request/index.js

@@ -13,7 +13,7 @@ function requestHandle(obj) {
 	const reqData = wipeNulish(obj.data) || {}
 	const accessToken = uni.getStorageSync('accessToken') || ''
 	const tokenType = uni.getStorageSync('tokenType') || ''
-	const Authorization = accessToken && tokenType ? `${tokenType} ${accessToken}` : ''
+	const Authorization = accessToken ? `${accessToken}` : ''
 	const customRes = obj.customRes
 	const plat = platform()
 	const env = getEnv()
@@ -21,6 +21,7 @@ function requestHandle(obj) {
 	const BASE_URL = obj.url.indexOf("http") > -1 || obj.url.indexOf("https://") > -1 ? obj.url : base + obj.url;
 	Object.assign(header, {
 		Authorization: Authorization,
+		accessToken:accessToken,
 		platform: plat
 	})
 	if (plat === 'APP-PLUS') {
@@ -76,7 +77,7 @@ function requestHandle(obj) {
 						url: '/pages/login/index'
 					})
 				}, 1000)
-			} else if (code !== 0) {
+			} else if (code !== 1) {
 				uni.showToast({
 					title: message || '服务器开小差',
 					icon: 'none'

+ 4 - 4
utils/preCheck.js

@@ -53,12 +53,12 @@ if (platform() === 'H5') {
         // let ress = res.data
         // uni.setStorageSync('wxOpenid', ress.wxOpenid)
         // const userInfo = uni.getStorageSync('userInfo')
-        const token = uni.getStorageSync('token')
-        // setTimeout(() => {
+        const token = uni.getStorageSync('accessToken')
+        setTimeout(() => {
           if (token) { // 登录成功 后更新用户信息
             uni.setStorageSync('accessToken', token)
             // uni.setStorageSync('tokenType', token.tokenType)
-            uni.setStorageSync('userInfo', ress)
+            // uni.setStorageSync('userInfo', ress)
           }
           if (!token) { // 未登录过
             const channel = getUrlParamsNormal('channel')
@@ -72,7 +72,7 @@ if (platform() === 'H5') {
               })
             }
           }
-        // })
+        },100)
         
       // })
     // } else {