Bez popisu

create.blade.php 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. @extends('admin/master')
  2. @section('content')
  3. <body>
  4. @if(count($errors) > 0)
  5. <div class="Huialert Huialert-info" id="error">
  6. @foreach($errors->all() as $error)
  7. <li>{{$error}}</li>
  8. @endforeach
  9. </div>
  10. @endif
  11. <div class="page-container">
  12. <form action="/admin/goods/store" method="post" class="form form-horizontal" enctype="multipart/form-data">
  13. <input type="hidden" name="_token" value="{{ csrf_token() }}" />
  14. <div class="row cl">
  15. <label class="form-label col-xs-4 col-sm-2">
  16. 商品标题:</label>
  17. <div class="formControls col-xs-6 col-sm-6">
  18. <input type="text" class="input-text" value="{{old('name')}}" placeholder="" name="name">
  19. </div>
  20. </div>
  21. <div class="row cl">
  22. <label class="form-label col-xs-4 col-sm-2">
  23. 商品分类:</label>
  24. <div class="formControls col-xs-6 col-sm-6">
  25. <span class="select-box">
  26. <select size="1" name="goodsCategoryName">
  27. <option value="0" @if(old('goodsCategoryName')=='') selected @endif>选择分类</option>
  28. @foreach($cates as $v)
  29. <option value="{{$v}}" @if(old('goodsCategoryName')==$v) selected @endif>{{$v}}</option>
  30. @endforeach
  31. </select>
  32. &nbsp;&nbsp;&nbsp;
  33. <font color='red'>增加其他分类并选择:</font><input type="text" value="{{old('goodsCategoryName2')}}" placeholder="" name="goodsCategoryName2">
  34. </span>
  35. </div>
  36. </div>
  37. <div class="row cl">
  38. <label class="form-label col-xs-4 col-sm-2">
  39. 商品货号:</label>
  40. <div class="formControls col-xs-6 col-sm-6">
  41. <input type="text" class="input-text" value="{{old('productCode')}}" placeholder="请输入货号,只能是字母数字下划线组合 例如:abc2或a_bcd" name="productCode">
  42. <br>
  43. <font color='red'></font>
  44. </div>
  45. </div>
  46. <div class="row cl">
  47. <label class="form-label col-xs-4 col-sm-2">
  48. 商品图片:</label>
  49. <div class="formControls col-xs-6 col-sm-6">
  50. <span class="btn-upload">
  51. <input class="input-text upload-url radius" type="text" name="uploadfile-1" id="uploadfile-1" readonly><a href="javascript:void();" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe642;</i> 上传图片</a>
  52. <input type="file" multiple name="img" class="input-file">
  53. </span><br>
  54. 文件类型支持:jpg ,png ,ico ,文件大小不能超过1M
  55. </div>
  56. </div>
  57. <div class="row cl">
  58. <label class="form-label col-xs-4 col-sm-2">
  59. 商品描述:</label>
  60. <div class="formControls col-xs-6 col-sm-6">
  61. <textarea class="textarea" name="description">{{old('description')}}</textarea>
  62. </div>
  63. </div>
  64. <div class="row cl">
  65. <label class="form-label col-xs-4 col-sm-2">添加规格:</label>
  66. <div class="formControls col-xs-6 col-sm-6">
  67. <span class="select-box">
  68. <font style='font-weight:bold;'>规格:</font><input type='text' value="" placeholder="示例:500克/包" name="propsName"/>
  69. &nbsp;&nbsp;<font style='font-weight:bold;'>售价:</font><input type="text" value="" placeholder="请填写对应规格价格(数字格式)" name="price">元
  70. &nbsp;&nbsp;<font style='font-weight:bold;'>吊牌价:</font><input type="text" value="" placeholder="请填写对应规格吊牌价(数字格式)" name="tagPrice">元<br>
  71. <font style='font-weight:bold;'>参考成本:</font><input type="text" value="" placeholder="请填写对应参考成本(数字格式)" name="referenceCost">元
  72. <font style='font-weight:bold;'>分销商价格:</font><input type="text" value="" placeholder="请填写对应分销商价格(数字格式)" name="outPrice">元
  73. &nbsp;&nbsp;<font style='font-weight:bold;color:red'>是否称重:</font><input type='radio' value='0' name='is_weigh' checked/>否 <input type='radio' value='1' name='is_weigh'/>是
  74. &nbsp;&nbsp;<button type='button' onclick='add_goods()'> 确认</button>
  75. </span>
  76. </div>
  77. </div><br>
  78. <div class="row cl">
  79. <label class="form-label col-xs-4 col-sm-2">
  80. 已有规格:</label>
  81. <div id='goods_o' class="formControls col-xs-6 col-sm-6">
  82. </div>
  83. </div><br>
  84. <div class="row cl">
  85. <div class="col-9 col-offset-2">
  86. <button class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>&nbsp;
  87. <button class="btn btn-default" type="reset" onclick="return_index();">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>&nbsp;
  88. {{--<a href="javascript:void(0)" class="btn btn-default radius" onclick="redirect('{{url('/admin/admin/all')}}')">返回并查看结果</a>--}}
  89. </div>
  90. </div>
  91. </form>
  92. </div>
  93. <!--_footer 作为公共模版分离出去-->
  94. <script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
  95. <script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
  96. <script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
  97. <script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
  98. <!--/_footer 作为公共模版分离出去-->
  99. <!--请在下方写此页面业务相关的脚本-->
  100. <script type="text/javascript">
  101. $(function(){
  102. setTimeout("$('#error').hide()",3000);
  103. });
  104. /*返回*/
  105. function return_index(){
  106. location.href='/admin/goods/index';
  107. }
  108. //全局变量
  109. id_n = -101;
  110. function add_goods(){
  111. id_n++;
  112. var propsName = $("input[name=propsName]").val();
  113. var price = $("input[name=price]").val();
  114. var tagPrice = $("input[name=tagPrice]").val();
  115. var referenceCost = $("input[name=referenceCost]").val();
  116. var is_weigh = $("input[name=is_weigh]:checked").val();
  117. var outPrice = $("input[name=outPrice]").val();
  118. var str = "<p id='sku"+id_n+"'><font style='font-weight:bold;'>规格:<\/font>"+propsName
  119. + " <font style='font-weight:bold;'>售价:<\/font>"+price+";"
  120. + " <font style='font-weight:bold;'>吊牌价:<\/font>"+tagPrice+";"
  121. + " <font style='font-weight:bold;'>参考成本:<\/font>"+referenceCost+";"
  122. + " <font style='font-weight:bold;'>分销商价格:<\/font>"+outPrice+";"
  123. + "&nbsp;&nbsp;<button type='button' onclick='del_sku("+id_n+")'> 移除<\/button> <input type='hidden' name='sku[]' value='"+propsName+'@@'+price+'@@'+tagPrice+'@@'+referenceCost+'@@'+outPrice+'@@'+is_weigh+"'\/> " +"<\/p>";
  124. $("#goods_o").append(str);
  125. return false;
  126. }
  127. function del_sku(id){
  128. $("#sku"+id).remove();
  129. }
  130. </script>
  131. </body>
  132. @endsection