free_config.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <div class="page-header">
  4. <h1>
  5. 快递鸟参数配置
  6. <small>
  7. <i class="icon-double-angle-right"></i>
  8. {$crumbs}
  9. </small>
  10. </h1>
  11. </div>
  12. <div class="row">
  13. <div class="col-xs-12 search-row">
  14. <div class="panel-body">
  15. <ul class="nav nav-tabs">
  16. <li <?php if($type == 0){ ?>class="active" <?php } ?>><a href="{:U('Voucher/index')}">平台券管理</a></li>
  17. <li <?php if($type == 1){ ?>class="active" <?php } ?>><a href="{:U('Voucher/free_config')}">免单券配置</a></li>
  18. </ul>
  19. </div>
  20. </div>
  21. <div class="col-xs-12">
  22. <form class="form-horizontal" id="validation-form" method="post" action='{:U("Voucher/free_config")}'>
  23. <div class="form-group required">
  24. <label class="col-sm-2 control-label">开启赠送免单券:</label>
  25. <div class="col-sm-10">
  26. <label>
  27. <input type="radio" name="voucher_free_state" value="1" <?php if($voucher_free_state_info['value'] == 1){ ?> checked <?php } ?> />&nbsp;是
  28. </label>
  29. <label>
  30. <input type="radio" name="voucher_free_state" value="0" <?php if($voucher_free_state_info['value'] == 0){ ?> checked <?php } ?> />&nbsp;否
  31. </label>
  32. </div>
  33. </div>
  34. <div class="form-group required">
  35. <label class="col-sm-2 control-label">免单券描述:</label>
  36. <div class="col-sm-10">
  37. <input class="form-control" type="text" placeholder="免单券描述:" name="voucher_free_desc" value="{$voucher_free_desc_info.value}" />
  38. </div>
  39. </div>
  40. <div class="form-group required">
  41. <label class="col-sm-2 control-label" for="input-image">
  42. <span title="">封面图:</span>
  43. </label>
  44. <div class="col-sm-10" id="thumb">
  45. <a href="#" data-toggle="image" class="img-thumbnail">
  46. <img osctype="image" <if condition="!empty($voucher_free_image_info['value'])">
  47. src="__ROOT__<?php echo resize($voucher_free_image_info['value'], 100, 100) ?>"
  48. <else />
  49. src="__ROOT__/Common/image/no_image_100x100.jpg"
  50. </if> />
  51. </a>
  52. <input osctype="image_input" type="hidden" name="voucher_free_image" value="{$voucher_free_image_info.value|default=''}" id="input-image" />
  53. <span class="help-inline ">
  54. <span class="middle red">建议尺寸:900*500</span>
  55. </span>
  56. </div>
  57. </div>
  58. <div class="form-group">
  59. <label class="col-sm-1 control-label no-padding-left"> </label>
  60. <div class="col-sm-11">
  61. <input name="send" type="submit" value="提交" class="btn btn-primary" />
  62. </div>
  63. </div>
  64. </form>
  65. </div>
  66. </div>
  67. </block>
  68. <block name="javascript">
  69. <script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
  70. <script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
  71. <script>
  72. $(function(){
  73. $(document).delegate('a[data-toggle=\'image\']', 'click', function(e) {
  74. e.preventDefault();
  75. var index=$(this).attr('num');
  76. var element = this;
  77. if(index==undefined){
  78. $(element).popover({
  79. html: true,
  80. placement: 'right',
  81. trigger: 'manual',
  82. content: function() {
  83. 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>';
  84. }
  85. });
  86. }else{
  87. $(element).popover({
  88. html: true,
  89. placement: 'right',
  90. trigger: 'manual',
  91. content: function() {
  92. return '<button type="button" n="'+index+'" class="btn btn-primary button-image"><i class="icon-edit"></i></button> <button type="button" id="button-clear" class="btn btn-danger"><i class="icon-trash"></i></button>';
  93. }
  94. });
  95. }
  96. $(element).popover('toggle');
  97. $('#thumb-image').on('click', function() {
  98. $('#modal-image').remove();
  99. $('#form-upload').remove();
  100. $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_image" type="file" name="file" /></form>');
  101. $('#form-upload input[name=\'file\']').trigger('click');
  102. $(element).popover('hide');
  103. $('[osctype="btn_upload_image"]').fileupload({
  104. dataType: 'json',
  105. url: "{:U('Image/upload_image',array('dir'=>'seller'))}",
  106. add: function(e, data) {
  107. $parent = $('#thumb');
  108. $input = $parent.find('[osctype="image_input"]');
  109. $img = $parent.find('[osctype="image"]');
  110. data.formData = {old_blog_images:$input.val()};
  111. $img.attr('src', "__IMG__/loading.gif");
  112. data.submit();
  113. },
  114. done: function (e,data) {
  115. var image=data.result;
  116. $parent = $('#thumb');
  117. $input = $parent.find('[osctype="image_input"]');
  118. $img = $parent.find('[osctype="image"]');
  119. if(image) {
  120. // $img.prev('i').hide();
  121. $img.attr('src', '__ROOT__'+image.image_thumb);
  122. $img.show();
  123. $input.val(image.image);
  124. } else {
  125. alert('上传失败');
  126. }
  127. }
  128. });
  129. });
  130. $('#button-clear').on('click', function() {
  131. $(element).find('img').attr('src', $(element).find('img').attr('data-placeholder'));
  132. $(element).parent().find('input').attr('value', '');
  133. $(element).popover('hide');
  134. });
  135. });
  136. })
  137. </script>
  138. </block>