add.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. .rr{
  5. padding-right: 10px;
  6. }
  7. .layui-laydate-content>.layui-laydate-list {
  8. padding-bottom: 0px;
  9. overflow: hidden;
  10. }
  11. .layui-laydate-content>.layui-laydate-list>li{
  12. width:50%
  13. }
  14. </style>
  15. <div class="row">
  16. <div class="col-sm-12">
  17. <div class="ibox float-e-margins">
  18. <div class="ibox-title">
  19. <h5>盘点</h5>
  20. <div class="ibox-tools">
  21. <a class="toback" href="{:url('index')}">
  22. 返回上一页
  23. </a>
  24. </div>
  25. </div>
  26. <div class="ibox-content">
  27. <form method="post" action="{:url('add')}" class="form-horizontal">
  28. <input type="hidden" name="id" value="{$info['id']|default='0'}">
  29. <div class="form-group">
  30. <label class="col-sm-2 control-label">盘点说明</label>
  31. <div class="col-sm-6">
  32. <textarea name="remark" id="" cols="30" rows="4" class="form-control"></textarea>
  33. </div>
  34. </div>
  35. <div class="form-group" id="goods" >
  36. <label class="col-sm-2 control-label">盘点物品<span class="text-danger">*</span></label>
  37. <div class="col-sm-8">
  38. <a url="{:url('selectGoods')}" id="gUrl" 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>编号</th>
  43. <th>名称</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="col-sm-12">
  57. <div class="hr-line-dashed">
  58. </div>
  59. </div>
  60. <div class="form-group">
  61. <div class="col-sm-6 col-sm-offset-2">
  62. <button class="btn btn-primary ajax-post" target-form="form-horizontal" type="submit">确定</button>
  63. <a href="{:url('index')}" class="btn btn-default">取 消</a>
  64. </div>
  65. </div>
  66. </form>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. {/block}
  72. {block name="script"}
  73. <script src="/static/layDate-v5.0.9/laydate.js"></script>
  74. <script>
  75. function setGoods(id) {
  76. // if(id !=''){
  77. // $("#goods").css('display','block')
  78. // $("#gUrl").attr('url','/admin/dispose/selectgoods.html?warehouse_id='+id);
  79. //
  80. // }else{
  81. // $("#goods").css('display','none')
  82. // $("#gUrl").attr('url','/admin/dispose/selectgoods.html?warehouse_id=0');
  83. //
  84. // }
  85. }
  86. $(function () {
  87. laydate.render({
  88. elem: '#delivery_time',
  89. trigger: 'click',
  90. theme: '#6eb7ff',
  91. type: 'date',
  92. format:'yyyy-MM-dd',
  93. });
  94. });
  95. var lists = [];
  96. function ddl(id) {
  97. var newArr = [];
  98. for (let o in lists){
  99. if(lists[o].id!=id){
  100. newArr.push(lists[o]);
  101. }
  102. }
  103. lists = newArr;
  104. formatList();
  105. }
  106. $(document).ready(function(){
  107. localStorage.removeItem("mateapply");
  108. localStorage.removeItem("mateapplyids");
  109. formatList();
  110. });
  111. function formatList() {
  112. var str = '';
  113. let ids = [];
  114. for (let o in lists){
  115. ids.push(lists[o].id);
  116. str += '<tr>';
  117. str += '<td>'+lists[o].sn+'</td>';
  118. str += '<td>'+lists[o].title+'</td>';
  119. str += '<td>'+lists[o].spec+'</td>';
  120. str += '<td>'+lists[o].cateName+'</td>';
  121. str += '<td>'+lists[o].price+'</td>';
  122. str += '<td>'+lists[o].nums+'</td>';
  123. str += '<input type="hidden" value="'+lists[o].id+'" class="form-control input-sm" name="items['+lists[o].id+'][id]"></td>';
  124. str += '<td><button onclick="ddl('+lists[o].id+')" type="button">删除</button></td>';
  125. str += '</tr>';
  126. }
  127. $('#layer-photos').html(str);
  128. if(ids.length > 0){
  129. localStorage.setItem("mateapply", JSON.stringify(lists));
  130. localStorage.setItem("mateapplyids", JSON.stringify(ids));
  131. }else{
  132. localStorage.removeItem("mateapply");
  133. localStorage.removeItem("mateapplyids");
  134. }
  135. }
  136. </script>
  137. {/block}