123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 |
- <!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="/components/lib/mui.min.css"/>
- <link rel="stylesheet" href="/components/custom/css/common.css"/>
- <link rel="stylesheet" href="/app/css/xyf.common.min.css">
- <style>
- .eventRow .mui-checkbox-wear {
- width: 43px;
- height: 45px;
- display: none;
- float: left;
- margin-right: -10px;
- }
- .batch-model .eventRow .mui-checkbox-wear {
- display: block;
- }
- #pullrefresh {
- margin-top: 44px;
- margin-bottom: 50px;
- padding-top: 10px;
- }
- .batch-model #pullrefresh {
- margin-bottom: 100px !important;
- }
- </style>
- </head>
- <body>
- <div class="mui-input-group mui-reset">
- <form class="mui-row" action="">
- <div class="mui-col-xs-7 mui-col-sm-7">
- <div class="mui-input-row mui-search">
- <input type="search" class="mui-input-clear" id="searchKey" placeholder="经销商名称、手机">
- </div>
- </div>
- <div class="mui-col-xs-5 mui-col-sm-5 mui-text-right">
- <div class="in-row-btn" onclick="batchOper()">管理<i class="iconfont icon-triangle-up"></i></div>
- </div>
- </form>
- </div>
- <div id="pullrefresh" class="mui-content mui-scroll-wrapper ">
- <div class="mui-scroll">
- <div class="group-wrap mui-table-view "></div>
- </div>
- </div>
- <div class="c-handle-panel mui-hidden" style="bottom: 50px;">
- <div class="handle-btn">
- <div class="mui-checkbox ">
- <input id="checkbox-all" class="checkbox-all" type="checkbox">
- <label for="checkbox-all">全选</label>
- </div>
- </div>
- <div class="handle-btn-list mui-text-right">
- <button type="button" class="mui-btn mui-btn-outlined mui-btn-primary " onclick="editCardFee()">流量卡年费
- </button>
- </div>
- </div>
- <div class="edit-back annualTrafficCostDialog mui-hidden">
- <div class="edit-content">
- <div class="edit-box">
- <div class="mui-input-row">
- <label>最低费用</label>
- <div class="mui-pull-right edit-row">
- <input id="annualTrafficCost" maxlength="3" type="tel" placeholder=""
- onkeypress="return myNumberic(event);"
- >
- </div>
- </div>
- </div>
- <div class="mui-popup-buttons">
- <span class="mui-popup-button">取消</span>
- <span class="mui-popup-button mui-popup-button-bold">确认</span>
- </div>
- </div>
- </div>
- <script src="/components/lib/jquery.min.js"></script>
- <script src="/components/lib/mui.min.js"></script>
- <script src="/components/custom/js/common.js"></script>
- <script src="/app/js/xyf.common.js"></script>
- <script>
- window.initAgentNav && initAgentNav('dealer_management');
- var pageType = 'customerMgr';
- var pageIndex = 0;
- var total = 0;
- var searchKey = "";
- $(function () {
- //全选
- $("#checkbox-all").on("change", function () {
- if ($(this).is(":checked")) {
- $(".checkbox-btn").prop("checked", true);
- } else {
- $(".checkbox-btn").prop("checked", false);
- }
- });
- //复选框事件重写:优化体验,点击的面积更大
- $("#pullrefresh").on("tap", ".mui-checkbox-wear", function (evt) {
- var box = $(this).find(".mui-checkbox input");
- if (box.is(":checked")) {
- box.prop("checked", false);
- } else {
- box.prop("checked", true);
- }
- evt.stopPropagation();
- evt.preventDefault();
- });
- //跳转到经销商详情事件绑定
- $("body ").on("tap", ".eventRow", function () {
- history.replaceState(null, null, "customer-mgr.html?orRecord=true&t=" + new Date().getTime());//再次返回该页面会带上orRecord
- var url = "customerParam.html?id=" + $(this).closest(".mui-table-view-cell").attr("id");
- goPage(url);
- });
- //如果调到子页面,返回后还是保留查询条件
- var orRecordBack = getQueryString('orRecord');
- if (orRecordBack) {
- history.replaceState(null, null, "customer-mgr.html");//清除掉自动带的参数orRecord
- }
- //获取条件缓存数据
- if (orRecordBack) {
- condition = localStorage.condition ? JSON.parse(localStorage.condition)[pageType] : null;
- } else {
- condition = null;
- }
- /*根据缓存渲染已有条件数据*/
- if (condition) {
- if (condition.searchKey) {
- searchKey = condition.searchKey;
- $("#searchKey").val(searchKey);
- }
- }
- });
- var setCondition = function () {
- var data = {
- searchKey: searchKey,
- };
- var conArr = localStorage.condition ? JSON.parse(localStorage.condition) : {};
- conArr[pageType] = data;
- localStorage.condition = JSON.stringify(conArr);
- };
- mui.init({
- pullRefresh: {
- container: '#pullrefresh',
- up: {
- contentrefresh: '正在加载...',
- contentnomore: '我已经是底线',
- callback: pullupRefresh
- }
- }
- });
- //关键字搜索
- document.onkeydown = function (ev) {
- if (ev.keyCode == 13) {
- ev.preventDefault();
- search();
- }
- };
- function search() {
- pageIndex = 0;
- $('.group-wrap').html("");
- mui('#pullrefresh').pullRefresh().refresh(true);//重置上拉加载
- searchKey = $("#searchKey").val();
- pullupRefresh();//刷新数据
- }
- //激活批量操作
- function batchOper() {
- if ($("body").hasClass("batch-model")) {
- $(".in-row-btn").removeClass('active');
- $("body").removeClass("batch-model");
- $(".c-handle-panel").addClass('mui-hidden')
- } else {
- $(".in-row-btn").addClass('active');
- $("body").addClass("batch-model");
- $(".c-handle-panel").removeClass('mui-hidden')
- }
- }
- function pullupRefresh() {
- pageIndex++;
- var url = "/agent/getDealerList?random=" + Math.random() * 1000;
- var data = {
- "pageIndex": pageIndex,
- "pageSize": 10,
- searchKey: searchKey,
- };
- setCondition();//设置条件到缓存
- 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 dom = document.createElement('li');
- dom.className = 'mui-table-view-cell';
- dom.id = obj.id;
- dom.innerHTML = '<div class="eventRow flexbox mui-navigate-right">' +
- '<div class="mui-checkbox-wear"><div class="mui-checkbox"><input class="checkbox-btn" value="" type="checkbox"></div></div>' +
- '<div class="flex">' +
- '<p class="font-b-16-10 margin-b-5">' +
- obj.name + '<span class="font-14 font-b-6"> ' + obj.tel + '</span>' +
- '<span class="mui-pull-right font-12 margin-r-10"><em class="c-green">' + obj.onCount + '</em>/' + obj.deviceCount + '台</span>' +
- '</p>' +
- '<p class="font-b-8 margin-b-0 ' + (obj.annualTrafficCost ? '' : 'mui-hidden') + '">流量卡年费:' + obj.annualTrafficCost + '</p>' +
- '<p class="font-b-8 margin-b-0 ' + (obj.expireCount ? '' : 'mui-hidden') + '">过期: ' + obj.expireCount + '台' + '</p>' +
- '<p class="font-b-8 margin-b-0 ' + (obj.toExpireCount ? '' : 'mui-hidden') + '">即将过期: ' + obj.toExpireCount + '台' + '</p>' +
- '</div></div>';
- groupWrap.appendChild(dom);
- }
- } else {
- mui.toast(res.description);
- }
- });
- }
- function editCardFee() {
- var idInfo = getSelectIdInfo();
- if (idInfo.idList.length == 0) {
- mui.toast("请您选择经销商。");
- return;
- }
- $(".annualTrafficCostDialog").removeClass("mui-hidden");
- }
- //事件绑定
- $('.annualTrafficCostDialog .mui-popup-buttons span').tap(function () {
- if ($(this).index() == 0) {
- //点击取消
- $('.annualTrafficCostDialog').addClass('mui-hidden');
- } else {
- //点击保存
- var annualTrafficCost = $('#annualTrafficCost').val();
- if (!isMoney(annualTrafficCost)) {
- mui.toast("请输入正确的最低年费");
- return;
- }
- var idInfo = getSelectIdInfo();
- var idList = idInfo.idList;
- var data = {"ids": idList, "annualTrafficCost": annualTrafficCost};
- var url = "/agent/setBatchDealerAnnualTrafficCost";
- sendRequest({
- url: url,
- type: "POST",
- mask: "正在设置...",
- data: data,
- contentType: "json",
- success: function (res) {
- if (res.result == 1) {
- mui.toast("设置成功");
- $('.annualTrafficCostDialog').addClass('mui-hidden');
- $("#annualTrafficCostShow").text(parseFloat(annualTrafficCost).toFixed(2));
- } else {
- mui.toast(res.description);
- }
- }
- });
- }
- return false;
- });
- //获取被选中的ID
- function getSelectIdInfo() {
- var idList = [];
- // 只遍历管理员下的设备
- $(".eventRow").each(function () {
- var checked = $(this).find("input").is(":checked");
- if (checked) {
- var id = $(this).closest(".mui-table-view-cell").attr("id");
- if (id) {
- idList.push(id);
- }
- }
- });
- return {
- idList: idList,
- };
- }
- if (mui.os.plus) {
- mui.plusReady(function () {
- setTimeout(function () {
- mui('#pullrefresh').pullRefresh().pullupLoading();
- }, 1000);
- });
- } else {
- mui.ready(function () {
- mui('#pullrefresh').pullRefresh().pullupLoading();
- });
- }
- </script>
- </body>
- </html>
|