hmp преди 4 години
родител
ревизия
35c1c921fd

+ 12 - 0
assets/http/global.js

@@ -19,5 +19,17 @@ global.payStatus={
 	IS_CANCEL:'2'
 	IS_CANCEL:'2'
 }
 }
 
 
+global.wxParams={
+	APPID:'wx9ad53e8c83ae1a51'
+}
+
+global.APPID={
+	nanyue:'wxd78a776416719686',//南粤药业
+	didi:'wxaf35009675aa0b2a',//滴滴出行
+}
+
+
+global.TRANSFORM_PARAMS='95963'
+
 
 
 export default global
 export default global

+ 1 - 1
assets/http/service.js

@@ -41,7 +41,7 @@ http.interceptors.response.use(async (response) => {
 	//toekn过期处理 
 	//toekn过期处理 
 
 
 	//200 返回数据成功 0
 	//200 返回数据成功 0
-	if (response.data.code != 200) {
+	if (response.data.code != 200 && response.data.code !=400) {
 		return Promise.reject(response)
 		return Promise.reject(response)
 	}
 	}
 	return response.data
 	return response.data

+ 234 - 208
components/login.vue

@@ -1,189 +1,209 @@
-<template >
+<template>
 	<view class="">
 	<view class="">
 		<!-- 获取手机号 -->
 		<!-- 获取手机号 -->
 		<u-modal v-model="phoneShow" content="请授权获取手机号">
 		<u-modal v-model="phoneShow" content="请授权获取手机号">
-			<button class="cu-btn btn-bg-color round" style="width: 80%;"  slot="confirm-button" open-type="getPhoneNumber" @getphonenumber="getphonenumber" >
+			<button class="cu-btn btn-bg-color round" style="width: 80%;height: 70rpx;margin-bottom: 20rpx;" slot="confirm-button"
+				open-type="getPhoneNumber" @getphonenumber="getphonenumber">
 				去授权
 				去授权
 			</button>
 			</button>
 		</u-modal>
 		</u-modal>
-		
+
 		<!-- 获取头像昵称 -->
 		<!-- 获取头像昵称 -->
 		<view @touchmove.stop.prevent="clear" v-show="dialogShow">
 		<view @touchmove.stop.prevent="clear" v-show="dialogShow">
 			<view class="popup_mask" @touchmove.stop.prevent="clear"></view>
 			<view class="popup_mask" @touchmove.stop.prevent="clear"></view>
 			<view class="">
 			<view class="">
 				<view class="dt-login-wrap">
 				<view class="dt-login-wrap">
-				  <view class="title">请先登录</view>
-				  <view class="content">
-				  	<view class="userinfo-avatar">
-					   <open-data  type="userAvatarUrl"></open-data>
-				  	</view>
-					<open-data type="userNickName"></open-data>
-					<text class="subtitle">申请获取您的公开信息(昵称,头像)</text>
-				  </view>
-				  <view class="btn-content setBtnCss">
-				  	<button  @click="hide" >暂不登录</button>
-					<button open-type="getUserInfo" @getuserinfo="getuserinfo" >立即登录</button>
-				  </view>
+					<view class="title">请先登录</view>
+					<view class="content">
+						<view class="userinfo-avatar">
+							<open-data type="userAvatarUrl"></open-data>
+						</view>
+						<open-data type="userNickName"></open-data>
+						<text class="subtitle">申请获取您的公开信息(昵称,头像)</text>
+					</view>
+					<view class="btn-content setBtnCss" >
+						<button @click="hide" style="padding: 10rpx 0;">暂不登录</button>
+						<button @click="getUserProfile" style="padding: 10rpx 0;">立即登录</button>
+						<!-- <button v-else open-type="getUserInfo" @getuserinfo="getuserinfo">立即登录</button> -->
+					</view>
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
 	</view>
 	</view>
-	
+
 </template>
 </template>
 <script>
 <script>
-export default {
-	data() {
-		return {
-			//保存时间七天
-			cacheTime:1*24*60*60*7,
-			dialogShow: false,
-			jscode:'',
-			//邀请码
-			inviteCode:'',
-			userInfo:'',
-			sessionKey:'',
-			
-			//获取手机号
-			phoneShow:false
-		};
-	},
-	beforeDestroy() {
-		if(this.timer){
-			clearTimeout(this.timer)
-			this.timer = null
-		}
-	},
-	methods:{
-		show(){
-			//获取邀请码
-			this.inviteCode=this.$cache.get('inviteCode')
-			this.dialogShow=true
-			this.$mpi.wxLogin().then(res => {
-			  this.jscode = res.code
-			})
-			this.setTimer()
-		},
-		hide () {
-		  if(this.timer){
-		    clearTimeout(this.timer)
-		    this.timer = null
-		  }
-		  this.dialogShow=false;
-		  this.$emit('hide')
+	export default {
+		data() {
+			return {
+				canIUseGetUserProfile: false,
+				//保存时间七天
+				cacheTime: 1 * 24 * 60 * 60 * 7,
+				dialogShow: false,
+				jscode: '',
+				//邀请码
+				inviteCode: '',
+				userInfo: '',
+				sessionKey: '',
+
+				//获取手机号
+				phoneShow: false
+			};
 		},
 		},
-		async setTimer(){
-		   let respWx = await this.$mpi.wxLogin()
-		   this.jscode=respWx.code
-		   // 每隔4分钟重新请求 jscode
-		   this.timer = setTimeout(()=>{
-		     this.setTimer()
-		   },240000) 
+		beforeDestroy() {
+			if (this.timer) {
+				clearTimeout(this.timer)
+				this.timer = null
+			}
 		},
 		},
-		async getuserinfo(e) {
-			console.log("获取用户信息",e);
-			if(e.detail.errMsg != 'getUserInfo:ok') {
-			  return
+		created() {
+			if (uni.getUserProfile) {
+				this.canIUseGetUserProfile = false
 			}
 			}
-			this.userInfo=e.detail.userInfo
-			this.dialogShow=false
-			  try{
-				this.respLogin = await this.$api.wxApp.getOpenId({
-					code:this.jscode
+		},
+		methods: {
+			show() {
+				//获取邀请码
+				this.inviteCode = this.$cache.get('inviteCode')
+				this.dialogShow = true
+				this.$mpi.wxLogin().then(res => {
+					this.jscode = res.code
+				})
+				this.setTimer()
+			},
+			hide() {
+				if (this.timer) {
+					clearTimeout(this.timer)
+					this.timer = null
+				}
+				this.dialogShow = false;
+				this.$emit('hide')
+			},
+			async setTimer() {
+				let respWx = await this.$mpi.wxLogin()
+				this.jscode = respWx.code
+				// 每隔4分钟重新请求 jscode
+				this.timer = setTimeout(() => {
+					this.setTimer()
+				}, 240000)
+			},
+			getUserProfile(e) {
+				uni.getUserProfile({
+					desc: '用于获取头像和昵称',
+					success: (res) => {
+						this.userInfo = res.userInfo
+						console.log("getUserProfile获取用户信息", this.userInfo);
+						this.doLogin()
+					}
 				})
 				})
-				let openId=this.respLogin.data.openid
-				let unionid=this.respLogin.data.unionid || ''
-				this.sessionKey=this.respLogin.data.session_key
-				//通过openid查询数据库中该用户是否存在
-				
-				let params={
-					nickName:this.userInfo.nickName,
-					avatar:this.userInfo.avatarUrl,
-					gender:this.userInfo.gender,
-					unionid,
-					openid:openId,
-					province:this.userInfo.province,
-					city:this.userInfo.city
+			},
+			getuserinfo(e) {
+				console.log("getuserinfo获取用户信息", e);
+				if (e.detail.errMsg != 'getUserInfo:ok') {
+					return
 				}
 				}
-				//将openid
-				let resp = await this.$api.loginUser.login(params)
-				if (resp.success) {
-					this.$u.toast('登录成功')
-					//登录成功
-					let obj={
-						openId,
-						sessionKey:this.sessionKey,
-						userId:resp.data.id,
-						phone:resp.data.phone
+				this.userInfo = e.detail.userInfo
+				this.doLogin()
+			},
+			async doLogin() {
+				this.dialogShow = false
+				try {
+					this.respLogin = await this.$api.wxApp.getOpenId({
+						code: this.jscode
+					})
+					let openId = this.respLogin.data.openid
+					let unionid = this.respLogin.data.unionid || ''
+					this.sessionKey = this.respLogin.data.session_key
+					//通过openid查询数据库中该用户是否存在
+					let params = {
+						nickName: this.userInfo.nickName,
+						avatar: this.userInfo.avatarUrl,
+						gender: this.userInfo.gender,
+						unionid,
+						openid: openId,
+						province: this.userInfo.province,
+						city: this.userInfo.city
 					}
 					}
-					//将openid和sessionkey存进缓存中,有效时间为七天
-					this.$cache.put("userInfo",obj)
-					this.$u.vuex('vuex_userId',resp.data.id)
-					if(resp.data.phone){
-					  this.$u.vuex('vuex_phone',resp.data.phone)
+					//将openid
+					let resp = await this.$api.loginUser.login(params)
+					if (resp.success) {
+						this.$u.toast('登录成功')
+						//登录成功
+						let obj = {
+							openId,
+							sessionKey: this.sessionKey,
+							userId: resp.data.id,
+							phone: resp.data.phone
+						}
+						//将openid和sessionkey存进缓存中,有效时间为七天
+						this.$cache.put("userInfo", obj)
+						this.$u.vuex('vuex_userId', resp.data.id)
+						if (resp.data.phone) {
+							this.$u.vuex('vuex_phone', resp.data.phone)
+						}
+						//移除邀请码
+						this.$cache.remove('inviteCode')
+						this.dialogShow = false
+						this.$emit('signIn', resp)
+					} else {
+						uni.showToast({
+							icon: "none",
+							title: "登录失败"
+						})
 					}
 					}
-					//移除邀请码
-					this.$cache.remove('inviteCode')
-					this.dialogShow=false
-					this.$emit('signIn', resp)
-				}else{
+
+				} catch (e) {
+					console.log(e);
 					uni.showToast({
 					uni.showToast({
-						icon:"none",
-						title:"登录失败"
+						icon: "none",
+						title: "登录失败"
 					})
 					})
+				} finally {
+					if (this.timer) {
+						clearTimeout(this.timer)
+						this.setTimer()
+					}
 				}
 				}
-				
-			  }catch(e){
-				  console.log(e);
-				  uni.showToast({
-					icon:"none",
-					title:"登录失败"
-				  })
-			  }finally{
-				if(this.timer){
-				  clearTimeout(this.timer)
-				  this.setTimer()
+			},
+			clear() {
+				return
+			},
+			//获取手机号
+			showPhoneModal() {
+				this.phoneShow = true
+			},
+			getphonenumber(e) {
+				this.$emit('getphonenumber')
+				let params = {
+					sessionKey: this.sessionKey,
+					encryptedData: e.detail.encryptedData,
+					iv: e.detail.iv
 				}
 				}
-		     }
-		},
-		clear(){
-			return
-		},
-		//获取手机号
-		showPhoneModal(){
-			this.phoneShow=true
-		},
-		getphonenumber(e){
-			this.$emit('getphonenumber')
-			let params={
-				sessionKey:this.sessionKey,
-				encryptedData:e.detail.encryptedData,
-				iv:e.detail.iv
-			}
-			this.$api.wxApp.getOpenData(params).then(res=>{
-				if (res.success) {
-					let obj=JSON.parse(res.data)
-					let phone=obj.phoneNumber
-					this.cachePhone(phone)
+				this.$api.wxApp.getOpenData(params).then(res => {
+					if (res.success) {
+						let obj = JSON.parse(res.data)
+						let phone = obj.phoneNumber
+						this.cachePhone(phone)
+					}
+				})
+			},
+			cachePhone(phone) {
+				let userInfo = this.$cache.get('userInfo')
+				let params = {
+					id: userInfo.userId,
+					phone
 				}
 				}
-			})
-		},
-		cachePhone(phone){
-			let userInfo=this.$cache.get('userInfo')
-			let params={
-				id:userInfo.userId,
-				phone
+				this.$api.loginUser.submit(params).then(res => {
+					if (res.success) {
+						userInfo.phone = phone
+						this.$cache.put('userInfo', userInfo)
+						this.$u.vuex('vuex_phone', phone)
+					}
+				})
 			}
 			}
-			this.$api.loginUser.submit(params).then(res=>{
-				if (res.success) {
-					userInfo.phone=phone
-					this.$cache.put('userInfo',userInfo)
-					this.$u.vuex('vuex_phone',phone)
-				}
-			})
+
 		}
 		}
-		
-	}
-};
+	};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
@@ -198,6 +218,7 @@ export default {
 		z-index: 98;
 		z-index: 98;
 
 
 	}
 	}
+
 	.dt-login-wrap {
 	.dt-login-wrap {
 		position: fixed;
 		position: fixed;
 		border-radius: 16rpx;
 		border-radius: 16rpx;
@@ -209,61 +230,66 @@ export default {
 		margin-left: -280rpx;
 		margin-left: -280rpx;
 		right: 0;
 		right: 0;
 		text-align: center;
 		text-align: center;
-		
-		  .title {
-			 padding-top:40upx;
-			 font-size: 34upx;
-			 font-weight: bold;
-		  }
-		  .content{
-			  display: flex;
-			  justify-content: center;
-			  align-items: center;
-			  flex-direction: column;
-			  padding-top: 30rpx;
-			  padding-bottom: 150rpx;
-			  .userinfo-avatar {
-			    overflow:hidden;  
-			    display: block;  
-			    width: 140rpx;  
-			    height: 140rpx; 
-				 margin: 20rpx 20rpx 40rpx;
-			    border-radius: 50%;  
-			    border: 2px solid #fff;  
-			  } 
-		  }
-		  .subtitle {
+
+		.title {
+			padding-top: 40upx;
+			font-size: 34upx;
+			font-weight: bold;
+		}
+
+		.content {
+			display: flex;
+			justify-content: center;
+			align-items: center;
+			flex-direction: column;
+			padding-top: 30rpx;
+			padding-bottom: 150rpx;
+
+			.userinfo-avatar {
+				overflow: hidden;
+				display: block;
+				width: 140rpx;
+				height: 140rpx;
+				margin: 20rpx 20rpx 40rpx;
+				border-radius: 50%;
+				border: 2px solid #fff;
+			}
+		}
+
+		.subtitle {
 			color: #7e7e7e;
 			color: #7e7e7e;
 			font-size: 26upx;
 			font-size: 26upx;
 			margin-top: 30rpx;
 			margin-top: 30rpx;
-		  }
-		  .btn-content{
-			  display: flex;
-			  width: 100%;
-			  border-radius: 0;
-			  border-top:1upx solid #ebebeb;
-			  
-			  button{
-				  border:none;
-				  width: 50%;
-				  font-size: 30rpx;
-				  background-color: #FFFFFF;
-				  color:#66656a;
-			  }
-			  
-			  button:first-child{
-				  border-right: 1rpx solid #ebebeb;
-				  border-radius: 0 0 0 18rpx;
-			  }
-			  
-			  button:last-child{
-			  	color: #2f7ff5;
+		}
+
+		.btn-content {
+			display: flex;
+			width: 100%;
+			border-radius: 0;
+			border-top: 1upx solid #ebebeb;
+
+			button {
+				border: none;
+				width: 50%;
+				font-size: 30rpx;
+				background-color: #FFFFFF;
+				color: #66656a;
+			}
+
+			button:first-child {
+				border-right: 1rpx solid #ebebeb;
+				border-radius: 0 0 0 18rpx;
+			}
+
+			button:last-child {
+				color: #2f7ff5;
 				border-radius: 0 0 18rpx 0;
 				border-radius: 0 0 18rpx 0;
-			  }
-			 
-		  }
-		  .btn-content button::after{
-			  border: none;
-		  }
+			}
+
+		}
+
+		.btn-content button::after {
+			border: none;
+		}
 	}
 	}
-</style>
+</style>

+ 19 - 0
package-lock.json

@@ -9,6 +9,15 @@
       "resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.4.4.tgz",
       "resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.4.4.tgz",
       "integrity": "sha512-EzUqM5uDg3ZauhnDj9bJp8OVrO/J1JHRktrO3kkoEtK6sECU/F87GtVVpVActyKAMLOSw65yIfeF17Yl+ctaNA=="
       "integrity": "sha512-EzUqM5uDg3ZauhnDj9bJp8OVrO/J1JHRktrO3kkoEtK6sECU/F87GtVVpVActyKAMLOSw65yIfeF17Yl+ctaNA=="
     },
     },
+    "hotp-totp-generator": {
+      "version": "1.1.3",
+      "resolved": "https://registry.nlark.com/hotp-totp-generator/download/hotp-totp-generator-1.1.3.tgz",
+      "integrity": "sha1-OrB48CnCqFhYjp9K8RS+ujwxOIM=",
+      "requires": {
+        "moment": "^2.19.3",
+        "pad-component": "0.0.1"
+      }
+    },
     "jssha": {
     "jssha": {
       "version": "3.2.0",
       "version": "3.2.0",
       "resolved": "https://registry.npmjs.org/jssha/-/jssha-3.2.0.tgz",
       "resolved": "https://registry.npmjs.org/jssha/-/jssha-3.2.0.tgz",
@@ -22,6 +31,16 @@
         "@dcloudio/types": "^2.0.16"
         "@dcloudio/types": "^2.0.16"
       }
       }
     },
     },
+    "moment": {
+      "version": "2.29.1",
+      "resolved": "https://registry.nlark.com/moment/download/moment-2.29.1.tgz",
+      "integrity": "sha1-sr52n6MZQL6e7qZGnAdeNQBvo9M="
+    },
+    "pad-component": {
+      "version": "0.0.1",
+      "resolved": "https://registry.npm.taobao.org/pad-component/download/pad-component-0.0.1.tgz",
+      "integrity": "sha1-rR8izhvw/cDW3dkIrxfzUaQEuKw="
+    },
     "tki-qrcode": {
     "tki-qrcode": {
       "version": "0.1.6",
       "version": "0.1.6",
       "resolved": "https://registry.npmjs.org/tki-qrcode/-/tki-qrcode-0.1.6.tgz",
       "resolved": "https://registry.npmjs.org/tki-qrcode/-/tki-qrcode-0.1.6.tgz",

+ 1 - 0
package.json

@@ -10,6 +10,7 @@
   "author": "",
   "author": "",
   "license": "ISC",
   "license": "ISC",
   "dependencies": {
   "dependencies": {
+    "hotp-totp-generator": "^1.1.3",
     "luch-request": "^3.0.6",
     "luch-request": "^3.0.6",
     "tki-qrcode": "^0.1.6",
     "tki-qrcode": "^0.1.6",
     "totp-generator": "0.0.9",
     "totp-generator": "0.0.9",

+ 44 - 47
pages.json

@@ -3,14 +3,7 @@
 		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
 		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
 	},
 	},
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
-		{
-			"path": "pages/gain/gain",
-			"style": {
-				"navigationBarTitleText": "赚积分",
-				"enablePullDownRefresh": false
-			}
 
 
-		},
 		{
 		{
 			"path": "pages/mine/mine",
 			"path": "pages/mine/mine",
 			"style": {
 			"style": {
@@ -18,6 +11,15 @@
 				"navigationBarTitleText": "我的"
 				"navigationBarTitleText": "我的"
 			}
 			}
 		},
 		},
+		{
+			"path": "pages/gain/gain",
+			"style": {
+				"navigationBarTitleText": "赚积分",
+				"enablePullDownRefresh": false
+			}
+
+		},
+
 		{
 		{
 			"path": "pages/consume/consume",
 			"path": "pages/consume/consume",
 			"style": {
 			"style": {
@@ -25,14 +27,14 @@
 				"navigationBarTitleText": "花积分"
 				"navigationBarTitleText": "花积分"
 			}
 			}
 		}, {
 		}, {
-			"path": "pages/mine/card/card",
+			"path": "pages/mine/setting/setting",
 			"style": {
 			"style": {
-				"navigationBarTitleText": "卡包",
+				"navigationBarTitleText": "设置",
 				"enablePullDownRefresh": false
 				"enablePullDownRefresh": false
 			}
 			}
 
 
 		}, {
 		}, {
-			"path": "pages/mine/card/pay-setting",
+			"path": "pages/mine/setting/pay-setting",
 			"style": {
 			"style": {
 				"navigationBarTitleText": "支付设置",
 				"navigationBarTitleText": "支付设置",
 				"enablePullDownRefresh": false
 				"enablePullDownRefresh": false
@@ -93,7 +95,8 @@
 			"path": "pages/checkstand/pay-qrcode",
 			"path": "pages/checkstand/pay-qrcode",
 			"style": {
 			"style": {
 				"navigationBarTitleText": "付款码",
 				"navigationBarTitleText": "付款码",
-				"backgroundColor": "#007AFF",
+				"navigationBarTextStyle": "white",
+				"navigationBarBackgroundColor": "#18b566",
 				"enablePullDownRefresh": false
 				"enablePullDownRefresh": false
 			}
 			}
 		}, {
 		}, {
@@ -159,35 +162,29 @@
 				"enablePullDownRefresh": false
 				"enablePullDownRefresh": false
 			}
 			}
 
 
+		}, {
+			"path": "pages/userBank/userBank",
+			"style": {
+				"navigationBarTitleText": "银行",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/userBank/add",
+			"style": {
+				"navigationBarTitleText": "添加银行",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/mine/myInfo",
+			"style": {
+				"navigationBarTitleText": "我的资料",
+				"enablePullDownRefresh": false
+			}
+
 		}
 		}
-	    ,{
-            "path" : "pages/userBank/userBank",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "银行",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/userBank/add",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "添加银行",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/mine/myInfo",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "我的资料",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-    ],
+	],
 	"tabBar": {
 	"tabBar": {
 		"color": "#555555",
 		"color": "#555555",
 		"backgroundColor": "#FFFFFF",
 		"backgroundColor": "#FFFFFF",
@@ -196,10 +193,10 @@
 		"list": [
 		"list": [
 
 
 			{
 			{
-				"pagePath": "pages/gain/gain",
-				"text": "赚积分",
-				"selectedIconPath": "static/tarbar/gain-points1.png",
-				"iconPath": "static/tarbar/gain-points.png"
+				"pagePath": "pages/mine/mine",
+				"text": "我的",
+				"selectedIconPath": "static/tarbar/mine1.png",
+				"iconPath": "static/tarbar/mine.png"
 			},
 			},
 			{
 			{
 				"pagePath": "pages/consume/consume",
 				"pagePath": "pages/consume/consume",
@@ -208,10 +205,10 @@
 				"iconPath": "static/tarbar/consume-points.png"
 				"iconPath": "static/tarbar/consume-points.png"
 			},
 			},
 			{
 			{
-				"pagePath": "pages/mine/mine",
-				"text": "我的",
-				"selectedIconPath": "static/tarbar/mine1.png",
-				"iconPath": "static/tarbar/mine.png"
+				"pagePath": "pages/gain/gain",
+				"text": "赚积分",
+				"selectedIconPath": "static/tarbar/gain-points1.png",
+				"iconPath": "static/tarbar/gain-points.png"
 			}
 			}
 		]
 		]
 	},
 	},

+ 7 - 12
pages/agent/pay.vue

@@ -66,12 +66,10 @@
 				this.current = index;
 				this.current = index;
 			},
 			},
 			async pay() {
 			async pay() {
-				let now=new Date()
-				let min=now.getMinutes()
-				now.setMinutes(min + 30)
-				let expireTime=this.$dateTime.format(now)
-				
+				let expireTime= this.$dateTime.getExpireTime(5)
 				let billRecord={
 				let billRecord={
+					appId:this.$global.wxParams.APPID,
+					openId:this.$cache.get('userInfo').openId,
 					userId:this.vuex_userId,
 					userId:this.vuex_userId,
 					price:this.detail.cost,
 					price:this.detail.cost,
 					type:this.$global.orderType.AGENT_CHARGE,
 					type:this.$global.orderType.AGENT_CHARGE,
@@ -88,14 +86,11 @@
 					orderId:resp.data,
 					orderId:resp.data,
 					payStatus:this.$global.payStatus.IS_WAIT
 					payStatus:this.$global.payStatus.IS_WAIT
 				}
 				}
-				this.$api.pay.payOrder(params).then(res=>{
-					if (res.success) {
-						uni.navigateTo({
-							url:"../webview/webview?url="+res.data.qrCodeUrl
-						})
-					}
+				let res=await this.$api.pay.payOrder(params)
+				let prePayTn= JSON.parse(res.data.prePayTn)
+				this.$mpi.requestPayment(prePayTn).then(()=>{
+					this.successShow = true;
 				})
 				})
-				// this.successShow = true;
 			},
 			},
 			confirm() {
 			confirm() {
 				this.successShow = false
 				this.successShow = false

+ 150 - 97
pages/checkstand/index.vue

@@ -1,126 +1,179 @@
 <template>
 <template>
 	<view class="check-panel flex-direction">
 	<view class="check-panel flex-direction">
-			<image :src="logo" class="buyer-logo"></image>
-			<view class="title center">{{buyer}}</view>
-			<view class="input-content">
-				<view class="tips">交易金额</view>
-				<view class="input-bar center" @tap="show=true">
-					<view class="icon center">¥</view>
-					<view class="input center">
-						<view>{{orderAmount}}</view>
-						<view class="cusor"></view>
-					</view>
+		<image :src="shopDetail.cover" class="buyer-logo"></image>
+		<view class="title center">{{shopDetail.name}}</view>
+		<view class="input-content">
+			<view class="tips">交易金额</view>
+			<view class="input-bar center" @tap="show=true">
+				<view class="icon center">¥</view>
+				<view class="input center">
+					<view>{{orderAmount}}</view>
+					<view class="cusor"></view>
 				</view>
 				</view>
-				<view style="height: 50rpx;"></view>
-				<u-button class="button" type="warning" @click="$jump('/pages/checkstand/order-res')">付款</u-button>
 			</view>
 			</view>
-			
-			<view  class="bottom-line center"> -- 联兑通提供技术支持 --</view>
-			<u-keyboard 
-				ref="uKeyboard" 
-				:show-tips="false"
-				:safe-area-inset-bottom="true" 
-				:mask="false"
-				v-model="show" 
-				@change="handleInput" 
-				@backspace="handleDelete"
-			></u-keyboard>
+			<view style="height: 50rpx;"></view>
+			<u-button  class="button" type="warning" @click="pay">付款</u-button>
 		</view>
 		</view>
+
+		<view class="bottom-line center"> -- 联兑通提供技术支持 --</view>
+		<u-keyboard ref="uKeyboard" :show-tips="false" :safe-area-inset-bottom="true" :mask="false" v-model="show"
+			@change="handleInput" @backspace="handleDelete"></u-keyboard>
+	</view>
 </template>
 </template>
 
 
 <script>
 <script>
 	export default {
 	export default {
-		onLoad(option) {
-		},
+		onLoad(option) {},
 		data() {
 		data() {
 			return {
 			return {
 				show: true,
 				show: true,
-				logo: "/static/bank/ABC.png",
-				buyer: "中国招商银行",
+				logo: "/static/bank/CMBCHINA.png",
+				buyer: "联兑通",
 				orderAmount: '',
 				orderAmount: '',
+				shopId:'',
+				shopDetail:{}
 			}
 			}
 		},
 		},
+		onLoad(options) {
+			this.shopId=options.shopId || '-1'
+			this.fetchShopDetail()
+		},
 		methods: {
 		methods: {
-			handleInput(num){
-							if(this.orderAmount.length>12) {
-								return
-							}
-							this.orderAmount =this.orderAmount + num
-						},
-						handleDelete(){
-							if(this.$isEmpty(this.orderAmount)){
-								return
-							}
-							this.orderAmount = this.orderAmount.substr(0,this.orderAmount.length-1)
-						},
+			fetchShopDetail(){
+				this.$api.shop.detail({id:this.shopId}).then(res=>{
+					if (this.$isEmpty(res.data)) {
+						this.$dialog.showModal('获取不到商户信息',false).then(()=>{
+							uni.navigateBack({
+								delta:1
+							})
+						})
+					}else{
+						this.shopDetail=res.data
+					}
+				}).catch(err=>{
+					this.$dialog.showModal('获取不到商户信息',false).then(()=>{
+						uni.navigateBack({
+							delta:1
+						})
+					})
+				})
+			},
+			handleInput(num) {
+				if (this.orderAmount.length > 12) {
+					return
+				}
+				this.orderAmount = this.orderAmount + num
+			},
+			handleDelete() {
+				if (this.$isEmpty(this.orderAmount)) {
+					return
+				}
+				this.orderAmount = this.orderAmount.substr(0, this.orderAmount.length - 1)
+			},
+			async pay(){
+				let expireTime= this.$dateTime.getExpireTime(5)
+				
+				let params={
+					shopId:this.shopId,
+					loginUserId:this.vuex_userId,
+					money:this.orderAmount,
+					billsTitle:'用户支付',
+					expireTime,
+					appId:this.$global.wxParams.APPID,
+					openId:this.$cache.get('userInfo').openId,
+					type:1 //type: 1-用户扫商户收款码支付 2-商户扫用户付款码支付
+				}
+				let resp=await this.$api.loginUser.payBefore(params)
+				let obj={
+					orderType:this.$global.orderType.USER_PAY,
+					orderId:resp.data.id,
+					payStatus:this.$global.payStatus.IS_WAIT
+				}
+				let res=await this.$api.pay.payOrder(obj)
+				let prePayTn= JSON.parse(res.data.prePayTn)
+				this.$mpi.requestPayment(prePayTn).then(()=>{
+					uni.navigateTo({
+						url:"/pages/checkstand/order-res?orderId="+resp.data.id
+					})
+				})
+			}
 		}
 		}
 	}
 	}
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
-	.check-panel{
-			.buyer-logo{
-				width: 100rpx;
+	.check-panel {
+		.buyer-logo {
+			width: 100rpx;
+			height: 100rpx;
+			margin-top: 50rpx;
+			margin-left: calc(50% - 50rpx);
+		}
+
+		.title {
+			height: 70rpx;
+			letter-spacing: 3rpx;
+			color: #5D5D5D;
+		}
+
+		.input-content {
+			padding: 50rpx;
+			position: absolute;
+			top: 280rpx;
+			bottom: 0;
+			left: 0;
+			right: 0;
+			background-color: #FFFFFF;
+			width: 100%;
+			border-radius: 25rpx 25rpx 0 0;
+
+			.tips {
 				height: 100rpx;
 				height: 100rpx;
-				margin-top: 50rpx;
-				margin-left: calc(50% - 50rpx);
-			}
-			.title{
-				height: 70rpx;
-				letter-spacing: 3rpx;
-				color: #5D5D5D;
+				font-size: 30rpx;
+				display: flex;
+				justify-content: left;
+				align-items: center;
 			}
 			}
-			.input-content{
-				padding: 50rpx;
-				position: absolute;
-				top: 280rpx;
-				bottom: 0;
-				left: 0;
-				right: 0;
-				background-color: #FFFFFF;
-				width: 100%;
-				border-radius: 25rpx 25rpx 0 0;
-				.tips{
-					height: 100rpx;
-					font-size: 30rpx;
-					display: flex;
-					justify-content: left;
-					align-items: center;
+
+			.input-bar {
+				height: 150rpx;
+				border-bottom: 1rpx solid #DDDDDD;
+
+				.icon {
+					width: 15%;
+					font-size: 70rpx;
+					font-weight: 900;
+					height: 100%;
 				}
 				}
-				.input-bar{
-					height: 150rpx;
-					border-bottom: 1rpx solid #DDDDDD;
-					.icon{
-						width: 15%;
-						font-size: 70rpx;
-						font-weight: 900;
-						height: 100%;
-					}
-					.input{
-						width: 85%;
-						height: 100%;
-						overflow: hidden;
-						font-size: 70rpx;
-					}
-					.cusor{
-						width: 2rpx;
-						height: 80%;
-						background-color: #FD711B;
-						animation: blink 1500ms infinite ease-in-out;
-					}
+
+				.input {
+					width: 85%;
+					height: 100%;
+					overflow: hidden;
+					font-size: 70rpx;
+				}
+
+				.cusor {
+					width: 2rpx;
+					height: 80%;
+					background-color: #FD711B;
+					animation: blink 1500ms infinite ease-in-out;
 				}
 				}
 			}
 			}
 		}
 		}
-		.bottom-line{
-			position: absolute;
-			bottom: 50rpx;
-			left: 0;
-			width: 100%;
-			color: #dddddd;
+	}
+
+	.bottom-line {
+		position: absolute;
+		bottom: 50rpx;
+		left: 0;
+		width: 100%;
+		color: #dddddd;
+	}
+
+	@keyframes blink {
+		from {
+			opacity: 0;
 		}
 		}
-		  @keyframes blink {
-		    from{
-				opacity: 0;
-			}
-		  }
+	}
 </style>
 </style>

+ 17 - 6
pages/checkstand/order-res.vue

@@ -19,25 +19,36 @@
 
 
 <script>
 <script>
 	export default {
 	export default {
-		onLoad(option) {
+		onLoad(options) {
+			this.orderId=options.orderId
 			this.timer =  setInterval(this.queryOrderStatus,500);
 			this.timer =  setInterval(this.queryOrderStatus,500);
 		},
 		},
 		data() {
 		data() {
 			return {
 			return {
+				orderId:'',//订单id
 				counter: 0,
 				counter: 0,
 				timer: null,
 				timer: null,
 				loading: true,
 				loading: true,
 				amount: 100,
 				amount: 100,
-				orderDes: '扫码付款'
+				orderDes: '扫码付款',
+				paySuccess:false
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
-			queryOrderStatus(){
+			async queryOrderStatus(){
+				let res=await this.$api.billRecord.detail({id:this.orderId})
+				if(res.data.payStatus==this.$global.payStatus.IS_PAY){
+					//已支付
+					clearInterval(this.timer)
+					this.loading = false
+					this.paySuccess=true
+					return
+				}
 				this.counter++;
 				this.counter++;
-				console.log("轮询订单状态!");
 				if(this.counter>10){
 				if(this.counter>10){
-					clearInterval(this.timer);
-					this.loading = false;
+					clearInterval(this.timer)
+					this.loading = false
+					this.paySuccess=false
 				}
 				}
 			},
 			},
 			backToHome(){
 			backToHome(){

+ 108 - 83
pages/checkstand/pay-qrcode.vue

@@ -1,171 +1,196 @@
 <template>
 <template>
 	<view class="code-container">
 	<view class="code-container">
 		<view class="title center">{{isPayment? "向商家付款":"扫一扫,向我付款"}}</view>
 		<view class="title center">{{isPayment? "向商家付款":"扫一扫,向我付款"}}</view>
-		<view  class="main-content">
+		<view class="main-content">
 			<view v-if="isPayment">
 			<view v-if="isPayment">
 				<!-- 占位 -->
 				<!-- 占位 -->
 				<view style="height: 50rpx;"></view>
 				<view style="height: 50rpx;"></view>
 				<!-- 条形码 -->
 				<!-- 条形码 -->
-				<view  class="bar-code center">
-					<tki-barcode
-				    ref="barcode"
-					:val="content"
-					onval=true
-					:opations="barOption"
-				  /></view>
-				  <!-- 付款码 -->
+				<view class="bar-code center">
+					<tki-barcode ref="barcode" :val="content" onval=true :opations="barOption" />
+				</view>
+				<!-- 付款码 -->
 				<view class="qr-code center">
 				<view class="qr-code center">
-					 <tki-qrcode
-						cid="2"
-					    ref="qrcode"
-					    :val="content"
-						size="300"
-					    :onval="true"
-					    :loadMake="true"
-					    :usingComponents="true"
-					    />
+					<tki-qrcode cid="2" ref="qrcode" :val="content" size="300" :onval="true" :loadMake="true"
+						:usingComponents="true" />
 				</view>
 				</view>
 			</view>
 			</view>
 			<!-- 收款码 -->
 			<!-- 收款码 -->
 			<view v-else class="charge-code center">
 			<view v-else class="charge-code center">
-				 <tki-qrcode
-					cid="1"
-				    ref="qrcode-charge"
-				    :val="id"
-					:icon="avatar"
-					size="420"
-				    :onval="true"
-				    :loadMake="true"
-				    :usingComponents="true"
-				    />
+				<tki-qrcode cid="1" ref="qrcode-charge" :val="id" :icon="avatar" size="440" :onval="true"
+					:loadMake="true" :usingComponents="true" />
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="footer center">
 		<view class="footer center">
-			<view @click="isPayment=!isPayment"  class="cu-btn round cuIcon-qrcode" style="font-size: 50rpx;height: 100rpx;" :style="{color: isPayment? 'orange':'green' }">
-				<view class="text-black text-xl margin-left-30">{{ isPayment? " 切换收款码":"切换付款码"}}</view>
-			</view>
+			<text class="text-xl text-bold">{{nickName}}</text>
 		</view>
 		</view>
-		
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
 	import tkiQrcode from "tki-qrcode"
 	import tkiQrcode from "tki-qrcode"
 	import tkiBarcode from "@/components/tki-barcode/tki-barcode.vue"
 	import tkiBarcode from "@/components/tki-barcode/tki-barcode.vue"
-	import  totp   from "@/utils/totp.js"
-	// import global from "@/utils/global.js"
-	// const  { transformKey } = global;
+	import totp from "@/utils/totp.js"
 	export default {
 	export default {
-		components: { tkiBarcode,tkiQrcode},
-		computed:{
-			content(){
-				let  transformStr = (this.id*95256)*2
-				return transformStr+this.secret
+		components: {
+			tkiBarcode,
+			tkiQrcode
+		},
+		computed: {
+			content() {
+				let transformStr = this.id
+				return transformStr + this.secret
 			}
 			}
 		},
 		},
 		data() {
 		data() {
 			return {
 			return {
-				id: "",
+				id: '',
 				avatar: "",
 				avatar: "",
+				nickName:'',
 				secret: '000000',
 				secret: '000000',
 				isPayment: true,
 				isPayment: true,
 				timer: '',
 				timer: '',
+				timerBillRecords:null,
 				barOption: {
 				barOption: {
-					width: 4,
+					width: 3,
 					height: 130,
 					height: 130,
-					displayValue:  false
+					displayValue: false
 				}
 				}
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
-			refreshCode(){
-				this.timer = setInterval(()=>{
-					this.secret =  totp.getSecret(this.id);
-				},1000)
+			refreshCode() {
+				this.timer = setInterval(() => {
+					this.secret = totp.getSecret(this.id);
+					console.log(this.secret);
+				}, 1000)
 			},
 			},
-			async initAvatat(url){
-				return new Promise((reslove,reject)=>{
+			async initAvatat(url) {
+				return new Promise((reslove, reject) => {
 					uni.downloadFile({
 					uni.downloadFile({
-							url,
-							success: (res)=> {
-								reslove(res);
-							},
-							fail: (err) => {
-								reject(err)
-							}
+						url,
+						success: (res) => {
+							reslove(res);
+						},
+						fail: (err) => {
+							reject(err)
+						}
 					})
 					})
 				})
 				})
-				
-			}
+			},
+			async queryBillRecords(){
+				let resp=await this.$api.loginUser.getBillrecordFromRedis({userId:this.vuex_userId})
+				if (this.$isEmpty(resp.data)) {
+					return
+				}
+				if (resp.data.realPayAmount>0) {
+					clearInterval(this.timerBillRecords)
+					//去支付
+					let params={
+						orderType:this.$global.orderType.USER_PAY,
+						orderId:resp.data.id,
+						payStatus:this.$global.payStatus.IS_WAIT
+					}
+					let res=await this.$api.pay.payOrder(params)
+					if (!this.$isEmpty(res.data.prePayTn)) {
+						let prePayTn= JSON.parse(res.data.prePayTn)
+						this.$mpi.requestPayment(prePayTn).then(()=>{
+							this.$dialog.showModal('支付成功',false).then(()=>{
+								this.$api.loginUser.clearBillRecordCache({userId:this.vuex_userId})
+								uni.navigateBack({
+									delta:1
+								})
+							})
+						}).catch(err=>{
+							this.$dialog.showModal('支付失败',false).then(()=>{
+								this.$api.loginUser.clearBillRecordCache({userId:this.vuex_userId})
+								uni.navigateBack({
+									delta:1
+								})
+							})
+						})
+					}
+				}
+			},
 		},
 		},
 		async created(option) {
 		async created(option) {
-			//获取用户头像
-			let avatar = "https://gxsz-bucket-01.obs.cn-south-1.myhuaweicloud.com/7123b4d61ba04f1ea2fb0335e36b9477.jpg";
-
-			this. avatar =(await  this.initAvatat(avatar)).tempFilePath;
+			let res = await this.$api.loginUser.detail({
+				id: this.vuex_userId
+			})
+			this.nickName=res.data.nickName
+			// this.avatar =(await  this.initAvatat(res.data.avatar)).tempFilePath;
+			//清除缓存
+			await this.$api.loginUser.clearBillRecordCache({userId:this.vuex_userId})
+			//轮询	
+			this.timerBillRecords =  setInterval(this.queryBillRecords,5000);
 		},
 		},
-		mounted(option){
+		async mounted(option) {
 			//获取用户ID
 			//获取用户ID
-			this.id = "13126058204"
+			this.id = this.vuex_userId
 			//生成动态密码
 			//生成动态密码
 			this.refreshCode();
 			this.refreshCode();
 		},
 		},
 		beforeDestroy() {
 		beforeDestroy() {
 			clearInterval(this.timer);
 			clearInterval(this.timer);
+			clearInterval(this.timerBillRecords);
+			uni.hideLoading()
 		}
 		}
+		
 	}
 	}
 </script>
 </script>
 
 
 <style>
 <style>
 	page {
 	page {
-		background-color: #FE9644;
+		background-color: #18b566;
 	}
 	}
 </style>
 </style>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
-
-	.code-container{
+	.code-container {
 		background-color: #FFFFFF;
 		background-color: #FFFFFF;
-		border-radius: 25rpx;
-		width: 90%;
-		min-height: 900rpx;
-		margin: 20rpx  5%;
-		.title{
+		border-radius: 16rpx;
+		min-height: 800rpx;
+		margin: 60rpx 20rpx;
+
+		.title {
 			border-radius: 25rpx 25rpx 0 0;
 			border-radius: 25rpx 25rpx 0 0;
 			height: 100rpx;
 			height: 100rpx;
 			width: 100%;
 			width: 100%;
 			font-size: 35rpx;
 			font-size: 35rpx;
-			color: #FD711B;
+			color: #18b566;
 			background-color: #F7F7F7;
 			background-color: #F7F7F7;
-			 font-weight: 600;
-			 letter-spacing: 3rpx;
+			font-weight: 600;
+			letter-spacing: 3rpx;
 		}
 		}
-		
-		.footer{
+
+		.footer {
 			width: 90%;
 			width: 90%;
-			height: 200rpx;
+			height: 160rpx;
 			margin-left: 5%;
 			margin-left: 5%;
 			border-top: 1rpx dashed #dddddd;
 			border-top: 1rpx dashed #dddddd;
 		}
 		}
-		.main-content{
+
+		.main-content {
 			width: 100%;
 			width: 100%;
 			height: 600rpx;
 			height: 600rpx;
 			scroll-margin-top: 600rpx;
 			scroll-margin-top: 600rpx;
+
 			// overflow: hidden;
 			// overflow: hidden;
-			.bar-code{
+			.bar-code {
 				margin-left: 5%;
 				margin-left: 5%;
 				width: 90%;
 				width: 90%;
 				height: 150rpx;
 				height: 150rpx;
 			}
 			}
-			.qr-code{
+
+			.qr-code {
 				width: 100%;
 				width: 100%;
 				height: 450rpx;
 				height: 450rpx;
 			}
 			}
-			.charge-code{
+
+			.charge-code {
 				width: 100%;
 				width: 100%;
 				height: 600rpx;
 				height: 600rpx;
 				transition: transform 1s ease-in-out;
 				transition: transform 1s ease-in-out;
 			}
 			}
 		}
 		}
 	}
 	}
-
 </style>
 </style>

+ 1 - 1
pages/mine/bill-detail.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
 	<view>
 	<view>
 		<view class="top">
 		<view class="top">
-			<image src="@/static/icon/zhongguo.png" mode=""></image>
+			<image src="../../static/bank/BOC.png" mode=""></image>
 			<text class="title">中国银行</text>
 			<text class="title">中国银行</text>
 
 
 			<view class="data">
 			<view class="data">

+ 20 - 13
pages/mine/mine.vue

@@ -16,14 +16,14 @@
 								<text >{{userInfo.nickName}}</text>
 								<text >{{userInfo.nickName}}</text>
 								<view v-if="vuex_agenter_type!=0" class="cu-tag bg-tag sm round margin-left-20">
 								<view v-if="vuex_agenter_type!=0" class="cu-tag bg-tag sm round margin-left-20">
 									<text v-if="vuex_agenter_type==1">独家代理</text>
 									<text v-if="vuex_agenter_type==1">独家代理</text>
-									<text v-if="vuex_agenter_type==2">渠道合伙人</text>
+									<text v-if="vuex_agenter_type==2">渠道合伙人</text>
 								</view>
 								</view>
 							</block>
 							</block>
 						</view>
 						</view>
 					</view>
 					</view>
-					<view class="center padding-right-20">
+					<!-- <view class="center padding-right-20">
 						<image style="width: 50rpx;height: 50rpx;" src="../../static/icon/setting.png"></image>
 						<image style="width: 50rpx;height: 50rpx;" src="../../static/icon/setting.png"></image>
-					</view>
+					</view> -->
 				</view>
 				</view>
 				
 				
 				<view class="info" v-else>
 				<view class="info" v-else>
@@ -97,7 +97,7 @@
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="item item3">
 				<view class="item item3">
-					<image src="@/static/icon/zhongguo.png" mode=""></image>
+					<image src="../../static/bank/BOC.png" mode=""></image>
 					<text class="title" style="color: #CF4948;">中国银行</text>
 					<text class="title" style="color: #CF4948;">中国银行</text>
 					<view class="cu-btn round sm">
 					<view class="cu-btn round sm">
 						530:100兑入
 						530:100兑入
@@ -129,7 +129,7 @@
 			</view>
 			</view>
 			
 			
 			<view class="cu-list grid col-4 no-border" style="border-radius:20rpx ;">
 			<view class="cu-list grid col-4 no-border" style="border-radius:20rpx ;">
-				<view class="cu-item" @click.stop="jump(item.path)" v-for="(item,index) in pointsList" :key="index">
+				<view class="cu-item" @click.stop="jumpMiniProgram(item.path)" v-for="(item,index) in pointsList" :key="index">
 					<view class="grid-icon" >
 					<view class="grid-icon" >
 						<image  style="width: 88rpx;height: 88rpx;" :src="item.icon"/>
 						<image  style="width: 88rpx;height: 88rpx;" :src="item.icon"/>
 					</view>
 					</view>
@@ -191,7 +191,12 @@
 					id:this.vuex_userId
 					id:this.vuex_userId
 				}
 				}
 				this.$api.loginUser.detail(params).then(res=>{
 				this.$api.loginUser.detail(params).then(res=>{
-					this.userInfo=res.data
+					if (this.$isEmpty(res.data)) {
+						this.$cache.clear()
+						this.showLogin()
+					}else{
+						this.userInfo=res.data
+					}
 				})
 				})
 			},
 			},
 			// 登录 begin
 			// 登录 begin
@@ -218,14 +223,13 @@
 				}
 				}
 			},
 			},
 			// 登录 end
 			// 登录 end
-			
 			scanCode(){
 			scanCode(){
 				const _this = this;
 				const _this = this;
 				// this.jump('/pages/checkstand/index')
 				// this.jump('/pages/checkstand/index')
 				uni.scanCode({
 				uni.scanCode({
 				    success: function (res) {
 				    success: function (res) {
 						console.log(res,1236456);
 						console.log(res,1236456);
-						_this.jump('/pages/checkstand/index')
+						_this.jump('/pages/checkstand/index?shopId='+res.result)
 				    },
 				    },
 					fail: (res) => {
 					fail: (res) => {
 						if(res.errMsg!='scanCode:fail cancel'){
 						if(res.errMsg!='scanCode:fail cancel'){
@@ -249,6 +253,9 @@
 					url
 					url
 				})
 				})
 			},
 			},
+			jumpMiniProgram(appid,path){
+				this.$mpi.navigateToMiniProgram(appid)
+			},
 			fetchStatic(){
 			fetchStatic(){
 				this.menuList=[
 				this.menuList=[
 					{
 					{
@@ -262,9 +269,9 @@
 						path:'/pages/checkstand/pay-qrcode'
 						path:'/pages/checkstand/pay-qrcode'
 					},
 					},
 					{
 					{
-						icon:'/static/icon/card.png',
-						name:'卡包',
-						path:'/pages/mine/card/card'
+						icon:'/static/icon/setting1.png',
+						name:'设置',
+						path:'/pages/mine/setting/setting'
 					}
 					}
 				]
 				]
 				this.gainList=[
 				this.gainList=[
@@ -293,7 +300,7 @@
 					{
 					{
 						icon:'/static/icon/jiaotong.png',
 						icon:'/static/icon/jiaotong.png',
 						name:'交通出行',
 						name:'交通出行',
-						path:''
+						path:this.$global.APPID.didi
 					},
 					},
 					{
 					{
 						icon:'/static/icon/shop.png',
 						icon:'/static/icon/shop.png',
@@ -303,7 +310,7 @@
 					{
 					{
 						icon:'/static/icon/yiyao.png',
 						icon:'/static/icon/yiyao.png',
 						name:'医疗',
 						name:'医疗',
-						path:''
+						path:this.$global.APPID.nanyue
 					},
 					},
 					
 					
 				]
 				]

+ 1 - 1
pages/mine/my-points/exchange.vue

@@ -12,7 +12,7 @@
 		
 		
 		<view class="card" v-for="(item,index) in 6" :key="index">
 		<view class="card" v-for="(item,index) in 6" :key="index">
 			<view class="left">
 			<view class="left">
-				<image src="@/static/icon/zhongguo.png" mode=""></image>
+				<image src="../../../static/bank/BOC.png" mode=""></image>
 				<view class="">
 				<view class="">
 					<text>中国银行</text>
 					<text>中国银行</text>
 				</view>
 				</view>

+ 1 - 1
pages/mine/my-points/my-points.vue

@@ -42,7 +42,7 @@
 			<view @click="$jump('/pages/mine/bill-detail')" class="item" hover-class="hoverClass" v-for="(item,index) in 6" :key="index">
 			<view @click="$jump('/pages/mine/bill-detail')" class="item" hover-class="hoverClass" v-for="(item,index) in 6" :key="index">
 				<view class="area1">
 				<view class="area1">
 					<view class="item-padding">
 					<view class="item-padding">
-						<image src="@/static/icon/zhongguo.png" mode=""></image>
+						<image src="../../../static/bank/BOC.png" mode=""></image>
 						<view class="">
 						<view class="">
 							<text>中国银行</text>
 							<text>中国银行</text>
 							<text>7月20日 12:00</text>
 							<text>7月20日 12:00</text>

+ 58 - 57
pages/mine/myInfo.vue

@@ -1,44 +1,48 @@
 <template>
 <template>
 	<view>
 	<view>
-		<view class="flex padding justify-between align-center" @click="upload">
-			<view class="title">头像</view>
-			<u-avatar :src="userData.avatar" size="120"></u-avatar>
-		</view>
-		<u-line color="#f1f1f1"></u-line>
-		<view class="flex padding justify-between align-center">
-			<view class="title">昵称<text class="text-red">*</text></view>
-			<u-input v-model="userData.nickName" :clearable="false" inputAlign="right" placeholder="请输入昵称"></u-input>
-		</view>
-		<u-line color="#f1f1f1"></u-line>
-		<view class="flex padding justify-between align-center">
-			<view class="title">性别</view>
-			<view style="width: 200upx;">
-				<u-input v-model="sex" type="select" :border="border" @click="sexShow = true"></u-input>
-				<u-action-sheet :list="actionSheetList" v-model="sexShow" @click="actionSheetCallback"></u-action-sheet>
+		<view class="bg-white margin-top-20">
+			<view class="flex padding justify-between align-center" @click="upload">
+				<view class="title">头像</view>
+				<u-avatar :src="userData.avatar" size="100"></u-avatar>
+			</view>
+			<u-line color="#f1f1f1"></u-line>
+			<view class="flex padding justify-between align-center">
+				<view class="title">昵称<text class="text-red">*</text></view>
+				<view class="center">
+					<u-input v-model="userData.nickName" :clearable="false" inputAlign="right" placeholder="请输入昵称"></u-input>
+					<text class="cuIcon-right margin-left-10"></text>
+				</view>
+			</view>
+			<u-line color="#f1f1f1"></u-line>
+			<view class="flex padding justify-between align-center">
+				<view class="title">性别</view>
+				<view class="center" >
+					<u-input disabled @click="sexShow = true" v-model="sex"  :clearable="false" inputAlign="right" placeholder="性别"></u-input>
+					<text class="cuIcon-right margin-left-10"></text>
+					<u-action-sheet :list="actionSheetList" v-model="sexShow" @click="actionSheetCallback"></u-action-sheet>
+				</view>
+			</view>
+			<u-line color="#f1f1f1"></u-line>
+			<view class="flex padding justify-between align-center">
+				<view class="title">手机号码<text class="text-red">*</text></view>
+				<view class="center">
+					<u-input v-model="userData.phone" :clearable="false" inputAlign="right" placeholder="请填写手机号码"></u-input>
+					<text class="cuIcon-right margin-left-10"></text>
+				</view>
+			</view>
+			<u-line color="#f1f1f1"></u-line>
+			<view class="flex padding justify-between align-center" @click="calendarShow = true">
+				<view class="title">生日</view>
+				<view class="center">
+					<u-input @click="calendarShow=true" disabled v-model="userData.birthday" :clearable="false" inputAlign="right" placeholder="请填写生日"></u-input>
+					<text class="cuIcon-right margin-left-10"></text>
+					<u-calendar v-model="calendarShow" mode="date" @change="change"></u-calendar>
+				</view>
+			</view>
+			<view style="height: 20upx;"></view>
+			<view class="footer-fixed margin-bottom" style="z-index: 99;">
+				<u-button :custom-style="customStyle" shape="circle" @click="save">保存</u-button>
 			</view>
 			</view>
-		</view>
-		<u-line color="#f1f1f1"></u-line>
-		<view class="flex padding justify-between align-center">
-			<view class="title">手机号码<text class="text-red">*</text></view>
-			<u-input v-model="userData.phone" :clearable="false" inputAlign="right" placeholder="请填写手机号码"></u-input>
-		</view>
-		<u-line color="#f1f1f1"></u-line>
-		<view class="flex padding justify-between align-center" @click="calendarShow = true">
-			<view class="title">生日</view>
-			<view>{{userData.birthday}}</view>
-			<u-calendar v-model="calendarShow" mode="date" @change="change"></u-calendar>
-		</view>
-		<u-line color="#f1f1f1"></u-line>
-		<view class="padding">
-			<view class="title">个人介绍<text class="text-red">*</text></view>
-		</view>
-		<view style="padding: 0 40upx">
-			<u-input v-model="introduce" type="textarea" :clearable="false" height="140" :autoHeight="false" maxlength="60" placeholder="请输入个人简介" />
-		</view>
-		<view class="flex justify-end padding-right-sm padding-bottom-sm text-gray">{{introduce.length}} / 60</view>
-		<view style="height: 120upx;"></view>
-		<view class="footer-fixed margin-bottom">
-			<u-button class="custom-style" shape="circle" @click="save">保存</u-button>
 		</view>
 		</view>
 	</view>
 	</view>
 </template>
 </template>
@@ -47,6 +51,13 @@
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
+				customStyle: {
+					backgroundColor: '#FF9447',
+					color: '#ffffff',
+					margin:"20rpx",
+					height:"90rpx"
+				},
+				
 				userData: {},
 				userData: {},
 				sex: '',
 				sex: '',
 				sexShow: false,
 				sexShow: false,
@@ -64,7 +75,6 @@
 					}
 					}
 				],
 				],
 				calendarShow: false,
 				calendarShow: false,
-				introduce: '',
 			}
 			}
 		},
 		},
 		onLoad() {
 		onLoad() {
@@ -72,9 +82,8 @@
 		},
 		},
 		methods: {
 		methods: {
 			getUserInfo() {
 			getUserInfo() {
-				this.$api.user.detail({id: this.vuex_userId}).then(res => {
-					this.userData = res;
-					this.introduce = res.introduce || " ";
+				this.$api.loginUser.detail({id: this.vuex_userId}).then(res => {
+					this.userData = res.data;
 					if (res.gender == 1) {
 					if (res.gender == 1) {
 						this.sex = '男';
 						this.sex = '男';
 					} else if (res.gender == 2) {
 					} else if (res.gender == 2) {
@@ -92,11 +101,13 @@
 				this.userData.birthday = e.result;
 				this.userData.birthday = e.result;
 			},
 			},
 			async upload() {
 			async upload() {
-				let res = await this.$mpi.uploadFile()
-				this.userData.avatar = JSON.parse(res).data;
+				let resp = await this.$mpi.chooseImage()
+				this.$api.uploadFile(resp[0]).then(res=>{
+					this.userData.avatar = res.data.link
+				})
 			},
 			},
 			save() {
 			save() {
-				if (this.$u.test.isEmpty(this.introduce) || this.$u.test.isEmpty(this.userData.nickName) || this.$u.test.isEmpty(this.userData.phone)) {
+				if (this.$u.test.isEmpty(this.userData.nickName) || this.$u.test.isEmpty(this.userData.phone)) {
 					uni.showToast({
 					uni.showToast({
 						icon: "none",
 						icon: "none",
 						title: "请填写必填信息",
 						title: "请填写必填信息",
@@ -115,10 +126,9 @@
 						gender: this.sex == '男' ? 1 : this.sex == '女' ? 2 : 0,
 						gender: this.sex == '男' ? 1 : this.sex == '女' ? 2 : 0,
 						phone: this.userData.phone,
 						phone: this.userData.phone,
 						birthday: this.userData.birthday,
 						birthday: this.userData.birthday,
-						introduce: this.introduce,
 						avatar: this.userData.avatar
 						avatar: this.userData.avatar
 					}
 					}
-					this.$u.api.user.submit(data).then(res => {
+					this.$u.api.loginUser.submit(data).then(res => {
 						uni.showToast({
 						uni.showToast({
 							icon: "none",
 							icon: "none",
 							title: "修改成功",
 							title: "修改成功",
@@ -135,11 +145,6 @@
 		}
 		}
 	}
 	}
 </script>
 </script>
-<style>
-	page {
-		background-color: #ffffff;
-	}
-</style>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
 	.title {
 	.title {
 		font-size: 30upx;
 		font-size: 30upx;
@@ -147,9 +152,5 @@
 		color: #060606;
 		color: #060606;
 		padding-left: 10upx;
 		padding-left: 10upx;
 	}
 	}
-	.custom-style {
-		background-color: #5a3ee7;
-		color: #ffffff;
-		width: 600rpx;
-	}
+	
 </style>
 </style>

+ 0 - 0
pages/mine/card/pay-setting.vue → pages/mine/setting/pay-setting.vue


+ 14 - 9
pages/mine/card/card.vue → pages/mine/setting/setting.vue

@@ -20,19 +20,24 @@
 			return {
 			return {
 				menuList:[
 				menuList:[
 					{
 					{
-						icon:'/static/icon/shenfen.png',
-						name:'身份认证',
-						path:'/pages/mine/card/pay-setting'
+						icon:'/static/setting/info.png',
+						name:'个人资料',
+						path:'/pages/mine/myInfo'
 					},
 					},
 					{
 					{
-						icon:'/static/icon/yihan.png',
-						name:'银行卡',
-						path:'/pages/mine/card/pay-setting'
+						icon:'/static/setting/location.png',
+						name:'地址管理',
+						path:''
 					},
 					},
 					{
 					{
-						icon:'/static/icon/zhifu.png',
-						name:'支付设置',
-						path:'/pages/mine/card/pay-setting'
+						icon:'/static/setting/kefu.png',
+						name:'官方客服',
+						path:''
+					},
+					{
+						icon:'/static/setting/tousu.png',
+						name:'投诉及反馈',
+						path:''
 					}
 					}
 				]
 				]
 			}
 			}

BIN
static/del/del4.png


BIN
static/icon/avatar.png


BIN
static/icon/bg.png


BIN
static/icon/daili.png


BIN
static/icon/pay_fail.png


BIN
static/icon/setting1.png


BIN
static/icon/xianfeng.png


BIN
static/icon/zhaoshang.png


BIN
static/icon/zhongguo.png


BIN
static/setting/info.png


BIN
static/setting/kefu.png


BIN
static/setting/location.png


BIN
static/setting/tousu.png


+ 10 - 0
utils/dateTime.js

@@ -34,4 +34,14 @@ dateTime.createDate = (value)=>{
   return new Date(date)
   return new Date(date)
 } 
 } 
 
 
+dateTime.getExpireTime=(value)=>{
+	let now=new Date()
+	let min=now.getMinutes()
+	now.setMinutes(min + value)
+	let expireTime=dateTime.format(now)
+	return expireTime
+}
+
+
+
 export default dateTime
 export default dateTime

+ 5 - 4
utils/mixin.js

@@ -28,16 +28,17 @@ let page = {
 		let currentPage = this.$util.getCurrentRoute()
 		let currentPage = this.$util.getCurrentRoute()
 		//全局登录拦截
 		//全局登录拦截
 		if (!this.vuex_userId) {
 		if (!this.vuex_userId) {
-			if (currentPage.indexOf('pages/agent/') != -1) {
+			if (currentPage.indexOf('pages/mine/') != -1 && currentPage != 'pages/mine/mine') {
 				uni.reLaunch({
 				uni.reLaunch({
-					url: "/pages/gain/gain?current=1"
+					url: "/pages/mine/mine"
 				})
 				})
 				return
 				return
 			}
 			}
-			if (currentPage.indexOf('pages/mine/') != -1 && currentPage != 'pages/mine/mine') {
+			if (currentPage.indexOf('pages/agent/') != -1) {
 				uni.reLaunch({
 				uni.reLaunch({
-					url: "/pages/mine/mine"
+					url: "/pages/gain/gain?current=1"
 				})
 				})
+				return
 			}
 			}
 		}
 		}
 	}
 	}

+ 162 - 130
utils/mpi.js

@@ -1,159 +1,191 @@
 let mpi = {}
 let mpi = {}
 
 
+
+mpi.requestPayment = (params) => {
+	return new Promise((resolve, reject) => {
+		uni.requestPayment({
+			provider: 'wxpay',
+			...params,
+			success: function(res) {
+				if (res.errMsg == "requestPayment:ok") {
+					resolve(res)
+				}
+			},
+			fail: function(err) {
+				reject(err)
+			}
+		});
+	})
+}
+mpi.navigateToMiniProgram = (appId, path) => {
+	return new Promise((resolve, reject) => {
+		uni.navigateToMiniProgram({
+			appId,
+			path,
+			success(res) {
+				resolve(res)
+			},
+			fail(err) {
+				reject(err)
+			}
+		
+		})
+	})
+}
+
 // 微信登陆
 // 微信登陆
 mpi.wxLogin = () => {
 mpi.wxLogin = () => {
-  return new Promise((resolve, reject)=>{
-    uni.login({
-      success: function (res) {
-        resolve(res)
-      },
-      fail: function (err) {
-        console.warn(err)
-        reject(err)
-      }
-    })
-  })
+	return new Promise((resolve, reject) => {
+		uni.login({
+			success: function(res) {
+				resolve(res)
+			},
+			fail: function(err) {
+				console.warn(err)
+				reject(err)
+			}
+		})
+	})
 }
 }
 
 
 //选择图片 res.tempFilePaths[0]
 //选择图片 res.tempFilePaths[0]
-mpi.chooseImage = (count=1) => {
-  return new Promise((resolve, reject)=>{
-    uni.chooseImage({
-    	count,
-    	//最多可以选择的图片张数,默认9
-    	sourceType: ['album'],
-    	sizeType: ['compressed'],
-    	//可选择原图或压缩后的图片
-    	success: res => {
-    		resolve(res.tempFilePaths)
-    	},
-		fail(err) {
-		  reject(err)
-		}
-    });
-    
-  })
-}
+mpi.chooseImage = (count = 1) => {
+	return new Promise((resolve, reject) => {
+		uni.chooseImage({
+			count,
+			//最多可以选择的图片张数,默认9
+			sourceType: ['album'],
+			sizeType: ['compressed'],
+			//可选择原图或压缩后的图片
+			success: res => {
+				resolve(res.tempFilePaths)
+			},
+			fail(err) {
+				reject(err)
+			}
+		});
 
 
+	})
+}
 
 
 
 
 mpi.getLocation = () => {
 mpi.getLocation = () => {
-  return new Promise((resolve, reject)=>{
-	   uni.getLocation({
-	       type: 'gcj02',
-	       success: function (res) {
-	           resolve(res)
-	       },
-		   fail:function(err){
-			   reject(err)
-		   }
-	   });
-  })
+	return new Promise((resolve, reject) => {
+		uni.getLocation({
+			type: 'gcj02',
+			success: function(res) {
+				resolve(res)
+			},
+			fail: function(err) {
+				reject(err)
+			}
+		});
+	})
 }
 }
 
 
 mpi.getConnectedWifi = () => {
 mpi.getConnectedWifi = () => {
-  return new Promise((resolve, reject)=>{
-	   uni.startWifi({
-	   	success: function(res) {
-	   		wx.getConnectedWifi({
-	   		  success: res => {
-	   			resolve(res)
-	   		  },
-	   		  fail: err => {
-	   			reject(err)
-	   		  }
-	   		})
-	   	},
-	   	fail: function(err){
-	   		reject(err)
-	   	}
-	   });
-  })
+	return new Promise((resolve, reject) => {
+		uni.startWifi({
+			success: function(res) {
+				wx.getConnectedWifi({
+					success: res => {
+						resolve(res)
+					},
+					fail: err => {
+						reject(err)
+					}
+				})
+			},
+			fail: function(err) {
+				reject(err)
+			}
+		});
+	})
 }
 }
 /**
 /**
  * 订阅认证信息
  * 订阅认证信息
  */
  */
-mpi.subscribe=(tmplIds)=>{
-	return new Promise((resolve, reject)=>{
-	  uni.requestSubscribeMessage({
-		tmplIds,
-		success(res) {
-		  resolve(res)
-		},
-		fail(err) {
-		  reject(err)
-		}
-	  })
-	})
-},
-
-
-// 获取用户信息
-mpi.wxGetUserInfo = () => {
-  return new Promise((resolve, reject) => {
-    uni.getUserInfo({
-      withCredentials: true,
-      success: function(res) {
-        resolve(res)
-      },
-      fail: function(err) {
-        reject(err)
-      },
-    })
-  })
-}
+mpi.subscribe = (tmplIds) => {
+		return new Promise((resolve, reject) => {
+			uni.requestSubscribeMessage({
+				tmplIds,
+				success(res) {
+					resolve(res)
+				},
+				fail(err) {
+					reject(err)
+				}
+			})
+		})
+	},
+
+
+	// 获取用户信息
+	mpi.wxGetUserInfo = () => {
+		return new Promise((resolve, reject) => {
+			uni.getUserInfo({
+				withCredentials: true,
+				success: function(res) {
+					resolve(res)
+				},
+				fail: function(err) {
+					reject(err)
+				},
+			})
+		})
+	}
 
 
 //新版本的获取用户信息
 //新版本的获取用户信息
 mpi.getUserProfile = () => {
 mpi.getUserProfile = () => {
-  return new Promise((resolve, reject) => {
-    uni.getUserProfile({
-    	desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
-    	success: (res) => {
-    		resolve(res) 
-    	},
-		fail:(err)=>{
-			reject(err)
-		}
-    })
-  })
+	return new Promise((resolve, reject) => {
+		uni.getUserProfile({
+			desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+			success: (res) => {
+				resolve(res)
+			},
+			fail: (err) => {
+				reject(err)
+			}
+		})
+	})
 }
 }
 
 
-let compareVersion=(v1, v2)=> {
-  v1 = v1.split('.')
-  v2 = v2.split('.')
-  const len = Math.max(v1.length, v2.length)
-
-  while (v1.length < len) {
-    v1.push('0')
-  }
-  while (v2.length < len) {
-    v2.push('0')
-  }
-
-  for (let i = 0; i < len; i++) {
-    const num1 = parseInt(v1[i])
-    const num2 = parseInt(v2[i])
-
-    if (num1 > num2) {
-      return 1
-    } else if (num1 < num2) {
-      return -1
-    }
-  }
-  return 0
+let compareVersion = (v1, v2) => {
+	v1 = v1.split('.')
+	v2 = v2.split('.')
+	const len = Math.max(v1.length, v2.length)
+
+	while (v1.length < len) {
+		v1.push('0')
+	}
+	while (v2.length < len) {
+		v2.push('0')
+	}
+
+	for (let i = 0; i < len; i++) {
+		const num1 = parseInt(v1[i])
+		const num2 = parseInt(v2[i])
+
+		if (num1 > num2) {
+			return 1
+		} else if (num1 < num2) {
+			return -1
+		}
+	}
+	return 0
 }
 }
 
 
-mpi.versioning=(minVersion)=>{
+mpi.versioning = (minVersion) => {
 	const version = wx.getSystemInfoSync().SDKVersion
 	const version = wx.getSystemInfoSync().SDKVersion
-	return new Promise((resolve, reject)=>{
-	  if (compareVersion(version, minVersion) >= 0) {
-		   resolve()
-	  }else{
-		  uni.showModal({
-		  	content:"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
-		  })
-	  }
-    })
+	return new Promise((resolve, reject) => {
+		if (compareVersion(version, minVersion) >= 0) {
+			resolve()
+		} else {
+			uni.showModal({
+				content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
+			})
+		}
+	})
 }
 }
 
 
 
 

+ 11 - 11
utils/totp.js

@@ -1,12 +1,12 @@
+const hotpOtpGenerator = require('hotp-totp-generator')
 
 
-// const base32 = require('base32')
-
-// //  根据ID生成动态密码,60秒过期
-// export default {
-// 	getSecret : (id)=>{
-// 		// console.log(id,123456);
-// 		 let key = base32.encode(id,"RFC4648")
-// 		 console.log(key,123456);
-// 		 return totp("JBSWY3DPEHPK3PXP", { period: 60 });
-// 	}
-// }
+//   生成动态密码
+export default {
+ getSecret: (str)=>{
+  let secret = hotpOtpGenerator.totp({
+         key: str,
+          X: 60,
+       });
+  return  secret.substr(secret.length-6,secret.length-1);
+ }
+}