ソースを参照

【Add】二维码增加可点击操作

liuxiangxin 6 ヶ月 前
コミット
ba1e5b70fd
3 ファイル変更103 行追加55 行削除
  1. 46 10
      pages/product/index.vue
  2. 43 44
      pages/user/follow.vue
  3. 14 1
      utils/checkaccess.js

+ 46 - 10
pages/product/index.vue

@@ -125,10 +125,10 @@
 							<view class="coupon_name" v-if="item.rebate_type == 3">赠品券</view> 
 						</view>
 						<view class="product_scope">
-							<text class="" v-if="item.type_id == 1">限定商品可用</text>
+							<text class="" v-if="item.type_id == 1">{{item.is_scope?"当前商品可用":"当前商品不可用"}}</text>
 							<text class="" v-if="item.type_id == 2">全场可用</text>
 							<view class="check_label" >
-								<view class="isstd" v-if="!item.is_std">不可用</view> 
+								<view class="isstd" v-if="!item.is_std">未达标</view> 
 								<image class="checkbox" v-if="item.is_std" :src="item.checked?'../../static/icon/checked.png':'../../static/icon/checkbox.png'"></image>
 							</view>
 						</view>
@@ -164,8 +164,11 @@
 		<uni-popup ref="addFollow" type="center" class="center_popup" @change="popupChange">
 			<view class="add_follow">
 				<view class="close_area"><button class="close_btn" @click="closeAddFollow()">关闭</button></view>
-				<view class="info_alter">长按识别二维码添加客服</view>
-				<view class="qr_code_area">
+				<view class="info_alter">
+					<text v-if="follow_linkurl">长按或点击二维码添加客服</text>
+					<text v-if="!follow_linkurl">长按二维码添加客服</text>
+				</view>
+				<view class="qr_code_area" @click="followLinkurl">
 					<image v-if="followQrcode" :src="followQrcode" class="qr_code" mode="" show-menu-by-longpress></image>
 				</view>
 				<view class="rule_info">
@@ -236,6 +239,8 @@
 				},
 				// 客服二维码
 				followQrcode:"",
+				// 二维码链接
+				follow_linkurl:"",
 				// 是否登录状态
 				isShowPrice:false,
 				// 选择的skuid
@@ -508,10 +513,14 @@
 							}
 							// 范围内的做计算
 							if( isScope )			totalPrice = this.$decimal.add(totalPrice,this.$decimal.mul(this.productInfo.price,this.quantity));
+							// 是否在可用范围
+							this.couponList[i].is_scope 	=  isScope;
 						// 店铺券
 						}else{
 							// 店铺券
-							totalPrice				= this.$decimal.add(totalPrice,this.$decimal.mul(this.productInfo.price,this.quantity));
+							totalPrice						= this.$decimal.add(totalPrice,this.$decimal.mul(this.productInfo.price,this.quantity));
+							// 是否在可用范围
+							this.couponList[i].is_scope 	=  true;
 						}
 						// 判断价格到不到限额
 						this.couponList[i].is_std	= parseFloat(totalPrice.toFixed()) >= parseFloat(this.$decimal.mul(this.couponList[i].std_pay,1).toFixed());
@@ -641,6 +650,8 @@
 			openAddFollow(){
 				// 返回结果
 				this.followQrcode 		= this.$checkAccess.getFollowQrcode();
+				// 返回结果
+				this.follow_linkurl 	= this.$checkAccess.getFollowLinkUrl();
 				// 有图才展示
 				if( this.followQrcode )	this.$refs.addFollow.open('center');
 			},
@@ -755,6 +766,31 @@
 						return;
 					}
 				}
+			},
+			// 去往webview
+			followLinkurl(){
+				// 获取登录标识
+				let userInfo   					= uni.getStorageSync('userInfo');
+				// 如果不存在的话
+				if( !userInfo )					return '';
+				// 未添加好友
+				if( !userInfo.follow_linkurl )	return '';
+				// 获取Url
+				let  url			= userInfo.follow_linkurl;
+				// 没有路径,不跳转
+				if( !url )			return;
+				// 判断是不是小程序链接
+				if( url.includes('http') ){
+					// 转码
+					let link_url = encodeURIComponent(url);
+					// 跳转到webview
+					uni.redirectTo({
+						url:`/pages/webview/index?link_url=${link_url}`
+					})
+				}else{
+					// 跳转到webview
+					uni.navigateTo({url:url});
+				}
 			}
 		}
 	}
@@ -1407,17 +1443,17 @@
 			border-radius: 40rpx;
 			background: linear-gradient(to bottom, #ff0091 0%, #2c82ff 100%);
 			.close_area{
-				height: 100rpx;
+				height: 80rpx;
 				display: block;
-				line-height: 100rpx;
+				line-height: 80rpx;
 				.close_btn{
 					color: #FFFFFF;
 					float: right;
-					width: 100rpx;
-					height: 100rpx;
+					width: 80rpx;
+					height: 80rpx;
 					font-size: 26rpx;
 					text-align: center;
-					line-height: 100rpx;
+					line-height: 80rpx;
 					padding: 0rpx 0rpx;
 					border: 0rpx solid transparent;
 					background-color: transparent;

+ 43 - 44
pages/user/follow.vue

@@ -3,13 +3,21 @@
 		<uni-popup ref="addFollow" type="center" class="center_popup" :mask-click="false">
 			<view class="add_follow">
 				<view class="close_area">
-					<!-- <button class="close_btn" @click="closeAddFollow()">关闭</button> -->
+					
 				</view>
-				<view class="qr_code_area">
+				<view class="qr_code_area" @click="followLinkurl">
 					<image v-if="followQrcode" :src="followQrcode" class="qr_code" mode="" show-menu-by-longpress></image>
 				</view>
-				<view class="info_alter">长按识别二维码添加客服</view>
-				<!-- <button class="save_btn" @click="saveImage()">保存图片添加客服</button> -->
+				<view class="info_alter">
+					<text v-if="follow_linkurl">长按或点击二维码添加客服</text>
+					<text v-if="!follow_linkurl">长按二维码添加客服</text>
+				</view>
+				<view class="rule_info">
+					<view class="">规则:</view>
+					<view class="">1、预约报单需要添加客服人员</view>
+					<view class="">2、添加完客服人员后填写小程序当前登录手机号以绑定账号</view>
+					<view class="">3、开始预约报单</view>
+				</view>
 			</view>
 		</uni-popup>
 	</view>
@@ -20,6 +28,7 @@
 		data() {
 			return {
 				followQrcode:"",
+				follow_linkurl:"",
 			}
 		},
 		onShow() {
@@ -40,34 +49,39 @@
 			openAddFollow(){
 				// 返回结果
 				this.followQrcode 		= this.$checkAccess.getFollowQrcode();
+				// 返回结果
+				this.follow_linkurl 	= this.$checkAccess.getFollowLinkUrl();
 				// 有图才展示
 				if( this.followQrcode )	this.$refs.addFollow.open('center');
 			},
 			closeAddFollow(){
 				this.$refs.addFollow.close();
 			},
-			// 保存图片
-			saveImage(){
-				var that = this;
-				// 下载远程图片后保存到相册
-				uni.downloadFile({
-					url: this.followQrcode,
-					success:function(res) {
-						if(res.statusCode == 200){
-							uni.saveImageToPhotosAlbum({
-								filePath: res.tempFilePath,
-								success:function(res) {
-									uni.showToast({title:"保存成功",icon:'none'});
-									that.$refs.addFollow.close();
-								},
-								fail:function(err){
-									
-								}
-							});
-						}
-					},
-				})
-			},
+			// 去往webview
+			followLinkurl(){
+				// 获取登录标识
+				let userInfo   					= uni.getStorageSync('userInfo');
+				// 如果不存在的话
+				if( !userInfo )					return '';
+				// 未添加好友
+				if( !userInfo.follow_linkurl )	return '';
+				// 获取Url
+				let  url			= userInfo.follow_linkurl;
+				// 没有路径,不跳转
+				if( !url )			return;
+				// 判断是不是小程序链接
+				if( url.includes('http') ){
+					// 转码
+					let link_url = encodeURIComponent(url);
+					// 跳转到webview
+					uni.redirectTo({
+						url:`/pages/webview/index?link_url=${link_url}`
+					})
+				}else{
+					// 跳转到webview
+					uni.navigateTo({url:url});
+				}
+			}
 		}
 	}
 </script>
@@ -79,30 +93,15 @@
 			display: block;
 			color: #FFFFFF;
 			width: 700rpx;
-			height: 800rpx;
+			height: 900rpx;
 			margin: 0 auto;
 			font-size: 26rpx;
 			border-radius: 40rpx;
 			background: linear-gradient(to bottom, #ff0091 0%, #2c82ff 100%);
 			.close_area{
-				height: 100rpx;
+				height: 30rpx;
 				display: block;
-				line-height: 100rpx;
-				.close_btn{
-					color: #FFFFFF;
-					float: right;
-					width: 100rpx;
-					height: 100rpx;
-					font-size: 26rpx;
-					text-align: center;
-					line-height: 100rpx;
-					padding: 0rpx 0rpx;
-					border: 0rpx solid transparent;
-					background-color: transparent;
-				}
-				.close_btn::after{
-					border: 0rpx solid transparent;
-				}
+				line-height: 30rpx;
 			}
 			.info_alter{
 				display: block;

+ 14 - 1
utils/checkaccess.js

@@ -104,4 +104,17 @@ const getFollowQrcode	= ()=>{
 }
 
 
-export default {checkLogin:checkLogin,alterLogin:alterLogin,checkShowPrice:checkShowPrice,alertCity:alertCity,getFollowQrcode:getFollowQrcode,getCity:getCity}
+// 检查客服推送码
+const getFollowLinkUrl	= ()=>{
+	// 获取登录标识
+	let userInfo   					= uni.getStorageSync('userInfo');
+	// 如果不存在的话
+	if( !userInfo )					return '';
+	// 未添加好友
+	if( !userInfo.follow_linkurl )	return '';
+	// 返回结果
+	return 							userInfo.follow_linkurl;
+}
+
+
+export default {checkLogin:checkLogin,alterLogin:alterLogin,checkShowPrice:checkShowPrice,alertCity:alertCity,getFollowQrcode:getFollowQrcode,getFollowLinkUrl:getFollowLinkUrl,getCity:getCity}