index.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. use yii\data\ArrayDataProvider;
  9. /* @var $this yii\web\View */
  10. /* @var $searchModel app\models\OrderreturnSearch */
  11. /* @var $dataProvider yii\data\ActiveDataProvider */
  12. $this->title = 'Orderreturns';
  13. $this->params['breadcrumbs'][] = $this->title;
  14. ?>
  15. <div style="display:inline-block;">
  16. <?php
  17. echo Nav::widget([
  18. 'options' => ['class' => 'navbar-nav navbar-left'],
  19. 'items' => [
  20. ['label' => '美国仓', 'url' => ['/site/index','shop'=>1]],
  21. ['label' => '亚马逊', 'url' => ['/site/index','shop'=>2]],
  22. ],
  23. ]);
  24. ?>
  25. </div>
  26. <div class="orderreturn-index">
  27. <h1><?php echo $shop==1?"美国仓":"亚马逊"; ?></h1><br/>
  28. <p class="order—create">
  29. <?= Html::a('统计数据', ['statis','shop'=>$shop], ['class' => 'btn btn-info ']) ?>
  30. <?= Html::a('创建', ['create'], ['class' => 'btn btn-success ']) ?>
  31. </p>
  32. <p>
  33. <?php
  34. $model=new app\models\UploadExcel();
  35. $form=ActiveForm::begin([
  36. 'id' => 'upload-excel',
  37. 'action'=>'/site/import?shop='.$shop,
  38. 'method'=>'post',
  39. 'options'=>[
  40. "class"=>"upload-excel",
  41. 'enctype'=>'multipart/form-data',
  42. ]
  43. ]);
  44. ?>
  45. <?= Html::activeFileInput($model, 'excel', $options = []) ?>
  46. <?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>
  47. <?php ActiveForm::end() ?>
  48. </p>
  49. <br/>
  50. <?php echo $this->render('_search', ['model' => $searchModel]); ?>
  51. <?= GridView::widget([
  52. 'dataProvider' => $dataProvider,
  53. 'showFooter' => true,
  54. // 'filterModel' => $searchModel,
  55. 'id' => 'grid',
  56. 'columns' => [
  57. [
  58. 'class'=>CheckboxColumn::className(),
  59. 'name'=>'id',
  60. 'headerOptions' => ['width'=>'30'],
  61. 'footer' => '<button href="#" class="btn btn-default btn-xs btn-delete" url="'. Url::toRoute('site/delete-all') .'">批量删除</button>',
  62. 'footerOptions' => ['colspan' => 5],
  63. ],
  64. ['attribute' => 'id', 'footerOptions' => ['class'=>'hide']],
  65. ['attribute' => 'deliveryid', 'footerOptions' => ['class'=>'hide']],
  66. ['attribute' => 'website', 'footerOptions' => ['class'=>'hide']],
  67. ['attribute' => 'customer', 'footerOptions' => ['class'=>'hide']],
  68. [
  69. 'attribute' => 'delivery',
  70. 'footerOptions' => ['class'=>'hide'],
  71. 'value'=>function($model){// 形参为此行记录对象
  72. $list=['1' =>'USPS','2'=>'UPS','3'=>'FedEx','4'=>'客人到店退货','5'=>'DHL' ];
  73. if(isset($list[$model->delivery])){
  74. return $list[$model->delivery];
  75. }
  76. return $model->delivery;
  77. }
  78. ],
  79. ['attribute' => 'origin_goodsinfo', 'footerOptions' => ['class'=>'hide']],
  80. ['attribute' => 'goodsinfo', 'footerOptions' => ['class'=>'hide']],
  81. [
  82. 'attribute' => 'usage',
  83. 'footerOptions' => ['class'=>'hide'],
  84. 'value'=>function($model){// 形参为此行记录对象
  85. $list=['1' => "可用-请加库存",'2'=>'不可用-退回工厂','3'=>'精打理-退回国内','4'=>'精打理-留美仓','5'=>'泡发-发回国内'];
  86. if(isset($list[$model->usage])){
  87. return $list[$model->usage];
  88. }
  89. return $model->usage;
  90. }
  91. ],
  92. ['attribute' => 'receiptdate', 'footerOptions' => ['class'=>'hide']],
  93. ['attribute' => 'num', 'footerOptions' => ['class'=>'hide']],
  94. ['attribute' => 'mark', 'footerOptions' => ['class'=>'hide']],
  95. ['class' => 'yii\grid\ActionColumn', 'header' => '管理操作', 'footerOptions' => ['class'=>'hide']],
  96. // ['class' => 'yii\grid\ActionColumn'],
  97. ],
  98. ]); ?>
  99. </div>
  100. <?php
  101. $script = <<< js
  102. $(".btn-delete").on("click", function(){
  103. var ids = $("#grid").yiiGridView("getSelectedRows");
  104. var self = $(this);
  105. if(ids.length == 0) return false;
  106. $.ajax({
  107. url:self.attr("url"),
  108. type:"post",
  109. data:{id:ids},
  110. success:function(res){
  111. }
  112. });
  113. });
  114. js;
  115. $this->registerJs($script);
  116. ?>