bargain_add.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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.bargain_name}{$Think.lang.ds_colon}
  7. </dt>
  8. <dd>
  9. <input id="bargain_name" name="bargain_name" type="text" maxlength="25" class="text w400" value="{present name='bargain_info'}{$bargain_info.bargain_name}{/present}"/>
  10. <span></span>
  11. <p class="hint">{$Think.lang.bargain_name_explain}</p>
  12. </dd>
  13. </dl>
  14. {empty name="bargain_info"}
  15. <dl>
  16. <dt><i class="required">*</i>{$Think.lang.bargain_begintime}{$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_bargain_quota.bargainquota_starttime > 1}
  24. {$Think.lang.bargain_add_start_time_explain}{$current_bargain_quota.bargainquota_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.bargain_endtime}{$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.bargain_add_end_time_explain}{$current_bargain_quota.bargainquota_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="bargain_info"}
  45. <dl>
  46. <dt><i class="required">*</i>{$Think.lang.bargain_goods}{$Think.lang.ds_colon}</dt>
  47. <dd>
  48. <div dstype="bargain_goods_info" class="selected-group-goods " style="display:none;">
  49. <div class="goods-thumb"><img id="bargain_goods_image" src=""/></div>
  50. <div class="goods-name">
  51. <a dstype="bargain_goods_href" id="bargain_goods_name" href="" target="_blank"></a>
  52. </div>
  53. <div class="goods-price">{$Think.lang.mall_price}:¥<span dstype="bargain_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="bargain_goods_id" name="bargain_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.bargain_goods_explain}</p>
  79. </dd>
  80. </dl>
  81. {else/}
  82. <dl>
  83. <dt>{$Think.lang.bargain_goods_name}</dt>
  84. <dd>
  85. {$bargain_info.bargain_goods_name}
  86. </dd>
  87. </dl>
  88. {/empty}
  89. <dl>
  90. <dt><i class="required">*</i>{$Think.lang.sellerpromotionbargain_floorprice}{$Think.lang.ds_colon}</dt>
  91. <dd>
  92. <input id="bargain_limit_number" name="bargain_floorprice" type="text" class="text w130" value="{$bargain_info.bargain_floorprice|default=''}"/>{$Think.lang.ds_yuan}<span></span>
  93. <p class="hint">{$Think.lang.sellerpromotionbargain_floorprice_explain}</p>
  94. </dd>
  95. </dl>
  96. <dl>
  97. <dt><i class="required">*</i>{$Think.lang.sellerpromotionbargain_limit}{$Think.lang.ds_colon}</dt>
  98. <dd>
  99. <input id="bargain_zhe" name="bargain_limit" type="text" class="text w130" value="{$bargain_info.bargain_limit|default='1'}"/><span></span>
  100. <p class="hint">{$Think.lang.sellerpromotionbargain_limit_explain}</p>
  101. </dd>
  102. </dl>
  103. <dl>
  104. <dt><i class="required">*</i>{$Think.lang.sellerpromotionbargain_time}{$Think.lang.ds_colon}</dt>
  105. <dd>
  106. <input id="bargain_limit_hour" name="bargain_time" type="text" class="text w130" value="{$bargain_info.bargain_time|default='2'}"/>{$Think.lang.hour}<span></span>
  107. <p class="hint">{$Think.lang.sellerpromotionbargain_time_explain}</p>
  108. </dd>
  109. </dl>
  110. <dl>
  111. <dt><i class="required">*</i>{$Think.lang.sellerpromotionbargain_total}{$Think.lang.ds_colon}</dt>
  112. <dd>
  113. <input id="bargain_limit_quantity" name="bargain_total" type="text" class="text w130" value="{$bargain_info.bargain_total|default='20'}"/><span></span>
  114. <p class="hint">{$Think.lang.sellerpromotionbargain_total_explain}</p>
  115. </dd>
  116. </dl>
  117. <dl>
  118. <dt><i class="required">*</i>{$Think.lang.sellerpromotionbargain_max}{$Think.lang.ds_colon}</dt>
  119. <dd>
  120. <input id="bargain_limit_quantity" name="bargain_max" type="text" class="text w130" value="{$bargain_info.bargain_max|default='1'}"/>{$Think.lang.ds_yuan}<span></span>
  121. <p class="hint">{$Think.lang.sellerpromotionbargain_max_explain}</p>
  122. </dd>
  123. </dl>
  124. <dl>
  125. <dt>{$Think.lang.sellerpromotionbargain_remark}{$Think.lang.ds_colon}
  126. </dt>
  127. <dd>
  128. <input id="bargain_name" name="bargain_remark" type="text" maxlength="25" class="text w400" value="{present name='bargain_info'}{$bargain_info.bargain_remark}{/present}"/>
  129. <span></span>
  130. <p class="hint"></p>
  131. </dd>
  132. </dl>
  133. <div class="bottom">
  134. <input id="submit_button" type="submit" class="submit" value="{$Think.lang.ds_submit}">
  135. </div>
  136. </form>
  137. </div>
  138. <link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.css">
  139. <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.js"></script>
  140. <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/i18n/jquery-ui-timepicker-zh-CN.js"></script>
  141. <script>
  142. $(function () {
  143. $('#btn_show_search_goods').on('click', function() {
  144. $('#div_search_goods').show();
  145. });
  146. $('#btn_hide_search_goods').on('click', function() {
  147. $('#div_search_goods').hide();
  148. });
  149. //搜索商品
  150. $('#btn_search_goods').on('click', function() {
  151. var url = "{:url('Sellerpromotionbargain/search_goods')}";
  152. var datas = $.param({goods_name: $('#search_goods_name').val()});
  153. $('#div_goods_search_result').load(url,datas);
  154. });
  155. $('#div_goods_search_result').on('click', '.pagination li a', function() {
  156. $('#div_goods_search_result').load($(this).attr('href'));
  157. return false;
  158. });
  159. //选择商品
  160. $('#div_goods_search_result').on('click', '[dstype="btn_add_bargain_goods"]', function() {
  161. var goods_id = $(this).attr('data-goods-id');
  162. $.get("{:url('Sellerpromotionbargain/bargain_goods_info')}", {goods_id: goods_id}, function(data) {
  163. if(data.result) {
  164. $('#bargain_goods_id').val(data.goods_id);
  165. $('#bargain_goods_image').attr('src', data.goods_image);
  166. $('#bargain_goods_name').text(data.goods_name);
  167. $('[dstype="bargain_goods_price"]').text(data.goods_price);
  168. $('[dstype="bargain_goods_href"]').attr('href', data.goods_href);
  169. $('[dstype="bargain_goods_info"]').show();
  170. $('#div_search_goods').hide();
  171. } else {
  172. layer.msg(data.message);
  173. }
  174. }, 'json');
  175. });
  176. {empty name = "bargain_info"}
  177. $('#start_time').datetimepicker({dateFormat: 'yy-mm-dd'});
  178. $('#end_time').datetimepicker({dateFormat: 'yy-mm-dd'});
  179. {/empty}
  180. jQuery.validator.methods.greaterThanDate = function(value, element, param) {
  181. var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
  182. var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
  183. return date1 < date2;
  184. };
  185. jQuery.validator.methods.lessThanDate = function(value, element, param) {
  186. var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
  187. var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
  188. return date1 > date2;
  189. };
  190. jQuery.validator.methods.greaterThanStartDate = function(value, element) {
  191. var start_date = $("#start_time").val();
  192. var date1 = new Date(Date.parse(start_date.replace(/-/g, "/")));
  193. var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
  194. return date1 < date2;
  195. };
  196. jQuery.validator.methods.lessThanGoodsPrice= function(value, element) {
  197. var goods_price = $("#input_groupbuy_goods_price").val();
  198. return Number(value) < Number(goods_price);
  199. };
  200. //页面输入内容验证
  201. $("#add_form").validate({
  202. errorPlacement: function (error, element) {
  203. var error_td = element.parent('dd').children('span');
  204. error_td.append(error);
  205. },
  206. onfocusout: false,
  207. submitHandler: function (form) {
  208. ds_ajaxpost('add_form', 'url', "{:url('Sellerpromotionbargain/index')}", 1000);
  209. },
  210. rules: {
  211. bargain_name: {
  212. required: true
  213. },
  214. bargain_zhe: {
  215. required: true,
  216. digits:true,
  217. range : [1,9]
  218. },
  219. bargain_limit_number: {
  220. required: true,
  221. digits:true,
  222. min:2
  223. },
  224. start_time: {
  225. required: true,
  226. greaterThanDate: "{:date('Y-m-d H:i',@$current_bargain_quota['bargainquota_starttime'])}"
  227. },
  228. end_time: {
  229. required: true,
  230. {if !$isPlatformStore}
  231. lessThanDate : "{present name='current_bargain_quota.bargainquota_starttime'}{$current_bargain_quota.bargainquota_endtime|date='Y-m-d H:i'}{/present}",
  232. {/if}
  233. greaterThanStartDate: true
  234. },
  235. },
  236. messages : {
  237. bargain_name : {
  238. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.bargain_name_error}'
  239. },
  240. bargain_zhe: {
  241. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.discount_cannot_empty}',
  242. digits: '<i class="iconfont">&#xe64c;</i>{$Think.lang.discount_must_figures}',
  243. range: '<i class="iconfont">&#xe64c;</i>{$Think.lang.please_fill_figure}'
  244. },
  245. bargain_limit_number: {
  246. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.group_must_not_empty}',
  247. digits: '<i class="iconfont">&#xe64c;</i>{$Think.lang.number_groups_must_number}',
  248. min: '<i class="iconfont">&#xe64c;</i>{$Think.lang.number_groups_cannot_less_than}'
  249. },
  250. start_time : {
  251. required : '<i class="iconfont">&#xe64c;</i>' + "<?php echo sprintf(lang('bargain_add_start_time_explain'),@date('Y-m-d H:i',$current_bargain_quota['bargainquota_starttime']));?>",
  252. greaterThanDate : '<i class="iconfont">&#xe64c;</i>' + "<?php echo sprintf(lang('bargain_add_start_time_explain'),@date('Y-m-d H:i',$current_bargain_quota['bargainquota_starttime']));?>"
  253. },
  254. end_time : {
  255. required : '<i class="iconfont">&#xe64c;</i>' + "<?php echo sprintf(lang('bargain_add_end_time_explain'),@date('Y-m-d H:i',$current_bargain_quota['bargainquota_endtime']));?>",
  256. {if !$isPlatformStore}
  257. lessThanDate : '<i class="iconfont">&#xe64c;</i>' +
  258. "<?php echo sprintf(lang('bargain_add_end_time_explain'),@date('Y-m-d H:i',$current_bargain_quota['bargainquota_endtime']));?>",
  259. {/if}
  260. greaterThanStartDate : '<i class="iconfont">&#xe64c;</i>{$Think.lang.greater_than_start_time}'
  261. },
  262. }
  263. });
  264. });
  265. </script>
  266. {/block}