index.php 4.6 KB

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