index.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. use common\helpers\Url;
  3. use common\helpers\Html;
  4. use yii\helpers\ArrayHelper;
  5. use yii\widgets\LinkPager;
  6. use yii\widgets\ActiveForm;
  7. use kartik\daterange\DateRangePicker;
  8. use addons\Wechat\common\enums\QrcodeStatTypeEnum;
  9. $addon = <<< HTML
  10. <div class="input-group-append">
  11. <span class="input-group-text">
  12. <i class="fas fa-calendar-alt"></i>
  13. </span>
  14. </div>
  15. HTML;
  16. $this->title = '扫描统计';
  17. $this->params['breadcrumbs'][] = ['label' => $this->title];
  18. ?>
  19. <div class="row">
  20. <div class="col-sm-12">
  21. <div class="nav-tabs-custom">
  22. <ul class="nav nav-tabs">
  23. <li><a href="<?= Url::to(['qrcode/index'])?>"> 二维码管理</a></li>
  24. <li class="active"><a href="<?= Url::to(['index'])?>"> 扫描统计</a></li>
  25. </ul>
  26. <div class="tab-content">
  27. <div class="active tab-pane">
  28. <div class="row">
  29. <div class="col-sm-8">
  30. <?php $form = ActiveForm::begin([
  31. 'action' => Url::to(['index']),
  32. 'method' => 'get'
  33. ]); ?>
  34. <div class="row">
  35. <div class="col-sm-4">
  36. <div class="input-group drp-container">
  37. <?= DateRangePicker::widget([
  38. 'name' => 'queryDate',
  39. 'value' => $from_date . '-' . $to_date,
  40. 'readonly' => 'readonly',
  41. 'useWithAddon' => true,
  42. 'convertFormat' => true,
  43. 'startAttribute' => 'from_date',
  44. 'endAttribute' => 'to_date',
  45. 'startInputOptions' => ['value' => $from_date],
  46. 'endInputOptions' => ['value' => $to_date],
  47. 'pluginOptions' => [
  48. 'locale' => ['format' => 'Y-m-d'],
  49. ]
  50. ]) . $addon;?>
  51. </div>
  52. </div>
  53. <div class="col-sm-2">
  54. <?= Html::dropDownList('type', $type, ArrayHelper::merge(['' => '全部'], QrcodeStatTypeEnum::getMap()), ['class'=>'form-control']);?>
  55. </div>
  56. <div class="col-sm-3">
  57. <div class="input-group m-b">
  58. <?= Html::textInput('keyword', $keyword, [
  59. 'placeholder' => '场景名称',
  60. 'class' => 'form-control'
  61. ])?>
  62. <?= Html::tag('span', '<button class="btn btn-white"><i class="fa fa-search"></i> 搜索</button>', ['class' => 'input-group-btn'])?>
  63. </div>
  64. </div>
  65. </div>
  66. <?php ActiveForm::end(); ?>
  67. </div>
  68. <div class="col-sm-4">
  69. <div class="float-right">
  70. 关注扫描 <strong class="text-danger"><?= $attention_count ?></strong> 次 ;
  71. 已关注扫描 <strong class="text-danger"><?= $scan_count ?></strong> 次 ;
  72. 总计 <strong class="text-danger"><?= $pages->totalCount ?></strong> 次 ;
  73. <?= Html::a('导出Excel', ['export','from_date' => $from_date,'to_date' => $to_date,'type' => $type,'keyword' => $keyword])?>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="col-sm-12">
  78. <table class="table table-hover">
  79. <thead>
  80. <tr>
  81. <th>#</th>
  82. <th>昵称</th>
  83. <th>场景名称</th>
  84. <th>场景ID/场景值</th>
  85. <th>关注扫描</th>
  86. <th>当前关注状态</th>
  87. <th>openId</th>
  88. <th>扫描时间</th>
  89. <th>操作</th>
  90. </tr>
  91. </thead>
  92. <tbody>
  93. <?php foreach($models as $model){ ?>
  94. <tr>
  95. <td><?= $model->id ?></td>
  96. <td><?= isset($model->fans->nickname) ? $model->fans->nickname : ''; ?></td>
  97. <td><?= $model->name ?></td>
  98. <td><?= $model->scene_id ? $model->scene_id : $model->scene_str ;?></td>
  99. <td><?= QrcodeStatTypeEnum::getValue($model->type); ?></td>
  100. <td><?= isset($model->fans->follow) && $model->fans->follow == 1 ? '已关注': '取消关注'; ?></td>
  101. <td><?= $model->openid ?></td>
  102. <td><?= Yii::$app->formatter->asDatetime($model->created_at) ?></td>
  103. <td><?= Html::delete(['delete','id' => $model->id]); ?></td>
  104. </tr>
  105. <?php } ?>
  106. </tbody>
  107. </table>
  108. <div class="row">
  109. <div class="col-sm-12">
  110. <?= LinkPager::widget([
  111. 'pagination' => $pages,
  112. 'maxButtonCount' => 5,
  113. ]);?>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
粤ICP备19079148号