templateadd.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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" enctype="multipart/form-data" action="{if $type == 'add'}{:url('Sellervoucher/templateadd')}{else}{:url('Sellervoucher/templateedit',['tid'=>$t_info.vouchertemplate_id])}{/if}">
  5. <dl>
  6. <dt><i class="required">*</i>{$Think.lang.voucher_template_title}{$Think.lang.ds_colon}</dt>
  7. <dd>
  8. <input type="text" class="w300 text" name="txt_template_title" value="{present name='t_info'}{$t_info.vouchertemplate_title}{/present}">
  9. <span></span>
  10. </dd>
  11. </dl>
  12. {if !$isPlatformStore}
  13. <dl>
  14. <dt><i class="required">*</i>{$Think.lang.store_classification}</dt>
  15. <dd>
  16. <select name="storeclass_id">
  17. <option value="0">{$Think.lang.store_classification}</option>
  18. {foreach name="store_class" item="v"}
  19. <option value="{$v.storeclass_id}" {present name='t_info'}{if $t_info.vouchertemplate_sc_id == $v.storeclass_id}selected{/if}{/present}>{$v.storeclass_name}</option>
  20. {/foreach}
  21. </select>
  22. <span></span>
  23. </dd>
  24. </dl>
  25. {else /}
  26. <input type="hidden" name="storeclass_id" value="{$store_info.storeclass_id}"/>
  27. {/if}
  28. <dl>
  29. <dt><em class="pngFix"></em>{$Think.lang.voucher_template_enddate}{$Think.lang.ds_colon}</dt>
  30. <dd>
  31. <input type="text" class="text w70" id="txt_template_enddate" name="txt_template_enddate" value="" readonly><em class="add-on"><i class="iconfont">&#xe8d6;</i></em>
  32. <span></span><p class="hint">
  33. {if $isPlatformStore}
  34. {$Think.lang.blank_defaults}
  35. {else /}
  36. {$Think.lang.voucher_template_enddate_tip}{$quotainfo.voucherquota_starttime|date="Y-m-d"} ~ {$quotainfo.voucherquota_endtime|date="Y-m-d"}
  37. {/if}
  38. </p>
  39. </dd>
  40. </dl>
  41. <dl>
  42. <dt>{$Think.lang.voucher_template_price}{$Think.lang.ds_colon}</dt>
  43. <dd>
  44. <select id="select_template_price" name="select_template_price" class="w80 vt">
  45. {notempty name="pricelist"}
  46. {foreach name="pricelist" item="val"}
  47. <option value="{$val.voucherprice}" {present name='t_info'}{$t_info.vouchertemplate_price == $val.voucherprice ?'selected':''}{/present}>{$val.voucherprice}</option>
  48. {/foreach}
  49. {/notempty}
  50. </select>
  51. <em class="add-on"><i class="iconfont">&#xe65c;</i></em>
  52. <span></span>
  53. </dd>
  54. </dl>
  55. <dl>
  56. <dt><i class="required">*</i>{$Think.lang.voucher_template_total}{$Think.lang.ds_colon}</dt>
  57. <dd>
  58. <input type="text" class="w70 text" name="txt_template_total" value="{present name='t_info'}{$t_info.vouchertemplate_total}{/present}">
  59. <span></span>
  60. </dd>
  61. </dl>
  62. <dl>
  63. <dt><i class="required">*</i>{$Think.lang.voucher_template_eachlimit}{$Think.lang.ds_colon}</dt>
  64. <dd>
  65. <select name="eachlimit" class="w80">
  66. <option value="0">{$Think.lang.voucher_template_eachlimit_item}</option>
  67. {for start="1" end="config('ds_config.voucher_buyertimes_limit')"}
  68. <option value="{$i}" {$t_info.vouchertemplate_eachlimit == $i ? 'selected':''}>{$i}{$Think.lang.ds_zhang}</option>
  69. {/for}
  70. </select>
  71. </dd>
  72. </dl>
  73. <dl>
  74. <dt><i class="required">*</i>{$Think.lang.voucher_template_orderpricelimit}{$Think.lang.ds_colon}</dt>
  75. <dd>
  76. <input type="text" name="txt_template_limit" class="text w70" value="{present name='t_info'}{$t_info.vouchertemplate_limit}{/present}"><em class="add-on"><i class="iconfont">&#xe65c;</i></em>
  77. <span></span>
  78. </dd>
  79. </dl>
  80. <dl>
  81. <dt><i class="required">*</i>{$Think.lang.voucher_template_describe}{$Think.lang.ds_colon}</dt>
  82. <dd>
  83. <textarea name="txt_template_describe" class="textarea w400 h600">{present name='t_info'}{$t_info.vouchertemplate_desc}{/present}</textarea>
  84. <span></span>
  85. </dd>
  86. </dl>
  87. <dl>
  88. <dt>{$Think.lang.voucher_template_image}{$Think.lang.ds_colon}</dt>
  89. <dd>
  90. <div id="customimg_preview" class="dssc-upload-thumb voucher-pic" style="display: none"><p>
  91. {present name='t_info'}
  92. {if $t_info.vouchertemplate_customimg}
  93. <img src="{$t_info.vouchertemplate_customimg}"/>
  94. {else}
  95. <i class="iconfont">&#xe72a;</i>
  96. {/if}
  97. {/present}</p>
  98. </div>
  99. <div class="dssc-upload-btn">
  100. <a href="javascript:void(0);">
  101. <span>
  102. <input type="file" hidefocus="true" size="1" class="input-file" name="customimg" id="customimg" ds_type="customimg"/>
  103. </span>
  104. <i id="file_name" style="left:100px;position: absolute;white-space: nowrap;"></i>
  105. <p><i class="iconfont">&#xe733;</i>{$Think.lang.image_upload}</p>
  106. </a>
  107. </div>
  108. <p class="hint">{$Think.lang.voucher_template_image_tip}</p>
  109. </dd>
  110. </dl>
  111. <dl>
  112. <dt>{$Think.lang.vouchertemplate_if_private}{$Think.lang.ds_colon}</dt>
  113. <dd>
  114. <ul class="dssc-form-radio-list">
  115. <li><label><input type="radio" name="vouchertemplate_if_private" {if !isset($t_info) || $t_info['vouchertemplate_if_private'] == '1'}checked="checked"{/if} value="1" />{$Think.lang.ds_yes}</label></li>
  116. <li><label><input type="radio" name="vouchertemplate_if_private" {if isset($t_info) && $t_info['vouchertemplate_if_private'] == '0'}checked="checked"{/if} value="0" />{$Think.lang.ds_no}</label></li>
  117. </ul>
  118. <p class="hint">{$Think.lang.vouchertemplate_if_private_tip}</p>
  119. </dd>
  120. </dl>
  121. {if $type== 'edit'}
  122. <dl>
  123. <dt><em class="pngFix"></em>{$Think.lang.ds_status}{$Think.lang.ds_colon}</dt>
  124. <dd>
  125. <input type="radio" value="{$templatestate_arr.usable.0}" name="tstate" {$t_info.vouchertemplate_state == $templatestate_arr.usable.0?'checked':''}> {$templatestate_arr.usable.1}
  126. <input type="radio" value="{$templatestate_arr.disabled.0}" name="tstate" {$t_info.vouchertemplate_state == $templatestate_arr.disabled.0 ?'checked':''}> {$templatestate_arr.disabled.1}
  127. </dd>
  128. </dl>
  129. {/if}
  130. <div class="bottom">
  131. <input id='btn_add' type="button" class="submit" value="{$Think.lang.ds_submit}" />
  132. </div>
  133. </form>
  134. </div>
  135. <script>
  136. //判断是否显示预览模块
  137. {present name='t_info'}
  138. {notempty name='t_info.vouchertemplate_customimg'}
  139. $('#customimg_preview').show();
  140. {/notempty}
  141. {/present}
  142. {if !$isPlatformStore}
  143. var year = {:date('Y',$quotainfo.voucherquota_endtime)};
  144. var month = {:date('m',$quotainfo.voucherquota_endtime)};
  145. var day = {:date('d',$quotainfo.voucherquota_endtime)};
  146. {/if}
  147. $(document).ready(function(){
  148. //日期控件
  149. $('#txt_template_enddate').datepicker({dateFormat: 'yy-mm-dd'});
  150. var currDate = new Date();
  151. var date = currDate.getDate();
  152. date = date + 1;
  153. currDate.setDate(date);
  154. $('#txt_template_enddate').datepicker( "option", "minDate", currDate);
  155. {if !$isPlatformStore}
  156. $('#txt_template_enddate').datepicker( "option", "maxDate", new Date(year,month-1,day));
  157. {/if}
  158. $('#txt_template_enddate').val("{present name='t_info'}{if $t_info.vouchertemplate_enddate}{:date('Y-m-d',$t_info.vouchertemplate_enddate)}{/if}{/present}");
  159. $('#customimg').change(function(){
  160. var src = getFullPath($(this)[0]);
  161. if(navigator.userAgent.indexOf("Firefox")>0){
  162. $('#customimg_preview').show();
  163. $('#customimg_preview').children('p').html('<img src="'+src+'">');
  164. }else{
  165. $('#file_name').text($(this)[0].files[0].name)
  166. }
  167. });
  168. $("#btn_add").click(function(){
  169. if($('#add_form').valid()){
  170. $('#add_form').submit();
  171. }
  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. rules : {
  180. txt_template_title: {
  181. required : true,
  182. rangelength:[0,100]
  183. },
  184. txt_template_total: {
  185. required : true,
  186. digits : true
  187. },
  188. txt_template_limit: {
  189. required : true,
  190. number : true
  191. },
  192. txt_template_describe: {
  193. required : true
  194. }
  195. },
  196. messages : {
  197. txt_template_title: {
  198. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.voucher_template_title_error}',
  199. rangelength : '<i class="iconfont">&#xe64c;</i>{$Think.lang.voucher_template_title_error}'
  200. },
  201. txt_template_total: {
  202. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.voucher_template_total_error}',
  203. digits : '<i class="iconfont">&#xe64c;</i>{$Think.lang.voucher_template_total_error}'
  204. },
  205. txt_template_limit: {
  206. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.voucher_template_limit_error}',
  207. number : '<i class="iconfont">&#xe64c;</i>{$Think.lang.voucher_template_limit_error}'
  208. },
  209. txt_template_describe: {
  210. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.voucher_template_describe_error}'
  211. }
  212. }
  213. });
  214. });
  215. </script>
  216. {/block}