pintuan_add.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. <dl>
  6. <dt><i class="required">*</i>{$Think.lang.pintuan_name}{$Think.lang.ds_colon}
  7. </dt>
  8. <dd>
  9. <input id="pintuan_name" name="pintuan_name" type="text" maxlength="25" class="text w400" value="{present name='pintuan_info'}{$pintuan_info.pintuan_name}{/present}"/>
  10. <span></span>
  11. <p class="hint">{$Think.lang.pintuan_name_explain}</p>
  12. </dd>
  13. </dl>
  14. {empty name="pintuan_info"}
  15. <dl>
  16. <dt><i class="required">*</i>{$Think.lang.pintuan_starttime}{$Think.lang.ds_colon}
  17. </dt>
  18. <dd>
  19. <input id="start_time" name="start_time" type="text" class="text w130"/><em class="add-on"><i class="iconfont">&#xe8d6;</i></em>
  20. <span></span>
  21. <p class="hint">
  22. {notpresent name="isPlatformStore"}
  23. {if $current_pintuan_quota.pintuanquota_starttime > 1}
  24. {$Think.lang.pintuan_add_start_time_explain}{$current_pintuan_quota.pintuanquota_starttime|date="Y-m-d H:i:s"}
  25. {/if}
  26. {/notpresent}
  27. <br/><span class="red">{$Think.lang.start_time_group_not_modified}</span>
  28. </p>
  29. </dd>
  30. </dl>
  31. <dl>
  32. <dt><i class="required">*</i>{$Think.lang.pintuan_end_time}{$Think.lang.ds_colon}</dt>
  33. <dd>
  34. <input id="end_time" name="end_time" type="text" class="text w130"/><em class="add-on"><i class="iconfont">&#xe8d6;</i></em><span></span>
  35. <p class="hint">
  36. {notpresent name="isPlatformStore"}
  37. {$Think.lang.pintuan_add_end_time_explain}{$current_pintuan_quota.pintuanquota_endtime|date="Y-m-d H:i:s"}
  38. {/notpresent}
  39. <br/><span class="red">{$Think.lang.end_time_group_not_modifiable}</span>
  40. </p>
  41. </dd>
  42. </dl>
  43. {/empty}
  44. {empty name="pintuan_info"}
  45. <dl>
  46. <dt><i class="required">*</i>{$Think.lang.pintuan_goods}{$Think.lang.ds_colon}</dt>
  47. <dd>
  48. <div dstype="pintuan_goods_info" class="selected-group-goods " style="display:none;">
  49. <div class="goods-thumb"><img id="pintuan_goods_image" src=""/></div>
  50. <div class="goods-name">
  51. <a dstype="pintuan_goods_href" id="pintuan_goods_name" href="" target="_blank"></a>
  52. </div>
  53. <div class="goods-price">{$Think.lang.mall_price}:¥<span dstype="pintuan_goods_price"></span></div>
  54. </div>
  55. <a href="javascript:void(0);" id="btn_show_search_goods" class="dssc-btn dssc-btn-acidblue">{$Think.lang.select_goods}</a>
  56. <input id="pintuan_goods_id" name="pintuan_goods_id" type="hidden" value=""/>
  57. <span></span>
  58. <div id="div_search_goods" class="div-goods-select mt10" style="display: none;">
  59. <table class="search-form">
  60. <tr>
  61. <th class="w150">
  62. <strong>{$Think.lang.search_store_goods}</strong>
  63. </th>
  64. <td class="w160">
  65. <input id="search_goods_name" type="text w150" class="text" name="goods_name" value=""/>
  66. </td>
  67. <td class="w70 tc">
  68. <a href="javascript:void(0);" id="btn_search_goods" class="dssc-btn"/><i class="iconfont">&#xe718;</i>{$Think.lang.ds_search}</a></td>
  69. <td class="w10"></td>
  70. <td>
  71. <p class="hint">{$Think.lang.group_information1}</p>
  72. </td>
  73. </tr>
  74. </table>
  75. <div id="div_goods_search_result" class="search-result" style="width:739px;"></div>
  76. <a id="btn_hide_search_goods" class="close" href="javascript:void(0);">X</a>
  77. </div>
  78. <p class="hint">{$Think.lang.pintuan_goods_explain}</br><span class="red">{$Think.lang.group_information2}</span></p>
  79. </dd>
  80. </dl>
  81. {else/}
  82. <dl>
  83. <dt>{$Think.lang.pintuan_goods_name}</dt>
  84. <dd>
  85. {$pintuan_info.pintuan_goods_name}
  86. </dd>
  87. </dl>
  88. {/empty}
  89. <dl>
  90. <dt><i class="required">*</i>{$Think.lang.group_discount}{$Think.lang.ds_colon}</dt>
  91. <dd>
  92. <input id="pintuan_zhe" name="pintuan_zhe" type="text" class="text w130"value="{$pintuan_info.pintuan_zhe|default='1'}"/>{$Think.lang.ds_xianshi_flag}<span></span>
  93. <p class="hint">{$Think.lang.group_discount_notice}</p>
  94. </dd>
  95. </dl>
  96. <dl>
  97. <dt><i class="required">*</i>{$Think.lang.group_size}{$Think.lang.ds_colon}</dt>
  98. <dd>
  99. <input id="pintuan_limit_number" name="pintuan_limit_number" type="text" class="text w130" value="{$pintuan_info.pintuan_limit_number|default='2'}"/><span></span>
  100. <p class="hint">{$Think.lang.group_size_notice}</p>
  101. </dd>
  102. </dl>
  103. <dl>
  104. <dt><i class="required">*</i>{$Think.lang.group_length}{$Think.lang.ds_colon}</dt>
  105. <dd>
  106. <input id="pintuan_limit_hour" name="pintuan_limit_hour" type="text" class="text w130"value="{$pintuan_info.pintuan_limit_hour|default='2'}"/>{$Think.lang.hour}<span></span>
  107. <p class="hint">{$Think.lang.group_length_notice}</p>
  108. </dd>
  109. </dl>
  110. <dl>
  111. <dt><i class="required">*</i>{$Think.lang.purchase_restriction}{$Think.lang.ds_colon}</dt>
  112. <dd>
  113. <input id="pintuan_limit_quantity" name="pintuan_limit_quantity" type="text" class="text w130"value="{$pintuan_info.pintuan_limit_quantity|default='1'}"/><span></span>
  114. <p class="hint">{$Think.lang.purchase_restriction_notice}</p>
  115. </dd>
  116. </dl>
  117. <div class="bottom">
  118. <input id="submit_button" type="submit" class="submit" value="{$Think.lang.ds_submit}">
  119. </div>
  120. </form>
  121. </div>
  122. <link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.css">
  123. <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.js"></script>
  124. <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/i18n/jquery-ui-timepicker-zh-CN.js"></script>
  125. <script>
  126. $(function () {
  127. $('#btn_show_search_goods').on('click', function() {
  128. $('#div_search_goods').show();
  129. });
  130. $('#btn_hide_search_goods').on('click', function() {
  131. $('#div_search_goods').hide();
  132. });
  133. //搜索商品
  134. $('#btn_search_goods').on('click', function() {
  135. var url = "{:url('Sellerpromotionpintuan/search_goods')}";
  136. var datas = $.param({goods_name: $('#search_goods_name').val()});
  137. $('#div_goods_search_result').load(url,datas);
  138. });
  139. $('#div_goods_search_result').on('click', '.pagination li a', function() {
  140. $('#div_goods_search_result').load($(this).attr('href'));
  141. return false;
  142. });
  143. //选择商品
  144. $('#div_goods_search_result').on('click', '[dstype="btn_add_pintuan_goods"]', function() {
  145. var goods_commonid = $(this).attr('data-goods-commonid');
  146. $.get("{:url('Sellerpromotionpintuan/pintuan_goods_info')}", {goods_commonid: goods_commonid}, function(data) {
  147. if(data.result) {
  148. $('#pintuan_goods_id').val(data.goods_id);
  149. $('#pintuan_goods_image').attr('src', data.goods_image);
  150. $('#pintuan_goods_name').text(data.goods_name);
  151. $('[dstype="pintuan_goods_price"]').text(data.goods_price);
  152. $('[dstype="pintuan_goods_href"]').attr('href', data.goods_href);
  153. $('[dstype="pintuan_goods_info"]').show();
  154. $('#div_search_goods').hide();
  155. } else {
  156. layer.msg(data.message);
  157. }
  158. }, 'json');
  159. });
  160. {empty name = "pintuan_info"}
  161. $('#start_time').datetimepicker({dateFormat: 'yy-mm-dd'});
  162. $('#end_time').datetimepicker({dateFormat: 'yy-mm-dd'});
  163. {/empty}
  164. jQuery.validator.methods.greaterThanDate = function(value, element, param) {
  165. var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
  166. var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
  167. return date1 < date2;
  168. };
  169. jQuery.validator.methods.lessThanDate = function(value, element, param) {
  170. var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
  171. var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
  172. return date1 > date2;
  173. };
  174. jQuery.validator.methods.greaterThanStartDate = function(value, element) {
  175. var start_date = $("#start_time").val();
  176. var date1 = new Date(Date.parse(start_date.replace(/-/g, "/")));
  177. var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
  178. return date1 < date2;
  179. };
  180. jQuery.validator.methods.lessThanGoodsPrice= function(value, element) {
  181. var goods_price = $("#input_groupbuy_goods_price").val();
  182. return Number(value) < Number(goods_price);
  183. };
  184. //页面输入内容验证
  185. $("#add_form").validate({
  186. errorPlacement: function (error, element) {
  187. var error_td = element.parent('dd').children('span');
  188. error_td.append(error);
  189. },
  190. onfocusout: false,
  191. submitHandler: function (form) {
  192. ds_ajaxpost('add_form', 'url', "{:url('Sellerpromotionpintuan/index')}", 1000);
  193. },
  194. rules: {
  195. pintuan_name: {
  196. required: true
  197. },
  198. pintuan_zhe: {
  199. required: true,
  200. digits:true,
  201. range : [1,9]
  202. },
  203. pintuan_limit_number: {
  204. required: true,
  205. digits:true,
  206. min:2
  207. },
  208. start_time: {
  209. required: true,
  210. greaterThanDate: "{:date('Y-m-d H:i',@$current_pintuan_quota['pintuanquota_starttime'])}"
  211. },
  212. end_time: {
  213. required: true,
  214. {if !$isPlatformStore}
  215. lessThanDate : "{present name='current_pintuan_quota.pintuanquota_starttime'}{$current_pintuan_quota.pintuanquota_endtime|date='Y-m-d H:i'}{/present}",
  216. {/if}
  217. greaterThanStartDate: true
  218. },
  219. },
  220. messages : {
  221. pintuan_name : {
  222. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.pintuan_name_error}'
  223. },
  224. pintuan_zhe: {
  225. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.discount_cannot_empty}',
  226. digits: '<i class="iconfont">&#xe64c;</i>{$Think.lang.discount_must_figures}',
  227. range: '<i class="iconfont">&#xe64c;</i>{$Think.lang.please_fill_figure}'
  228. },
  229. pintuan_limit_number: {
  230. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.group_must_not_empty}',
  231. digits: '<i class="iconfont">&#xe64c;</i>{$Think.lang.number_groups_must_number}',
  232. min: '<i class="iconfont">&#xe64c;</i>{$Think.lang.number_groups_cannot_less_than}'
  233. },
  234. start_time : {
  235. required : '<i class="iconfont">&#xe64c;</i>' + "<?php echo sprintf(lang('pintuan_add_start_time_explain'),@date('Y-m-d H:i',$current_pintuan_quota['pintuanquota_starttime']));?>",
  236. greaterThanDate : '<i class="iconfont">&#xe64c;</i>' + "<?php echo sprintf(lang('pintuan_add_start_time_explain'),@date('Y-m-d H:i',$current_pintuan_quota['pintuanquota_starttime']));?>"
  237. },
  238. end_time : {
  239. required : '<i class="iconfont">&#xe64c;</i>' + "<?php echo sprintf(lang('pintuan_add_end_time_explain'),@date('Y-m-d H:i',$current_pintuan_quota['pintuanquota_endtime']));?>",
  240. {if !$isPlatformStore}
  241. lessThanDate : '<i class="iconfont">&#xe64c;</i>' +
  242. "<?php echo sprintf(lang('pintuan_add_end_time_explain'),@date('Y-m-d H:i',$current_pintuan_quota['pintuanquota_endtime']));?>",
  243. {/if}
  244. greaterThanStartDate : '<i class="iconfont">&#xe64c;</i>{$Think.lang.greater_than_start_time}'
  245. },
  246. }
  247. });
  248. });
  249. </script>
  250. {/block}