截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

add.html 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. {layout name="layout2" /}
  2. <style>
  3. .layui-form-label {
  4. color: #6a6f6c;
  5. width: 100px;
  6. }
  7. .layui-input-block {
  8. margin-left: 130px;
  9. }
  10. .tips{
  11. color: red;
  12. }
  13. .goods{
  14. display: none;
  15. }
  16. </style>
  17. <div class="layui-form" lay-filter="layuiadmin-form-user_level" id="layuiadmin-form-user_level" style="padding: 20px 30px 0 0;">
  18. <div class="layui-form-item">
  19. <label class="layui-form-label"><span class="tips">*</span>活动专区:</label>
  20. <div class="layui-input-inline">
  21. <select name="activity_id">
  22. <option value="">请选择活动专区</option>
  23. {foreach activity_area as $key => $value}
  24. <option value="{$value.id}">{$value.name}</option>
  25. {/foreach}
  26. </select>
  27. </div>
  28. </div>
  29. <div class="layui-form-item">
  30. <label class="layui-form-label"><span class="tips">*</span>专区商品</label>
  31. <div class="layui-input-block">
  32. <a class="layui-btn layui-btn-normal select-goods" >选择专区商品</a>
  33. </div>
  34. </div>
  35. <div class="layui-form-item goods">
  36. <label class="layui-form-label"></label>
  37. <div class="layui-input-block ">
  38. <table id="goods_list" class="layui-table" lay-size="sm">
  39. <colgroup>
  40. <col width="40px">
  41. </colgroup>
  42. <thead>
  43. <tr style="background-color: #f3f5f9">
  44. <th style="width: 120px;text-align: center">商品</th>
  45. <th style="width: 120px;text-align: center">规格</th>
  46. <th style="width: 120px;text-align: center">商品价格</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. </tbody>
  51. </table>
  52. </div>
  53. </div>
  54. <div class="layui-form-item layui-hide">
  55. <input type="button" lay-submit lay-filter="add-submit" id="add-submit" value="确认">
  56. </div>
  57. </div>
  58. <style>
  59. .layui-form-label {
  60. width: 100px;
  61. }
  62. .layui-input-block {
  63. margin-left: 130px;
  64. }
  65. </style>
  66. <script>
  67. layui.use([ 'form'], function(){
  68. var $ = layui.$
  69. ,form = layui.form
  70. ,goods_ids = [];
  71. $(document).on('click','.select-goods',function () {
  72. layer.open({
  73. type: 2
  74. ,title: '选择商品'
  75. ,content: '{:url("common/selectGoodsTwo")}'
  76. ,area: ['90%', '90%']
  77. ,btn: ['确认', '取消']
  78. ,yes: function(index, layero){
  79. var data = window["layui-layer-iframe" + index].callbackdata();
  80. if(data.length){
  81. goods_ids = [];
  82. $('#goods_list tbody').remove();
  83. }
  84. data.forEach(function(item,index,arr) {
  85. var image = item.image;
  86. for(var i = 0; item.goods_item.length > i;i++){
  87. var goods_item = item.goods_item[i];
  88. if(goods_ids.indexOf(goods_item.id) == -1) {
  89. goods_ids.push(goods_item.id);
  90. if(item.goods_item[i].image) {
  91. image = item.goods_item[i].image;
  92. }
  93. var goods_html = '<tr>\n' +
  94. '<td style="text-align: left">' +
  95. ' <input type="hidden" name="goods_id[]" value="'+item.id +'">' +
  96. ' <img class="image-show" width="80px" height="80px" src="'+image +'">'+item.name+
  97. '</td>\n' +
  98. '<td style="text-align: center">' +
  99. ' <input type="hidden" name="item_id[]" value="'+goods_item.id+'">'+goods_item.spec_value_str+
  100. '</td>\n' +
  101. '<td style="text-align: center">'+goods_item.price+'</td>\n' +
  102. '</tr>';
  103. $('#goods_list').append(goods_html);
  104. }
  105. }
  106. })
  107. $('.goods').show();
  108. }
  109. })
  110. })
  111. //图片放大
  112. $(document).on('click', '.image-show', function () {
  113. var src = $(this).attr('src');
  114. like.showImg(src,600);
  115. });
  116. })
  117. </script>