123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- {include file="public/layout" /}
- <body class="bodystyle">
- <div id="append_parent"></div>
- <div id="ajaxwaitid"></div>
- <div class="page">
- <div class="flexigrid">
- <div class="ncap-form-default">
- <form class="form-horizontal" id="post_form" action="{:url('Sharp/active_add')}" method="post">
- <dl class="row">
- <dt class="tit">
- <label for="limit"><em>*</em>活动日期</label>
- </dt>
- <dd class="opt">
- <input type="text" class="input-txt" id="active_date" name="active_date" placeholder="比如:2020-05-20" autocomplete="off">
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="seckill_price"><em>*</em>活动场次</label>
- </dt>
- <dd class="opt">
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="0" />00:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="1" />01:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="2" />02:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="3" />03:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="4" />04:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="5" />05:00</label> <br>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="6" />06:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="7" />07:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="8" />08:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="9" />09:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="10" />10:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="11" />11:00</label> <br>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="12" />12:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="13" />13:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="14" />14:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="15" />15:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="16" />16:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="17" />17:00</label> <br>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="18" />18:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="19" />19:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="20" />20:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="21" />21:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="22" />22:00</label>
- <label class="curpoin"><input type="checkbox" name="active_time[]" value="23" />23:00</label>
- <span class="err"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="total_stock">选择商品 </label>
- </dt>
- <dd class="opt">
- <a href="javascript:void(0);" onclick="choGoods();" class="ncap-btn ncap-btn-green"><i class="layui-icon"></i>选择秒杀商品</a>
- <p class="notic2">注:每个活动场次中出售的秒杀商品,此处非必选,可在场次管理中单独设置</p>
- <div class="none" id="goods_show_list" style="margin-top: 15px;width: 850px;">
- <div class="flexigrid">
- <div class="hDiv">
- <div class="hDivBox">
- <table cellspacing="0" cellpadding="0" style="width: 100%;">
- <thead>
- <tr>
- <th abbr="id" axis="col5" class="w60">
- <div class="tc">商品ID</div>
- </th>
- <th align="center" abbr="article_title" axis="col3" class="w40">
- <div class="tc">封面图</div>
- </th>
- <th align="left" abbr="article_title" axis="col3" class="">
- <div style="text-align: left; padding-left: 10px;" class="">商品标题</div>
- </th>
- <th abbr="article_time" axis="col6" class="w60">
- <div class="tc">操作</div>
- </th>
- </tr>
- </thead>
- </table>
- </div>
- <div class="bDiv" style="height: auto;">
- <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
- <table style="width: 100%;">
- <tbody id="Template">
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </dd>
- </dl>
- <div class="bot">
- <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
- </div>
- </form>
- </div>
- </div>
- </div>
- <script>
- var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- function reback(info) {
- layer.closeAll();
- if (info) {
- $("#goods_show_list").show();
- info.forEach(function (v) {
- v = JSON.parse(v,true)
- if ($('div').is('.goods_show_list_div_'+v.sharp_goods_id) == false){
- var html = '';
- html += '<tr class="tr goods_show_list_div goods_show_list_div_' + v.sharp_goods_id + '">';
- html += ' <td class="sort">';
- html += ' <div class="w60 tc">';
- html += ' ' + v.sharp_goods_id;
- html += ' <input type="hidden" name="goods[sharp_goods_id][]" value="' + v.sharp_goods_id + '">';
- html += ' <input type="hidden" name="goods[aid][]" value="' + v.aid + '">';
- html += ' </div>';
- html += ' </td>';
- html += ' <td class="w40">';
- html += ' <div class="tc">';
- html += ' <img width="40" height="40" src="' + v.litpic + '">';
- html += ' </div>';
- html += ' </td>';
- html += ' <td class="" style="width: 100%;">';
- html += ' <div class="tl" style="padding-left: 10px;">';
- html += ' ' + v.title;
- html += ' </div>';
- html += ' </td>';
- html += ' <td class="">';
- html += ' <div class="w60 tc">';
- html += ' <a class="btn red" href="javascript:void(0);" onclick="del(' + v.sharp_goods_id + ');">删除</a>';
- html += ' </div>';
- html += ' </td>';
- html += '</tr>';
- $("#Template").append(html);
- }
- })
- }
- }
- function del(sid){
- $(".goods_show_list_div_"+sid).remove();
- }
- layui.use(['form', 'laydate'], function(){
- var form = layui.form,
- laydate = layui.laydate;
-
- laydate.render({
- elem: '#active_date'
- });
-
- form.render();
- });
- function choGoods() {
- layer.open({
- type: 2,
- title: '选择秒杀商品',
- fixed: true, //不固定
- shadeClose: false,
- shade: layer_shade,
- maxmin: true, //开启最大化最小化按钮
- area: ['80%', '90%'],
- content: "{:url('Sharp/goods_list')}"
- });
- }
- </script>
- <script type="text/javascript">
- // 判断输入框是否为空
- function checkForm(){
- if($('input[name=active_date]').val() == ''){
- showErrorMsg('活动日期不能为空!');
- $('input[name=active_date]').focus();
- return false;
- }
-
- if($('input[name^=active_time]:checked').length == 0){
- showErrorMsg('请选择活动场次!');
- return false;
- }
-
- layer_loading('正在处理');
- $.ajax({
- type : 'post',
- url : "{:url('Sharp/active_add', ['_ajax'=>1])}",
- data : $('#post_form').serialize(),
- dataType : 'json',
- success : function(res){
- layer.closeAll();
- if(res.code == 1){
- var _parent = parent;
- _parent.layer.close(parentObj);
- _parent.layer.msg(res.msg, {icon: 1, shade: 0.1, time: 1000}, function(){
- _parent.window.location.reload();
- });
- }else{
- showErrorMsg(res.msg);
- }
- },
- error: function(e){
- layer.closeAll();
- showErrorAlert(e.responseText);
- }
- });
- }
- </script>
- {include file="public/footer" /}
|