yii2 index.php页面,字段的显示

<?php

use yii\helpers\Html;
use yii\grid\GridView;
use kartik\select2\Select2;
use kartik\daterange\DateRangePicker;
use yii\bootstrap\Modal;
use app\modules\admin\models\RbacUserRole;

/* @var $this yii\web\View */
/* @var $searchModel app\modules\crm\models\CrmKaihuMainSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '开户信息';
$this->params['breadcrumbs'][] = $this->title;
$c = Yii::$app->controller->id;
$arr = RbacUserRole::getSfields($permissionIds);
$scenarios = \app\modules\crm\models\CrmKaihuExt::SCENARIO_SALESMAN;
$this->registerJsFile(CDN_URL .'/sources/crm/js/laydate.js', ['position' => \yii\web\View::POS_HEAD, 'depends' => 'app\assets\AdminAsset']);
$this->registerJsFile(CDN_URL .'/sources/crm/js/salesman.js', ['position' => \yii\web\View::POS_HEAD, 'depends' => 'app\assets\AdminAsset']);
$this->registerCssFile(CDN_URL . '/sources/crm/css/laydate.css',['position' => \yii\web\View::POS_END,'depends' => 'app\assets\AdminAsset']);
?>
<div class="crm-kaihu-main-index">
<div class="nav_box">
<div class="nav_left">
<?php
if($smale == $scenarios){
echo Html::a('添加一条', ['create'], ['class' => 'btn btn-success']);
}
?>
</div>
<div class="nav_right">
&nbsp;到款开始时间 &nbsp;<input type="text" id="start">
&nbsp; 到款结束时间 &nbsp; <input type="text" id="end">
&nbsp; 业务代表 &nbsp; <input type="text" id="sou">
<a id="daochu" href="javascript: void(0);" class="btn btn-success">导出当前列表</a>
</div>
<div class="cl"></div>
</div>

<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'attribute' => 'id',
'headerOptions' => ['width'=>'4%'], // 显示html key=>value属性
],
[
'attribute' => 'username',
'label' => '业务代表',
'headerOptions' => ['width'=>'8%'],
'value' => 'adminuser.username',
'filter' => Select2::widget([
'name' => 'CrmKaihuMainSearch[admin_id]',
'value' => isset($_GET['CrmKaihuMainSearch']['admin_id']) ? $_GET['CrmKaihuMainSearch']['admin_id'] : '',
'data' => app\modules\admin\models\AdminUser::getAdminNameIdMap($allAdminList),
'options' => ['placeholder' => '请选择...'],
'pluginOptions' => [
'allowClear' => true
],
]),
'visible' =>isset( $arr['admin_id']) ? true:false,
],
[
'attribute' => 'pay_time',
'filter' => false,
'content'=>function($model){
if($model->pay_time){
return date("Y-m-d",$model->pay_time);
}
},
'headerOptions' => ['width'=>'6%'], // 显示html key=>value属性
'format' => ['date', 'php:Y-m-d'],
'visible' => isset($arr['pay_time']) ? true:false,
'filter' => DateRangePicker::widget([
'name' => 'CrmKaihuMainSearch[pay_time]',
'value' => isset(Yii::$app->request->get('CrmKaihuMainSearch')['pay_time']) ? Yii::$app->request->get('CrmKaihuMainSearch')['pay_time'] : '',
'convertFormat'=>true,
'pluginOptions'=>[
'timePickerIncrement'=>5,
'singleDatePicker'=>true,
'locale'=>[
'format'=>'Y-m-d H:i',
]
]
]),
'visible' =>isset( $arr['pay_time']) ? true:false,
],
[
'attribute' => 'platform_name',
'value' => 'platform.platform_name',
'headerOptions' => ['width'=>'8%'],
'label' => '平台',
'filter' => Select2::widget([
'name' => 'CrmKaihuMainSearch[platform_name]',
'value' => isset($_GET['CrmKaihuMainSearch']['platform_name']) ? $_GET['CrmKaihuMainSearch']['platform_name'] : '',
'data' => \app\modules\crm\models\CrmPlatform::getPlatformNameMap(),
'options' => ['multiple' => false, 'placeholder' => '请选择平台'],
'pluginOptions' => [
'allowClear' => true
],
]),
'visible' =>isset($arr['platform_name']) ? true:false,
],
[
'label'=>'客户公司',
'attribute' => 'customer',
'value' => 'customer.customer',
'headerOptions' => ['width'=>'5%'],
'visible' => isset($arr['customer']) ? true:false,
'filter' => Select2::widget([
'name' => 'CrmKaihuMainSearch[customer]',
'value' => isset($_GET['CrmKaihuMainSearch']['customer']) ? $_GET['CrmKaihuMainSearch']['customer'] : '',
'data' => \app\modules\crm\models\CrmCustomer::getCustomerNameMap(),
'options' => ['multiple' => false, 'placeholder' => '请选择公司名字'],
'pluginOptions' => [
'allowClear' => true
],
]),
],
[
'label'=>'二级行业',
'attribute' => 'sub_industry',
'filter' => false,
'value' => 'customer.sub_industry' ,
'headerOptions' => ['width'=>'8%'],
'visible' => isset($arr['sub_industry']) ? true:false,
],
[
'label'=>'到款账户',
'attribute' => 'money_account',
'value' => 'bank.money_account',
'headerOptions' => ['width'=>'5%'],
'visible' => isset($arr['money_bank']) ? true:false,
'filter' => Select2::widget([
'name' => 'CrmKaihuMainSearch[money_account]',
'value' => isset($_GET['CrmKaihuMainSearch']['money_account']) ? $_GET['CrmKaihuMainSearch']['money_account'] : '',
'data' => \app\modules\crm\models\CrmBank::getBankNameMap(),
'options' => ['multiple' => false, 'placeholder' => '请选择到款账户'],
'pluginOptions' => [
'allowClear' => true
],
]),
],
[
'attribute' => 'total_money',
'headerOptions' => ['width'=>'6%'],
'filter' => false,
'visible' => isset($arr['total_money']) ? true:false,
],

[
'attribute' => 'kaihu_rebate',
'filter' => false,
'label'=>'返点',
'headerOptions' => ['width'=>'50'], // 显示html key=>value属性
'visible' => isset($arr['kaihu_rebate']) ? true:false,
],

[
'attribute' => 'renewal_rebate',
'filter' => false,
'label' =>'续费承诺返点',
'value' => 'ext.renewal_rebate',
'headerOptions' => ['width'=>'5%'], // 显示html key=>value属性
'visible' =>isset( $arr['renewal_rebate']) ? true:false,
],
[
'label'=>'运营',
'attribute' => 'operator',
'value' => 'ext.operator',
'headerOptions' => ['width'=>'8%'],
'filter' => Select2::widget([
'name' => 'CrmKaihuMainSearch[operator]',
'value' => isset($_GET['CrmKaihuMainSearch']['operator']) ? $_GET['CrmKaihuMainSearch']['operator'] : '',
'data' => \app\modules\admin\models\AdminUser::getAdminNameMap(),
'options' => ['multiple' => false, 'placeholder' => '运营'],
'pluginOptions' => [
'allowClear' => true
],
]),
'visible' =>isset( $arr['operator']) ? true:false,
],
[
'attribute' => 'effect_feedback',
'filter' => false,
'headerOptions' => ['width'=>'15%'], // 显示html key=>value属性
'visible' =>isset( $arr['effect_feedback']) ? true:false,
],

[
'label'=>'转换反馈',
'attribute' => 'transfer_feedback',
'value' => 'ext.transfer_feedback',
'filter' => false,
'headerOptions' => ['width'=>'15%'],
'visible' =>isset( $arr['transfer_feedback']) ? true:false,
],

[
'label'=>'跟踪回复',
'attribute' => 'director_feedback',
'value' => 'ext.director_feedback',
'filter' => false,
'headerOptions' => ['width'=>'15%'],
'visible' =>isset( $arr['director_feedback']) ? true:false,
],
[
'label'=>'打款账户',
'attribute' => 'who_pay',
'headerOptions' => ['width'=>'8%'],
'visible' =>isset( $arr['who_pay']) ? true:false,
],
[
'label'=>'链接',
'attribute' => 'ad_link',
'headerOptions' => ['width'=>'8%'],
'visible' => isset($arr['ad_link']) ? true:false,
],

[
'label'=>'充值金额',
'attribute' => 'confirm_reveive_money',
'value' => 'ext.confirm_reveive_money',
'headerOptions' => ['width'=>'8%'],
'visible' => isset($arr['confirm_reveive_money']) ? true:false,
],
[
'attribute' => 'leader_name',
'filter' => false,
'label'=>'直属上级',
'headerOptions' => ['width'=>'50'], // 显示html key=>value属性
'value' => 'adminuser.leader_name',
'visible' => isset($arr['leader_id']) ? true:false,
],
[
'attribute' => 'name',
'label' => '部门',
'headerOptions' => ['width'=>'8%'],
'value'=>'department.name',
'filter' => Select2::widget([
'name' => 'CrmKaihuMainSearch[department_id]',
'value' => isset($_GET['CrmKaihuMainSearch']['department_id']) ? $_GET['CrmKaihuMainSearch']['department_id'] : '',
'data' => app\modules\crm\models\CrmDepartment::getDepartmentNameMap(),
'options' => ['placeholder' => '请选择...'],
'pluginOptions' => [
'allowClear' => true
],
]),
'visible' =>isset( $arr['department_id']) ? true:false,
],

[
'label'=>'管理员备注',
'attribute' => 'admin_notes',
'value' => 'ext.admin_notes',
'filter' => false,
'headerOptions' => ['width'=>'15%'],
'visible' =>isset( $arr['admin_notes']) ? true:false,
],

[
'label'=>'预充值欠款',
'attribute' => 'precharge_debt',
'value' => 'ext.precharge_debt',
'filter' => false,
'headerOptions' => ['width'=>'5%'],
'visible' =>isset( $arr['precharge_debt']) ? true:false,
],

[
'attribute' => 'is_cashback',
'label' => '是否返现',
'headerOptions' => ['width'=>'5%'],
'content' => function($model){
if ($model->is_cashback == app\modules\crm\models\CrmKaihuMain::CASHBACK_ON) {
return '<span class="label label-default">'.app\modules\crm\models\CrmKaihuMain::getConstValue('is_cashback', $model->is_cashback).'</span>';
} else if ($model->is_cashback == app\modules\crm\models\CrmKaihuMain::CASHBACK_OFF) {
return '<span class="label label-success">'.app\modules\crm\models\CrmKaihuMain::getConstValue('is_cashback', $model->is_cashback).'</span>';
}
},
//如果是数组就会变成下拉列表
'filter' => \app\modules\crm\models\CrmKaihuMain::getConstValue('is_cashback'),
'visible' =>isset( $arr['is_cashback']) ? true:false,
],
[
'attribute' => 'cashback_amount',
'headerOptions' => ['width'=>'5%'],
'visible' => isset($arr['cashback_amount']) ? true:false,
],
[
'attribute' => 'ctime',
'header' => '日期',
'headerOptions' => ['width'=>'10%'], // 显示html key=>value属性
'format' => ['date', 'php:Y-m-d'],
'filter' => DateRangePicker::widget([
'name' => 'CrmKaihuMainSearch[ctime]',
'value' => isset(Yii::$app->request->get('CrmKaihuMainSearch')['ctime']) ? Yii::$app->request->get('CrmKaihuMainSearch')['ctime'] : '',
'convertFormat' => true,
'pluginOptions' => [
'locale' => [
'format' => 'Y-m-d',
'separator' => '/',
]
]
]),
],
[
'attribute' => 'is_precharge',
'label' => '预充值',
'content' => function($model){
if ($model->ext && $model->ext->is_precharge == app\modules\crm\models\CrmKaihuExt::PRECHARGE_ON) {
return '<span class="label label-default">'.app\modules\crm\models\CrmKaihuExt::getConstValue('is_precharge', $model->ext->is_precharge).'</span>';
} else if ($model->ext &&$model->ext->is_precharge == app\modules\crm\models\CrmKaihuExt::PRECHARGE_OFF) {
return '<span class="label label-success">'.app\modules\crm\models\CrmKaihuExt::getConstValue('is_precharge', $model->ext->is_precharge).'</span>';
}
},
//如果是数组就会变成下拉列表
'filter' => \app\modules\crm\models\CrmKaihuExt::getConstValue('is_precharge'),
'visible' =>isset( $arr['is_precharge']) ? true:false,
],
[
'attribute' => 'expiry_time',
'label'=> '是否到期',
'content' => function($model){
if ($model->ext && $model->ext->expiry_time <= time() && $model->ext->expiry_time) {
return "<div style='text-align: center'><span style='color: red'><strong>已到期</strong></span></div>";
} else if ($model->ext && $model->ext->expiry_time > time()) {
return "<div style='text-align: center'><span style='color: green'><strong>正常</strong></span></div>";
}else{
return "<div style='text-align: center'><span style='color: green'><strong>正常</strong></span></div>";
}
},
'visible' =>isset( $arr['expiry_time']) ? true:false,
'headerOptions' => ['width'=>'5%'],
//如果是数组就会变成下拉列表
'filter' => \app\modules\crm\models\CrmKaihuExt::getConstValue('expiry_time'),
'visible' =>isset( $arr['expiry_time']) ? true:false,
],
['class' => 'yii\grid\ActionColumn',
'header' => '操作',
'template' => '{update} {delete} {allotPers}{feedback}{expiry}{transfer_feedback}{admin_notes}{caiwu}{precharge}{contract}{liucheng}',
'buttons' => [
'allotPers' => function($url, $model, $key) use($is_sent_id,$isRootUser){
if(!in_array($model->id,$is_sent_id) || $isRootUser){
return Html::a('发送',$url = null,['class' => 'btn btn-xs btn-success list_send_btn']);
}else{
return null;

}
},
'feedback' => function($url, $model, $key) use ($buttons) {
if(in_array('reg:/^\/crm\/crmkaihumain\/(setfeedback|setfeedbackhtml)$/',$buttons) && !$model->effect_feedback){
return '<a href="javascript:void(0);" onclick="Setfeedbackhtml('.$model->id.')" data-toggle="modal"
data-target="#edit-modal" class="btn btn-xs btn-primary" style="display:block;margin: 10px 0;">效果反馈</a>';
}else{
return null;
}
},
'expiry' => function($url, $model, $key) use ($buttons){
if(in_array("reg:/^\/crm\/crmkaihumain\/(setexpritytime|exprity)$/",$buttons)){
return '<a href="javascript:void(0);" onclick="Setexpiryhtml('.$model->id.')" data-toggle="modal"
data-target="#expiry-modal" class="btn btn-xs btn-primary" style="display:block;margin: 10px 0;">设置延迟过期</a>';
}else{
return null;
}
},
'transfer_feedback' => function($url, $model, $key) use ($buttons){
if(in_array("reg:/^\/crm\/crmkaihumain\/(settransferfeedback|transferfeedbackhtml)$/",$buttons) && $model->ext->expiry_time && $model->ext->expiry_time>time() && !$model->ext->transfer_feedback){
return '<a href="javascript:void(0);" onclick="Settransferhtml(' . $model->id . ')" data-toggle="modal"
data-target="#transfer-modal" class="btn btn-xs btn-primary" style="display:block;margin: 10px 0;">转化反馈</a>';
}else{
return null;
}
},
'admin_notes' => function($url, $model, $key) use ($buttons){
if(in_array("reg:/^\/crm\/crmkaihumain\/(setadminnotes|setadminnoteshtml)$/",$buttons) && $model->ext && !$model->ext->admin_notes){
return '<a href="javascript:void(0);" onclick="Setadminnoteshtml(' . $model->id . ')" data-toggle="modal"
data-target="#admin-modal" class="btn btn-xs btn-primary" style="display:block;margin: 10px 0;">管理员备注</a>';
}else{
return null;
}
},
'caiwu' => function($url, $model, $key) use ($buttons){
if(in_array("reg:/^\/crm\/crmkaihumain\/(setcaiwu|caiwuhtml)$/",$buttons)){
return '<a href="javascript:void(0);" onclick="Setcaiwuhtml('.$model->id.')" data-toggle="modal"
data-target="#caiwu-modal" class="btn btn-xs btn-primary" style="display:block;margin: 10px 0;">财务填写</a>';
}else{
return null;
}
},
'precharge' => function($url, $model, $key) use ($buttons){
if($model->ext && in_array("reg:/^\/crm\/crmkaihumain\/(prechargehtml|setprecharge)$/",$buttons) && $model->ext->is_precharge== \app\modules\crm\models\CrmKaihuExt::PRECHARGE_ON){
return '<a href="javascript:void(0);" onclick="Setprechargehtml('.$model->id.')" data-toggle="modal"
data-target="#precharge-modal" class="btn btn-xs btn-primary" style="display:block;margin: 10px 0;">充值情况</a>';
}else{
return null;
}
},
'contract' => function($url, $model, $key) use ($buttons){
if(in_array("reg:/^\/crm\/crmkaihumain\/(contract|setcontract)$/",$buttons) && !$model->ext->contract && $model->ext->is_precharge == \app\modules\crm\models\CrmKaihuExt::PRECHARGE_ON){
return '<a href="javascript:void(0);" onclick="Setcontracthtml('.$model->id.')" data-toggle="modal"
data-target="#contract-modal" class="btn btn-xs btn-primary" style="display:block;margin: 10px 0;">合同图片</a>';
}else{
return null;
}
},
'liucheng' => function($url, $model, $key){
return '<a href="javascript:void(0);" onclick="Setliucheng('.$model->id.')" data-toggle="modal"
data-target="#liucheng-modal" class="btn btn-xs btn-primary" style="display:block;margin: 10px 0;">流程</a>';
}
],
'headerOptions' => ['width' => '8%']
],

],
]); ?>
</div>
<input type="hidden" scenarioss ="<?php echo $scenarios;?>" id="scenarios">
<div class="send_box">
<div class="send_title">发送</div>
<div class="send_close_btn">×</div>
<div class="send_box_row">
<div class="send_box_label">
<label for="CrmKaihuExt[admin_id]">收件人</label>
</div>
<div class="send_box_select">
<?= Select2::widget([
'name' => 'CrmKaihuExt[admin_id]',
'value' => '',
'data' => app\modules\crm\models\CrmKaihuExt::getAdminPositionMap($allAdminList),
'options' => [ 'placeholder' => '请选择发送人'],
'pluginOptions' => [
'allowClear' => true,
'multiple' => true,
],
]);?>
</div>
<div class="send_box_btn">
<div class="btn btn-success send_btn">发送</div>
</div>
</div>
</div>

<!--效果反馈-->
<?php
Modal::begin([
'id' => 'edit-modal',
'header' => '<h4 class="modal-title"></h4>',
//'footer' => '<a href="#" class="btn btn-primary">确定</a><a href="#" class="btn btn-default" data-dismiss="modal">关闭</a>',
'options' => [
'tabindex' => false
],
]);
$requestUrl = \yii\helpers\Url::toRoute($c.'/setfeedbackhtml');
Modal::end();
?>

<!--设置过期时间-->
<?php
Modal::begin([
'id' => 'expiry-modal',
'header' => '<h4 class="modal-title"></h4>',
// 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
]);
$requestUrl1 = \yii\helpers\Url::toRoute($c.'/exprity');
Modal::end();
?>

<!--销售转化反馈-->
<?php
Modal::begin([
'id' => 'transfer-modal',
'header' => '<h4 class="modal-title"></h4>',
// 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
]);
$requestUrl3 = \yii\helpers\Url::toRoute($c.'/transferfeedbackhtml');
Modal::end();
?>
<!--财务-->
<?php
Modal::begin([
'id' => 'caiwu-modal',
'header' => '<h4 class="modal-title"></h4>',
// 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
]);
$requestUrl4 = \yii\helpers\Url::toRoute($c.'/caiwuhtml');
Modal::end();
?>
<!--管理员备注-->
<?php
Modal::begin([
'id' => 'admin-modal',
'header' => '<h4 class="modal-title"></h4>',
// 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
]);
$requestUrl5 = \yii\helpers\Url::toRoute($c.'/setadminnoteshtml');
Modal::end();
?>

<!--充值情况-->
<?php
Modal::begin([
'id' => 'precharge-modal',
'header' => '<h4 class="modal-title"></h4>',
// 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
]);
$requestUrl6 = \yii\helpers\Url::toRoute($c.'/prechargehtml');
Modal::end();
?>

<!--合同-->
<?php
Modal::begin([
'id' => 'contract-modal',
'header' => '<h4 class="modal-title"></h4>',
// 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
]);
$requestUrl7 = \yii\helpers\Url::toRoute($c.'/contract');
Modal::end();
?>

<!--流程-->
<?php
Modal::begin([
'id' => 'liucheng-modal',
'header' => '<h4 class="modal-title"></h4>',
// 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
]);
$requestUrl8 = \yii\helpers\Url::toRoute($c.'/liucheng');
Modal::end();
?>

posted @ 2018-08-13 11:22  坚持!!  阅读(791)  评论(0编辑  收藏  举报