Преглед на файлове

【Mod】关闭强制添加客服,增加添加客服页面

liuxiangxin преди 7 месеца
родител
ревизия
af00ff2b4e
променени са 8 файла, в които са добавени 218 реда и са изтрити 95 реда
  1. 22 76
      App.vue
  2. 7 0
      pages.json
  3. 21 7
      pages/index/index.vue
  4. 14 6
      pages/orders/completion.vue
  5. 2 2
      pages/product/index.vue
  6. 10 3
      pages/score/index.vue
  7. 141 0
      pages/user/follow.vue
  8. 1 1
      utils/request.js

+ 22 - 76
App.vue

@@ -1,13 +1,34 @@
 <script>
 	export default {
+		data() {
+			return {
+				getOn:true,
+			}
+		},
 		onLaunch: function(param) {
-			console.log(param);
+			
 		},
 		onShow: function() {
 			// #ifdef MP
 			// 检查是否升级
 			this.checkForUpdate();
 			// #endif
+			// 进入小程序,如果需要推送客服,请求客户信息,获取最新的微伴ID
+			if( this.$checkAccess.getFollowQrcode() ){
+				if( !this.getOn )  return ;
+				this.getOn = false;
+				// 判断数据
+				this.$http.request('api/custom/get_info').then((callback)=>{
+					this.getOn = true;
+					if( callback.code == 'success' ){
+						if( !callback.data.userpic ) callback.data.userpic = "../../static/icon/doctor.png";
+						// 赋值
+						this.userInfo = callback.data;
+						// 存储登录标识
+						uni.setStorageSync('userInfo',callback.data);
+					}
+				});
+			}
 		},
 		onHide: function() {
 			console.log('App Hide');
@@ -69,79 +90,4 @@
 		text-align: center;
 		padding-bottom: 160rpx;
 	}
-	// 添加客服
-	.center_popup{
-		.add_follow{
-			display: block;
-			color: #FFFFFF;
-			width: 700rpx;
-			height: 1100rpx;
-			margin: 0 auto;
-			font-size: 26rpx;
-			border-radius: 40rpx;
-			background: linear-gradient(to bottom, #ff0091 0%, #2c82ff 100%);
-			.close_area{
-				height: 100rpx;
-				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;
-				}
-			}
-			.info_alter{
-				display: block;
-				height: 100rpx;
-				font-size: 42rpx;
-				font-weight: bold;
-				text-align: center;
-				line-height: 100rpx;
-			}
-			.qr_code_area{
-				display: block;
-				width: 300rpx;
-				height: 300rpx;
-				margin: 60rpx auto;
-				.qr_code{
-					float: left;
-					width: 300rpx;
-					height: 300rpx;
-				}
-			}
-			.save_btn{
-				color: #333333;
-				display: block;
-				width: 260rpx;
-				height: 80rpx;
-				font-size: 26rpx;
-				text-align: center;
-				line-height: 80rpx;
-				padding: 0rpx 0rpx;
-				margin: 40rpx auto;
-				border-radius: 40rpx;
-				background-color: #FFFFFF;
-				border: 0rpx solid transparent;
-			}
-			.rule_info{
-				width: 600rpx;
-				display: block;
-				font-size: 26rpx;
-				margin: 20rpx auto;
-				overflow: hidden;
-				line-height: 60rpx;
-			}
-		}
-	}
-	
 </style>

+ 7 - 0
pages.json

@@ -132,6 +132,13 @@
 			{
 				"navigationBarTitleText" : "活动页面"
 			}
+		},
+		{
+			"path" : "pages/user/follow",
+			"style" : 
+			{
+				"navigationBarTitleText" : "添加客服"
+			}
 		}
 	],
 	"globalStyle": {

+ 21 - 7
pages/index/index.vue

@@ -190,12 +190,20 @@
 			navLottery(url){
 				// 没有路径,不跳转
 				if( !url )	return;
-				// 转码
-				let link_url = encodeURIComponent(url);
-				// 跳转到webview
-				uni.redirectTo({
-					url:`/pages/webview/index?link_url=${link_url}`
-				})
+				// 判断是不是小程序链接
+				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
+					})
+				}
 			}
 		}
 	}
@@ -291,6 +299,7 @@
 			.product_item{
 				float: left;
 				width: 320rpx;
+				height: 520rpx;
 				display: block;
 				overflow: hidden;
 				margin: 20rpx 0rpx;
@@ -306,14 +315,19 @@
 					font-size: 30rpx;
 					line-height: 40rpx;
 					overflow: hidden;
-					padding: 10rpx 10rpx;
+					margin: 10rpx 0rpx;
+					padding: 0rpx 10rpx;
 					text-overflow: ellipsis;
 				}
 				.product_spec{
+					height: 30rpx;
 					color: #999999;
 					font-size: 24rpx;
 					line-height: 30rpx;
 					padding: 0rpx 10rpx;
+					overflow: hidden;
+					white-space: nowrap;
+					text-overflow: ellipsis;
 				}
 				.stock_price{
 					color: #dddddd;

+ 14 - 6
pages/orders/completion.vue

@@ -75,12 +75,20 @@
 			navLottery(url){
 				// 没有路径,不跳转
 				if( !url )	return;
-				// 转码
-				let link_url = encodeURIComponent(url);
-				// 跳转到webview
-				uni.redirectTo({
-					url:`/pages/webview/index?link_url=${link_url}`
-				})
+				// 判断是不是小程序链接
+				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
+					})
+				}
 			}
 		}
 	}

+ 2 - 2
pages/product/index.vue

@@ -257,7 +257,7 @@
 		},
 		onShow() {
 			// 没有添加客服就不显示
-			this.isShowPrice = this.$checkAccess.getFollowQrcode() ? 0 : 1;
+			this.isShowPrice = this.$checkAccess.checkShowPrice();
 			// 如果存在产品ID的话
 			if( this.requestParam.id > 0) {
 				// 请求详情
@@ -283,7 +283,7 @@
 				// 登录提示
 				if( !this.$checkAccess.alterLogin()) return ;
 				// 判断是否弹出
-				if( this.$checkAccess.getFollowQrcode() ) return this.openAddFollow();
+				// if( this.$checkAccess.getFollowQrcode() ) return this.openAddFollow();
 				// 显示类型,1预约,2购物车
 				this.specBtnType  = type;
 				// 恢复优惠券使用按钮

+ 10 - 3
pages/score/index.vue

@@ -213,6 +213,7 @@
 			.product_item{
 				float: left;
 				width: 320rpx;
+				height: 490rpx;
 				display: block;
 				overflow: hidden;
 				margin: 20rpx 0rpx;
@@ -225,16 +226,22 @@
 				}
 				.product_name{
 					height: 80rpx;
-					font-size: 26rpx;
+					font-size: 30rpx;
 					line-height: 40rpx;
 					overflow: hidden;
-					padding: 10rpx 10rpx;
+					margin: 10rpx 0rpx;
+					padding: 0rpx 10rpx;
+					text-overflow: ellipsis;
 				}
 				.product_spec{
+					height: 30rpx;
 					color: #999999;
-					font-size: 22rpx;
+					font-size: 24rpx;
 					line-height: 30rpx;
 					padding: 0rpx 10rpx;
+					overflow: hidden;
+					white-space: nowrap;
+					text-overflow: ellipsis;
 				}
 				.stock_price{
 					color: #dddddd;

+ 141 - 0
pages/user/follow.vue

@@ -0,0 +1,141 @@
+<template>
+	<view>
+		<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="info_alter">长按识别二维码添加客服</view>
+				<view class="qr_code_area">
+					<image v-if="followQrcode" :src="followQrcode" class="qr_code" mode="" show-menu-by-longpress></image>
+				</view>
+				<button class="save_btn" @click="saveImage()">保存图片添加客服</button>
+			</view>
+		</uni-popup>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				followQrcode:"",
+			}
+		},
+		onShow() {
+			this.openAddFollow();
+		},
+		methods: {
+			// 客服显示
+			openAddFollow(){
+				// 返回结果
+				this.followQrcode 		= this.$checkAccess.getFollowQrcode();
+				// 有图才展示
+				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){
+									
+								}
+							});
+						}
+					},
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+// 添加客服
+	.center_popup{
+		.add_follow{
+			display: block;
+			color: #FFFFFF;
+			width: 700rpx;
+			height: 1100rpx;
+			margin: 0 auto;
+			font-size: 26rpx;
+			border-radius: 40rpx;
+			background: linear-gradient(to bottom, #ff0091 0%, #2c82ff 100%);
+			.close_area{
+				height: 100rpx;
+				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;
+				}
+			}
+			.info_alter{
+				display: block;
+				height: 100rpx;
+				font-size: 42rpx;
+				font-weight: bold;
+				text-align: center;
+				line-height: 100rpx;
+			}
+			.qr_code_area{
+				display: block;
+				width: 300rpx;
+				height: 300rpx;
+				margin: 60rpx auto;
+				.qr_code{
+					float: left;
+					width: 300rpx;
+					height: 300rpx;
+				}
+			}
+			.save_btn{
+				color: #333333;
+				display: block;
+				width: 260rpx;
+				height: 80rpx;
+				font-size: 26rpx;
+				text-align: center;
+				line-height: 80rpx;
+				padding: 0rpx 0rpx;
+				margin: 40rpx auto;
+				border-radius: 40rpx;
+				background-color: #FFFFFF;
+				border: 0rpx solid transparent;
+			}
+			.rule_info{
+				width: 600rpx;
+				display: block;
+				font-size: 26rpx;
+				margin: 20rpx auto;
+				overflow: hidden;
+				line-height: 60rpx;
+			}
+		}
+	}
+	
+</style>

+ 1 - 1
utils/request.js

@@ -2,7 +2,7 @@
 var domain = 'https://kailin.dfwy.tech/'
 // #ifdef MP-WEIXIN
 // 'http://127.0.0.1:8000/';
-domain = uni.getAccountInfoSync().miniProgram.envVersion == 'release' ? 'https://mall.findit.ltd/' : 'https://kailin.dfwy.tech/';
+domain = 'https://mall.findit.ltd/';//uni.getAccountInfoSync().miniProgram.envVersion == 'release' ? 'https://mall.findit.ltd/' : 'https://kailin.dfwy.tech/';
 // #endif
 
 // 发送网络请求的函数