| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 | 
							- <!DOCTYPE html>
 
- <html>
 
- <head>
 
-     <meta charset="utf-8"/>
 
-     <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">
 
-     <style>
 
-         .hide-empty-group .empty-group{
 
-             display: none;
 
-         }
 
-         .hide-empty-group .empty-group+.mui-radio{
 
-             display: none;
 
-         }
 
-     </style>
 
- </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-card" style="top:44px">
 
-     <div class="mui-scroll">
 
-         <ul class="mui-table-view custom-top account-bd">
 
-             <li class="mui-table-view-cell">
 
-                 隐藏无设备地址
 
-                 <div class="switch switch-mini">
 
-                     <div class="switch-handle"></div>
 
-                 </div>
 
-             </li>
 
-             <li class="mui-table-view-cell">
 
-                 <a href="location-add.html?back=list" class="mui-navigate-right">
 
-                     <i class="iconfont icon-add c-green"></i>添加投放地址
 
-                 </a>
 
-             </li>
 
-             <li class="mui-table-view-cell" id="card_management">
 
-                 <a href="/dealer/index.html#/currencyAddress" class="mui-navigate-right">
 
-                     <i class="iconfont icon-grid c-blue"></i>通用分组管理
 
-                 </a>
 
-             </li>
 
-         </ul>
 
-         <div class="group-wrap"></div>
 
-     </div>
 
- </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.picker.js"></script>
 
- <script src="js/xyf.common.js"></script>
 
- <script>
 
-     //关键字搜索
 
-     document.onkeydown = function (ev) {
 
-         if (ev.keyCode == 13) {
 
-             ev.preventDefault();
 
-             search();
 
-         }
 
-     };
 
-     var searchKey;
 
-     function search() {
 
-         pageIndex = 0;
 
-         $('#pullrefresh .group-wrap').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?random=" + Math.random() * 1000;
 
-         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) {
 
-                         $('#pullrefresh').addClass('mui-hidden');
 
-                         $("body").append('<div class="nomore"></div>');
 
-                     }
 
-                 }
 
-                 mui('#pullrefresh').pullRefresh().endPullupToRefresh((pageIndex * 10 >= total));
 
-                 var groupWrap = document.body.querySelector('.group-wrap');
 
-                 var length = res.para.dataList.length;
 
-                 for (var i = 0; i < length; i++) {
 
-                     var obj = res.para.dataList[i];
 
-                     var group = document.createElement('div');
 
-                     group.className = 'mui-input-group interval custom-top';
 
-                     group.id = 'group' + obj.groupId;
 
-                     if (obj.isManager || obj.isManager == null) {
 
-                         $(group).attr("role", "manage");
 
-                     } else {
 
-                         $(group).attr("role", "limit-user");
 
-                     }
 
-                     var checked = "";
 
-                     if (obj.isDefault) {
 
-                         checked = "checked";
 
-                     }
 
-                     var addressType = "";
 
-                     if (obj.addressLabel) {
 
-                         addressType = '<em class="total-mark">' + obj.addressLabel + '</em>';
 
-                     }
 
-                     group.innerHTML = '<div class="mui-input-row autoheight card-hd ' + (obj.equipmentCount ? '' : 'empty-group') +'">' +
 
-                             '<p>' + obj.groupName + addressType + '<em class="total-mark">' + obj.equipmentCount + '台</em><em permission="limit-user-show" class="total-mark">合伙</em></p>' +
 
-                             '<p class="mui-ellipsis">' + obj.address + '</p></div>' +
 
-                             '<div class="mui-input-row mui-radio mui-left autoheight" data-id="' + obj.groupId + '">' +
 
-                             '<label permission="manage-show"><input class="default-radio" name="default" onclick="setDefault(\'' + obj.groupId + '\')" type="radio" ' + checked + '>设为默认</label>' +
 
-                             '<div class="mui-pull-right">' +
 
-                             '<a class="check-btn" groupId="' + obj.groupId + '"><span permission="limit-user-show"><i class="iconfont icon-eye c-primary"></i>查看</span><span permission="manage-show"><i class="iconfont icon-edit c-primary"></i>编辑</span></a>' +
 
-                             '<a href="javascript:void(0);" permission="manage-show" class="delete-btn" groupId="' + obj.groupId + '" count="' + obj.equipmentCount + '" > ' +
 
-                             '<i class="iconfont icon-delete c-red"></i>删除</a></div></div>';
 
-                     groupWrap.appendChild(group);
 
-                 }
 
-             } else {
 
-                 mui.toast(res.description);
 
-             }
 
-         });
 
-     }
 
-     function checkData(groupId) {
 
-         var url = 'location-edit.html?groupId=' + groupId + '&random=' + Math.random() * 1000;
 
-         goPage(url);
 
-     }
 
-     if (mui.os.plus) {
 
-         mui.plusReady(function () {
 
-             setTimeout(function () {
 
-                 mui('#pullrefresh').pullRefresh().pullupLoading();
 
-             }, 1000);
 
-         });
 
-     } else {
 
-         mui.ready(function () {
 
-             mui('#pullrefresh').pullRefresh().pullupLoading();
 
-         });
 
-     }
 
-     mui('body').on('tap', '.check-btn', function () {
 
-         var groupId = $(this).attr("groupId");
 
-         checkData(groupId)
 
-     }).on('tap', '.delete-btn', function () {
 
-         var count = $(this).attr("count");
 
-         var groupId = $(this).attr("groupId");
 
-         deleteAddr(count, groupId);
 
-     });
 
-     function setDefault(groupId) {
 
-         var url = "/dealer/setDefaultGroup";
 
-         var data = {"groupId": groupId};
 
-         sendRequest(url, "POST", data, function (res) {
 
-             if (res.result == 1) {
 
-                 mui.toast("设置成功");
 
-             } else {
 
-                 mui.toast(res.description);
 
-             }
 
-         });
 
-     }
 
-     //点击删除按钮弹出dialog
 
-     function deleteAddr(equipmentCount, groupId) {
 
-         //如果当前地址存在投放设备
 
-         if (equipmentCount > 0) {
 
-             mui.alert('地址存在投放设备,暂时不能删除', '温馨提示', '我知道了');
 
-         } else {
 
-             //如果当前地址存在投放设备
 
-             var btnArray = ['确定', '取消'];
 
-             var isDefault = $("[data-id='" + groupId + "']").find(".default-radio")[0].checked;
 
-             var tit1 = "确定删除投放地址?";
 
-             var tit2 = "温馨提示";
 
-             if (isDefault) {
 
-                 tit1 = "确定删除投放地址?(该地址为默认地址,删除后请您重新设置默认地址)";
 
-                 tit2 = "重要提示";
 
-             }
 
-             mui.confirm(tit1, tit2, btnArray, function (e) {
 
-                 if (e.index == 0) {
 
-                     var url = "/device/delGroup";
 
-                     var data = {"groupId": groupId};
 
-                     sendRequest(url, "POST", data, function (res) {
 
-                         if (res.result == 1) {
 
-                             $("#group" + groupId).remove();
 
-                         } else {
 
-                             mui.alert(res.description, '温馨提示', '我知道了');
 
-                         }
 
-                     });
 
-                 }
 
-             });
 
-         }
 
-     }
 
-     //开关
 
-     $('.mui-table-view-cell').on('tap', '.switch', function () {
 
-         var that = $(this);
 
-         that.toggleClass('active');
 
-         var flag = ''
 
-         if (that.hasClass("active")) {
 
-             $('body').addClass('hide-empty-group')
 
-             flag = 1
 
-         } else {
 
-             $('body').removeClass('hide-empty-group')
 
-             flag = ''
 
-         }
 
-         localStorage.setItem('hide-empty-group',flag)
 
-     });
 
-     var lastHideSwitch = localStorage.getItem('hide-empty-group')
 
-     if (lastHideSwitch) {
 
-         $('.mui-table-view-cell .switch').addClass('active')
 
-         $('body').addClass('hide-empty-group')
 
-     }
 
- </script>
 
- </body>
 
- </html>
 
 
  |