Files
littleTiger/application/admin/view/promotion/flash_sale_info.html
2019-02-28 19:48:21 +08:00

243 lines
13 KiB
HTML

<include file="public/layout" />
<style>
.err{color:#F00; display:none;}
</style>
<script src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
<div class="fixed-bar">
<div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
<div class="subject">
<h3>促销管理 - 编辑抢购</h3>
<h5>网站系统抢购活动详情页</h5>
</div>
</div>
</div>
<form class="form-horizontal" id="handleposition" method="post">
<input type="hidden" id="goods_id" name="goods_id" value="{$info.goods_id}">
<input type="hidden" name="id" value="{$info.id}">
<input type="hidden" name="item_id" value="{$info.item_id}">
<div class="ncap-form-default">
<dl class="row">
<dt class="tit">
<label><em>*</em>抢购标题</label>
</dt>
<dd class="opt">
<input type="text" name="title" id="title" value="{$info.title}" class="input-txt">
<span class="err" id="err_title"></span>
<p class="notic">请填写抢购标题</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label><em>*</em>选择抢购商品</label>
</dt>
<dd class="opt">
<input type="text" id="goods_name" readonly name="goods_name" value="{$info.goods_name}" class="input-txt">
<div style="overflow: hidden" id="selected_group_goods">
<if condition="$info['goods_id'] gt 0">
<div style="float: left;margin-right: 10px" class="selected-group-goods">
<div class="goods-thumb"><img style="width: 162px;height: 162px" <notempty name="info['specGoodsPrice']">src="{$info['specGoodsPrice']['spec_img']}"<else/>src="{$info['goods_id']|goods_thum_images=162,162}"</notempty>/></div>
<div class="goods-name">
<a target="_blank" href="{:U('Home/Goods/goodsInfo',array('id'=>$info['goods_id']))}">{$info.goods_name}</a>
</div>
<div class="goods-price">
<notempty name="info['specGoodsPrice']">
商城价:¥{$info['specGoodsPrice']['price']}库存:{$info['specGoodsPrice']['store_count']}
<else/>
商城价:¥{$info['goods']['shop_price']}库存:{$info['goods']['store_count']}
</notempty>
</div>
</div>
</if>
</div>
<span class="err" id="err_goods_name"></span>
<p class="notic">
<a onclick="selectGoods()" class="ncap-btn" id="select_goods_button"><i class="fa fa-search"></i>选择商品</a>
</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label><em>*</em>限时抢购价格</label>
</dt>
<dd class="opt">
<input type="text" id="price" name="price" value="{$info.price}" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="input-txt">
<span class="err" id="err_price"></span>
<p class="notic">商品抢购价格,单位:元</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label><em>*</em>参加抢购数量</label>
</dt>
<dd class="opt">
<input type="text" name="goods_num" id="goods_num" value="{$info.goods_num}" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="input-txt">
<span class="err" id="err_goods_num"></span>
<p class="notic">此抢购活动最多允许抢购的商品数量</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label><em>*</em>限购数量</label>
</dt>
<dd class="opt">
<input type="text" <if condition="$info[id] gt 0">readonly="readonly"</if> id="buy_limit" name="buy_limit" value="{$info.buy_limit}" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="input-txt">
<span class="err" id="err_buy_limit"></span>
<p class="notic">限时抢购每个人能购买的数量</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label><em>*</em>开始时间</label>
</dt>
<dd class="opt">
<input type="text" id="start_time" name="start_time" value="{:date('Y-m-d', $info['start_time'])}" class="input-txt">
<select name="start_time_h" id="start_time_h">
<for start="0" end="24" step="2" name="i" >
<option value="{$i}" <if condition="$info.start_time_h eq $i">selected</if>>{$i}:00:00</option>
</for>
</select>
<span class="err" id="err_start_time"></span>
<p class="notic">抢购开始时间</p>
<p class="hint" style="color:red"><strong>重要:抢购时间是从凌晨0:00:00秒开始, 每隔2小时一个节点, 所以活动时间必须是两小时之内才有效, (例如今天是2017年1月1日下午2点场,<br/>那活动开始和结束时间必须是:2017-01-01 14:00:01 ~ 2017-01-01 15:59:59 时间范围内), 否则前端无法显示活动信息</strong></p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label>抢购介绍</label>
</dt>
<dd class="opt">
<textarea placeholder="请输入活动介绍" name="description" rows="6" class="tarea">{$info.description}</textarea>
<p class="notic">抢购描述介绍</p>
</dd>
</dl>
<if condition="$info['is_edit'] eq 0">
<div class="bot"><a class="ncap-btn-big">确认提交</a></div>
<else/>
<dl class="row" txt="发布活动时,进行通知">
<dt class="tit">站内信通知</dt>
<dd class="opt">
<div class="onoff">
<label for="mmt_message_switch1" class="cb-enable selected"></label>
<label for="mmt_message_switch0" class="cb-disable "></label>
<input id="mmt_message_switch1" name="mmt_message_switch" checked="checked" value="1" type="radio">
<input id="mmt_message_switch0" name="mmt_message_switch" value="0" type="radio">
</div>
<p class="notic"></p>
</dd>
</dl>
<!-- <dl class="row">
<dt class="tit">手机短信通知</dt>
<dd class="opt">
<div class="onoff">
<label for="mmt_short_switch1" class="cb-enable ">是</label>
<label for="mmt_short_switch0" class="cb-disable selected">否</label>
<input id="mmt_short_switch1" name="mmt_short_switch" value="1" type="radio">
<input id="mmt_short_switch0" name="mmt_short_switch" checked="checked" value="0" type="radio">
</div>
<p class="notic"></p>
</dd>
</dl>
<dl class="row">
<dt class="tit">邮件通知</dt>
<dd class="opt">
<div class="onoff">
<label for="mmt_mail_switch1" class="cb-enable ">是</label>
<label for="mmt_mail_switch0" class="cb-disable selected">否</label>
<input id="mmt_mail_switch1" name="mmt_mail_switch" value="1" type="radio">
<input id="mmt_mail_switch0" name="mmt_mail_switch" checked="checked" value="0" type="radio">
</div>
<p class="notic"></p>
</dd>
</dl> -->
<div class="bot"><a onclick="verifyForm()" class="ncap-btn-big ncap-btn-green">确认提交</a></div>
</if>
</div>
</form>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#start_time').layDate();
})
var ajax_return_status = 1; // 标识ajax 请求是否已经回来 可以进行下一次请求
function verifyForm(){
$('span.err').hide();
if (ajax_return_status == 0) {
return false;
}
if ($('#start_time').val() == ''){
layer.msg('请输入活动时间', {icon: 2,time: 1000});
return false;
}
ajax_return_status = 0;
$.ajax({
type: "POST",
url: "{:U('Admin/Promotion/flash_sale_info')}",
data: $('#handleposition').serialize(),
dataType: "json",
error: function () {
ajax_return_status = 1
layer.alert("服务器繁忙, 请联系管理员!");
},
success: function (data) {
if (data.status == 1) {
layer.msg(data.msg, {icon: 1, time: 1000}, function(){
location.href = "{:U('Admin/Promotion/flash_sale')}";
});
} else {
layer.msg(data.msg, {icon: 2,time: 1000});
$.each(data.result, function (index, item) {
$('#err_' + index).text(item).show();
});
ajax_return_status = 1;
}
}
});
}
function selectGoods(){
var url = "{:U('Promotion/search_goods',array('tpl'=>'select_goods','prom_type'=>1,'prom_id'=>$info[id]))}";
layer.open({
type: 2,
title: '选择商品',
shadeClose: true,
shade: 0.2,
area: ['75%', '75%'],
content: url,
});
}
function call_back(goodsItem){
$('#goods_id').val(goodsItem.goods_id);
$('input[name=item_id]').val(''); //将规格ID重置一下
var html = '';
if(goodsItem.spec != null){
//有规格
html = '<div style="float: left;margin: 10px auto;" class="selected-group-goods"><div class="goods-thumb">' +
'<img style="width: 162px;height: 162px" src="'+goodsItem.spec.spec_img+'"/></div> <div class="goods-name"> ' +
'<a target="_blank" href="/index.php?m=Home&c=Goods&a=goodsInfo&id='+goodsItem.goods_id+'">'+goodsItem.goods_name+goodsItem.spec.key_name+'</a> </div>' +
' <div class="goods-price">商城价:¥'+goodsItem.spec.price+'库存:'+goodsItem.spec.store_count+'</div> </div>';
$('input[name=item_id]').val(goodsItem.spec.item_id)
$('input[name=goods_name]').val(goodsItem.goods_name + goodsItem.spec.key_name);
}else{
html = '<div style="float: left;margin: 10px auto;" class="selected-group-goods"><div class="goods-thumb">' +
'<img style="width: 162px;height: 162px" src="'+goodsItem.goods_image+'"/></div> <div class="goods-name"> ' +
'<a target="_blank" href="/index.php?m=Home&c=Goods&a=goodsInfo&id='+goodsItem.goods_id+'">'+goodsItem.goods_name+'</a> </div>' +
' <div class="goods-price">商城价:¥'+goodsItem.goods_price+'库存:'+goodsItem.store_count+'</div> </div>';
$('input[name=goods_name]').val(goodsItem.goods_name);
}
$('#select_goods_button').attr('data-goods-id',goodsItem.goods_id);
$('#selected_group_goods').empty().html(html);
$('.selected-group-goods').show();
layer.closeAll('iframe');
}
</script>
</body>
</html>