add.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <!--<div class="ibox-title">-->
  7. <!--<h5>{$meta_title}</h5>-->
  8. <!--<div class="ibox-tools">-->
  9. <!--<a class="toback" href="{:url('show')}">-->
  10. <!--返回上一页-->
  11. <!--</a>-->
  12. <!--</div>-->
  13. <!--</div>-->
  14. <div class="ibox-content">
  15. <form method="post" action="{:url('add')}" class="form-horizontal">
  16. <input type="hidden" name="type" value="1">
  17. <div class="form-group">
  18. <label class="col-sm-2 control-label">入库人<span class="text-danger">*</span></label>
  19. <div class="col-sm-8">
  20. <input type="text" class="form-control" name="name" value="{$info.title|default=''}">
  21. </div>
  22. </div>
  23. <div class="form-group">
  24. <label class="col-sm-2 control-label">联系电话<span class="text-danger">*</span></label>
  25. <div class="col-sm-8">
  26. <input type="text" class="form-control" name="phone" value="{$info.unit|default=''}">
  27. </div>
  28. </div>
  29. <div class="form-group">
  30. <label class="col-sm-2 control-label">备注</label>
  31. <div class="col-sm-8">
  32. <textarea name="remark" class="form-control" id="remark" cols="30" rows="5">{$info.remark|default=''}</textarea>
  33. </div>
  34. </div>
  35. <div class="form-group">
  36. <label class="col-sm-2 control-label">选择物品<span class="text-danger">*</span></label>
  37. <div class="col-sm-8">
  38. <a url="{:url('CompanyGoods/selectGoods')}" href="javascript:;" data-title="选择物品" onclick="layer_open(this,0)" class="btn btn-primary">选择物品</a>
  39. <table class="table table-striped table-bordered">
  40. <thead>
  41. <tr>
  42. <th style="width: 120px">单价</th>
  43. <th style="width: 120px">数量</th>
  44. <th>名称</th>
  45. <th>品牌</th>
  46. <th>规格</th>
  47. <th>类型</th>
  48. <th>购买时间</th>
  49. </tr>
  50. </thead>
  51. <tbody class="layer-photos" id="layer-photos">
  52. </tbody>
  53. </table>
  54. </div>
  55. </div>
  56. <div class="hr-line-dashed"></div>
  57. <div class="form-group">
  58. <div class="col-sm-6 col-sm-offset-2">
  59. <button class="btn btn-primary ajax-post" data-layer_c="1" target-form="form-horizontal" type="submit">确 定</button>
  60. <button class="btn cancel-btn btn-default" type="button">取 消</button>
  61. </div>
  62. </div>
  63. </form>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. {/block}
  69. {block name="script"}
  70. <script type="text/javascript" src="/static/layDate-v5.0.9/laydate.js"></script>
  71. <script>
  72. laydate.render({
  73. elem: '#buy_time',
  74. trigger: 'click' ,
  75. theme:'#284a94'
  76. });
  77. $(document).ready(function(){
  78. formSetValue("enable", {$info.enable|default=1});
  79. localStorage.removeItem("mateapply");
  80. localStorage.removeItem("mateapplyids");
  81. });
  82. var lists = [];
  83. function formatList() {
  84. var str = '';
  85. let ids = [];
  86. for (let o in lists){
  87. ids.push(lists[o].id);
  88. str += '<tr>';
  89. str += '<td><input type="number" class="form-control input-sm" name="goods['+lists[o].id+'][price]"></td>';
  90. str += '<td><input type="number" class="form-control input-sm" name="goods['+lists[o].id+'][nums]"></td>';
  91. str += '<td>'+lists[o].title+'</td>';
  92. str += '<td>'+lists[o].brand+'</td>';
  93. str += '<td>'+lists[o].spec+'</td>';
  94. str += '<td>'+lists[o].type+'</td>';
  95. str += '<td>'+lists[o].buy_time+'</td>';
  96. str += '</tr>';
  97. }
  98. $('#layer-photos').html(str);
  99. if(ids.length > 0){
  100. localStorage.setItem("mateapply", JSON.stringify(lists));
  101. localStorage.setItem("mateapplyids", JSON.stringify(ids));
  102. }else{
  103. localStorage.removeItem("mateapply");
  104. localStorage.removeItem("mateapplyids");
  105. }
  106. console.log(keyword);
  107. }
  108. function lastSave() {
  109. var name = $("input[name=name]").val();
  110. var phone = $("input[name=phone]").val();
  111. var remark = $("#remark").val();
  112. if(!name){
  113. var n = '入库人';
  114. layer.msg('请填写'+n);
  115. return;
  116. }
  117. if(!phone){
  118. layer.msg('请输入联系电话');
  119. return;
  120. }
  121. items = document.getElementsByClassName("ids");
  122. data = [];
  123. for(x in items){
  124. if(items[x].checked)
  125. data.push(items[x].value);
  126. }
  127. if(data.length <=0){
  128. layer.msg('请选择商品');
  129. return;
  130. }
  131. var url = 'lastSave?name='+name+'&phone='+phone+'&ids='+data.join(',')+'&remark='+remark;
  132. layer.open({
  133. type: 2,
  134. shade: 0.8,
  135. title: '{$meta_title}',
  136. area: ['800px', '90%'],
  137. fix: false, //不固定
  138. maxmin: true,
  139. content: url,
  140. skin: 'layer-ext-moon',
  141. end : function() {
  142. window.location.href="{:url('show')}";
  143. }
  144. });
  145. }
  146. </script>
  147. {/block}