123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2017/3/17 0017
- * Time: 上午 10:52
- */
- use yii\helpers\Url;
- use yii\widgets\LinkPager;
- ?>
- <div class="panel panel-default">
- <div class="ibox-title">
- <h5><?= $name ?></h5>
- <div class="ibox-tools">
- <button type="button" class="btn btn-default btn-sm " onclick="window.history.go(-1)">返回</button>
- </div>
- </div>
- <table class="table ">
- <tr>
- <th>操作</th>
- <th>公司名称</th>
- <th>业主</th>
- <th>电话号码</th>
- <th>小区名称</th>
- <th>城市归属</th>
- <th>订单状态</th>
- <th>派单时间</th>
- </tr>
- <?php if(!empty($models)): ?>
- <?php foreach ($models as $vo):?>
- <tr id="tr_<?=$vo->id?>">
- <td>
- <div class="btn-group">
- <button data-toggle="dropdown" class="btn btn-primary dropdown-toggle btn-sm " aria-expanded="false">操作 <span class="caret"></span>
- </button>
- <ul class="dropdown-menu">
- <li><a url="<?=Url::toRoute(['sendorder-log/update-status','id'=>$vo->id]);?>" data-id="<?=$vo->id?>" href="javascript:void(0);" class="font-bold">编辑状态</a>
- </li>
- <li class="divider" ></li>
- <li><a href="javascript:void(0);" data-id="<?= $vo->id?>" class="opera" data-type="cancel">取消订单</a>
- </li>
- <li>
- <a href="javascript:void(0);" data-uid="<?=$vo->uid ?>" class="opera" data-type="send">短信通知</a>
- </li>
- </ul>
- </div>
- </td>
- <td><?= !empty($vo->company)?$vo->company->company :"" ?></td>
- <td><?= $modelSendOrder->name?></td>
- <td><?= $modelSendOrder->tel ?></td>
- <td><?= $modelSendOrder->house_name ?></td>
- <td><?= \common\models\Area::queryAdminProvinceName($modelSendOrder->province).\common\models\Area::queryAdminCityName($modelSendOrder->city) ?></td>
- <td id="status_name_<?=$vo->id?>"><?= !empty(\common\models\SendOrderLog::status_list()[$vo->status]) ? \common\models\SendOrderLog::status_list()[$vo->status] : "" ?></td>
- <td><?=date('Y-m-d H:i',$vo->c_time);?></td>
- </tr>
- <?php endforeach;?>
- <?php else :?>
- <tr class="no-records-found" style="text-align: center;"><td colspan="8">没有找到匹配的记录</td></tr>
- <?php endif; ?>
- </table>
- </div>
- <?=LinkPager::widget(['pagination' => $pages]); ?>
- <input type="hidden" id="status" >
- <script type="text/javascript">
- $('.font-bold').on('click',function () {
- $("#status").val("");
- var url = $(this).attr('url');
- var id = $(this).attr('data-id');
- layer.open({
- title : '编辑状态',
- type: 2,
- area: ['500px', '200px'],
- fixed: false, //不固定
- maxmin: false,
- content:url,
- btn: ['确定','取消'],//自定义按钮,默认第一个为确定按钮
- btnAlign: 'c',//按钮显示方式 'l' 按钮左对齐 'c' 按钮居中对齐 'r' 按钮右对齐(默认)
- yes:function(index, content){
- var status = $("#status").val();//选择状态
- if(status=='')
- {
- layer.msg("请选择状态");
- return false;
- }
- $.ajax({
- url:'<?=Url::toRoute(['sendorder-log/update-status']);?>',
- type:'POST',
- dataType:'json',
- data:{id:id,status:status,'<?=Yii::$app->request->csrfParam;?>':'<?= Yii::$app->request->csrfToken;?>'},
- success:function(data){
- console.log(data);
- if(data.sign==1){
- if(data.status!='')
- $('#status_name_'+id).html(data.status);
- toastr.success("", data.msg);
- }else{
- swal("", data.msg, "error");
- }
- }
- })
- layer.close(index);
- }
- });
- });
- /**
- * 取消订单,给装修公司发送短信
- */
- $('.opera').on('click',function () {
- var type = $(this).attr('data-type');
- if(type =='cancel')
- {
- var id = $(this).attr('data-id');
- var data = {id:id,'<?=Yii::$app->request->csrfParam;?>':'<?=Yii::$app->request->csrfToken;?>'};
- var title = "确定要取消对当前公司的派单吗?";
- var url = '<?=Url::toRoute(['sendorder-log/cancel']);?>';
- }else
- {
- var uid = $(this).attr('data-uid');
- var data = {uid:uid,'<?=Yii::$app->request->csrfParam;?>':'<?=Yii::$app->request->csrfToken;?>'};
- var title ="确定要短信通知吗?";
- var url = '<?=Url::toRoute(['sendorder-log/send-message']);?>';
- }
- swal({
- title: title,
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- closeOnConfirm: true,
- closeOnCancel: true
- },
- function(isConfirm){
- if (isConfirm) {
- $.ajax({
- url:url,
- type:'POST',
- dataType:'json',
- data:data,
- success:function(data){
- if(data.sign==1){
- toastr.success("", data.msg);
- if(type=='cancel')
- $('#tr_'+id).remove();
- }else{
- swal("", data.msg, "error");
- }
- }
- })
- }
- });
- });
- toastr.options={ "closeButton": true};
- </script>
|