Преглед изворни кода

commit -m 订单模块接口联调

zhengjinyi пре 3 година
родитељ
комит
94745ef32d
2 измењених фајлова са 56 додато и 53 уклоњено
  1. 27 27
      pages/user/order/order-sharelogin.vue
  2. 29 26
      pages/user/order/orderShareLogin.vue

+ 27 - 27
pages/user/order/order-sharelogin.vue

@@ -38,45 +38,45 @@
 				imagePath:'https://img.caimei365.com/group1/M00/03/83/Cmis214FbbCAQhKoAAKWfqqSIds292.png',
 				shareCode:'',  		//获取用户登录的邀请码
 				isUserInfo:false,	//控制显示授权弹窗
-				nickName:'',		//存储用户名
-				userInfo:'',		//存储微信用户授权信息
-				orderId:0,			//订单ID
-				userId:0,			//分享人的用户ID
 				isShareStatus:false,
-				serviceProviderId:'',
-				productList:[]
+				productList:[],
+				params:{
+					code:'',
+					iv:'',
+					encryptedData:'',
+					shareCode:'',
+					orderId:0,			//订单ID
+					userId:0,			//机构用户ID	
+					serviceProviderId:0,//协销ID	
+					
+				}
 			}
 		},
 		onLoad(e) {
 			console.log(e)
-			this.orderId = e.orderId
-			this.userId = e.userId
+			this.params.orderId = e.orderId
+			this.params.userId = e.userId
 			if(e.serviceProviderId){
-				this.serviceProviderId = e.serviceProviderId
+				this.params.serviceProviderId = e.serviceProviderId
 			}
 			this.initQueryUser()
 		},
 		methods:{
 			async initQueryUser(){
-				const code = await authorize.getCode('weixin')
-				this.OrderService.OrderShareCode(
-					{
-						code:code,
-						orderId:this.orderId,
-						userId:this.userId,
-						shareCode:this.shareCode,
-						serviceProviderId:this.serviceProviderId
-					}
-				).then(response =>{
+				const getUserInfo = await authorize.getUserInfo('weixin');
+				this.params.code = await authorize.getCode('weixin')
+				this.params.iv = getUserInfo.iv
+				this.params.encryptedData = getUserInfo.encryptedData
+				this.OrderService.OrderShareCode(this.params).then(response =>{
 					console.log(response.code)
 					if(response.code === 2){
-						this.$api.navigateTo(`/pages/seller/order/order-details?type=share&orderId=${this.orderId}`)
+						this.$api.navigateTo(`/pages/seller/order/order-details?type=share&orderId=${this.params.orderId}`)
 					}else if(response.code === 0) {
 						console.log(response.data)
 						if(response.data == true){//同为会所运营人员查看订单详情
-							this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderId=${this.orderId}`)
+							this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderId=${this.params.orderId}`)
 						}else{//游客第二次查看订单详情
-							this.$api.redirectTo(`/pages/user/order/order-sharedetails?orderId=${this.orderId}&userId=${this.userId}`)
+							this.$api.redirectTo(`/pages/user/order/order-sharedetails?orderId=${this.params.orderId}&userId=${this.params.userId}`)
 						}
 					}else if(response.code === -2){
 						this.$util.modal('提示',response.msg,'确定','',false,() =>{})
@@ -87,7 +87,7 @@
 				})
 			},
 			getOrderCommodityData(){//查询订单商品信息s
-				this.OrderService.OrderCommodityData({orderId:this.orderId}).then(response =>{
+				this.OrderService.OrderCommodityData({orderId:this.params.orderId}).then(response =>{
 					this.productList = response.data
 					this.isShareStatus = true
 				}).catch(error =>{
@@ -98,11 +98,11 @@
 				switch(index){
 					case 1:
 						this.$store.commit('setLoginType',7)
-						this.$store.commit('setLoginOrderId',this.orderId)
+						this.$store.commit('setLoginOrderId',this.params.orderId)
 						this.$api.navigateTo('/pages/login/login')
 						break;
 					case 2:
-						this.$api.navigateTo(`/pages/user/order/orderShareLogin?orderId=${this.orderId}&userId=${this.userId}`)
+						this.$api.navigateTo(`/pages/user/order/orderShareLogin?orderId=${this.params.orderId}&userId=${this.params.userId}`)
 						break;
 				}
 			}
@@ -200,7 +200,7 @@
 			}
 		}
 		.login-btn{
-			width: 702rpx;
+			width: 600rpx;
 			height: 88rpx;
 			font-size: $font-size-28;
 			line-height: 88rpx;
@@ -209,7 +209,7 @@
 			margin-bottom: 24rpx;
 			text-align: center;
 			background: $btn-confirm;
-			border-radius: 14rpx;
+			border-radius: 50rpx;
 		}
 		.container-footer{
 			box-sizing: border-box;

+ 29 - 26
pages/user/order/orderShareLogin.vue

@@ -5,7 +5,7 @@
 		</view>
 		<view class="login-input">
 			<input type="number" 
-				   v-model="shareCode"
+				   v-model="params.shareCode"
 				   maxlength="4" 
 				   class="input" 
 				   placeholder="请输入分享码"
@@ -20,44 +20,47 @@
 		data() {
 			return{
 				imagePath:'https://img.caimei365.com/group1/M00/03/83/Cmis214FbbCAQhKoAAKWfqqSIds292.png',
-				shareCode:'',  		//获取用户登录的邀请码
-				isUserInfo:false,	//控制显示授权弹窗
-				nickName:'',		//存储用户名
-				userInfo:'',		//存储微信用户授权信息
-				orderID:0,			//订单ID
-				userID:0			,//分享人的用户ID
+				shareCode:'',  		// 获取用户登录的邀请码
+				isUserInfo:false,	// 控制显示授权弹窗
+				params:{
+					code:'',		// 微信code
+					iv:'',
+					encryptedData:'',
+					shareCode:'',	// 邀请码
+					orderId:0,		// 订单ID
+					userId:0,		// 分享人的用户ID
+				},
 				isShareStatus:false,
 			}
 		},
 		onLoad(e) {
 			console.log(e)
-			this.orderID = e.orderID
-			this.userID = e.userID
+			this.params.orderId = e.orderId
+			this.params.userId = e.userId
+			this.initGetCode()
 		},
 		methods:{
+			async initGetCode(){
+				const getUserInfo = await authorize.getUserInfo('weixin');
+				this.params.iv = getUserInfo.iv
+				this.params.encryptedData = getUserInfo.encryptedData
+				this.params.code = await authorize.getCode('weixin')
+			},
 			goLogin() {
-				if(this.shareCode == ''){
-					this.$util.msg('请联系分享人获取分享码',2000);
+				if(this.params.shareCode == ''){
+					this.$util.msg('请联系分享人获取分享码',2000); 
 					return
 				}
-				if(!this.$api.isNumber(this.shareCode)){
+				if(!this.$api.isNumber(this.params.shareCode)){
 					this.$util.msg('分享码格式不正确',2000);
 					return
 				}
-				authorize.getCode('weixin').then(wechatcode =>{
-					let params ={
-							code:wechatcode,
-							orderID:this.orderID,
-							userID:this.userID,
-							shareCode:this.shareCode
-						}
-					this.OrderService.OrderShareCode(params).then(response =>{
-						if (response.code === 0) {//游客第一次查看订单详情
-							this.$api.redirectTo(`/pages/user/order/order-sharedetails?orderID=${this.orderID}&userId=${this.userID}`)
-						}else{
-							this.$util.msg(response.msg,2000);
-						}
-					})
+				this.OrderService.OrderShareCode(this.params).then(response =>{
+					if (response.code === 0) {//游客第一次查看订单详情
+						this.$api.redirectTo(`/pages/user/order/order-sharedetails?orderId=${this.params.orderId}&userId=${this.params.userId}`)
+					}else{
+						this.$util.msg(response.msg,2000);
+					}
 				})
 			},
 		},