invite.blade.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. @extends('user.layouts')
  2. @section('content')
  3. <div class="page-header">
  4. <h1 class="page-title cyan-600"><i class="icon wb-extension"></i>{{trans('home.invite_code')}}</h1>
  5. <div class="page-content container-fluid">
  6. <div class="alert alert-info" role="alert">
  7. <button class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  8. {!! trans('home.promote_invite_code', ['traffic' => $referral_traffic, 'referral_percent' => $referral_percent * 100]) !!}
  9. </div>
  10. <div class="row">
  11. <div class="col-xxl-3 col-lg-4">
  12. <div class="card">
  13. <div class="card-block">
  14. <h4 class="card-title cyan-600"><i class="icon wb-plus"></i> {{trans('home.invite_code_make')}}
  15. </h4>
  16. <p class="card-text alert alert-info">
  17. <i class="icon wb-warning red-700"></i> {{trans('home.invite_code_tips1')}}
  18. <strong> {{Auth::user()->invite_num}} </strong> {{trans('home.invite_code_tips2', ['days' => \App\Components\Helpers::systemConfig()['user_invite_days']])}}
  19. </p>
  20. <button type="button" class="btn btn-primary btn-animate btn-animate-side" onclick="makeInvite()" @if(!Auth::user()->invite_num) disabled @endif><i class="icon wb-plus"></i> {{trans('home.invite_code_button')}}
  21. </button>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="col-xxl-9 col-lg-8">
  26. <div class="card">
  27. <div class="card-block">
  28. <h4 class="card-title cyan-600"><i class="icon wb-extension"></i>{{trans('home.invite_code_my_codes')}}
  29. </h4>
  30. <div class="table-responsive">
  31. <table class="table text-center" data-mobile-responsive="true">
  32. <thead class="thead-default">
  33. <tr>
  34. <th data-cell-style="cellStyle"> #</th>
  35. <th> {{trans('home.invite_code_table_name')}} </th>
  36. <th> {{trans('home.invite_code_table_date')}} </th>
  37. <th> {{trans('home.invite_code_table_status')}} </th>
  38. <th> {{trans('home.invite_code_table_user')}} </th>
  39. </tr>
  40. </thead>
  41. <tbody>
  42. @if($inviteList->isEmpty())
  43. <tr>
  44. <td colspan="5">{{trans('home.invite_code_table_none_codes')}}</td>
  45. </tr>
  46. @else
  47. @foreach($inviteList as $invite)
  48. <tr>
  49. <td> {{$loop->iteration}} </td>
  50. <td>
  51. <a href="/register?aff={{Auth::user()->id}}&code={{$invite->code}}" target="_blank">{{$invite->code}}</a>
  52. </td>
  53. <td> {{$invite->dateline}} </td>
  54. <td>
  55. @if($invite->status == '0')
  56. <span class="badge badge-success">{{trans('home.invite_code_table_status_un')}}</span>
  57. @elseif($invite->status == '1')
  58. <span class="badge badge-danger">{{trans('home.invite_code_table_status_yes')}}</span>
  59. @else
  60. <span class="badge badge-default">{{trans('home.invite_code_table_status_expire')}}</span>
  61. @endif
  62. </td>
  63. @if($invite->status == '1')
  64. <td> {{empty($invite->user) ? ($invite->status == 1 ? '【账号已删除】' : '') : $invite->user->username}} </td>
  65. @else
  66. <td></td>
  67. @endif
  68. </tr>
  69. @endforeach
  70. @endif
  71. </tbody>
  72. </table>
  73. </div>
  74. <div class="row">
  75. <div class="col-md-4">
  76. {{trans('home.invite_code_summary', ['total' => $inviteList->total()])}}
  77. </div>
  78. <div class="col-md-8">
  79. <nav class="Page navigation float-right">
  80. {{ $inviteList->links() }}
  81. </nav>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. @endsection
  91. @section('script')
  92. <script type="text/javascript">
  93. // 生成邀请码
  94. function makeInvite() {
  95. var _token = '{{csrf_token()}}';
  96. $.ajax({
  97. type: "POST",
  98. url: "/makeInvite",
  99. async: false,
  100. data: {_token: _token},
  101. dataType: 'json',
  102. success: function (ret) {
  103. swal.fire({title: ret.message, timer: 1000})
  104. .then(() => {
  105. if (ret.status === 'success') {
  106. window.location.reload();
  107. }
  108. });
  109. }
  110. });
  111. return false;
  112. }
  113. </script>
  114. @endsection