Procházet zdrojové kódy

访客同学页面修改添加访客二维码生成

黄勇成 před 2 roky
rodič
revize
d26636a2d4

+ 4 - 3
src/main/webapp/WEB-INF/pages/admin/visitor/visitorOrderInfoList.jsp

@@ -18,10 +18,10 @@
 	<link href="<c:url value='/styles/lib/datatables/dataTables.bootstrap.css' />" rel="stylesheet" type="text/css" />
 	<!-- Theme style -->
 	<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet" type="text/css" />
-	<link href="<c:url value='/styles/visitor/visitorOrderInfoList.css?v=20220217'/>" rel="stylesheet" type="text/css" />
+	<link href="<c:url value='/styles/visitor/visitorOrderInfoList.css?v=20220610'/>" rel="stylesheet" type="text/css" />
 	<script type="text/javascript" src="<c:url value='/scripts/lib/template-native.js'/>"></script>
 	<script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
-
+	<script type="text/javascript" src="${ctx }/scripts/lib/plugins/qrcode/jquery.qrcode.min.js"></script>
 	<script type="text/javascript" src="<c:url value='/scripts/lib/layui/layui.js'/>"></script>
 	<script type="text/javascript" src="${ctx }/scripts/admin/cjqt.js"></script>
 
@@ -99,6 +99,7 @@
 				<button class="btn-white visitor-register visitor-list" type="button">访客登记</button>
 				<button class="btn-white through-plan" type="button">基础设置</button>
 				<button class="btn-white export-excel-order" type="button">导出excel</button>
+				<button class="btn-white reservation-code" type="button">访客预约码</button>
 
 				<!--  <button class="btn-white scan-print" type="button" style="width: 85px;">扫码打印</button>  -->
 			</div>
@@ -109,7 +110,7 @@
 <script type="text/html" id="indexTpl">
 	{{d.LAY_TABLE_INDEX+1}}
 </script>
-<script type="text/javascript" src="<c:url value='/scripts/admin/visitor/visitorOrderInfoList.js?v=20220220'/>"></script>
+<script type="text/javascript" src="<c:url value='/scripts/admin/visitor/visitorOrderInfoList.js?v=20220511.10'/>"></script>
 
 
 </html>

+ 130 - 2
src/main/webapp/scripts/admin/visitor/visitorOrderInfoList.js

@@ -273,6 +273,18 @@ $(function () {
 							</div>\
 						</div>\
 						<div class="view-flex">\
+							<div class="plan-title">预约信息确认:</div>\
+							<div class="xq_audit_item clearfloat required  group-item">\
+								<div class="checkbox-wp">\
+									<span class="checkbox-input">\
+									<input type="checkbox" id="make" class="check-item staple-make" data-id="6"/>\
+									<span class="checkbox-inner"></span>\
+									</span>		\
+									<label class="checkbox-con" for="wx-6">开启</label>\
+								</div>\
+							</div>\
+						</div>\
+						<div class="view-flex">\
 							<div class="plan-title">预约输入字段:</div>\
 							<div class="field-content"></div>\
 						</div>\
@@ -409,6 +421,36 @@ $(function () {
 					</div>\
 				</div>\
 			</div>	',
+		"visitorCodeTpl": '<div class="dialog-wp">\
+				<div class="mask"></div>\
+				<div class="dialog dialog-print-con">\
+					<div class="title-wp">\
+						<span>访客预约码</span>\
+						<span class="close-btn"></button>\
+					</div>\
+					<div class=" dialog-print-wp "  >\
+					   <div class="base-title" style="text-align: center;margin-bottom: 20px;"><%=orgName%></div>\
+					   <div class="print-item">\
+							<div class="p-i-tip">链接:</div>\
+							<div class="p-i-con">\
+								<span class="p-i-input p-span-url">\
+								<%=qrUrl%>\
+								</span>\
+							</div>\
+						</div>\
+						<div class="print-item">\
+							<button class="btn-white btn-copy">复制链接</button>\
+							<button class="btn-white btn-qr-code">生成二维码</button>\
+						</div>\
+						<div class="print-item">\
+							<div class="qr-left" id="qrCode"></div>\
+						</div>\
+					</div>\
+					<div class="dialog-btns">\
+						<button class="btn-white cancel-btn">返回</button>\
+					</div>\
+				</div>\
+			</div>',
 		"visitorModelTpl": '<div class="dialog-wp">\
 						<div class="mask"></div>\
 						<div class="dialog dialog-print-con">\
@@ -495,7 +537,8 @@ $(function () {
 				visitedCompType: 1,
 				visitedMobileType: 1,
 				visitCompType: 1,
-				visitNameType: 1
+				visitNameType: 1,
+				orderAffirm: 0
 			};
 			fieldList = [
 				{
@@ -656,6 +699,35 @@ $(function () {
 					}, function (index) {});
 
 			})
+
+			// 访客预约码
+			$(".reservation-code").on("click", function () {
+				var orgId = $("#conditionform  #orgId").attr('org__id');
+				_this.getVisitorQenterUrlHandler(orgId, backData => {
+					if (!backData) {
+						return;
+					}
+					console.log('backData', backData);
+					$("body").append(template.render(tpl.visitorCodeTpl)({
+						orgName: $("#conditionform  #orgId").val(),
+						qrUrl: backData
+					}));
+
+					$(".btn-copy").on("click", function () {
+						_this.copyToClipboard(backData)
+					})
+
+					$(".btn-qr-code").on("click", function () {
+						$("#qrCode").empty(); // 清空子元素
+						$("#qrCode").qrcode({width:200,height:200,text:backData});
+					})
+
+					$(".close-btn,.dialog-wp .cancel-btn").on("click", function () {
+						$(".dialog-wp").remove();
+					})
+				});
+			})
+
 			// 通行方案设计
 			$(".through-plan").on("click", function () {
 				$("body").append(template.render(tpl.throughTpl)({
@@ -701,6 +773,16 @@ $(function () {
 					})
 					_this.upFieldDataUI()
 				})
+				$(".staple-make").on("click",function(){
+					let arr = $(".xq_audit_item .staple-make:checked")
+					if (arr.length>0) {
+						if ($(arr[0]).data("id") == 6) {
+							setData.orderAffirm = 1;
+						}
+					} else {
+						setData.orderAffirm = 0;
+					}
+				})
 				$(".save_btn").on("click", function () {
 					var orgId = $('.meal-select#orgId').attr('org__id')
 					var passType = "",koalaAuthUrl= "",koalaUserName= "",koalaUserPwd= "",show = false
@@ -815,6 +897,24 @@ $(function () {
 				}
 			});
 		},
+
+		copyToClipboard: function(str) {
+			const el = document.createElement('textarea'); //创建input对象
+			el.value = str;
+			el.setAttribute('readonly', '');  //当前获得焦点的元素
+			el.style.position = 'absolute';
+			el.style.left = '-9999px';
+			document.body.appendChild(el); //添加元素
+			const selectedStr = document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false;
+			el.select();
+			document.execCommand('copy'); //执行复制
+			document.body.removeChild(el);//删除元素
+			if (selectedStr) {
+				document.getSelection().removeAllRanges();
+				document.getSelection().addRange(selectedStr);
+			}
+			layer.msg('复制完成')
+		},
 		//导出
 		exportAjax: function () {
 			var _this = this;
@@ -933,6 +1033,7 @@ $(function () {
 				click_callback:function(){
 					var orgId = $('.meal-select#orgId').attr('org__id')
 					_this.getCaseDetail(orgId)
+					_this.getSetData(orgId)
 				} })
 		},
 		//模糊搜索事件
@@ -1332,6 +1433,29 @@ $(function () {
 			}
 			return fmt
 		},
+		// 获取访客预约码地址
+		getVisitorQenterUrlHandler: function (orgId, callback) {
+			console.log('orgId', orgId);
+			let contextPath = window.location.hostname === 'localhost'? 'https://wx.palmnest.com/super_cloud' : $("#contextPath").val().split("super_service")[0]+"super_cloud"
+			$.ajax({
+				type: "post",
+				url: contextPath + "/api/organisation/wechat/qenter/getVisitorQenterUrl",
+				data: {
+					"orgId": orgId,
+				},
+				success: function (data) {
+					if (data && data.code == 200) {
+						callback(data.data);
+					} else {
+						layer.msg(data.msg);
+						callback();
+					}
+				},
+				error: function (error) {
+					layer.msg('error')
+				}
+			});
+		},
 		visitorRegister: function (data, callback) {
 			var _this = this;
 			$.ajax({
@@ -1502,7 +1626,8 @@ $(function () {
 								visitedCompType: data.data.visitedCompType,
 								visitedMobileType: data.data.visitedMobileType,
 								visitCompType: data.data.visitCompType,
-								visitNameType: data.data.visitNameType
+								visitNameType: data.data.visitNameType,
+								orderAffirm: data.data.orderAffirm
 							}
 							fieldList.forEach(item => {
 								if (item.label === '被访人公司') {
@@ -1530,6 +1655,9 @@ $(function () {
 							if (setData.isLinglingAudit == 1) {
 								$("#audit").attr("checked",true);
 							}
+							if (setData.orderAffirm == 1) {
+								$("#make").attr("checked",true);
+							}
 							_this.upFieldDataUI()
 						}
 					}

+ 29 - 0
src/main/webapp/styles/visitor/visitorOrderInfoList.css

@@ -197,6 +197,35 @@
 	border: 1px solid #ddd;
 	border-radius: 4px;
 }
+.print-item .p-i-con .p-span-url{
+	float: left;
+	height: auto;
+	min-width: 50%;
+	max-width: 80%;
+	white-space: normal;
+	word-wrap: break-word;
+}
+
+.print-item .btn-copy{
+	margin-left: 120px !important;
+	height: 35px !important;
+	line-height: 35px !important;
+}
+
+.print-item .btn-qr-code {
+	margin-left: 20px !important;
+	height: 35px !important;
+	line-height: 35px !important;
+	background: #34A0FE !important;
+	color: white !important;
+}
+.print-item .btn-qr-code:hover {
+	color: #dfdfdf !important;
+	background: #287bc4 !important;
+}
+.print-item .qr-left {
+	margin-left: 120px;
+}
 .id-number{
 	position: relative
 }