123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- {extend name="default/base/base_seller" /}
- {block name="seller_main"}
- <div class="dssc-form-default">
- <form id="add_form" method="post">
- {empty name="goods_info"}
- <dl>
- <dt><i class="required">*</i>{$Think.lang.inviter_goods}{$Think.lang.ds_colon}</dt>
- <dd>
- <div dstype="inviter_goods_info" class="selected-group-goods " style="display:none;">
- <div class="goods-thumb"><img id="inviter_goods_image" src=""/></div>
- <div class="goods-name">
- <a dstype="inviter_goods_href" id="inviter_goods_name" href="" target="_blank"></a>
- </div>
- <div class="goods-price">{$Think.lang.mall_price}:¥<span dstype="inviter_goods_price"></span></div>
- </div>
- <a href="javascript:void(0);" id="btn_show_search_goods" class="dssc-btn dssc-btn-acidblue">{$Think.lang.choose_goods}</a>
- <input id="inviter_goods_commonid" name="inviter_goods_commonid" type="hidden" />
- <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"></i>{$Think.lang.ds_search}</a></td>
- <td class="w10"></td>
- <td>
- <p class="hint"></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"></p>
- </dd>
- </dl>
- {else/}
- <dl>
- <dt>{$Think.lang.inviter_goods}{$Think.lang.ds_colon}</dt>
- <dd>
- {$goods_info.goods_name}
- <input id="inviter_goods_commonid" name="inviter_goods_commonid" type="hidden" value="{$goods_info.goods_commonid}" />
- </dd>
- </dl>
- {/empty}
-
- <dl>
- <dt><i class="required">*</i>{$Think.lang.inviter_ratio}{$Think.lang.ds_colon}</dt>
- <dd>
- <input id="inviter_ratio" name="inviter_ratio" type="text" class="text w130" value="{$goods_info.inviter_ratio|default=''}"/>{$Think.lang.ds_percent}<span></span>
- <p class="hint">{$Think.lang.cannot_exceed}100{$Think.lang.ds_percent}</p>
- </dd>
- </dl>
- <div class="bottom">
- <input id="submit_button" type="submit" class="submit" value="{$Think.lang.ds_submit}">
- </div>
- </form>
- </div>
- <link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.css">
- <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.js"></script>
- <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/i18n/jquery-ui-timepicker-zh-CN.js"></script>
- <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('Sellerinviter/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_inviter_goods"]', function() {
- var goods_commonid = $(this).attr('data-goods-commonid');
- $.get("{:url('Sellerinviter/inviter_goods_info')}", {goods_commonid: goods_commonid}, function(data) {
- if(data.result) {
- $('#inviter_goods_commonid').val(data.goods_commonid);
- $('#inviter_goods_image').attr('src', data.goods_image);
- $('#inviter_goods_name').text(data.goods_name);
- $('[dstype="inviter_goods_price"]').text(data.goods_price);
- $('[dstype="inviter_goods_href"]').attr('href', data.goods_href);
- $('[dstype="inviter_goods_info"]').show();
- $('#div_search_goods').hide();
- } else {
- layer.msg(data.message);
- }
- }, 'json');
- });
-
- {empty name = "goods_info"}
- $('#start_time').datetimepicker({dateFormat: 'yy-mm-dd'});
- $('#end_time').datetimepicker({dateFormat: 'yy-mm-dd'});
- {/empty}
-
- jQuery.validator.methods.greaterThanDate = function(value, element, param) {
- var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
- var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
- return date1 < date2;
- };
- jQuery.validator.methods.lessThanDate = function(value, element, param) {
- var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
- var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
- return date1 > date2;
- };
- jQuery.validator.methods.greaterThanStartDate = function(value, element) {
- var start_date = $("#start_time").val();
- var date1 = new Date(Date.parse(start_date.replace(/-/g, "/")));
- var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
- return date1 < date2;
- };
- jQuery.validator.methods.lessThanGoodsPrice= function(value, element) {
- var goods_price = $("#input_groupbuy_goods_price").val();
- return Number(value) < Number(goods_price);
- };
-
- //页面输入内容验证
- $("#add_form").validate({
- errorPlacement: function (error, element) {
- var error_td = element.parent('dd').children('span');
- error_td.append(error);
- },
- onfocusout: false,
- submitHandler: function (form) {
- ds_ajaxpost('add_form', 'url', "{:url('Sellerinviter/goods_list')}");
- },
- rules: {
- inviter_goods_commonid: {
- required: true
- },
- inviter_ratio: {
- required: true,
- number:true,
- max : 100
- },
- },
- messages : {
- inviter_goods_commonid : {
- required : '<i class="iconfont"></i>{$Think.lang.inviter_goods_commonid_required}'
- },
- inviter_ratio: {
- required: '<i class="iconfont"></i>{$Think.lang.inviter_ratio_required}',
- number:'<i class="iconfont"></i>{$Think.lang.inviter_ratio_number}',
- max : '<i class="iconfont"></i>{$Think.lang.inviter_ratio_max}100{$Think.lang.ds_percent}'
- },
- }
- });
- });
- </script>
- {/block}
|