presell_add.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. {extend name="default/base/base_seller" /}
  2. {block name="seller_main"}
  3. <div class="dssc-form-default">
  4. <form id="add_form" method="post">
  5. {empty name="presell_info"}
  6. <dl>
  7. <dt><i class="required">*</i>{$Think.lang.presell_type}{$Think.lang.ds_colon}</dt>
  8. <dd>
  9. <ul class="dssc-form-radio-list">
  10. <li><label onclick="$('*[dstype=type_2]').hide();$('*[dstype=type_1]').show();"><input type="radio" name="presell_type" {if !isset($presell_info) || $presell_info['presell_type'] == '1'}checked="checked"{/if} value="1" />{$Think.lang.presell_type_1}</label></li>
  11. <li><label onclick="$('*[dstype=type_2]').show();$('*[dstype=type_1]').hide()"><input type="radio" name="presell_type" {if isset($presell_info) && $presell_info['presell_type'] == '2'}checked="checked"{/if} value="2" />{$Think.lang.presell_type_2}</label></li>
  12. </ul>
  13. <p class="red">{$Think.lang.presell_type_notice}</p>
  14. </dd>
  15. </dl>
  16. <dl>
  17. <dt><i class="required">*</i>{$Think.lang.presell_start_time}{$Think.lang.ds_colon}
  18. </dt>
  19. <dd>
  20. <input id="start_time" name="start_time" type="text" class="text w130"/><em class="add-on"><i class="iconfont">&#xe8d6;</i></em>
  21. <span></span>
  22. <p class="hint">
  23. {notpresent name="isPlatformStore"}
  24. {if $current_presell_quota.presellquota_starttime > 1}
  25. {$Think.lang.presell_add_start_time_explain}{$current_presell_quota.presellquota_starttime|date="Y-m-d H:i:s"}
  26. {/if}
  27. {/notpresent}
  28. <br/><span class="red">{$Think.lang.start_time_group_not_modified}</span>
  29. </p>
  30. </dd>
  31. </dl>
  32. <dl>
  33. <dt><i class="required">*</i>{$Think.lang.presell_end_time}{$Think.lang.ds_colon}</dt>
  34. <dd>
  35. <input id="end_time" name="end_time" type="text" class="text w130"/><em class="add-on"><i class="iconfont">&#xe8d6;</i></em><span></span>
  36. <p class="hint">
  37. {notpresent name="isPlatformStore"}
  38. {$Think.lang.presell_add_end_time_explain}{$current_presell_quota.presellquota_endtime|date="Y-m-d H:i:s"}
  39. {/notpresent}
  40. <br/><span class="red">{$Think.lang.end_time_group_not_modifiable}</span>
  41. </p>
  42. </dd>
  43. </dl>
  44. <dl>
  45. <dt><i class="required">*</i>{$Think.lang.presell_goods}{$Think.lang.ds_colon}</dt>
  46. <dd>
  47. <div dstype="presell_goods_info" class="selected-group-goods " style="display:none;">
  48. <div class="goods-thumb"><img id="presell_goods_image" src=""/></div>
  49. <div class="goods-name">
  50. <a dstype="presell_goods_href" id="presell_goods_name" href="" target="_blank"></a>
  51. </div>
  52. <div class="goods-price">{$Think.lang.mall_price}:¥<span dstype="presell_goods_price"></span></div>
  53. </div>
  54. <a href="javascript:void(0);" id="btn_show_search_goods" class="dssc-btn dssc-btn-acidblue">{$Think.lang.select_goods}</a>
  55. <input id="presell_goods_id" name="presell_goods_id" type="hidden" value=""/>
  56. <span></span>
  57. <div id="div_search_goods" class="div-goods-select mt10" style="display: none;">
  58. <table class="search-form">
  59. <tr>
  60. <th class="w150">
  61. <strong>{$Think.lang.search_store_goods}</strong>
  62. </th>
  63. <td class="w160">
  64. <input id="search_goods_name" type="text w150" class="text" name="goods_name" value=""/>
  65. </td>
  66. <td class="w70 tc">
  67. <a href="javascript:void(0);" id="btn_search_goods" class="dssc-btn"/><i class="iconfont">&#xe718;</i>{$Think.lang.ds_search}</a></td>
  68. <td class="w10"></td>
  69. <td>
  70. <p class="hint">{$Think.lang.group_information1}</p>
  71. </td>
  72. </tr>
  73. </table>
  74. <div id="div_goods_search_result" class="search-result" style="width:739px;"></div>
  75. <a id="btn_hide_search_goods" class="close" href="javascript:void(0);">X</a>
  76. </div>
  77. <p class="hint">{$Think.lang.presell_goods_explain}</p>
  78. </dd>
  79. </dl>
  80. {else/}
  81. <dl>
  82. <dt>{$Think.lang.presell_goods_name}</dt>
  83. <dd>
  84. {$presell_info.goods_name}
  85. </dd>
  86. </dl>
  87. {/empty}
  88. <dl>
  89. <dt><i class="required">*</i>{$Think.lang.presell_price}{$Think.lang.ds_colon}</dt>
  90. <dd>
  91. <input id="presell_limit_number" name="presell_price" type="text" class="text w130" value="{$presell_info.presell_price|default=''}"/>{$Think.lang.ds_yuan}<span></span>
  92. <p class="hint"></p>
  93. </dd>
  94. </dl>
  95. <dl dstype="type_2" {if !isset($presell_info) || $presell_info['presell_type'] == '1'}style="display:none"{/if}>
  96. <dt><i class="required">*</i>{$Think.lang.presell_deposit_amount}{$Think.lang.ds_colon}</dt>
  97. <dd>
  98. <input id="presell_deposit_amount" name="presell_deposit_amount" type="text" class="text w130" value="{$presell_info.presell_deposit_amount|default=''}"/>{$Think.lang.ds_yuan}<span></span>
  99. <p class="hint">{$Think.lang.presell_deposit_amount_explain}</p>
  100. </dd>
  101. </dl>
  102. <dl dstype="type_1" {if isset($presell_info) && $presell_info['presell_type'] == '2'}style="display:none"{/if}>
  103. <dt><i class="required">*</i>{$Think.lang.presell_shipping_time}{$Think.lang.ds_colon}</dt>
  104. <dd>
  105. <input id="presell_shipping_time" name="presell_shipping_time" type="text" class="text w130" value="{if isset($presell_info)}{:date('Y-m-d',$presell_info.presell_shipping_time)}{/if}"/><em class="add-on"><i class="iconfont">&#xe8d6;</i></em><span></span>
  106. <p class="hint"></p>
  107. </dd>
  108. </dl>
  109. <div class="bottom">
  110. <input id="submit_button" type="submit" class="submit" value="{$Think.lang.ds_submit}">
  111. </div>
  112. </form>
  113. </div>
  114. <link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.css">
  115. <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.js"></script>
  116. <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/i18n/jquery-ui-timepicker-zh-CN.js"></script>
  117. <script>
  118. $(function () {
  119. $('#btn_show_search_goods').on('click', function() {
  120. $('#div_search_goods').show();
  121. });
  122. $('#btn_hide_search_goods').on('click', function() {
  123. $('#div_search_goods').hide();
  124. });
  125. //搜索商品
  126. $('#btn_search_goods').on('click', function() {
  127. var url = "{:url('Sellerpromotionpresell/search_goods')}";
  128. var datas = $.param({goods_name: $('#search_goods_name').val()});
  129. $('#div_goods_search_result').load(url,datas);
  130. });
  131. $('#div_goods_search_result').on('click', '.pagination li a', function() {
  132. $('#div_goods_search_result').load($(this).attr('href'));
  133. return false;
  134. });
  135. //选择商品
  136. $('#div_goods_search_result').on('click', '[dstype="btn_add_presell_goods"]', function() {
  137. var goods_id = $(this).attr('data-goods-id');
  138. $.get("{:url('Sellerpromotionpresell/presell_goods_info')}", {goods_id: goods_id}, function(data) {
  139. if(data.result) {
  140. $('#presell_goods_id').val(data.goods_id);
  141. $('#presell_goods_image').attr('src', data.goods_image);
  142. $('#presell_goods_name').text(data.goods_name);
  143. $('[dstype="presell_goods_price"]').text(data.goods_price);
  144. $('[dstype="presell_goods_href"]').attr('href', data.goods_href);
  145. $('[dstype="presell_goods_info"]').show();
  146. $('#div_search_goods').hide();
  147. } else {
  148. layer.msg(data.message);
  149. }
  150. }, 'json');
  151. });
  152. {empty name = "presell_info"}
  153. $('#start_time').datetimepicker({dateFormat: 'yy-mm-dd'});
  154. $('#end_time').datetimepicker({dateFormat: 'yy-mm-dd'});
  155. {/empty}
  156. $('#presell_shipping_time').datetimepicker({dateFormat: 'yy-mm-dd'});
  157. jQuery.validator.methods.greaterThanDate = function(value, element, param) {
  158. var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
  159. var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
  160. return date1 < date2;
  161. };
  162. jQuery.validator.methods.lessThanDate = function(value, element, param) {
  163. var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
  164. var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
  165. return date1 > date2;
  166. };
  167. jQuery.validator.methods.greaterThanStartDate = function(value, element) {
  168. var start_date = $("#start_time").val();
  169. var date1 = new Date(Date.parse(start_date.replace(/-/g, "/")));
  170. var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
  171. return date1 < date2;
  172. };
  173. //页面输入内容验证
  174. $("#add_form").validate({
  175. errorPlacement: function (error, element) {
  176. var error_td = element.parent('dd').children('span');
  177. error_td.append(error);
  178. },
  179. onfocusout: false,
  180. submitHandler: function (form) {
  181. ds_ajaxpost('add_form', 'url', "{:url('Sellerpromotionpresell/index')}", 1000);
  182. },
  183. rules: {
  184. start_time: {
  185. required: true,
  186. greaterThanDate: "{:date('Y-m-d H:i',@$current_presell_quota['presellquota_starttime'])}"
  187. },
  188. end_time: {
  189. required: true,
  190. {if !$isPlatformStore}
  191. lessThanDate : "{present name='current_presell_quota.presellquota_starttime'}{$current_presell_quota.presellquota_endtime|date='Y-m-d H:i'}{/present}",
  192. {/if}
  193. greaterThanStartDate: true
  194. },
  195. },
  196. messages : {
  197. start_time : {
  198. required : '<i class="iconfont">&#xe64c;</i>' + "<?php echo sprintf(lang('presell_add_start_time_explain'),@date('Y-m-d H:i',$current_presell_quota['presellquota_starttime']));?>",
  199. greaterThanDate : '<i class="iconfont">&#xe64c;</i>' + "<?php echo sprintf(lang('presell_add_start_time_explain'),@date('Y-m-d H:i',$current_presell_quota['presellquota_starttime']));?>"
  200. },
  201. end_time : {
  202. required : '<i class="iconfont">&#xe64c;</i>' + "<?php echo sprintf(lang('presell_add_end_time_explain'),@date('Y-m-d H:i',$current_presell_quota['presellquota_endtime']));?>",
  203. {if !$isPlatformStore}
  204. lessThanDate : '<i class="iconfont">&#xe64c;</i>' +
  205. "<?php echo sprintf(lang('presell_add_end_time_explain'),@date('Y-m-d H:i',$current_presell_quota['presellquota_endtime']));?>",
  206. {/if}
  207. greaterThanStartDate : '<i class="iconfont">&#xe64c;</i>{$Think.lang.greater_than_start_time}'
  208. },
  209. }
  210. });
  211. });
  212. </script>
  213. {/block}