lgh 1 год назад
Родитель
Сommit
fece9d6bec

+ 16 - 2
apis/main.js

@@ -26,6 +26,14 @@ export const getOrderPage = (data) => {
 	})
 }
 
+// 轮询订单
+export const orderPolling = (data) => {
+	return request.get({
+		url: '/increase/gameCurrency/customer/orderPolling',
+		data: data
+	})
+}
+
 // 购买套餐
 export const doPay = (data) => {
 	return request.post({
@@ -34,7 +42,7 @@ export const doPay = (data) => {
 	})
 }
 
-// 购买套餐
+// 换头像
 export const changeAvatar = (data) => {
 	return request.post({
 		url: '/increase/agent/customer/changeAvatar',
@@ -42,4 +50,10 @@ export const changeAvatar = (data) => {
 	})
 }
 
-
+// 上传图片
+export const FileV3 = (data) => {
+	return request.post({
+		url: '/api/file/upload/FileV3',
+		data: data
+	})
+}

+ 9 - 0
apis/user.js

@@ -16,10 +16,19 @@ export const login = (data) => {
 		data: data
 	})
 }
+
 // 获取验证码
 export const sendCode = (data) => {
 	return request.post({
 		url: '/increase/agent/customer/sendCode',
 		data: data
 	})
+}
+
+// 获取openId
+export const getOpendId = (data) => {
+	return request.get({
+		url: '/increase/agent/customer/wechatapi/getOpendId',
+		data: data
+	})
 }

+ 2 - 1
config/modules/debug.js

@@ -1,7 +1,8 @@
 module.exports = {
 	env: 'debug',
 	baseUrl: 'http://debugapi.mstardance.com',
+	wapUrl: 'http://debugstar.mstardance.com/retail/#/',
 	buyerMock: '/', // 买家mock  /mock/23/
 	sellerMock: '/', // 卖家mock  /mock/25/
-	appid: 'wxd51ce33b1119f45d'
+	appid: 'wx6bf179cc7f0bd36d'
 }

+ 2 - 1
config/modules/dev.js

@@ -1,7 +1,8 @@
 module.exports = {
 	env: 'dev',
 	baseUrl: 'http://debugapi.mstardance.com',
+	wapUrl: 'http://debugstar.mstardance.com/retail/#/',
 	buyerMock: '/', // 买家mock  /mock/23/
 	sellerMock: '/', // 卖家mock  /mock/25/
-	appid: 'wxd51ce33b1119f45d'
+	appid: 'wx6bf179cc7f0bd36d'
 }

+ 2 - 1
config/modules/prod.js

@@ -1,7 +1,8 @@
 module.exports = {
 	env: 'prod',
 	baseUrl: 'http://api.mstardance.com',
+	wapUrl: 'http://star.mstardance.com/retail/#/',
 	buyerMock: '/', // 买家mock  /mock/23/
 	sellerMock: '/', // 卖家mock  /mock/25/
-	appid: 'wxfabdf96c0fafc5b6'
+	appid: 'wx6bf179cc7f0bd36d'
 }

+ 3 - 2
config/modules/test.js

@@ -1,7 +1,8 @@
 module.exports = {
 	env: 'test',
-	baseUrl: 'http://testseafood.mashangyl.com',
+	baseUrl: 'http://testapi.mstardance.com',
+	wapUrl: 'http://teststar.mstardance.com/retail/#/',
 	buyerMock: '/', // 买家mock  /mock/23/
 	sellerMock: '/', // 卖家mock  /mock/25/
-	appid: 'wxd51ce33b1119f45d'
+	appid: 'wx6bf179cc7f0bd36d'
 }

+ 1 - 0
index.html

@@ -9,6 +9,7 @@
         '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
         (coverSupport ? ', viewport-fit=cover' : '') + '" />')
     </script>
+    <!-- <meta base="/retail/"> -->
     <title></title>
     <!--preload-links-->
     <!--app-context-->

+ 20 - 6
manifest.json

@@ -1,6 +1,6 @@
 {
     "name" : "retail-app",
-    "appid" : "",
+    "appid" : "__UNI__46380EC",
     "description" : "",
     "versionName" : "1.0.0",
     "versionCode" : "100",
@@ -69,16 +69,30 @@
         "enable" : false
     },
     "vueVersion" : "2",
-    "h5":{
-        "title":"游戏币分销",
-        "devServer":{
-            "port": 80,
-            "disableHostCheck": true
+    "h5" : {
+        "title" : "游戏币分销",
+        "devServer" : {
+            "port" : 80,
+            "disableHostCheck" : true,
+            "proxy" : {
+                "/api" : {
+                    "target" : "http://api.mstardance.com",
+                    "changeOrigin" : true,
+                    "secure" : false,
+                    "pathRewrite" : {
+                        "/api" : "/"
+                    }
+                }
+            },
+            "https" : false
         },
         "optimization" : {
             "treeShaking" : {
                 "enable" : true
             }
+        },
+        "router" : {
+            "base" : "/retail/"
         }
     }
 }

+ 1 - 1
package-lock.json

@@ -9,7 +9,7 @@
 			"version": "1.0.0",
 			"dependencies": {
 				"jweixin-module": "^1.6.0",
-				"vconsole": "^3.15.0"
+				"vconsole": "^3.15.1"
 			}
 		},
 		"node_modules/@babel/runtime": {

+ 2 - 2
package.json

@@ -50,6 +50,6 @@
 	"main": "pathToMain",
 	"dependencies": {
 		"jweixin-module": "^1.6.0",
-		"vconsole": "^3.15.0"
+		"vconsole": "^3.15.1"
 	}
-}
+}

+ 30 - 20
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="upCallback"></u-search>
+            <u-search placeholder="请输入充值账户" searchIconColor="#2A200A" placeholderColor="#959AA3" bgColor="#F2F3F7" v-model="searchValue" :showAction="false" maxlength="30" height="60rpx" @search="initPage"></u-search>
             <view class="date flex aic" @click="show = true">
                 <text>日期</text>
                 <re-icon name="icon-xiala" :customStyle="{ fontSize: '10rpx',marginLeft:'10rpx'}"></re-icon>
@@ -13,17 +13,17 @@
                     <view class="list-item" v-for="(item,index) in list" :key="index">
                         <view class="top flex aic jcsb">
                             <text class="word">{{item.packageName}}</text>
-                            <text class="money">+{{item.totalAmount}}</text>
+                            <text class="money">¥{{item.totalAmount}}</text>
                         </view>
                         <view class="btom flex-column">
-                            <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>
+                            <text>充值账户:{{item.username || '--'}}</text>
+                            <text>有效期至:{{item.expireTime || '--'}}</text>
+                            <text>赠送用户明细:<span v-if="item.trafficSize">赠送流量{{item.trafficSize}}M</span><span v-if="item.trafficSize && item.grabTimes">+</span><span v-if="item.grabTimes">红包机会x{{item.grabTimes}}</span></text>
+                            <text>套餐金额:¥{{item.realPrice}}</text>
+                            <text>套餐折扣:{{item.deductionRatio || '--'}}</text>
+                            <text>实付金额:¥{{item.totalAmount || 0}}</text>
+                            <text>预估收益:¥{{item.deduction || 0}}</text>
+                            <text>充值时间:{{item.payTime || '--'}}</text>
                         </view>
                     </view>
                 </view>
@@ -44,10 +44,11 @@ export default {
     data(){
         return{
             isInit: true, // 初次进入页面
-            show:false,
+            show: false,
             searchValue:'',
             value: Number(new Date()),
-            list:[]
+            list:[],
+            date:''
         }
     },
     onShow(){
@@ -66,21 +67,30 @@ export default {
             })
 			
 		},
+        getYMD(timestamp){
+            let time = new Date(timestamp)
+            let year = time.getFullYear()
+            let month = time.getMonth() + 1
+            let date = time.getDate()
+            if (month < 10) { month = '0' + month }
+            if (date < 10) { date = '0' + date }
+            return year + '-' + month + '-' + date
+        },
         confirm(e) {
             console.log('confirm', e)
+            this.value = e.value
+            this.date = this.getYMD(this.value)
             this.show = false
-            this.date = e.value[0].label
-            this.$nextTick(() => {
-                this.mescroll.resetUpScroll()
-                this.mescroll.scrollTo(0, 300)
-            })
+            // this.date = e.value[0].label
+            this.initPage()
         },
         // 获取数据
         async upCallback(page){
             const res = await getOrderPage({
-                current:page.num,
-                size:page.size,
-                username:this.searchValue
+                current: page.num,
+                size: page.size,
+                username: this.searchValue,
+                day: this.date
             })
             if (res) {
                 //设置列表数据

+ 23 - 13
pages/gallery/index.vue

@@ -110,15 +110,15 @@
 				bannerImage: defaultConfig.ossImgUrl + '/retail/main/img_bgtop.png',
 				title: 'Hello',
 				navBarHeight: uni.getStorageSync('navBarHeight'),
-				sumPayNum: uni.getStorageSync('userInfo').sumPayNum,// 总销订单
-				sumGameCurrency: uni.getStorageSync('userInfo').sumGameCurrency,// 总销游戏币
-				sumIncome: uni.getStorageSync('userInfo').sumIncome,//预估总收益,
-				avatar:uni.getStorageSync('avatar'),
+				sumPayNum: '',// 总销订单
+				sumGameCurrency: '',// 总销游戏币
+				sumIncome: '',//预估总收益,
+				avatar:'',
 				defaultAvatar:'../../static/image/img_touxiang.png',
-				name:uni.getStorageSync('userInfo').name,
-				lvName:uni.getStorageSync('userInfo').lvName,
+				name:'',
+				lvName:'',
 				list:[],
-				username:uni.getStorageSync('username'),
+				username:'',
 			}
 		},
 		onLoad() {
@@ -126,10 +126,6 @@
 		},
 
 		methods: {
-			 updateAvatarFromStorage() {  
-				// 从本地存储同步获取 avatar 并更新组件状态  
-				this.avatar = uni.getStorageSync('avatar');  
-			},
 			// async getInfo(){
 			// 	const res = await getUserInfo()
 			// 	if(res){
@@ -151,6 +147,20 @@
 					url: '/pages/mall/mallRecharge/index?id='+ id
 				})
 			},
+
+			async getInfo(){
+				const userInfo = await getUserInfo()
+				if(userInfo){
+					const { sumPayNum,sumGameCurrency,sumIncome,avatar,name,lvName,username } = userInfo
+					this.sumPayNum = sumPayNum
+					this.sumGameCurrency = sumGameCurrency
+					this.sumIncome = sumIncome
+					this.avatar = avatar
+					this.name = name
+					this.lvName = lvName
+					this.username = username
+				}
+			},
 			
 			async getData(){
 				const res = await packagePage()
@@ -162,7 +172,7 @@
 		},
 		onShow() {
 			this.getData()
-			this.updateAvatarFromStorage()
+			this.getInfo()
 		},
 	}
 </script>
@@ -182,7 +192,7 @@
 		}
 
 		.content {
-			padding: 0 32rpx 120rpx;
+			padding: 0 32rpx var(--window-bottom);
 			.news {
 				background: #FFFFFF;
 				box-shadow: 0rpx 6rpx 16rpx 0rpx #E3E6F2;

+ 2 - 1
pages/login/index.vue

@@ -45,7 +45,7 @@
                 code:'',
                 tips:'',
 				getCoding: false,
-				wxopenId:uni.getStorageSync('wxOpenId')
+				wxOpenid:uni.getStorageSync('wxOpenid')
 			}
 		},
 		onLoad() {
@@ -68,6 +68,7 @@
 					channel:1,
 					username:this.phone,
 					code:this.code,
+					wxOpenId:this.wxOpenid
 				})
 				const { accessToken,username } = res
 				uni.setStorageSync('accessToken', accessToken)

+ 220 - 49
pages/mall/mallRecharge/index.vue

@@ -3,7 +3,9 @@
 	<view class="mall-recharge">
 		<view class="white-box">
 			<view class="account-text">充值账号</view>
-			<u-input class="account-name" v-model="phone" type="text" maxlength="11" placeholder="请输入手机号" placeholder-style="font-size:32rpx;font-weight:400" fontSize="56rpx" :customStyle="{ padding: '0'}" clearable></u-input>
+			<u-input class="account-name" v-model="phone" type="text" maxlength="11" placeholder="请输入手机号"
+				placeholder-style="font-size:32rpx;font-weight:400" fontSize="56rpx" :customStyle="{ padding: '0'}"
+				clearable></u-input>
 		</view>
 		<view v-if="phone" class="tip flex aic">
 			<re-image imgSrc="/retail/mall/ic_tip.png" width="28" height="28"></re-image>
@@ -22,13 +24,14 @@
 					</view>
 					<view>
 						<span class="price-text">¥</span>
-						<span class="price-num">{{data.discountPrice}}</span>
+						<span class="price-num">{{data.price}}</span>
 					</view>
 				</view>
 				<view class="info-msg flex jcsb aic">
 					<view class="msg-left">
-						<span class="zeng"  v-if="data.additionalGameCurrency || data.grabTimes">赠</span>
-						<span class="game-num" v-if="data.additionalGameCurrency">{{data.additionalGameCurrency}}游戏币</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>
@@ -87,41 +90,84 @@
 		<!-- 支付按钮 -->
 		<view class="btn-wrapper">
 			<view id="checkBox" class="margin-bottom-17">
-				<view class="check-text text-center">点击“确认支付”,即代表您已阅读并同意<span id="agreeEl" class="red">《用户购买协议》</span></view>
+				<view class="check-text text-center">点击“确认支付”,即代表您已阅读并同意<span id="agreeEl" class="red">《用户购买协议》</span>
+				</view>
 			</view>
 			<view class="btns flex jcsb aic safe-area-inset-bottom">
 				<view>
 					<span class="btn-price-text1">应付款:</span>
 					<span class="btn-price-text2">¥</span>
-					<span class="price-num btn-price-num">{{data.discountPrice}}</span>
+					<span class="price-num btn-price-num">{{data.price}}</span>
 				</view>
 				<u-button class="primary-btn" id="buyBtn" @click="confirm()">确认支付</u-button>
 			</view>
 		</view>
+		<!-- <u-popup :show="isPay" mode="center" :round="10">
+			<view class="white-box-pay">
+				<view class="title bold text-center">提示</view>
+				<view class="text">未完成支付请点击<span class="red">“继续支付”</span></view>
+				<view class="text">更换金额或支付方式请点击<span class="red">“取消支付”</span></view>
+				<view class="text">完成支付请点击<span class="red">“完成支付”</span></view>
+				<view class="btn flex jcc" @click="contPay">
+					<view class="primary-btn width100" id="payCon">继续支付</view>
+				</view>
+				<view class="btn flex jcc" @click="cancel">
+					<view class="normal-btn width100" id="cancelBtn">取消支付</view>
+				</view>
+				<view class="btn flex jcc" @click="enterPayRes">
+					<span class="line" id="enterPayRes">完成支付</span>
+				</view>
+			</view>
+		</u-popup> -->
 	</view>
 </template>
 <script>
-	import { doPay,getPackageDetail } from '@/apis/main'
-	import { wxPay } from '@/utils/pay.js'
+	import {
+		doPay,
+		getPackageDetail,
+		orderPolling
+	} from '@/apis/main'
+	import {
+		wxPay
+	} from '@/utils/pay.js'
+	import config from "@/config"
 	export default {
 		// components:{
 		// 	'u-input': () => import('@/plugins/uview-ui/components/u-input') 
 		// }
-		data(){
-			return{
-				phone:'',
-				id:'',
-				data:'',
-				date: ''
-			}
-			
+		data() {
+			return {
+				phone: '',
+				id: '',
+				data: {},
+				date: '',
+				timer: null,
+				time: 1,
+				orderNo: '',
+				isPay:false,
+				wxOpenid:uni.getStorageSync('wxOpenid'),
+			}
+
 		},
-		onLoad(params){
+		onLoad(params) {
 			this.id = params.id
+			this.orderNo = params.orderNo
 			this.getData()
 			this.getDate()
+			// if (params.orderNo) {
+			// 	this.orderNo = params.orderNo
+			// 	this.polling(params.id)
+			// }
 		},
 		methods: {
+			// getOrder(){
+			// 	let orderNo = uni.getStorageSync('orderNo')
+			// 	if(orderNo){
+			// 		this.polling(orderNo)
+			// 		removeStorageSync('orderNo')
+			// 	}
+			// },
+
 			// 获取日期
 			getDate() {
 				let today = new Date();
@@ -133,42 +179,107 @@
 			},
 			async getData() {
 				uni.showLoading()
-				const res = await getPackageDetail({id:this.id})
-				if(res){
+				const res = await getPackageDetail({
+					id: this.id
+				})
+				if (res) {
 					this.data = res
 				}
 				uni.hideLoading();
 
 			},
 			// 确认支付
-			async confirm(){
+			async confirm() {
+				if (!this.phone) {
+					uni.showToast({
+						title: '手机号不能为空',
+						icon: 'none'
+					})
+					return
+				}
 				uni.showLoading();
 				let params = {
-					orderNo: '',
-					packageId: '',
-					payChannel: 1,
+					orderNo: this.orderNo,
+					packageId: this.id,
+					payChannel: 2,
 					payType: 1,
 					phone: this.phone,
+					wxOpenid: this.wxOpenid
 				}
 				const res = await doPay(params)
+				// let redirect_url = encodeURIComponent(
+				// 	`${config.wapUrl}pages/mall/mallRecharge/index?orderNo=${res.orderNo}`)
 				uni.hideLoading();
 				const payRes = await wxPay(res)
 				if (payRes) {
-					uni.navigateTo({
-						url: `/pages/mall/mallSuccess/index`
+					this.polling(res.orderNo)
+					// uni.navigateTo({
+					// 	url: `/pages/mall/mallPay/index?mwebUrl=${res.mwebUrl}`
+					// })
+				}
+
+				// location.href = `${res.mwebUrl}&redirect_url=${redirect_url}`
+			},
+			// contPay(){
+			// 	confirm()
+			// },
+			// // 取消支付
+			// cancel(){
+			// 	this.isPay = false
+			// },
+			// // 完成支付
+			// async enterPayRes(no){
+			// 	const res = await orderPolling({
+			// 		orderNo: no
+			// 	})
+			// 	clearTimeout(timer)
+			// 	if(res.status === 1){
+			// 		uni.navigateTo({
+			// 			url: `/pages/mall/mallSuccess/index?gameCurrency=${this.data.gameCurrency}&price=${this.data.price}`
+			// 		})
+			// 	}else{
+			// 		uni.showToast({
+			// 			title:'还未支付成功'
+			// 		})
+			// 	}
+			// },
+			// 获取支付状态
+			async polling(no) {
+				if (no) {
+					clearTimeout(this.timer)
+					const res = await orderPolling({
+						orderNo: no
 					})
+					if (res) {
+						if (res.status === 1) {
+							uni.navigateTo({
+								url: `/pages/mall/mallSuccess/index?gameCurrency=${this.data.gameCurrency}&price=${this.data.price}`
+							})
+						} else {
+							clearTimeout(this.timer)
+							if (this.times <= 10) {
+								this.times++
+								this.timer = setTimeout(() => {
+									this.polling(no)
+								}, 1000)
+							}
+						}
+					} else {
+						this.times = 1
+					}
 				}
-				
 			}
+
 		}
 	}
 	// const data = reactive({
-		
+
 	// })
 </script>
 <style lang="scss">
 	.mall-recharge {
 		padding: 32rpx;
+
 		.white-box {
 			padding: 48rpx 48rpx 56rpx;
 			background-color: #fff;
@@ -189,28 +300,31 @@
 				line-height: 32rpx;
 			}
 		}
-		.tip{
+
+		.tip {
 			font-size: 24rpx;
 			color: #8B8B8B;
 			margin-top: 16rpx;
 			margin-left: 46rpx;
-			text{
+
+			text {
 				margin-left: 6rpx;
 			}
 		}
+
 		.list-title {
-		  color: #363531;
-		  font-weight: bold;
-		  font-size: 36rpx;
-		  line-height: 36rpx;
-		  margin: 48rpx 0 32rpx;
-		
-		  .title-line {
-		    width: 8rpx;
-		    height: 32rpx;
-		    background-color: #FF8800;
-		    margin-right: 10rpx;
-		  }
+			color: #363531;
+			font-weight: bold;
+			font-size: 36rpx;
+			line-height: 36rpx;
+			margin: 48rpx 0 32rpx;
+
+			.title-line {
+				width: 8rpx;
+				height: 32rpx;
+				background-color: #FF8800;
+				margin-right: 10rpx;
+			}
 		}
 
 		.order-info {
@@ -259,7 +373,7 @@
 					font-weight: bold;
 					font-size: 28rpx;
 
-					.game-num{
+					.game-num {
 						font-weight: bold;
 					}
 				}
@@ -374,16 +488,17 @@
 			color: #2C2B28;
 			font-weight: 500;
 
-			.date-wrapper{
-				
-			}
-			.wx-ctrl{
+			.date-wrapper {}
+
+			.wx-ctrl {
 				margin-top: 78rpx;
-				.check-icon1-i{
+
+				.check-icon1-i {
 					width: 48rpx;
 					height: 48rpx;
 				}
 			}
+
 			.margin-top-40 {
 				margin-top: 40rpx;
 			}
@@ -458,7 +573,7 @@
 			z-index: 200;
 			background-color: rgb(252, 252, 252);
 			border-top: 1rpx solid #eee;
-			box-shadow: 0rpx -4rpx 8rpx 0rpx rgba(109,84,52,0.19);
+			box-shadow: 0rpx -4rpx 8rpx 0rpx rgba(109, 84, 52, 0.19);
 
 			.btn-price-text1 {
 				color: #2C2B28;
@@ -503,9 +618,11 @@
 					color: #FF6400;
 				}
 			}
-			.btns{
+
+			.btns {
 				margin: 24rpx 0 8rpx;
 			}
+
 			.primary-btn {
 				width: 296rpx;
 				height: 96rpx;
@@ -517,5 +634,59 @@
 				margin: 0;
 			}
 		}
+		.white-box-pay {
+			width: 600rpx;
+			background-color: #fff;
+			padding: 60rpx;
+			// border-radius: 32rpx;
+
+			.red {
+				color: #FF591C;
+			}
+
+			.line {
+				text-decoration: underline;
+				font-size: 28rpx;
+			}
+
+			.title {
+				font-size: 36rpx;
+				color: #333;
+				margin-bottom: 40rpx;
+			}
+
+			.text {
+				margin-bottom: 20rpx;
+				font-size: 28rpx;
+				color: #666;
+				line-height: 40rpx;
+			}
+
+			.btn {
+				margin-bottom: 20rpx;
+				
+			}
+			.primary-btn {
+				font-size: 28rpx;
+				padding: 28rpx 60rpx;
+				background-color: #1890ff;
+				color: #fff;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				border-radius: 48rpx;
+			}
+			.normal-btn{
+				font-size: 28rpx;
+				padding: 28rpx 60rpx;
+				background-color: #fff;
+				color: #1890ff;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				border-radius: 48rpx;
+				border: 1px solid #1890ff;
+			}
+		}
 	}
 </style>

+ 9 - 4
pages/mall/mallSuccess/index.vue

@@ -9,8 +9,8 @@
 				<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>
+					<text>支付金额:{{gameCurrency}}</text>
+					<text>购买游戏币:{{price}}</text>
 				</view>
 				<view class="btns">
 					<u-button class="order" @click="toOrder">查看订单</u-button>
@@ -24,14 +24,19 @@
 	export default {
 		data() {
 			return {
-
+				gameCurrency:'',
+				price:''
 			}
 		},
+		onLoad(params){
+			this.gameCurrency = params.gameCurrency,
+			this.price = params.price
+		},
 		methods: {
 			// 返回订单
 			toOrder() {
 				uni.navigateTo({
-					url: '/pages/mall/mallRecharge/index'
+					url: '/pages/accountRecharge/index'
 				})
 			},
 			toHome() {

+ 144 - 16
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 || defaultAvatar" @tap="chooseImage"></image></view>
+					<view style="width:128rpx;height:128rpx"><image class="img" :src="avatar || defaultAvatar" @tap="checkImage"></image></view>
 					<view class="info-text flex-column jcsa">
 						<view class="info-top flex aic">
-							<view class="name">{{info.name}}</view>
+							<view class="name">{{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">{{info.lvName}}</view>
+								<view class="level-text">{{lvName}}</view>
 							</view>
 						</view>
-						<view class="phone">{{info.username}}</view>
+						<view class="phone">{{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>
@@ -29,7 +29,7 @@
 					</view>
 				</view>
 				<view class="menu-item">
-					<view class="item-left flex aic jcsb">
+					<view class="item-left flex aic jcsb" @click="contact">
 						<view class="flex aic">
 							<re-image imgSrc="/retail/my/ic_kefu.png" width="48" height="48"></re-image>
 							<text>联系客服</text>
@@ -39,18 +39,29 @@
 				</view>
 			</view>
 		</view>
-		<u-popup :show="show" @close="close" @open="open">
+		<u-popup :show="show" @close="close" @open="open" safeAreaInsetBottom :round="8">
             <view class="safe-area-inset-bottom">
                 <view class="login-out" @click="outLogin">退出登录</view>
             </view>
 		</u-popup>
+		<u-popup :show="isContact" mode="center" @close="close" @open="open" :round="10">
+			<view class="kefu">
+				<view class="tips">
+					<p>长按或截图保存微信二维码</p>
+					<p>添加好友即可联系客服</p>
+				</view>
+				<image class="contact" :src='kefuImg' @longpress="saveImage"></image>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
 <script>
 	import { toRpx } from '@/utils/calculate.js'
 	import defaultConfig from '@/config/default.js'
+	import config from '@/config'
 	import { changeAvatar } from '@/apis/main'
+	import { getUserInfo } from '@/apis/user'
 	export default {
 		components: {},
 		computed: {
@@ -61,18 +72,47 @@
 		data() {
 			return {
 				show:false,
+				isContact: false,
 				bannerImage: defaultConfig.ossImgUrl + '/retail/my/img_myBgc.png',
+				kefuImg: defaultConfig.ossImgUrl + '/retail/my/wxCon.jpg',
 				defaultAvatar: '../../static/image/img_touxiang.png',
 				navBarHeight: uni.getStorageSync('navBarHeight'),
-				info: uni.getStorageSync('userInfo'),
-				avatar: uni.getStorageSync('avatar'),
+				lvName: '',
+				avatar: '',
+				name:'',
+				username:'',
+				accessToken:''
 			}
 		},
-		onLoad() {
-
+		onShow() {
+			this.getInfo()
 		},
 
 		methods: {
+			saveImage(e){
+				// 获取图片的路径
+				const imagePath = e.currentTarget.src;
+				// 使用uni.saveImageToPhotosAlbum保存图片到系统相册
+				uni.saveImageToPhotosAlbum({
+					filePath: imagePath,
+					success() {
+						uni.showToast({
+							title: '图片保存成功',
+							icon: 'success',
+							duration: 2000
+						});
+					},
+					fail(err) {
+						console.log('保存失败:', err);
+						uni.showToast({
+							title: '图片保存失败',
+							icon: 'none'
+						});
+					}
+				});
+				
+			},
+
 			outLogin(){
 				uni.removeStorageSync('accessToken')
 				uni.removeStorageSync('userInfo')
@@ -81,29 +121,97 @@
 					url: '/pages/login/index'
 				})
 			},
+			// 跳转充值记录
 			toAccount(){
 				uni.navigateTo({
 					url: '/pages/accountRecharge/index'
 				})
 			},
-			chooseImage() {
+			// 联系客服
+			contact(){
+				this.isContact = true
+			},
+
+			// 获取用户信息
+			async getInfo(){
+				const userInfo = await getUserInfo()
+				if(userInfo){
+					const { avatar,name,lvName,username } = userInfo
+					this.avatar = avatar
+					this.name = name
+					this.lvName = lvName
+					this.username = username
+				}
+			},
+
+			// 切换头像
+			checkImage() {
 				var that = this;
+				that.accessToken = uni.getStorageSync('accessToken')
 				uni.chooseImage({
 					count: 1, // 默认9
 					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
 					sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
 					success: function (res) {
-						// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
-						that.avatar  =  res.tempFilePaths[0];
-						that.upAvatar(that.avatar)
-						
+						// that.avatar  =  res.tempFilePaths[0];
+						uni.uploadFile({
+							url: `${config.baseUrl}/api/file/upload/FileV3`,
+							filePath: res.tempFilePaths[0],
+							header:{
+								// 'Content-Type': 'multipart/form-data',
+								'accessToken': that.accessToken
+							},
+							formData: {
+								user: 'test',
+							},
+							success: (res) => {
+								// console.log(res,'res');
+								let data = JSON.parse(res.data)
+								that.upAvatar(data.data)
+								// setTimeout(() => {
+								// 	resolve(data.data)
+								// }, 1000)
+							}
+						})
+					},
+					fail:err => {
+						console.error('选择图片失败',err)
 					}
 				});
 			},
+
+
+			// uploadFilePromise(url) {
+			// 	return new Promise((resolve, reject) => {
+			// 		let a = uni.uploadFile({
+			// 			url: `${config.baseUrl}/api/file/upload/FileV3`,
+			// 			filePath: url,
+			// 			name: 'file',
+			// 			header:{
+			// 				'Content-Type': 'multipart/form-data',
+			// 				'accessToken':uni.setStorageSync('accessToken')
+			// 			},
+			// 			formData: {
+			// 				user: 'test',
+			// 			},
+						
+			// 			success: (res) => {
+			// 				console.log(res,'res');
+			// 				let data = JSON.parse(res.data)
+			// 				setTimeout(() => {
+			// 					resolve(data.data)
+			// 				}, 1000)
+			// 			}
+			// 		});
+			// 	})
+			// },
 			// 更换头像
 			async upAvatar(avatar) {
+				uni.showLoading()
 				await changeAvatar({avatar:avatar})
+				uni.hideLoading()
 				uni.setStorageSync('avatar',avatar)
+				this.avatar = avatar
 				uni.showToast({
 					title:'更换成功'
 				})
@@ -116,6 +224,7 @@
 			},
 			close() {
 				this.show = false
+				this.isContact = false
 				// console.log('close');
 			}
 		},
@@ -231,7 +340,26 @@
 		.login-out{
 			text-align: center;
 			margin: 40rpx 0;
-
 		}
+		.kefu{
+			padding: 40rpx 0;
+			.contact{
+				flex-shrink: 0;
+				object-fit: contain;
+			}
+			.tips {
+				margin-top: 40rpx;
+				// position: fixed;
+				// top: 30rem;
+				// left: 0;
+				// width: 100%;
+				text-align: center;
+				font-size: 32rpx;
+				p{
+					margin-bottom: 20rpx;
+				}
+			}
+		}
+		
 	}
 </style>

+ 31 - 15
pages/news/index.vue

@@ -16,6 +16,7 @@
 					</view>
 				</view>
 			</view>
+			<no-data :statusType="2" :top="0" tipsText="暂无数据" v-if="!isInit&&!list.length"></no-data>
 		</mescroll-body>
 	</view>
 </template>
@@ -30,14 +31,15 @@ export default {
     },
 	data(){
 		return{
-			list: [{
-				sendTime:'2024-3-31 12:85',
-				msg:'消息内容写死的文本',
-				title:'充值信息',
-
-			}],
+			isInit: true, // 初次进入页面
+			list: [],
 		}
 	},
+	onShow(){
+ 		if(!this.isInit){
+            this.initPage()
+        }
+	},
 	mixins: [MescrollMixin],
 	methods: {
 		// 初始化
@@ -46,17 +48,30 @@ export default {
 			this.mescroll.scrollTo(0, 300)
 		},
 
-		async upCallback(){
-			this.mescroll.endErr()
-			const res = await msgPage()
-			if(res.code === 1){
-				this.mescroll.endBySize(res.records.length, res.total)
-			}
-			
+		async upCallback(page){
+			const res = await msgPage({
+				current:page.num,
+                size:page.size,
+			})
+			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
 		},
+
+		// 跳转到信息详情
 		toDetail(id){
 			uni.navigateTo({
-				url:'/pages/system/index?id' + id
+				url:'/pages/system/index?id=' + id
 			})
 		}
 	},
@@ -65,9 +80,10 @@ export default {
 
 <style lang="scss" scoped>
 .news{
-	padding: 32rpx 20rpx;
+	padding: 0 20rpx;
 	.list{
 		.list-item{
+			margin-top: 48rpx;
 			.time{
 				text-align: center;
 				font-size: 26rpx;

+ 26 - 18
pages/statistics/index.vue

@@ -6,7 +6,7 @@
 		<view class="content">
 			<view class="news">
 				<view class="info flex">
-					<image :src="avatar || defaultAvatar" class="img"></image>
+					<image :src="info.avatar || defaultAvatar" class="img"></image>
 					<view class="info-text flex-column jcsa">
 						<view class="info-top flex">
 							<view class="name">{{info.name}}</view>
@@ -92,6 +92,7 @@
 	} from '@/utils/calculate.js'
 	import defaultConfig from '@/config/default.js'
 	import { statistics,getConfig } from '@/apis/statistic'
+	import { getUserInfo } from '@/apis/user'
 	export default {
 		components: {},
 		computed: {
@@ -105,20 +106,20 @@
 				date:'今日',
 				columns:[
 					[{
-						label:'日',
+						label:'日',
 						id:1
 					},{
-						label:'日',
+						label:'日',
 						id:2
 					},{
 						label:'近一周',
-						id:3,
+						id:3
 					},{
 						label:'近一月',
-						id:4,
+						id:4
 					},{
 						label:'近一年',
-						id:5,
+						id:5
 					}]
 				],
 				bannerImage: defaultConfig.ossImgUrl + '/retail/main/img_bgtop.png',
@@ -128,14 +129,13 @@
 				orderNum:'',
 				sumGameCurrency:'',
 				sumPay:'',
-				info: uni.getStorageSync('userInfo'),
+				info: '',
+				defaultAvatar:'../../static/image/img_touxiang.png',
 				// 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'),
+				// name:'',
+				// username:'',
 			}
 		},
 		onLoad() {
@@ -143,10 +143,6 @@
 		},
 
 		methods: {
-			updateAvatarFromStorage() {  
-				// 从本地存储同步获取 avatar 并更新组件状态  
-				this.avatar = uni.getStorageSync('avatar');  
-			},
 			changeHandler(e) {
 				console.log(e,'e');
                 const {
@@ -162,16 +158,27 @@
                 //     // picker为选择器this实例,变化第二列对应的选项
                 //     picker.setColumnValues(1, this.columnData[index])
                 // }
+				
+				
             },
 			// 回调参数为包含columnIndex、value、values
 			confirm(e) {
                 console.log('confirm', e)
                 this.show = false
+				const date = e.value[0].id
 				this.date = e.value[0].label
+				this.getData(date)
+			},
+			async getInfo(){
+				const userInfo = await getUserInfo()
+				if(userInfo){
+					this.info = userInfo
+				}
 			},
-			async getData(){
+			// 获取统计
+			async getData(type=1){
 				uni.showLoading()
-				const res = await statistics()
+				const res = await statistics({type:type})
 				const { income,orderNum,sumGameCurrency,sumPay } = res
 				this.income = income
 				this.orderNum = orderNum
@@ -179,6 +186,7 @@
 				this.sumPay = sumPay
 				uni.hideLoading()
 			},
+			// 获取规则
 			async getRule(){
 				const res = await getConfig()
 				this.nodes = res.lvRule
@@ -187,7 +195,7 @@
 		onShow() {
 			this.getData()
 			this.getRule()
-			this.updateAvatarFromStorage()
+			this.getInfo()
 		},
 	}
 </script>

+ 1 - 1
pages/system/index.vue

@@ -31,7 +31,7 @@ export default {
         async getDetail () {
             const res = await getMsgDetail({msgId:this.id})
             if(res){
-                const { title,sendTime,msg } = res.data
+                const { title,sendTime,msg } = res
                 this.title = title
                 this.sendTime = sendTime
                 this.msg = msg

+ 0 - 1
plugins/uview-ui/components/u-picker/u-picker.vue

@@ -119,7 +119,6 @@ export default {
 		},
 		// 关闭选择器
 		closeHandler() {
-			console.log(this.closeOnClickOverlay,555);
 			if (this.closeOnClickOverlay) {
 				this.$emit('close')
 			}

+ 3 - 2
request/index.js

@@ -57,7 +57,7 @@ function requestHandle(obj) {
 			}
 			if (customRes) {
 				resolve(response[1].data)
-			} else if (code === 424) { // 登录过期
+			} else if (code === 9001) { // 登录过期
 				uni.removeStorageSync('accessToken')
 				uni.removeStorageSync('tokenType')
 				uni.removeStorageSync('userInfo')
@@ -68,10 +68,11 @@ function requestHandle(obj) {
 					return
 				}
 				uni.showToast({
-					title: message,
+					title: '登录已过期',
 					icon: 'none',
 					mask: true
 				})
+				console.log('过期');
 				setTimeout(() => {
 					uni.reLaunch({
 						url: '/pages/login/index'

+ 5 - 4
utils/pay.js

@@ -7,13 +7,14 @@ export const wxPay = (obj) => {
 			WeixinJSBridge.invoke(
 				'getBrandWCPayRequest', {
 					"appId": config.appid, //公众号ID,由商户传入     
-					"timeStamp": obj.wxTimestamp, // cfg.timeStamp, //时间戳,自1970年以来的秒数     
-					"nonceStr": obj.wxNoncestr, // cfg.nonceStr, //随机串     
-					"package": obj.wxPackage, // cfg.packages,
+					"timeStamp": obj.timeStamp, // cfg.timeStamp, //时间戳,自1970年以来的秒数     
+					"nonceStr": obj.nonceStr, // cfg.nonceStr, //随机串     
+					"package": obj.packageValue, // cfg.packages,
 					"signType": obj.signType, // cfg.signType, //微信签名方式:     
-					"paySign": obj.wxSign // cfg.paySign //微信签名 
+					"paySign": obj.paySign // cfg.paySign //微信签名 
 				},
 				function(res) {
+					console.log(res,'respay');
 					if (res.err_msg == "get_brand_wcpay_request:ok") {
 						// 使用以上方式判断前端返回,微信团队郑重提示:
 						//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。

+ 60 - 64
utils/preCheck.js

@@ -5,7 +5,7 @@ import {
   getUrlParamsNormal
 } from '@/utils/utils.js'
 import {
-  getUserInfo,login
+  getUserInfo,login,getOpendId
 } from '@/apis/user.js'
 // import {
 //   logout
@@ -24,81 +24,77 @@ import {
 //   })
 // }
 if (platform() === 'H5') {
-  // const getWxQuery = (name) => {
-  //   return new URL(window.location.href).searchParams.get(name + '')
-  // }
+  const getWxQuery = (name) => {
+    return new URL(window.location.href).searchParams.get(name + '')
+  }
   let openIdSt = ''
-  let station = getUrlParamsNormal('stationType') || uni.getStorageSync('stationType')
-  // if (getEnv() === 'test') {
+  // let station = getUrlParamsNormal('stationType') || uni.getStorageSync('stationType')
+  // if (getEnv() === 'dev') {
   //   const opId = getUrlParamsNormal('wxOpenid') || uni.getStorageSync('wxOpenid')
   //   uni.setStorageSync('wxOpenid', opId)
-  //   if (station) {
-  //     uni.setStorageSync('stationType', station)
-  //   }
+  
+  //   // if (station) {
+  //   //   uni.setStorageSync('stationType', station)
+  //   // }
   //   openIdSt = opId || uni.getStorageSync('wxOpenid')
   // } else {
-  //   openIdSt = uni.getStorageSync('wxOpenid')
-  //   if (station) {
-  //     uni.setStorageSync('stationType', station)
-  //   }
+  openIdSt = uni.getStorageSync('accessToken')
+    // if (station) {
+    //   uni.setStorageSync('stationType', station)
+    // }
   // }
-  // console.log(openIdSt,'openIdSt');
-  // if (!openIdSt) {
-    // const code = getWxQuery('code')
-    // console.log(code,'code');
-    // if (code) {
-      // getUserInfo(station, {
-      //   // code: code
-      // }).then(res => {
-        // let ress = res.data
-        // uni.setStorageSync('wxOpenid', ress.wxOpenid)
-        // const userInfo = uni.getStorageSync('userInfo')
-        const token = uni.getStorageSync('accessToken')
-        setTimeout(() => {
-          if (token) { // 登录成功 后更新用户信息
-            uni.setStorageSync('accessToken', token)
-            // uni.setStorageSync('tokenType', token.tokenType)
+  console.log(openIdSt,'openIdSt');
+  if (!openIdSt) {
+    const code = getWxQuery('code')
+    console.log(code,'code');
+    if (code) {
+      getOpendId({ code: code }).then(res => {
+        const { accessToken,username,wxOpenid } = res
+        uni.setStorageSync('wxOpenid', wxOpenid)
+        // const username = uni.getStorageSync('username')
+        // setTimeout(() => {
+          if (accessToken) { // 登录成功 后更新用户信息
+            uni.setStorageSync('accessToken', accessToken)
+            uni.setStorageSync('username', username)
+            // uni.setStorageSync('wxOpenid', wxOpenid)
             // uni.setStorageSync('userInfo', ress)
+            window.history.go(-1)
           }
-          if (!token) { // 未登录过
-            const channel = getUrlParamsNormal('channel')
-            if (channel === 'qrcode') { // 扫码进入的页面
-              uni.redirectTo({
-                url: '/pages/gallery/index'
-              })
-            } else { // 进入登录
+          if (!accessToken) { // 未登录过
+          //   const channel = getUrlParamsNormal('channel')
+          //   if (channel === 'qrcode') { // 扫码进入的页面
+            //   uni.reLaunch({
+            //     url: '/pages/gallery/index'
+            //   })
+            // } else { // 进入登录
               uni.redirectTo({
                 url: '/pages/login/index'
               })
             }
-          }
-        },100)
-        
-      // })
-    // } else {
-    //   uni.setStorageSync('indexHref', window.location.href)
-    //   if (getEnv() !== 'mock') {
-    //     console.log(22);
-    //     const state = 'retail'
-    //     const redirect_uri = encodeURIComponent(window.location.href)
-    //     const appid = config.appid
-    //     const scope = 'snsapi_userinfo'
-    //     window.location.href =
-    //       `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`
-    //   }
-    // }
-  // } else {
-  //   uni.setStorageSync('indexHref', window.location.href)
-  //   const userInfo = uni.getStorageSync('userInfo')
-  //   if ((userInfo.type === 0 && station === '0') || (userInfo.type !== 0 && station === '1')) { // 站点切团长
+          // }
+        // },100)
+      }).catch(err => {console.log(err,'err')})
+    } else {
+      uni.setStorageSync('indexHref', window.location.href)
+      const state = ''
+      const redirect_uri = window.encodeURIComponent(window.location.href)
+      const appid = config.appid
+      const scope = 'snsapi_base'
+      window.location.href =
+        `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`
+    }
+  } else {
+    uni.setStorageSync('indexHref', window.location.href)
+    const userInfo = uni.getStorageSync('userInfo')
+    if (!userInfo) { // 站点切团长
       // logout().then(() => {
-      //   uni.removeStorageSync('accessToken')
-      //   uni.removeStorageSync('tokenType')
-      //   uni.removeStorageSync('userInfo')
-      //   uni.navigateTo({
-      //     url: '/pages/login/index'
-      //   })
+        // uni.removeStorageSync('accessToken')
+        // uni.removeStorageSync('tokenType')
+        // uni.removeStorageSync('userInfo')
+        uni.navigateTo({
+          url: '/pages/login/index'
+        })
       // })
-//     }
-//   }
+    }
+  }
 }

+ 0 - 0
vue.config.js