prod_add.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. {include file="public/header" /}
  2. <div class="page">
  3. <div class="fixed-bar">
  4. <div class="item-title">
  5. <div class="subject">
  6. <h3>{$Think.lang.ds_pointprod}</h3>
  7. <h5></h5>
  8. </div>
  9. {include file="public/admin_items" /}
  10. </div>
  11. </div>
  12. <form id="pointprod_form" method="post" enctype="multipart/form-data" >
  13. <table class="ds-default-table">
  14. <thead>
  15. <tr class="space">
  16. <th colspan="3">{$Think.lang.admin_pointprod_baseinfo}</th>
  17. </tr>
  18. </thead>
  19. <tbody>
  20. <tr>
  21. <th class="required" style="line-height:normal; border-top: 1px dotted #CBE9F3;"><label for="">{$Think.lang.admin_pointprod_goods_image}:</label></th>
  22. <td colspan="2" class="required"><label class="validation" for="goodsname">{$Think.lang.admin_pointprod_goods_name}:</label></td>
  23. </tr>
  24. <tr class="noborder">
  25. <th rowspan="6" class="picture"><div class="size-200x200"><span class="thumb size-200x200"><i></i><img src="{:ds_get_pic(ATTACH_COMMON,$Think.config.ds_config.default_goods_image)}" onload="javascript:ResizeImage(this,200,200);" ds_type="goods_image" /></span></div>
  26. </th>
  27. <td class="vatop rowform"><input type="text" name="goodsname" id="goodsname" class="txt"/></td>
  28. <td class="vatop tips"></td>
  29. </tr>
  30. <tr>
  31. <td colspan="2" class="required"><label class="validation" for="goodsprice">{$Think.lang.admin_pointprod_goods_price}:</label></td>
  32. </tr>
  33. <tr class="noborder">
  34. <td class="vatop rowform"><input type="text" name="goodsprice" id="goodsprice" class="txt"/></td>
  35. <td class="vatop tips"></td>
  36. </tr>
  37. <tr>
  38. <td colspan="2" class="required"><label class="validation" for="goodspoints">{$Think.lang.admin_pointprod_goods_points}:</label></td>
  39. </tr>
  40. <tr class="noborder">
  41. <td class="vatop rowform"><input type="text" name="goodspoints" id="goodspoints" class="txt"/></td>
  42. <td class="vatop tips"></td>
  43. </tr>
  44. <tr>
  45. <td colspan="2" class="required"><label class="validation" for="goodsserial">{$Think.lang.admin_pointprod_goods_serial}:</label></td>
  46. </tr>
  47. <tr class="noborder">
  48. <th style="line-height:normal;"><span class="type-file-box">
  49. <input name="goods_images" type="file" class="type-file-file" id="goods_images" size="30" hidefocus="true" ds_type="change_goods_image">
  50. </span> </th>
  51. <td class="vatop rowform"><input type="text" name="goodsserial" id="goodsserial" class="txt"/></td>
  52. <td class="vatop tips"></td>
  53. </tr>
  54. <tr>
  55. <th class="required" style="line-height:normal; border-top: 1px dotted #CBE9F3;"><label for="goodstag">{$Think.lang.admin_pointprod_goods_tag}:</label></th>
  56. <td colspan="2" class="required"><label class="validation" for="goodsstorage">{$Think.lang.admin_pointprod_goods_storage}:</label></td>
  57. </tr>
  58. <tr class="noborder">
  59. <td class="vatop rowform"><input type="text" name="goodstag" id="goodstag" class="txt"/></td>
  60. <td class="vatop rowform"><input type="text" name="goodsstorage" id="goodsstorage" class="txt"/></td>
  61. <td class="vatop tips"></td>
  62. </tr>
  63. <tr class="space">
  64. <th colspan="3">{$Think.lang.admin_pointprod_requireinfo}</th>
  65. </tr>
  66. <tr>
  67. <td colspan="3" class="required"><label>{$Think.lang.admin_pointprod_limittip}:</label></td>
  68. </tr>
  69. <tr class="noborder">
  70. <td class="vatop rowform"><input type="radio" name="islimit" id="islimit_1" value="1" onclick="showlimit();"/>
  71. &nbsp;{$Think.lang.admin_pointprod_limit_yes}&nbsp;
  72. <input type="radio" name="islimit" id="islimit_0" value="0" checked="checked" onclick="showlimit();"/>
  73. &nbsp;{$Think.lang.admin_pointprod_limit_no}</td>
  74. <td colspan="2" class="vatop tips"></td>
  75. </tr>
  76. </tbody>
  77. <tbody id="limitnum_div">
  78. <tr class="noborder">
  79. <td colspan="3" class="required"><label for="limitnum">{$Think.lang.admin_pointprod_limitnum}:</label></td>
  80. </tr>
  81. <tr class="noborder">
  82. <td class="vatop rowform"><input type="text" name="limitnum" id="limitnum" class="txt" value="1" /></td>
  83. <td colspan="2" class="vatop tips"></td>
  84. </tr>
  85. </tbody>
  86. <tbody>
  87. <tr>
  88. <td colspan="3" class="required"><label>{$Think.lang.admin_pointprod_limittimetip}:</label></td>
  89. </tr>
  90. <tr class="noborder">
  91. <td class="vatop rowform"><input type="radio" name="islimittime" id="islimittime_1" value="1" onclick="showlimittime();"/>
  92. &nbsp;{$Think.lang.admin_pointprod_limittime_yes}&nbsp;
  93. <input type="radio" name="islimittime" id="islimittime_0" value="0" checked="checked" onclick="showlimittime();"/>
  94. &nbsp;{$Think.lang.admin_pointprod_limittime_no}</td>
  95. <td colspan="2" class="vatop tips"></td>
  96. </tr>
  97. </tbody>
  98. <tbody name="limittime_div">
  99. <tr class="noborder">
  100. <td class="required"><label>{$Think.lang.ds_start_time}: </label></td>
  101. <td colspan="2" class="required"><label>{$Think.lang.ds_end_time}: </label></td>
  102. </tr>
  103. <tr class="noborder">
  104. <td class="vatop rowform"><input type="text" name="starttime" id="starttime" class="txt date" style="width:100px;" value="{$Think.TIMESTAMP|date='Y-m-d'}"/>{$Think.lang.admin_pointprod_time_day}
  105. <select id="starthour" name="starthour" style="margin-left: 8px; _margin-left: 4px; width:60px;">
  106. {foreach name="hourarr" item="item"}
  107. <option value="{$item}">{$item}</option>
  108. {/foreach}
  109. </select>
  110. {$Think.lang.admin_pointprod_time_hour}</td>
  111. <td class="vatop rowform"><input type="text" name="endtime" id="endtime" class="txt date" style="width:100px;" value="{$Think.TIMESTAMP|date='Y-m-d'}" />
  112. {$Think.lang.admin_pointprod_time_day}
  113. <select id="endhour" name="endhour" style="margin-left: 8px; _margin-left: 4px; width:60px;">
  114. {foreach name="hourarr" item="item"}
  115. <option value="{$item}">{$item}</option>
  116. {/foreach}
  117. </select>
  118. {$Think.lang.admin_pointprod_time_hour}</td>
  119. <td class="vatop tips"></td>
  120. </tr>
  121. </tbody>
  122. <tbody>
  123. <tr>
  124. <td colspan="3" class="required"><label>{$Think.lang.admin_pointprod_limitgrade}:</label></td>
  125. </tr>
  126. <tr class="noborder">
  127. <td>
  128. <select name="limitgrade">
  129. {if $member_grade}
  130. {foreach name="member_grade" item="v"}
  131. <option value="{$v.level}">V{$v.level}</option>
  132. {/foreach}
  133. {/if}
  134. </select>
  135. </td>
  136. <td colspan="2" class="vatop tips">{$Think.lang.admin_pointprod_limitgrade_tips}</td>
  137. </tr>
  138. </tbody>
  139. <tbody>
  140. <tr class="space">
  141. <th colspan="3">{$Think.lang.admin_pointprod_stateinfo}</th>
  142. </tr>
  143. <tr>
  144. <td colspan="3" class="required"><label>{$Think.lang.admin_pointprod_isshow}:</label></td>
  145. </tr>
  146. <tr class="noborder">
  147. <td class="vatop rowform onoff"><label for="showstate_1" class="cb-enable selected"><span>{$Think.lang.admin_pointprod_yes}</span></label>
  148. <label for="showstate_0" class="cb-disable"><span>{$Think.lang.admin_pointprod_no}</span></label>
  149. <input id="showstate_1" name="showstate" checked="checked" value="1" type="radio">
  150. <input id="showstate_0" name="showstate" value="0" type="radio"></td>
  151. <td colspan="2" class="vatop tips"></td>
  152. </tr>
  153. <tr>
  154. <td colspan="3" class="required"><label>{$Think.lang.admin_pointprod_iscommend}:</label></td>
  155. </tr>
  156. <tr class="noborder">
  157. <td class="vatop rowform onoff"><label for="commendstate_1" class="cb-enable"><span>{$Think.lang.admin_pointprod_yes}</span></label>
  158. <label for="commendstate_0" class="cb-disable selected"><span>{$Think.lang.admin_pointprod_no}</span></label>
  159. <input id="commendstate_1" name="commendstate" value="1" type="radio">
  160. <input id="commendstate_0" name="commendstate" checked="checked" value="0" type="radio"></td>
  161. <td colspan="2" class="vatop tips"></td>
  162. </tr>
  163. </tbody>
  164. <tbody id="forbidreason_div">
  165. <tr class="noborder">
  166. <td colspan="3" class="required"><label for="forbidreason">{$Think.lang.admin_pointprod_forbidreason}: </label></td>
  167. </tr>
  168. <tr class="noborder">
  169. <td class="vatop rowform"><textarea name="forbidreason" id="forbidreason" rows="6" class="tarea"></textarea></td>
  170. <td colspan="2" class="vatop tips"></td>
  171. </tr>
  172. </tbody>
  173. <tbody>
  174. <tr class="space">
  175. <th colspan="3">{$Think.lang.admin_pointprod_seoinfo}</th>
  176. </tr>
  177. <tr>
  178. <td colspan="3" class="required"><label for="keywords">{$Think.lang.admin_pointprod_seokey}:</label></td>
  179. </tr>
  180. <tr class="noborder">
  181. <td class="vatop rowform"><input type="text" name="keywords" id="keywords" class="txt"/></td>
  182. <td colspan="2" class="vatop tips"></td>
  183. </tr>
  184. <tr>
  185. <td colspan="3" class="required"><label for="description">{$Think.lang.admin_pointprod_seodescription}:</label></td>
  186. </tr>
  187. <tr class="noborder">
  188. <td class="vatop rowform"><textarea class="tarea" rows="6" id="description" name="description"></textarea></td>
  189. <td colspan="2" class="vatop tips"></td>
  190. </tr>
  191. </tbody>
  192. <tbody>
  193. <tr class="space">
  194. <th colspan="3">{$Think.lang.admin_pointprod_otherinfo}</th>
  195. </tr>
  196. <tr>
  197. <td colspan="3" class="required"><label for="sort">{$Think.lang.admin_pointprod_sort}:</label></td>
  198. </tr>
  199. <tr class="noborder">
  200. <td class="vatop rowform"><input type="text" name="sort" id="sort" class="txt" value="0" /></td>
  201. <td colspan="2" class="vatop tips">{$Think.lang.admin_pointprod_sorttip}</td>
  202. </tr>
  203. <tr class="space">
  204. <th colspan="3">{$Think.lang.admin_pointprod_descriptioninfo}</th>
  205. </tr>
  206. <tr>
  207. <td colspan="3">
  208. {:build_editor(['name'=>'pgoods_body'])}
  209. <textarea name="pgoods_body" id="pgoods_body"></textarea>
  210. </td>
  211. </tr>
  212. <tr>
  213. <td colspan="3" class="required">{$Think.lang.admin_pointprod_uploadimg}:</td>
  214. </tr>
  215. <tr class="noborder">
  216. <td colspan="3" id="divComUploadContainer"><input type="file" multiple="multiple" id="fileupload" name="fileupload" /></td>
  217. </tr>
  218. <tr>
  219. <td colspan="3" class="required">{$Think.lang.admin_pointprod_uploadimg_complete}:</td>
  220. </tr>
  221. <tr class="noborder">
  222. <td colspan="3"><ul id="thumbnails" class="thumblists">
  223. {notempty name="file_upload"}
  224. {foreach name="file_upload" item="v"}
  225. <li id="{$v.upload_id}" class="picture" >
  226. <input type="hidden" name="file_id[]" value="{$v.upload_id}" />
  227. <div class="size-64x64"><span class="thumb"><i></i><img src="{:ds_get_pic(ATTACH_POINTPROD,$v.file_name)}" alt="{$v.file_name}" onload="javascript:ResizeImage(this,64,64);"/></span></div>
  228. <p><span><a href="javascript:insert_editor('{:ds_get_pic(ATTACH_POINTPROD,$v.file_name)}');">{$Think.lang.admin_pointprod_uploadimg_add}</a></span><span><a href="javascript:del_file_upload('{$v.upload_id}');">{$Think.lang.ds_del}</a></span></p>
  229. </li>
  230. {/foreach}
  231. {/notempty}
  232. </ul></td>
  233. </tr>
  234. </tbody>
  235. <tfoot>
  236. <tr class="tfoot">
  237. <td colspan="3"><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
  238. </tr>
  239. </tfoot>
  240. </table>
  241. </form>
  242. </div>
  243. <script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-file-upload/jquery.fileupload.js"></script>
  244. <script>
  245. // 模拟上传input type='file'样式
  246. $(function(){
  247. var textButton="<input type='text' name='textfield' id='textfield1' class='type-file-text' /><input type='button' name='button' id='button1' value='上传' class='type-file-button' />"
  248. $(textButton).insertBefore("#goods_images");
  249. $("#goods_images").change(function(){
  250. $("#textfield1").val($("#goods_images").val());
  251. });
  252. });
  253. function showlimit(){
  254. //var islimit = $('input[name=islimit][checked]').val();
  255. var islimit = $(":radio[name=islimit]:checked").val();
  256. if(islimit == '1'){
  257. $("#limitnum_div").show();
  258. $("#limitnum").val('');
  259. }else{
  260. $("#limitnum_div").hide();
  261. $("#limitnum").val('1');//为了减少提交表单的验证,所以添加一个虚假值
  262. }
  263. }
  264. function showforbidreason(){
  265. var forbidstate = $(":radio[name=forbidstate]:checked").val();
  266. if(forbidstate == '1'){
  267. $("#forbidreason_div").show();
  268. }else{
  269. $("#forbidreason_div").hide();
  270. }
  271. }
  272. function showlimittime(){
  273. var islimit = $(":radio[name=islimittime]:checked").val();
  274. if(islimit == '1'){
  275. $("[name=limittime_div]").show();
  276. $("#starttime").val('');
  277. $("#endtime").val('');
  278. }else{
  279. $("[name=limittime_div]").hide();
  280. $("#starttime").val("{$Think.TIMESTAMP|date='Y-m-d'}");
  281. $("#endtime").val("{$Think.TIMESTAMP|date='Y-m-d'}");
  282. }
  283. }
  284. $(function(){
  285. showlimit();
  286. showforbidreason();
  287. showlimittime();
  288. $('#starttime').datepicker({dateFormat: 'yy-mm-dd'});
  289. $('#endtime').datepicker({dateFormat: 'yy-mm-dd'});
  290. $('#pointprod_form').validate({
  291. errorPlacement: function(error, element){
  292. error.appendTo(element.parent().parent().prev().find('td:first'));
  293. },
  294. rules : {
  295. goodsname : {
  296. required : true
  297. },
  298. goodsprice : {
  299. required : true,
  300. number : true,
  301. min : 0
  302. },
  303. goodspoints : {
  304. required : true,
  305. digits : true,
  306. min :0
  307. },
  308. goodsserial : {
  309. required : true
  310. },
  311. goodsstorage : {
  312. required : true,
  313. digits : true
  314. },
  315. limitnum : {
  316. required : true,
  317. digits : true,
  318. min : 0
  319. },
  320. starttime : {
  321. required : true,
  322. date : false
  323. },
  324. endtime : {
  325. required : true,
  326. date : false
  327. },
  328. sort : {
  329. required : true,
  330. digits : true,
  331. min :0
  332. }
  333. },
  334. messages : {
  335. goodsname : {
  336. required : '{$Think.lang.admin_pointprod_add_goodsname_error}'
  337. },
  338. goodsprice : {
  339. required: '{$Think.lang.admin_pointprod_add_goodsprice_null_error}',
  340. number : '{$Think.lang.admin_pointprod_add_goodsprice_number_error}',
  341. min : '{$Think.lang.admin_pointprod_add_goodsprice_number_error}'
  342. },
  343. goodspoints : {
  344. required: '{$Think.lang.admin_pointprod_add_goodspoint_null_error}',
  345. digits : '{$Think.lang.admin_pointprod_add_goodspoint_number_error}',
  346. min : '{$Think.lang.admin_pointprod_add_goodspoint_number_error}'
  347. },
  348. goodsserial:{
  349. required : '{$Think.lang.admin_pointprod_add_goodsserial_null_error}'
  350. },
  351. goodsstorage : {
  352. required: '{$Think.lang.admin_pointprod_add_storage_null_error}',
  353. digits : '{$Think.lang.admin_pointprod_add_storage_number_error}'
  354. },
  355. limitnum : {
  356. required: '{$Think.lang.admin_pointprod_add_limitnum_error}',
  357. digits : '{$Think.lang.admin_pointprod_add_limitnum_digits_error}',
  358. min : '{$Think.lang.admin_pointprod_add_limitnum_digits_error}'
  359. },
  360. starttime : {
  361. required: '{$Think.lang.admin_pointprod_add_limittime_null_error}'
  362. },
  363. endtime : {
  364. required: '{$Think.lang.admin_pointprod_add_limittime_null_error}'
  365. },
  366. sort : {
  367. required: '{$Think.lang.admin_pointprod_add_sort_null_error}',
  368. digits : '{$Think.lang.admin_pointprod_add_sort_number_error}',
  369. min : '{$Think.lang.admin_pointprod_add_sort_number_error}'
  370. }
  371. }
  372. });
  373. // 替换图片
  374. $('#fileupload').each(function(){
  375. $(this).fileupload({
  376. dataType: 'json',
  377. url: "{:url('Pointprod/pointprod_pic_upload')}",
  378. done: function (e,data) {
  379. if(data != 'error'){
  380. add_uploadedfile(data.result);
  381. }
  382. }
  383. });
  384. });
  385. });
  386. function add_uploadedfile(file_data)
  387. {
  388. var newImg = '<li id="' + file_data.file_id + '" class="picture"><input type="hidden" name="file_id[]" value="' + file_data.file_id + '" /><div class="size-64x64"><span class="thumb"><i></i><img src="' + file_data.file_path + '" alt="' + file_data.file_name + '" width="64px" height="64px"/></span></div><p><span><a href="javascript:insert_editor(\'' + file_data.file_path + '\');">{$Think.lang.admin_pointprod_uploadimg_add}</a></span><span><a href="javascript:del_file_upload(' + file_data.file_id + ');">{$Think.lang.ds_del}</a></span></p></li>';
  389. $('#thumbnails').prepend(newImg);
  390. }
  391. function insert_editor(file_path){
  392. ue.execCommand('insertimage', {src:file_path});
  393. }
  394. function del_file_upload(file_id)
  395. {
  396. layer.confirm('{$Think.lang.ds_ensure_del}', {
  397. btn: ['{$Think.lang.ds_ok}', '{$Think.lang.ds_cancel}'],
  398. title: false,
  399. }, function () {
  400. $.getJSON("{:url('Pointprod/ajaxdelupload')}",{file_id:+ file_id}, function(result){
  401. if(result){
  402. $('#' + file_id).remove();
  403. layer.msg('{$Think.lang.ds_common_del_succ}');
  404. }else{
  405. layer.alert('{$Think.lang.admin_pointprod_delfail}');
  406. }
  407. });
  408. });
  409. }
  410. </script>