addgoods.html 105 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  42. <link href="/static/css/snailfish.css" rel="stylesheet">
  43. <script type="text/javascript" src="/static/js/dist/area/cascade.js"></script>
  44. <script type="text/javascript" src="/static/js/dist/select2/select2.min.js"></script>
  45. <link rel="stylesheet" href="/static/js/dist/select2/select2-bootstrap.css">
  46. <link rel="stylesheet" href="/static/js/dist/select2/select2.css">
  47. <script type="text/javascript" src="/web/resource/js/lib/moment.js"></script>
  48. <link rel="stylesheet" href="/web/resource/components/datetimepicker/jquery.datetimepicker.css">
  49. <link rel="stylesheet" href="/web/resource/components/daterangepicker/daterangepicker.css">
  50. <style type='text/css'>
  51. .tabs-container .layui-form-item {overflow: hidden;}
  52. .tabs-container .tabs-left > .nav-tabs {}
  53. .tab-goods .nav li {float:left;}
  54. .spec_item_thumb {position: relative; width: 30px; height: 20px; padding: 0; border-left: none;}
  55. .spec_item_thumb i {position: absolute; top: -5px; right: -5px;}
  56. .input-group .spec_item_thumb{padding:0px;}
  57. .multi-img-details, .multi-audio-details {margin-top:.5em;max-width: 700px; padding:0; }
  58. .multi-audio-details .multi-audio-item {width:155px; height: 40px; position:relative; float: left; margin-right: 5px;}
  59. .region-goods-details {
  60. background: #f8f8f8;
  61. margin-bottom: 10px;
  62. padding: 0 10px;
  63. }
  64. .region-goods-left{
  65. text-align: center;
  66. font-weight: bold;
  67. color: #333;
  68. font-size: 14px;
  69. padding: 20px 0;
  70. }
  71. .region-goods-right{
  72. border-left: 3px solid #fff;
  73. padding: 10px 10px;
  74. }
  75. .input-group .input-group-btn .btn:hover{background-color:#5bc0de}
  76. .layui-form-select{display:none;}
  77. .daterangepicker select.ampmselect, .daterangepicker select.hourselect, .daterangepicker select.minuteselect {
  78. width: auto!important;
  79. }
  80. .input-group .input-group-addon{}
  81. </style>
  82. </head>
  83. <body layadmin-themealias="default">
  84. <div class="layui-fluid">
  85. <div class="layui-card">
  86. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text"><?php if( !empty($item['id'])){ ?>编辑<?php }else{ ?>添加<?php } ?>商品 <small><?php if( !empty($item['id'])){ ?>修改【<span class="text-info">{$item['goodsname']}</span>】<?php } ?></small></span></div>
  87. <div class="layui-card-body" style="padding:15px;">
  88. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
  89. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  90. <ul class="layui-tab-title">
  91. <li <?php if( empty($_GPC['tab']) || $_GPC['tab']=='basic'){ ?>class="layui-this"<?php } ?>>基本信息</li>
  92. <li <?php if( $_GPC['tab']=='option'){ ?>class="layui-this"<?php } ?> >规格库存</li>
  93. <li <?php if( $_GPC['tab']=='des'){ ?>class="layui-this"<?php } ?> >商品详情</li>
  94. <?php $commiss_level = D('Home/Front')->get_config_by_name('commiss_level'); ?>
  95. <li <?php if( $_GPC['tab']=='community_head_level'){ ?>class="layui-this"<?php } ?> >等级/分销</li>
  96. <?php if( !empty($is_open_goods_relative_goods) && $is_open_goods_relative_goods == 1 ){ ?>
  97. <li <?php if( $_GPC['tab']=='goods_relative_goods'){ ?>class="layui-this"<?php } ?> >推荐商品</li>
  98. <?php } ?>
  99. </ul>
  100. <div class="layui-tab-content" >
  101. <div class="layui-tab-item <?php if( empty($_GPC['tab']) || $_GPC['tab']=='basic'){ ?>layui-show<?php } ?>" >
  102. <!---- 基本信息begin --->
  103. <div class="region-goods-details layui-row">
  104. <div class="layui-form-item">
  105. <div class="layui-form-item" style="padding-top:10px;">
  106. <label class="layui-form-label must">商品名称</label>
  107. <div class="layui-input-block" style="padding-right:0;" >
  108. <input type="text" name="goodsname" id="goodsname" class="form-control" value="{$item['goodsname']}" data-rule-required="true" />
  109. </div>
  110. </div>
  111. <div class="layui-form-item">
  112. <label class="layui-form-label">商品分类</label>
  113. <div class="layui-input-block">
  114. <select id="cates" multiple="multiple" name='cates[]' class="form-control select2" >
  115. <?php foreach( $category as $c ){ ?>
  116. <option value="{$c['id']}" <?php if( is_array($item['cates']) && in_array($c['id'],$item['cates'])){ ?>selected<?php } ?> >{$c['name']}</option>
  117. <?php } ?>
  118. </select>
  119. </div>
  120. </div>
  121. <div class="layui-form-item">
  122. <label class="layui-form-label">商品简介</label>
  123. <div class="layui-input-block">
  124. <textarea name="subtitle" id="subtitle" rows="5" class="form-control" data-parent=".subtitle" maxlength="100" data-rule-maxlength="100">{$item['subtitle']}</textarea>
  125. <div class="layui-form-mid layui-word-aux">副标题的长度请控制在100字以内</div>
  126. </div>
  127. </div>
  128. <div class="layui-form-item">
  129. <label class="layui-form-label">默认商品预达简介</label>
  130. <div class="layui-input-block ">
  131. <input type="checkbox" lay-skin="primary" name="is_show_arrive" class="form-control valid" <?php if( empty($item) || $item['is_show_arrive'] ==1 || !isset($item['is_show_arrive']) ){ ?>checked<?php } ?> value="1" title="展示预达时间" />
  132. <br/>
  133. <div class="layui-form-mid layui-word-aux">“商品预达简介”为商品名称下方的“预计送达时间”。例如:"现在下单 预计(12点前下单,预计当天送达)可自提" 默认开启,关闭后不进行显示。</div>
  134. </div>
  135. </div>
  136. <div class="layui-form-item">
  137. <label class="layui-form-label">商品自定义预达简介</label>
  138. <div class="layui-input-block">
  139. <label class="radio-inline"><input type="radio" name="diy_arrive_switch" value="0" <?php if( !isset($item['diy_arrive_switch']) || $item['diy_arrive_switch'] == 0 ){ ?>checked="true"<?php } ?> title="关闭" /> </label>
  140. <label class="radio-inline"><input type="radio" name="diy_arrive_switch" value="1" <?php if( isset($item['diy_arrive_switch']) && $item['diy_arrive_switch'] == 1 ){ ?>checked="true"<?php } ?> title="开启" /> </label>
  141. <div class="layui-form-mid layui-word-aux">“商品自定义预达简介”为商品名称下方“预计送达时间”,配合“商品预达简介”使用默认关闭状态,在“商品预达简介”描述不精确的情况下建议使用此项,如果使用此项建议关闭“商品预达简介”。</div>
  142. </div>
  143. </div>
  144. <div class="layui-form-item">
  145. <label class="layui-form-label"></label>
  146. <div class="layui-input-block">
  147. <textarea name="diy_arrive_details" id="diy_arrive_details" rows="3" class="form-control" maxlength="35" data-rule-maxlength="35">{$item['diy_arrive_details']}</textarea>
  148. <div class="layui-form-mid layui-word-aux">文字的长度请控制在35字以内</div>
  149. </div>
  150. </div>
  151. <div class="layui-form-item">
  152. <label class="layui-form-label">商品简短标题</label>
  153. <div class="layui-input-block">
  154. <input type="text" name="print_sub_title" id="print_sub_title" class="form-control" value="{$item['print_sub_title']}" />
  155. <div class="layui-form-mid layui-word-aux">小票打印机使用,请控制字数,未填写默认截取商品标题(无须打印的可以不填写)</div>
  156. </div>
  157. </div>
  158. <div class="layui-form-item">
  159. <label class="layui-form-label must">商品视频</label>
  160. <div class="layui-input-block gimgs">
  161. {:tpl_form_field_video('video',$item['video'] );}
  162. <span class="layui-form-mid layui-word-aux image-block">
  163. 请输入视频链接地址或者选择上传视频(支持抖音视频地址)
  164. </span>
  165. </div>
  166. </div>
  167. <div class="layui-form-item">
  168. <label class="layui-form-label must">首页商品(大图)</label>
  169. <div class="layui-input-block gimgs">
  170. {:tpl_form_field_image2('big_img',$item['big_img'])}
  171. <span class="layui-form-mid layui-word-aux image-block">此图为首页商品大图模式封面图,最佳尺寸:710*400</span>
  172. </div>
  173. </div>
  174. <div class="layui-form-item">
  175. <label class="layui-form-label must">商品图片<label style="color:red;font-size:16px;font-weight:900">*</label></label>
  176. <div class="layui-input-block gimgs" id="gimgs_mult">
  177. {:tpl_form_field_multi_image3('thumbs',$item['piclist'])}
  178. <span class="layui-form-mid layui-word-aux image-block">商品详情页主图(轮播图),第一张未商品列表调用图,建议为正方型,尺寸建议宽度为640,并保持图片大小一致,可拖拽改变图片顺序</span>
  179. </div>
  180. </div>
  181. <div class="layui-form-item">
  182. <label class="layui-form-label">分享标题</label>
  183. <div class="layui-input-block">
  184. <input type="text" name="share_title" class="form-control" value="{$item['share_title']}" />
  185. <div class="layui-form-mid layui-word-aux"></div>
  186. </div>
  187. </div>
  188. <div class="layui-form-item">
  189. <label class="layui-form-label ">分享图片</label>
  190. <div class="layui-input-block gimgs">
  191. {:tpl_form_field_image2('goods_share_image',$item['goods_share_image'])}
  192. <span class="layui-form-mid layui-word-aux image-block">此图为商品详情页分享图片(比例为长宽比5:4)</span>
  193. </div>
  194. </div>
  195. <?php if($is_updown){ ?>
  196. <div class="layui-form-item">
  197. <label class="layui-form-label">商品状态</label>
  198. <div class="layui-input-block">
  199. <label class="radio-inline"><input type="radio" name="grounding" value="1" <?php if( !isset($item['grounding']) || $item['grounding'] == 1){ ?>checked="true"<?php } ?> title="上架" /> </label>
  200. <label class="radio-inline"><input type="radio" name="grounding" value="0" <?php if( isset($item['grounding']) && $item['grounding'] == 0){ ?>checked="true"<?php } ?> title="下架" /> </label>
  201. </div>
  202. </div>
  203. <?php } ?>
  204. <?php if($is_index){ ?>
  205. <div class="layui-form-item">
  206. <label class="layui-form-label">首页推荐</label>
  207. <div class="layui-input-block">
  208. <label class="radio-inline"><input type="radio" name="is_index_show" value="1" <?php if( !isset($item['is_index_show']) || $item['is_index_show'] == 1){ ?>checked="true"<?php } ?> title="是" /> </label>
  209. <label class="radio-inline"><input type="radio" name="is_index_show" value="0" <?php if( isset($item['is_index_show']) && $item['is_index_show'] == 0){ ?>checked="true"<?php } ?> title="否" /> </label>
  210. </div>
  211. </div>
  212. <?php } ?>
  213. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ){ ?>
  214. <div class="layui-form-item" >
  215. <label class="layui-form-label">付费</label>
  216. <div class="col-sm-10 col-xs-12" >
  217. <div class="radio-inline">
  218. <input type="checkbox" lay-skin="primary" name="is_take_vipcard" <?php if( isset($item['is_take_vipcard']) && $item['is_take_vipcard'] ==1 ){ ?> checked <?php } ?> value="1" />
  219. <div style="clear:both;"></div>
  220. <span class="layui-form-mid layui-word-aux">开启会员价,该商品会员卡会员下单享会员价</span>
  221. </div>
  222. </div>
  223. </div>
  224. <?php } ?>
  225. <div class="layui-form-item" style="display:none;">
  226. <label class="layui-form-label">分享描述</label>
  227. <div class="layui-input-block">
  228. <input type="text" name="share_description" class="form-control" value="{$item['share_description']}" />
  229. <div class="layui-form-mid layui-word-aux">公众号才有的,小程序没有这个描述</div>
  230. </div>
  231. </div>
  232. <div class="layui-form-item price" >
  233. <label class="layui-form-label">商品价格<label style="color:red;font-size:16px;font-weight:900">*</label></label>
  234. <div class="layui-input-block">
  235. <div class="input-group">
  236. <input type="text" name="price" id="price" class="form-control" value="{$item['price']}" <?php if($item['hasoption']!=1){ ?> lay-verify="required"<?php } ?> />
  237. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ){ ?>
  238. <span class="input-group-addon">元&nbsp;</span>
  239. <span class="input-group-addon">付费会员价</span>
  240. <input type="text" name="card_price" id="card_price" class="form-control" value="{$item['card_price']}" <?php if( $item['hasoption']!=1 ){ ?>lay-verify="required"<?php } ?> placeholder="请填写会员价"/>
  241. <?php } ?>
  242. <span class="input-group-addon">元&nbsp;</span>
  243. <span class="input-group-addon">原价</span>
  244. <input type="text" name="productprice" id="productprice" class="form-control" value="{$item['productprice']}" <?php if($item['hasoption']!=1){ ?>lay-verify="required" <?php } ?> />
  245. <span class="input-group-addon">元&nbsp;</span>
  246. <span class="input-group-addon"> (市场价、划线价)成本价</span>
  247. <input type="text" name="costprice" id="costpriceprice" class="form-control" value="{$item['costprice']}" placeholder="请填写商品成本价"/>
  248. </div>
  249. <span class='layui-form-mid layui-word-aux'>如未启用商品规格,请填写商品价格</span>
  250. </div>
  251. </div>
  252. <?php if($is_vir_count){ ?>
  253. <div class="layui-form-item" >
  254. <label class="layui-form-label">已出售数</label>
  255. <div class="layui-input-block">
  256. <div class="input-group">
  257. <input type="text" name="sales" id="sales" class="form-control" value="{$item['sales']}" />
  258. <span class="input-group-addon">备注:前台销量=虚拟销量+实际销量</span>
  259. </div>
  260. </div>
  261. </div>
  262. <?php } ?>
  263. <div class="layui-form-item" >
  264. <label class="layui-form-label">提货时间</label>
  265. <div class="col-sm-10 col-xs-12" id="radPickupDateTip">
  266. <?php $item['pick_up_type'] = isset($item['pick_up_type']) ? $item['pick_up_type'] : 1; ?>
  267. <label class="radio-inline"><input type="radio" name="pick_up_type" <?php if( !isset($item['pick_up_type']) || $item['pick_up_type'] ==0 ){ ?> checked <?php } ?> value="0" title="当日达" /><span class="fake-radio"></span></label>
  268. <label class="radio-inline"><input type="radio" name="pick_up_type" <?php if( isset($item['pick_up_type']) && $item['pick_up_type'] ==1 ){ ?> checked <?php } ?> value="1" title="次日达" /><span class="fake-radio"></span></label>
  269. <label class="radio-inline"><input type="radio" name="pick_up_type" <?php if( isset($item['pick_up_type']) && $item['pick_up_type'] ==2 ){ ?> checked <?php } ?> value="2" title="隔日达" /><span class="fake-radio"></span></label>
  270. <label class="radio-inline"><input type="radio" name="pick_up_type" <?php if( isset($item['pick_up_type']) && $item['pick_up_type'] ==3 ){ ?> checked <?php } ?> value="3" title="自定义" /><span class="fake-radio"></span></label>
  271. <input class="form-control " id="txtPickupDateTip" name="pick_up_modify" style="vertical-align: sub; <?php if( isset($item['pick_up_type']) && $item['pick_up_type'] ==3){ ?>display:inline-block;<?php }else{ ?>display: none;<?php } ?>width: 120px;" type="text" value="{$item['pick_up_modify']}">
  272. <div style="clear:both;"></div>
  273. <span class="layui-form-mid layui-word-aux">系统会根据当前日期自动生成具体提货时间,或直接显示自定义内容</span>
  274. </div>
  275. </div>
  276. <div class="layui-form-item" style="display:none;">
  277. <label class="layui-form-label"></label>
  278. <div class="layui-input-block">
  279. <label class="checkbox-inline"><input type="checkbox" name="showsales" value="1" <?php if( $item['showsales'] == 1){ ?>checked="true"<?php } ?> /> 显示销量</label>
  280. <span class="layui-form-mid layui-word-aux"></span>
  281. </div>
  282. </div>
  283. <div class="layui-form-item" style="display:none;">
  284. <label class="layui-form-label">标签</label>
  285. <div class="layui-input-block">
  286. <label class="checkbox-inline"><input type="checkbox" name="quality" value="1" <?php if( !empty($item['quality'])){ ?>checked="true"<?php } ?> /> 正品保证</label>
  287. <label class="checkbox-inline"><input type="checkbox" name="seven" value="1" <?php if( !empty($item['seven'])){ ?>checked="true"<?php } ?> /> 7天无理由退换</label>
  288. <label class="checkbox-inline"><input type="checkbox" name="repair" value="1" <?php if( !empty($item['repair'])){ ?>checked="true"<?php } ?> /> 保修</label>
  289. </div>
  290. </div>
  291. <div class="layui-form-item">
  292. <label class="layui-form-label">自定义标签</label>
  293. <div class="layui-input-block">
  294. <div class="input-group " style="margin: 0;">
  295. <input type="text" disabled value="{$item['label']['id']}" class="form-control valid" name="labelname" placeholder="" id="label_id">
  296. <span class="input-group-btn">
  297. <span data-input="#label_id" id="chose_label_id" class="btn btn-default">选择标签</span>
  298. </span>
  299. </div>
  300. <?php if( $item['label']){ ?>
  301. <div class="input-group " style="margin: 0;">
  302. <div class="layadmin-text-center choose_user">
  303. <div class="" style="">{$item['label']['tagname']}</div>
  304. <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this,'label_id')"><i class="layui-icon">&#xe640;</i></button>
  305. </div>
  306. </div>
  307. <?php } ?>
  308. </div>
  309. </div>
  310. <?php if($is_open_only_express == 1){ ?>
  311. <div class="layui-form-item" >
  312. <label class="layui-form-label">仅快递</label>
  313. <div class="col-sm-10 col-xs-12" >
  314. <input type="checkbox" lay-skin="primary" name="is_only_express" <?php if(isset($item['is_only_express']) && $item['is_only_express'] ==1 ){ ?> checked <?php } ?> value="1" />
  315. <div style="clear:both;"></div>
  316. <span class="layui-form-mid layui-word-aux">开启仅快递后,该商品只会快递商品一起下单</span>
  317. </div>
  318. </div>
  319. <?php } ?>
  320. <?php if( $delivery_type_express == 1){ ?>
  321. <div class="layui-form-item dispatch_info">
  322. <label class="layui-form-label">运费设置</label>
  323. <div class="layui-input-block" style='padding-left:0'>
  324. <div class="input-group">
  325. <span class='input-group-addon' style='border:none;padding:0px;'><label class="radio-inline" style='margin-top:-7px;' ><input type="radio" name="dispatchtype" value="0" <?php if( empty($item['dispatchtype'])){ ?>checked="true"<?php } ?> title="运费模板" /> </label></span>
  326. <select class="form-control tpl-category-parent select2" id="dispatchid" name="dispatchid">
  327. <?php foreach( $dispatch_data as $dispatch_item ){ ?>
  328. <option value="{$dispatch_item['id']}" <?php if( $item['dispatchid'] == $dispatch_item['id']){ ?>selected="true"<?php } ?>>{$dispatch_item['name']}</option>
  329. <?php } ?>
  330. </select>
  331. </div>
  332. </div>
  333. </div>
  334. <div class="layui-form-item dispatch_info">
  335. <label class="layui-form-label"></label>
  336. <div class="layui-input-block" style='padding-left:0'>
  337. <div class="input-group">
  338. <span class='input-group-addon' style='border:none;padding:0px;'><label class="radio-inline" style='margin-top:-7px;' >
  339. <input type="radio"name="dispatchtype" value="1" <?php if( $item['dispatchtype'] == 1){ ?>checked="true"<?php } ?> title="统一邮费" /> </label></span>
  340. <input type="text" name="dispatchprice" id="dispatchprice" class="form-control" value="{$item['dispatchprice']}" />
  341. <span class="input-group-addon">元</span>
  342. </div>
  343. </div>
  344. </div>
  345. <?php } ?>
  346. <?php
  347. $is_show_fullre = true;
  348. if (defined('ROLE') && ROLE == 'agenter' ) {
  349. $supper_info = get_agent_logininfo();
  350. if($supper_info['type'] == 1)
  351. {
  352. $is_show_fullre = false;
  353. }
  354. }
  355. ?>
  356. <?php if( $is_show_fullre && !empty($is_open_fullreduction) && $is_open_fullreduction == 1){ ?>
  357. <div class="layui-form-item" >
  358. <label class="layui-form-label">满减活动</label>
  359. <div class="col-sm-10 col-xs-12">
  360. <label class="radio-inline"><input type="radio" name="is_take_fullreduction" <?php if( !isset($item['is_take_fullreduction']) || $item['is_take_fullreduction'] ==1 ){ ?> checked <?php } ?> value="1" title="参与" /><span class="fake-radio"></span></label>
  361. <label class="radio-inline"><input type="radio" name="is_take_fullreduction" <?php if( isset($item['is_take_fullreduction']) && $item['is_take_fullreduction'] ==0 ){ ?> checked <?php } ?> value="0" title="不参与" /><span class="fake-radio"></span></label>
  362. </div>
  363. </div>
  364. <?php } ?>
  365. <?php if($supply_can_goods_sendscore == 1){ ?>
  366. <div class="layui-form-item" >
  367. <label class="layui-form-label">下单送积分</label>
  368. <div class="col-sm-10 col-xs-12" id="send_score_div">
  369. <input type="checkbox" lay-filter="is_modify_sendscore" lay-skin="primary" name="is_modify_sendscore" <?php if(isset($item['is_modify_sendscore']) && $item['is_modify_sendscore'] ==1){ ?> checked <?php } ?> value="1" />
  370. <input class="form-control " id="send_score_divTip" name="send_socre" style="vertical-align: sub; <?php if(isset($item['is_modify_sendscore']) && $item['is_modify_sendscore'] ==1){ ?>display:inline;<?php }else{ ?>display: none;<?php } ?>width: 120px;" type="text" value="{$item['send_socre']}">
  371. <div style="clear:both;"></div>
  372. <div style="color:#999">赠送数量 = 商品数量 * 下单送积分数量(未开启,则使用系统全局设置)</div>
  373. <div style="color:#999">订单结算,才送积分。订单结算时间,请看订单——订单设置——售后期设置</div>
  374. </div>
  375. </div>
  376. <?php } ?>
  377. <?php if($index_sort_method == 1){ ?>
  378. <div class="layui-form-item" >
  379. <label class="layui-form-label">首页排序</label>
  380. <div class="layui-input-block">
  381. <div class="input-group">
  382. <input type="text" name="index_sort" id="index_sort" class="form-control" value="{$item['index_sort']}" />
  383. <span class="input-group-addon">备注:排序越大显示越靠前</span>
  384. </div>
  385. </div>
  386. </div>
  387. <?php } ?>
  388. </div>
  389. </div>
  390. <div class="region-goods-details ">
  391. <div class="layui-form-item">
  392. <div class="layui-form-item">
  393. <label class="layui-form-label">团购时间</label>
  394. <div class="layui-input-block">
  395. {:tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $item['begin_time']),'endtime'=>date('Y-m-d H:i', $item['end_time'])),true);}
  396. </div>
  397. </div>
  398. </div>
  399. </div>
  400. <div class="region-goods-details ">
  401. <div class="layui-form-item">
  402. <div class="layui-form-item">
  403. <label class="layui-form-label">单次限购</label>
  404. <div class="layui-input-block">
  405. <input type="text" name="one_limit_count" class="form-control " value="{$item['one_limit_count']}" />
  406. <div class="layui-form-mid layui-word-aux">用户单次提交订单最多可购买数,默认为0表示不限制</div>
  407. </div>
  408. </div>
  409. <div class="layui-form-item">
  410. <label class="layui-form-label">历史限购</label>
  411. <div class="layui-input-block">
  412. <input type="text" name="total_limit_count" class="form-control" value="{$item['total_limit_count']}" />
  413. <div class="layui-form-mid layui-word-aux">用户历史累积最多可购买数,默认为0表示不限制</div>
  414. </div>
  415. </div>
  416. </div>
  417. </div>
  418. <div class="region-goods-details ">
  419. <div class="region-goods-right col-sm-10">
  420. <?php if( empty($community_head_level) || count($community_head_level) ==1 || $is_head_takegoods ==0 ){ ?>
  421. <div class="layui-form-item">
  422. <label class="layui-form-label">商品独立团长提成</label>
  423. <?php if( !empty($community_money_type) && $community_money_type ==1 ){ ?>
  424. <div class="layui-col-sm-10 ">
  425. <div class="input-group">
  426. <input type="text" name="community_head_commission" id="community_head_commission" class="form-control valid" value="<?php if(empty($item)){ ?>{$communityhead_commission}<?php }else{ ?>{$item['community_head_commission']}<?php } ?>" />
  427. <span class="input-group-addon">元 </span>
  428. </div>
  429. <div class="layui-form-mid layui-word-aux">预计团长可得佣金¥<font ><?php if(isset($item['community_head_commission'])){ ?>{:round( $item['community_head_commission'] ,2) }<?php }else{ ?>0.00<?php } ?></font></div>
  430. </div>
  431. <?php }else{ ?>
  432. <div class="layui-col-sm-10 ">
  433. <div class="input-group">
  434. <input type="text" name="community_head_commission" id="community_head_commission" class="form-control valid" value="<?php if( empty($item)){ ?>{$communityhead_commission}<?php }else{ ?>{$item['community_head_commission']}<?php } ?>" />
  435. <span class="input-group-addon">% </span>
  436. </div>
  437. <div class="layui-form-mid layui-word-aux">预计团长可得佣金¥<font id="precommiss_head_money_tip"><?php if( isset($item['community_head_commission'])){ ?><?php echo round( ($item['community_head_commission']*$item['price'])/100 ,2); ?><?php }else{ ?>0.00<?php } ?></font>,将根据商品最终的成交价格来计算佣金</div>
  438. </div>
  439. <?php } ?>
  440. </div>
  441. <?php } ?>
  442. <div class="layui-form-item">
  443. <label class="layui-form-label">所有团长可销售</label>
  444. <div class="layui-input-block ">
  445. <input type="checkbox" lay-skin="primary" name="is_all_sale" class="form-control valid" <?php if( empty($item) || $item['is_all_sale'] ==1 || !isset($item['is_all_sale'])){ ?>checked<?php } ?> value="1" />
  446. </div>
  447. </div>
  448. <?php if($is_newbuy){ ?>
  449. <div class="layui-form-item">
  450. <label class="layui-form-label">新人专享</label>
  451. <div class="layui-input-block ">
  452. <input type="checkbox" id="xinrenckbox" lay-filter="xinrenckbox" lay-skin="primary" name="is_new_buy" class="form-control valid" <?php if( !empty($item) && $item['is_new_buy'] ==1 ){ ?>checked<?php } ?> value="1" />
  453. </div>
  454. <div class="layui-form-mid layui-word-aux" style="margin-left:15px;">未付款过的用户。勾选后,只在首页新人专区显示</div>
  455. </div>
  456. <?php } ?>
  457. <?php if( $seckill_is_open == 1 ){ ?>
  458. <div class="layui-form-item">
  459. <label class="layui-form-label">整点秒杀</label>
  460. <div class="layui-input-block ">
  461. <input type="checkbox" id="is_seckill" lay-filter="is_seckill" lay-skin="primary" name="is_seckill" class="form-control valid" <?php if( !empty($item) && $item['is_seckill'] ==1 ){ ?>checked<?php } ?> value="1" />
  462. </div>
  463. <div class="layui-form-mid layui-word-aux" style="margin-left:15px;">
  464. 勾选后,商品团购时间设置整点,后台——营销——整点秒杀勾选这个整点,系统会自动调用显示到“整点秒杀”方块以及该页面中。该整点开始前设置好这些,才会调用
  465. </div>
  466. </div>
  467. <?php } ?>
  468. <?php if($is_goodsspike){ ?>
  469. <div class="layui-form-item">
  470. <label class="layui-form-label">限时秒杀</label>
  471. <div class="layui-input-block ">
  472. <input type="checkbox" id="xianshickbox" lay-filter="xianshickbox" lay-skin="primary" name="is_spike_buy" class="form-control valid" <?php if(!empty($item) && $item['is_spike_buy'] ==1){ ?>checked<?php } ?> value="1" />
  473. </div>
  474. <div class="layui-form-mid layui-word-aux" style="margin-left:15px;">
  475. 勾选后,只在首页限时秒杀显示
  476. </div>
  477. </div>
  478. <?php } ?>
  479. <div class="layui-form-item">
  480. <label class="layui-form-label">限制普通会员下单</label>
  481. <div class="layui-input-block ">
  482. <input type="checkbox" lay-skin="primary" name="is_limit_levelunbuy" class="form-control valid" <?php if( !empty($item) && $item['is_limit_levelunbuy'] ==1 ){ ?>checked<?php } ?> value="1" />
  483. </div>
  484. <div class="layui-form-mid layui-word-aux" style="margin-left:15px;">
  485. 勾选后,默认等级会员不能购买此商品
  486. </div>
  487. </div>
  488. <div class="layui-form-item">
  489. <label class="layui-form-label">付费会员专享</label>
  490. <div class="layui-input-block ">
  491. <input type="checkbox" lay-skin="primary" name="is_limit_vipmember_buy" class="form-control valid" <?php if( !empty($item) && $item['is_limit_vipmember_buy'] ==1 ){ ?>checked<?php } ?> value="1" />
  492. </div>
  493. <div class="layui-form-mid layui-word-aux" style="margin-left:15px;">
  494. 勾选后,非vip会员不能购买此商品
  495. </div>
  496. </div>
  497. </div>
  498. </div>
  499. <?php if( !defined('ROLE') ){
  500. ?>
  501. <div class="region-goods-details ">
  502. <div class="layui-form-item">
  503. <label class="layui-form-label">选择供应商</label>
  504. <div class="layui-input-block">
  505. <div class="input-group " style="margin: 0;">
  506. <input type="text" disabled value="{$item['supply_id']}" class="form-control valid" name="supply_id" placeholder="" id="member_id">
  507. <span class="input-group-btn">
  508. <span data-input="#member_id" id="chose_member_id" class="btn btn-default">选择供应商</span>
  509. </span>
  510. </div>
  511. <?php if( $item['supply_info']){ ?>
  512. <div class="input-group " style="margin: 0;">
  513. <div class="layadmin-text-center choose_user">
  514. <img style="" src="{:tomedia($item['supply_info']['logo'])}">
  515. <div class="layadmin-maillist-img" style="">{$item['supply_info']['shopname']}</div>
  516. <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this,'member_id')"><i class="layui-icon">&#xe640;</i></button>
  517. </div>
  518. </div>
  519. <?php } ?>
  520. </div>
  521. </div>
  522. </div>
  523. <?php } ?>
  524. <script language="javascript">
  525. $(function () {
  526. $('#price').blur(function(){
  527. var price = parseFloat( $("#price").val() );
  528. var community_head_commission = parseFloat( $("#community_head_commission").val() );
  529. if(price > 0 && community_head_commission >0)
  530. {
  531. $('#precommiss_head_money_tip').html( ( (price * community_head_commission) /100 ).toFixed(2) );
  532. }else{
  533. $('#precommiss_head_money_tip').html('0.00');
  534. }
  535. })
  536. $("#community_head_commission").blur(function(){
  537. var price = parseFloat( $("#price").val() );
  538. var community_head_commission = parseFloat( $(this).val() );
  539. if(price > 0 && community_head_commission >0)
  540. {
  541. $('#precommiss_head_money_tip').html( ( (price * community_head_commission) /100 ).toFixed(2) );
  542. }else{
  543. $('#precommiss_head_money_tip').html('0.00');
  544. }
  545. });
  546. $('#radPickupDateTip input[type=radio]').click(function(){
  547. var s_val = $(this).val();
  548. if(s_val == 3)
  549. {
  550. $('#txtPickupDateTip').css('display','inline-block');
  551. }else{
  552. $('#txtPickupDateTip').css('display', 'none');
  553. }
  554. })
  555. $("input[name=isstatustime]").off('click').on('click',function () {
  556. if($(this).val()==1){
  557. $("#shelves").show()
  558. }else{
  559. $("#shelves").hide();
  560. }
  561. })
  562. })
  563. </script>
  564. <!--- 基本信息 end -->
  565. </div>
  566. <div class="layui-tab-item <?php if( $_GPC['tab']=='option'){ ?>layui-show<?php } ?>" >
  567. <!--规格begin-->
  568. <div class="region-goods-details ">
  569. <div class="region-goods-left col-sm-2">规格库存</div>
  570. <div class="region-goods-right col-sm-10">
  571. <div class="layui-form-item">
  572. <label class="layui-form-label">商品编码</label>
  573. <div class="layui-input-block">
  574. <input type="text" name="codes" class="form-control" value="{$item['codes']}" />
  575. <div class="help-block">商品编码 用部分商家用于统计</div>
  576. </div>
  577. </div>
  578. <div class="layui-form-item">
  579. <label class="layui-form-label">重量</label>
  580. <div class="layui-input-block">
  581. <div class="input-group fixsingle-input-group">
  582. <input type="text" name="weight" id="weight" <?php if( $item['hasoption']){ ?>readonly<?php } ?> class="form-control hasoption" value="{$item['weight']}"/>
  583. <span class="input-group-addon">克</span>
  584. </div>
  585. </div>
  586. </div>
  587. <div class="layui-form-item">
  588. <label class="layui-form-label">库存</label>
  589. <div class="layui-input-block">
  590. <input type="text" name="total" id="total" class="form-control hasoption" value="{$item['total']}" style="width:150px;display: inline;margin-right: 20px;" <?php if( $item['hasoption']){ ?>readonly<?php } ?>/>
  591. <span class="help-block">商品的剩余数量, 如启用多规格,则此处设置无效.</span>
  592. </div>
  593. </div>
  594. </div>
  595. </div>
  596. <div class="region-goods-details ">
  597. <div class="region-goods-left col-sm-2">
  598. 规格
  599. </div>
  600. <div class="region-goods-right col-sm-10">
  601. <div class="layui-form-item">
  602. <div class="layui-row" style=''>
  603. <input type="checkbox" lay-skin="primary" title="启用商品规格" lay-filter="hasoption" value="1" name="hasoption" <?php if( $item['hasoption']==1){ ?>checked<?php } ?> />
  604. <span class="help-block">启用商品规格后,商品的价格及库存以商品规格为准,库存设置为0则会到”已售罄“中,手机也不会显示, -1为不限制</span>
  605. </div>
  606. </div>
  607. <div id='tboption' style="padding-left:15px;<?php if( $item['hasoption']!=1){ ?>display:none<?php } ?>" >
  608. <div class="alert alert-info" style="display:none;">
  609. 1. 拖动规格可调整规格显示顺序, 更改规格及规格项后请点击下方的【刷新规格项目表】来更新数据。<br/>
  610. 2. 每一种规格代表不同型号,例如颜色为一种规格,尺寸为一种规格,如果设置多规格,手机用户必须每一种规格都选择一个规格项,才能添加购物车或购买。
  611. </div>
  612. <div id='specs'>
  613. <?php foreach( $item['allspecs'] as $spec ){ ?>
  614. <!--spec-->
  615. <div class='spec_item spec_class_{$cur_cate_id}' id="spec_{$spec['id']}" >
  616. <div style='border:1px solid #e7eaec;padding:10px;margin-bottom: 10px;' >
  617. <input name="spec_id[]" type="hidden" class="form-control spec_id" value="{$spec['id']}"/>
  618. <div class="form-group">
  619. <div class="col-sm-12">
  620. <div class='input-group'>
  621. <input name="spec_title[{$spec['id']}]" type="text" class="form-control spec_title" value="{$spec['title']}" placeholder="规格名称 (比如: 颜色)"/>
  622. <div class='input-group-btn'>
  623. <a href="javascript:;" id="add-specitem-{$spec['id']}" specid='{$spec['id']}' class='btn btn-info add-specitem' onclick="addSpecItem('{$spec['id']}')"><i class="fa fa-plus"></i> 添加规格项</a>
  624. <a href="javascript:void(0);" class='btn btn-danger' onclick="removeSpec('{$spec['id']}')"><i class="fa fa-remove"></i></a>
  625. </div>
  626. </div>
  627. </div>
  628. </div>
  629. <div class="form-group">
  630. <div class="col-md-12">
  631. <div id='spec_item_{$spec['id']}' class='spec_item_items'>
  632. <?php foreach( $spec['items'] as $specitem ){ ?>
  633. <!--spec_item begin-->
  634. <div class="spec_item_item" style="float:left;margin:5px;width:250px; position: relative">
  635. <input type="hidden" class="form-control spec_item_show" name="spec_item_show_{$spec['id']}[]" value="{$specitem['show']}" />
  636. <input type="hidden" class="form-control spec_item_id" name="spec_item_id_{$spec['id']}[]" value="{$specitem['id']}" />
  637. <div class="input-group">
  638. <span class="input-group-addon">
  639. <input type="checkbox" lay-skin="primary" <?php if( $specitem['id']>0){ ?>checked<?php } ?> value="1" onclick='showItem(this)'>
  640. </span>
  641. <input type="text" class="form-control spec_item_title" onblur="refreshOptions()" name="spec_item_title_{$spec['id']}[]" VALUE="{$specitem['title']}" />
  642. <span class="input-group-addon spec_item_thumb <?php if( !empty($specitem['thumb'])){ ?>has_thumb<?php } ?>">
  643. <input type='hidden' name="spec_item_thumb_{$spec['id']}[]" value="{$specitem['thumb']}"
  644. />
  645. <img onclick="selectSpecItemImage(this)"
  646. src="<?php if( empty($specitem['thumb'])){ ?><?php }else{ ?>{:resize($specitem['thumb'],100)}<?php } ?>" style='width:100%;'
  647. <?php if( !empty($specitem['thumb'])){ ?>
  648. data-toggle='popover'
  649. data-html ='true'
  650. data-placement='top'
  651. data-trigger ='hover'
  652. data-content="<img src='{:tomedia($specitem['thumb'])}' style='width:100px;height:100px;' />"
  653. <?php } ?>
  654. >
  655. <i class="fa fa-times-circle" <?php if( empty($specitem['thumb'])){ ?>style="display:none"<?php } ?>></i>
  656. </span>
  657. <span class="input-group-addon">
  658. <a href="javascript:;" onclick="removeSpecItem(this)" title='删除'><i class="fa fa-times"></i></a>
  659. <a href="javascript:;" class="fa fa-arrows" title="拖动调整显示顺序" ></a>
  660. </span>
  661. </div>
  662. </div>
  663. <!--spec_item end-->
  664. <?php } ?>
  665. </div>
  666. </div>
  667. </div>
  668. </div>
  669. </div>
  670. <!--end spec-->
  671. <?php } ?>
  672. </div>
  673. <table class="table">
  674. <tr>
  675. <td>
  676. <div class="layui-form-item">
  677. <label class="col-sm-2 control-label">选择规格</label>
  678. <div class="col-sm-8 col-xs-12">
  679. <select id="cates2" name='options[]' class="form-control select2" style='width:605px;' multiple='' >
  680. <?php foreach( $spec_list as $c ){ ?>
  681. <option value="{$c['id']}" data-names="{$c['value_str']}">{$c['name']}</option>
  682. <?php } ?>
  683. </select>
  684. </div>
  685. </div>
  686. <td>
  687. </tr>
  688. <tr>
  689. <td>
  690. <h4>
  691. <a href="javascript:;" class='btn btn-primary' id='add-spec' onclick="addSpec()" style="margin-top:10px;margin-bottom:10px;" title="添加规格"><i class='fa fa-plus'></i> 添加规格</a>
  692. <a style="display:none;" href="javascript:;" onclick="refreshOptions();" title="刷新规格项目表" class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新规格项目表</a>
  693. </h4>
  694. </td>
  695. </tr>
  696. <tr style="display: none;" >
  697. <td>
  698. <div class="alert alert-danger">警告:规格数据有变动,请重新点击上方 [刷新规格项目表] 按钮!</div>
  699. </td>
  700. </tr>
  701. </table>
  702. <div class="alert alert-info wholesalewarning" style="display:none;">
  703. </div>
  704. <div id="options" style="padding:0;">{$item['html']}</div>
  705. </div>
  706. </div>
  707. </div>
  708. <input type="hidden" name="optionArray" value=''>
  709. <input type="hidden" name="isdiscountDiscountsArray" value=''>
  710. <input type="hidden" name="discountArray" value=''>
  711. <input type="hidden" name="commissionArray" value=''>
  712. <!--规格end-->
  713. </div>
  714. <div class="layui-tab-item <?php if( $_GPC['tab']=='des'){ ?>layui-show<?php } ?>" >
  715. <div class="region-goods-details row">
  716. <div class="region-goods-left col-sm-2">商品详情</div>
  717. <div class=" region-goods-right col-sm-10">
  718. <div class="" >
  719. {:tpl_ueditor('content',htmlspecialchars_decode($item['content']),array('height'=>'300'))}
  720. </div>
  721. </div>
  722. </div>
  723. </div>
  724. <!---团长分销begin --->
  725. <div class="layui-tab-item <?php if( $_GPC['tab']=='community_head_level'){ ?>layui-show<?php } ?>" >
  726. <?php if( !empty($community_head_level) && count($community_head_level) > 1 && $is_head_takegoods == 1 ) { ?>
  727. <div class="region-goods-details row">
  728. <div class="region-goods-left col-sm-2">团长提成</div>
  729. <div class="region-goods-right col-sm-10">
  730. <div class="form-group">
  731. <label class="col-sm-2 control-label">独立规则</label>
  732. <div class="col-sm-9 col-xs-12">
  733. <input type="checkbox" id="is_modify_head_commission" lay-skin="primary" value="1" name="is_modify_head_commission" lay-filter="is_modify_head_commission" <?php if( $item['is_modify_head_commission']==1){ ?>checked<?php } ?> title="启用独立团长提成" />
  734. <span class="help-block">默认使用团长等级提成设置,启用独立团长提成设置,此商品拥有独自的团长提成比例,不受团长等级比例及默认设置限制</span>
  735. </div>
  736. </div>
  737. <div id="head_commission_div" <?php if( empty($item['is_modify_head_commission'])){ ?>style="display:none"<?php } ?> >
  738. <?php foreach($community_head_level as $head_level){ ?>
  739. <div class="form-group">
  740. <label class="col-sm-2 control-label"><?php echo $head_level['levelname']; ?></label>
  741. <div class="col-sm-4 col-xs-12">
  742. <div class="input-group">
  743. <input type="text" name="head_level<?php echo $head_level['id']; ?>" class="form-control" value="<?php echo $item['head_level'.$head_level['id']]; ?>" />
  744. <?php if( !empty($community_money_type) && $community_money_type ==1 ){ ?>
  745. <div class="input-group-addon">元 </div>
  746. <?php }else{ ?>
  747. <div class="input-group-addon">%{$community_money_type}</div>
  748. <?php } ?>
  749. </div>
  750. </div>
  751. </div>
  752. <?php } ?>
  753. </div>
  754. </div>
  755. </div>
  756. <?php } ?>
  757. <?php if($commiss_level > 0){ ?>
  758. <div class="region-goods-details row">
  759. <div class="region-goods-left col-sm-2">会员分销</div>
  760. <div class="region-goods-right col-sm-10">
  761. <div class="form-group">
  762. <label class="col-sm-2 control-label">是否参与分销</label>
  763. <div class="col-sm-9 col-xs-12">
  764. <input type="radio" value="0" name="nocommission" <?php if($item['nocommission']==0){ ?>checked<?php } ?> title="参与分销" />
  765. <input type="radio" value="1" name="nocommission" <?php if($item['nocommission']==1){ ?>checked<?php } ?> title="不参与分销" />
  766. <span class="help-block">如果不参与分销,则不产生分销佣金</span>
  767. </div>
  768. </div>
  769. <div class="form-group">
  770. <label class="col-sm-2 control-label">独立规则</label>
  771. <div class="col-sm-9 col-xs-12">
  772. <input type="checkbox" lay-filter="hascommission" lay-skin="primary" id="hascommission" value="1" name="hascommission" <?php if($item['hascommission']==1){ ?>checked<?php } ?> title="启用独立佣金比例" />
  773. <span class="help-block">启用独立佣金设置,此商品拥有独自的佣金比例,不受分销商等级比例及默认设置限制</span>
  774. </div>
  775. </div>
  776. <div style="clear:both;"></div>
  777. <div id="commission_div" <?php if(empty($item['hascommission'])){ ?>style="display:none"<?php } ?> >
  778. <div id="commission_0" <?php if($commission_type!=0){ ?> style="display:none;" <?php } ?>>
  779. <div class='alert alert-danger'>
  780. 如果比例为空,则使用固定规则,如果都为空则无分销佣金,都填写则以比例优先
  781. </div>
  782. <?php if($set['commiss_level']>=1){ ?>
  783. <div class="form-group">
  784. <label class="col-sm-2 control-label">一级分销</label>
  785. <div class="col-sm-4 col-xs-12">
  786. <div class="input-group">
  787. <input type="text" name="commission1_rate" id="commission1_rate" class="form-control" value="{$item['commission1_rate']}" />
  788. <div class="input-group-addon">% 固定</div>
  789. <input type="text" name="commission1_pay" id="commission1_pay" class="form-control" value="{$item['commission1_pay']}" />
  790. <div class="input-group-addon">元</div>
  791. </div>
  792. </div>
  793. </div>
  794. <?php } ?>
  795. <?php if($set['commiss_level']>=2){ ?>
  796. <div class="form-group">
  797. <label class="col-sm-2 control-label">二级分销</label>
  798. <div class="col-sm-4 col-xs-12">
  799. <div class="input-group">
  800. <input type="text" name="commission2_rate" id="commission2_rate" class="form-control" value="{$item['commission2_rate']}" />
  801. <div class="input-group-addon">% 固定</div>
  802. <input type="text" name="commission2_pay" id="commission2_pay" class="form-control" value="{$item['commission2_pay']}" />
  803. <div class="input-group-addon">元</div>
  804. </div>
  805. </div>
  806. </div>
  807. <?php } ?>
  808. <?php if($set['commiss_level']>=3){ ?>
  809. <div class="form-group">
  810. <label class="col-sm-2 control-label">三级分销</label>
  811. <div class="col-sm-4 col-xs-12">
  812. <div class="input-group">
  813. <input type="text" name="commission3_rate" id="commission3_rate" class="form-control" value="{$item['commission3_rate']}" />
  814. <div class="input-group-addon">% 固定</div>
  815. <input type="text" name="commission3_pay" id="commission3_pay" class="form-control" value="{$item['commission3_pay']}" />
  816. <div class="input-group-addon">元</div>
  817. </div>
  818. </div>
  819. </div>
  820. <?php } ?>
  821. </div>
  822. </div>
  823. </div>
  824. </div>
  825. <?php } ?>
  826. <div class="region-goods-details row">
  827. <div class="region-goods-left col-sm-2">会员等级折扣</div>
  828. <div class="region-goods-right col-sm-10">
  829. <div class="form-group">
  830. <label class="col-sm-2 control-label">是否参与会员折扣</label>
  831. <div class="col-sm-9 col-xs-12">
  832. <input type="radio" value="1" name="is_mb_level_buy" <?php if(!isset($item['is_mb_level_buy']) || $item['is_mb_level_buy']==1){ ?>checked<?php } ?> title="参与" />
  833. <input type="radio" value="0" name="is_mb_level_buy" <?php if($item['is_mb_level_buy']==0){ ?>checked<?php } ?> title="不参与" />
  834. <span class="help-block">如果不参与会员折扣,则不打折</span>
  835. </div>
  836. </div>
  837. </div>
  838. </div>
  839. <!--团长分销end--->
  840. </div>
  841. <div class="layui-tab-item <?php if( $_GPC['tab']=='goods_relative_goods'){ ?>layui-show<?php } ?>" >
  842. <div class="region-goods-details row">
  843. <div class="region-goods-left col-sm-2">推荐商品</div>
  844. <div class=" region-goods-right col-sm-10">
  845. <div class="input-group " style="margin: 0;">
  846. <input type="text" disabled value="" class="form-control valid" name="" placeholder="" id="agent_id">
  847. <span class="input-group-btn">
  848. <span data-input="#agent_id" id="chose_agent_id2" class="btn btn-default">选择商品</span>
  849. </span>
  850. </div>
  851. <?php if(!empty($limit_goods)){ ?>
  852. <?php foreach( $limit_goods as $goods ){ ?>
  853. <div class="input-group mult_choose_goodsid" data-gid="{$goods['gid']}" style="border-radius: 0;float: left;margin: 10px;margin-left:0px;width: 22%;">
  854. <div class="layadmin-text-center choose_user">
  855. <img style="" src="{$goods['image']}">
  856. <div class="layadmin-maillist-img" style="">{$goods['goodsname']}</div>
  857. <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)">
  858. <i class="layui-icon"></i>
  859. </button>
  860. </div>
  861. </div>
  862. <?php }} ?>
  863. </div>
  864. </div>
  865. </div>
  866. </div>
  867. <script>
  868. $(function(){
  869. $(".select2").select2({
  870. placeholder:'请选择',
  871. allowClear:true
  872. })
  873. })
  874. </script>
  875. <div class="layui-form-item">
  876. <label class="layui-form-label"> </label>
  877. <div class="layui-input-block">
  878. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  879. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  880. <a class="btn btn-default" style='margin-left:10px;' href="{:U('goods/index' , array( 'ok' => 1))}">返回列表</a>
  881. </div>
  882. </div>
  883. </form>
  884. </div>
  885. </div>
  886. </div>
  887. <script src="/layuiadmin/layui/layui.js"></script>
  888. <script type="text/javascript" src="/static/js/jquery-migrate-1.1.1.js"></script>
  889. <script src="/static/js/jquery-ui.min.js"></script>
  890. <style>
  891. .multi-img-details{width:100%;}
  892. </style>
  893. <script>
  894. layui.config({
  895. base: '/layuiadmin/' //静态资源所在路径
  896. }).extend({
  897. index: 'lib/index' //主入口模块
  898. }).use('index');
  899. </script>
  900. <script>
  901. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  902. var layer = layui.layer;
  903. var $;
  904. var cur_open_div;
  905. var form;
  906. layui.use(['jquery', 'layer','form'], function(){
  907. $ = layui.$;
  908. form = layui.form;
  909. console.log(22);
  910. form.on('radio(linktype)', function(data){
  911. if (data.value == 2) {
  912. $('#typeGroup').show();
  913. } else {
  914. $('#typeGroup').hide();
  915. }
  916. });
  917. form.on('checkbox(is_modify_sendscore)', function(data){
  918. console.log(data.elem.checked)
  919. if (data.elem.checked) {
  920. console.log(12);
  921. $("#send_score_divTip").css('display','inline');
  922. } else {
  923. console.log(33);
  924. $("#send_score_divTip").hide();
  925. }
  926. form.render('checkbox');
  927. });
  928. form.on('checkbox(xinrenckbox)', function(data){
  929. if (data.elem.checked) {
  930. $("#xianshickbox").removeAttr("checked");
  931. } else {
  932. }
  933. form.render('checkbox');
  934. });
  935. form.on('checkbox(xianshickbox)', function(data){
  936. if (data.elem.checked) {
  937. $("#xinrenckbox").removeAttr("checked");
  938. } else {
  939. }
  940. form.render('checkbox');
  941. });
  942. form.on('checkbox(hascommission)', function(data){
  943. if (data.elem.checked) {
  944. $('#commission_div').show();
  945. } else {
  946. $('#commission_div').hide();
  947. }
  948. })
  949. //hascommission
  950. $('#chose_label_id').click(function(){
  951. cur_open_div = $(this).attr('data-input');
  952. $.post("{:U('goods/labelquery', array('ok' => 1))}", {}, function(shtml){
  953. layer.open({
  954. type: 1,
  955. area: '930px',
  956. content: shtml //注意,如果str是object,那么需要字符拼接。
  957. });
  958. });
  959. })
  960. $('#chose_member_id').click(function(){
  961. cur_open_div = $(this).attr('data-input');
  962. $.post("{:U('supply/zhenquery', array('ok' => 1))}", {}, function(shtml){
  963. layer.open({
  964. type: 1,
  965. area: '930px',
  966. content: shtml //注意,如果str是object,那么需要字符拼接。
  967. });
  968. });
  969. })
  970. $('#chose_agent_id').click(function(){
  971. cur_open_div = $(this).attr('data-input');
  972. $.post("{:U('communityhead/query_head_user', array('ok' => 1))}", {}, function(shtml){
  973. layer.open({
  974. type: 1,
  975. area: '930px',
  976. content: shtml //注意,如果str是object,那么需要字符拼接。
  977. });
  978. });
  979. })
  980. $('#chose_link').click(function(){
  981. cur_open_div = $(this).attr('data-input');
  982. $.post("{:U('util.selecturl', array('ok' => 1))}", {}, function(shtml){
  983. layer.open({
  984. type: 1,
  985. area: '930px',
  986. content: shtml //注意,如果str是object,那么需要字符拼接。
  987. });
  988. });
  989. })
  990. $('.layui-tab-title li').click(function(){
  991. form.render('radio');
  992. form.render('checkbox');
  993. })
  994. //监听提交
  995. form.on('submit(formDemo)', function(data){
  996. var loadingIndex = layer.load();
  997. var s_cates = $('#cates').val();
  998. var cate_mult = [];
  999. for(var i in s_cates)
  1000. {
  1001. cate_mult.push(s_cates[i]);
  1002. }
  1003. data.field.cate_mult = cate_mult;
  1004. <?php if( !empty($is_open_goods_relative_goods) && $is_open_goods_relative_goods == 1 ){ ?>
  1005. var gd_ar = [];
  1006. var gd_str = '';
  1007. $('.mult_choose_goodsid').each(function(){
  1008. gd_ar.push( $(this).attr('data-gid') );
  1009. })
  1010. gd_str = gd_ar.join(',');
  1011. data.field.limit_goods_list = gd_str;
  1012. <?php } ?>
  1013. $.ajax({
  1014. url: data.form.action,
  1015. type: data.form.method,
  1016. data: data.field,
  1017. dataType:'json',
  1018. success: function (info) {
  1019. if(info.status == 0)
  1020. {
  1021. layer.msg(info.result.message,{icon: 1,time: 2000});
  1022. layer.close(loadingIndex);
  1023. }else if(info.status == 1){
  1024. var go_url = location.href;
  1025. if( info.result.hasOwnProperty("url") )
  1026. {
  1027. go_url = info.result.url;
  1028. }
  1029. layer.msg('操作成功',{time: 1000,
  1030. end:function(){
  1031. location.href = info.result.url;
  1032. }
  1033. });
  1034. }
  1035. }
  1036. });
  1037. return false;
  1038. });
  1039. form.on('checkbox(hasoption)', function(data){
  1040. if(data.elem.checked)
  1041. {
  1042. $('#goodssn').attr('readonly',true);
  1043. $('#productsn').attr('readonly',true);
  1044. $('#weight').attr('readonly',true);
  1045. $('#total').attr('readonly',true);
  1046. $("#tboption").show();
  1047. $("#tbdiscount").show();
  1048. $("#isdiscount_discounts").show();
  1049. $("#isdiscount_discounts_default").hide();
  1050. $("#commission").show();
  1051. $("#commission_default").hide();
  1052. $("#discounts_type1").show().parent().show();
  1053. refreshOptions();
  1054. }else{
  1055. $('#weight').removeAttr('readonly');
  1056. $('#total').removeAttr('readonly');
  1057. $("#tboption").hide();
  1058. refreshOptions();
  1059. $("#isdiscount_discounts").hide();
  1060. var isdiscount_discounts = $("#isdiscount_discounts").html();
  1061. $("#isdiscount_discounts").html('');
  1062. $("#isdiscount_discounts").html(isdiscount_discounts);
  1063. $("#tbdiscount").hide();
  1064. $("#isdiscount_discounts_default").show();
  1065. $("#commission_default").show();
  1066. $('#goodssn').removeAttr('readonly');
  1067. $('#productsn').removeAttr('readonly');
  1068. $("#discounts_type1").hide().parent().hide();
  1069. $("#discounts_type0").click();
  1070. $(this).prop("checked", false);
  1071. }
  1072. form.render('checkbox');
  1073. });
  1074. $('#chose_agent_id2').click(function(){
  1075. cur_open_div = $(this).attr('data-input');
  1076. $.post("{:U('goods/query_normal', array('template' => 'mult', 'unselect_goodsid' => $id))}", {}, function(shtml){
  1077. layer.open({
  1078. type: 1,
  1079. area: '930px',
  1080. content: shtml //注意,如果str是object,那么需要字符拼接。
  1081. });
  1082. });
  1083. })
  1084. form.on('checkbox(is_modify_head_commission)', function(data){
  1085. if(data.elem.checked)
  1086. {
  1087. $("#head_commission_div").show();
  1088. }else{
  1089. $("#head_commission_div").hide();
  1090. }
  1091. form.render('checkbox');
  1092. });
  1093. })
  1094. function cancle_bind(obj,sdiv)
  1095. {
  1096. $('#'+sdiv).val('');
  1097. $(obj).parent().parent().remove();
  1098. }
  1099. </script>
  1100. <script>
  1101. $(function () {
  1102. // 拖拽时开始滚动的间距
  1103. var scrollingSensitivity = 20
  1104. // 拖拽时滚动速度
  1105. let scrollingSpeed = 20
  1106. // 拖拽前的父级节点
  1107. let dragBeforeParentNode = null
  1108. // 初始化拖拽函数
  1109. $('.multi-img-details').sortable({
  1110. // 自适应placeholder的大小
  1111. forceHelperSize: true,
  1112. // 拖拽时的鼠标形状
  1113. cursor: '-webkit-grabbing',
  1114. // 拖拽的父级节点(该节点一定要注意,配置错误会导致当前屏幕外的元素没法自动滚动拖拽,两列之间拖拽的滚动也会出问题)
  1115. appendTo: '.layui-form-item',
  1116. // 拖拽时的倾斜度
  1117. rotate: '5deg',
  1118. // 延迟时间(毫秒),避免和click同时操作时出现的冲突
  1119. delay: 0,
  1120. // 以clone方式拖拽
  1121. helper: 'clone',
  1122. // 拖拽到边框出现滚动的间距,
  1123. scrollSensitivity: scrollingSensitivity,
  1124. // 应用于拖拽空白区域的样式
  1125. placeholder: 'portlet-placeholder ui-state-highlight',
  1126. // 允许拖拽预留空白区域
  1127. forcePlaceholderSize: false,
  1128. // 多个列表之间的拖拽的dom元素
  1129. connectWith: '.multi-img-details',
  1130. // 鼠标到区域则填充
  1131. tolerance: "pointer",
  1132. // 可以拖拽的项
  1133. items: '.multi-item',
  1134. // 填充动画
  1135. revert: 0,
  1136. // 拖拽结束函数
  1137. stop: (e, ui) => {
  1138. // 当前拽入的元素
  1139. let item = $(ui.item)
  1140. // 当前拽入元素的下标
  1141. let index = item.index()
  1142. let kid = ''
  1143. // xxxx 这里面可以操作数据更新
  1144. },
  1145. // 开始拖拽时的函数
  1146. start: (e, ui) => {
  1147. // 拖拽前的父级节点
  1148. dragBeforeParentNode = ui.item[0].parentNode
  1149. // 让placeholder和源高度一致
  1150. ui.helper.addClass('item').width(110)
  1151. // xxxx 这里可以记录一些拖拽前的元素属性
  1152. },
  1153. // 处理两列滚动条问题
  1154. sort: function (event, ui) {
  1155. var scrollContainer = ui.placeholder[0].parentNode
  1156. // 设置拽入的列表的滚动位置
  1157. var overflowOffset = $(scrollContainer).offset()
  1158. if ((overflowOffset.top + scrollContainer.offsetHeight) - event.pageY <
  1159. scrollingSensitivity) {
  1160. scrollContainer.scrollTop = scrollContainer.scrollTop + scrollingSpeed
  1161. } else if (event.pageY - overflowOffset.top < scrollingSensitivity) {
  1162. scrollContainer.scrollTop = scrollContainer.scrollTop - scrollingSpeed
  1163. }
  1164. }
  1165. }).disableSelection()
  1166. })
  1167. </script>
  1168. <script language="javascript">
  1169. var chose_cate = -1;
  1170. var chose_cate_id_arr = [];
  1171. $(function(){
  1172. $('#cates2').on('change',function(){
  1173. var s_length = $("#cates2 option:selected").length -1;
  1174. var options_name = $("#cates2 option:selected:eq("+s_length+")").text();
  1175. var options_str = $("#cates2 option:selected:eq("+s_length+")").attr('data-names');
  1176. if(s_length > chose_cate)
  1177. {
  1178. chose_cate++;
  1179. var cur_cate_id = '';
  1180. $("#cates2 option:selected").each(function(){
  1181. var tmp_cate_id = parseInt($(this).val());
  1182. if( $.inArray( tmp_cate_id, chose_cate_id_arr ) == -1)
  1183. {
  1184. chose_cate_id_arr.push( parseInt(tmp_cate_id) );
  1185. cur_cate_id = tmp_cate_id;
  1186. }
  1187. })
  1188. addSpecList(options_name,options_str,cur_cate_id);
  1189. }else{
  1190. chose_cate--;
  1191. var new_chose_cate_id_arr = [];
  1192. if(chose_cate_id_arr.length == 1)
  1193. {
  1194. $('.spec_class_'+chose_cate_id_arr[0]).remove();
  1195. }
  1196. $("#cates2 option:selected").each(function(){
  1197. var tmp_cate_id = parseInt( $(this).val() );
  1198. if( $.inArray( tmp_cate_id, chose_cate_id_arr ) != -1)
  1199. {
  1200. new_chose_cate_id_arr.push( parseInt(tmp_cate_id) );
  1201. chose_cate_id_arr.splice($.inArray( tmp_cate_id, chose_cate_id_arr ), 1);
  1202. }
  1203. })
  1204. if(chose_cate_id_arr.length == 1)
  1205. {
  1206. $('.spec_class_'+chose_cate_id_arr[0]).remove();
  1207. }
  1208. chose_cate_id_arr = new_chose_cate_id_arr;
  1209. refreshOptions();
  1210. }
  1211. })
  1212. $(document).on('input propertychange change', '#specs input', function () {
  1213. window.optionchanged = true;
  1214. $('#optiontip').show();
  1215. });
  1216. $(document).on('input propertychange change', '#specs input', function () {
  1217. window.optionchanged = true;
  1218. $('#optiontip').show();
  1219. });
  1220. $(".spec_item_thumb").find('i').click(function(){
  1221. var group =$(this).parent();
  1222. group.find('img').attr('src',"{SNAILFISH_LOCAL}static/images/nopic100.jpg");
  1223. group.find(':hidden').val('');
  1224. $(this).hide();
  1225. group.find('img').popover('destroy');
  1226. });
  1227. });
  1228. function selectSpecItemImage(obj){
  1229. util.image('',function(val){
  1230. $(obj).attr('src',val.url).popover({
  1231. trigger: 'hover',
  1232. html: true,
  1233. container: $(document.body),
  1234. content: "<img src='" + val.url + "' style='width:100px;height:100px;' />",
  1235. placement: 'top'
  1236. });
  1237. var group =$(obj).parent();
  1238. group.find(':hidden').val(val.attachment), group.find('i').show().unbind('click').click(function(){
  1239. $(obj).attr('src',"{SNAILFISH_LOCAL}static/images/nopic100.jpg");
  1240. group.find(':hidden').val('');
  1241. group.find('i').hide();
  1242. $(obj).popover('destroy');
  1243. });
  1244. });
  1245. }
  1246. function addSpecList(options_name,spec_str, cur_cate_id)
  1247. {
  1248. var len = $(".spec_item").length;
  1249. $("#add-spec").html("正在处理...").attr("disabled", "true").toggleClass("btn-primary");
  1250. var url = "{:U('goods/mult_tpl',array('tpl'=>'spec'))}";
  1251. $.ajax({
  1252. "url": url,
  1253. type:'post',
  1254. data:{options_name:options_name,spec_str:spec_str,cur_cate_id:cur_cate_id},
  1255. success:function(data){
  1256. $("#add-spec").html('<i class="fa fa-plus"></i> 添加规格').removeAttr("disabled").toggleClass("btn-primary"); ;
  1257. $('#specs').append(data);
  1258. var len = $(".add-specitem").length -1;
  1259. $(".add-specitem:eq(" +len+ ")").focus();
  1260. refreshOptions();
  1261. }
  1262. });
  1263. }
  1264. function addSpec(){
  1265. var len = $(".spec_item").length;
  1266. $("#add-spec").html("正在处理...").attr("disabled", "true").toggleClass("btn-primary");
  1267. var url = "{:U('goods/tpl',array('tpl'=>'spec'))}";
  1268. $.ajax({
  1269. "url": url,
  1270. success:function(data){
  1271. $("#add-spec").html('<i class="fa fa-plus"></i> 添加规格').removeAttr("disabled").toggleClass("btn-primary"); ;
  1272. $('#specs').append(data);
  1273. var len = $(".add-specitem").length -1;
  1274. $(".add-specitem:eq(" +len+ ")").focus();
  1275. refreshOptions();
  1276. }
  1277. });
  1278. }
  1279. function removeSpec(specid){
  1280. if (confirm('确认要删除此规格?')){
  1281. $("#spec_" + specid).remove();
  1282. refreshOptions();
  1283. }
  1284. }
  1285. function addSpecItem(specid){
  1286. $("#add-specitem-" + specid).html("正在处理...").attr("disabled", "true");
  1287. var url = "{:U('goods/tpl',array('tpl'=>'specitem'))}" + "&specid=" + specid;
  1288. $.ajax({
  1289. "url": url,
  1290. success:function(data){
  1291. $("#add-specitem-" + specid).html('<i class="fa fa-plus"></i> 添加规格项').removeAttr("disabled");
  1292. $('#spec_item_' + specid).append(data);
  1293. var len = $("#spec_" + specid + " .spec_item_title").length -1;
  1294. $("#spec_" + specid + " .spec_item_title:eq(" +len+ ")").focus();
  1295. refreshOptions
  1296. if(type==3 && virtual==0){
  1297. $(".choosetemp").show();
  1298. }
  1299. }
  1300. });
  1301. }
  1302. function removeSpecItem(obj){
  1303. $(obj).closest('.spec_item_item').remove();
  1304. refreshOptions();
  1305. }
  1306. function refreshOptions(){
  1307. // 刷新后重置
  1308. window.optionchanged = false;
  1309. $('#optiontip').hide();
  1310. var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
  1311. var specs = [];
  1312. if($('.spec_item').length<=0){
  1313. $("#options").html('');
  1314. $("#discount").html('');
  1315. $("#isdiscount_discounts").html('');
  1316. $("#commission").html('');
  1317. return;
  1318. }
  1319. $(".spec_item").each(function(i){
  1320. var _this = $(this);
  1321. var spec = {
  1322. id: _this.find(".spec_id").val(),
  1323. title: _this.find(".spec_title").val()
  1324. };
  1325. var items = [];
  1326. _this.find(".spec_item_item").each(function(){
  1327. var __this = $(this);
  1328. var item = {
  1329. id: __this.find(".spec_item_id").val(),
  1330. title: __this.find(".spec_item_title").val(),
  1331. virtual: __this.find(".spec_item_virtual").val(),
  1332. show:__this.find(".spec_item_show").get(0).checked?"1":"0"
  1333. }
  1334. items.push(item);
  1335. });
  1336. spec.items = items;
  1337. specs.push(spec);
  1338. });
  1339. specs.sort(function(x,y){
  1340. if (x.items.length > y.items.length){
  1341. return 1;
  1342. }
  1343. if (x.items.length < y.items.length) {
  1344. return -1;
  1345. }
  1346. });
  1347. var len = specs.length;
  1348. var newlen = 1;
  1349. var h = new Array(len);
  1350. var rowspans = new Array(len);
  1351. for(var i=0;i<len;i++){
  1352. html+="<th>" + specs[i].title + "</th>";
  1353. var itemlen = specs[i].items.length;
  1354. if(itemlen<=0) { itemlen = 1 };
  1355. newlen*=itemlen;
  1356. h[i] = new Array(newlen);
  1357. for(var j=0;j<newlen;j++){
  1358. h[i][j] = new Array();
  1359. }
  1360. var l = specs[i].items.length;
  1361. rowspans[i] = 1;
  1362. for(j=i+1;j<len;j++){
  1363. rowspans[i]*= specs[j].items.length;
  1364. }
  1365. }
  1366. html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">库存</div><div class="input-group"><input type="text" class="form-control input-sm option_stock_all" VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_stock\');"></a></span></div></div></th>';
  1367. html += '<th class="type-4"><div class=""><div style="padding-bottom:10px;text-align:center;">现价</div><div class="input-group"><input type="text" class="form-control input-sm option_marketprice_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_marketprice\');"></a></span></div></div></th>';
  1368. html+='<th class="type-4"><div class=""><div style="padding-bottom:10px;text-align:center;">原价</div><div class="input-group"><input type="text" class="form-control input-sm option_productprice_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_productprice\');"></a></span></div></div></th>';
  1369. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ){ ?>
  1370. html+='<th class="type-4"><div class=""><div style="padding-bottom:10px;text-align:center;">会员价</div><div class="input-group"><input type="text" class="form-control input-sm option_cardprice_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_cardprice\');"></a></span></div></div></th>';
  1371. <?php } ?>
  1372. html+='<th class="type-4"><div class=""><div style="padding-bottom:10px;text-align:center;">成本价</div><div class="input-group"><input type="text" class="form-control input-sm option_costprice_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_costprice\');"></a></span></div></div></th>';
  1373. html+='<th><div class=""><div style="padding-bottom:10px;text-align:center;">编码</div><div class="input-group"><input type="text" class="form-control input-sm option_goodssn_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_goodssn\');"></a></span></div></div></th>';
  1374. html+='<th><div class=""><div style="padding-bottom:10px;text-align:center;">重量(克)</div><div class="input-group"><input type="text" class="form-control input-sm option_weight_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_weight\');"></a></span></div></div></th>';
  1375. html+='</tr></thead>';
  1376. for(var m=0;m<len;m++){
  1377. var k = 0,kid = 0,n=0;
  1378. for(var j=0;j<newlen;j++){
  1379. var rowspan = rowspans[m];
  1380. if( j % rowspan==0){
  1381. h[m][j]={title: specs[m].items[kid].title, virtual: specs[m].items[kid].virtual,html: "<td class='full' rowspan='" +rowspan + "'>"+ specs[m].items[kid].title+"</td>\r\n",id: specs[m].items[kid].id};
  1382. }
  1383. else{
  1384. h[m][j]={title:specs[m].items[kid].title,virtual: specs[m].items[kid].virtual, html: "",id: specs[m].items[kid].id};
  1385. }
  1386. n++;
  1387. if(n==rowspan){
  1388. kid++; if(kid>specs[m].items.length-1) { kid=0; }
  1389. n=0;
  1390. }
  1391. }
  1392. }
  1393. var hh = "";
  1394. for(var i=0;i<newlen;i++){
  1395. hh+="<tr>";
  1396. var ids = [];
  1397. var titles = [];
  1398. var virtuals = [];
  1399. for(var j=0;j<len;j++){
  1400. hh+=h[j][i].html;
  1401. ids.push( h[j][i].id);
  1402. titles.push( h[j][i].title);
  1403. virtuals.push( h[j][i].virtual);
  1404. }
  1405. ids =ids.join('_');
  1406. titles= titles.join('+');
  1407. var val ={ id : "",title:titles, stock : "",presell : "",costprice : "",productprice : "",<?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ){ ?>cardprice:"",<?php } ?>marketprice : "",weight:"",productsn:"",goodssn:"",virtual:virtuals };
  1408. if( $(".option_id_" + ids).length>0){
  1409. val ={
  1410. id : $(".option_id_" + ids+":eq(0)").val(),
  1411. title: titles,
  1412. stock : $(".option_stock_" + ids+":eq(0)").val(),
  1413. presell : $(".option_presell_" + ids+":eq(0)").val(),
  1414. costprice : $(".option_costprice_" + ids+":eq(0)").val(),
  1415. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ){ ?>
  1416. cardprice : $(".option_cardprice_" + ids+":eq(0)").val(),
  1417. <?php } ?>
  1418. productprice : $(".option_productprice_" + ids+":eq(0)").val(),
  1419. marketprice : $(".option_marketprice_" + ids +":eq(0)").val(),
  1420. goodssn : $(".option_goodssn_" + ids +":eq(0)").val(),
  1421. productsn : $(".option_productsn_" + ids +":eq(0)").val(),
  1422. weight : $(".option_weight_" + ids+":eq(0)").val(),
  1423. virtual : virtuals
  1424. }
  1425. }
  1426. hh += '<td>'
  1427. hh += '<input name="option_stock_' + ids +'" type="text" class="form-control option_stock option_stock_' + ids +'" value="' +(val.stock=='undefined'?'':val.stock )+'"/></td>';
  1428. hh += '<input name="option_id_' + ids+'" type="hidden" class="form-control option_id option_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
  1429. hh += '<input name="option_ids[]" type="hidden" class="form-control option_ids option_ids_' + ids +'" value="' + ids +'"/>';
  1430. hh += '<input name="option_title_' + ids +'" type="hidden" class="form-control option_title option_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
  1431. hh += '<input name="option_virtual_' + ids +'" type="hidden" class="form-control option_virtual option_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
  1432. hh += '</td>';
  1433. //hh += '<td class="type-4"><input data-name="option_presell_' + ids+'" type="text" class="form-control option_presell option_presell_' + ids +'" value="' +(val.presell=='undefined'?'':val.presell )+'"/></td>';
  1434. hh += '<td class="type-4"><input name="option_marketprice_' + ids+'" type="text" class="form-control option_marketprice option_marketprice_' + ids +'" value="' +(val.marketprice=='undefined'?'':val.marketprice )+'"/></td>';
  1435. hh += '<td class="type-4"><input name="option_productprice_' + ids+'" type="text" class="form-control option_productprice option_productprice_' + ids +'" " value="' +(val.productprice=='undefined'?'':val.productprice )+'"/></td>';
  1436. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ){ ?>
  1437. hh += '<td class="type-4"><input name="option_cardprice_' + ids+'" type="text" class="form-control option_cardprice option_cardprice_' + ids +'" " value="' +(val.cardprice=='undefined'?'':val.cardprice )+'"/></td>';
  1438. <?php } ?>
  1439. hh += '<td class="type-4"><input name="option_costprice_' +ids+'" type="text" class="form-control option_costprice option_costprice_' + ids +'" " value="' +(val.costprice=='undefined'?'':val.costprice )+'"/></td>';
  1440. hh += '<td><input name="option_goodssn_' +ids+'" type="text" class="form-control option_goodssn option_goodssn_' + ids +'" " value="' +(val.goodssn=='undefined'?'':val.goodssn )+'"/></td>';
  1441. //hh += '<td><input data-name="option_productsn_' +ids+'" type="text" class="form-control option_productsn option_productsn_' + ids +'" " value="' +(val.productsn=='undefined'?'':val.productsn )+'"/></td>';
  1442. hh += '<td><input name="option_weight_' + ids +'" type="text" class="form-control option_weight option_weight_' + ids +'" " value="' +(val.weight=='undefined'?'':val.weight )+'"/></td>';
  1443. hh += "</tr>";
  1444. }
  1445. html+=hh;
  1446. html+="</table>";
  1447. $("#options").html(html);
  1448. refreshDiscount();
  1449. refreshIsDiscount();
  1450. if(window.type=='4'){
  1451. $('.type-4').hide();
  1452. }else{
  1453. $('.type-4').show();
  1454. }
  1455. }
  1456. function refreshDiscount() {
  1457. var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
  1458. var specs = [];
  1459. $(".spec_item").each(function (i) {
  1460. var _this = $(this);
  1461. var spec = {
  1462. id: _this.find(".spec_id").val(),
  1463. title: _this.find(".spec_title").val()
  1464. };
  1465. var items = [];
  1466. _this.find(".spec_item_item").each(function () {
  1467. var __this = $(this);
  1468. var item = {
  1469. id: __this.find(".spec_item_id").val(),
  1470. title: __this.find(".spec_item_title").val(),
  1471. virtual: __this.find(".spec_item_virtual").val(),
  1472. show: __this.find(".spec_item_show").get(0).checked ? "1" : "0"
  1473. }
  1474. items.push(item);
  1475. });
  1476. spec.items = items;
  1477. specs.push(spec);
  1478. });
  1479. specs.sort(function (x, y) {
  1480. if (x.items.length > y.items.length) {
  1481. return 1;
  1482. }
  1483. if (x.items.length < y.items.length) {
  1484. return -1;
  1485. }
  1486. });
  1487. var len = specs.length;
  1488. var newlen = 1;
  1489. var h = new Array(len);
  1490. var rowspans = new Array(len);
  1491. for (var i = 0; i < len; i++) {
  1492. html += "<th>" + specs[i].title + "</th>";
  1493. var itemlen = specs[i].items.length;
  1494. if (itemlen <= 0) {
  1495. itemlen = 1
  1496. }
  1497. ;
  1498. newlen *= itemlen;
  1499. h[i] = new Array(newlen);
  1500. for (var j = 0; j < newlen; j++) {
  1501. h[i][j] = new Array();
  1502. }
  1503. var l = specs[i].items.length;
  1504. rowspans[i] = 1;
  1505. for (j = i + 1; j < len; j++) {
  1506. rowspans[i] *= specs[j].items.length;
  1507. }
  1508. }
  1509. <?php foreach( $levels as $level ){ ?>
  1510. <?php if( $level['key']=='default'){ ?>
  1511. html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">{$level['levelname']}</div><div class="input-group"><input type="text" class="form-control input-sm discount_{$level["key"]}_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'discount_{$level["key"]}\');"></a></span></div></div></th>';
  1512. <?php }else{ ?>
  1513. html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">{$level['levelname']}</div><div class="input-group"><input type="text" class="form-control input-sm discount_level{$level['id']}_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'discount_level{$level['id']}\');"></a></span></div></div></th>';
  1514. <?php } ?>
  1515. <?php } ?>
  1516. html += '</tr></thead>';
  1517. for (var m = 0; m < len; m++) {
  1518. var k = 0, kid = 0, n = 0;
  1519. for (var j = 0; j < newlen; j++) {
  1520. var rowspan = rowspans[m];
  1521. if (j % rowspan == 0) {
  1522. h[m][j] = {
  1523. title: specs[m].items[kid].title,
  1524. virtual: specs[m].items[kid].virtual,
  1525. html: "<td class='full' rowspan='" + rowspan + "'>" + specs[m].items[kid].title + "</td>\r\n",
  1526. id: specs[m].items[kid].id
  1527. };
  1528. }
  1529. else {
  1530. h[m][j] = {
  1531. title: specs[m].items[kid].title,
  1532. virtual: specs[m].items[kid].virtual,
  1533. html: "",
  1534. id: specs[m].items[kid].id
  1535. };
  1536. }
  1537. n++;
  1538. if (n == rowspan) {
  1539. kid++;
  1540. if (kid > specs[m].items.length - 1) {
  1541. kid = 0;
  1542. }
  1543. n = 0;
  1544. }
  1545. }
  1546. }
  1547. var hh = "";
  1548. for (var i = 0; i < newlen; i++) {
  1549. hh += "<tr>";
  1550. var ids = [];
  1551. var titles = [];
  1552. var virtuals = [];
  1553. for (var j = 0; j < len; j++) {
  1554. hh += h[j][i].html;
  1555. ids.push(h[j][i].id);
  1556. titles.push(h[j][i].title);
  1557. virtuals.push(h[j][i].virtual);
  1558. }
  1559. ids = ids.join('_');
  1560. titles = titles.join('+');
  1561. var val = {
  1562. id: "",
  1563. title: titles,
  1564. <?php foreach( $levels as $level ){ ?>
  1565. <?php if( $level['key']=='default'){ ?>
  1566. level{$level['key']}: '',
  1567. <?php }else{ ?>
  1568. level{$level['id']}: '',
  1569. <?php } ?>
  1570. <?php } ?>
  1571. costprice: "",
  1572. presell: "",
  1573. productprice: "",
  1574. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ){ ?>
  1575. cardprice: "",
  1576. <?php } ?>
  1577. marketprice: "",
  1578. weight: "",
  1579. productsn: "",
  1580. goodssn: "",
  1581. virtual: virtuals
  1582. };
  1583. var val ={ id : "",title:titles,<?php foreach( $levels as $level ){ ?><?php if( $level['key']=='default'){ ?> level{$level['key']}: '',<?php }else{ ?> level{$level['id']}: '',<?php } ?><?php } ?>costprice : "",productprice : "",marketprice : "",weight:"",productsn:"",goodssn:"",virtual:virtuals };
  1584. if ($(".discount_id_" + ids).length > 0) {
  1585. val = {
  1586. id: $(".discount_id_" + ids + ":eq(0)").val(),
  1587. title: titles,
  1588. <?php foreach( $levels as $level ){ ?>
  1589. <?php if( $level['key']=='default'){ ?>
  1590. level{$level['key']}: $(".discount_{$level['key']}_" + ids + ":eq(0)").val(),
  1591. <?php }else{ ?>
  1592. level{$level['id']}: $(".discount_level{$level['id']}_" + ids + ":eq(0)").val(),
  1593. <?php } ?>
  1594. <?php } ?>
  1595. costprice: $(".discount_costprice_" + ids + ":eq(0)").val(),
  1596. presell: $(".discount_presell_" + ids + ":eq(0)").val(),
  1597. productprice: $(".discount_productprice_" + ids + ":eq(0)").val(),
  1598. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ){ ?>
  1599. cardprice: $(".discount_cardprice_" + ids + ":eq(0)").val(),
  1600. <?php } ?>
  1601. marketprice: $(".discount_marketprice_" + ids + ":eq(0)").val(),
  1602. presell: $(".discount_presell_" + ids + ":eq(0)").val(),
  1603. goodssn: $(".discount_goodssn_" + ids + ":eq(0)").val(),
  1604. productsn: $(".discount_productsn_" + ids + ":eq(0)").val(),
  1605. weight: $(".discount_weight_" + ids + ":eq(0)").val(),
  1606. virtual: virtuals
  1607. }
  1608. }
  1609. <?php foreach( $levels as $level ){ ?>
  1610. hh += '<td>'
  1611. <?php if( $level['key']=='default'){ ?>
  1612. hh += '<input data-name="discount_level_{$level['key']}_' + ids +'"type="text" class="form-control discount_{$level['key']} discount_{$level['key']}_' + ids +'" value="' +(val.level{$level['key']}=='undefined'?'':val.level{$level['key']} )+'"/>';
  1613. <?php }else{ ?>
  1614. hh += '<input data-name="discount_level_{$level['id']}_' + ids +'"type="text" class="form-control discount_level{$level['id']} discount_level{$level['id']}_' + ids +'" value="' +(val.level{$level['id']}=='undefined'?'':val.level{$level['id']} )+'"/>';
  1615. <?php } ?>
  1616. hh += '</td>';
  1617. <?php } ?>
  1618. hh += '<input data-name="discount_id_' + ids+'"type="hidden" class="form-control discount_id discount_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
  1619. hh += '<input data-name="discount_ids"type="hidden" class="form-control discount_ids discount_ids_' + ids +'" value="' + ids +'"/>';
  1620. hh += '<input data-name="discount_title_' + ids +'"type="hidden" class="form-control discount_title discount_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
  1621. hh += '<input data-name="discount_virtual_' + ids +'"type="hidden" class="form-control discount_virtual discount_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
  1622. hh += "</tr>";
  1623. }
  1624. html += hh;
  1625. html += "</table>";
  1626. $("#discount").html(html);
  1627. }
  1628. function refreshIsDiscount() {
  1629. var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
  1630. var specs = [];
  1631. $(".spec_item").each(function (i) {
  1632. var _this = $(this);
  1633. var spec = {
  1634. id: _this.find(".spec_id").val(),
  1635. title: _this.find(".spec_title").val()
  1636. };
  1637. var items = [];
  1638. _this.find(".spec_item_item").each(function () {
  1639. var __this = $(this);
  1640. var item = {
  1641. id: __this.find(".spec_item_id").val(),
  1642. title: __this.find(".spec_item_title").val(),
  1643. virtual: __this.find(".spec_item_virtual").val(),
  1644. show: __this.find(".spec_item_show").get(0).checked ? "1" : "0"
  1645. }
  1646. items.push(item);
  1647. });
  1648. spec.items = items;
  1649. specs.push(spec);
  1650. });
  1651. specs.sort(function (x, y) {
  1652. if (x.items.length > y.items.length) {
  1653. return 1;
  1654. }
  1655. if (x.items.length < y.items.length) {
  1656. return -1;
  1657. }
  1658. });
  1659. var len = specs.length;
  1660. var newlen = 1;
  1661. var h = new Array(len);
  1662. var rowspans = new Array(len);
  1663. for (var i = 0; i < len; i++) {
  1664. html += "<th>" + specs[i].title + "</th>";
  1665. var itemlen = specs[i].items.length;
  1666. if (itemlen <= 0) {
  1667. itemlen = 1
  1668. }
  1669. ;
  1670. newlen *= itemlen;
  1671. h[i] = new Array(newlen);
  1672. for (var j = 0; j < newlen; j++) {
  1673. h[i][j] = new Array();
  1674. }
  1675. var l = specs[i].items.length;
  1676. rowspans[i] = 1;
  1677. for (j = i + 1; j < len; j++) {
  1678. rowspans[i] *= specs[j].items.length;
  1679. }
  1680. }
  1681. <?php foreach( $levels as $level ){ ?>
  1682. <?php if( $level['key']=='default'){ ?>
  1683. html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">{$level['levelname']}</div><div class="input-group"><input type="text" class="form-control input-sm isdiscount_discounts_{$level['key']}_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'isdiscount_discounts_{$level['key']}\');"></a></span></div></div></th>';
  1684. <?php }else{ ?>
  1685. html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">{$level['levelname']}</div><div class="input-group"><input type="text" class="form-control input-sm isdiscount_discounts_level{$level['id']}_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'isdiscount_discounts_level{$level['id']}\');"></a></span></div></div></th>';
  1686. <?php } ?>
  1687. <?php } ?>
  1688. html += '</tr></thead>';
  1689. for (var m = 0; m < len; m++) {
  1690. var k = 0, kid = 0, n = 0;
  1691. for (var j = 0; j < newlen; j++) {
  1692. var rowspan = rowspans[m];
  1693. if (j % rowspan == 0) {
  1694. h[m][j] = {
  1695. title: specs[m].items[kid].title,
  1696. virtual: specs[m].items[kid].virtual,
  1697. html: "<td class='full' rowspan='" + rowspan + "'>" + specs[m].items[kid].title + "</td>\r\n",
  1698. id: specs[m].items[kid].id
  1699. };
  1700. }
  1701. else {
  1702. h[m][j] = {
  1703. title: specs[m].items[kid].title,
  1704. virtual: specs[m].items[kid].virtual,
  1705. html: "",
  1706. id: specs[m].items[kid].id
  1707. };
  1708. }
  1709. n++;
  1710. if (n == rowspan) {
  1711. kid++;
  1712. if (kid > specs[m].items.length - 1) {
  1713. kid = 0;
  1714. }
  1715. n = 0;
  1716. }
  1717. }
  1718. }
  1719. var hh = "";
  1720. for (var i = 0; i < newlen; i++) {
  1721. hh += "<tr>";
  1722. var ids = [];
  1723. var titles = [];
  1724. var virtuals = [];
  1725. for (var j = 0; j < len; j++) {
  1726. hh += h[j][i].html;
  1727. ids.push(h[j][i].id);
  1728. titles.push(h[j][i].title);
  1729. virtuals.push(h[j][i].virtual);
  1730. }
  1731. ids = ids.join('_');
  1732. titles = titles.join('+');
  1733. var val = {
  1734. id: "",
  1735. title: titles,
  1736. <?php foreach( $levels as $level ){ ?>
  1737. <?php if( $level['key']=='default'){ ?>
  1738. level{$level['key']}: '',
  1739. <?php }else{ ?>
  1740. level{$level['if']}: '',
  1741. <?php } ?>
  1742. <?php } ?>
  1743. costprice: "",
  1744. presell: "",
  1745. productprice: "",
  1746. marketprice: "",
  1747. weight: "",
  1748. productsn: "",
  1749. goodssn: "",
  1750. virtual: virtuals
  1751. };
  1752. var val ={ id : "",title:titles,<?php foreach( $levels as $level ){ ?><?php if( $level['key']=='default'){ ?> level{$level['key']}: '',<?php }else{ ?> level{$level['id']}: '',<?php } ?><?php } ?>costprice : "",productprice : "",marketprice : "",weight:"",productsn:"",goodssn:"",virtual:virtuals };
  1753. if ($(".isdiscount_discounts_id_" + ids).length > 0) {
  1754. val = {
  1755. id: $(".isdiscount_discounts_id_" + ids + ":eq(0)").val(),
  1756. title: titles,
  1757. <?php foreach( $levels as $level ){ ?>
  1758. <?php if( $level['key']=='default'){ ?>
  1759. level{$level['key']}: $(".isdiscount_discounts_{$level['key']}_" + ids + ":eq(0)").val(),
  1760. <?php }else{ ?>
  1761. level{$level['id']}: $(".isdiscount_discounts_level{$level['id']}_" + ids + ":eq(0)").val(),
  1762. <?php } ?>
  1763. <?php } ?>
  1764. costprice: $(".isdiscount_discounts_costprice_" + ids + ":eq(0)").val(),
  1765. productprice: $(".isdiscount_discounts_productprice_" + ids + ":eq(0)").val(),
  1766. marketprice: $(".isdiscount_discounts_marketprice_" + ids + ":eq(0)").val(),
  1767. presell: $(".isdiscount_discounts_presell_" + ids + ":eq(0)").val(),
  1768. goodssn: $(".isdiscount_discounts_goodssn_" + ids + ":eq(0)").val(),
  1769. productsn: $(".isdiscount_discounts_productsn_" + ids + ":eq(0)").val(),
  1770. weight: $(".isdiscount_discounts_weight_" + ids + ":eq(0)").val(),
  1771. virtual: virtuals
  1772. }
  1773. }
  1774. <?php foreach( $levels as $level ){ ?>
  1775. hh += '<td>'
  1776. <?php if( $level['key']=='default'){ ?>
  1777. hh += '<input data-name="isdiscount_discounts_level_{$level['key']}_' + ids +'"type="text" class="form-control isdiscount_discounts_{$level['key']} isdiscount_discounts_{$level['key']}_' + ids +'" value="' +(val.level{$level['key']}=='undefined'?'':val.level{$level['key']} )+'"/>';
  1778. <?php }else{ ?>
  1779. hh += '<input data-name="isdiscount_discounts_level_{$level['id']}_' + ids +'"type="text" class="form-control isdiscount_discounts_level{$level['id']} isdiscount_discounts_level{$level['id']}_' + ids +'" value="' +(val.level{$level['id']}=='undefined'?'':val.level{$level['id']} )+'"/>';
  1780. <?php } ?>
  1781. hh += '</td>';
  1782. <?php } ?>
  1783. hh += '<input data-name="isdiscount_discounts_id_' + ids+'"type="hidden" class="form-control isdiscount_discounts_id isdiscount_discounts_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
  1784. hh += '<input data-name="isdiscount_discounts_ids"type="hidden" class="form-control isdiscount_discounts_ids isdiscount_discounts_ids_' + ids +'" value="' + ids +'"/>';
  1785. hh += '<input data-name="isdiscount_discounts_title_' + ids +'"type="hidden" class="form-control isdiscount_discounts_title isdiscount_discounts_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
  1786. hh += '<input data-name="isdiscount_discounts_virtual_' + ids +'"type="hidden" class="form-control isdiscount_discounts_virtual isdiscount_discounts_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
  1787. hh += "</tr>";
  1788. }
  1789. html += hh;
  1790. html += "</table>";
  1791. $("#isdiscount_discounts").html(html);
  1792. }
  1793. function refreshCommission() {
  1794. var commission_level = {:json_encode($commission_level)};
  1795. var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
  1796. var specs = [];
  1797. $(".spec_item").each(function (i) {
  1798. var _this = $(this);
  1799. var spec = {
  1800. id: _this.find(".spec_id").val(),
  1801. title: _this.find(".spec_title").val()
  1802. };
  1803. var items = [];
  1804. _this.find(".spec_item_item").each(function () {
  1805. var __this = $(this);
  1806. var item = {
  1807. id: __this.find(".spec_item_id").val(),
  1808. title: __this.find(".spec_item_title").val(),
  1809. virtual: __this.find(".spec_item_virtual").val(),
  1810. show: __this.find(".spec_item_show").get(0).checked ? "1" : "0"
  1811. }
  1812. items.push(item);
  1813. });
  1814. spec.items = items;
  1815. specs.push(spec);
  1816. });
  1817. specs.sort(function (x, y) {
  1818. if (x.items.length > y.items.length) {
  1819. return 1;
  1820. }
  1821. if (x.items.length < y.items.length) {
  1822. return -1;
  1823. }
  1824. });
  1825. var len = specs.length;
  1826. var newlen = 1;
  1827. var h = new Array(len);
  1828. var rowspans = new Array(len);
  1829. for (var i = 0; i < len; i++) {
  1830. html += "<th>" + specs[i].title + "</th>";
  1831. var itemlen = specs[i].items.length;
  1832. if (itemlen <= 0) {
  1833. itemlen = 1
  1834. }
  1835. ;
  1836. newlen *= itemlen;
  1837. h[i] = new Array(newlen);
  1838. for (var j = 0; j < newlen; j++) {
  1839. h[i][j] = new Array();
  1840. }
  1841. var l = specs[i].items.length;
  1842. rowspans[i] = 1;
  1843. for (j = i + 1; j < len; j++) {
  1844. rowspans[i] *= specs[j].items.length;
  1845. }
  1846. }
  1847. $.each(commission_level,function (key,level) {
  1848. html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">'+level.levelname+'</div></div></th>';
  1849. })
  1850. html += '</tr></thead>';
  1851. for (var m = 0; m < len; m++) {
  1852. var k = 0, kid = 0, n = 0;
  1853. for (var j = 0; j < newlen; j++) {
  1854. var rowspan = rowspans[m];
  1855. if (j % rowspan == 0) {
  1856. h[m][j] = {
  1857. title: specs[m].items[kid].title,
  1858. virtual: specs[m].items[kid].virtual,
  1859. html: "<td class='full' rowspan='" + rowspan + "'>" + specs[m].items[kid].title + "</td>\r\n",
  1860. id: specs[m].items[kid].id
  1861. };
  1862. }
  1863. else {
  1864. h[m][j] = {
  1865. title: specs[m].items[kid].title,
  1866. virtual: specs[m].items[kid].virtual,
  1867. html: "",
  1868. id: specs[m].items[kid].id
  1869. };
  1870. }
  1871. n++;
  1872. if (n == rowspan) {
  1873. kid++;
  1874. if (kid > specs[m].items.length - 1) {
  1875. kid = 0;
  1876. }
  1877. n = 0;
  1878. }
  1879. }
  1880. }
  1881. var hh = "";
  1882. for (var i = 0; i < newlen; i++) {
  1883. hh += "<tr>";
  1884. var ids = [];
  1885. var titles = [];
  1886. var virtuals = [];
  1887. for (var j = 0; j < len; j++) {
  1888. hh += h[j][i].html;
  1889. ids.push(h[j][i].id);
  1890. titles.push(h[j][i].title);
  1891. virtuals.push(h[j][i].virtual);
  1892. }
  1893. ids = ids.join('_');
  1894. titles = titles.join('+');
  1895. var val = {
  1896. id: "",
  1897. title: titles,
  1898. <?php foreach( $commission_level as $level ){ ?>
  1899. <?php if( $level["key"] == "default"){ ?>
  1900. level{$level['key']}: '',
  1901. <?php }else{ ?>
  1902. level{$level['id']}: '',
  1903. <?php } ?>
  1904. <?php } ?>
  1905. costprice: "",
  1906. presell: "",
  1907. productprice: "",
  1908. marketprice: "",
  1909. weight: "",
  1910. productsn: "",
  1911. goodssn: "",
  1912. virtual: virtuals
  1913. };
  1914. var val ={ id : "",title:titles,<?php foreach( $commission_level as $level ){ ?> <?php if( $level["key"] == "default"){ ?>level{$level['key']}: '',<?php }else{ ?>level{$level['id']}: '',<?php } ?><?php } ?>costprice : "",productprice : "",marketprice : "",weight:"",productsn:"",goodssn:"",virtual:virtuals };
  1915. <?php foreach( $commission_level as $level ){ ?>
  1916. <?php if( $level["key"] == "default"){ ?>
  1917. var level{$level['key']} = new Array(3);
  1918. $(".commission_{$level['key']}_"+ ids).each(function(index,val){
  1919. level{$level['key']}[index] = val;
  1920. })
  1921. <?php }else{ ?>
  1922. var level{$level['id']} = new Array(3);
  1923. $(".commission_level{$level['id']}_"+ ids).each(function(index,val){
  1924. level{$level['id']}[index] = val;
  1925. })
  1926. <?php } ?>
  1927. <?php } ?>
  1928. if ($(".commission_id_" + ids).length > 0) {
  1929. val = {
  1930. id: $(".commission_id_" + ids + ":eq(0)").val(),
  1931. title: titles,
  1932. costprice: $(".commission_costprice_" + ids + ":eq(0)").val(),
  1933. presell: $(".commission_presell_" + ids + ":eq(0)").val(),
  1934. productprice: $(".commission_productprice_" + ids + ":eq(0)").val(),
  1935. marketprice: $(".commission_marketprice_" + ids + ":eq(0)").val(),
  1936. goodssn: $(".commission_goodssn_" + ids + ":eq(0)").val(),
  1937. productsn: $(".commission_productsn_" + ids + ":eq(0)").val(),
  1938. weight: $(".commission_weight_" + ids + ":eq(0)").val(),
  1939. virtual: virtuals
  1940. }
  1941. }
  1942. <?php foreach( $commission_level as $level ){ ?>
  1943. hh += '<td>';
  1944. var level_temp = <?php if( $level['key'] == 'default'){ ?>level{$level['key']}<?php }else{ ?>level{$level['id']}<?php } ?>;
  1945. if (len >= i && typeof (level_temp) != 'undefined')
  1946. {
  1947. if('{$level['key']}' == 'default')
  1948. {
  1949. for (var li = 0; li<{$shopset_level};li++)
  1950. {
  1951. if (typeof (level_temp[li])!= "undefined")
  1952. {
  1953. hh += '<input data-name="commission_level_{$level['key']}_' +ids+ '" type="text" class="form-control commission_{$level['key']} commission_{$level['key']}_' +ids+ '" value="' +$(level_temp[li]).val()+ '" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
  1954. }
  1955. else
  1956. {
  1957. hh += '<input data-name="commission_level_{$level['key']}_' +ids+ '" type="text" class="form-control commission_{$level['key']} commission_{$level['key']}_' +ids+ '" value="" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
  1958. }
  1959. }
  1960. }
  1961. else
  1962. {
  1963. for (var li = 0; li<{$shopset_level};li++)
  1964. {
  1965. if (typeof (level_temp[li])!= "undefined")
  1966. {
  1967. hh += '<input data-name="commission_level_{$level['id']}_' +ids+ '" type="text" class="form-control commission_level{$level['id']} commission_level{$level['id']}_' +ids+ '" value="' +$(level_temp[li]).val()+ '" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
  1968. }
  1969. else
  1970. {
  1971. hh += '<input data-name="commission_level_{$level['id']}_' +ids+ '" type="text" class="form-control commission_level{$level['id']} commission_level{$level['id']}_' +ids+ '" value="" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
  1972. }
  1973. }
  1974. }
  1975. }
  1976. else
  1977. {
  1978. if('{$level['key']}' == 'default')
  1979. {
  1980. for (var li = 0; li<{$shopset_level};li++)
  1981. {
  1982. if (typeof (level_temp[li])!= "undefined")
  1983. {
  1984. hh += '<input data-name="commission_level_{$level['key']}_' +ids+ '" type="text" class="form-control commission_{$level['key']} commission_{$level['key']}_' +ids+ '" value="' +$(level_temp[li]).val()+ '" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
  1985. }
  1986. else
  1987. {
  1988. hh += '<input data-name="commission_level_{$level['key']}_' +ids+ '" type="text" class="form-control commission_{$level['key']} commission_{$level['key']}_' +ids+ '" value="" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
  1989. }
  1990. }
  1991. }
  1992. else
  1993. {
  1994. for (var li = 0; li<{$shopset_level};li++)
  1995. {
  1996. if (typeof (level_temp[li])!= "undefined")
  1997. {
  1998. hh += '<input data-name="commission_level_{$level['id']}_' +ids+ '" type="text" class="form-control commission_level{$level['id']} commission_level{$level['id']}_' +ids+ '" value="' +$(level_temp[li]).val()+ '" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
  1999. }
  2000. else
  2001. {
  2002. hh += '<input data-name="commission_level_{$level['id']}_' +ids+ '" type="text" class="form-control commission_level{$level['id']} commission_level{$level['id']}_' +ids+ '" value="" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
  2003. }
  2004. }
  2005. }
  2006. }
  2007. hh += '</td>';
  2008. <?php } ?>
  2009. hh += '<input data-name="commission_id_' + ids+'"type="hidden" class="form-control commission_id commission_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
  2010. hh += '<input data-name="commission_ids"type="hidden" class="form-control commission_ids commission_ids_' + ids +'" value="' + ids +'"/>';
  2011. hh += '<input data-name="commission_title_' + ids +'"type="hidden" class="form-control commission_title commission_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
  2012. hh += '<input data-name="commission_virtual_' + ids +'"type="hidden" class="form-control commission_virtual commission_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
  2013. hh += "</tr>";
  2014. }
  2015. html += hh;
  2016. html += "</table>";
  2017. $("#commission").html(html);
  2018. }
  2019. function setCol(cls){
  2020. $("."+cls).val( $("."+cls+"_all").val());
  2021. }
  2022. function showItem(obj){
  2023. var show = $(obj).get(0).checked?"1":"0";
  2024. $(obj).parents('.spec_item_item').find('.spec_item_show:eq(0)').val(show);
  2025. }
  2026. function nofind(){
  2027. var img=event.srcElement;
  2028. img.src="./resource/image/module-nopic-small.jpg";
  2029. img.onerror=null;
  2030. }
  2031. function choosetemp(id){
  2032. $('#modal-module-chooestemp').modal();
  2033. $('#modal-module-chooestemp').data("temp",id);
  2034. }
  2035. function addtemp(){
  2036. var id = $('#modal-module-chooestemp').data("temp");
  2037. var temp_id = $('#modal-module-chooestemp').find("select").val();
  2038. var temp_name = $('#modal-module-chooestemp option[value='+temp_id+']').text();
  2039. //alert(temp_id+":"+temp_name);
  2040. $("#temp_name_"+id).val(temp_name);
  2041. $("#temp_id_"+id).val(temp_id);
  2042. $('#modal-module-chooestemp .close').click();
  2043. refreshOptions()
  2044. }
  2045. function setinterval(type)
  2046. {
  2047. var intervalfloor =$('#intervalfloor').val();
  2048. if(intervalfloor=="")
  2049. {
  2050. intervalfloor=0;
  2051. }
  2052. intervalfloor = parseInt(intervalfloor);
  2053. if(type=='plus')
  2054. {
  2055. if(intervalfloor==3)
  2056. {
  2057. tip.msgbox.err("最多添加三个区间价格");
  2058. return;
  2059. }
  2060. intervalfloor=intervalfloor+1;
  2061. }
  2062. else if(type=='minus')
  2063. {
  2064. if(intervalfloor==0)
  2065. {
  2066. tip.msgbox.err("请最少添加一个区间价格");
  2067. return;
  2068. }
  2069. intervalfloor=intervalfloor-1;
  2070. }else
  2071. {
  2072. return;
  2073. }
  2074. if(intervalfloor<1)
  2075. {
  2076. $('#interval1').hide();
  2077. $('#intervalnum1').val("");
  2078. $('#intervalprice1').val("");
  2079. }else
  2080. {
  2081. $('#interval1').show();
  2082. }
  2083. if(intervalfloor<2)
  2084. {
  2085. $('#interval2').hide();
  2086. $('#intervalnum2').val("");
  2087. $('#intervalprice2').val("");
  2088. }else
  2089. {
  2090. $('#interval2').show();
  2091. }
  2092. if(intervalfloor<3)
  2093. {
  2094. $('#interval3').hide();
  2095. $('#intervalnum3').val("");
  2096. $('#intervalprice3').val("");
  2097. }else
  2098. {
  2099. $('#interval3').show();
  2100. }
  2101. $('#intervalfloor').val(intervalfloor);
  2102. }
  2103. </script>
  2104. <script language="javascript">
  2105. $(function() {
  2106. })
  2107. </script>
  2108. </body>