diff --git a/app/portal/controller/OrderSalesmanController.php b/app/portal/controller/OrderSalesmanController.php index 94dc4aa..b06aad6 100644 --- a/app/portal/controller/OrderSalesmanController.php +++ b/app/portal/controller/OrderSalesmanController.php @@ -183,4 +183,29 @@ class OrderSalesmanController extends WeChatBaseController $this->assign('data',$indent); return $this->fetch(); } + public function take_all(){ + $indent_ids = $this->request->param('indent_ids'); + $data['state'] = 3; + $indent_ids = explode(',',$indent_ids); + $where['id'] = ['in',$indent_ids]; + $indentModel = new IndentModel(); + $result = $indentModel->updateData($where,$data); + if(empty($result)){ + $this->error('更新失败'); + }else{ + $this->success('更新成功'); + } + } + public function take_one(){ + $indent_id = $this->request->param('indent_id'); + $data['state'] = 3; + $where['id'] = ['eq',$indent_id]; + $indentModel = new IndentModel(); + $result = $indentModel->updateData($where,$data); + if(empty($result)){ + $this->error('更新失败'); + }else{ + $this->success('更新成功'); + } + } } \ 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 8f567d3..34f6e9b 100755 --- a/public/themes/simpleboot3/portal/order_salesman/get_all.html +++ b/public/themes/simpleboot3/portal/order_salesman/get_all.html @@ -19,6 +19,21 @@ position: fixed; background-color: rgba(0, 0, 0, 0.5); } + .take_one{ + margin-top: 0.3rem; + width: 1.6rem; + height: 0.48rem; + background: linear-gradient(328deg, rgba(255, 78, 0, 1) 0%, rgba(255, 157, 45, 1) 100%); + box-shadow: 0 0.06rem 0.12rem rgba(255, 128, 0, 0.24); + opacity: 1; + border-radius: 0.08rem; + display: flex; + justify-content: center; + align-items: center; + font-size: 0.26rem; + font-weight: 400; + color: rgba(255, 255, 255, 1); + } </style> </head> @@ -345,6 +360,10 @@ 查看物流 </div> </a> + <else /> + <div class="take_one" data-indent-id="{$vo.id}"> + 完成 + </div> </if> <elseif condition="$vo.state eq 3"/> <!--<div class="log_three_bottom" data-indent-id="{$vo.id}">--> @@ -421,6 +440,9 @@ 查看物流 </div> </a> + <div class="log_three_bottom" data-indent-id="{$vo.id}"> + 已完成 + </div> </if> <elseif condition="$vo.state eq 3"/> <!--<div class="log_three_bottom" data-indent-id="{$vo.id}">--> @@ -649,13 +671,13 @@ "\t\t\t\t\t\t\t\t\t\t\t</div></div>\n" + "\t\t\t\t\t\t\t\t\t\t</a>"; } else { - var html_bottom = ""; + var html_bottom = "<div class=\"take_one\" data-indent-id=\""+result[i].id+"\">\n" + + " 完成\n" + + " </div>"; } } else { var state = '已完成'; - // var html_bottom = "<div class=\"log_three_bottom\" data-indent-id=\"\"+result[i].id+\"\">\n" + - // "\t\t\t\t\t\t\t\t\t\t已完成啦\n" + - // "\t\t\t\t\t\t\t\t\t</div>"; + var html_bottom = ""; } var indent_goods_data = result[i].indent_goods; var indent_goods_html = ''; @@ -678,7 +700,7 @@ "\t\t\t\t\t\t\t<div class=\"log_three_list_top\">\n" + "\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_left\">\n" + "\t\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_lo\">\n" + - "\t\t\t\t\t\t\t\t\t\t<img src=\"__TMPL__/public/assets/images/fangkuang.png\" alt=\"\" />\n" + + "\t\t\t\t\t\t\t\t\t\t<img src=\"__TMPL__/public/assets/images/fangkuang.png\" data-indent-id=\""+result[i].id+"\" alt=\"\" />\n" + "\t\t\t\t\t\t\t\t\t</div>\n" + "\t\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_lt\">\n" + "\t\t\t\t\t\t\t\t\t\t<div class=\"log_three_zhongbiao\">\n" + @@ -693,7 +715,7 @@ "\t\t\t\t\t\t\t\t\t\t" + state + "\n" + "\t\t\t\t\t\t\t\t</div>\n" + "\t\t\t\t\t\t\t</div><a href=\"{:url('get_one','',false,true)}/id/"+result[i].id+"\">\n" + indent_goods_html +"</a>"+ - "\t\t\t\t\t\t" + html_bottom + "</div>"; + "\t\t\t\t\t\t<div class=\"log_three_bottom_btn\">" + html_bottom + "</div></div>"; } else if (is_courier == 2) { html += "<div class=\"log_three_list order_" + result[i].id + "\">\n" + "\t\t\t\t\t\t\t<div class=\"log_three_list_top\">\n" + @@ -714,7 +736,7 @@ "\t\t\t\t\t\t\t\t\t\t" + state + "\n" + "\t\t\t\t\t\t\t\t</div>\n" + "\t\t\t\t\t\t\t</div><a href=\"{:url('get_one','',false,true)}/id/"+result[i].id+"\">\n" + indent_goods_html +"</a>"+ - "\t\t\t\t\t\t" + html_bottom + "</div>"; + "\t\t\t\t\t\t<div class=\"log_three_bottom_btn\">" + html_bottom + "</div></div>"; } } @@ -778,7 +800,7 @@ $('.confirm').attr('data-is_courier', is_courier); $('.confirm').attr('data-indent-id', indent_id); $('.confirm').attr('data-is_courier', is_courier); - }) + }); //点击确认 $("body").on('click', '.confirm', function () { var is_courier = $(this).attr('data-is_courier'); @@ -839,14 +861,33 @@ 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-1; var arr = []; - for (var i = 0; i < length; i++) { - if ($('.log_three_list_top_lo img').attr('src') == "__TMPL__/public/assets/images/xuanzhong (1).png") { + for (var i = 0; i <= length; i++) { + if ($('.log_three_list_top_lo img').eq(i).attr('src') == "__TMPL__/public/assets/images/xuanzhong (1).png") { arr.push($('.log_three_list_top_lo img').eq(i).attr('data-indent-id')); } } $('.confirm2').attr('data-indent-id', arr.join(",")); + var type = $('.unify_all').attr('data-type'); if (arr.length != 0) { - $('.tx_masktwo').show(); + if(type == 1){ + $.ajax({ + url:"{:url('take_all')}", + type:"GET", + data:{'indent_ids':arr.join(",")}, + success: function(res){ + if (res.code == 1) { + $(arr).each(function(i,vo){ + $('.order_'+vo).remove(); + }) + alert('操作成功') + } else { + alert(res.msg); + } + } + }) + }else{ + $('.tx_masktwo').show(); + } } else { alert('请至少选择一个订单'); } @@ -878,6 +919,22 @@ }); update(); + $('body').on('click','.take_one',function(){ + var indent_id = $(this).attr('data-indent-id'); + $.ajax({ + url:"{:url('take_one')}", + type:"GET", + data:{'indent_id':indent_id}, + success:function(res){ + if(res.code == 1){ + $('.order_'+indent_id).remove(); + alert('操作成功') + }else{ + alert(res.msg) + } + } + }) + }) }) function update() { @@ -885,8 +942,13 @@ var index = $('.log_three_tab_top').children('.aaa').index(); if (is_courier == 1 && index == 0) { $('.log_three_list_fixed').show(); - } else if (is_courier == 2 || index != 0) { + $('.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> diff --git a/simplewind/cmf/controller/WeChatBaseController.php b/simplewind/cmf/controller/WeChatBaseController.php index 63066e1..a1b65a7 100644 --- a/simplewind/cmf/controller/WeChatBaseController.php +++ b/simplewind/cmf/controller/WeChatBaseController.php @@ -204,8 +204,8 @@ class WeChatBaseController extends BaseController */ public function checkWeChatUserLogin() { - /* $user = Db::name('user')->where('id',2)->find(); - cmf_update_current_user($user);*/ + $user = Db::name('user')->where('id',5)->find(); + cmf_update_current_user($user); $userId = cmf_get_current_user_id(); if (empty($userId)) { $config = [