diff --git a/Application/Admin/Controller/FinanceCompareController.class.php b/Application/Admin/Controller/FinanceCompareController.class.php index 578b2707b..1781b7b73 100644 --- a/Application/Admin/Controller/FinanceCompareController.class.php +++ b/Application/Admin/Controller/FinanceCompareController.class.php @@ -13,8 +13,18 @@ class FinanceCompareController extends ThinkController } public function creatCompare() { + $adddata = I("post."); - # code... + $adddata['create_time'] = time(); + $adddata['begin_time'] = strtotime($adddata['begin_time']); + $adddata['end_time'] = strtotime($adddata['end_time'])+ 86399; + + $res = M("finance_compare","tab_")->add($adddata); + if($res){ + $this->ajaxReturn(array("success"=>"ok","code"=>0,"data"=>["id"=>$res])); + }else{ + $this->ajaxReturn(array("error"=>"creat error","code"=>4000)); + } } public function compareData() { diff --git a/Application/Admin/View/FinanceCompare/add.html b/Application/Admin/View/FinanceCompare/add.html index 0ef195f39..c56045f77 100644 --- a/Application/Admin/View/FinanceCompare/add.html +++ b/Application/Admin/View/FinanceCompare/add.html @@ -1,164 +1,309 @@ - - -if(C('COLOR_STYLE')=='blue_color') echo ''; - - + + + if(C('COLOR_STYLE')=='blue_color') echo ' + '; + + - + -
- -
- -
- - - - - + + + + +
*校验时间: -
- -  -  -
- - +
+ +
+ +
+ + + + + + + + + + + + + + - - - - - - - - - - - - - -
*校验时间: +
+ +  -  +
+ + +
+
+ 请选择不超过31天的时间 +
*支付渠道: + +
*Excel文件上传: +
+
- - 请选择不超过31天的时间 -
*支付渠道: - -
*Excel文件上传: -
- -
- 暂只支持.xls .xlsx 格式文件 -
+ 暂只支持.xls .xlsx 格式文件 +
+
+
+ + + 返回 + +
+
+
+ 4654654646
-
- - - 返回 - -
-
- 4654654646 + -
- - - - - + + + + + - + $("#submit_btn").on("click", function () { + var start = $("#time_start").val(); + var end = $("#time_end").val(); + var sdate = Date.parse(start) / 1000; + var edate = Date.parse(end) / 1000; + if (start == '' || end == '') { + layer.msg('开始时间与结束时间都不允许为空'); + return false; + } + if (sdate > edate) { + layer.msg('开始时间必须小于等于结束时间'); + return false; + } + if ((edate - sdate) > 2592000) { + layer.msg('时间间隔不能超过31天,请重新选择日期'); + return false; + } + //获取渠道 + var paychannel = $("#pay_way option:selected").val(); + if (paychannel == -1) { + layer.msg('请选择支付渠道'); + return false; + } + //获取文件 + if (!isfile) { + layer.msg('excel文件不能为空'); + return false; + } + //执行 + readFileInput(function () { + if(sendDefaultData.filedata_count == 0){ + MSG.hidemsg(); + layer.msg('excel内容不能为空'); + return false; + } + //获取需要循环的次数 + sendDefaultData.check_page = Math.ceil(sendDefaultData.filedata_count/check_size); + //创建面单 + var senddata = { + begin_time:start, + end_time:end, + pay_way:paychannel, + check_count:sendDefaultData.filedata_count + } + COMPARE.creatCompare(senddata,function(){ + COMPARE.loopCheck(1,function(){ + + }) + }) + + }) + }) + + + $("#fileinput").change(function () { + var p = $(this).val(); + var ext = p.substr(p.lastIndexOf(".")).toLowerCase(); + if (ext != ".xls" && ext != ".xlsx") { + layer.msg("文件仅支持excel文件格式"); + $(this).val(''); + p = ''; + } + + if (p != '') { + isfile = true; + } else { + isfile = false; + } + }) + }); + function readFileInput(callback) { + MSG.showmsg("读取excle中。。。"); + var wb;//读取完成的数据 + var f = $("#fileinput")[0].files[0]; + var reader = new FileReader(); + if (rABS) { + reader.readAsArrayBuffer(f); + } else { + reader.readAsBinaryString(f); + } + reader.onload = function (e) { + MSG.showmsg("文件读取完成,比较命令初始化。。。"); + var data = e.target.result; + if (rABS) { + wb = XLSX.read(btoa(fixdata(data)), { + type: 'base64' + }); + } else { + wb = XLSX.read(data, { + type: 'binary' + }); + } + try { + sendDefaultData.keys.push(wb.Sheets[wb.SheetNames[0]]["A1"]["v"]); + sendDefaultData.keys.push(wb.Sheets[wb.SheetNames[0]]["B1"]["v"]); + sendDefaultData.filedata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]); + sendDefaultData.filedata_count = sendDefaultData.filedata.length; + callback(); + } catch (error) { + MSG.hidemsg(); + isfile = false; + layer.msg('excel内容不符或不能为空'); + return false; + } + + // document.getElementById("demo").innerHTML= JSON.stringify( XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) ); + }; + } + + + function fixdata(data) { //文件流转BinaryString + var o = "", + l = 0, + w = 10240; + for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w))); + o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w))); + return o; + } + + $('#time_start').datetimepicker({ + format: 'yyyy-mm-dd', + language: "zh-CN", + minView: 2, + autoclose: true + }); + + $('#datetimepicker').datetimepicker({ + format: 'yyyy-mm-dd', + language: "zh-CN", + minView: 2, + autoclose: true, + pickerPosition: 'bottom-left' + }) + + \ No newline at end of file