title = '订单管理';$this->params['breadcrumbs'] = [$this->title];/** @var \yii\data\DataProviderInterface $dataProvider *//** @var \common\models\Order[] $models *//** @var \backend\models\OrderSearch $searchModel */$models = $dataProvider->getModels();$pagination = $dataProvider->getPagination();$virtualOrderModel = new \common\models\VirtualOrder();?>render('nav-tabs') ;?>'__parent_id__']); $cityUrl = \yii\helpers\Url::to(['region/ajax-cities', 'province_id' => '__province_id__']); $districtUrl = \yii\helpers\Url::to(['region/ajax-districts', 'city_id' => '__city_id__']); $labelOptions = ['labelOptions' => ['class' => false]]; $form = \yii\bootstrap\ActiveForm::begin([ 'action' => ['list'], 'layout' => 'inline', 'method' => 'get', ]); ?> field($searchModel, 'top_category_id', $labelOptions)->widget(Select2Widget::className(), [ 'serverUrl' => \yii\helpers\Url::to(['product-category/ajax-list']), 'itemsName' => 'categories', 'selectedItem' => $searchModel->topCategory ? [$searchModel->topCategory->id => $searchModel->topCategory->name] : [], 'options' => ['prompt'=>'选择类目', 'class' => 'form-control'], 'placeholderId' => '0', 'placeholder' => '选择类目', 'eventSelect' => new JsExpression(" $('#category_id').val('0').trigger('change'); ") ])?> field($searchModel, 'category_id')->widget(Select2Widget::className(), [ 'serverUrl' => \yii\helpers\Url::to(['product-category/ajax-list']), 'itemsName' => 'categories', 'selectedItem' => $searchModel->category ? [$searchModel->category->id => $searchModel->category->name] : [], 'options' => ['prompt'=>'选择类目', 'class' => 'form-control'], 'placeholderId' => '0', 'placeholder' => '选择类目', 'eventOpening' => new JsExpression(" var id = $('#top_category_id').val(); serverUrl = '{ $categoryUrl}'.replace('__parent_id__', id ? id : '-1'); ") ])?> field($searchModel, 'province_id', $labelOptions)->widget(Select2Widget::className(), [ 'serverUrl' => \yii\helpers\Url::to(['region/ajax-provinces']), 'itemsName' => 'provinces', 'selectedItem' => $searchModel->province ? [$searchModel->province->id => $searchModel->province->province_name] : [], 'options' => ['class' => 'form-control', 'prompt'=>'请选择省份'], 'placeholderId' => '0', 'placeholder' => '请选择省份', 'eventSelect' => new JsExpression(" $('#city_id').val('0').trigger('change'); $('#district_id').val('0').trigger('change'); ") ]); ?> field($searchModel, 'city_id')->widget(Select2Widget::className(), [ 'serverUrl' => \yii\helpers\Url::to(['region/ajax-cities', 'province_id' => '__province_id__']), 'itemsName' => 'cities', 'selectedItem' => $searchModel->city ? [$searchModel->city->id => $searchModel->city->name] : [], 'options' => ['class' => 'form-control', 'prompt'=>'请选择城市'], 'placeholderId' => '0', 'placeholder' => '请选择城市', 'eventSelect' => new JsExpression(" $('#district_id').val('0').trigger('change'); "), 'eventOpening' => new JsExpression(" var id = $('#province_id').val(); serverUrl = '{ $cityUrl}'.replace('__province_id__', id ? id : '-1'); ") ]); ?> field($searchModel, 'district_id')->widget(Select2Widget::className(), [ 'serverUrl' => \yii\helpers\Url::to(['region/ajax-districts', 'city_id' => '__city_id__']), 'selectedItem' => $searchModel->district ? [$searchModel->district->id => $searchModel->district->name] : [], 'options' => ['class' => 'form-control', 'prompt'=>'请选择地区'], 'placeholderId' => '0', 'placeholder' => '请选择地区', 'itemsName' => 'districts', 'eventOpening' => new JsExpression(" var id = $('#city_id').val(); serverUrl = '{ $districtUrl}'.replace('__city_id__', id ? id : '-1'); ") ]); ?> field($searchModel, 'type', $labelOptions)->widget(Select2Widget::className(), [ 'selectedItem' => \backend\models\OrderSearch::getTypes(), 'placeholderId' => '0', 'placeholder' => '请选择类型', 'options' => ['class' => 'form-control', 'prompt'=>'请选择类型'], 'static' => true, ]) ?> field($searchModel, 'keyword', $labelOptions)->textInput() ?> $status)) ?>
下单时间 订单号 客户姓名/联系方式 公司名称 所购商品 地区 业务人员 嘟嘟妹 客服 服务人员 订单金额 订单状态 操作 formatter->asDatetime($model->created_at);?> sn; ?> user->name;?>/ user->phone;?> company_name ;?> product_name ;?> province_name ;?>- city_name ;?>- district_name ;?> creator_name ;?> supervisor_name;?> customer_service_name ;?> status == Order::STATUS_PENDING_PAY || $model->status == Order::STATUS_PENDING_ALLOT || $model->status == Order::STATUS_PENDING_SERVICE || $model->status == Order::STATUS_IN_SERVICE): ?> clerk_name ;?> status == Order::STATUS_PENDING_SERVICE || $model->status == Order::STATUS_IN_SERVICE): ?> price ;?> find()->where(['id'=> $model->virtual_order_id])->one();?>isRefund() && $model->refund_status == Order::REFUND_STATUS_APPLY): ?> 退款原因: refund_reason] ;?>退款金额: refund_amount ;?>status == Order::STATUS_PENDING_PAY && $virtualModel->status == 2): ?>未付清已付金额: payment_amount ;?>未付金额: total_amount, $virtualModel->payment_amount);?>status == Order::STATUS_IN_SERVICE): ?> 调取当前流程节点的后台提示内容标题 status == Order::STATUS_BREAK_SERVICE): ?> 已取消 getStatusName(); ?>isRefund()): ?> refund_status == Order::REFUND_STATUS_APPLY):?> refund_status == Order::REFUND_STATUS_AUDITED): ?> 查看详情 status == Order::STATUS_PENDING_ALLOT && !$model->clerk_id): ?> status == Order::STATUS_PENDING_SERVICE): ?> status == Order::STATUS_IN_SERVICE): ?> 查看详情 status == Order::STATUS_COMPLETE_SERVICE || $model->status == Order::STATUS_BREAK_SERVICE): ?> 查看详情 跟进记录 status == Order::STATUS_PENDING_PAY): ?> 下次跟进时间:$pagination, 'options' => [ 'class' => 'pagination pull-right' ], ]); ?> ['order/change-customer-service', 'order_id' => '__order_id__'], 'id' => 'customer-service-form', 'layout' => 'horizontal', 'fieldConfig' => [ 'horizontalCssClasses' => [ 'label' => 'col-sm-3', 'offset' => 'col-sm-offset-3', 'wrapper' => 'col-sm-8', ], ], ]); ?>['order/change-clerk', 'order_id' => '__order_id__'], 'id' => 'clerk-form', 'layout' => 'horizontal', 'fieldConfig' => [ 'horizontalCssClasses' => [ 'label' => 'col-sm-3', 'offset' => 'col-sm-offset-3', 'wrapper' => 'col-sm-8', ], ], ]); ?>{name}{phone}';$changeClerkTemplate = '{name}{phone}{area}';$ajaxRefundInfoUrl = \yii\helpers\Url::to(['ajax-refund-info', 'id' => '__id__']);$ajaxChangeCustomerServiceInfoUrl = \yii\helpers\Url::to(['ajax-change-customer-service-info']);$ajaxClerkListUrl = \yii\helpers\Url::to(['clerk/ajax-list']);$startServiceUrl = Url::to(['order/ajax-start-service']);$paymentUrl = Url::to(['order/ajax-payment']);$cancelOrderUrl = Url::to(['order/ajax-cancel-order']);$districtPriceTemplate = '';$this->registerJs(<<< rs.model.length; i++) { var item = changeCustomerServiceTemplate.replace('{id}', rs.model[i].id).replace('{phone}', rs.model[i].phone).replace('{name}', rs.model[i].name); $('.change-customer-service-table table tbody').append(item); } } },'json'); }); //修改服务人员 $('.clerk-btn').click(function(){ //清空表格内容 $('.change-clerk-table table tbody').empty(); $('#clerk-form .modal-title').text('修改服务人员'); var changeClerkTemplate = '{ $changeClerkTemplate}'; var id = $(this).attr('data-id'); var product_id = $(this).attr('data-product-id'); var district_id = $(this).attr('data-district-id'); var form = $('#clerk-form'); form.attr('action', form.attr('action').replace('__order_id__', id)); //console.log('{ $ajaxClerkListUrl}'); $.get('{ $ajaxClerkListUrl}', { product_id: product_id,district_id: district_id}, function(rs){ if(rs.status==200){ for(var i = 0;i < rs.models.length; i++) { var item = changeClerkTemplate.replace('{id}', rs.models[i].id).replace('{phone}', rs.models[i].phone).replace('{name}', rs.models[i].name).replace('{area}', rs.models[i].areas); $('.change-clerk-table table tbody').append(item); form.trigger('reset.yiiActiveForm'); } } },'json'); }); //派单服务人员 $('.clerk-allot-btn').click(function(){ //清空表格内容 $('.change-clerk-table table tbody').empty(); $('#clerk-form .modal-title').text('派单给服务人员'); var changeClerkTemplate = '{ $changeClerkTemplate}'; var id = $(this).attr('data-id'); var form = $('#clerk-form'); form.attr('action', form.attr('action').replace('__order_id__', id)); $.post('',function(rs){ if(rs.status==200){ for(var i = 0;i < rs.models.length; i++) { var item = changeClerkTemplate.replace('{id}', rs.models[i].id).replace('{phone}', rs.models[i].phone).replace('{name}', rs.models[i].name).replace('{area}', rs.models[i].areas); $('.change-clerk-table table tbody').append(item); form.trigger('reset.yiiActiveForm'); } } },'json'); }); //开始服务 $('.start-service-btn').on('click', function(){ var id = $(this).attr('data-id'); var btn = $('#order-start-service-modal .sure-btn'); btn.unbind('click'); btn.click(function(){ $.post('{ $startServiceUrl}', { order_id: id}, function(rs){ if(rs.status == 200) { window.location.reload(); $('#order-start-service-modal').modal('hide'); } else { $('#order-start-service-modal .warning-active').text(rs.message); } }, 'json'); }); }); //确认付款 $('.sure-payment-btn').on('click', function(){ var id = $(this).attr('data-id'); var btn = $('#payment-modal .sure-btn'); btn.unbind('click'); btn.click(function(){ $.post('{ $paymentUrl}', { order_id: id}, function(rs){ if(rs.status == 200) { window.location.reload(); $('#payment-modal').modal('hide'); } else { $('#payment-modal .warning-active').text(rs.message); } }, 'json'); }); }); //取消订单 $('.cancel-order-btn').on('click', function(){ var id = $(this).attr('data-id'); var btn = $('#cancel-order-modal .sure-btn'); btn.unbind('click'); btn.click(function(){ $.post('{ $cancelOrderUrl}', { order_id: id}, function(rs){ if(rs.status == 200) { window.location.reload(); $('#cancel-order-modal').modal('hide'); } else { $('#cancel-order-modal .warning-active').text(rs.message); } }, 'json'); }); }); JS);?> registerJs(<<