作者 刘朕
1 个管道 的构建 通过 耗费 30 秒

订单截图功能调整

@@ -366,4 +366,69 @@ class OrderSalesmanController extends WeChatBaseController @@ -366,4 +366,69 @@ class OrderSalesmanController extends WeChatBaseController
366 } 366 }
367 $this->success('SUCCESS'); 367 $this->success('SUCCESS');
368 } 368 }
  369 +
  370 + // 订单截图
  371 + public function get_jietu(){
  372 + $param = $this->request->param();
  373 + if(!empty($param['is_courier'])){
  374 + $where['is_courier'] = ['eq',$param['is_courier']];
  375 + }
  376 + $user_id = $this->user_id;
  377 + if($this->status == 2){
  378 + $where['salesman_uid'] = ['eq',$user_id];
  379 + }else{
  380 + //获取当前用户的所有下级
  381 + $user_child = Db::name('my_user')->where(['pid'=>$this->pid])->select();
  382 + $user_ids = [];
  383 + foreach($user_child as $key => $u_c){
  384 + $user_ids[] = $u_c['uid'];
  385 + }
  386 + $where['uid'] = ['in',$user_ids];
  387 + }
  388 + $where['indent_type'] = ['eq',2];
  389 + $where['state'] = ['eq',2];
  390 + $indentModel = new IndentModel();
  391 + $data = $indentModel->selectData($where);
  392 + $indentGoodsModel = new IndentGoodsModel();
  393 + $indent_ids = [];
  394 + foreach($data as $key => $vo){
  395 + $indent_goods = $indentGoodsModel->selectData(['indent_id'=>$vo['id']]);
  396 + $data[$key]['indent_goods'] = $indent_goods;
  397 + //判断订单是不是平台订单
  398 + if($vo['indent_type'] == 1){
  399 + $data[$key]['dizhi'] = Db::name('address') -> where('id',$vo['indent_address']) -> find();
  400 + }
  401 + $indent_ids[] = $vo['id'];
  402 + }
  403 + $goods_count = $indentGoodsModel->where(['indent_id'=>['in',$indent_ids]])->group('goods_id')->order('indent_id desc')->select()->toArray();
  404 + foreach($goods_count as $key => $g_c){
  405 + $number_sum = $indentGoodsModel->where(['indent_id'=>['in',$indent_ids],'goods_id'=>$g_c['goods_id']])->sum('number');
  406 + $goods_count[$key]['number_sum'] = $number_sum;
  407 + }
  408 + $this->assign('goods_count',$goods_count);
  409 + // 身份为老师,获取上级业务员的id
  410 + $school_uid = $user_id;
  411 + if($this->my_user['status'] == 3) {
  412 + $school_uid = Db::name('my_user')->where('id',$this->my_user['pid'])->value('uid');
  413 + }
  414 + $school = Db::name('school')->where('uid',$school_uid)->order('create_time desc')->select()->toArray();
  415 + if(count($school)!=0){
  416 + $schools = [];
  417 + foreach ($school as $key => $val){
  418 + $schools[$key]['value'] = $val['id'];
  419 + $schools[$key]['text'] = $val['school'];
  420 + }
  421 + $this->assign('school',json_encode($schools));
  422 + }else{
  423 + $this->assign('school','');
  424 + }
  425 + foreach ($data as $k=>$v) {
  426 + foreach ($v['indent_goods'] as $ki=>$vi) {
  427 + $data[$k]['indent_goods'][$ki]['thumbnail'] = cmf_get_image_url($vi['thumbnail']);
  428 + }
  429 + }
  430 + $this->assign('data',$data);
  431 + $this->assign('count',count($data));
  432 + return $this->fetch();
  433 + }
369 } 434 }
@@ -424,8 +424,8 @@ @@ -424,8 +424,8 @@
424 </div> 424 </div>
425 </foreach> 425 </foreach>
426 </div> 426 </div>
427 -<div class="view_img" style="padding: 0 0.3rem;display: none;">  
428 - <div class="log_three_select_one log_three_select_btn down" href="javascript:;" id="view_canvas">查看订单截图</div> 427 +<div class="view_img" style="padding: 0 0.3rem;">
  428 + <div class="log_three_select_one log_three_select_btn" id="view_canvas">订单截图</div>
429 </div> 429 </div>
430 <!-- 列表内容 --> 430 <!-- 列表内容 -->
431 <div id="orderlist" style="background: #fff;"> 431 <div id="orderlist" style="background: #fff;">
@@ -758,7 +758,6 @@ @@ -758,7 +758,6 @@
758 $(".log_three_select_tongyi").click(function () { 758 $(".log_three_select_tongyi").click(function () {
759 expresspicker.show(function (e) { 759 expresspicker.show(function (e) {
760 express_word = e[0].value; 760 express_word = e[0].value;
761 - console.log(express_word, "experss_word")  
762 $(".express_word").text(e[0].text); 761 $(".express_word").text(e[0].text);
763 $('.express_word').css('color', '#333333'); 762 $('.express_word').css('color', '#333333');
764 }); 763 });
@@ -984,7 +983,6 @@ @@ -984,7 +983,6 @@
984 'type': "GET", 983 'type': "GET",
985 'data': {'school': school, 'grade': grade, 'state': state, 'is_courier': is_courier}, 984 'data': {'school': school, 'grade': grade, 'state': state, 'is_courier': is_courier},
986 'success': (function (data) { 985 'success': (function (data) {
987 - console.log(data);  
988 var index = $('.log_three_tab_top div').index($('.aaa')); 986 var index = $('.log_three_tab_top div').index($('.aaa'));
989 if (data.code == 1) { 987 if (data.code == 1) {
990 var result = data.data.data; 988 var result = data.data.data;
@@ -1146,14 +1144,12 @@ @@ -1146,14 +1144,12 @@
1146 var goods_count = data.data.goods_count; 1144 var goods_count = data.data.goods_count;
1147 var goods_count_html = ''; 1145 var goods_count_html = '';
1148 $(goods_count).each(function(key,g_c){ 1146 $(goods_count).each(function(key,g_c){
1149 - console.log(g_c);  
1150 goods_count_html += "<div class=\"shuju_zongshu\" style=\"float: left;width: 50%;height: 20px;\">\n" + 1147 goods_count_html += "<div class=\"shuju_zongshu\" style=\"float: left;width: 50%;height: 20px;\">\n" +
1151 " <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" + 1148 " <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" +
1152 " </div>" 1149 " </div>"
1153 }) 1150 })
1154 $('.goods').html(goods_count_html); 1151 $('.goods').html(goods_count_html);
1155 count = result.length; 1152 count = result.length;
1156 - order2canvas();  
1157 } else { 1153 } else {
1158 alert('未知错误'); 1154 alert('未知错误');
1159 } 1155 }
@@ -1416,69 +1412,8 @@ @@ -1416,69 +1412,8 @@
1416 function zZFun(e) { 1412 function zZFun(e) {
1417 window.event ? (window.event.cancelBubble = true) : e.stopPropagation(); 1413 window.event ? (window.event.cancelBubble = true) : e.stopPropagation();
1418 } 1414 }
1419 -</script>  
1420 -<script>  
1421 - var count = "{$count}";  
1422 - var allow = true;  
1423 - var img_url = '';  
1424 - var k= $("#orderlist").offset().top;  
1425 - order2canvas();  
1426 - function order2canvas() {  
1427 - if(count > 0 && allow) {  
1428 - var canvas2 = document.createElement("canvas");  
1429 - let  
1430 - _canvas = document.querySelector('#orderlist');  
1431 - var w = parseInt(window.getComputedStyle(_canvas).width);  
1432 - var h = parseInt(window.getComputedStyle(_canvas).height);  
1433 - //将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了  
1434 - canvas2.width = w * 2;  
1435 - canvas2.height = (h + 400) * 2;  
1436 - canvas2.style.width = w + "px";  
1437 - canvas2.style.height = h + "px";  
1438 - //可以按照自己的需求,对context的参数修改,translate指的是偏移量  
1439 - // var context = canvas.getContext("2d");  
1440 - // context.translate(0,0);  
1441 - var context = canvas2.getContext("2d");  
1442 - context.scale(2, 2);  
1443 - html2canvas(document.querySelector('#orderlist'), { canvas: canvas2 }).then(function(canvas) {  
1444 - //document.body.appendChild(canvas);  
1445 - //canvas转换成url,然后利用a标签的download属性,直接下载,绕过上传服务器再下载  
1446 - var text = $('#view_canvas').text();  
1447 - $.ajax({  
1448 - type: 'POST',  
1449 - url: "{:url('upload_img')}",  
1450 - data: {img:canvas.toDataURL(),top:k},  
1451 - dataType: 'json',  
1452 - beforeSend: function() {  
1453 - allow = false;  
1454 - $('#view_canvas').text('截图生成中...');  
1455 - if(!$('#view_canvas').hasClass('disabled')) {  
1456 - $('#view_canvas').addClass('disabled');  
1457 - }  
1458 - },  
1459 - success: function (res) {  
1460 - img_url = res.data;  
1461 - $('.view_img').css('display','block');  
1462 - $('#view_canvas').text(text);  
1463 - $('#view_canvas').removeClass('disabled');  
1464 - allow = true;  
1465 - }  
1466 - });  
1467 - // document.querySelector(".down").setAttribute('href', canvas.toDataURL());  
1468 - });  
1469 - } else {  
1470 - if(!$('#view_canvas').hasClass('disabled')) {  
1471 - $('#view_canvas').addClass('disabled');  
1472 - }  
1473 - }  
1474 - }  
1475 $('#view_canvas').click(function(){ 1415 $('#view_canvas').click(function(){
1476 - if(!$('#view_canvas').hasClass('disabled')) {  
1477 - wx.previewImage({  
1478 - current: img_url, // 当前显示图片的http链接  
1479 - urls: [img_url] // 需要预览的图片http链接列表  
1480 - });  
1481 - } 1416 + location.href = "{:url('get_jietu')}";
1482 }) 1417 })
1483 </script> 1418 </script>
1484 </body> 1419 </body>
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +
  4 +<head>
  5 + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
  6 + <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
  7 + <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
  8 + <title>学考无忧-订单管理</title>
  9 + <link rel="stylesheet" href="__TMPL__/public/assets/css/mui.min.css"/>
  10 + <link rel="stylesheet" href="__TMPL__/public/assets/css/mui.picker.min.css"/>
  11 + <link rel="stylesheet" href="__TMPL__/public/assets/css/reset.css"/>
  12 + <link rel="stylesheet" href="__TMPL__/public/assets/css/log.css"/>
  13 + <style>
  14 + .disabled {
  15 + background: #999;
  16 + }
  17 + .tx_masktwo {
  18 + display: none;
  19 + z-index: 2;
  20 + width: 100%;
  21 + height: 100%;
  22 + position: fixed;
  23 + background-color: rgba(0, 0, 0, 0.5);
  24 + }
  25 +
  26 + .tx_mask_class {
  27 + display: none;
  28 + z-index: 3;
  29 + width: 100%;
  30 + height: 100%;
  31 + position: fixed;
  32 + background-color: rgba(0, 0, 0, 0.5);
  33 + }
  34 +
  35 + .tx_maskCon_class {
  36 + width: 100%;
  37 + height: 5.16rem;
  38 + background: #fff;
  39 + position: fixed;
  40 + bottom: 0;
  41 + }
  42 +
  43 + .three_model_class_name {
  44 + height: 0.36rem;
  45 + margin: 0.08rem;
  46 + font-size: 0.24rem;
  47 + font-weight: 400;
  48 + color: #666666;
  49 + opacity: 1;
  50 + padding: 0.2rem 0;
  51 + line-height: 0;
  52 + border-left: none;
  53 + border-right: none
  54 + }
  55 +
  56 + .get_Go {
  57 + height: 0.36rem;
  58 + margin: 0.08rem;
  59 + font-size: 0.24rem;
  60 + font-weight: 400;
  61 + cursor: pointer;
  62 + color: #666666;
  63 + opacity: 1;
  64 + padding: 0.2rem 0;
  65 + line-height: 0;
  66 + border-left: none;
  67 + border-right: none;
  68 + }
  69 +
  70 + .mui-poppicker-header,
  71 + .mui-picker {
  72 + background-color: white;
  73 + }
  74 +
  75 + .mui-btn-blue,
  76 + .mui-btn-primary,
  77 + input[type=submit] {
  78 + background-color: #FF7700;
  79 + border: 0;
  80 + }
  81 +
  82 + .mui-pciker-list li.highlight {
  83 + color: #FF7700;
  84 + }
  85 +
  86 + .mui-dtpicker-header, .mui-dtpicker-title h5 {
  87 + background-color: white;
  88 + }
  89 +
  90 + .dingdan_lianxi_ren {
  91 + font-size: 0.28rem;
  92 + cursor: pointer;
  93 + font-family: PingFang SC;
  94 + font-weight: 400;
  95 + color: rgba(102, 102, 102, 1);
  96 + opacity: 1;
  97 + }
  98 +
  99 + /*.dingdan_detail {*/
  100 + /*padding-top: 0.22rem;*/
  101 + /*}*/
  102 +
  103 + .dingdan_detail_hao {
  104 + font-size: 0.28rem;
  105 + cursor: pointer;
  106 + font-family: PingFang SC;
  107 + font-weight: 400;
  108 + color: rgba(102, 102, 102, 1);
  109 + opacity: 1;
  110 + margin-top: 0.2rem;
  111 + }
  112 +
  113 + .right_dingdan {
  114 + width: 5.6rem;
  115 + margin-left: 0.2rem;
  116 + }
  117 +
  118 + .right_dingdan_top {
  119 + display: flex;
  120 + justify-content: space-between;
  121 + display: -webkit-box; /* Chrome 4+, Safari 3.1, iOS Safari 3.2+ */
  122 + display: -moz-box; /* Firefox 17- */
  123 + display: -webkit-flex; /* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */
  124 + display: -moz-flex; /* Firefox 18+ */
  125 + display: -ms-flexbox; /* IE 10 */
  126 + display: flex; /* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */
  127 + justify-content: space-between;
  128 + -webkit-flex-justify-content: space-between;
  129 + -moz-box-justify-content: space-between;
  130 + -ms-flexbox-justify-content: space-between;
  131 + -webkit-flexalign-align-items: center;
  132 + -moz-box-align-items: center;
  133 + -ms-flexbox-align-items: center;
  134 + }
  135 +
  136 + .right_dingdan_center {
  137 + text-align: right;
  138 + }
  139 +
  140 + .right_dingdan_one {
  141 + font-size: 0.26rem;
  142 + cursor: pointer;
  143 + font-weight: 400;
  144 + color: rgba(51, 51, 51, 1);
  145 + opacity: 1;
  146 + }
  147 +
  148 + .right_dingdan_two {
  149 + font-size: 0.34rem;
  150 + font-weight: 400;
  151 + cursor: pointer;
  152 + line-height: 25px;
  153 + color: rgba(51, 51, 51, 1);
  154 + opacity: 1;
  155 + }
  156 +
  157 + .shuju_zongshu {
  158 + padding-left: 0.4rem;
  159 + font-size: 0.28rem;
  160 + font-weight: 600;
  161 + color: #333;
  162 + border-radius: 0.08rem;
  163 + }
  164 + </style>
  165 +</head>
  166 +
  167 +<body style="cursor:pointer;">
  168 +
  169 +
  170 +<!--学校弹窗-->
  171 +<div class="tx_mask_school" onclick="$(this).hide()">
  172 + <div class="tx_maskCon_school" onclick="zZFun(this)">
  173 + <div class="three_model_school">
  174 + <div class="three_model_school_title">
  175 + 选择学校
  176 + </div>
  177 + <div class="three_model_school_data there_university" style="display: block;">
  178 +
  179 + </div>
  180 + </div>
  181 + </div>
  182 +</div>
  183 +<!--班级弹窗-->
  184 +<div class="tx_mask_class" onclick="$(this).hide()">
  185 + <div class="tx_maskCon_class" onclick="zZFun(this)">
  186 + <div class="three_model_school">
  187 + <div class="three_model_school_title">
  188 + 选择班级
  189 + </div>
  190 + <div class="three_model_school_data there_university grade" style="display: block;">
  191 + </div>
  192 + </div>
  193 + </div>
  194 +</div>
  195 +
  196 +<div class="log_top_co">
  197 + <!-- 顶部 -->
  198 + <div class=" order_top log_top_co order_tops">
  199 + <a href="javascript:history.back(-1)">
  200 + <img src="__TMPL__/public/assets/images/left.png" alt=""/>
  201 + </a>
  202 + <p>订单管理</p>
  203 + </div>
  204 +</div>
  205 +<!-- tab切换 -->
  206 +<div class="log_three_tab log_three_tab_top">
  207 + <div class="log_three_tab_one log_three_tab_two word_color aaa" data-state="2" style="cursor: pointer">未发货</div>
  208 + <div class="log_three_tab_one" data-state="5" style="cursor: pointer">已发货</div>
  209 + <div class="log_three_tab_one" data-state="3" style="cursor: pointer">已完成</div>
  210 +</div>
  211 +<!-- 下拉框 -->
  212 +<div class="log_three_select">
  213 + <!-- <div class="log_three_select_one log_three_select_school" style="cursor: pointer">
  214 + <div class="log_three_select_title log_three_select_school2">
  215 + 请选择学校/班级
  216 + </div>
  217 + <div class="log_three_select_img">
  218 + <img src="__TMPL__/public/assets/images/75.png" alt=""/>
  219 + </div>
  220 + </div>-->
  221 +
  222 + <if condition="in_array($my_user['status'],[2,3])">
  223 + <div class="log_three_select_one log_three_select_school2">
  224 + <div class="log_three_select_title schools_word">
  225 + 请选择学校
  226 + </div>
  227 + <!--<div class="log_three_select_img">-->
  228 + <!--<img src="__TMPL__/public/assets/images/75.png" alt="" />-->
  229 + <!--</div>-->
  230 + </div>
  231 + <div class="log_three_select_one log_three_select_class2">
  232 + <div class="log_three_select_title class_word">
  233 + 请选择班级
  234 + </div>
  235 + <!--<div class="log_three_select_img">-->
  236 + <!--<img src="__TMPL__/public/assets/images/75.png" alt="" />-->
  237 + <!--</div>-->
  238 + </div>
  239 + </if>
  240 +
  241 +
  242 + <div class="log_three_select_one log_three_select_peisong log_three_select_tongyi" style="cursor: pointer">
  243 + <!--<div class="log_three_select_title log_three_select_contant">-->
  244 + <!--统一配送-->
  245 + <!--</div>-->
  246 + <div class="log_three_select_title express_word">请选择配送方式</div>
  247 + <!--<div class="log_three_select_img">-->
  248 + <!--<img src="__TMPL__/public/assets/images/75.png" alt=""/>-->
  249 + <!--</div>-->
  250 + </div>
  251 + <div class="log_three_select_one log_three_select_btn search">
  252 + 搜索
  253 + </div>
  254 + <div class="log_three_select_one log_three_select_btn clear ">
  255 + 重置
  256 + </div>
  257 + <input type="hidden" id="school" value=""/>
  258 + <input type="hidden" id="grade" value=""/>
  259 + <input type="hidden" id="is_courier" value="1"/>
  260 +</div>
  261 +<php>$arr2 = [];</php>
  262 +<foreach name="$data" item="vo">
  263 + <if condition="$vo.state eq 2">
  264 + <php>$arr2[] = $vo;</php>
  265 + <elseif condition="$vo.state eq 5"/>
  266 + <php>$arr5[] = $vo;</php>
  267 + <elseif condition="$vo.state eq 3"/>
  268 + <php>$arr3[] = $vo;</php>
  269 + </if>
  270 +</foreach>
  271 +<div class="shuju_zongshu">搜索结果为<span class="count">{:count($arr2)}</span></div>
  272 +<div class="goods" style="overflow: hidden">
  273 + <foreach name="$goods_count" item="g_c">
  274 + <div class="shuju_zongshu" style="float: left;width: 50%;height: 20px;">
  275 + <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}
  276 + </div>
  277 + </foreach>
  278 +</div>
  279 +<div class="view_img" style="padding: 0 0.3rem;display: none;">
  280 + <div class="log_three_select_one log_three_select_btn down" href="javascript:;" id="view_canvas">查看订单截图</div>
  281 +</div>
  282 +<!-- 列表内容 -->
  283 +<div id="orderlist" style="background: #fff;">
  284 + <!--未发货-->
  285 + <div class="log_three_list_contant" style="display: block;">
  286 + <foreach name="$data" item="vo">
  287 + <if condition="$vo.state eq 2">
  288 + <php>$arr1[] = $vo;</php>
  289 + <div class="log_three_list order_{$vo.id}">
  290 + <a href="{:url('get_one',array('id'=>$vo['id']))}">
  291 + <div class="dingdan_detail_top">
  292 + <div class="dingdan_detail_hao">订单号:{$vo.order_number}</div>
  293 + </div>
  294 + <foreach name="$vo.indent_goods" item="i_g">
  295 + <div class="dingdan_detail">
  296 + <div class="log_three_list_center" style="display: flex;justify-content: flex-start;">
  297 + <div class="log_three_list_center_left" style="width: 1.44rem;height:1.44rem">
  298 + <img src="{:cmf_get_image_url($i_g.thumbnail)}" alt=""
  299 + style="width: 100%;height: 100%;"/>
  300 + </div>
  301 + <!--<div class="log_three_list_center_right" style="margin-left: 0.16rem;width: 5.6rem">-->
  302 + <!--<div class="log_three_center_one">-->
  303 + <!--{$i_g.book_name}-->
  304 + <!--</div>-->
  305 + <!--<div class="right_dingdan_money">-->
  306 + <!--<div class="log_three_center_three"><span>¥</span>{$i_g.price}</div>-->
  307 + <!--<div class="log_three_center_two">×{$i_g.number}</div>-->
  308 + <!--</div>-->
  309 + <!--</div>-->
  310 + <div class="right_dingdan">
  311 + <div class="right_dingdan_top">
  312 + <div class="right_dingdan_one">{$i_g.book_name}</div>
  313 + <div class="right_dingdan_two">¥{$i_g.price}</div>
  314 + </div>
  315 + <div class="right_dingdan_center">
  316 + <div class="right_dindan_three right_dingdan_one">x{$i_g.number}</div>
  317 + </div>
  318 +
  319 + <div class="right_dingdan_four right_dingdan_one">{$vo.school} {$vo.grade}
  320 + {$vo.class}
  321 + </div>
  322 + <div class="right_dingdan_four right_dingdan_one" style="margin-top: -0.05rem;">
  323 + {$vo.name} &nbsp;&nbsp;{$vo.phone}
  324 + </div>
  325 + </div>
  326 + </div>
  327 + </div>
  328 + </foreach>
  329 + </a>
  330 + </div>
  331 + </if>
  332 + </foreach>
  333 + <empty name="$arr1">
  334 + <div style="text-align: center;width: 100%;height:100%;margin:0 auto;">暂无数据</div>
  335 + </empty>
  336 + </div>
  337 +
  338 + <!--已发货-->
  339 + <div class="log_three_list_contant">
  340 + <foreach name="$data" item="vo">
  341 + <if condition="$vo.state eq 5">
  342 + <php>$arr2[] = $vo;</php>
  343 + <div class="log_three_list order_{$vo.id}">
  344 + <a href="{:url('get_one',array('id'=>$vo['id']))}">
  345 + <foreach name="$vo.indent_goods" item="i_g">
  346 + <div class="log_three_list_center" style="display: flex;justify-content: flex-start;">
  347 + <div class="log_three_list_center_left" style="width: 1.44rem;height:1.44rem">
  348 + <img src="{:cmf_get_image_url($i_g.thumbnail)}" alt=""
  349 + style="width: 100%;height: 100%;"/>
  350 + </div>
  351 + <div class="log_three_list_center_right" style="margin-left: 0.16rem;">
  352 + <div class="log_three_center_one">
  353 + {$i_g.book_name}
  354 + </div>
  355 + <div class="log_three_center_two">×{$i_g.number}</div>
  356 + <div class="log_three_center_three"><span></span>{$i_g.price}</div>
  357 + </div>
  358 + </div>
  359 + </foreach>
  360 + </a>
  361 + </div>
  362 + </if>
  363 + </foreach>
  364 + <empty name="$arr2">
  365 + <div style="text-align: center;width: 100%;height:100%;margin:0 auto;">暂无数据</div>
  366 + </empty>
  367 + </div>
  368 + <!--已完成-->
  369 + <div class="log_three_list_contant">
  370 + <foreach name="$data" item="vo">
  371 + <if condition="$vo.state eq 3">
  372 + <php>$arr3 = $vo;</php>
  373 + <div class="log_three_list order_{$vo.id}">
  374 + <a href="{:url('get_one',array('id'=>$vo['id']))}">
  375 + <foreach name="$vo.indent_goods" item="i_g">
  376 + <div class="log_three_list_center" style="display: flex;justify-content: flex-start;">
  377 + <div class="log_three_list_center_left" style="width: 1.44rem;height:1.44rem">
  378 + <img src="{:cmf_get_image_url($i_g.thumbnail)}" alt=""
  379 + style="width: 100%;height: 100%;"/>
  380 + </div>
  381 + <div class="log_three_list_center_right" style="margin-left: 0.16rem;">
  382 + <div class="log_three_center_one">
  383 + {$i_g.book_name}
  384 + </div>
  385 + <div class="log_three_center_two">×{$i_g.number}</div>
  386 + <div class="log_three_center_three"><span></span>{$i_g.price}</div>
  387 + </div>
  388 + </div>
  389 + </foreach>
  390 + </a>
  391 + </div>
  392 + </if>
  393 + </foreach>
  394 + <empty name="$arr3">
  395 + <div style="text-align: center;width: 100%;height:100%;margin:0 auto;">暂无数据</div>
  396 + </empty>
  397 + </div>
  398 +</div>
  399 +<script src="__TMPL__/public/assets/js/jquery.js"></script>
  400 +<script src="__TMPL__/public/assets/js/base.js"></script>
  401 +<script src="__TMPL__/public/assets/js/mui.min.js"></script>
  402 +<script src="__TMPL__/public/assets/js/mui.picker.min.js"></script>
  403 +<script src="__TMPL__/public/assets/js/city.data-3.js"></script>
  404 +<script src="https://cdn.bootcss.com/html2canvas/0.5.0-beta4/html2canvas.js"></script>
  405 +<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
  406 +<script>
  407 + var expresspicker = new mui.PopPicker();
  408 +
  409 +
  410 + $(".clear").click(function () {
  411 + window.location.reload();
  412 + })
  413 + var schoolpicker = new mui.PopPicker();
  414 + var classpicker = new mui.PopPicker();
  415 + var class_arr = '';
  416 + zujian();
  417 +
  418 + function zujian(data_class_arr) {
  419 + (function ($, doc) {
  420 + $.init();
  421 + school_arr = {$school};
  422 + $.ready(function () {
  423 + schoolpicker.setData(school_arr);
  424 + classpicker.setData(data_class_arr);
  425 + expresspicker.setData([{
  426 + value: '2',
  427 + text: '快递配送'
  428 + }, {
  429 + value: '1',
  430 + text: '统一配送'
  431 + }]);
  432 + });
  433 + })(mui, document);
  434 + }
  435 +
  436 + var express_word
  437 + $(".log_three_select_tongyi").click(function () {
  438 + expresspicker.show(function (e) {
  439 + express_word = e[0].value;
  440 + $(".express_word").text(e[0].text);
  441 + $('.express_word').css('color', '#333333');
  442 + });
  443 + })
  444 + var school_name;
  445 + $(".log_three_select_school2").click(function () {
  446 + $(".log_three_select_class2").text("请选择班级").css("color", "rgba(153, 153, 153, 1)");
  447 + $("#grade").val("");
  448 + schoolpicker.show(function (e) {
  449 + school_name = e[0].value;
  450 + school_names = e[0].text;
  451 + $('#school').val(school_names);
  452 + $(".schools_word").text(e[0].text);
  453 + $('.schools_word').css('color', '#333333');
  454 + $.post("{:url('Personalcenter/get_grade_class')}", {id: school_name}, function (data) {
  455 + if (data) {
  456 + data = JSON.parse(data);
  457 + zujian(data);
  458 + }
  459 +
  460 + });
  461 + });
  462 +
  463 + })
  464 + $(".log_three_select_class2").click(function () {
  465 + if (school_name != undefined) {
  466 + classpicker.show(function (e) {
  467 + class_name = e[0].text;
  468 + $('#grade').val(class_name);
  469 + $(".log_three_select_class2").text(e[0].text);
  470 + $('.log_three_select_class2').css('color', '#333333');
  471 + });
  472 + } else {
  473 + alert("请先选择学校")
  474 + }
  475 + })
  476 + var excompanypicker = new mui.PopPicker();
  477 + excompanypicker.setData([{
  478 + value: 'SF',
  479 + text: '顺丰快递'
  480 + }, {
  481 + value: 'YTO',
  482 + text: '圆通快递'
  483 + }, {
  484 + value: 'ZTO',
  485 + text: '中通快递'
  486 + }, {
  487 + value: 'STO',
  488 + text: '申通快递'
  489 + }, {
  490 + value: 'YD',
  491 + text: '韵达快递'
  492 + }, {
  493 + value: 'HHTT',
  494 + text: '天天快递'
  495 + }, {
  496 + value: 'HTKY',
  497 + text: '百世快递'
  498 + }, {
  499 + value: 'YZPY',
  500 + text: '邮政快递包裹'
  501 + }, {
  502 + value: 'EMS',
  503 + text: 'EMS'
  504 + }, {
  505 + value: 'DBL',
  506 + text: '德邦快递'
  507 + }, {
  508 + value: 'ZJS',
  509 + text: '宅急送'
  510 + }, {
  511 + value: 'TNT',
  512 + text: 'TNT快递'
  513 + }]);
  514 + var excompany_word
  515 + $(".excompany").click(function () {
  516 + excompanypicker.show(function (e) {
  517 + school_name = e[0].value
  518 + $(".excompany_word").text(e[0].text);
  519 + $("#logistic_name").val(e[0].value);
  520 + $('.excompany_word').css('color', '#333333');
  521 + });
  522 + })
  523 +</script>
  524 +<script>
  525 +
  526 + $(".log_three_tab_one").click(function () {
  527 + var tabIndex = $(this).index();
  528 + $(this).addClass("log_three_tab_two").addClass("word_color").addClass('aaa').siblings().removeClass("log_three_tab_two").removeClass("word_color").removeClass("aaa");
  529 + $('.log_three_list_contant').eq(tabIndex).css('display', 'block').siblings().css('display', 'none');
  530 + search();
  531 + $('.log_three_fixed_left_one img').attr('src', "__TMPL__/public/assets/images/fangkuang.png")
  532 + });
  533 + $(".three_model_school_tab>div").click(function () {
  534 + $(this).addClass("three_model_school_hover").addClass("word_color").addClass('aaa').siblings().removeClass("three_model_school_hover").removeClass("word_color").removeClass("aaa");
  535 + });
  536 +
  537 + $("body").on('click', '.log_three_list_top_lo', function () {
  538 + if ($(this).find("img").attr("src") == "__TMPL__/public/assets/images/fangkuang.png") {
  539 + $(this).find("img").attr("src", "__TMPL__/public/assets/images/xuanzhong (1).png");
  540 + } else {
  541 + $(this).find("img").attr("src", "__TMPL__/public/assets/images/fangkuang.png");
  542 + }
  543 + //判断订单是否全选了
  544 + check();
  545 + });
  546 +
  547 + function check() {
  548 + var index = $(".log_three_tab_top .log_three_tab_one").index($('.aaa'));
  549 + var length = $(".log_three_list_contant").eq(index).find('.log_three_list_top_lo img').length;
  550 + var l = 0;
  551 + for (var n = 0; n < length; n++) {
  552 + 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") {
  553 + l++
  554 + }
  555 + }
  556 + if (l == length) {
  557 + $('.log_three_fixed_left_one img').attr('src', "__TMPL__/public/assets/images/xuanzhong (1).png")
  558 + } else {
  559 + $('.log_three_fixed_left_one img').attr('src', "__TMPL__/public/assets/images/fangkuang.png")
  560 + }
  561 + }
  562 +
  563 + $(".log_three_fixed_left_one").click(function () {
  564 + if (
  565 + $(this)
  566 + .find("img")
  567 + .attr("src") == "__TMPL__/public/assets/images/fangkuang.png"
  568 + ) {
  569 + $(this)
  570 + .find("img")
  571 + .attr("src", "__TMPL__/public/assets/images/xuanzhong (1).png");
  572 + $(".log_three_list_top_lo")
  573 + .find("img")
  574 + .attr("src", "__TMPL__/public/assets/images/xuanzhong (1).png");
  575 + } else {
  576 + $(this)
  577 + .find("img")
  578 + .attr("src", "__TMPL__/public/assets/images/fangkuang.png");
  579 + $(".log_three_list_top_lo")
  580 + .find("img")
  581 + .attr("src", "__TMPL__/public/assets/images/fangkuang.png");
  582 + }
  583 + });
  584 +
  585 + $(".log_three_select_peisong").click(function () {
  586 + $(".tx_mask").css({
  587 + display: "block"
  588 + });
  589 + });
  590 +
  591 + //选择快递方式
  592 + $(".log_psong_select").click(function () {
  593 + $(".tx_mask_kuaidi").css({
  594 + display: "block"
  595 + });
  596 + });
  597 + $(".tx_mask_kuaidi .get_Go").click(function () {
  598 + var index = $(this).index();
  599 + $(this).addClass('there_unActive').siblings().removeClass('there_unActive');
  600 + $('.get_Gofo').text($(this).text()).css("color", "#333");
  601 + $(".tx_mask_kuaidi").hide();
  602 + $('#logistic_name').val($(this).attr('data-name'))
  603 + });
  604 + var index = $(".log_three_bottom").index();
  605 + $("body").on('click', '.log_three_bottom', function () {
  606 + $(".tx_maskone").css({
  607 + display: "block"
  608 + });
  609 + });
  610 + $('body').on('click', ".there_class div", function () {
  611 + var index2 = $(this).index();
  612 + $(this).addClass("there_unActive").siblings().removeClass("there_unActive");
  613 + if ($xuexiao == undefined) {
  614 + alert('请选择学校')
  615 + } else if ($(this).hasClass("there_unActive")) {
  616 + var banji = $(this).text();
  617 + $('.log_three_select_school2').text($xuexiao + ' ' + "-" + ' ' + banji);
  618 + $(".log_three_select_school2").css("color", "#333")
  619 + $(".tx_mask_school").hide();
  620 + $('#school').val($xuexiao);
  621 + $('#grade').val(banji);
  622 + }
  623 + })
  624 + // 关闭弹窗
  625 + $(document).mouseup(function (e) {
  626 + var _con = $('.tx_maskCon_school');
  627 + if (!_con.is(e.target) && _con.has(e.target).length === 0) {
  628 + $('.tx_mask_school').hide()
  629 + }
  630 + });
  631 +
  632 + function search() {
  633 + var school = $('#school').val();
  634 + var grade = $('#grade').val();
  635 + var state = $('.log_three_tab_top .aaa').attr('data-state');
  636 + var is_courier = express_word
  637 +
  638 + $.ajax({
  639 + 'url': "{:url('order_salesman/getOrderSalesman')}",
  640 + 'type': "GET",
  641 + 'data': {'school': school, 'grade': grade, 'state': state, 'is_courier': is_courier},
  642 + 'success': (function (data) {
  643 + var index = $('.log_three_tab_top div').index($('.aaa'));
  644 + if (data.code == 1) {
  645 + var result = data.data.data;
  646 + if (result.length == 0) {
  647 + var html = "<div style=\"text-align: center;width: 100%;height:100%;margin:0 auto;\">暂无数据</div>";
  648 + } else {
  649 + var html = '';
  650 + }
  651 + for (var i = 0; i < result.length; i++) {
  652 + var indent_goods_data = result[i].indent_goods;
  653 + var indent_goods_html = '';
  654 + for (var i3 = 0; i3 < indent_goods_data.length; i3++) {
  655 + // indent_goods_html += "<div class=\"log_three_list_center\" style=\"display: flex;justify-content: flex-start;\">\n" +
  656 + // " <div class=\"log_three_list_center_left\" style=\"width: 1.44rem;height:1.44rem\">\n" +
  657 + // " <img src=\"" + indent_goods_data[i3].thumbnail + "\" alt=\"\" style=\"width: 100%;height: 100%;\"/>\n" +
  658 + // " </div>\n" +
  659 + // " <div class=\"log_three_list_center_right\" style=\"margin-left: 0.16rem;\">\n" +
  660 + // " <div class=\"log_three_center_one\">\n" +
  661 + // " " + indent_goods_data[i3].book_name + "\n" +
  662 + // " </div>\n" +
  663 + // " <div class=\"log_three_center_two\">×" + indent_goods_data[i3].number + "</div>\n" +
  664 + // " <div class=\"log_three_center_three\"><span>¥</span>" + indent_goods_data[i3].price + "</div>\n" +
  665 + // " </div>\n" +
  666 + // " </div>";
  667 + if (result[i].is_courier == 2) {
  668 + indent_goods_html += "<div class=\"dingdan_detail\">\n" +
  669 + " <div class=\"log_three_list_center\" style=\"display: flex;justify-content: flex-start;\">\n" +
  670 + " <div class=\"log_three_list_center_left\" style=\"width: 1.44rem;height:1.44rem\">\n" +
  671 + " <img src=\"" + indent_goods_data[i3].thumbnail + "\" alt=\"\"\n" +
  672 + " style=\"width: 100%;height: 100%;\"/>\n" +
  673 + " </div>\n" +
  674 + " <div class=\"right_dingdan\">\n" +
  675 + " <div class=\"right_dingdan_top\">\n" +
  676 + " <div class=\"right_dingdan_one\">" + indent_goods_data[i3].book_name + "</div>\n" +
  677 + " <div class=\"right_dingdan_two\">¥" + indent_goods_data[i3].price + "</div>\n" +
  678 + " </div>\n" +
  679 + " <div class=\"right_dingdan_center\">\n" +
  680 + " <div class=\"right_dindan_three right_dingdan_one\">x" + indent_goods_data[i3].number + "</div>\n" +
  681 + " </div>\n" +
  682 + "\n" +
  683 + " <div class=\"right_dingdan_four right_dingdan_one\">" + result[i].region + " " + result[i].detailed + "\n" +
  684 + " </div>\n" +
  685 + " <div class=\"right_dingdan_four right_dingdan_one\" style=\"margin-top: -0.05rem;\">\n" +
  686 + " " + result[i].name + "&nbsp;&nbsp;" + result[i].phone + "\n" +
  687 + " </div>\n" +
  688 + " </div>\n" +
  689 + " </div>\n" +
  690 + " </div>";
  691 + } else {
  692 + indent_goods_html += "<div class=\"dingdan_detail\">\n" +
  693 + " <div class=\"log_three_list_center\" style=\"display: flex;justify-content: flex-start;\">\n" +
  694 + " <div class=\"log_three_list_center_left\" style=\"width: 1.44rem;height:1.44rem\">\n" +
  695 + " <img src=\"" + indent_goods_data[i3].thumbnail + "\" alt=\"\"\n" +
  696 + " style=\"width: 100%;height: 100%;\"/>\n" +
  697 + " </div>\n" +
  698 + " <div class=\"right_dingdan\">\n" +
  699 + " <div class=\"right_dingdan_top\">\n" +
  700 + " <div class=\"right_dingdan_one\">" + indent_goods_data[i3].book_name + "</div>\n" +
  701 + " <div class=\"right_dingdan_two\">¥" + indent_goods_data[i3].price + "</div>\n" +
  702 + " </div>\n" +
  703 + " <div class=\"right_dingdan_center\">\n" +
  704 + " <div class=\"right_dindan_three right_dingdan_one\">x" + indent_goods_data[i3].number + "</div>\n" +
  705 + " </div>\n" +
  706 + "\n" +
  707 + " <div class=\"right_dingdan_four right_dingdan_one\">" + result[i].school + " " + result[i].grade + "\n" +
  708 + " " + result[i].class + "\n" +
  709 + " </div>\n" +
  710 + " <div class=\"right_dingdan_four right_dingdan_one\" style=\"margin-top: -0.05rem;\">\n" +
  711 + " " + result[i].name + "&nbsp;&nbsp;" + result[i].phone + "\n" +
  712 + " </div>\n" +
  713 + " </div>\n" +
  714 + " </div>\n" +
  715 + " </div>";
  716 + }
  717 + }
  718 + if (result[i].is_courier == 1) {
  719 + html += "<div class=\"log_three_list order_" + result[i].id + "\">\n" +
  720 + "\t\t\t\t\t\t\t<a href=\"{:url('get_one','',false,true)}/id/" + result[i].id + "\"><div class=\"dingdan_detail_top\">\n" +
  721 + " <div class=\"dingdan_detail_hao\">订单号:" + result[i].order_number + "</div>\n" +
  722 + " </div>\n" + indent_goods_html + "</a></div>";
  723 + } else if (result[i].is_courier == 2) {
  724 + html += "<div class=\"log_three_list order_" + result[i].id + "\">\n" +
  725 + "\t\t\t\t\t\t\t<a href=\"{:url('get_one','',false,true)}/id/" + result[i].id + "\"><div class=\"dingdan_detail_top\">\n" +
  726 + " <div class=\"dingdan_detail_hao\">订单号:" + result[i].order_number + "</div>\n" +
  727 + " </div>\n" + indent_goods_html + "</a></div>";
  728 + }
  729 + }
  730 + $('.count').html(i);
  731 + $('.log_three_list_contant').eq(index).html(html);
  732 + update();
  733 + var goods_count = data.data.goods_count;
  734 + var goods_count_html = '';
  735 + $(goods_count).each(function(key,g_c){
  736 + goods_count_html += "<div class=\"shuju_zongshu\" style=\"float: left;width: 50%;height: 20px;\">\n" +
  737 + " <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" +
  738 + " </div>"
  739 + })
  740 + $('.goods').html(goods_count_html);
  741 + count = result.length;
  742 + order2canvas();
  743 + } else {
  744 + alert('未知错误');
  745 + }
  746 + }),
  747 + 'error': (function () {
  748 + alert('与服务器断开连接');
  749 + })
  750 + })
  751 + // }
  752 + }
  753 +
  754 + $(function () {
  755 + $('.school').click(function () {
  756 + var school_id = $(this).attr('data-id');
  757 + $.ajax({
  758 + url: "{:url('order_salesman/getGradeClass')}",
  759 + type: 'GET',
  760 + data: {'school_id': school_id},
  761 + success: (function (data) {
  762 + if (data.code == 1) {
  763 + var result = data.data;
  764 + var html = '';
  765 + for (var i = 0; i < result.length; i++) {
  766 + var i2 = Number(result[i].start);
  767 + var j = Number(result[i].end);
  768 + for (i2; i2 <= j; i2++) {
  769 + // if(i == 0){
  770 + // html += "<div class=\"three_model_school_name there_unActive\" data-id=\""+result[i].id+"\">"+result[i].grade+"—"+i2+"</div>";
  771 + // }
  772 + html += "<div class=\"three_model_class_name\" data-id=\"" + result[i].id + "\">" + result[i].grade + "-" + i2 + "班</div>";
  773 + }
  774 + }
  775 + $('.grade').html(html);
  776 + } else {
  777 + alert(data.msg);
  778 + }
  779 + })
  780 + })
  781 + })
  782 + $('.search').click(function () {
  783 + search();
  784 + });
  785 + update();
  786 + });
  787 + function update() {
  788 + var is_courier = $('#is_courier').val();
  789 + var index = $('.log_three_tab_top').children('.aaa').index();
  790 + if (is_courier == 1 && index == 0) {
  791 + $('.log_three_list_fixed').show();
  792 + $('.unify_all').text('统一发货');
  793 + $('.unify_all').attr('data-type', '')
  794 + } else if (is_courier == 2 || (index != 0 && index != 1)) {
  795 + $('.log_three_list_fixed').hide();
  796 + } else if (index == 1) {
  797 + $('.unify_all').text('统一完成');
  798 + $('.unify_all').attr('data-type', 1)
  799 + }
  800 + }
  801 +</script>
  802 +<script>
  803 + var count = "{$count}";
  804 + var allow = true;
  805 + var img_url = '';
  806 + var k= $("#orderlist").offset().top;
  807 + order2canvas();
  808 + function order2canvas() {
  809 + if(count > 0 && allow) {
  810 + var canvas2 = document.createElement("canvas");
  811 + let
  812 + _canvas = document.querySelector('#orderlist');
  813 + var w = parseInt(window.getComputedStyle(_canvas).width);
  814 + var h = parseInt(window.getComputedStyle(_canvas).height);
  815 + //将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了
  816 + canvas2.width = w * 2;
  817 + canvas2.height = (h + 400) * 2;
  818 + canvas2.style.width = w + "px";
  819 + canvas2.style.height = h + "px";
  820 + //可以按照自己的需求,对context的参数修改,translate指的是偏移量
  821 + // var context = canvas.getContext("2d");
  822 + // context.translate(0,0);
  823 + var context = canvas2.getContext("2d");
  824 + context.scale(2, 2);
  825 + html2canvas(document.querySelector('#orderlist'), { canvas: canvas2 }).then(function(canvas) {
  826 + //document.body.appendChild(canvas);
  827 + //canvas转换成url,然后利用a标签的download属性,直接下载,绕过上传服务器再下载
  828 + var text = $('#view_canvas').text();
  829 + $.ajax({
  830 + type: 'POST',
  831 + url: "{:url('upload_img')}",
  832 + data: {img:canvas.toDataURL(),top:k},
  833 + dataType: 'json',
  834 + beforeSend: function() {
  835 + allow = false;
  836 + $('#view_canvas').text('截图生成中...');
  837 + if(!$('#view_canvas').hasClass('disabled')) {
  838 + $('#view_canvas').addClass('disabled');
  839 + }
  840 + },
  841 + success: function (res) {
  842 + img_url = res.data;
  843 + $('.view_img').css('display','block');
  844 + $('#view_canvas').text(text);
  845 + $('#view_canvas').removeClass('disabled');
  846 + allow = true;
  847 + }
  848 + });
  849 + // document.querySelector(".down").setAttribute('href', canvas.toDataURL());
  850 + });
  851 + } else {
  852 + if(!$('#view_canvas').hasClass('disabled')) {
  853 + $('#view_canvas').addClass('disabled');
  854 + }
  855 + }
  856 + }
  857 + $('#view_canvas').click(function(){
  858 + if(!$('#view_canvas').hasClass('disabled')) {
  859 + wx.previewImage({
  860 + current: img_url, // 当前显示图片的http链接
  861 + urls: [img_url] // 需要预览的图片http链接列表
  862 + });
  863 + }
  864 + })
  865 +</script>
  866 +</body>
  867 +
  868 +</html>