mui.plusReady(function() { window.addEventListener('reload', function(e) { //执行刷新 location.reload(); }); var comName = "山东省全亮共信息科技有限公司"; var cardNum = "810102701421013395"; var cardBank = "日照银行股份有限公司泰安路支行"; $('.comName ').val(comName) $('.comNameBtn').attr("data-value", comName) $('.cardNum ').val(cardNum) $('.cardNumBtn').attr("data-value", cardNum) $('.cardBank ').val(cardBank) $('.cardBankBtn').attr("data-value", cardBank) var self = plus.webview.currentWebview(); //console.log(self); var shopId = self.id; var type = 0; //0 huozhe 1 if ("undefined" != typeof(self.type)) { type = self.type } if (0 == type) { getuncommitted(); } else if (1 == type) { getcommitted(); } $('.con_con_com').eq(type).show().siblings().hide(); $('.con_nav').on("tap", ".nav_header", function() { type = $(this).index(); $(this).addClass('active').siblings().removeClass('active'); $('.con_con_com').eq(type).show().siblings().hide(); if (0 == type) { getuncommitted(); } else if (1 == type) { getcommitted(); } }) $('.committed').on("tap", ".row_title", function() { var idx = $(this).index(); // //console.log(idx); $('.row_cont').eq(idx).toggle() }) $('.committed').on("tap", ".oper", function(e) { e.preventDefault(); e.stopPropagation() id = $(this).parents().parents().attr("data-id") id = parseInt(id); //console.log(id); JZL.openWindow("shoperUploadVoucher.html", "shoperUploadVoucher.html", { orderId: id, shopId: shopId }) }) // $('.btns').on('tap', '.bc_btn', function() { // var idx = $(this).index() // JZL.openWindow("uploadVoucher.html", "uploadVoucher.html") // }) // 获取未提交凭证 getuncommitted(); function getuncommitted() { JZL.ajax(qlgUrl('app/Shoporders/getCertificate'), { shopId: shopId, type: 0 }, function(data) { //console.log(data) if ("undefined" != typeof data.data) { var html = ''; var youhui = 0; var payable = 0; mui.each(data.data, function() { payable = Math.abs(this.payable); youhui = Math.abs(youhui) + payable; html += '
' + this.status + '
优惠款' + payable + '
' mui.each(this.list, function() { html += '

' + this.goodsName + '

' + this.goodsSpecNames + '

¥' + this.goodsPrice + '

' }); youhui = youhui.toFixed(2); html += '
共' + this.list.length + '件商品 合计¥' + this.realTotalMoney + '(含运费¥' + this.deliverMoney + ')
订单完成时间:' + this.receiveTime + '
' }) html += '
' + data.data.length + '笔订单 优惠款' + youhui + '
提交凭证
' } else { html = '

没有更多订单了

'; // html = '
' } $('.uncommitted .con_con_com_').html(html); }) } var i = 0; //全选或者全不选 $('body').on('change', '#checkall', function() { checkAll('.check1', $(this).prop("checked")); if (false == $(this).prop("checked")) { $('.orderNo').html("0") $('.youhuiNo').html("0") } else { var youhui = 0; $('.orderNo').html($('.check1').length) mui.each($('.indent_youhui span'), function() { youhui += Number($(this).text()) }) $('.youhuiNo').html(youhui) } // if (0 == i) { // $('input[name="check1"]').prop('checked', true); // i = 1; // } else { // / $('input[name="check1"]').prop('checked', false); // i = 0; // } }) // checkAll('.check1',$('#checkall').checked); function checkAll(domName, isChecked) { //console.log(isChecked); $(domName).prop("checked", isChecked); } function checkNum() { var length = $('input[name=check1]:checked').length; var len = $('input[name=check1]').length; if (length == len) { $('#checkall').prop('checked', true); } else { $('#checkall').prop('checked', false); } var youhui = 0; $.each($('input[name="check1"]:checked'), function() { youhui += Number($(this).attr('data-payable')); }) $('.orderNo').html(length); $('.youhuiNo').html(youhui); } $('body').on('change', '.check1', function() { checkNum(); }) var click = 0 $('body').on('tap', ".bc_btn", function() { if (0 == $('input[name="check1"]:checked').length) { mui.alert("请选择至少一个订单") return; } if (1 == click) { return; } click = 1; var orderIdsArr = []; $.each($('input[name="check1"]:checked'), function() { orderIdsArr.push($(this).parents().parents().parents().attr('data-id')) }) orderIds = orderIdsArr.join(',') JZL.openWindow("shoperUploadVoucher.html", "shoperUploadVoucher.html", { shopId: shopId, orderIds: orderIds }) }) var isjiazai = false; function getcommitted(page, PerPage) { var recommenddata = { page: page ? page : 1, PerPage: PerPage ? PerPage : 10 } if (isjiazai == true) { return; } isjiazai = true; JZL.ajax(qlgUrl('app/Shoporders/getCertificate'), { shopId: shopId, type: 1 }, function(data) { //console.log(data); if (1 == data.status) { var data = data.data; var html = ''; var totPayable = 0; if (data.Rows == '') { $('.committed ').append( '

没有更多订单了

'); return; } $.each(data.Rows, function() { totPayable = 0; if ("已通过" == this.statusStr) { html += '
提交时间:' + this.createTime + '' + this.statusStr + '
' } else { html += '
提交时间:' + this.createTime + '' + this.statusStr + '
' } $.each(this.list, function() { totPayable += Number(this.payable) html += '
订单编号:' + this.orderNo + '
优惠金额:' + this.payable + '
' }) totPayable = totPayable.toFixed(2) html += '
总计优惠款:' + totPayable + '
' }) if (page == 1) { $('.committed').html(html); } else { $('.committed').append(html); } } else { mui.alert(data.msg) } }) } mui('body').on('tap', '.btn', function() { // 每次触发事件就会使用 innerText 获取纯文本。 var copy_content = $(this).attr("data-value"); // var copy_content = this.innerText; // 加了一个确认框 让用户选择是否复制 // mui.confirm('您要复制内容吗?', '小禾CRM', ['取消', '复制内容'], function (e) { // if (e.index == 1) { //判断是安卓还是ios if (mui.os.ios) { // ios 的方法 这个我没具体研究过 直接拿来用了 var UIPasteboard = plus.ios.importClass("UIPasteboard"); var generalPasteboard = UIPasteboard.generalPasteboard(); //设置 复制的内容也就是 触发事件 innerText 获取的内容 generalPasteboard.plusCallMethod({ setValue: copy_content, forPasteboardType: "public.utf8-plain-text" }); generalPasteboard.plusCallMethod({ valueForPasteboardType: "public.utf8-plain-text" }); // 在上边都走完 给用户一个提示 mui.toast('复制成功') } else { //安卓 的方法 这个我没具体研究过 直接拿来用了 var context = plus.android.importClass("android.content.Context"); var main = plus.android.runtimeMainActivity(); var clip = main.getSystemService(context.CLIPBOARD_SERVICE); plus.android.invoke(clip, "setText", copy_content); // 在上边都走完 给用户一个提示 mui.toast('复制成功') } // } }) })