Files

415 lines
15 KiB
HTML
Raw Permalink Normal View History

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>联盟门店管理</title>
<link rel="stylesheet" type="text/css" href="/css/api.css" />
<link rel="stylesheet" type="text/css" href="/css/content.css" />
<link rel="stylesheet" type="text/css" href="/css/switch.css" />
<script type="text/javascript" src="/scripts/jquery-2.0.2.min.js"></script>
<!--<script type="text/javascript" src="/scripts/iscroll.js"></script>-->
<script type="text/javascript" src="/script/main.js?t=0"></script>
<script type="text/javascript" src="/layer/layer.js"></script>
<script type="text/javascript" src="/Scripts/long.js"></script>
<script type="text/javascript" src="/script/moment.js"></script>
<script type="text/javascript" src="/Scripts/TouchSlide.1.1.js"></script>
<script type="text/javascript" src="/Scripts/clipboard.min.js"></script>
<script type="text/javascript" src="/script/api.js"></script>
<script src="/scripts/html2canvas.js"></script>
<style type="text/css">
html, body {
overflow: hidden;
}
#wrapper {
flex: 1;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.mydata_box0 {
margin-bottom: 0.8em;
border-radius: 0;
}
.mydata_box0 div {
margin-top: 0;
width: 20%;
font-size: 0.8em;
border-radius: 0;
line-height: 1.8em;
}
.mydata_box0.jfbox {
height: 4em;
margin: 0;
border-radius: 0;
}
.mydata_box0.jfbox div {
height: 4em;
width: 33.333333333333333332%;
}
.mydata_box0.jfbox div div {
width: 100%;
font-size: 1.1em;
}
.mydata_box0.orderbox div {
width: 33.333333333333333332%;
}
.mydata_box0.orderbox div div.order_yuan {
font-size: 1em;
}
.gxzmx_box div.cklink span {
padding-bottom: 0.4em;
}
</style>
<script type="text/javascript">
var userId = null;
var LoginId = null;
var CartId = null;
var ifapp = 0;
var opentimes = null;
var myScroll = null;
var pullDown = 1; // 下拉刷新避免多次执行
var pullUp = 1; // 上拉加载避免多次执行
var downHeight = 0;
var upHeight = 0;
var isload = true;//设置是否终止滚动加载
var curScrollHeight = 0;//当前滚动位置
var curCount = 1;//计数器,防止滚动时重复执行加载下一页
$(document).ready(function () {
userId = getlocalStorage("userId");
LoginId = getlocalStorage("LoginId");
CartId = getlocalStorage("CartId");
var aifapp = getlocalStorage("ifapp");
if (aifapp != null) {
ifapp = aifapp;
}
rdata();
});
function onScroll0() {
isload = true;//设置是否终止滚动加载
curScrollHeight = 0;//当前滚动位置
curCount = 1;//计数器,防止滚动时重复执行加载下一页
$("#wrapper").scroll(function () {
var pageHeight = $("#sysnew").height();
var showHeight = $("#wrapper").height();
var scrollHeight = $("#wrapper").scrollTop();
if (curScrollHeight - scrollHeight < 10 && curScrollHeight > 0) {
if (curCount == 1 && isload) {
rdata(0);
}
curCount++; //加载下一页后计数器+1
}
if (curScrollHeight < scrollHeight) {
curScrollHeight = pageHeight - showHeight;//滚动到页面底部时,重设当前滚动位置
curCount = 1;
}
});
}
function rdata() {
userId = getlocalStorage("userId");
LoginId = getlocalStorage("LoginId");
$(".ajaxLoader").removeClass("uhide");
$(".more_box").html("");
$.ajax({
type: 'GET',
url: "/apiajax.ashx",
data: "&action=getmybusinessdata&ifweb=1&userId=" + (userId != null ? userId : "") + "&LoginId=" + (LoginId != null ? LoginId : ""),
dataType: "JSON",
error: function (xhr, type) {
tishi3("发生错误:" + JSON.stringify(xhr));
},
success: function (data) {
if (data) {
if (data.status == 1) {
$(".emx_box_sjname").html(data.sjname);
$(".emx_box_ewmpic").html("<img src=\"" + data.ewmpic + "\">");
if (data.userInfo.Paypush == 1) {
$(".am-switch").addClass("am-active");
} else {
$(".am-switch").removeClass("am-active");
}
$("#smze").html(data.smzemoney);
$("#jrje").html(data.jrmoney);
$("#zrje").html(data.zrmoney);
$("#sjyl").html(data.sjylmoney);
$(".ajaxLoader").addClass("uhide");
} else {
tishi3(data.msg);
$(".ajaxLoader").addClass("uhide");
if (data.msg == "您未登录") {
onlink("/");
}
}
} else {
tishi3("网络错误!");
$(".ajaxLoader").addClass("uhide");
}
}
});
}
function ondetail(id) {
onlink("shop_view.html?id=" + id);
}
function onproduct(t) {
userId = getlocalStorage("userId");
if (userId != null) {
onlink("myproducts.html?t=" + t);
} else {
onlink("/");
}
}
function onlog(t) {
userId = getlocalStorage("userId");
if (userId != null) {
onlink("mylog.html?t=" + t);
} else {
onlink("/");
}
}
function onorders0(t, t0) {
userId = getlocalStorage("userId");
if (userId != null) {
onlink("myorders0.html?t=" + t + "&t0=" + t0);
} else {
onlink("/");
}
}
function onifshowurl() {
if ($("#url_box.uhide").length == 0) {
onhideurl();
} else {
onshowurl();
}
}
function onshowurl() {
clearlocalStorage("ifshowglzhmm");
$("#url_box").removeClass("uhide");
$("#nav-right").html("隐藏后台网址和账号");
}
function onhideurl() {
setlocalStorage("ifshowglzhmm", 1);
$("#url_box").addClass("uhide");
$("#nav-right").html("显示后台网址和账号");
}
function oncopy0(t) {
var font = $("#txturl").val();
if (t == 1) {
$("#txtuserid").val();
} else if (t == 2) {
font = $("#txtuserpwd").val();
} else if (t == 3) {
font = $("#txtuserpwd0").val();
}
$("#copyinput").val(font);
$("#copybtn").click();
}
var ewmName = "mdaskm.png";//下载二维码地址
function onsave() {
var curTime = new Date();
ewmName = "ksdskm" + judgetime1(curTime.toString()) + ".png";
var ifb = true;
var ifb0 = true;
try {
var permission = 'storage';
var resultList = api.hasPermission({
list: [permission]
});
var granted = resultList[0].granted;
if (!granted) {
ifb = false;
layer.confirm('应用需要您的授权才能访问存储,是否要授权?', {
btn: ['是', '否'] //按钮
}, function () {
api.requestPermission({
list: [permission],
}, function (res) {
if (res.list[0].granted) {
// 已授权,可以继续下一步操作
tishi3('已授权');
} else {
ifb = false;
}
});
}, function () {
ifb = false;
});
}
} catch (err) {
ifb0 = false;
ifb = true;
}
if (ifb) {
if (ifb0) {
$("#savebtn").html("保存中,请稍候...");
try {
const options = {
backgroundColor: 'transparent' // null或transparent可将canvas背景设置为透明
}
html2canvas(document.querySelector("#emx_box_to"), options).then(canvas => {
//document.body.appendChild(canvas);
var baseurl = canvas.toDataURL('image/png').replace("data:image/png;base64,", "");
var trans = api.require('trans');// 引入apicloud提供的trans模块
trans.saveImage({
base64Str: baseurl,
album: true,
imgPath: "fs://image/",// 图片路径
imgName: ewmName //图片名字
}, function (ret, err) {
$("#savebtn").html("保存门店收款码到相册");
if (ret.status) {
tishi3("保存成功,可以去分享了");
} else {
tishi3(JSON.stringify(err));
}
});
});
} catch (err) {
tishi3(err);
}
} else {
tishi3('下载APP才能保存');
}
}
}
function onSwitch() {
var Paypush = 1;
if ($(".am-switch.am-active").length > 0) {
Paypush = 0;
}
userId = getlocalStorage("userId");
LoginId = getlocalStorage("LoginId");
var datas = {
userId: userId,
LoginId: LoginId,
t: Paypush
};
$.ajax({
type: 'POST',
url: "/apiajax.ashx?action=updatePaypush&ifweb=1",
data: datas,
dataType: "json",
error: function (xhr) {
tishi3("发生错误:" + JSON.stringify(xhr));
},
success: function (data) {
$(".ajaxLoader").addClass("uhide");
if (data.status == 1) {
tishi3(data.msg);
if (ifapp == 1) {
$api.setStorage("Paypush", Paypush);
}
rdata();
} else {
tishi3(data.msg);
}
}
});
}
</script>
</head>
<body class="wrap">
<header>
<div class="ub">
<div class="nav-btn" id="nav-left" style=" margin:0; padding:0; padding-top:0.2em; min-width:3em" onclick="closeWin()">
<img src="../image/faifei.png" style="margin-left:0; margin-top:0em; height:1.2em;width:1.2em;" />
</div>
<h1 class="ub-f1">门店管理</h1>
<div class="nav-btn blue" id="nav-right" style="color:#fff; margin:0; padding:0; min-width:4em; padding-right:1em;">
</div>
</div>
</header>
<section class="ub-f1" id="wrapper">
<div class="emx_box">
<div class="emx_box_to" id="emx_box_to">
<img src="../image/skm.png" /><div class="emx_box_sjname"></div><div class="emx_box_ewmpic"></div>
</div>
<div class="emx_box_button">
<div class="mybtn" onclick="onsave()" id="savebtn">保存门店收款码到相册</div>
</div>
</div>
<div style="padding:0.8em;">
<div class="zzjfmx_box">
<div class="Paypush_box">
<div>开启/关闭收款自动播报:</div>
<div class="am-switch" onclick="onSwitch()">
<div class="am-switch-handle"></div>
</div>
</div>
<div class="zzjfmx_box">
<div class="gxzmx_box">
<div onclick="onloginlink('mybusiness_smlog.html')" class="alink">
<span>扫码总额</span>
<span class="je" id="smze">0</span>
</div>
<div onclick="onloginlink('mybusiness_smlog.html?t=1')" class="alink">
<span>今日金额</span>
<span class="je" id="jrje">0</span>
</div>
<div onclick="onloginlink('mybusiness_smlog.html?t=2')" class="alink">
<span>昨日金额</span>
<span class="je" id="zrje">0</span>
</div>
</div>
<div class="gxzmx_box">
<div>
<span>门店服务费</span>
<span class="je" id="sjyl">0</span>
</div>
<div class="alink cklink">
<span onclick="onloginlink('mybusiness_sjzl.html')">查看门店资料</span>
<span onclick="onloginlink('mybusiness_hours.html')">营业时间设置</span>
</div>
</div>
</div>
</div>
</div>
</section>
<div class="ajaxLoader ub ub-ac uhide" onclick="reload()">
<div class="ub ub-ac ub-ver"><img src="image/load.gif" /><br>正在加载...</div>
</div>
<div style="height:1px;width:1px; overflow:hidden;"><input id="copyinput" type="text" /><input type="button" id="copybtn" data-clipboard-action="copy" data-clipboard-target="#copyinput" value="copy" /></div>
</body>
</html>