edit.blade.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. @extends('admin/public/layout')
  2. @section('css')
  3. <link href="{{ asset('/static/js/summernote/summernote.css')}}" rel="stylesheet">
  4. @endsection
  5. @section('title')编辑商品@endsection
  6. @section('content')
  7. <section class="content-header">
  8. <h1>
  9. 编辑商品
  10. </h1>
  11. </section>
  12. <section class="content">
  13. <div class="row">
  14. <div class="col-xs-12">
  15. <div class="box box-primary">
  16. <form role="form" name="editForm" method="POST" enctype="multipart/form-data" action="{{ route('admin.goods.update',['id'=>$goods->id]) }}">
  17. <input name="_method" type="hidden" value="PUT">
  18. <input type="hidden" name="_token" value="{{ csrf_token() }}">
  19. <div class="box-body">
  20. <div class="form-group">
  21. <label>是否需要邮寄</label>
  22. <span class="text-muted">(虚拟物品不用邮寄例。如:手机充值等)</span>
  23. <div class="radio">
  24. <label>
  25. <input type="radio" name="post_type" value="1" @if($goods->post_type === 1 ) checked @endif /> 是
  26. </label>&nbsp;&nbsp;
  27. <label>
  28. <input type="radio" name="post_type" value="0" @if($goods->post_type === 0 ) checked @endif /> 否
  29. </label>
  30. </div>
  31. </div>
  32. <div class="form-group @if($errors->has('name')) has-error @endif">
  33. <label>商品名称</label>
  34. <input type="text" name="name" class="form-control " placeholder="商品名称" value="{{ old('name',$goods->name) }}">
  35. @if($errors->has('name')) <p class="help-block">{{ $errors->first('name') }}</p> @endif
  36. </div>
  37. <div class="form-group">
  38. <label>分类</label>
  39. <select name="category_id" class="form-control">
  40. <option value="0">选择分类</option>
  41. @include('admin.category.option',['type'=>'goods','select_id'=>$goods->category_id])
  42. </select>
  43. </div>
  44. <div class="form-group">
  45. <label>logo图片</label>
  46. <input type="file" name="logo" />
  47. @if($goods->logo)
  48. <div style="margin-top: 10px;">
  49. <img src="{{ route('website.image.show',['image_name'=>$goods->logo]) }}" />
  50. </div>
  51. @endif
  52. </div>
  53. <div class="form-group @if($errors->has('remnants')) has-error @endif">
  54. <label>商品总数量</label>
  55. <input type="text" name="remnants" class="form-control " placeholder="商品总数量" value="{{ old('remnants',$goods->remnants) }}">
  56. @if($errors->has('remnants')) <p class="help-block">{{ $errors->first('remnants') }}</p> @endif
  57. </div>
  58. <div class="form-group @if($errors->has('coins')) has-error @endif">
  59. <label>商品价格(消耗的金币数)</label>
  60. <input type="text" name="coins" class="form-control " placeholder="消耗的金币数" value="{{ old('coins',$goods->coins) }}">
  61. @if($errors->has('coins')) <p class="help-block">{{ $errors->first('coins') }}</p> @endif
  62. </div>
  63. {{--<div class="form-group @if($errors->has('description')) has-error @endif">--}}
  64. {{--<label>商品详情</label>--}}
  65. {{--<textarea name="description" class="form-control" placeholder="话题简介" style="height: 80px;">{{ old('description',$goods->description) }}</textarea>--}}
  66. {{--@if($errors->has('description')) <p class="help-block">{{ $errors->first('description') }}</p> @endif--}}
  67. {{--</div>--}}
  68. <div class="form-group @if ($errors->has('description')) has-error @endif">
  69. <label for="name">商品详情</label>
  70. <div id="description_editor">{!! old('description',$goods->description) !!}</div>
  71. @if ($errors->has('description')) <p class="help-block">{{ $errors->first('description') }}</p> @endif
  72. </div>
  73. <div class="form-group">
  74. <label>状态</label>
  75. <span class="text-muted">(禁用后前台不会显示)</span>
  76. <div class="radio">
  77. <label>
  78. <input type="radio" name="status" value="1" @if($goods->status === 1) checked @endif /> 启用
  79. </label>&nbsp;&nbsp;
  80. <label>
  81. <input type="radio" name="status" value="0" @if($goods->status === 0 ) checked @endif /> 禁用
  82. </label>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="box-footer">
  87. <input type="hidden" id="description_editor_content" name="description" value="{{ old('description',$goods->description) }}" />
  88. <button type="submit" class="btn btn-primary">保存</button>
  89. <button type="reset" class="btn btn-success">重置</button>
  90. </div>
  91. </form>
  92. </div>
  93. </div>
  94. </div>
  95. </section>
  96. @endsection
  97. @section('script')
  98. <script src="{{ asset('/static/js/summernote/summernote.min.js') }}"></script>
  99. <script src="{{ asset('/static/js/summernote/lang/summernote-zh-CN.min.js') }}"></script>
  100. <script type="text/javascript">
  101. $(function(){
  102. set_active_menu('manage_content',"{{ route('admin.goods.index') }}");
  103. $('#description_editor').summernote({
  104. lang: 'zh-CN',
  105. height: 300,
  106. placeholder:'完善话题详情',
  107. toolbar: [ {!! config('tipask.summernote.blog') !!} ],
  108. callbacks: {
  109. onChange:function (contents, $editable) {
  110. var code = $(this).summernote("code");
  111. $("#description_editor_content").val(code);
  112. },
  113. onImageUpload: function(files) {
  114. upload_editor_image(files[0],'description_editor');
  115. }
  116. }
  117. });
  118. });
  119. </script>
  120. @endsection