<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
<%--
|
Created by IntelliJ IDEA.
|
User: Dell
|
Date: 2023/6/20
|
Time: 14:33
|
To change this template use File | Settings | File Templates.
|
--%>
|
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
<html>
|
<head>
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<link href="/HxzkFlow/images/favicon.ico" rel="icon" type="image/x-icon"/>
|
<link rel="stylesheet" href="/HxzkFlow/css/layui.css" media="all">
|
<style>
|
/* 小型手机 */
|
@media (max-width: 360px) {
|
|
}
|
</style>
|
<title>Title</title>
|
<style>
|
|
.panbox{
|
width: 540px;
|
height: 130px;
|
float: left;
|
margin-left: 20px;
|
margin-top: 10px;
|
color: white;
|
font-size: 22px;
|
}
|
</style>
|
</head>
|
<body>
|
|
<form class="layui-form layui-row layui-col-space16" style="width: 1672px;margin-left: 12px;padding-bottom: 10px">
|
<div class="layui-col-md4" style="position: relative;top: 89px;z-index: 999;width: 150px;left: 500px">
|
<div class="layui-input-wrap">
|
<input type="text" name="cardnumber" style="width: 220px" value="" placeholder="请输入卡号/备注" class="layui-input" lay-affix="clear">
|
</div>
|
</div>
|
<div class="layui-col-md4" style="margin-left: 20px">
|
<div class="layui-input-wrap" style="position: relative;top: 89px;z-index: 999;width: 150px;left: 560px">
|
<input type="text" name="company" style="width: 150px" placeholder="请输入所属公司" lay-affix="clear" class="layui-input">
|
</div>
|
</div>
|
<%-- <div class="layui-col-md4" style="float: left;width: 551px;margin-left: 4px">--%>
|
<%-- <div class="layui-input-wrap" style="position: relative;top: 89px;z-index: 99999;width: 150px;left: 92px">--%>
|
<%-- <input type="text" name="bindid" style="width: 150px" placeholder="请输入绑定设备" lay-affix="clear" class="layui-input">--%>
|
<%-- </div>--%>
|
<%-- </div>--%>
|
<button style="position: relative;top: 96.5px;z-index: 999;width: 70px;left: -400px" id="relo" class="layui-btn layui-btn-normal" lay-filter="demo-table-search1">刷新</button>
|
<button style="position: relative;top: 96.5px;z-index: 999;width: 80px;left: 90px" class="layui-btn layui-btn-normal" lay-submit lay-filter="demo-table-search" lay-event="getselect">查询</button>
|
</form>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container" style="margin-left: 0px;margin-top: 20px;display: inline-block">
|
<button class="layui-btn" lay-event="getadd">新增</button>
|
<button class="layui-btn layui-btn-warm" onclick="update()" lay-event="getUpdate">修改</button>
|
<button class="layui-btn layui-btn-danger" lay-event="getDelete">删除</button>
|
<button class="layui-btn" lay-event="getchongzhi">充值</button>
|
|
</div>
|
</script>
|
|
<script type="text/html" id="toolbarDemo1">
|
<div class="layui-btn-container" style="margin-left: 0px;margin-top: 20px;display: inline-block">
|
<button class="layui-btn" lay-event="getchongzhi">充值</button>
|
</div>
|
</script>
|
<div style="display: inline-block;width: 100%;margin-left: 20px">
|
<table id="demo" lay-filter="demo"></table>
|
</div>
|
<div class="heimu" style="display: none;width: 100%;height: 100%;position: fixed;top: 0px;left: 0px;z-index: 9999;background-color: black;opacity: 0.8"></div>
|
<div class="add" style="display: none;width: 600px;background-color: white;border: 1px solid #cccccc;padding: 50px;border-radius: 20px;position: fixed;top: 50px;left: 450px;z-index: 99999">
|
<form class="layui-form" action="/HxzkFlow/hxzk/addCard" method="post" lay-filter="example" onsubmit="return checkadd()">
|
<div class="layui-form-item">
|
<label class="layui-form-label">所属公司:</label>
|
<div class="layui-input-block">
|
<input type="text" name="company" id="companyadd1" lay-verify="title" autocomplete="off" placeholder="" onkeyup="xzGongSi()" onfocus="xz()" class="layui-input">
|
</div>
|
<div style="width:488px;height: 400px;overflow-y: scroll;border: 1px solid #EEEEEE;border-top: none;position: absolute;left: 160px;z-index: 999;background-color: white;display: none" id="ZsGs">
|
<c:forEach items="${suoshu}" var="k">
|
<p onclick="xzGong('${k.companyname}')" style="cursor: pointer;height: 40px;line-height: 40px;padding-left: 10px;border-bottom: 1px solid #f6f6f6">${k.companyname}</p>
|
</c:forEach>
|
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">卡号:</label>
|
<div class="layui-input-block">
|
<input type="text" name="cardnumber" id="cardnumberadd1" lay-verify="title" autocomplete="off" placeholder="请输入卡号,N个卡号需要 ; 分隔" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">开始日期:</label>
|
<div class="layui-input-block">
|
<input type="date" name="carddate" id="carddateadd1" placeholder="请输入密码" autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">选择流量:</label>
|
<div class="layui-input-block">
|
<select name="flow" lay-filter="ddtt" id="flowadd1">
|
<option value=""></option>
|
<option value="12G/年">12G/年</option>
|
<option value="24G/年">24G/年</option>
|
<option value="36G/年">36G/年</option>
|
<option value="100G/年">100G/年</option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">运营商:</label>
|
<div class="layui-input-block">
|
<select name="operator" id="operatoradd1" lay-filter="aihao" >
|
<option value=""></option>
|
<option value="移动" >移动</option>
|
<option value="联通" >联通</option>
|
<option value="电信">电信</option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-form-item">
|
<label class="layui-form-label">单价/元:</label>
|
<div class="layui-input-block">
|
<%-- <input type="text" lay-verify="number" name="nTopAmount" value="0.000" onblur="value=zhzs(this.value)" class="layui-input"/>--%>
|
|
<%-- <span id="feiyong" style="margin-top: 10px;display: inline-block;margin-left: 10px"></span>--%>
|
<input type="text" id="feiyongadd" name="unitprice" lay-verify="number" value="0" onblur="value=zhzs(this.value)" autocomplete="off" placeholder="" class="layui-input">
|
</div>
|
</div>
|
</div>
|
|
<div class="layui-form-item" >
|
<label class="layui-form-label" style="width: 20% ;margin-left: -40px">绑定设备ID:</label>
|
<div class="layui-input-block">
|
<input type="text" name="bindid" id="bindidadd1" lay-verify="title" autocomplete="off" placeholder="请输入绑定设备ID,N个格式同于卡号" class="layui-input">
|
</div>
|
</div>
|
<%-- <div class="layui-form-item">--%>
|
<%-- <label class="layui-form-label">所在地:</label>--%>
|
<%-- <div class="layui-input-block">--%>
|
<%-- <input type="text" name="location" id="locationadd1" lay-verify="title" autocomplete="off" placeholder="请输入所在地" class="layui-input">--%>
|
<%-- </div>--%>
|
<%-- </div>--%>
|
<div class="layui-form-item">
|
<label class="layui-form-label">备注:</label>
|
<div class="layui-input-block">
|
<input type="text" name="notes" id="notesadd1" lay-verify="title" autocomplete="off" placeholder="选填" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">结束日期:</label>
|
<div class="layui-input-block">
|
<input type="date" name="enddate" id="enddateadd1" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-input-block">
|
<button type="submit" class="layui-btn" lay-submit="" lay-filter="demoadd">立即提交</button>
|
<button type="button" class="layui-btn layui-btn-normal" lay-filter="demo1" onclick="canseladd()" style="margin-left: 200px">取消</button>
|
</div>
|
</div>
|
</form>
|
</div>
|
<div class="chongzhi" style="display: none;width: 500px;background-color: white;border-radius: 20px;border: 1px solid #ccc;padding: 50px;position: fixed;top: 150px;left: 500px;z-index: 99999">
|
<form class="layui-form" action="" lay-filter="example">
|
<div class="layui-form-item">
|
<label class="layui-form-label">卡号:</label>
|
<div class="layui-input-block">
|
<input type="text" name="username" disabled id="cardnumber" lay-verify="title" autocomplete="off" placeholder="请选择卡号" class="layui-input">
|
<span class="hao" style="color: red;margin-top: 9px;display: inline-block"></span>
|
</div>
|
</div>
|
<%-- <div class="layui-form-item">--%>
|
<%-- <label class="layui-form-label">选择流量</label>--%>
|
<%-- <div class="layui-input-block">--%>
|
<%-- <select name="interest" lay-filter="ddtt" id="flow">--%>
|
<%-- <option value=""></option>--%>
|
<%-- <option value="12">12G/年</option>--%>
|
<%-- <option value="24">24G/年</option>--%>
|
<%-- <option value="36">36G/年</option>--%>
|
<%-- </select>--%>
|
<%-- </div>--%>
|
<%-- </div>--%>
|
<div class="chongzhi">
|
<div class="layui-form-item">
|
<label class="layui-form-label">单价/元:</label>
|
<div class="layui-input-block">
|
<span id="feiyong" name = "unitprice" style="margin-top: 10px;display: inline-block;margin-left: 10px"></span>
|
<%-- <input type="text" id="feiyong" name="username" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">--%>
|
</div>
|
</div>
|
</div>
|
<div class="chongzhi">
|
<div class="layui-form-item">
|
<label class="layui-form-label">总价:</label>
|
<div class="layui-input-block">
|
<span id="zongjia" name = "zongjia" style="margin: 10px;display: inline-block"></span>
|
<%-- <input type="text" id="zongjia" name="zongjia" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">--%>
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-input-block">
|
<input type="button" class="layui-btn" value="立即提交" onclick="chongzhitj()"></input>
|
<button type="reset" class="layui-btn layui-btn-normal" lay-filter="demo1" onclick="canselchongzhi()" style="margin-left: 200px">取消</button>
|
</div>
|
</div>
|
</form>
|
</div>
|
<div class="update" style="width: 500px;border: 1px solid #ccc;padding: 50px;border-radius: 20px;position: fixed;top: 150px;left: 500px;z-index: 99999;background-color: white;display: none">
|
<form class="layui-form" action="/HxzkFlow/hxzk/Update" method="post" lay-filter="example">
|
<input type="text" name="num" style="display: none" class="upnum"/>
|
<div class="layui-form-item">
|
<label class="layui-form-label">绑定设备ID:</label>
|
<div class="layui-input-block">
|
<input type="text" name="bindid" lay-verify="title" autocomplete="off" placeholder="请输入设备ID" class="layui-input">
|
</div>
|
</div>
|
<%-- <div class="layui-form-item">--%>
|
<%-- <label class="layui-form-label">所在地:</label>--%>
|
<%-- <div class="layui-input-block">--%>
|
<%-- <input type="text" name="location" lay-verify="title" autocomplete="off" placeholder="请输入所在地" class="layui-input">--%>
|
<%-- </div>--%>
|
<%-- </div>--%>
|
<div class="layui-form-item">
|
<label class="layui-form-label">备注:</label>
|
<div class="layui-input-block">
|
<input type="text" name="notes" lay-verify="title" autocomplete="off" placeholder="请输入备注" class="layui-input">
|
</div>
|
</div>
|
<div class="chongzhi">
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-input-block">
|
<button type="submit" class="layui-btn" lay-submit="" lay-filter="demoupdate">立即提交</button>
|
<button type="button" class="layui-btn layui-btn-normal" lay-filter="demo1" onclick="canselupdate()" style="margin-left: 200px">取消</button>
|
</div>
|
</div>
|
</form>
|
</div>
|
<div class="updateZong" style="width: 500px;border: 1px solid #ccc;padding: 50px;border-radius: 20px;position: fixed;top: 150px;left: 500px;z-index: 99999;background-color: white;display: none">
|
<form class="layui-form" action="/HxzkFlow/hxzk/Update" method="post" lay-filter="example">
|
<input type="text" name="num" style="display: none" class="upnum"/>
|
<div class="layui-form-item">
|
<label class="layui-form-label">卡号:</label>
|
<div class="layui-input-block">
|
<input type="text" name="cardnumber" id="xgkh" lay-verify="title" autocomplete="off" placeholder="请输入设备ID" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">所属公司:</label>
|
<div class="layui-input-block">
|
<input type="text" name="company" id="xggs" disabled lay-verify="title" autocomplete="off" placeholder="请输入所属公司" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">开始日期:</label>
|
<div class="layui-input-block">
|
<input type="date" id="carddateu" name="carddate" lay-verify="title" autocomplete="off" placeholder="请输入开始日期" class="layui-input">
|
</div>
|
</div>
|
|
<div class="layui-form-item">
|
<div class="layui-form-item">
|
<label class="layui-form-label">单价/元:</label>
|
<div class="layui-input-block">
|
<%-- <input type="text" lay-verify="number" name="nTopAmount" value="0.000" onblur="value=zhzs(this.value)" class="layui-input"/>--%>
|
|
<%-- <span id="feiyong" style="margin-top: 10px;display: inline-block;margin-left: 10px"></span>--%>
|
<input type="text" id="unitpriceu" name="unitprice" lay-verify="number" value="0" onblur="value=zhzs(this.value)" autocomplete="off" placeholder="" class="layui-input">
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">结束日期:</label>
|
<div class="layui-input-block">
|
<input type="date" name="enddate" id="enddateu" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">选择流量:</label>
|
<div class="layui-input-block">
|
<select name="flow" lay-filter="ddtt">
|
<option value="12G/年">12G/年</option>
|
<option value="24G/年">24G/年</option>
|
<option value="36G/年">36G/年</option>
|
<option value="100G/年">100G/年</option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label">运营商:</label>
|
<div class="layui-input-block">
|
<select name="operator" lay-filter="aihao" >
|
<%-- <option value="operatoru">#{operatoru}</option>--%>
|
<option value="移动" >移动</option>
|
<option value="联通" >联通</option>
|
<option value="电信">电信</option>
|
</select>
|
</div>
|
</div>
|
<%-- <div class="layui-form-item">--%>
|
<%-- <label class="layui-form-label">运营商信息:</label>--%>
|
<%-- <div class="layui-input-block">--%>
|
<%-- <input type="text" name="operator" id="operatoru"lay-verify="title" autocomplete="off" placeholder="请输入备注" class="layui-input" disabled>--%>
|
<%-- </div>--%>
|
<%-- </div>--%>
|
<div class="chongzhi">
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-input-block">
|
<button type="submit" class="layui-btn" onclick="chongzhitj()" lay-filter="demoupdate">立即提交</button>
|
<button type="button" class="layui-btn layui-btn-normal" lay-filter="demo1" onclick="canselupdate()" style="margin-left: 200px">取消</button>
|
</div>
|
</div>
|
</form>
|
</div>
|
<div id="fhfrom"></div>
|
|
<script type="text/html" id="titleTpl">
|
{{# if(d.status === '待激活') { }}
|
<button class="layui-btn layui-btn-sm layui-btn-warm">待激活</button>
|
{{# } else if(d.status === '已激活') { }}
|
<button class="layui-btn layui-btn-sm">已激活</button>
|
{{# } else if(d.status === '已到期') { }}
|
<button class="layui-btn layui-btn-sm layui-btn-danger">已到期</button>
|
{{# } else if(d.status === '预销户') { }}
|
<button class="layui-btn layui-btn-sm layui-btn-primary layui-btn-primary layui-btn-primary layui-bg-blue">预销户</button>
|
{{# } else if(d.status === '已销户') { }}
|
<button class="layui-btn layui-btn-sm layui-btn layui-bg-cyan" >已销户</button>
|
{{# } else { }}
|
<button class="layui-btn layui-btn-sm layui-btn-primary layui-btn-primary layui-btn-primary layui-btn-primary">未知</button>
|
{{# } }}
|
</script>
|
</body>
|
<script src="/HxzkFlow/js/layui.js" charset="utf-8"></script>
|
<script src="../js/jquery-3.5.1.js"></script>
|
<script>
|
var qb = localStorage.getItem("gsjc")
|
var data = "qb="+qb
|
|
var chongzhiCompany = "";
|
|
var accessKey = "448c2cedcdce41428a290d144e81ab6e"
|
var accessSecret = "RgoIWycMYGmQfrLwLuT2VWawAhwMO8w7P9zh2dZp"
|
var str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
var nonce = '';
|
const now = new Date();
|
const year = now.getFullYear();
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
const day = String(now.getDate()).padStart(2, '0');
|
const hours = String(now.getHours()).padStart(2, '0');
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
const formattedTime = year + month + day + hours + minutes + seconds;
|
for (var i = 30; i > 0; --i)
|
nonce += str[Math.floor(Math.random() * str.length)];
|
|
var stringSignTemp = accessKey+nonce+formattedTime
|
function zhzs(value) {
|
value = value.replace(/[^\d]/g, '').replace(/^0{1,}/g, '');
|
if (value != '')
|
value = parseFloat(value).toFixed(0);
|
else
|
value = parseFloat(0).toFixed(0);
|
return value;
|
}
|
|
function xzGongSi(){
|
var company = $("#companyadd1").val();
|
var data = "companyname="+company
|
$.post("/HxzkFlow/hxzk/MoHuGongSi",data,function (data){
|
var str = [];
|
if(data.length !=0){
|
for(var i = 0; i < data.length;i++){
|
$("#ZsGs").empty();
|
data[i].company = "'"+data[i].companyname+"'"
|
str += '<p onclick="xzGong('+data[i].company+')" style="cursor: pointer;height: 40px;line-height: 40px;padding-left: 10px;border-bottom: 1px solid #f6f6f6">'+data[i].companyname+'</p>'
|
}
|
}
|
$("#ZsGs").append(str)
|
})
|
$("#ZsGs").show()
|
}
|
function xz(){
|
$("#ZsGs").show()
|
}
|
function xzGong(id){
|
$("#companyadd1").val(id)
|
$("#ZsGs").hide()
|
}
|
|
function clasp(){
|
var items = new Array();
|
items = $("#operatoradd1 option:selected");
|
//此处取到了每个item,items[i].text则取到的是option中的文字,下面取到的是value属性
|
for(var i = 0;i<items.length;i++){
|
itemTitle = items[i].value;
|
}
|
}
|
if(qb === "华星智控"){
|
// url: 'https://api.spruceiot.cn/api/v1/sim/detail/query',
|
//查找所有卡号
|
// $.ajax({
|
// url: '/HxzkFlow/hxzk/proxyfindCard',
|
// method: 'POST',
|
// data: {
|
// },
|
// success: function (data) {
|
// var str = "";
|
// var num = 0;
|
// for (var i =2880; i<2894; i++){
|
// num++
|
// if (num == 90){
|
// str += data[i].cardnumber
|
// }else{
|
// str += data[i].cardnumber+","
|
// }
|
// }
|
// $.ajax({
|
// url: '/HxzkFlow/hxzk/wlk',
|
// data: {
|
// Nonce: nonce,
|
// Timestamp: formattedTime,
|
// targetUrl: "https://api.spruceiot.cn/api/v1/sim/detail/batch/query",
|
// targetUrl1: "?cNo="+str
|
// },
|
// success: function (data) {
|
// var zflow ="" //套餐总量
|
// var syflow = ""//套餐已用
|
// var operator = "" //运营商
|
// var carddate = "" // 开始日期 录入日期
|
// var enddate = "" //结束日期
|
// for (var i = 0; i <data.result.length;i++){
|
// var sy = parseInt(data.result[i].dataLimit-data.result[i].dataUsage)
|
// $.ajax({
|
// url: '/HxzkFlow/hxzk/proxyupXinXi',
|
// method:'POST',
|
// data:{
|
// cardnumber:data.result[i].msisdn,
|
// zflow:data.result[i].dataLimit,
|
// syflow:sy,
|
// operator:data.result[i].operators,
|
// carddate:data.result[i].serviceStartDate,
|
// enddate:data.result[i].serviceEndDate,
|
// enterdate:data.result[i].serviceStartDate
|
// },
|
// success:function (data){
|
// console.log(data)
|
// }
|
// })
|
// }
|
// }
|
// })
|
// }
|
// })
|
|
|
//查找流量池名称
|
// $.ajax({
|
// url: '/HxzkFlow/hxzk/wlk',
|
// data: {
|
// Nonce: nonce,
|
// Timestamp: formattedTime,
|
// targetUrl: "https://api.spruceiot.cn/api/v1/pool/list/query",
|
// targetUrl1: "?queryType=0&pageIndex=1&pageSize=100"
|
// },
|
// success: function (data) {
|
//
|
// for (var i = 0; i<data.result.list.length;i++){
|
// console.log(data.result.list[i].name)
|
// }
|
// }
|
// })
|
|
//更改卡号公司名称
|
// $.ajax({
|
// url: '/HxzkFlow/hxzk/wlk',
|
// data: {
|
// Nonce: nonce,
|
// Timestamp: formattedTime,
|
// targetUrl: "https://api.spruceiot.cn/api/v1/pool/member/query",
|
// targetUrl1: "?poolID=80&pageIndex=1&pageSize=100"
|
// },
|
// success: function (data) {
|
//
|
// for(var i =0; i<data.result.list.length;i++){
|
// console.log(data.result.list[i].msisdn)
|
// $.ajax({
|
// url: '/HxzkFlow/hxzk/proxyCardcompanyUp',
|
// method: 'POST',
|
// data:{
|
// card:data.result.list[i].msisdn,
|
// name:"华星北斗移动1G共享池"
|
// }
|
// })
|
// }
|
// }
|
// })
|
|
|
|
// $.ajax({
|
// url:'/HxzkFlow/hxzk/proxyCardList',
|
// method:"post",
|
// data:{
|
// Nonce:nonce,
|
// Timestamp:formattedTime,
|
// targetUrl:"https://api.spruceiot.cn/api/v1/sim/list/query",
|
// targetUrl1:"?pageIndex=1&pageSize=100"
|
// },
|
// success:function (data) {
|
// //把所有卡号存入数据库:
|
// console.log(data.result.total)
|
// }
|
// })
|
|
|
|
|
$.get("/HxzkFlow/hxzk/chawu",function (data){
|
$(".zk").text(data[0])
|
$(".by").text(data[1])
|
$(".cy").text(data[2])
|
$(".dw").text(data[3])
|
$(".jjdl").text(data[4])
|
})
|
setInterval(function() {
|
$.get("/HxzkFlow/hxzk/chawu",function (data){
|
$(".zk").text(data[0])
|
$(".by").text(data[1])
|
$(".cy").text(data[2])
|
$(".dw").text(data[3])
|
$(".jjdl").text(data[4])
|
})
|
}, 60000);
|
}else{
|
|
|
}
|
/**
|
* 判断用户在规定的时间内没有操作系统,则刷新浏览器
|
* 参数:时间(单位分钟)
|
* */
|
function timeUserFun(time){
|
var time = time || 2;
|
var userTime = 3600;
|
var objTime = {
|
init:0,
|
time:function(){
|
objTime.init += 1;
|
if(objTime.init === userTime){// 达到限制时间时,用户未操作事件,则刷新整个页面
|
localStorage.removeItem("gsjc")
|
sessionStorage.removeItem("admin")
|
alert("您长时间未操作当前页面,请重新登录")
|
var data = "Zong="+sessionStorage.getItem("admin");
|
//获取该用户最新时间
|
$.post("/HxzkFlow/hxzk/userdate",data,function (data){
|
|
})
|
parent.location.reload()
|
//达到限制时间没操作,所要执行的动作
|
}
|
},
|
eventFun:function(){
|
//清除上次监听,重新开始新的监听
|
clearInterval(testUser);
|
objTime.init = 0;
|
testUser = setInterval(objTime.time,1000);
|
}
|
};
|
//监听当前时间流动
|
var testUser = setInterval(objTime.time,1000);
|
|
//监听相应事件
|
var body = document.querySelector('html');
|
body.addEventListener("click",objTime.eventFun);
|
body.addEventListener("keydown",objTime.eventFun);
|
body.addEventListener("mousemove",objTime.eventFun);
|
body.addEventListener("mousewheel",objTime.eventFun);
|
}
|
(function () {
|
timeUserFun(1);
|
|
}(0));
|
|
|
|
|
layui.use(['layer', 'form'], function(){
|
var layer = layui.layer
|
,form = layui.form;
|
|
|
//从本地存储获取用户登录信息,如果是子账号,只显示else 如果是总账号显示if
|
layui.use('table', function(){
|
var table = layui.table;
|
|
var Zong = localStorage.getItem("gsjc")
|
var data ="Zong="+Zong
|
if(Zong == null){
|
}else{
|
$.post("/HxzkFlow/hxzk/jiemi",data,function (data){
|
if(data == "1"){
|
table.render({
|
elem: '#demo'
|
,layEvent: 'LAYTABLE_TIPS'
|
,height: 695
|
,url: '/HxzkFlow/hxzk/FindCard' //数据接口
|
,cellMinWidth: 80
|
,page: true //开启分页
|
,toolbar:'#toolbarDemo'
|
,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
|
title: '提示'
|
,layEvent: 'LAYTABLE_TIPS'
|
,icon: 'layui-icon-tips'
|
}]
|
,cols: [[ //表头
|
{type:'checkbox',sort: true,fixed: "left"}
|
,{field: 'num', title: '序号', sort: true,width:'5%'}
|
,{field: 'company', title: '所属公司', }
|
,{field: 'cardnumber', title: '卡号', sort: true}
|
,{field:'status', title: '状态',templet: '#titleTpl'}
|
,{field: 'flow', title: '流量', sort: true}
|
// ,{field: 'zflow', title: '总流量(MB)', }
|
// ,{field: 'syflow', title: '已用流量(MB)', }
|
,{field: 'remainingdays', title: '剩余天数', }
|
// ,{field: 'syll', title: '剩余流量(MB)', }
|
,{field: 'carddate', title: '开始日期', sort: true}
|
,{field: 'operator', title: '运营商', sort: true}
|
|
,{field: 'unitprice', title: '单价', sort: true}
|
,{field: 'bindid', title: '绑定设备'}
|
// ,{field: 'location', title: '所在地', sort: true}
|
,{field: 'notes', title: '备注', sort: true}
|
,{field: 'enddate', title: '结束日期', sort: true}
|
// ,{field: 'enterdate', title: '录入日期', sort: true}
|
,{field: 'rechargedate', title: '最近充值日期', sort: true}
|
,{field: 'rechargemoney', title: '充值金额', sort: true}
|
|
|
]],
|
limit:100,
|
limits:[10,20,30,40,50,60,70,80,90,100],
|
});
|
}else{
|
$("#relo").css("left","-620px")
|
var Zi = localStorage.getItem("gsmc")
|
var dt ="Zong="+Zi
|
$.post("/HxzkFlow/hxzk/chaZi",dt,function (data){
|
var jc = Zi;
|
table.render({
|
elem: '#demo'
|
,layEvent: 'LAYTABLE_TIPS'
|
,height: 695
|
,url: '/HxzkFlow/hxzk/FindCardZi?Zong='+jc //数据接口
|
,cellMinWidth: 80
|
,page: true //开启分页
|
,limit: 100
|
,toolbar:'#toolbarDemo1'
|
,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
|
title: '提示'
|
,layEvent: 'LAYTABLE_TIPS'
|
,icon: 'layui-icon-tips'
|
}]
|
,cols: [[ //表头
|
{type:'checkbox',sort: true,fixed: "left",top:10}
|
,{field: 'num', title: '序号', sort: true,width:'5%'}
|
,{field: 'cardnumber', title: '卡号', sort: true,width: 210}
|
,{field: 'company', title: '公司', sort: true,width: 220}
|
,{field:'status', title: '状态',templet: '#titleTpl',width: 100}
|
,{field: 'flow', title: '流量', sort: true}
|
// ,{field: 'zflow', title: '总流量(MB)',width: 120 }
|
// ,{field: 'syflow', title: '已用流量(MB)',sort: true,width: 130 }
|
// ,{field: 'syll', title: '剩余流量(MB)', width: 120}
|
,{field: 'remainingdays', title: '剩余天数', }
|
,{field: 'carddate', title: '开始日期', sort: true}
|
,{field: 'operator', title: '运营商', sort: true}
|
|
,{field: 'unitprice', title: '单价', sort: true}
|
,{field: 'rechargedate', title: '最近充值日期', sort: true}
|
,{field: 'rechargemoney', title: '充值金额', sort: true}
|
|
|
]],
|
limit:100,
|
limits:[10,20,30,40,50,60,70,80,90,100],
|
});
|
})
|
}
|
})
|
}
|
|
|
|
|
//头工具栏事件
|
table.on('toolbar(demo)', function(obj){
|
var checkStatus = table.checkStatus(obj.config.id);
|
switch(obj.event) {
|
case 'getDelete':
|
var data = checkStatus.data;
|
if(data.length == 0){
|
layer.alert("请选中一条数据")
|
}else{
|
var nums = [];
|
for (var i = 0; i < data.length; i++) {
|
nums.push(JSON.stringify(data[i].num))
|
var datas = "num="+JSON.stringify(data[i].num)
|
$.post("/HxzkFlow/hxzk/DeleteCard",datas,function (data){
|
|
});
|
}
|
layer.alert("删除成功")
|
}
|
layui.table.reload('demo')
|
break;
|
case 'getUpdate':
|
var data = checkStatus.data;
|
if(data.length>1){
|
layer.alert("一次只能选中一个进行修改")
|
}else if(data.length == 0){
|
layer.alert("请选中一条数据")
|
}else{
|
showUpdate();
|
$("#cardnumber").val(data[0].cardnumber)
|
$(".upnum").val(data[0].num);
|
$("#xgkh").val(data[0].cardnumber);
|
$("#xggs").val(data[0].company);
|
$("#carddateu").val(data[0].carddate);
|
$("#enddateu").val(data[0].enddate);
|
$("#unitpriceu").val(data[0].unitprice);
|
$("#operatoru").append(new Option(data[0].operator,data[0].operator));
|
$("#flowu").append(new Option(data[0].flow,data[0].flow));
|
}
|
break;
|
case 'getadd':
|
var data = checkStatus.data;
|
add();
|
form.on('select(ddtt)', function(data){
|
|
// console.log(data,11111111)
|
// if(data.value == "12G/年"){
|
// money = 80;
|
// // Zmoney = 80*num
|
// // $("#feiyong").text(money)
|
// $("#feiyongadd").text(money)
|
// // $("#zongjia").text(Zmoney)
|
// }else if(data.value == ("24G/年")){
|
// money = 150;
|
// // Zmoney = 150*num
|
// $("#feiyongadd").text(money)
|
// // $("#zongjia").text(Zmoney)
|
// }else if(data.value == "36G/年"){
|
// money = 200;
|
// // Zmoney = 200*num
|
// $("#feiyongadd").text(money)
|
// // $("#zongjia").text(Zmoney)
|
// }else if(data.value == "100G/年"){
|
// money = 300;
|
// // Zmoney = 200*num
|
// $("#feiyongadd").text(money)
|
// // $("#zongjia").text(Zmoney)
|
// }else{
|
// $("#feiyongadd").text("")
|
// $("#zongjia").text("")
|
// }
|
});
|
break;
|
case 'getchongzhi':
|
var data = checkStatus.data;
|
$("#feiyong").text("")
|
$("#zongjia").text("")
|
//选择卡的数量
|
var num = data.length;
|
var cardNum = [];
|
var card = [];
|
var zong = 0;
|
var feiyong = [];
|
for (var i = 0; i < data.length; i++) {
|
if(i == data.length-1){
|
chongzhiCompany += data[i].company;
|
}
|
card.push(data[i].cardnumber)
|
zong = zong+data[i].unitprice
|
feiyong.push(data[i].unitprice.toString())
|
cardNum.push(JSON.stringify(data[i].cardnumber))
|
var datas = "num="+JSON.stringify(data[i].cardnumber)
|
}
|
$("#cardnumber").val(card)
|
$(".hao").text("当前已选择"+num+"个卡号")
|
chongzhi()
|
var money=0;
|
// Zmoney = 80*num
|
$("#feiyong").text(feiyong)
|
$("#zongjia").text(zong)
|
break;
|
};
|
});
|
// 搜索提交
|
form.on('submit(demo-table-search)', function(data){
|
var field = data.field; // 获得表单字段
|
if(field.company != ""){
|
if(localStorage.getItem("gsjc") == "华星智控"){
|
table.reload('demo', {
|
url: "/HxzkFlow/hxzk/tableSearch",
|
method:'post',
|
page: {
|
curr: 1 // 重新从第 1 页开始
|
}
|
,where: field // 搜索的字段
|
,done: function(res, curr, count) {
|
// res为接口返回的数据
|
if (res.data.length > 0) {
|
|
} else {
|
alert("搜索的内容不存在")
|
}
|
}
|
});
|
layer.msg('搜索成功');
|
}else if(field.company == localStorage.getItem("gsmc")){
|
table.reload('demo', {
|
url: "/HxzkFlow/hxzk/tableSearch",
|
method:'post',
|
page: {
|
curr: 1 // 重新从第 1 页开始
|
}
|
,where: field // 搜索的字段
|
,done: function(res, curr, count) {
|
// res为接口返回的数据
|
if (res.data.length > 0) {
|
|
} else {
|
alert("搜索的内容不存在")
|
}
|
}
|
});
|
layer.msg('搜索成功');
|
}else{
|
alert("没有权限查询其他公司")
|
}
|
}else{
|
if (localStorage.getItem("gsjc") == "华星智控"){
|
field.company = localStorage.getItem("gsjc");
|
table.reload('demo', {
|
url: "/HxzkFlow/hxzk/tableSearch",
|
method:'post',
|
page: {
|
curr: 1 // 重新从第 1 页开始
|
}
|
,where: field // 搜索的字段
|
});
|
layer.msg('搜索成功');
|
}else{
|
field.company = localStorage.getItem("gsmc")
|
table.reload('demo', {
|
url: "/HxzkFlow/hxzk/tableSearch",
|
method:'post',
|
page: {
|
curr: 1 // 重新从第 1 页开始
|
}
|
,where: field // 搜索的字段
|
});
|
layer.msg('搜索成功');
|
}
|
}
|
// 执行搜索重载
|
|
return false; // 阻止默认 form 跳转
|
});
|
//
|
form.on('submit(demo-table-search1)', function(data){
|
var field = data.field; // 获得表单字段
|
if(field.company != ""){
|
if(localStorage.getItem("gsjc") == "华星智控"){
|
table.reload('demo', {
|
url: "/HxzkFlow/hxzk/tableSearch",
|
method:'post',
|
page: {
|
curr: 1 // 重新从第 1 页开始
|
}
|
,where: field // 搜索的字段
|
});
|
layer.msg('搜索成功');
|
}else if(field.company == localStorage.getItem("gsmc")){
|
table.reload('demo', {
|
url: "/HxzkFlow/hxzk/tableSearch",
|
method:'post',
|
page: {
|
curr: 1 // 重新从第 1 页开始
|
}
|
,where: field // 搜索的字段
|
});
|
layer.msg('搜索成功');
|
}else{
|
alert("没有权限查询其他公司")
|
}
|
}else{
|
if (localStorage.getItem("gsjc") == "华星智控"){
|
field.company = "";
|
table.reload('demo', {
|
url: "/HxzkFlow/hxzk/tableSearch",
|
method:'post',
|
page: {
|
curr: 1 // 重新从第 1 页开始
|
}
|
,where: field // 搜索的字段
|
});
|
layer.msg('搜索成功');
|
}else{
|
field.company = localStorage.getItem("gsmc")
|
table.reload('demo', {
|
url: "/HxzkFlow/hxzk/tableSearch",
|
method:'post',
|
page: {
|
curr: 1 // 重新从第 1 页开始
|
}
|
,where: field // 搜索的字段
|
});
|
layer.msg('搜索成功');
|
}
|
}
|
// 执行搜索重载
|
|
return false; // 阻止默认 form 跳转
|
});
|
});
|
|
});
|
|
|
//新增
|
function add(){
|
$(".add").show();
|
$(".heimu").show();
|
}
|
function canseladd(){
|
$(".add").hide();
|
$(".heimu").hide();
|
}
|
//充值
|
function chongzhi(){
|
$(".chongzhi").show();
|
$(".heimu").show();
|
}
|
function canselchongzhi(){
|
$(".chongzhi").hide();
|
$(".heimu").hide();
|
}
|
//修改
|
function canselupdate(){
|
$(".update").hide();
|
$(".heimu").hide();
|
$(".updateZong").hide();
|
}
|
function showUpdate(){
|
var gsjc = localStorage.getItem("gsjc");
|
if(gsjc == "华星智控"){
|
$(".updateZong").show();
|
$(".heimu").show();
|
}else{
|
$(".update").show();
|
$(".heimu").show();
|
}
|
|
}
|
//新增成功
|
function checkadd() {
|
var add1 = $("#companyadd1").val();
|
var add2 = $("#cardnumberadd1").val();
|
var add3 = $("#carddateadd1").val();
|
var add4 = $("#operatoradd1").val();
|
// var add4 = $("#flowadd1").val();
|
var add12 = $("#unitprice").val();
|
var add5 = $("#bindidadd1").val();
|
var add6 = $("#locationadd1").val();
|
var add7 = $("#notesadd1").val();
|
var add8 = $("#enddateadd1").val();
|
var add9 = "0";
|
var add10 = $("#flowadd1").val();
|
var add11 = $("#feiyongadd").val();
|
var parts = add2.replace(/\s*/g,"").split(";");
|
// var parts;
|
var parts1 = add5.split(";");
|
if(parts.length>1){
|
for (var i = 0 ; i<parts.length;i++){
|
var data = "cardnumber="+parts[i]
|
$.ajax({
|
url: "/HxzkFlow/hxzk/ifCard",
|
type: "POST",
|
data: data,
|
async: false,
|
success: function(data) {
|
if(data != ""){
|
//已经存在, 根据卡号修改信息
|
var upp = "company="+add1+"&cardnumber="+parts[i]+"&carddate="+add3+"&operator="+add4+"&bindid="+parts1[i]+"&location="+add6+"¬es="+add7+"&enddate="+add8+"&flow="+add10+"&unitprice="+add11
|
$.post("/HxzkFlow/hxzk/UpdateChong",upp,function (data){
|
|
})
|
$("#cardnumberadd1").val(parts[i])
|
}else{
|
|
}
|
|
}
|
});
|
|
}
|
if(add9 == "1"){
|
alert("该卡号中可能有已经存在过的")
|
}
|
}else{
|
var data = "cardnumber="+add2
|
$.ajax({
|
url: "/HxzkFlow/hxzk/ifCard",
|
type: "POST",
|
data: data,
|
async: false,
|
success: function(data) {
|
if(data != ""){
|
alert("该卡号已存在!")
|
add9 = "1";
|
}else{
|
add9 = "0";
|
}
|
}
|
});
|
}
|
if(add1 == "" || add1 == null){
|
layer.alert("请选择所属公司")
|
return false;
|
}else if(add2 == "" || add2 == null){
|
layer.alert("请输入卡号")
|
return false;
|
}else if(add3 == "" || add3 == null){
|
layer.alert("请选择开始日期")
|
return false;
|
}else if(add4 == "" || add4 == null){
|
layer.alert("请选择运营商")
|
return false;
|
}else if(add10 == "" || add10 == null){
|
layer.alert("请选择流量")
|
return false;
|
}else if(add8 == "" || add8 == null){
|
layer.alert("请选择结束日期")
|
return false;
|
}else if(add11 == "" || add11 == 0){
|
layer.alert("请选择单价")
|
return false;
|
}else if (add9 == "1"){
|
return false;
|
}else if (add9 == "0"){
|
return true
|
}
|
}
|
//选择流量
|
//监听选中事件
|
|
//
|
|
function chongzhitj(){
|
var kh = $("#cardnumber").val();
|
var unitprice ;
|
if ($("#unitpriceu").val()!=0){
|
unitprice =$("#unitpriceu").val();
|
}else if ($("#zongjia").text()!=0){
|
unitprice =$("#zongjia").text();
|
}else{
|
unitprice ="";
|
}
|
if (kh == ""){
|
alert("请选择卡号")
|
return false;
|
}
|
if(unitprice == "" || unitprice == 0){
|
alert("费用不正确")
|
return false;;
|
}
|
var dt = "card="+kh+"&type=流量"+"&feiyong="+unitprice+"&chongzhiCompany="+chongzhiCompany
|
$.post("/HxzkFlow/hxzk/buy",dt,function (data){
|
const div = document.createElement('divform');
|
div.innerHTML = data;
|
document.body.appendChild(div);
|
document.forms['punchout_form'].setAttribute('target', '_blank')
|
document.forms['punchout_form'].submit()
|
})
|
$(".chongzhi").hide();
|
$(".heimu").hide();
|
}
|
</script>
|
</html>
|