index.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\grid\GridView;
  4. use yii\widgets\ActiveForm;
  5. use yii\bootstrap\Nav;
  6. use yii\grid\CheckboxColumn;
  7. use yii\helpers\Url;
  8. /* @var $this yii\web\View */
  9. /* @var $searchModel app\models\OrderreturnSearch */
  10. /* @var $dataProvider yii\data\ActiveDataProvider */
  11. $this->title = 'Orderreturns';
  12. $this->params['breadcrumbs'][] = $this->title;
  13. ?>
  14. <div style="display:inline-block;">
  15. <?php
  16. echo Nav::widget([
  17. 'options' => ['class' => 'navbar-nav navbar-left'],
  18. 'items' => [
  19. ['label' => '美国仓', 'url' => ['/site/index','shop'=>1]],
  20. ['label' => '亚马逊', 'url' => ['/site/index','shop'=>2]],
  21. ],
  22. ]);
  23. ?>
  24. </div>
  25. <div class="orderreturn-index">
  26. <h1><?php echo $shop==1?"美国仓":"亚马逊"; ?></h1>
  27. <p class="order—create">
  28. <?= Html::a('创建', ['create'], ['class' => 'btn btn-success ']) ?>
  29. </p>
  30. <p>
  31. <?php
  32. $model=new app\models\UploadExcel();
  33. $form=ActiveForm::begin([
  34. 'id' => 'upload-excel',
  35. 'action'=>'/site/export?shop='.$shop,
  36. 'method'=>'post',
  37. 'options'=>[
  38. "class"=>"upload-excel",
  39. 'enctype'=>'multipart/form-data',
  40. ]
  41. ]);
  42. ?>
  43. <?= Html::activeFileInput($model, 'excel', $options = []) ?>
  44. <?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>
  45. <?php ActiveForm::end() ?>
  46. </p>
  47. <?php echo $this->render('_search', ['model' => $searchModel]); ?>
  48. <?= GridView::widget([
  49. 'dataProvider' => $dataProvider,
  50. 'showFooter' => true,
  51. // 'filterModel' => $searchModel,
  52. 'id' => 'grid',
  53. 'columns' => [
  54. [
  55. 'class'=>CheckboxColumn::className(),
  56. 'name'=>'id',
  57. 'headerOptions' => ['width'=>'30'],
  58. 'footer' => '<button href="#" class="btn btn-default btn-xs btn-delete" url="'. Url::toRoute('site/delete-all') .'">批量删除</button>',
  59. 'footerOptions' => ['colspan' => 5],
  60. ],
  61. 'id',
  62. 'deliveryid',
  63. 'website',
  64. 'customer',
  65. 'delivery',
  66. 'origin_goodsinfo',
  67. 'goodsinfo',
  68. 'usage',
  69. 'receiptdate',
  70. 'num',
  71. 'mark',
  72. ['class' => 'yii\grid\ActionColumn', 'header' => '管理操作', 'footerOptions' => ['class'=>'hide']],
  73. // ['class' => 'yii\grid\ActionColumn'],
  74. ],
  75. ]); ?>
  76. </div>
  77. <?php
  78. $script = <<< js
  79. $(".btn-delete").on("click", function(){
  80. var ids = $("#grid").yiiGridView("getSelectedRows");
  81. var self = $(this);
  82. if(ids.length == 0) return false;
  83. $.ajax({
  84. url:self.attr("url"),
  85. type:"post",
  86. data:{id:ids},
  87. success:function(res){
  88. }
  89. });
  90. });
  91. js;
  92. $this->registerJs($script);
  93. ?>