addguobie.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <div class="page-header">
  4. <h1>
  5. {$breadcrumb2}
  6. <small>
  7. <i class="icon-double-angle-right"></i>
  8. 基本信息
  9. </small>
  10. </h1>
  11. </div>
  12. <div class="row">
  13. <div class="col-xs-12">
  14. <form class="form-horizontal" id="form" method="post" action="{:U('Goods/saveguobie')}">
  15. <notempty name="Think.get.id">
  16. <input name="id" type="hidden" value="{$Think.get.id}" />
  17. </notempty>
  18. <div class="tab-content">
  19. <!-- 常规 START -->
  20. <div class="tab-pane active" id="tab-general">
  21. <div class="form-group">
  22. <label class="col-sm-2 control-label no-padding-left"> 国别名称 </label>
  23. <div class="col-sm-10">
  24. <div class="clearfix">
  25. <input name="name" class="col-xs-10 col-sm-10 form-control" value="{$guobie.name|default=''}" type="text">
  26. </div>
  27. </div>
  28. </div>
  29. <div class="form-group" id="goods-image-row2">
  30. <label class="col-sm-2 control-label no-padding-left">国别logo </label>
  31. <div class="col-sm-10" id="image-row2">
  32. <a href="#" data-toggle="image" class="img-thumbnail" type="goods" id="thumb-image2" num="2">
  33. <img osctype="goods_image2" <if condition="$guobie['logo']">
  34. src="__ROOT__/<?php echo resize($guobie['logo'],100,100); ?>"
  35. <else />
  36. src="__ROOT__/Common/image/no_image_40x40.jpg"
  37. </if> />
  38. </a>
  39. <input osctype="goods_image_input2" type="hidden" name="logo" value="{$guobie.logo|default=''}" id="input-image2" />
  40. <span class="help-inline ">
  41. <span class="middle red">用于海淘首页展示圆形logo</span>
  42. </span>
  43. </div>
  44. </div>
  45. <div class="form-group" id="goods-image-row3">
  46. <label class="col-sm-2 control-label no-padding-left">国旗 </label>
  47. <div class="col-sm-10" id="image-row3">
  48. <a href="#" data-toggle="image" class="img-thumbnail" type="goods" id="thumb-image3" num="3">
  49. <img osctype="goods_image3" <if condition="$guobie['icon']">
  50. src="__ROOT__/<?php echo resize($guobie['icon'],100,100); ?>"
  51. <else />
  52. src="__ROOT__/Common/image/no_image_40x40.jpg"
  53. </if> />
  54. </a>
  55. <input osctype="goods_image_input3" type="hidden" name="icon" value="{$guobie.icon|default=''}" id="input-image3" />
  56. <span class="help-inline ">
  57. <span class="middle red">用于海淘首页展示圆形logo</span>
  58. </span>
  59. </div>
  60. </div>
  61. <div class="form-group" id="goods-image-row4">
  62. <label class="col-sm-2 control-label no-padding-left">BANNER </label>
  63. <div class="col-sm-10" id="image-row4">
  64. <a href="#" data-toggle="image" class="img-thumbnail" type="goods" id="thumb-image4" num="4">
  65. <img osctype="goods_image4" <if condition="$guobie['banner']">
  66. src="__ROOT__/<?php echo resize($guobie['banner'],100,100); ?>"
  67. <else />
  68. src="__ROOT__/Common/image/no_image_40x40.jpg"
  69. </if> />
  70. </a>
  71. <input osctype="goods_image_input4" type="hidden" name="banner" value="{$guobie.banner|default=''}" id="input-image4" />
  72. <span class="help-inline ">
  73. <span class="middle red">海淘国家详细页顶部</span>
  74. </span>
  75. </div>
  76. </div>
  77. <div class="form-group">
  78. <label class="col-sm-2 control-label no-padding-left"> 推荐</label>
  79. <div class="col-sm-10">
  80. <div class="clearfix">
  81. <label class="radio-inline"><input <?php if($guobie['is_index']==1){echo ' checked="checked"';} ?> type="radio" value="1" name="is_index">是</label>
  82. <label class="radio-inline"><input <?php if($guobie['is_index']==0){echo ' checked="checked"';} ?> type="radio" value="0" name="is_index">否</label>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </form>
  89. <div class="form-group">
  90. <label class="col-sm-1 control-label no-padding-left"> </label>
  91. <div class="col-sm-11">
  92. <button form="form" type="submit" class="btn btn-sm btn-primary">提交</button>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </block>
  98. <block name="javascript">
  99. <script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
  100. <script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
  101. <script>
  102. $(function(){
  103. // tooltips on hover button-upload
  104. $('[data-toggle=\'tooltip\']').tooltip({container: 'body', html: true});
  105. // Makes tooltips work on ajax generated content
  106. $(document).ajaxStop(function() {
  107. $('[data-toggle=\'tooltip\']').tooltip({container: 'body'});
  108. });
  109. $(document).delegate('a[data-toggle=\'image\']', 'click', function(e) {
  110. e.preventDefault();
  111. var index=$(this).attr('num');
  112. var type=$(this).attr('type');
  113. //alert(index);
  114. var element = this;
  115. if(index==undefined){
  116. $(element).popover({
  117. html: true,
  118. placement: 'right',
  119. trigger: 'manual',
  120. content: function() {
  121. return '<button type="button" id="thumb-image" class="btn btn-primary"><i class="icon-edit"></i></button> <button type="button" id="button-clear" class="btn btn-danger"><i class="icon-trash"></i></button>';
  122. }
  123. });
  124. }else{
  125. $(element).popover({
  126. html: true,
  127. placement: 'right',
  128. trigger: 'manual',
  129. content: function() {
  130. return '<button type="button" n="'+index+'" t="'+type+'" class="btn btn-primary button-image"><i class="icon-edit"></i></button> ';
  131. }
  132. });
  133. }
  134. $(element).popover('toggle');
  135. //商品图片
  136. $('#thumb-image').on('click', function() {
  137. //alert('333');
  138. $('#modal-image').remove();
  139. $('#form-upload').remove();
  140. $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_image" type="file" name="file" /></form>');
  141. $('#form-upload input[name=\'file\']').trigger('click');
  142. $(element).popover('hide');
  143. $('[osctype="btn_upload_image"]').fileupload({
  144. dataType: 'json',
  145. url: "{:U('Image/upload_image',array('dir'=>'shop'))}",
  146. add: function(e, data) {
  147. $parent = $('#thumb');
  148. $input = $parent.find('[osctype="image_input"]');
  149. $img = $parent.find('[osctype="image"]');
  150. data.formData = {old_goods_image:$input.val()};
  151. $img.attr('src', "__IMG__/loading.gif");
  152. data.submit();
  153. },
  154. done: function (e,data) {
  155. var image=data.result;
  156. $parent = $('#thumb');
  157. $input = $parent.find('[osctype="image_input"]');
  158. $img = $parent.find('[osctype="image"]');
  159. if(image) {
  160. // $img.prev('i').hide();
  161. $img.attr('src', '__ROOT__'+image.image_thumb);
  162. $img.show();
  163. $input.val(image.image);
  164. } else {
  165. alert('上传失败');
  166. }
  167. }
  168. });
  169. });
  170. $('.button-image').on('click', function() {
  171. $('#modal-image').remove();
  172. $('#form-upload').remove();
  173. var i=$(this).attr('n');
  174. var type=$(this).attr('t');
  175. $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_image" type="file" name="file" /></form>');
  176. $('#form-upload input[name=\'file\']').trigger('click');
  177. $(element).popover('hide');
  178. $('[osctype="btn_upload_image"]').fileupload({
  179. dataType: 'json',
  180. url: "{:U('Image/upload_image/dir')}"+'/'+type,
  181. add: function(e, data) {
  182. $parent = $('#image-row'+i);
  183. $input = $parent.find('[osctype="'+type+'_image_input'+i+'"]');
  184. $img = $parent.find('[osctype="'+type+'_image'+i+'"]');
  185. var old_name='old_'+type+'_image';
  186. data.formData = {old_name:$input.val()};
  187. $img.attr('src', "__IMG__/loading.gif");
  188. data.submit();
  189. },
  190. done: function (e,data) {
  191. var image=data.result;
  192. $parent = $('#'+type+'-image-row'+i);
  193. $input = $parent.find('[osctype="'+type+'_image_input'+i+'"]');
  194. $img = $parent.find('[osctype="'+type+'_image'+i+'"]');
  195. if(image) {
  196. // $img.prev('i').hide();
  197. $img.attr('src', '__ROOT__/'+image.image_thumb);
  198. $img.show();
  199. $input.val(image.image);
  200. } else {
  201. alert('上传失败');
  202. }
  203. }
  204. });
  205. });
  206. $('#button-clear').on('click', function() {
  207. $(element).find('img').attr('src', $(element).find('img').attr('data-placeholder'));
  208. $(element).parent().find('input').attr('value', '');
  209. $(element).popover('hide');
  210. });
  211. });
  212. });
  213. </script>
  214. </block>