bundling_add.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. {extend name="default/base/base_seller" /}
  2. {block name="seller_main"}
  3. <div class="alert"> <strong>{$Think.lang.ds_explain}{$Think.lang.ds_colon}</strong>
  4. <ul>
  5. {if intval(config('ds_config.promotion_bundling_sum')) != 0}
  6. <li>{php}printf(lang('bundling_add_explain1'), config('ds_config.promotion_bundling_sum'), config('ds_config.promotion_bundling_goods_sum')){/php}</li>
  7. {else/}
  8. <li>{php}printf(lang('bundling_add_explain2'), config('ds_config.promotion_bundling_goods_sum')){/php}</li>
  9. {/if}
  10. <li>{$Think.lang.notice_concessionary_activities1}</li>
  11. <li>{$Think.lang.notice_concessionary_activities2}</li>
  12. </ul>
  13. </div>
  14. <div class="dssc-form-default">
  15. <!-- 说明 -->
  16. <form id="add_form" method="post" action="{:url('Sellerpromotionbundling/bundling_add')}">
  17. {notempty name="bundling_info"}
  18. <input type="hidden" name="bundling_id" value="{$bundling_info.bl_id}" />
  19. {/notempty}
  20. <dl>
  21. <dt><i class="required">*</i>{$Think.lang.bundling_name}{$Think.lang.ds_colon}</dt>
  22. <dd>
  23. <p>
  24. <input id="bundling_name" name="bundling_name" type="text" maxlength="25" class="w400 text" value="{present name="bundling_info"}{$bundling_info.bl_name}{/present}" />
  25. <span></span> </p>
  26. <p class="hint">{$Think.lang.bundling_name_explain}</p>
  27. </dd>
  28. </dl>
  29. <dl>
  30. <dt><i class="required">*</i>{$Think.lang.bundling_add_price}{$Think.lang.ds_colon}</dt>
  31. <dd>
  32. <input id="discount_price" name="discount_price" type="text" readonly style="background:#E7E7E7 none;" class="text w60 mr5" value="{present name="bundling_info"}{$bundling_info.bl_discount_price}{/present}"/>
  33. {$Think.lang.ds_yuan}
  34. <span></span>
  35. <p class="hint mt10">{$Think.lang.bundling_cost_price}<span dstype="storecost_price" class="price mr5 ml5">{present name="bundling_info"}{$bundling_info.bl_discount_price}{/present}</span>{$Think.lang.ds_yuan}{$Think.lang.bundling_cost_price_note|raw}</p>
  36. </dd>
  37. </dl>
  38. <dl>
  39. <dt><i class="required">*</i>{$Think.lang.bundling_goods}{$Think.lang.ds_colon}</dt>
  40. <dd>
  41. <p class="bundling_goods_box">
  42. <input id="bundling_goods" type="text" value="" name="bundling_goods">
  43. <span></span></p>
  44. <table class="dssc-default-table mb15">
  45. <thead>
  46. <tr>
  47. <th class="w70">{$Think.lang.designated_offer}</th>
  48. <th class="tl" colspan="2">{$Think.lang.bundling_goods_name}</th>
  49. <th class="w90">{$Think.lang.bundling_cost_price}</th>
  50. <th class="w90">{$Think.lang.special_offer}</th>
  51. <th class="w90">{$Think.lang.ds_handle}</th>
  52. </tr>
  53. </thead>
  54. <tbody dstype="bundling_data" class="bd-line tip" title="{$Think.lang.bundling_add_goods_explain|raw}">
  55. <tr style="display:none;">
  56. <td colspan="20" class="norecord"><div class="no-promotion"><i class="zh"></i><span>{$Think.lang.no_added_items_were_selected}</span></div></td>
  57. </tr>
  58. {notempty name="b_goods_list"}
  59. {foreach name="b_goods_list" item="val"}
  60. {present name="goods_list[$val.goods_id]"}
  61. <tr id="bundling_tr_{$val.goods_id}" class="off-shelf">
  62. <input type="hidden" value="{$val.blgoods_id}" name="goods[{$val.goods_id}][bundling_goods_id]" />
  63. <input type="hidden" value="{$val.goods_id}" name="goods[{$val.goods_id}][gid]" dstype="goods_id">
  64. <td class="w70"><input type="checkbox" name="goods[{$val.goods_id}][appoint]" value="1" {if $val.blgoods_appoint == 1}checked="checked"{/if}></td>
  65. <td class="w50"><div class="shelf-state"><div class="pic-thumb"><img src="{:goods_cthumb($goods_list[$val.goods_id]['goods_image'],240,session('store_id'))}" ncname="{$goods_list[$val.goods_id]['goods_image']}" dstype="bundling_data_img">
  66. </div></div>
  67. </td>
  68. <td class="tl"><dl class="goods-name">
  69. <dt style="width: 300px;">{$goods_list[$val.goods_id]['goods_name']}</dt>
  70. </dl></td>
  71. <td class="goods-price w90" dstype="bundling_data_price">{$goods_list[$val.goods_id]['goods_price']}</td>
  72. <td class="w90">
  73. <input dstype="price" type="text" value="{$val.blgoods_price}" name="goods[{$val.goods_id}][price]" class="text w70"></td>
  74. <td class="dscs-table-handle w90"><span><a onclick="bundling_operate_delete($('#bundling_tr_{$val.goods_id}'), {$val.goods_id})" href="JavaScript:void(0);" class="btn-orange"><i class="iconfont">&#xe754;</i>
  75. <p>{$Think.lang.bundling_goods_remove}</p>
  76. </a></span></td>
  77. </tr>
  78. {/present}
  79. {/foreach}
  80. {/notempty}
  81. </tbody>
  82. </table>
  83. <a id="bundling_add_goods" href="{:url('Sellerpromotionbundling/bundling_add_goods')}" class="dssc-btn dssc-btn-acidblue">{$Think.lang.bundling_goods_add}</a>
  84. <div class="div-goods-select-box">
  85. <div id="bundling_add_goods_ajaxContent"></div>
  86. <a id="bundling_add_goods_delete" class="close" href="javascript:void(0);" style="display: none; right: -10px;">X</a></div>
  87. </dd>
  88. </dl>
  89. <dl>
  90. <dt>{$Think.lang.bundling_add_freight_method}{$Think.lang.ds_colon}</dt>
  91. <dd>
  92. <ul class="dssc-form-radio-list">
  93. <li><label for="whops_seller"><input id="whops_seller" type="radio" name="bundling_freight_choose" {if !isset($bundling_info) || $bundling_info['bl_freight_choose'] == '1'}checked="checked"{/if} value="1" />{$Think.lang.bundling_add_freight_method_seller}</label></li>
  94. <li><label for="whops_buyer"><input id="whops_buyer" type="radio" name="bundling_freight_choose" {if isset($bundling_info) && $bundling_info['bl_freight_choose'] == '0'}checked="checked"{/if} value="0" />{$Think.lang.bundling_add_freight_method_buyer}</label>
  95. <div id="whops_buyer_box" class="transport_tpl" style="{if !isset($bundling_info) || $bundling_info['bl_freight_choose'] == '1'}display:none;{/if}">
  96. <input class="w50 text" type="text" name="bundling_freight" value="{present name='bundling_info'}{$bundling_info.bl_freight}{/present}" /><em class="add-on"><i class="iconfont">&#xe65c;</i></em>
  97. </div>
  98. </li>
  99. </ul>
  100. </dd>
  101. </dl>
  102. <dl>
  103. <dt>{$Think.lang.bundling_status}{$Think.lang.ds_colon}</dt>
  104. <dd>
  105. <ul class="dssc-form-radio-list">
  106. <li><label for="bundling_status_1">
  107. <input type="radio" name="state" value="1" id="bundling_status_1" {if !isset($bundling_info) || $bundling_info['bl_state'] == 1}checked="checked"{/if} />
  108. {$Think.lang.bundling_status_1}</label></li>
  109. <li><label for="bundling_status_0">
  110. <input type="radio" name="state" value="0" id="bundling_status_0" {if isset($bundling_info) && $bundling_info['bl_state'] == 0}checked="checked"{/if} />
  111. {$Think.lang.bundling_status_0}</label></li>
  112. </ul>
  113. </dd>
  114. </dl>
  115. <div class="bottom">
  116. <input id="submit_button" type="submit" value="{$Think.lang.ds_submit}" class="submit">
  117. </div>
  118. </form>
  119. </div>
  120. <script src="{$Think.PLUGINS_SITE_ROOT}/jquery.ajaxContent.pack.js"></script>
  121. <script>
  122. jQuery.browser={};(function(){jQuery.browser.msie=false; jQuery.browser.version=0;if(navigator.userAgent.match(/MSIE ([0-9]+)./)){ jQuery.browser.msie=true;jQuery.browser.version=RegExp.$1;}})();
  123. </script>
  124. <script>
  125. $(document).ready(function(){
  126. /* ajax添加商品 */
  127. $('#bundling_add_goods').ajaxContent({
  128. event:'click', //mouseover
  129. loaderType:"img",
  130. loadingMsg:"{$Think.HOME_SITE_ROOT}/images/loading.gif",
  131. target:'#bundling_add_goods_ajaxContent'
  132. }).click(function(){
  133. $(this).hide();
  134. $('#bundling_add_goods_delete').show();
  135. });
  136. $('#bundling_add_goods_delete').click(function(){
  137. $(this).hide();
  138. $('#bundling_add_goods_ajaxContent').html('');
  139. $('#bundling_add_goods').show();
  140. });
  141. $('#bundling_add_goods_ajaxContent').on('click', '.pagination li a', function() {
  142. $('#bundling_add_goods_ajaxContent').load($(this).attr('href'));
  143. return false;
  144. });
  145. // 退拽效果
  146. $('tbody[dstype="bundling_data"]').sortable({ items: 'tr' });
  147. $('#goods_images').sortable({ items: 'li' });
  148. });
  149. /* 计算商品原价 */
  150. function count_cost_price_sum(){
  151. data_price = $('td[dstype="bundling_data_price"]');
  152. if(typeof(data_price) != 'undefined'){
  153. var S_price = 0;
  154. data_price.each(function(){
  155. S_price += parseFloat($(this).html());
  156. });
  157. $('span[dstype="storecost_price"]').html(S_price.toFixed(2));
  158. }else{
  159. $('span[dstype="storecost_price"]').html('');
  160. }
  161. }
  162. /* 计算商品售价 */
  163. function count_price_sum(){
  164. data_price = $('input[dstype="price"]');
  165. if(typeof(data_price) != 'undefined'){
  166. var S_price = 0;
  167. data_price.each(function(){
  168. S_price += parseFloat($(this).val());
  169. });
  170. $('#discount_price').val(S_price.toFixed(2));
  171. }else{
  172. $('#discount_price').val('');
  173. }
  174. }
  175. </script>
  176. <script src="{$Think.PLUGINS_SITE_ROOT}/jquery.poshytip.min.js"></script>
  177. <style>
  178. .pic_list .small_pic ul li{height:100px}
  179. .ui-sortable-helper{border:dashed 1px #F93;box-shadow:2px 2px 2px rgba(153,153,153,.25);filter:alpha(opacity=75);-moz-opacity:.75;opacity:.75;cursor:ns-resize}
  180. .ui-sortable-helper td{background-color:#FFC!important}
  181. .ajaxload{display:block;width:16px;height:16px;margin:100px 300px}
  182. </style>
  183. <script type="text/javascript">
  184. var DEFAULT_GOODS_IMAGE = '{:ds_get_pic(ATTACH_COMMON,$Think.config.ds_config.default_goods_image)}';
  185. $(function(){
  186. jQuery.validator.addMethod('bundling_goods', function(value, element){
  187. return $('tbody[dstype="bundling_data"] > tr').length >2?true:false;
  188. });
  189. //Ajax提示
  190. $('.tip').poshytip({
  191. className: 'tip-yellowsimple',
  192. showTimeout: 1,
  193. alignTo: 'target',
  194. alignX: 'left',
  195. alignY: 'top',
  196. offsetX: 5,
  197. offsetY: -78,
  198. allowTipHover: false
  199. });
  200. $('.tip2').poshytip({
  201. className: 'tip-yellowsimple',
  202. showTimeout: 1,
  203. alignTo: 'target',
  204. alignX: 'right',
  205. alignY: 'center',
  206. offsetX: 5,
  207. offsetY: 0,
  208. allowTipHover: false
  209. });
  210. //页面输入内容验证
  211. $("#add_form").validate({
  212. errorPlacement: function(error, element){
  213. var error_td = element.nextAll('span:first');
  214. error_td.append(error);
  215. },
  216. submitHandler:function(form){
  217. ds_ajaxpost('add_form', 'url', "{:url('Sellerpromotionbundling/index')}")
  218. },
  219. rules : {
  220. bundling_name : {
  221. required : true
  222. },
  223. bundling_goods : {
  224. bundling_goods : true
  225. },
  226. discount_price : {
  227. required : true,
  228. number : true
  229. }
  230. },
  231. messages : {
  232. bundling_name : {
  233. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.bundling_add_name_error}'
  234. },
  235. bundling_goods : {
  236. bundling_goods : '<i class="iconfont">&#xe64c;</i>{$Think.lang.bundling_add_goods_error}'
  237. },
  238. discount_price : {
  239. required : '<i class="iconfont">&#xe64c;</i>{$Think.lang.bundling_add_price_error_null}',
  240. number : '<i class="iconfont">&#xe64c;</i>{$Think.lang.bundling_add_price_error_not_num}'
  241. }
  242. }
  243. });
  244. $('input[name="bundling_freight_choose"]').click(function(){
  245. if($(this).val() == '0'){
  246. $('#whops_buyer_box').show();
  247. }else{
  248. $('#whops_buyer_box').hide();
  249. }
  250. });
  251. check_bundling_data_length();
  252. {notempty name='bundling_info'}
  253. count_cost_price_sum(); // 计算商品原价
  254. count_price_sum();
  255. {/notempty}
  256. $('tbody[dstype="bundling_data"]').on('change', 'input[dstype="price"]', function(){
  257. count_price_sum();
  258. });
  259. });
  260. /* 删除商品 */
  261. function bundling_operate_delete(o, id){
  262. o.remove();
  263. check_bundling_data_length();
  264. $('li[dstype="'+id+'"]').children(':last').html('<a href="JavaScript:void(0);" onclick="bundling_goods_add($(this))" class="dssc-btn-mini dssc-btn-green"><i class="iconfont">&#xe6db;</i>{$Think.lang.bundling_goods_add_bundling}</a>');
  265. count_cost_price_sum();
  266. count_price_sum();
  267. }
  268. function check_bundling_data_length(){
  269. if ($('tbody[dstype="bundling_data"] tr').length == 1) {
  270. $('tbody[dstype="bundling_data"]').children(':first').show();
  271. }
  272. }
  273. </script>
  274. {/block}