prod_edit.html 23 KB

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