wpfw_ewei_shopv2/template/web/sale/wxcard/post.html
2023-02-14 19:57:32 +08:00

414 lines
14 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{template '_header'}
<link href="/favicon.ico" rel="shortcut icon" />
<link rel="stylesheet" type="text/css" href="../addons/{EWEI_SHOP_V2_MODULE_NAME}/template/web/sale/wxcard/css/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="../addons/{EWEI_SHOP_V2_MODULE_NAME}/template/web/sale/wxcard/css/index.css"/>
<script type="text/javascript" src="../addons/{EWEI_SHOP_V2_MODULE_NAME}/static/js/app/biz/sale/wxcard/colorpalette.js" charset="utf-8"></script>
<div class="page-heading">
<span class='pull-right'>
<a class="btn btn-default btn-sm" href="{php echo webUrl('sale/wxcard')}">返回列表</a>
</span>
<h2>添加 {if $type==0}代金券{elseif $type==1}折扣券{/if}</h2>
</div>
<div id="bgcolor" class="preview Color010">
<div class="title">
<i class="back iconfont">&#xe7e0;</i>
<i class="more pull-right iconfont">&#xe7e3;</i>
</div>
<div class="panel">
<!--商户信息-->
<div class="logo-area">
<div class="logo">
<img id="showlogo" src="{php echo empty($item)?'':$item['logo_url']}"/>
</div>
<p class="name" id="showbrand_name">{$item['brand_name']}
</p>
</div>
<!--卡券标题-->
<div class="card">
<p id="showtitle" class="card-title">{$item['title']}</p>
<div id="btnuse" class='btn Color010'>使用</div>
</div>
<!--使用条件-->
<div class="card_usage">
<ul>
<li id="showuselimit" style="display: none;"><em>使用条件:</em><span id="showlimittext"></span></li>
<li><em>可用时间:</em><span id="showbeginendtime"></span></li>
</ul>
</div>
<!--卡券封面-->
<div class="card-cover" id="showallabstract" {if empty($item['setabstract'])}style="display: none;"{/if}>
<img id="showabstractimg" src="{php echo empty($item)?'':$item['abstractimg']}"/>
<span class="card-cover-intr">
<span id="showabstract" class="cover-title">
{$item['abstract']}
<i class="go pull-right iconfont">&#xe6a7;</i>
</span>
</span>
</div>
<!--卡券其他-->
<div class="card-other">
<ul>
<li>公众号<i class="go pull-right iconfont">&#xe6a7;</i></li>
<li>详情<i class="go pull-right iconfont">&#xe6a7;</i></li>
</ul>
</div>
</div>
<!--自定义入口1-->
<div class="custom-detail" id="showcustom" {if empty($item['setcustom'])}style="display: none;"{/if}>
<ul>
<li><span id="show_custom_url_name">{if empty($item['custom_url_name'])}自定义入口1(选填){else}{$item['custom_url_name']}{/if}</span><i class="go pull-right iconfont">&#xe6a7;</i><span class="pull-right gray" id="show_custom_url_sub_title">{$item['custom_url_sub_title']}</span></li>
</ul>
</div>
<!--自定义入口2-->
<div class="custom-detail" id="showpromotion" {if empty($item['setpromotion'])} style="display: none;"{/if}>
<ul>
<li><span id="show_promotion_url_name">{if empty($item['promotion_url_name'])}自定义入口2(选填){else}{$item['promotion_url_name']}{/if}</span><i class="go pull-right iconfont">&#xe6a7;</i><span class="pull-right gray" id="show_promotion_url_sub_title">{$item['promotion_url_sub_title']}</span></li>
</ul>
</div>
</div>
<form style="width: 450px;float: left;margin-left: 30px" {ife 'sale.wxcard' $item}action="" method='post'{/if} class='form-horizontal form-validate'>
<input type="hidden" name="id" value="{$item['id']}">
<input type="hidden" name="tab" id='tab' value="{$_GPC['tab']}" />
<ul class="nav nav-arrow-next nav-tabs" style="width: 450px" id="myTab">
<li {if $_GPC['tab']=='basic' || empty($_GPC['tab'])}class="active"{/if} ><a href="#tab_basic">基本</a></li>
<li {if $_GPC['tab']=='abstract'}class="active"{/if} ><a href="#tab_abstract">自定义元素</a></li>
<li {if $_GPC['tab']=='limit'}class="active"{/if} ><a href="#tab_limit">使用限制</a></li>
<li {if $_GPC['tab']=='center'}class="active"{/if} ><a href="#tab_center">领取设置</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane {if $_GPC['tab']=='basic' || empty($_GPC['tab'])}active{/if}" id="tab_basic">{template 'sale/wxcard/post/basic'}</div>
<div class="tab-pane {if $_GPC['tab']=='abstract'}active{/if}" id="tab_abstract">{template 'sale/wxcard/post/abstract'}</div>
<div class="tab-pane {if $_GPC['tab']=='limit'}active{/if}" id="tab_limit">{template 'sale/wxcard/post/limit'}</div>
<div class="tab-pane {if $_GPC['tab']=='center'}active{/if}" id="tab_center">{template 'sale/wxcard/post/center'}</div>
</div>
<div class="form-group"></div>
<div class="form-group">
<label class="col-sm-2 control-label"f></label>
<div class="col-sm-9 col-xs-12">
{ife 'sale.wxcard' $item}
<input type="submit" name="submit" value="提交" class="btn btn-primary" />
{/if}
<input type="button" name="back" onclick='history.back()' {ife 'sale.wxcard' $item}style='margin-left:10px;'{/if} value="返回列表" class="btn btn-default" />
</div>
</div>
</form>
<script language='javascript'>
require(['bootstrap'],function(){
$('#myTab a').click(function (e) {
e.preventDefault();
$('#tab').val( $(this).attr('href'));
$(this).tab('show');
})
});
function showbacktype(type){
$('.backtype').hide();
$('.backtype' + type).show();
}
function setshowuselimit()
{
var shiyongtext = $("#accept_category").val();
var text="";
if(shiyongtext!='')
{
text="适用于"+shiyongtext;
}
var bushiyongtext = $("#reject_category").val();
if(bushiyongtext!='')
{
if(shiyongtext!='')
{
text=text+",";
}
text=text+"不适用于"+bushiyongtext;
}
$("#showlimittext").html(text);
}
$(function(){
$('form').submit(function(){
{if empty($id)}
if($('#title').val()==''||$('#title').val().length>9)
{
$('#myTab a[href=#tab_basic]').tab('show');
tip.msgbox.err('卡券标题不能为空且不能超过9个字符!');
$('form').attr('stop',1);
return false;
}
if($('#logourl').val()==''||$('#logolocalpath').val()=='')
{
$('#myTab a[href=#tab_basic]').tab('show');
tip.msgbox.err('logo图片未上传!');
$('form').attr('stop',1);
return false;
}
if($('#quantity').val()=='')
{
$('#myTab a[href=#tab_basic]').tab('show');
tip.msgbox.err('卡券库存数量不能为空且必须大于1!');
$('form').attr('stop',1);
return false;
}
if($('#brand_name').val()==''||$('#brand_name').val().length>12)
{
$('#myTab a[href=#tab_basic]').tab('show');
tip.msgbox.err('商铺名称不能为空且长度超过12个字符!');
$('form').attr('stop',1);
return false;
}
{if empty($type)}
if($('#reduce_cost').val()==''||$('#reduce_cost').val()<=0)
{
$('#myTab a[href=#tab_basic]').tab('show');
tip.msgbox.err('减免金额不能为空,且必须大于1,支持2位小数点!');
$('form').attr('stop',1);
return false;
}
{else}
if($('#discount').val()==''||$('#discount').val()>9.9||$('#discount').val()<1)
{
$('#myTab a[href=#tab_basic]').tab('show');
tip.msgbox.err('不能为空且折扣额度需填写范围在1-9.9的数字!');
$('form').attr('stop',1);
return false;
}
{/if}
{/if}
$('form').removeAttr('stop');
return true;
});
require(['jquery', 'util'], function($, util){
//示例图logo控制
$('#uploadlogo').click(function(){
util.image('',function(data){
$("#showlogo").attr('src',data.url);
$("#logourl").val(data.url);
$("#logolocalpath").val(data.attachment);
});
});
//示例图封面图片控制
$('#upabstractimg').click(function(){
util.image('',function(data){
$("#showabstractimg").attr('src',data.url);
$("#abstractimgurl").val(data.url);
$("#abstractimglocalpath").val(data.attachment);
});
});
});
//示例图l品牌名称文本控制
$('#brand_name').change(function(){
$('#showbrand_name').html($(this).val());
});
//示例图有效期控制
window.timer_id = setInterval(function(){
if($("input[name='datetype']:checked").val()=="DATE_TYPE_FIX_TIME_RANGE")
{
$("#showbeginendtime").html( $("input[name='beginendtime[start]']").val().replace("-",".")+" "+$("input[name='beginendtime[end]").val().replace("-","."));
}
else if($("input[name='datetype']:checked").val()=="DATE_TYPE_FIX_TERM")
{
var fixed_begin_term = $("#fixed_begin_term").val();
var fixed_term = $("#fixed_term").val();
var nowdate = new Date();
nowdate=new Date(nowdate.getTime()+fixed_begin_term*86400*1000);
var showdate =nowdate.getFullYear() + "." + (nowdate.getMonth()+1) + "." + nowdate.getDate();
nowdate=new Date(nowdate.getTime()+(fixed_term-1)*86400*1000);
var showdate =showdate+"-"+nowdate.getFullYear() + "." + (nowdate.getMonth()+1) + "." + nowdate.getDate();
$("#showbeginendtime").html(showdate);
}
},1000);
//clearInterval(window.time_id);
//示例图标题控制
$('#title').change(function(){
$('#showtitle').html($(this).val());
});
//示例图适用商品控制
$('#accept_category').change(function(){
setshowuselimit();
});
$('#reject_category').change(function(){
setshowuselimit();
});
//示例图封面文本控制
$('#abstract').change(function(){
$('#showabstract').html($(this).val());
});
//示例图卡券顶部按钮文本控制
$('#center_title').change(function(){
var str = $(this).val();
if(str=="")
{
str="使用";
}
$('#btnuse').html(str);
});
//添加自定义入口1
$("#addcustom") .on('click', function(){
$("#showsetcustom").show();
$("#showcustom").show();
$("#setcustom").val(1);
});
//删除自定义入口1
$("#delcustom") .on('click', function(){
$("#showsetcustom").hide();
$("#showcustom").hide();
$("#setcustom").val(0);
});
//添加自定义入口2
$("#addpromotion") .on('click', function(){
$("#showsetpromotion").show();
$("#showpromotion").show();
$("#setpromotion").val(1);
});
//删除自定义入口2
$("#delpromotion") .on('click', function(){
$("#showsetpromotion").hide();
$("#showpromotion").hide();
$("#setpromotion").val(0);
});
//添加封面
$("#addabstract") .on('click', function(){
$("#showsetabstract").show();
$("#showallabstract").show();
$("#setabstract").val(1);
});
//删除封面
$("#delabstract") .on('click', function(){
$("#showsetabstract").hide();
$("#showallabstract").hide();
$("#setabstract").val(0);
});
//示例图自定义入口1文本控制
$('#custom_url_name').change(function(){
var str = $(this).val();
if(str=="")
{
str="自定义入口1(选填)";
}
$('#show_custom_url_name').html(str);
});
//示例图自定义入口1引导文本控制
$('#custom_url_sub_title').change(function(){
$('#show_custom_url_sub_title').html($(this).val());
});
//示例图自定义入口2文本控制
$('#promotion_url_name').change(function(){
var str = $(this).val();
if(str=="")
{
str="自定义入口2(选填)";
}
$('#show_promotion_url_name').html(str);
});
//示例图自定义入口2引导文本控制
$('#promotion_url_sub_title').change(function(){
$('#show_promotion_url_sub_title').html($(this).val());
});
//示例图使用条件控制
$("#use_condition") .on('click', function(){
if($(this).prop("checked"))
{
$("#showuse_condition").show();
$("#showuselimit").show();
}else
{
$("#showuse_condition").hide();
$("#showuselimit").hide();
}
});
})
</script>
{template '_footer'}