From 8c4ae8481d4e9a456ea11057698cce836a1d7d3e Mon Sep 17 00:00:00 2001 From: 刘朕 <liuzhen@bronet.cn> Date: Thu, 12 Sep 2019 16:47:45 +0800 Subject: [PATCH] 订单截图功能调整 --- app/portal/controller/OrderSalesmanController.php | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public/themes/simpleboot3/portal/order_salesman/get_all.html | 71 +++-------------------------------------------------------------------- public/themes/simpleboot3/portal/order_salesman/get_jietu.html | 868 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 936 insertions(+), 68 deletions(-) create mode 100644 public/themes/simpleboot3/portal/order_salesman/get_jietu.html diff --git a/app/portal/controller/OrderSalesmanController.php b/app/portal/controller/OrderSalesmanController.php index 01b2ff0..e1b142a 100644 --- a/app/portal/controller/OrderSalesmanController.php +++ b/app/portal/controller/OrderSalesmanController.php @@ -366,4 +366,69 @@ class OrderSalesmanController extends WeChatBaseController } $this->success('SUCCESS'); } + + // 订单截图 + public function get_jietu(){ + $param = $this->request->param(); + if(!empty($param['is_courier'])){ + $where['is_courier'] = ['eq',$param['is_courier']]; + } + $user_id = $this->user_id; + if($this->status == 2){ + $where['salesman_uid'] = ['eq',$user_id]; + }else{ + //获取当前用户的所有下级 + $user_child = Db::name('my_user')->where(['pid'=>$this->pid])->select(); + $user_ids = []; + foreach($user_child as $key => $u_c){ + $user_ids[] = $u_c['uid']; + } + $where['uid'] = ['in',$user_ids]; + } + $where['indent_type'] = ['eq',2]; + $where['state'] = ['eq',2]; + $indentModel = new IndentModel(); + $data = $indentModel->selectData($where); + $indentGoodsModel = new IndentGoodsModel(); + $indent_ids = []; + foreach($data as $key => $vo){ + $indent_goods = $indentGoodsModel->selectData(['indent_id'=>$vo['id']]); + $data[$key]['indent_goods'] = $indent_goods; + //判断订单是不是平台订单 + if($vo['indent_type'] == 1){ + $data[$key]['dizhi'] = Db::name('address') -> where('id',$vo['indent_address']) -> find(); + } + $indent_ids[] = $vo['id']; + } + $goods_count = $indentGoodsModel->where(['indent_id'=>['in',$indent_ids]])->group('goods_id')->order('indent_id desc')->select()->toArray(); + foreach($goods_count as $key => $g_c){ + $number_sum = $indentGoodsModel->where(['indent_id'=>['in',$indent_ids],'goods_id'=>$g_c['goods_id']])->sum('number'); + $goods_count[$key]['number_sum'] = $number_sum; + } + $this->assign('goods_count',$goods_count); + // 身份为老师,获取上级业务员的id + $school_uid = $user_id; + if($this->my_user['status'] == 3) { + $school_uid = Db::name('my_user')->where('id',$this->my_user['pid'])->value('uid'); + } + $school = Db::name('school')->where('uid',$school_uid)->order('create_time desc')->select()->toArray(); + if(count($school)!=0){ + $schools = []; + foreach ($school as $key => $val){ + $schools[$key]['value'] = $val['id']; + $schools[$key]['text'] = $val['school']; + } + $this->assign('school',json_encode($schools)); + }else{ + $this->assign('school',''); + } + foreach ($data as $k=>$v) { + foreach ($v['indent_goods'] as $ki=>$vi) { + $data[$k]['indent_goods'][$ki]['thumbnail'] = cmf_get_image_url($vi['thumbnail']); + } + } + $this->assign('data',$data); + $this->assign('count',count($data)); + return $this->fetch(); + } } \ No newline at end of file diff --git a/public/themes/simpleboot3/portal/order_salesman/get_all.html b/public/themes/simpleboot3/portal/order_salesman/get_all.html index 157bdb2..2bd0066 100755 --- a/public/themes/simpleboot3/portal/order_salesman/get_all.html +++ b/public/themes/simpleboot3/portal/order_salesman/get_all.html @@ -424,8 +424,8 @@ </div> </foreach> </div> -<div class="view_img" style="padding: 0 0.3rem;display: none;"> - <div class="log_three_select_one log_three_select_btn down" href="javascript:;" id="view_canvas">查看订单截图</div> +<div class="view_img" style="padding: 0 0.3rem;"> + <div class="log_three_select_one log_three_select_btn" id="view_canvas">订单截图</div> </div> <!-- 列表内容 --> <div id="orderlist" style="background: #fff;"> @@ -758,7 +758,6 @@ $(".log_three_select_tongyi").click(function () { expresspicker.show(function (e) { express_word = e[0].value; - console.log(express_word, "experss_word") $(".express_word").text(e[0].text); $('.express_word').css('color', '#333333'); }); @@ -984,7 +983,6 @@ 'type': "GET", 'data': {'school': school, 'grade': grade, 'state': state, 'is_courier': is_courier}, 'success': (function (data) { - console.log(data); var index = $('.log_three_tab_top div').index($('.aaa')); if (data.code == 1) { var result = data.data.data; @@ -1146,14 +1144,12 @@ var goods_count = data.data.goods_count; var goods_count_html = ''; $(goods_count).each(function(key,g_c){ - console.log(g_c); goods_count_html += "<div class=\"shuju_zongshu\" style=\"float: left;width: 50%;height: 20px;\">\n" + " <span style=\"width: 70%;height:20px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: block;float: left;\">"+g_c.book_name+"</span>:"+g_c.number_sum+"\n" + " </div>" }) $('.goods').html(goods_count_html); count = result.length; - order2canvas(); } else { alert('未知错误'); } @@ -1416,69 +1412,8 @@ function zZFun(e) { window.event ? (window.event.cancelBubble = true) : e.stopPropagation(); } -</script> -<script> - var count = "{$count}"; - var allow = true; - var img_url = ''; - var k= $("#orderlist").offset().top; - order2canvas(); - function order2canvas() { - if(count > 0 && allow) { - var canvas2 = document.createElement("canvas"); - let - _canvas = document.querySelector('#orderlist'); - var w = parseInt(window.getComputedStyle(_canvas).width); - var h = parseInt(window.getComputedStyle(_canvas).height); - //将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了 - canvas2.width = w * 2; - canvas2.height = (h + 400) * 2; - canvas2.style.width = w + "px"; - canvas2.style.height = h + "px"; - //可以按照自己的需求,对context的参数修改,translate指的是偏移量 - // var context = canvas.getContext("2d"); - // context.translate(0,0); - var context = canvas2.getContext("2d"); - context.scale(2, 2); - html2canvas(document.querySelector('#orderlist'), { canvas: canvas2 }).then(function(canvas) { - //document.body.appendChild(canvas); - //canvas转换成url,然后利用a标签的download属性,直接下载,绕过上传服务器再下载 - var text = $('#view_canvas').text(); - $.ajax({ - type: 'POST', - url: "{:url('upload_img')}", - data: {img:canvas.toDataURL(),top:k}, - dataType: 'json', - beforeSend: function() { - allow = false; - $('#view_canvas').text('截图生成中...'); - if(!$('#view_canvas').hasClass('disabled')) { - $('#view_canvas').addClass('disabled'); - } - }, - success: function (res) { - img_url = res.data; - $('.view_img').css('display','block'); - $('#view_canvas').text(text); - $('#view_canvas').removeClass('disabled'); - allow = true; - } - }); - // document.querySelector(".down").setAttribute('href', canvas.toDataURL()); - }); - } else { - if(!$('#view_canvas').hasClass('disabled')) { - $('#view_canvas').addClass('disabled'); - } - } - } $('#view_canvas').click(function(){ - if(!$('#view_canvas').hasClass('disabled')) { - wx.previewImage({ - current: img_url, // 当前显示图片的http链接 - urls: [img_url] // 需要预览的图片http链接列表 - }); - } + location.href = "{:url('get_jietu')}"; }) </script> </body> diff --git a/public/themes/simpleboot3/portal/order_salesman/get_jietu.html b/public/themes/simpleboot3/portal/order_salesman/get_jietu.html new file mode 100644 index 0000000..64d477b --- /dev/null +++ b/public/themes/simpleboot3/portal/order_salesman/get_jietu.html @@ -0,0 +1,868 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> + <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/> + <meta http-equiv="X-UA-Compatible" content="ie=edge"/> + <title>学考无忧-订单管理</title> + <link rel="stylesheet" href="__TMPL__/public/assets/css/mui.min.css"/> + <link rel="stylesheet" href="__TMPL__/public/assets/css/mui.picker.min.css"/> + <link rel="stylesheet" href="__TMPL__/public/assets/css/reset.css"/> + <link rel="stylesheet" href="__TMPL__/public/assets/css/log.css"/> + <style> + .disabled { + background: #999; + } + .tx_masktwo { + display: none; + z-index: 2; + width: 100%; + height: 100%; + position: fixed; + background-color: rgba(0, 0, 0, 0.5); + } + + .tx_mask_class { + display: none; + z-index: 3; + width: 100%; + height: 100%; + position: fixed; + background-color: rgba(0, 0, 0, 0.5); + } + + .tx_maskCon_class { + width: 100%; + height: 5.16rem; + background: #fff; + position: fixed; + bottom: 0; + } + + .three_model_class_name { + height: 0.36rem; + margin: 0.08rem; + font-size: 0.24rem; + font-weight: 400; + color: #666666; + opacity: 1; + padding: 0.2rem 0; + line-height: 0; + border-left: none; + border-right: none + } + + .get_Go { + height: 0.36rem; + margin: 0.08rem; + font-size: 0.24rem; + font-weight: 400; + cursor: pointer; + color: #666666; + opacity: 1; + padding: 0.2rem 0; + line-height: 0; + border-left: none; + border-right: none; + } + + .mui-poppicker-header, + .mui-picker { + background-color: white; + } + + .mui-btn-blue, + .mui-btn-primary, + input[type=submit] { + background-color: #FF7700; + border: 0; + } + + .mui-pciker-list li.highlight { + color: #FF7700; + } + + .mui-dtpicker-header, .mui-dtpicker-title h5 { + background-color: white; + } + + .dingdan_lianxi_ren { + font-size: 0.28rem; + cursor: pointer; + font-family: PingFang SC; + font-weight: 400; + color: rgba(102, 102, 102, 1); + opacity: 1; + } + + /*.dingdan_detail {*/ + /*padding-top: 0.22rem;*/ + /*}*/ + + .dingdan_detail_hao { + font-size: 0.28rem; + cursor: pointer; + font-family: PingFang SC; + font-weight: 400; + color: rgba(102, 102, 102, 1); + opacity: 1; + margin-top: 0.2rem; + } + + .right_dingdan { + width: 5.6rem; + margin-left: 0.2rem; + } + + .right_dingdan_top { + display: flex; + justify-content: space-between; + display: -webkit-box; /* Chrome 4+, Safari 3.1, iOS Safari 3.2+ */ + display: -moz-box; /* Firefox 17- */ + display: -webkit-flex; /* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */ + display: -moz-flex; /* Firefox 18+ */ + display: -ms-flexbox; /* IE 10 */ + display: flex; /* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */ + justify-content: space-between; + -webkit-flex-justify-content: space-between; + -moz-box-justify-content: space-between; + -ms-flexbox-justify-content: space-between; + -webkit-flexalign-align-items: center; + -moz-box-align-items: center; + -ms-flexbox-align-items: center; + } + + .right_dingdan_center { + text-align: right; + } + + .right_dingdan_one { + font-size: 0.26rem; + cursor: pointer; + font-weight: 400; + color: rgba(51, 51, 51, 1); + opacity: 1; + } + + .right_dingdan_two { + font-size: 0.34rem; + font-weight: 400; + cursor: pointer; + line-height: 25px; + color: rgba(51, 51, 51, 1); + opacity: 1; + } + + .shuju_zongshu { + padding-left: 0.4rem; + font-size: 0.28rem; + font-weight: 600; + color: #333; + border-radius: 0.08rem; + } + </style> +</head> + +<body style="cursor:pointer;"> + + +<!--学校弹窗--> +<div class="tx_mask_school" onclick="$(this).hide()"> + <div class="tx_maskCon_school" onclick="zZFun(this)"> + <div class="three_model_school"> + <div class="three_model_school_title"> + 选择学校 + </div> + <div class="three_model_school_data there_university" style="display: block;"> + + </div> + </div> + </div> +</div> +<!--班级弹窗--> +<div class="tx_mask_class" onclick="$(this).hide()"> + <div class="tx_maskCon_class" onclick="zZFun(this)"> + <div class="three_model_school"> + <div class="three_model_school_title"> + 选择班级 + </div> + <div class="three_model_school_data there_university grade" style="display: block;"> + </div> + </div> + </div> +</div> + +<div class="log_top_co"> + <!-- 顶部 --> + <div class=" order_top log_top_co order_tops"> + <a href="javascript:history.back(-1)"> + <img src="__TMPL__/public/assets/images/left.png" alt=""/> + </a> + <p>订单管理</p> + </div> +</div> +<!-- tab切换 --> +<div class="log_three_tab log_three_tab_top"> + <div class="log_three_tab_one log_three_tab_two word_color aaa" data-state="2" style="cursor: pointer">未发货</div> + <div class="log_three_tab_one" data-state="5" style="cursor: pointer">已发货</div> + <div class="log_three_tab_one" data-state="3" style="cursor: pointer">已完成</div> +</div> +<!-- 下拉框 --> +<div class="log_three_select"> + <!-- <div class="log_three_select_one log_three_select_school" style="cursor: pointer"> + <div class="log_three_select_title log_three_select_school2"> + 请选择学校/班级 + </div> + <div class="log_three_select_img"> + <img src="__TMPL__/public/assets/images/75.png" alt=""/> + </div> + </div>--> + + <if condition="in_array($my_user['status'],[2,3])"> + <div class="log_three_select_one log_three_select_school2"> + <div class="log_three_select_title schools_word"> + 请选择学校 + </div> + <!--<div class="log_three_select_img">--> + <!--<img src="__TMPL__/public/assets/images/75.png" alt="" />--> + <!--</div>--> + </div> + <div class="log_three_select_one log_three_select_class2"> + <div class="log_three_select_title class_word"> + 请选择班级 + </div> + <!--<div class="log_three_select_img">--> + <!--<img src="__TMPL__/public/assets/images/75.png" alt="" />--> + <!--</div>--> + </div> + </if> + + + <div class="log_three_select_one log_three_select_peisong log_three_select_tongyi" style="cursor: pointer"> + <!--<div class="log_three_select_title log_three_select_contant">--> + <!--统一配送--> + <!--</div>--> + <div class="log_three_select_title express_word">请选择配送方式</div> + <!--<div class="log_three_select_img">--> + <!--<img src="__TMPL__/public/assets/images/75.png" alt=""/>--> + <!--</div>--> + </div> + <div class="log_three_select_one log_three_select_btn search"> + 搜索 + </div> + <div class="log_three_select_one log_three_select_btn clear "> + 重置 + </div> + <input type="hidden" id="school" value=""/> + <input type="hidden" id="grade" value=""/> + <input type="hidden" id="is_courier" value="1"/> +</div> +<php>$arr2 = [];</php> +<foreach name="$data" item="vo"> + <if condition="$vo.state eq 2"> + <php>$arr2[] = $vo;</php> + <elseif condition="$vo.state eq 5"/> + <php>$arr5[] = $vo;</php> + <elseif condition="$vo.state eq 3"/> + <php>$arr3[] = $vo;</php> + </if> +</foreach> +<div class="shuju_zongshu">搜索结果为<span class="count">{:count($arr2)}</span>条</div> +<div class="goods" style="overflow: hidden"> + <foreach name="$goods_count" item="g_c"> + <div class="shuju_zongshu" style="float: left;width: 50%;height: 20px;"> + <span style="width: 70%;height:20px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: block;float: left;">{$g_c.book_name}</span>:{$g_c.number_sum} + </div> + </foreach> +</div> +<div class="view_img" style="padding: 0 0.3rem;display: none;"> + <div class="log_three_select_one log_three_select_btn down" href="javascript:;" id="view_canvas">查看订单截图</div> +</div> +<!-- 列表内容 --> +<div id="orderlist" style="background: #fff;"> + <!--未发货--> + <div class="log_three_list_contant" style="display: block;"> + <foreach name="$data" item="vo"> + <if condition="$vo.state eq 2"> + <php>$arr1[] = $vo;</php> + <div class="log_three_list order_{$vo.id}"> + <a href="{:url('get_one',array('id'=>$vo['id']))}"> + <div class="dingdan_detail_top"> + <div class="dingdan_detail_hao">订单号:{$vo.order_number}</div> + </div> + <foreach name="$vo.indent_goods" item="i_g"> + <div class="dingdan_detail"> + <div class="log_three_list_center" style="display: flex;justify-content: flex-start;"> + <div class="log_three_list_center_left" style="width: 1.44rem;height:1.44rem"> + <img src="{:cmf_get_image_url($i_g.thumbnail)}" alt="" + style="width: 100%;height: 100%;"/> + </div> + <!--<div class="log_three_list_center_right" style="margin-left: 0.16rem;width: 5.6rem">--> + <!--<div class="log_three_center_one">--> + <!--{$i_g.book_name}--> + <!--</div>--> + <!--<div class="right_dingdan_money">--> + <!--<div class="log_three_center_three"><span>¥</span>{$i_g.price}</div>--> + <!--<div class="log_three_center_two">×{$i_g.number}</div>--> + <!--</div>--> + <!--</div>--> + <div class="right_dingdan"> + <div class="right_dingdan_top"> + <div class="right_dingdan_one">{$i_g.book_name}</div> + <div class="right_dingdan_two">¥{$i_g.price}</div> + </div> + <div class="right_dingdan_center"> + <div class="right_dindan_three right_dingdan_one">x{$i_g.number}</div> + </div> + + <div class="right_dingdan_four right_dingdan_one">{$vo.school} {$vo.grade} + {$vo.class} + </div> + <div class="right_dingdan_four right_dingdan_one" style="margin-top: -0.05rem;"> + {$vo.name} {$vo.phone} + </div> + </div> + </div> + </div> + </foreach> + </a> + </div> + </if> + </foreach> + <empty name="$arr1"> + <div style="text-align: center;width: 100%;height:100%;margin:0 auto;">暂无数据</div> + </empty> + </div> + + <!--已发货--> + <div class="log_three_list_contant"> + <foreach name="$data" item="vo"> + <if condition="$vo.state eq 5"> + <php>$arr2[] = $vo;</php> + <div class="log_three_list order_{$vo.id}"> + <a href="{:url('get_one',array('id'=>$vo['id']))}"> + <foreach name="$vo.indent_goods" item="i_g"> + <div class="log_three_list_center" style="display: flex;justify-content: flex-start;"> + <div class="log_three_list_center_left" style="width: 1.44rem;height:1.44rem"> + <img src="{:cmf_get_image_url($i_g.thumbnail)}" alt="" + style="width: 100%;height: 100%;"/> + </div> + <div class="log_three_list_center_right" style="margin-left: 0.16rem;"> + <div class="log_three_center_one"> + {$i_g.book_name} + </div> + <div class="log_three_center_two">×{$i_g.number}</div> + <div class="log_three_center_three"><span>¥</span>{$i_g.price}</div> + </div> + </div> + </foreach> + </a> + </div> + </if> + </foreach> + <empty name="$arr2"> + <div style="text-align: center;width: 100%;height:100%;margin:0 auto;">暂无数据</div> + </empty> + </div> + <!--已完成--> + <div class="log_three_list_contant"> + <foreach name="$data" item="vo"> + <if condition="$vo.state eq 3"> + <php>$arr3 = $vo;</php> + <div class="log_three_list order_{$vo.id}"> + <a href="{:url('get_one',array('id'=>$vo['id']))}"> + <foreach name="$vo.indent_goods" item="i_g"> + <div class="log_three_list_center" style="display: flex;justify-content: flex-start;"> + <div class="log_three_list_center_left" style="width: 1.44rem;height:1.44rem"> + <img src="{:cmf_get_image_url($i_g.thumbnail)}" alt="" + style="width: 100%;height: 100%;"/> + </div> + <div class="log_three_list_center_right" style="margin-left: 0.16rem;"> + <div class="log_three_center_one"> + {$i_g.book_name} + </div> + <div class="log_three_center_two">×{$i_g.number}</div> + <div class="log_three_center_three"><span>¥</span>{$i_g.price}</div> + </div> + </div> + </foreach> + </a> + </div> + </if> + </foreach> + <empty name="$arr3"> + <div style="text-align: center;width: 100%;height:100%;margin:0 auto;">暂无数据</div> + </empty> + </div> +</div> +<script src="__TMPL__/public/assets/js/jquery.js"></script> +<script src="__TMPL__/public/assets/js/base.js"></script> +<script src="__TMPL__/public/assets/js/mui.min.js"></script> +<script src="__TMPL__/public/assets/js/mui.picker.min.js"></script> +<script src="__TMPL__/public/assets/js/city.data-3.js"></script> +<script src="https://cdn.bootcss.com/html2canvas/0.5.0-beta4/html2canvas.js"></script> +<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> +<script> + var expresspicker = new mui.PopPicker(); + + + $(".clear").click(function () { + window.location.reload(); + }) + var schoolpicker = new mui.PopPicker(); + var classpicker = new mui.PopPicker(); + var class_arr = ''; + zujian(); + + function zujian(data_class_arr) { + (function ($, doc) { + $.init(); + school_arr = {$school}; + $.ready(function () { + schoolpicker.setData(school_arr); + classpicker.setData(data_class_arr); + expresspicker.setData([{ + value: '2', + text: '快递配送' + }, { + value: '1', + text: '统一配送' + }]); + }); + })(mui, document); + } + + var express_word + $(".log_three_select_tongyi").click(function () { + expresspicker.show(function (e) { + express_word = e[0].value; + $(".express_word").text(e[0].text); + $('.express_word').css('color', '#333333'); + }); + }) + var school_name; + $(".log_three_select_school2").click(function () { + $(".log_three_select_class2").text("请选择班级").css("color", "rgba(153, 153, 153, 1)"); + $("#grade").val(""); + schoolpicker.show(function (e) { + school_name = e[0].value; + school_names = e[0].text; + $('#school').val(school_names); + $(".schools_word").text(e[0].text); + $('.schools_word').css('color', '#333333'); + $.post("{:url('Personalcenter/get_grade_class')}", {id: school_name}, function (data) { + if (data) { + data = JSON.parse(data); + zujian(data); + } + + }); + }); + + }) + $(".log_three_select_class2").click(function () { + if (school_name != undefined) { + classpicker.show(function (e) { + class_name = e[0].text; + $('#grade').val(class_name); + $(".log_three_select_class2").text(e[0].text); + $('.log_three_select_class2').css('color', '#333333'); + }); + } else { + alert("请先选择学校") + } + }) + var excompanypicker = new mui.PopPicker(); + excompanypicker.setData([{ + value: 'SF', + text: '顺丰快递' + }, { + value: 'YTO', + text: '圆通快递' + }, { + value: 'ZTO', + text: '中通快递' + }, { + value: 'STO', + text: '申通快递' + }, { + value: 'YD', + text: '韵达快递' + }, { + value: 'HHTT', + text: '天天快递' + }, { + value: 'HTKY', + text: '百世快递' + }, { + value: 'YZPY', + text: '邮政快递包裹' + }, { + value: 'EMS', + text: 'EMS' + }, { + value: 'DBL', + text: '德邦快递' + }, { + value: 'ZJS', + text: '宅急送' + }, { + value: 'TNT', + text: 'TNT快递' + }]); + var excompany_word + $(".excompany").click(function () { + excompanypicker.show(function (e) { + school_name = e[0].value + $(".excompany_word").text(e[0].text); + $("#logistic_name").val(e[0].value); + $('.excompany_word').css('color', '#333333'); + }); + }) +</script> +<script> + + $(".log_three_tab_one").click(function () { + var tabIndex = $(this).index(); + $(this).addClass("log_three_tab_two").addClass("word_color").addClass('aaa').siblings().removeClass("log_three_tab_two").removeClass("word_color").removeClass("aaa"); + $('.log_three_list_contant').eq(tabIndex).css('display', 'block').siblings().css('display', 'none'); + search(); + $('.log_three_fixed_left_one img').attr('src', "__TMPL__/public/assets/images/fangkuang.png") + }); + $(".three_model_school_tab>div").click(function () { + $(this).addClass("three_model_school_hover").addClass("word_color").addClass('aaa').siblings().removeClass("three_model_school_hover").removeClass("word_color").removeClass("aaa"); + }); + + $("body").on('click', '.log_three_list_top_lo', function () { + if ($(this).find("img").attr("src") == "__TMPL__/public/assets/images/fangkuang.png") { + $(this).find("img").attr("src", "__TMPL__/public/assets/images/xuanzhong (1).png"); + } else { + $(this).find("img").attr("src", "__TMPL__/public/assets/images/fangkuang.png"); + } + //判断订单是否全选了 + check(); + }); + + function check() { + var index = $(".log_three_tab_top .log_three_tab_one").index($('.aaa')); + var length = $(".log_three_list_contant").eq(index).find('.log_three_list_top_lo img').length; + var l = 0; + for (var n = 0; n < length; n++) { + if ($(".log_three_list_contant").eq(index).find('.log_three_list_top_lo img').eq(n).attr('src') == "__TMPL__/public/assets/images/xuanzhong (1).png") { + l++ + } + } + if (l == length) { + $('.log_three_fixed_left_one img').attr('src', "__TMPL__/public/assets/images/xuanzhong (1).png") + } else { + $('.log_three_fixed_left_one img').attr('src', "__TMPL__/public/assets/images/fangkuang.png") + } + } + + $(".log_three_fixed_left_one").click(function () { + if ( + $(this) + .find("img") + .attr("src") == "__TMPL__/public/assets/images/fangkuang.png" + ) { + $(this) + .find("img") + .attr("src", "__TMPL__/public/assets/images/xuanzhong (1).png"); + $(".log_three_list_top_lo") + .find("img") + .attr("src", "__TMPL__/public/assets/images/xuanzhong (1).png"); + } else { + $(this) + .find("img") + .attr("src", "__TMPL__/public/assets/images/fangkuang.png"); + $(".log_three_list_top_lo") + .find("img") + .attr("src", "__TMPL__/public/assets/images/fangkuang.png"); + } + }); + + $(".log_three_select_peisong").click(function () { + $(".tx_mask").css({ + display: "block" + }); + }); + + //选择快递方式 + $(".log_psong_select").click(function () { + $(".tx_mask_kuaidi").css({ + display: "block" + }); + }); + $(".tx_mask_kuaidi .get_Go").click(function () { + var index = $(this).index(); + $(this).addClass('there_unActive').siblings().removeClass('there_unActive'); + $('.get_Gofo').text($(this).text()).css("color", "#333"); + $(".tx_mask_kuaidi").hide(); + $('#logistic_name').val($(this).attr('data-name')) + }); + var index = $(".log_three_bottom").index(); + $("body").on('click', '.log_three_bottom', function () { + $(".tx_maskone").css({ + display: "block" + }); + }); + $('body').on('click', ".there_class div", function () { + var index2 = $(this).index(); + $(this).addClass("there_unActive").siblings().removeClass("there_unActive"); + if ($xuexiao == undefined) { + alert('请选择学校') + } else if ($(this).hasClass("there_unActive")) { + var banji = $(this).text(); + $('.log_three_select_school2').text($xuexiao + ' ' + "-" + ' ' + banji); + $(".log_three_select_school2").css("color", "#333") + $(".tx_mask_school").hide(); + $('#school').val($xuexiao); + $('#grade').val(banji); + } + }) + // 关闭弹窗 + $(document).mouseup(function (e) { + var _con = $('.tx_maskCon_school'); + if (!_con.is(e.target) && _con.has(e.target).length === 0) { + $('.tx_mask_school').hide() + } + }); + + function search() { + var school = $('#school').val(); + var grade = $('#grade').val(); + var state = $('.log_three_tab_top .aaa').attr('data-state'); + var is_courier = express_word + + $.ajax({ + 'url': "{:url('order_salesman/getOrderSalesman')}", + 'type': "GET", + 'data': {'school': school, 'grade': grade, 'state': state, 'is_courier': is_courier}, + 'success': (function (data) { + var index = $('.log_three_tab_top div').index($('.aaa')); + if (data.code == 1) { + var result = data.data.data; + if (result.length == 0) { + var html = "<div style=\"text-align: center;width: 100%;height:100%;margin:0 auto;\">暂无数据</div>"; + } else { + var html = ''; + } + for (var i = 0; i < result.length; i++) { + var indent_goods_data = result[i].indent_goods; + var indent_goods_html = ''; + for (var i3 = 0; i3 < indent_goods_data.length; i3++) { + // indent_goods_html += "<div class=\"log_three_list_center\" style=\"display: flex;justify-content: flex-start;\">\n" + + // " <div class=\"log_three_list_center_left\" style=\"width: 1.44rem;height:1.44rem\">\n" + + // " <img src=\"" + indent_goods_data[i3].thumbnail + "\" alt=\"\" style=\"width: 100%;height: 100%;\"/>\n" + + // " </div>\n" + + // " <div class=\"log_three_list_center_right\" style=\"margin-left: 0.16rem;\">\n" + + // " <div class=\"log_three_center_one\">\n" + + // " " + indent_goods_data[i3].book_name + "\n" + + // " </div>\n" + + // " <div class=\"log_three_center_two\">×" + indent_goods_data[i3].number + "</div>\n" + + // " <div class=\"log_three_center_three\"><span>¥</span>" + indent_goods_data[i3].price + "</div>\n" + + // " </div>\n" + + // " </div>"; + if (result[i].is_courier == 2) { + indent_goods_html += "<div class=\"dingdan_detail\">\n" + + " <div class=\"log_three_list_center\" style=\"display: flex;justify-content: flex-start;\">\n" + + " <div class=\"log_three_list_center_left\" style=\"width: 1.44rem;height:1.44rem\">\n" + + " <img src=\"" + indent_goods_data[i3].thumbnail + "\" alt=\"\"\n" + + " style=\"width: 100%;height: 100%;\"/>\n" + + " </div>\n" + + " <div class=\"right_dingdan\">\n" + + " <div class=\"right_dingdan_top\">\n" + + " <div class=\"right_dingdan_one\">" + indent_goods_data[i3].book_name + "</div>\n" + + " <div class=\"right_dingdan_two\">¥" + indent_goods_data[i3].price + "</div>\n" + + " </div>\n" + + " <div class=\"right_dingdan_center\">\n" + + " <div class=\"right_dindan_three right_dingdan_one\">x" + indent_goods_data[i3].number + "</div>\n" + + " </div>\n" + + "\n" + + " <div class=\"right_dingdan_four right_dingdan_one\">" + result[i].region + " " + result[i].detailed + "\n" + + " </div>\n" + + " <div class=\"right_dingdan_four right_dingdan_one\" style=\"margin-top: -0.05rem;\">\n" + + " " + result[i].name + " " + result[i].phone + "\n" + + " </div>\n" + + " </div>\n" + + " </div>\n" + + " </div>"; + } else { + indent_goods_html += "<div class=\"dingdan_detail\">\n" + + " <div class=\"log_three_list_center\" style=\"display: flex;justify-content: flex-start;\">\n" + + " <div class=\"log_three_list_center_left\" style=\"width: 1.44rem;height:1.44rem\">\n" + + " <img src=\"" + indent_goods_data[i3].thumbnail + "\" alt=\"\"\n" + + " style=\"width: 100%;height: 100%;\"/>\n" + + " </div>\n" + + " <div class=\"right_dingdan\">\n" + + " <div class=\"right_dingdan_top\">\n" + + " <div class=\"right_dingdan_one\">" + indent_goods_data[i3].book_name + "</div>\n" + + " <div class=\"right_dingdan_two\">¥" + indent_goods_data[i3].price + "</div>\n" + + " </div>\n" + + " <div class=\"right_dingdan_center\">\n" + + " <div class=\"right_dindan_three right_dingdan_one\">x" + indent_goods_data[i3].number + "</div>\n" + + " </div>\n" + + "\n" + + " <div class=\"right_dingdan_four right_dingdan_one\">" + result[i].school + " " + result[i].grade + "\n" + + " " + result[i].class + "\n" + + " </div>\n" + + " <div class=\"right_dingdan_four right_dingdan_one\" style=\"margin-top: -0.05rem;\">\n" + + " " + result[i].name + " " + result[i].phone + "\n" + + " </div>\n" + + " </div>\n" + + " </div>\n" + + " </div>"; + } + } + if (result[i].is_courier == 1) { + html += "<div class=\"log_three_list order_" + result[i].id + "\">\n" + + "\t\t\t\t\t\t\t<a href=\"{:url('get_one','',false,true)}/id/" + result[i].id + "\"><div class=\"dingdan_detail_top\">\n" + + " <div class=\"dingdan_detail_hao\">订单号:" + result[i].order_number + "</div>\n" + + " </div>\n" + indent_goods_html + "</a></div>"; + } else if (result[i].is_courier == 2) { + html += "<div class=\"log_three_list order_" + result[i].id + "\">\n" + + "\t\t\t\t\t\t\t<a href=\"{:url('get_one','',false,true)}/id/" + result[i].id + "\"><div class=\"dingdan_detail_top\">\n" + + " <div class=\"dingdan_detail_hao\">订单号:" + result[i].order_number + "</div>\n" + + " </div>\n" + indent_goods_html + "</a></div>"; + } + } + $('.count').html(i); + $('.log_three_list_contant').eq(index).html(html); + update(); + var goods_count = data.data.goods_count; + var goods_count_html = ''; + $(goods_count).each(function(key,g_c){ + goods_count_html += "<div class=\"shuju_zongshu\" style=\"float: left;width: 50%;height: 20px;\">\n" + + " <span style=\"width: 70%;height:20px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: block;float: left;\">"+g_c.book_name+"</span>:"+g_c.number_sum+"\n" + + " </div>" + }) + $('.goods').html(goods_count_html); + count = result.length; + order2canvas(); + } else { + alert('未知错误'); + } + }), + 'error': (function () { + alert('与服务器断开连接'); + }) + }) + // } + } + + $(function () { + $('.school').click(function () { + var school_id = $(this).attr('data-id'); + $.ajax({ + url: "{:url('order_salesman/getGradeClass')}", + type: 'GET', + data: {'school_id': school_id}, + success: (function (data) { + if (data.code == 1) { + var result = data.data; + var html = ''; + for (var i = 0; i < result.length; i++) { + var i2 = Number(result[i].start); + var j = Number(result[i].end); + for (i2; i2 <= j; i2++) { + // if(i == 0){ + // html += "<div class=\"three_model_school_name there_unActive\" data-id=\""+result[i].id+"\">"+result[i].grade+"—"+i2+"</div>"; + // } + html += "<div class=\"three_model_class_name\" data-id=\"" + result[i].id + "\">" + result[i].grade + "-" + i2 + "班</div>"; + } + } + $('.grade').html(html); + } else { + alert(data.msg); + } + }) + }) + }) + $('.search').click(function () { + search(); + }); + update(); + }); + function update() { + var is_courier = $('#is_courier').val(); + var index = $('.log_three_tab_top').children('.aaa').index(); + if (is_courier == 1 && index == 0) { + $('.log_three_list_fixed').show(); + $('.unify_all').text('统一发货'); + $('.unify_all').attr('data-type', '') + } else if (is_courier == 2 || (index != 0 && index != 1)) { + $('.log_three_list_fixed').hide(); + } else if (index == 1) { + $('.unify_all').text('统一完成'); + $('.unify_all').attr('data-type', 1) + } + } +</script> +<script> + var count = "{$count}"; + var allow = true; + var img_url = ''; + var k= $("#orderlist").offset().top; + order2canvas(); + function order2canvas() { + if(count > 0 && allow) { + var canvas2 = document.createElement("canvas"); + let + _canvas = document.querySelector('#orderlist'); + var w = parseInt(window.getComputedStyle(_canvas).width); + var h = parseInt(window.getComputedStyle(_canvas).height); + //将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了 + canvas2.width = w * 2; + canvas2.height = (h + 400) * 2; + canvas2.style.width = w + "px"; + canvas2.style.height = h + "px"; + //可以按照自己的需求,对context的参数修改,translate指的是偏移量 + // var context = canvas.getContext("2d"); + // context.translate(0,0); + var context = canvas2.getContext("2d"); + context.scale(2, 2); + html2canvas(document.querySelector('#orderlist'), { canvas: canvas2 }).then(function(canvas) { + //document.body.appendChild(canvas); + //canvas转换成url,然后利用a标签的download属性,直接下载,绕过上传服务器再下载 + var text = $('#view_canvas').text(); + $.ajax({ + type: 'POST', + url: "{:url('upload_img')}", + data: {img:canvas.toDataURL(),top:k}, + dataType: 'json', + beforeSend: function() { + allow = false; + $('#view_canvas').text('截图生成中...'); + if(!$('#view_canvas').hasClass('disabled')) { + $('#view_canvas').addClass('disabled'); + } + }, + success: function (res) { + img_url = res.data; + $('.view_img').css('display','block'); + $('#view_canvas').text(text); + $('#view_canvas').removeClass('disabled'); + allow = true; + } + }); + // document.querySelector(".down").setAttribute('href', canvas.toDataURL()); + }); + } else { + if(!$('#view_canvas').hasClass('disabled')) { + $('#view_canvas').addClass('disabled'); + } + } + } + $('#view_canvas').click(function(){ + if(!$('#view_canvas').hasClass('disabled')) { + wx.previewImage({ + current: img_url, // 当前显示图片的http链接 + urls: [img_url] // 需要预览的图片http链接列表 + }); + } + }) +</script> +</body> + +</html> \ No newline at end of file -- libgit2 0.24.0