www.lightcourse.com/app/admin/view/promotionmgdiscount/mgdiscount_goods_add.html

137 lines
5.8 KiB
HTML

{include file="public/header" /}
<div class="page">
<div class="fixed-bar">
<div class="item-title">
<div class="subject">
<h3>{$Think.lang.ds_promotion_mgdiscount}</h3>
<h5></h5>
</div>
{include file="public/admin_items" /}
</div>
</div>
<form id="add_form" method="post" class="dssc-form-default">
{empty name="goodscommon_info"}
<dl>
<dt><i class="required">*</i>{$Think.lang.mgdiscount_goods}{$Think.lang.ds_colon}</dt>
<dd>
<div dstype="mgdiscount_goods_info" class="selected-group-goods " style="display:none;">
<div class="goods-thumb"><img id="mgdiscount_goods_image" src=""/></div>
<div class="goods-name">
<a dstype="mgdiscount_goods_href" id="mgdiscount_goods_name" href="" target="_blank"></a>
</div>
<div class="goods-price">{$Think.lang.mall_price}:¥<span dstype="mgdiscount_goods_price"></span></div>
</div>
<a href="javascript:void(0);" id="btn_show_search_goods" class="dssc-btn dssc-btn-acidblue">{$Think.lang.pintuan_goods}</a>
<input id="mgdiscount_goods_id" name="mgdiscount_goods_id" type="hidden" value=""/>
<span></span>
<div id="div_search_goods" class="div-goods-select mt10" style="display: none;">
<table class="search-form">
<tr>
<th class="w150">
<strong>{$Think.lang.search_store_items}</strong>
</th>
<td class="w160">
<input id="search_goods_name" type="text w150" class="text" name="goods_name" value=""/>
</td>
<td class="w70 tc">
<a href="javascript:void(0);" id="btn_search_goods" class="dssc-btn"/><i class="iconfont">&#xe718;</i>{$Think.lang.ds_search}</a></td>
<td class="w10"></td>
<td>
<p class="hint">{$Think.lang.special_goods_not_allowed}</p>
</td>
</tr>
</table>
<div id="div_goods_search_result" class="search-result" style="width:739px;"></div>
<a id="btn_hide_search_goods" class="close" href="javascript:void(0);">X</a>
</div>
<p class="hint">{$Think.lang.mgdiscount_goods_explain}</br><span class="red">{$Think.lang.implement_flat_membership_discount}</span></p>
</dd>
</dl>
{else/}
<dl>
<dt>{$Think.lang.goods_name}</dt>
<dd>
{$goodscommon_info.goods_name}
</dd>
</dl>
{/empty}
{foreach name="mgdiscount_goods_arr" item="v" key="k" }
<dl>
<dt><i class="required">*</i>{$v.level_name}</dt>
<dd>
<input class="w60 text" name="mgdiscount_goods[{$k}][level_discount]" type="text" value="{$v.level_discount|default=''}" maxlength="30" />
<span>{$Think.lang.ds_xianshi_flag}</span>
<p class="hint">{$Think.lang.setting_indicates_no_discount}</p>
</dd>
</dl>
{/foreach}
<div class="bottom">
<input id="submit_button" type="submit" class="btn" value="{$Think.lang.ds_submit}">
</div>
</form>
<script>
$(function () {
$('#btn_show_search_goods').on('click', function () {
$('#div_search_goods').show();
});
$('#btn_hide_search_goods').on('click', function () {
$('#div_search_goods').hide();
});
//搜索商品
$('#btn_search_goods').on('click', function () {
var url = "{:url('Promotionmgdiscount/search_goods')}";
var datas = $.param({goods_name: $('#search_goods_name').val()});
$('#div_goods_search_result').load(url, datas);
});
$('#div_goods_search_result').on('click', '.pagination li a', function () {
$('#div_goods_search_result').load($(this).attr('href'));
return false;
});
//选择商品
$('#div_goods_search_result').on('click', '[dstype="btn_add_mgdiscount_goods"]', function () {
var goods_commonid = $(this).attr('data-goods-commonid');
$.get("{:url('Promotionmgdiscount/mgdiscount_goods_info')}", {goods_commonid: goods_commonid}, function (data) {
if (data.result) {
$('#mgdiscount_goods_id').val(data.goods_id);
$('#mgdiscount_goods_image').attr('src', data.goods_image);
$('#mgdiscount_goods_name').text(data.goods_name);
$('[dstype="mgdiscount_goods_price"]').text(data.goods_price);
$('[dstype="mgdiscount_goods_href"]').attr('href', data.goods_href);
$('[dstype="mgdiscount_goods_info"]').show();
$('#div_search_goods').hide();
} else {
layer.msg(data.message);
}
}, 'json');
});
//页面输入内容验证
$("#add_form").validate({
errorPlacement: function (error, element) {
var error_td = element.parent('dd').children('span');
error_td.append(error);
},
submitHandler: function (form) {
ds_ajaxpost('add_form', 'url', "{:url('Promotionmgdiscount/mgdiscount_goods')}", 1000);
},
rules: {
},
messages: {
}
});
});
</script>
</div>