123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <meta name="author" content=""/>
- <meta name="description" content=""/>
- <meta name="keywords" content="扫码支付,线上投币,运营数据,物联网"/>
- <meta name="format-detection" content="telphone=no,email=no"/>
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="expires" content="0">
- <title>投放地址</title>
- <link rel="stylesheet" href="https://cdn.washpayer.com/components/lib/mui.min.css"/>
- <link rel="stylesheet" href="../components/custom/css/common.css"/>
- <link rel="stylesheet" href="css/xyf.common.min.css">
- </head>
- <body>
- <div class="mui-input-group mui-reset">
- <form class="mui-row" action="">
- <div class="mui-col-xs-12 mui-col-sm-12">
- <div class="mui-input-row mui-search">
- <input type="search" class="mui-input-clear" id="searchKey" placeholder=" 请输入地址名称">
- </div>
- </div>
- </form>
- </div>
- <div id="pullrefresh" class="mui-content mui-scroll-wrapper location-bd" style="top:54px">
- <div class="mui-scroll">
- <ul class="mui-table-view interval"></ul>
- </div>
- </div>
- <div class="custom-btn-area custom-fixed-b">
- <a href="javascript:void(0);" class="custom-btn custom-btn-primary" onclick="toAddLocation()">添加投放地址</a>
- </div>
- <script src="https://cdn.washpayer.com/components/lib/jquery.min.js"></script>
- <script src="https://cdn.washpayer.com/components/lib/mui.min.js"></script>
- <script src="/components/custom/js/common.js"></script>
- <script src="js/xyf.common.js"></script>
- <script>
- (function () {
- //ios返回刷新
- var isPageHide = false;
- window.addEventListener('pageshow', function () {
- if (isPageHide) {
- window.location.reload();
- }
- });
- window.addEventListener('pagehide', function () {
- isPageHide = true;
- });
- })();
- //关键字搜索
- document.onkeydown = function (ev) {
- if (ev.keyCode == 13) {
- ev.preventDefault();
- search();
- }
- };
- var searchKey;
- function search() {
- pageIndex = 0;
- $('#pullrefresh .mui-table-view').html("");
- mui('#pullrefresh').pullRefresh().refresh(true);//重置上拉加载
- searchKey = $("#searchKey").val();
- //写入数据
- pullupRefresh();
- }
- mui.init({
- pullRefresh: {
- container: '#pullrefresh',
- up: {
- contentrefresh: '正在加载...',
- contentnomore: '没有更多数据了...',
- callback: pullupRefresh
- }
- }
- });
- var pageIndex = 0;
- var total = 0;
- function pullupRefresh() {
- pageIndex++;
- var url = "/device/groupList";
- var data = {"pageIndex": pageIndex, "pageSize": 10, searchKey: searchKey,};
- sendRequest(url, "GET", data, function (res) {
- if (res.result == 1) {
- if (pageIndex == 1) {
- total = res.para.total;
- if (total === 0) {
- $("body").append('<div class="nomore"></div>');
- $("#pullrefresh").hide()
- }
- }
- mui('#pullrefresh').pullRefresh().endPullupToRefresh((pageIndex * 10 >= total));
- var table = $('.mui-table-view');
- var length = res.para.dataList.length;
- for (var i = 0; i < length; i++) {
- var obj = res.para.dataList[i];
- //如果不是地址管理员,则不能选
- if(!obj.isManager){
- continue
- }
- var isDefault = "";
- if (obj.isDefault) {
- isDefault += " <em class='mark-blue'>默认</em>";
- }
- var liDom = $('<li class="mui-table-view-cell"><a href="javascript:void(0)">' +
- '<p>' + obj.groupName + isDefault + '<em class="total-mark"> ' + obj.equipmentCount + '台 </em></p>' +
- '<p class="mui-ellipsis">' + obj.address + '</p>' +
- '</a></li>');
- bindClick(liDom, {groupName: obj.groupName, groupId: obj.groupId});
- table.append(liDom);
- }
- } else {
- mui.toast(res.description);
- }
- });
- }
- if (mui.os.plus) {
- mui.plusReady(function () {
- setTimeout(function () {
- mui('#pullrefresh').pullRefresh().pullupLoading();
- }, 1000);
- });
- } else {
- mui.ready(function () {
- mui('#pullrefresh').pullRefresh().pullupLoading();
- });
- }
- function bindClick(dom, opt) {
- dom.on("tap",function () {
- //缓存数据,这样选择地址回退才不回丢失数据
- setSessionStorage("DEVICE_REG_PARAM", $.extend(true, getSessionStorage("DEVICE_REG_PARAM"), opt), 1000 * 60 * 30);
- window.history.back();
- });
- }
- function toAddLocation() {
- var url = "location-add.html";
- goPage(url);
- }
- </script>
- </body>
- </html>
|