Browse Source

二维码

twt 2 years ago
parent
commit
de68aa149b
5 changed files with 58 additions and 15 deletions
  1. 22 4
      pages/index/index.vue
  2. 32 7
      pages/partner/myQr.vue
  3. 1 1
      pages/partner/partner.vue
  4. 1 1
      pages/referral/referral.vue
  5. 2 2
      utils/request.js

+ 22 - 4
pages/index/index.vue

@@ -256,9 +256,10 @@
 				NextAuditDate:'',
 				themeColor:'',
 				getwxLoing:false,
+				shareID:'',
 			}
 		},
-		onLoad() {
+		onLoad(opt) {
 			this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
 			var that=this;
 			 //this.$common.getExtStoreId()
@@ -268,7 +269,13 @@
 			//console.log( String(Date.now()))
 			this.shopId=ext.shopId;
 			this.url=ext.url;
-			this.unionId=ext.unionId
+			this.unionId=ext.unionId;
+			var shareID = opt.scene //'F16E7299-6850-4015-ABCE-A9F2794B45B5'
+			
+			if (shareID) {
+				this.shareID = shareID
+				//this.$store.commit('mutationsshareID', shareID)
+			}
 			//this.unionId="26A1039A-DB10-4D0E-BBA2-541C06274EED";
 			//this.ext.appId="wxffd2502e67d37908"
 			// uni.setStorage({
@@ -325,6 +332,7 @@
 				}
 			},
 			goShop(){
+				
 				uni.switchTab({
 					url:'../shop/shop'
 				})
@@ -341,6 +349,13 @@
 				})
 			},
 			changeCar(){
+				// uni.scanCode({
+				// 	success: function (res) {
+				// 		console.log('条码类型:' + res.scanType);
+				// 		console.log( res);
+				// 	}
+				// });
+				// return false;
 				uni.navigateTo({
 					url:'../user/addCar/cailist'
 				})
@@ -422,6 +437,7 @@
 							 icon:'none',
 							 duration: 3000
 						});
+						
 					}else if(item.bizType==2){ //钣金喷漆
 						uni.navigateTo({
 							url:'paint'
@@ -545,7 +561,8 @@
 				 })
 				 this.$http('miniApp2/sys/getWxOpenID', {
 				   code:e.code,
-				   unionId:this.unionId
+				   unionId:this.unionId,
+				   shareId:this.shareID
 				  },'GET').then(res => {
 					if(res.code!=0){
 						 uni.hideLoading();
@@ -626,7 +643,8 @@
 				   appId:this.ext.appId,
 				   unionId:this.unionId,
 				   code:this.code,
-				   openId:this.wxOpenData.openid
+				   openId:this.wxOpenData.openid,
+				    shareId:this.shareID
 				  },'POST').then(res => {
 				 	var data = res.data;
 					if(data.loginInfo){

+ 32 - 7
pages/partner/myQr.vue

@@ -14,7 +14,7 @@
 		<view class="ms">很不错的店铺 值得推荐!</view>
 		<view class="wqmBox">
 			<view class="ewmLeft">
-				<image :src="userInfo.headImg" mode="" class="ewmImg"></image>
+				<image :src="img" mode="" class="ewmImg"></image>
 			</view>
 			<view class="ewmRight">
 				<view class="ewmRight1">长按二维码立即关注</view>
@@ -36,18 +36,43 @@
 				headImg: '',
 				themeColor:'',
 				userInfo:'',
+				type:'',
+				wxOpenData:'',
+				ext:'',
+				img:'',
 			}
 		},
 		onLoad(opt) {
 			this.themeColor = uni.getStorageSync("themeColor");
 			this.userInfo = uni.getStorageSync("userInfo");
-			
+			this.wxOpenData=this.$store.state.wxOpenData;
+			this.ext=this.$common.getExtStoreId();
+			this.type=opt.type;
+			//if(this.type==1){
+				this.openShareQrCode()
+			//}
 		},
 		onShow() {
 			
 		},
 		methods: {
-			
+			openShareQrCode(){
+				uni.showLoading({
+					title: '加载中'
+				})
+				this.$request.httpBinary('openShareQrCode/create', {
+				    bizType:this.type,
+					openId:this.wxOpenData.openid,
+					unionId:this.ext.unionId,
+					shopId:this.ext.shopId
+				}, 'GET').then(res => {
+					uni.hideLoading();
+					this.img = 'data:image/png;base64,'+uni.arrayBufferToBase64(res);
+					//this.img= uni.arrayBufferToBase64(res)
+					//console.log('list+=', this.queryShopList);
+				
+				})
+			}
 			
 		}
 	}
@@ -97,13 +122,13 @@
 	color: #FFAF18;font-size: 30rpx;padding-top: 16rpx;text-align: center;
 }
 .wqmBox{
-	border-top:1px solid #EEEEEE;margin-top: 40rpx;
+	border-top:1px solid #EEEEEE;margin-top: 20rpx;
 	display: flex;
-	padding: 30rpx 0 0 70rpx;
+	padding: 30rpx 0 0 30rpx;
 }
 .ewmImg{
-	width: 148rpx;
-	height: 148rpx;
+	width: 200rpx;
+	height: 200rpx;
 }
 .ewmRight1{
 	color: #999999;font-size: 24rpx;padding-top: 30rpx;padding-left: 24rpx;

+ 1 - 1
pages/partner/partner.vue

@@ -43,7 +43,7 @@
   </view>
    
    <view class="lineBox">
-   	  <view class="line" @click="goRouter('myQr')">
+   	  <view class="line" @click="goRouter('myQr?type=1')">
    		  <view class="lineLeft">
    		  	<image src="../../static/timg/icon_erweima.png" mode="" class="lineLeftImg"></image>
    		  	<view class="lineLeftTxt">生成二维码</view>

+ 1 - 1
pages/referral/referral.vue

@@ -57,7 +57,7 @@
 		
 	</view>
 	<view class="lineBox">
-		  <view class="line" @click="goRouter('../partner/myQr')">
+		  <view class="line" @click="goRouter('../partner/myQr?type=2')">
 			  <view class="lineLeft">
 			  	<image src="../../static/timg/icon_erweima.png" mode="" class="lineLeftImg"></image>
 			  	<view class="lineLeftTxt">生成二维码</view>

+ 2 - 2
utils/request.js

@@ -11,9 +11,9 @@ console.log(extConfig)
 const baseUrl=extConfig.url+'/'
 //wx2c6f04c0dcd15984正式  wx33053a645546ec31
 //测试地址
-//const webUrl = 'http://dms.32che.cn/'
+const webUrl = 'http://dms.32che.cn/'
 //正式
-const webUrl = 'http://webwx.66km.com/'
+//const webUrl = 'http://webwx.66km.com/'
 const http = (url = '', date = {}, type = 'POST', header = {
 }) => {
     return new Promise((resolve, reject) => {