addgoods.html 137 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605
  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. .fa-arrows{display:none;}
  82. .spec_item_thumb img{min-height:20px;}
  83. .choose_room_title{position: absolute;top: 0px;left: -90px;font-size: 14px;}
  84. </style>
  85. </head>
  86. <body layadmin-themealias="default">
  87. <div class="layui-fluid">
  88. <div class="layui-card">
  89. <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>
  90. <div class="layui-card-body" style="padding:15px;">
  91. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
  92. <input type="hidden" name="goods_id" id="goods_id" value="{$id}"/>
  93. <input type="hidden" name="head_id_arr" id="head_id_arr" value="{$head_id_arr}"/>
  94. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  95. <ul class="layui-tab-title">
  96. <li <?php if( empty($_GPC['tab']) || $_GPC['tab']=='basic'){ ?>class="layui-this"<?php } ?>>基本信息</li>
  97. <li <?php if( $_GPC['tab']=='option'){ ?>class="layui-this"<?php } ?> >规格库存</li>
  98. <li <?php if( $_GPC['tab']=='des'){ ?>class="layui-this"<?php } ?> >商品详情</li>
  99. <?php $commiss_level = D('Home/Front')->get_config_by_name('commiss_level');
  100. ?>
  101. <li <?php if( $_GPC['tab']=='community_head_level'){ ?>class="layui-this"<?php } ?> >提成/分销/等级</li>
  102. <?php if( !empty($is_open_goods_relative_goods) && $is_open_goods_relative_goods == 1 ){ ?>
  103. <li <?php if( $_GPC['tab']=='goods_relative_goods'){ ?>class="layui-this"<?php } ?> >推荐商品</li>
  104. <?php } ?>
  105. </ul>
  106. <div class="layui-tab-content" >
  107. <div class="layui-tab-item <?php if( empty($_GPC['tab']) || $_GPC['tab']=='basic'){ ?>layui-show<?php } ?>" >
  108. <!---- 基本信息begin --->
  109. <div class="region-goods-details layui-row">
  110. <div class="layui-form-item">
  111. <div class="layui-form-item" style="padding-top:10px;">
  112. <label class="layui-form-label must">商品名称<label style="color:red;font-size:16px;font-weight:900">*</label></label>
  113. <div class="layui-input-block" style="padding-right:0;" >
  114. <input type="text" name="goodsname" id="goodsname" class="form-control" value="{$item['goodsname']}" data-rule-required="true" />
  115. </div>
  116. </div>
  117. <div class="layui-form-item">
  118. <label class="layui-form-label">商品分类</label>
  119. <div class="layui-input-block">
  120. <select id="cates" multiple="multiple" name='cates[]' class="form-control select2" >
  121. <?php foreach( $category as $c ){ ?>
  122. <option value="{$c['id']}" <?php if( is_array($item['cates']) && in_array($c['id'],$item['cates'])){ ?>selected<?php } ?> >{$c['name']}</option>
  123. <?php } ?>
  124. </select>
  125. </div>
  126. </div>
  127. <div class="layui-form-item">
  128. <label class="layui-form-label">商品简介</label>
  129. <div class="layui-input-block">
  130. <textarea name="subtitle" id="subtitle" rows="5" class="form-control" data-parent=".subtitle" maxlength="100" data-rule-maxlength="100">{$item['subtitle']}</textarea>
  131. <div class="layui-form-mid layui-word-aux">商品名称下方的副标题,标题长度请控制在100字以内</div>
  132. </div>
  133. </div>
  134. <div class="layui-form-item">
  135. <label class="layui-form-label">商品简短标题</label>
  136. <div class="layui-input-block">
  137. <input type="text" name="print_sub_title" id="print_sub_title" class="form-control" value="{$item['print_sub_title']}" />
  138. <div class="layui-form-mid layui-word-aux">小票打印机使用,请控制字数,未填写默认截取商品标题(无须打印的可以不填写)</div>
  139. </div>
  140. </div>
  141. <div class="layui-form-item">
  142. <label class="layui-form-label must">商品视频</label>
  143. <div class="layui-input-block gimgs">
  144. {:tpl_form_field_video('video',$item['video'] );}
  145. <span class="layui-form-mid layui-word-aux image-block">
  146. 请输入视频链接地址或者选择上传视频(支持抖音视频地址)
  147. </span>
  148. </div>
  149. </div>
  150. <div class="layui-form-item">
  151. <label class="layui-form-label must">首页商品(大图)</label>
  152. <div class="layui-input-block gimgs">
  153. {:tpl_form_field_image2('big_img',$item['big_img'])}
  154. <span class="layui-form-mid layui-word-aux image-block">此图为首页商品大图模式封面图,最佳尺寸:710*400</span>
  155. </div>
  156. </div>
  157. <div class="layui-form-item">
  158. <label class="layui-form-label must">商品图片<label style="color:red;font-size:16px;font-weight:900">*</label></label>
  159. <div class="layui-input-block gimgs" id="gimgs_mult">
  160. {:tpl_form_field_multi_image3('thumbs',$item['piclist'])}
  161. <span class="layui-form-mid layui-word-aux image-block">商品详情页主图(轮播图),第一张为商品列表调用图,<span style="color: red;">图片类型必须为jpg或者png24,不支持png8</span>,建议为正方型,尺寸建议宽度为640,并保持图片大小一致,可拖拽改变图片顺序</span>
  162. </div>
  163. </div>
  164. <div class="layui-form-item">
  165. <label class="layui-form-label">分享标题</label>
  166. <div class="layui-input-block">
  167. <input type="text" name="share_title" class="form-control" value="{$item['share_title']}" />
  168. <div class="layui-form-mid layui-word-aux"></div>
  169. </div>
  170. </div>
  171. <div class="layui-form-item">
  172. <label class="layui-form-label ">分享图片</label>
  173. <div class="layui-input-block gimgs">
  174. {:tpl_form_field_image2('goods_share_image',$item['goods_share_image'])}
  175. <span class="layui-form-mid layui-word-aux image-block">此图为商品详情页分享图片(比例为长宽比5:4)</span>
  176. </div>
  177. </div>
  178. <div class="layui-form-item">
  179. <label class="layui-form-label">起售数量</label>
  180. <div class="layui-input-block">
  181. <div style="float: left;height: 35px;line-height:35px">商品至少&nbsp;&nbsp;</div>
  182. <input style="width: 35px; height: 35px; border: 2px white; float: left;" type="button" value="-" onclick="reduction(this)"/>
  183. <input type="text" name="goods_start_count" class="layui-input goods_start_count" value="<?php if( isset($item['goods_start_count']) && !empty($item['goods_start_count'])){echo $item['goods_start_count'];}else{echo '1';} ?>" maxlength="10" style="width: 100px;float: left;" onchange="validationNumber(this, 0)"/>
  184. <input style="width: 35px; height: 35px; border: 2px white;float: left;" type="button" value="+" onclick="add(this)"/>
  185. <div style="float: left;height: 35px;line-height:35px">&nbsp;&nbsp;件起售</div>
  186. <br/>
  187. <div style="clear:both;"></div>
  188. <span class="layui-form-mid layui-word-aux image-block">起售数量超出商品库存时,买家无法购买该商品</span>
  189. </div>
  190. </div>
  191. <?php if($is_updown){ ?>
  192. <div class="layui-form-item">
  193. <label class="layui-form-label">商品状态</label>
  194. <div class="layui-input-block">
  195. <label class="radio-inline"><input type="radio" name="grounding" value="1" <?php if( !isset($item['grounding']) || $item['grounding'] == 1){ ?>checked="true"<?php } ?> title="上架" /> </label>
  196. <label class="radio-inline"><input type="radio" name="grounding" value="0" <?php if( isset($item['grounding']) && $item['grounding'] == 0){ ?>checked="true"<?php } ?> title="下架" /> </label>
  197. </div>
  198. </div>
  199. <?php } ?>
  200. <?php if($is_index){ ?>
  201. <div class="layui-form-item">
  202. <label class="layui-form-label">首页推荐</label>
  203. <div class="layui-input-block">
  204. <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>
  205. <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>
  206. </div>
  207. </div>
  208. <?php } ?>
  209. <div class="layui-form-item" style="display:none;">
  210. <label class="layui-form-label">分享描述</label>
  211. <div class="layui-input-block">
  212. <input type="text" name="share_description" class="form-control" value="{$item['share_description']}" />
  213. <div class="layui-form-mid layui-word-aux">公众号才有的,小程序没有这个描述</div>
  214. </div>
  215. </div>
  216. <div class="layui-form-item price" >
  217. <label class="layui-form-label">售价<label style="color:red;font-size:16px;font-weight:900">*</label></label>
  218. <div class="layui-input-block">
  219. <div class="input-group">
  220. <input type="text" name="price" id="price" class="form-control" value="{$item['price']}" <?php if($item['hasoption']!=1){ ?> <?php } ?> />
  221. <span class="input-group-addon">元&nbsp;</span>
  222. <span class="input-group-addon">原价(市场价、划线价)</span>
  223. <input type="text" name="productprice" id="productprice" class="form-control" value="{$item['productprice']}" />
  224. <span class="input-group-addon">元&nbsp;</span>
  225. <span class="input-group-addon"> 成本价</span>
  226. <input type="text" name="costprice" id="costpriceprice" class="form-control" value="{$item['costprice']}" placeholder=""/>
  227. <span class="input-group-addon">元&nbsp;</span>
  228. </div>
  229. <span class='layui-form-mid layui-word-aux' style="display:none;">如未启用商品规格,请填写商品价格</span>
  230. </div>
  231. </div>
  232. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ){ ?>
  233. <div class="layui-form-item" >
  234. <label class="layui-form-label">付费会员专享价</label>
  235. <div class="col-sm-10 col-xs-12" style="width: 600px;">
  236. <div class="radio-inline">
  237. <input type="checkbox" lay-skin="primary" lay-filter="is_take_vipcard" name="is_take_vipcard" <?php if( isset($item['is_take_vipcard']) && $item['is_take_vipcard'] ==1 ){ ?> checked <?php } ?> value="1" />
  238. <div class="input-group card_price_txt" style="width:500px;float: right; <?php if( isset($item['is_take_vipcard']) && $item['is_take_vipcard'] ==1 ){ ?><?php }else{?>display: none;<?php } ?>">
  239. <span class="input-group-addon">商品付费会员价</span>
  240. <input type="text" name="card_price" id="card_price" style="width: 360px;" class="form-control" value="{$item['card_price']}" placeholder="请填写会员价"/>
  241. <span class="input-group-addon" style="width: auto;">元&nbsp;</span>
  242. </div>
  243. <div style="clear:both;"></div>
  244. <span class="layui-form-mid layui-word-aux">开启后,付费会员下单享专属价格</span>
  245. </div>
  246. </div>
  247. </div>
  248. <?php } ?>
  249. <?php if($is_vir_count){ ?>
  250. <div class="layui-form-item" >
  251. <label class="layui-form-label">已出售数</label>
  252. <div class="layui-input-block">
  253. <div class="input-group">
  254. <input type="text" name="sales" id="sales" class="form-control" value="{$item['sales']}" />
  255. <span class="input-group-addon">备注:前台销量=虚拟销量+实际销量</span>
  256. </div>
  257. </div>
  258. </div>
  259. <?php } ?>
  260. <div class="layui-form-item" style="display:none;">
  261. <label class="layui-form-label"></label>
  262. <div class="layui-input-block">
  263. <label class="checkbox-inline"><input type="checkbox" name="showsales" value="1" <?php if( $item['showsales'] == 1){ ?>checked="true"<?php } ?> /> 显示销量</label>
  264. <span class="layui-form-mid layui-word-aux"></span>
  265. </div>
  266. </div>
  267. <div class="layui-form-item" style="display:none;">
  268. <label class="layui-form-label">标签</label>
  269. <div class="layui-input-block">
  270. <label class="checkbox-inline"><input type="checkbox" name="quality" value="1" <?php if( !empty($item['quality'])){ ?>checked="true"<?php } ?> /> 正品保证</label>
  271. <label class="checkbox-inline"><input type="checkbox" name="seven" value="1" <?php if( !empty($item['seven'])){ ?>checked="true"<?php } ?> /> 7天无理由退换</label>
  272. <label class="checkbox-inline"><input type="checkbox" name="repair" value="1" <?php if( !empty($item['repair'])){ ?>checked="true"<?php } ?> /> 保修</label>
  273. </div>
  274. </div>
  275. <div class="layui-form-item">
  276. <label class="layui-form-label">自定义标签</label>
  277. <div class="layui-input-block">
  278. <div class="input-group " style="margin: 0;">
  279. <input type="text" disabled value="{$item['label']['id']}" class="form-control valid" name="labelname" placeholder="" id="label_id">
  280. <span class="input-group-btn">
  281. <span data-input="#label_id" id="chose_label_id" class="btn btn-default">选择标签</span>
  282. </span>
  283. </div>
  284. <?php if( $item['label']){ ?>
  285. <div class="input-group " style="margin: 0;">
  286. <div class="layadmin-text-center choose_user">
  287. <div class="" style="">{$item['label']['tagname']}</div>
  288. <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this,'label_id')"><i class="layui-icon">&#xe640;</i></button>
  289. </div>
  290. </div>
  291. <?php } ?>
  292. </div>
  293. </div>
  294. <div class="layui-form-item dispatch_info">
  295. <label class="layui-form-label"></label>
  296. <div class="layui-input-block" style='padding-left:0'>
  297. <div class="input-group">
  298. <span class='input-group-addon' style='border:none;padding:0px;'><label class="radio-inline" style='margin-top:-7px;' >
  299. <input type="radio"name="dispatchtype" value="1" <?php if( $item['dispatchtype'] == 1){ ?>checked="true"<?php } ?> title="统一邮费" /> </label></span>
  300. <input type="text" name="dispatchprice" id="dispatchprice" class="form-control" value="{$item['dispatchprice']}" />
  301. <span class="input-group-addon">元</span>
  302. </div>
  303. </div>
  304. </div>
  305. <?php
  306. $is_show_fullre = true;
  307. if (defined('ROLE') && ROLE == 'agenter' ) {
  308. $supper_info = get_agent_logininfo();
  309. if($supper_info['type'] == 1)
  310. {
  311. $is_show_fullre = false;
  312. }
  313. }
  314. ?>
  315. <?php if( $is_show_fullre && !empty($is_open_fullreduction) && $is_open_fullreduction == 1){ ?>
  316. <div class="layui-form-item" >
  317. <label class="layui-form-label">满减活动</label>
  318. <div class="col-sm-10 col-xs-12">
  319. <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>
  320. <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>
  321. <div style="color:red;margin-left: 25px;">独立供应商不参与平台满减活动</div>
  322. </div>
  323. </div>
  324. <?php } ?>
  325. <?php if($open_buy_send_score == 1){ ?>
  326. <?php if($supply_can_goods_sendscore == 1){ ?>
  327. <div class="layui-form-item" >
  328. <label class="layui-form-label">下单送积分</label>
  329. <div class="col-sm-10 col-xs-12" id="send_score_div">
  330. <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" />
  331. <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']}" >
  332. <div id="send_score_divTip2" style=" display: inline; <?php if(isset($item['is_modify_sendscore']) && $item['is_modify_sendscore'] ==1){ ?>display:inline;<?php }else{ ?>display: none;<?php } ?>">积分</div>
  333. <div style="clear:both;"></div>
  334. <div style="color:#999">赠送数量 = 商品数量 * 下单送积分数量(未开启,则使用系统全局设置)</div>
  335. <div style="color:#999">订单结算,才送积分。订单结算时间,请看订单——订单设置——售后期设置</div>
  336. </div>
  337. </div>
  338. <?php } ?>
  339. <?php } ?>
  340. <?php if($index_sort_method == 1){ ?>
  341. <div class="layui-form-item" >
  342. <label class="layui-form-label">首页排序</label>
  343. <div class="layui-input-block">
  344. <div class="input-group">
  345. <input type="text" name="index_sort" id="index_sort" class="form-control" value="{$item['index_sort']}" />
  346. <span class="input-group-addon">备注:排序越大显示越靠前</span>
  347. </div>
  348. </div>
  349. </div>
  350. <?php } ?>
  351. </div>
  352. </div>
  353. <div class="region-goods-details ">
  354. <div class="layui-form-item">
  355. <div class="layui-form-item">
  356. <label class="layui-form-label">团购时间</label>
  357. <div class="layui-input-block">
  358. {: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);}
  359. </div>
  360. </div>
  361. </div>
  362. </div>
  363. <div class="region-goods-details ">
  364. <div class="layui-form-item">
  365. <div class="layui-form-item">
  366. <label class="layui-form-label">每天限购</label>
  367. <div class="layui-input-block">
  368. <input type="text" name="oneday_limit_count" class="form-control " value="{$item['oneday_limit_count']}" />
  369. <div class="layui-form-mid layui-word-aux">用户每天提交订单最多可购买数,默认为0表示不限制</div>
  370. </div>
  371. </div>
  372. </div>
  373. </div>
  374. <div class="region-goods-details ">
  375. <div class="layui-form-item">
  376. <div class="layui-form-item">
  377. <label class="layui-form-label">单次限购</label>
  378. <div class="layui-input-block">
  379. <input type="text" name="one_limit_count" class="form-control " value="{$item['one_limit_count']}" />
  380. <div class="layui-form-mid layui-word-aux">用户单次提交订单最多可购买数,默认为0表示不限制</div>
  381. </div>
  382. </div>
  383. <div class="layui-form-item">
  384. <label class="layui-form-label">历史限购</label>
  385. <div class="layui-input-block">
  386. <input type="text" name="total_limit_count" class="form-control" value="{$item['total_limit_count']}" />
  387. <div class="layui-form-mid layui-word-aux">用户历史累积最多可购买数,默认为0表示不限制</div>
  388. </div>
  389. </div>
  390. </div>
  391. </div>
  392. <div class="region-goods-details ">
  393. <div class="layui-form-item">
  394. <div class="layui-form-item">
  395. <label class="layui-form-label">关联兑换码</label>
  396. <div class="layui-input-block">
  397. <select name="virtual_code_id" class="form-control select2">
  398. <option value="0">请选择关联兑换码</option>
  399. <?php foreach( $virtualcard_code_list as $code_value ){ ?>
  400. <option value="{$code_value['id']}" <?php if( $goods_virtualcode_id == $code_value['id'] ){ ?> selected<?php } ?> >{$code_value['code_name']}</option>
  401. <?php } ?>
  402. </select>
  403. <input type="hidden" name="is_virtualcard_goods" value="1" />
  404. <div class="layui-form-mid layui-word-aux">商品出售后,在订单详情可以看到对应的兑换码序号</div>
  405. </div>
  406. </div>
  407. </div>
  408. </div>
  409. <div class="region-goods-details ">
  410. <div class="region-goods-right col-sm-10">
  411. <!--
  412. <?php if( empty($community_head_level) || count($community_head_level) ==1 || $is_head_takegoods ==0 ){ ?>
  413. <div class="layui-form-item">
  414. <label class="layui-form-label"></label>
  415. <div class="layui-col-sm-10 ">
  416. <input type="checkbox" id="is_community_head_commission" lay-skin="primary" value="1" name="is_community_head_commission" lay-filter="is_community_head_commission" <?php if( $item['is_community_head_commission']==1){ ?>checked<?php } ?> title="商品启用独立团长提成" />
  417. <br />
  418. <div class="layui-form-mid layui-word-aux" style="margin-left: 155px;" >勾选使用 商品独立团长提成 计算佣金,不勾选则使用 后台——“团长设置”中团长提成比例 计算佣金</div>
  419. </div>
  420. </div>
  421. <div id="head_commission_div2" <?php if( empty($item['is_community_head_commission'])){ ?>style="display:none"<?php } ?> >
  422. <div class="layui-form-item">
  423. <label class="layui-form-label">商品独立团长提成</label>
  424. <?php if( !empty($community_money_type) && $community_money_type ==1 ){ ?>
  425. <div class="layui-col-sm-10 ">
  426. <div class="input-group">
  427. <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 } ?>" />
  428. <span class="input-group-addon">元 </span>
  429. </div>
  430. <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>
  431. </div>
  432. <?php }else{ ?>
  433. <div class="layui-col-sm-10 ">
  434. <div class="input-group">
  435. <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 } ?>" />
  436. <span class="input-group-addon">% </span>
  437. </div>
  438. <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>
  439. </div>
  440. <?php } ?>
  441. </div>
  442. </div>
  443. <?php } ?> -->
  444. <!--<div class="layui-form-item">
  445. <label class="layui-form-label">所有团长可销售</label>
  446. <div class="layui-input-block ">
  447. <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" />
  448. </div>
  449. </div>-->
  450. <?php if($supply_can_distribution_sale == 1){ ?>
  451. <div class="layui-form-item">
  452. <label class="layui-form-label">售卖团长</label>
  453. <div class="layui-input-block">
  454. <label class="radio-inline"><input type="radio" class="radio_sale" name="is_all_sale" value="1" <?php if( !isset($item['is_all_sale']) || $item['is_all_sale'] == 1){ ?>checked="true"<?php } ?> title="所有团长可售" /> </label>
  455. <label class="radio-inline"><input type="radio" class="radio_sale" name="is_all_sale" value="0" <?php if( isset($item['is_all_sale']) && $item['is_all_sale'] == 0){ ?>checked="true"<?php } ?> title="部分团长可售" /> </label>
  456. </div>
  457. <div class="layui-form-mid layui-word-aux" style="margin-left:15px;">选择所有团长可售,部分团长可售失效</div>
  458. </div>
  459. <?php } ?>
  460. <?php if($is_newbuy){ ?>
  461. <div class="layui-form-item">
  462. <label class="layui-form-label">新人专享</label>
  463. <div class="layui-input-block ">
  464. <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" />
  465. </div>
  466. <div class="layui-form-mid layui-word-aux" style="margin-left:15px;">未付款过的用户。勾选后,只在首页新人专区显示</div>
  467. </div>
  468. <?php } ?>
  469. <div class="layui-form-item">
  470. <label class="layui-form-label">限制普通会员下单</label>
  471. <div class="layui-input-block ">
  472. <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" />
  473. </div>
  474. <div class="layui-form-mid layui-word-aux" style="margin-left:15px;">
  475. 勾选后,默认等级会员不能购买此商品
  476. </div>
  477. </div>
  478. <div class="layui-form-item">
  479. <label class="layui-form-label">付费会员专享</label>
  480. <div class="layui-input-block ">
  481. <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" />
  482. </div>
  483. <div class="layui-form-mid layui-word-aux" style="margin-left:15px;">
  484. 勾选后,非vip会员不能购买此商品
  485. </div>
  486. </div>
  487. </div>
  488. </div>
  489. <script language="javascript">
  490. function validationNumber(e, num) {
  491. var regu = /^[\-0-9]+\.?[0-9]*$/;
  492. if (e.value != "") {
  493. if (!regu.test(e.value)) {
  494. e.value = 1;
  495. e.focus();
  496. } else {
  497. if (num == 0) {
  498. if (e.value.indexOf('.') > -1) {
  499. e.value = e.value.substring(0, e.value.length - e.value.split('.')[1].length - 1);
  500. e.focus();
  501. }
  502. }
  503. if (e.value.indexOf('.') > -1) {
  504. if (e.value.split('.')[1].length > num) {
  505. e.value = e.value.substring(0, e.value.length - e.value.split('.')[1].length - 1);
  506. e.focus();
  507. }
  508. }
  509. if(parseFloat(e.value) < 1){
  510. e.value = 1;
  511. e.focus();
  512. }
  513. }
  514. }
  515. }
  516. function reduction(obj){
  517. var goods_start_count = $.trim($('.goods_start_count').val());
  518. if(goods_start_count == ''){
  519. $('.goods_start_count').val(1);
  520. }else{
  521. var count = parseInt(goods_start_count)-1;
  522. if(count < 1){
  523. $('.goods_start_count').val(1);
  524. }else{
  525. $('.goods_start_count').val(count);
  526. }
  527. }
  528. }
  529. function add(obj){
  530. var goods_start_count = $.trim($('.goods_start_count').val());
  531. if(goods_start_count == ''){
  532. $('.goods_start_count').val(1);
  533. }else{
  534. var count = parseInt(goods_start_count)+1;
  535. $('.goods_start_count').val(count);
  536. }
  537. }
  538. $(function () {
  539. $('#price').blur(function(){
  540. var price = parseFloat( $("#price").val() );
  541. var community_head_commission = parseFloat( $("#community_head_commission").val() );
  542. if(price > 0 && community_head_commission >0)
  543. {
  544. $('#precommiss_head_money_tip').html( ( (price * community_head_commission) /100 ).toFixed(2) );
  545. }else{
  546. $('#precommiss_head_money_tip').html('0.00');
  547. }
  548. })
  549. $("#community_head_commission").blur(function(){
  550. var price = parseFloat( $("#price").val() );
  551. var community_head_commission = parseFloat( $(this).val() );
  552. if(price > 0 && community_head_commission >0)
  553. {
  554. $('#precommiss_head_money_tip').html( ( (price * community_head_commission) /100 ).toFixed(2) );
  555. }else{
  556. $('#precommiss_head_money_tip').html('0.00');
  557. }
  558. });
  559. $('#radPickupDateTip input[type=radio]').click(function(){
  560. var s_val = $(this).val();
  561. if(s_val == 3)
  562. {
  563. $('#txtPickupDateTip').css('display','inline-block');
  564. }else{
  565. $('#txtPickupDateTip').css('display', 'none');
  566. }
  567. })
  568. $("input[name=isstatustime]").off('click').on('click',function () {
  569. if($(this).val()==1){
  570. $("#shelves").show()
  571. }else{
  572. $("#shelves").hide();
  573. }
  574. })
  575. })
  576. </script>
  577. <!--- 基本信息 end -->
  578. </div>
  579. <div class="layui-tab-item <?php if( $_GPC['tab']=='option'){ ?>layui-show<?php } ?>" >
  580. <!--规格begin-->
  581. <div class="region-goods-details ">
  582. <div class="region-goods-left col-sm-2">规格库存</div>
  583. <div class="region-goods-right col-sm-10">
  584. <div class="layui-form-item">
  585. <label class="layui-form-label">商品编码</label>
  586. <div class="layui-input-block">
  587. <input type="text" name="codes" class="form-control" value="{$item['codes']}" />
  588. <div class="help-block">商品编码 用部分商家用于统计</div>
  589. </div>
  590. </div>
  591. <div class="layui-form-item">
  592. <label class="layui-form-label">重量</label>
  593. <div class="layui-input-block">
  594. <div class="input-group fixsingle-input-group">
  595. <input type="text" name="weight" id="weight" <?php if( $item['hasoption']){ ?>readonly<?php } ?> class="form-control hasoption" value="{$item['weight']}"/>
  596. <span class="input-group-addon">克</span>
  597. </div>
  598. </div>
  599. </div>
  600. <div class="layui-form-item">
  601. <label class="layui-form-label">库存<label style="color:red;font-size:16px;font-weight:900">*</label></label>
  602. <div class="layui-input-block">
  603. <input type="text" name="total" id="total" class="form-control hasoption" lay-verify="" value="{$item['total']}" style="width:150px;display: inline;margin-right: 20px;" <?php if( $item['hasoption']){ ?>readonly<?php } ?>/>
  604. <span class="help-block">商品的剩余数量, 如启用多规格,则此处设置无效.</span>
  605. </div>
  606. </div>
  607. </div>
  608. </div>
  609. <div class="region-goods-details ">
  610. <div class="region-goods-left col-sm-2">
  611. 规格
  612. </div>
  613. <div class="region-goods-right col-sm-10">
  614. <div class="layui-form-item">
  615. <div class="layui-row" style=''>
  616. <input type="checkbox" lay-skin="primary" title="启用商品规格" lay-filter="hasoption" value="1" id="hasoption" name="hasoption" <?php if( $item['hasoption']==1){ ?>checked<?php } ?> />
  617. <span class="help-block">启用商品规格后,商品的价格及库存以商品规格为准,库存设置为0则会到”已售罄“中,手机也不会显示</span>
  618. </div>
  619. </div>
  620. <div id='tboption' style="padding-left:15px;<?php if( $item['hasoption']!=1){ ?>display:none<?php } ?>" >
  621. <div class="alert alert-info" style="display:none;">
  622. 1. 拖动规格可调整规格显示顺序, 更改规格及规格项后请点击下方的【刷新规格项目表】来更新数据。<br/>
  623. 2. 每一种规格代表不同型号,例如颜色为一种规格,尺寸为一种规格,如果设置多规格,手机用户必须每一种规格都选择一个规格项,才能添加购物车或购买。
  624. </div>
  625. <div id='specs'>
  626. <?php foreach( $item['allspecs'] as $spec ){ ?>
  627. <!--spec-->
  628. <div class='spec_item spec_class_{$cur_cate_id}' id="spec_{$spec['id']}" >
  629. <div style='border:1px solid #e7eaec;padding:10px;margin-bottom: 10px;' >
  630. <input name="spec_id[]" type="hidden" class="form-control spec_id" value="{$spec['id']}"/>
  631. <div class="form-group">
  632. <div class="col-sm-12">
  633. <div class='input-group'>
  634. <input name="spec_title[{$spec['id']}]" type="text" class="form-control spec_title" value="{$spec['title']}" placeholder="规格名称 (比如: 颜色)"/>
  635. <div class='input-group-btn'>
  636. <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>
  637. <a href="javascript:void(0);" class='btn btn-danger' onclick="removeSpec('{$spec['id']}')"><i class="fa fa-remove"></i></a>
  638. </div>
  639. </div>
  640. </div>
  641. </div>
  642. <div class="form-group">
  643. <div class="col-md-12">
  644. <div id='spec_item_{$spec['id']}' class='spec_item_items'>
  645. <?php foreach( $spec['items'] as $specitem ){ ?>
  646. <!--spec_item begin-->
  647. <div class="spec_item_item" style="float:left;margin:5px;width:250px; position: relative">
  648. <input type="hidden" class="form-control spec_item_show" name="spec_item_show_{$spec['id']}[]" value="{$specitem['show']}" />
  649. <input type="hidden" class="form-control spec_item_id" name="spec_item_id_{$spec['id']}[]" value="{$specitem['id']}" />
  650. <div class="input-group">
  651. <span class="input-group-addon">
  652. <input type="checkbox" lay-skin="primary" <?php if( $specitem['id']>0){ ?>checked<?php } ?> value="1" onclick='showItem(this)'>
  653. </span>
  654. <input type="text" class="form-control spec_item_title" onblur="refreshOptions()" name="spec_item_title_{$spec['id']}[]" VALUE="{$specitem['title']}" />
  655. <span class="input-group-addon spec_item_thumb <?php if( !empty($specitem['thumb'])){ ?>has_thumb<?php } ?>">
  656. <input type='hidden' name="spec_item_thumb_{$spec['id']}[]" value="{$specitem['thumb']}"
  657. />
  658. <img onclick="selectSpecItemImage(this)"
  659. src="<?php if( empty($specitem['thumb'])){ ?><?php }else{ ?>{:resize($specitem['thumb'],100)}<?php } ?>" style='width:100%;'
  660. <?php if( !empty($specitem['thumb'])){ ?>
  661. data-toggle='popover'
  662. data-html ='true'
  663. data-placement='top'
  664. data-trigger ='hover'
  665. data-content="<img src='{:tomedia($specitem['thumb'])}' style='width:100px;height:100px;' />"
  666. <?php } ?>
  667. >
  668. <i class="fa fa-times-circle" <?php if( empty($specitem['thumb'])){ ?>style="display:none"<?php } ?>></i>
  669. </span>
  670. <span class="input-group-addon">
  671. <a href="javascript:;" onclick="removeSpecItem(this)" title='删除'><i class="fa fa-times"></i></a>
  672. <a href="javascript:;" class="fa fa-arrows" title="拖动调整显示顺序" ></a>
  673. </span>
  674. </div>
  675. </div>
  676. <!--spec_item end-->
  677. <?php } ?>
  678. </div>
  679. </div>
  680. </div>
  681. </div>
  682. </div>
  683. <!--end spec-->
  684. <?php } ?>
  685. </div>
  686. <table class="table">
  687. <tr>
  688. <td>
  689. <div class="layui-form-item">
  690. <label class="col-sm-2 control-label">选择已有规格</label>
  691. <div class="col-sm-8 col-xs-12">
  692. <select id="cates2" name='options[]' class="form-control select2" style='width:605px;' multiple='' >
  693. <?php foreach( $spec_list as $c ){ ?>
  694. <option value="{$c['id']}" data-names="{$c['value_str']}">{$c['name']}</option>
  695. <?php } ?>
  696. </select>
  697. </div>
  698. </div>
  699. <td>
  700. </tr>
  701. <tr>
  702. <td>
  703. <h4>
  704. <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>
  705. <a style="display:none;" href="javascript:;" onclick="refreshOptions();" title="刷新规格项目表" class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新规格项目表</a>
  706. </h4>
  707. </td>
  708. </tr>
  709. <tr style="display: none;" >
  710. <td>
  711. <div class="alert alert-danger">警告:规格数据有变动,请重新点击上方 [刷新规格项目表] 按钮!</div>
  712. </td>
  713. </tr>
  714. </table>
  715. <div class="alert alert-info wholesalewarning" style="display:none;">
  716. </div>
  717. <div id="options" style="padding:0;">{$item['html']}</div>
  718. </div>
  719. </div>
  720. </div>
  721. <input type="hidden" name="optionArray" value=''>
  722. <input type="hidden" name="isdiscountDiscountsArray" value=''>
  723. <input type="hidden" name="discountArray" value=''>
  724. <input type="hidden" name="commissionArray" value=''>
  725. <!--规格end-->
  726. </div>
  727. <div class="layui-tab-item <?php if( $_GPC['tab']=='des'){ ?>layui-show<?php } ?>" >
  728. <div class="region-goods-details row">
  729. <div class="region-goods-left col-sm-2">商品详情</div>
  730. <div class=" region-goods-right col-sm-10">
  731. <div class="" >
  732. {:tpl_ueditor('content',htmlspecialchars_decode($item['content']),array('height'=>'300'))}
  733. </div>
  734. </div>
  735. </div>
  736. </div>
  737. <!---团长分销begin --->
  738. <div class="layui-tab-item <?php if( $_GPC['tab']=='community_head_level'){ ?>layui-show<?php } ?>" >
  739. <div class="region-goods-details row">
  740. <div class="region-goods-left col-sm-2">团长提成</div>
  741. <div class="region-goods-right col-sm-10">
  742. <?php if( !empty($community_head_level) && count($community_head_level) > 1 && $is_head_takegoods == 1 ) { ?>
  743. <div class="form-group">
  744. <label class="col-sm-2 control-label">独立规则</label>
  745. <div class="col-sm-9 col-xs-12">
  746. <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="启用独立团长提成" />
  747. <span class="help-block">默认使用团长等级提成设置,启用独立团长提成设置,此商品拥有独自的团长提成比例,不受团长等级比例及默认设置限制,团长提成 = 订单有效金额 * 设置比例</span>
  748. </div>
  749. </div>
  750. <div id="head_commission_div" <?php if( empty($item['is_modify_head_commission'])){ ?>style="display:none"<?php } ?> >
  751. <?php foreach($community_head_level as $head_level){ ?>
  752. <div class="form-group">
  753. <label class="col-sm-2 control-label"><?php echo $head_level['levelname']; ?></label>
  754. <div class="col-sm-4 col-xs-12">
  755. <div class="input-group">
  756. <input type="text" name="head_level<?php echo $head_level['id']; ?>" class="form-control" value="<?php echo $item['head_level'.$head_level['id']]; ?>" />
  757. <?php if( !empty($community_money_type) && $community_money_type ==1 ){ ?>
  758. <div class="input-group-addon">元 </div>
  759. <?php }else{ ?>
  760. <div class="input-group-addon">%</div>
  761. <?php } ?>
  762. </div>
  763. </div>
  764. </div>
  765. <?php } ?>
  766. </div>
  767. <?php } ?>
  768. <?php if( empty($community_head_level) || count($community_head_level) ==1 || $is_head_takegoods ==0 ){ ?>
  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" id="is_community_head_commission" lay-skin="primary" value="1" name="is_community_head_commission" lay-filter="is_community_head_commission" <?php if( $item['is_community_head_commission']==1){ ?>checked<?php } ?> title="商品启用独立团长提成" />
  773. <br />
  774. <span class="help-block">勾选后此处优先生效,不勾选则使用 后台——“团长设置”中团长提成比例 计算佣金</span>
  775. </div>
  776. </div>
  777. <div id="head_commission_div2" <?php if( empty($item['is_community_head_commission'])){ ?>style="display:none"<?php } ?> >
  778. <div class="form-group">
  779. <label class="col-sm-2 control-label">商品独立团长提成</label>
  780. <?php if( !empty($community_money_type) && $community_money_type ==1 ){ ?>
  781. <div class="col-sm-4 col-xs-12">
  782. <div class="input-group">
  783. <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 } ?>" />
  784. <span class="input-group-addon">元 </span>
  785. </div>
  786. <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>
  787. </div>
  788. <?php }else{ ?>
  789. <div class="col-sm-4 col-xs-12">
  790. <div class="input-group">
  791. <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 } ?>" />
  792. <span class="input-group-addon">% </span>
  793. </div>
  794. <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>
  795. </div>
  796. <?php } ?>
  797. </div>
  798. </div>
  799. <?php } ?>
  800. </div>
  801. </div>
  802. <?php
  803. $virtualcard_is_takecommiss = D('Home/Front')->get_config_by_name('virtualcard_is_takecommiss');
  804. $virtualcard_is_takecommiss = !isset($virtualcard_is_takecommiss) ? 0 : $virtualcard_is_takecommiss;
  805. if( $virtualcard_is_takecommiss == 0 )
  806. {
  807. $commission_level = 0;
  808. }
  809. ?>
  810. <?php if($commiss_level > 0 && $virtualcard_is_takecommiss == 1){ ?>
  811. <div class="region-goods-details row">
  812. <div class="region-goods-left col-sm-2">会员分销</div>
  813. <div class="region-goods-right col-sm-10">
  814. <div class="form-group">
  815. <label class="col-sm-2 control-label">是否参与分销</label>
  816. <div class="col-sm-9 col-xs-12">
  817. <input type="radio" value="0" name="nocommission" <?php if($item['nocommission']==0){ ?>checked<?php } ?> title="参与分销" />
  818. <input type="radio" value="1" name="nocommission" <?php if($item['nocommission']==1){ ?>checked<?php } ?> title="不参与分销" />
  819. <span class="help-block">如果不参与分销,则不产生分销佣金</span>
  820. </div>
  821. </div>
  822. <div class="form-group">
  823. <label class="col-sm-2 control-label">独立规则</label>
  824. <div class="col-sm-9 col-xs-12">
  825. <input type="checkbox" lay-filter="hascommission" lay-skin="primary" id="hascommission" value="1" name="hascommission" <?php if($item['hascommission']==1){ ?>checked<?php } ?> title="启用独立佣金比例" />
  826. <span class="help-block">启用独立佣金设置,此商品拥有独自的佣金比例,不受分销商等级比例及默认设置限制</span>
  827. </div>
  828. </div>
  829. <div style="clear:both;"></div>
  830. <div id="commission_div" <?php if(empty($item['hascommission'])){ ?>style="display:none"<?php } ?> >
  831. <div id="commission_0" <?php if($commission_type!=0){ ?> style="display:none;" <?php } ?>>
  832. <div class='alert alert-danger'>
  833. 如果比例为空,则使用固定规则,如果都为空则无分销佣金,都填写则以比例优先
  834. </div>
  835. <?php if($set['commiss_level']>=1){ ?>
  836. <div class="form-group">
  837. <label class="col-sm-2 control-label">一级分销</label>
  838. <div class="col-sm-4 col-xs-12">
  839. <div class="input-group">
  840. <input type="text" name="commission1_rate" id="commission1_rate" class="form-control" value="{$item['commission1_rate']}" />
  841. <div class="input-group-addon">% 固定</div>
  842. <input type="text" name="commission1_pay" id="commission1_pay" class="form-control" value="{$item['commission1_pay']}" />
  843. <div class="input-group-addon">元</div>
  844. </div>
  845. </div>
  846. </div>
  847. <?php } ?>
  848. <?php if($set['commiss_level']>=2){ ?>
  849. <div class="form-group">
  850. <label class="col-sm-2 control-label">二级分销</label>
  851. <div class="col-sm-4 col-xs-12">
  852. <div class="input-group">
  853. <input type="text" name="commission2_rate" id="commission2_rate" class="form-control" value="{$item['commission2_rate']}" />
  854. <div class="input-group-addon">% 固定</div>
  855. <input type="text" name="commission2_pay" id="commission2_pay" class="form-control" value="{$item['commission2_pay']}" />
  856. <div class="input-group-addon">元</div>
  857. </div>
  858. </div>
  859. </div>
  860. <?php } ?>
  861. <?php if($set['commiss_level']>=3){ ?>
  862. <div class="form-group">
  863. <label class="col-sm-2 control-label">三级分销</label>
  864. <div class="col-sm-4 col-xs-12">
  865. <div class="input-group">
  866. <input type="text" name="commission3_rate" id="commission3_rate" class="form-control" value="{$item['commission3_rate']}" />
  867. <div class="input-group-addon">% 固定</div>
  868. <input type="text" name="commission3_pay" id="commission3_pay" class="form-control" value="{$item['commission3_pay']}" />
  869. <div class="input-group-addon">元</div>
  870. </div>
  871. </div>
  872. </div>
  873. <?php } ?>
  874. </div>
  875. </div>
  876. </div>
  877. </div>
  878. <?php } ?>
  879. <div class="region-goods-details row">
  880. <div class="region-goods-left col-sm-2">会员等级折扣</div>
  881. <div class="region-goods-right col-sm-10">
  882. <div class="form-group">
  883. <label class="col-sm-2 control-label">是否参与会员折扣</label>
  884. <div class="col-sm-9 col-xs-12">
  885. <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="参与" />
  886. <input type="radio" value="0" name="is_mb_level_buy" <?php if($item['is_mb_level_buy']==0){ ?>checked<?php } ?> title="不参与" />
  887. <span class="help-block">如果不参与会员折扣,则不打折</span>
  888. </div>
  889. </div>
  890. <div class="form-group">
  891. <label class="col-sm-2 control-label">独立规则</label>
  892. <div class="col-sm-9 col-xs-12">
  893. <input type="checkbox" lay-filter="has_mb_level_buy" lay-skin="primary" id="has_mb_level_buy" value="1" name="has_mb_level_buy" <?php if($item['has_mb_level_buy']==1){ ?>checked<?php } ?> title="启用独立折扣比例" />
  894. <span class="help-block">启用独立折扣设置,此商品拥有独立的会员等级折扣比例,不受会员等级折扣设置限制</span>
  895. </div>
  896. </div>
  897. <div style="clear:both;"></div>
  898. <div id="mb_level_div" <?php if(empty($item['has_mb_level_buy'])){ ?>style="display:none"<?php } ?> >
  899. <div id="mb_level_tip">
  900. <div class='alert alert-danger'>
  901. 请填写1-99的<span style="color:red">整数</span>,100不打折。例如:80,打八折,该会员对应等级会员价=商品现价*80%
  902. <?php if( empty($member_level_ist) ){ ?>
  903. <br>
  904. <span style="color:red">暂无会员等级,请前往会员--》会员等级 添加会员等级</span>
  905. <?php } ?>
  906. </div>
  907. </div>
  908. <?php foreach($member_level_ist as $k=>$v){?>
  909. <div class="form-group">
  910. <label class="col-sm-2 control-label"><?php echo $v['levelname']?></label>
  911. <div class="col-sm-4 col-xs-4">
  912. <div class="input-group">
  913. <input type="hidden" name="level_id[]" class="form-control" value="<?php echo $v['id']?>" />
  914. <input type="text" name="discount[]" class="form-control" value="<?php echo $mb_level_discount_list[$v['id']];?>" />
  915. <div class="input-group-addon">% </div>
  916. </div>
  917. </div>
  918. </div>
  919. <?php }?>
  920. </div>
  921. </div>
  922. </div>
  923. <!--团长分销end--->
  924. </div>
  925. <?php if( !empty($is_open_goods_relative_goods) && $is_open_goods_relative_goods == 1 ){ ?>
  926. <div class="layui-tab-item <?php if( $_GPC['tab']=='goods_relative_goods'){ ?>layui-show<?php } ?>" >
  927. <div class="region-goods-details row">
  928. <div class="region-goods-left col-sm-2">推荐商品</div>
  929. <div class=" region-goods-right col-sm-10">
  930. <div class="input-group " style="margin: 0;">
  931. <input type="text" disabled value="" class="form-control valid" name="" placeholder="" id="agent_id">
  932. <span class="input-group-btn">
  933. <span data-input="#agent_id" id="chose_agent_id2" class="btn btn-default">选择商品</span>
  934. </span>
  935. </div>
  936. <?php if(!empty($limit_goods)){ ?>
  937. <?php foreach( $limit_goods as $goods ){ ?>
  938. <div class="input-group mult_choose_goodsid" data-gid="{$goods['gid']}" style="border-radius: 0;float: left;margin: 10px;margin-left:0px;width: 22%;">
  939. <div class="layadmin-text-center choose_user">
  940. <img style="" src="{$goods['image']}">
  941. <div class="layadmin-maillist-img" style="">{$goods['goodsname']}</div>
  942. <button type="button" class="layui-btn layui-btn-sm" onclick="cancle_bind(this)">
  943. <i class="layui-icon"></i>
  944. </button>
  945. </div>
  946. </div>
  947. <?php }} ?>
  948. </div>
  949. </div>
  950. </div>
  951. <?php } ?>
  952. </div>
  953. <script>
  954. $(function(){
  955. $(".select2").select2({
  956. placeholder:'请选择',
  957. allowClear:true
  958. })
  959. })
  960. </script>
  961. <div class="layui-form-item">
  962. <label class="layui-form-label"> </label>
  963. <div class="layui-input-block">
  964. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  965. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  966. <a class="btn btn-default" style='margin-left:10px;' href="{:U('goods/index' , array( 'ok' => 1))}">返回列表</a>
  967. </div>
  968. </div>
  969. </form>
  970. </div>
  971. </div>
  972. </div>
  973. <div id="batchheads" style="z-index: 999;display: none;position: fixed;top: 0;left: 0;right: 0;bottom: 0;background: rgba(0,0,0,0.5)" class="form-horizontal form-validate batchcates" enctype="multipart/form-data">
  974. <div class="modal-dialog" style="position: absolute;margin-top: -300px">
  975. <div class="modal-content">
  976. <div class="modal-header" style="padding:5px;">
  977. <button data-dismiss="modal" class="close" type="button">×</button>
  978. <h4 class="modal-title">选取团长</h4>
  979. </div>
  980. <div class="modal-body" style="height:600px">
  981. <div class="form-group">
  982. <label class="col-sm-2 control-label">社区位置</label>
  983. <div class="col-sm-10 col-xs-12">
  984. <p>
  985. <select id="sel-provance" name="province_id" onChange="selectCity();" class="select form-control" style="width:160px;display:inline;">
  986. <option value="" selected="true">省/直辖市</option>
  987. </select>
  988. <select id="sel-city" name="city_id" onChange="selectcounty(0)" class="select form-control" style="width:160px;display:inline;">
  989. <option value="" selected="true">请选择</option>
  990. </select>
  991. <select id="sel-area" name="area_id" onChange="selectstreet(0)" class="select form-control" style="width:160px;display:inline;">
  992. <option value="" selected="true">请选择</option>
  993. </select>
  994. <select id="sel-street" name="country_id" class="select form-control" style="width:160px;display:inline;">
  995. <option value="" selected="true">请选择</option>
  996. </select>
  997. </p>
  998. </div>
  999. </div>
  1000. <div class="form-group">
  1001. <label class="col-sm-2 control-label">团长名称</label>
  1002. <div class="col-sm-10 col-xs-12">
  1003. <div class="input-group">
  1004. <input type="text" class="form-control" name="keyword" id="supply_id_input" placeholder="团长名称/团长手机号/社区地址">
  1005. <span class="input-group-btn">
  1006. <button type="button" class="btn btn-default" onclick="search_heads()">搜索</button>
  1007. </span>
  1008. </div>
  1009. </div>
  1010. </div>
  1011. <div class="form-group">
  1012. <div class="col-sm-1 control-label">
  1013. </div>
  1014. <div class="col-sm-10 col-xs-12">
  1015. <div class="page-table-header">
  1016. <input type="checkbox" class="check_heads_all">
  1017. <div class="btn-group">
  1018. 全选/反选
  1019. </div>
  1020. <br/>
  1021. <label><input type="checkbox" class="is_cancle_old" id="is_cancle_old" style="vertical-align: text-bottom;">
  1022. <div class="btn-group" style="color:#666;">
  1023. 同时取消以前所有分配
  1024. </div>
  1025. </label>
  1026. &nbsp;&nbsp;&nbsp;&nbsp;
  1027. <label><input type="checkbox" class="is_cancle_allhead" id="is_cancle_allhead" style="vertical-align: text-bottom;">
  1028. <div class="btn-group" style="color:#666;">
  1029. 同时取消商品 “所有团长可售”
  1030. </div>
  1031. </label>
  1032. </div>
  1033. </div>
  1034. </div>
  1035. <div class="row">
  1036. <label class="col-sm-1 control-label"></label>
  1037. <div class="col-sm-11 col-xs-12">
  1038. <div class="content" style="padding-top:5px;" data-name="supply_id">
  1039. <div style="max-height:410px;overflow:auto;" id="batchheads_content">
  1040. </div>
  1041. <div class="" id="batchheads_page">
  1042. </div>
  1043. </div>
  1044. </div>
  1045. </div>
  1046. </div>
  1047. <div class="modal-footer">
  1048. <button class="btn btn-primary model_heads">确认</button>
  1049. <button class="btn btn-default" >取消</button>
  1050. </div>
  1051. </div>
  1052. </div>
  1053. </div>
  1054. <script src="/layuiadmin/layui/layui.js"></script>
  1055. <script type="text/javascript" src="/static/js/jquery-migrate-1.1.1.js"></script>
  1056. <script src="/static/js/jquery-ui.min.js"></script>
  1057. <style>
  1058. .multi-img-details{width:100%;}
  1059. </style>
  1060. <script>
  1061. layui.config({
  1062. base: '/layuiadmin/' //静态资源所在路径
  1063. }).extend({
  1064. index: 'lib/index' //主入口模块
  1065. }).use('index');
  1066. </script>
  1067. <script>
  1068. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  1069. var layer = layui.layer;
  1070. var $;
  1071. var cur_open_div;
  1072. var form;
  1073. layui.use(['jquery', 'layer','form', 'laydate'], function(){
  1074. $ = layui.$;
  1075. form = layui.form;
  1076. laydate = layui.laydate;
  1077. laydate.render({
  1078. elem: '#hx_expire_end_time'
  1079. ,type: 'datetime'
  1080. ,min: '<?php echo date("Y-m-d H:i:s"); ?>'
  1081. });
  1082. form.on('radio(linktype)', function(data){
  1083. if (data.value == 2) {
  1084. $('#typeGroup').show();
  1085. } else {
  1086. $('#typeGroup').hide();
  1087. }
  1088. });
  1089. form.on('checkbox(is_modify_sendscore)', function(data){
  1090. console.log(data.elem.checked)
  1091. if (data.elem.checked) {
  1092. console.log(12);
  1093. $("#send_score_divTip").css('display','inline');
  1094. $("#send_score_divTip2").css('display','inline');
  1095. } else {
  1096. console.log(33);
  1097. $("#send_score_divTip").hide();
  1098. $("#send_score_divTip2").hide();
  1099. }
  1100. form.render('checkbox');
  1101. });
  1102. form.on('checkbox(xinrenckbox)', function(data){
  1103. if (data.elem.checked) {
  1104. $("#xianshickbox").removeAttr("checked");
  1105. } else {
  1106. }
  1107. form.render('checkbox');
  1108. });
  1109. form.on('checkbox(xianshickbox)', function(data){
  1110. if (data.elem.checked) {
  1111. $("#xinrenckbox").removeAttr("checked");
  1112. } else {
  1113. }
  1114. form.render('checkbox');
  1115. });
  1116. form.on('checkbox(hascommission)', function(data){
  1117. if (data.elem.checked) {
  1118. $('#commission_div').show();
  1119. } else {
  1120. $('#commission_div').hide();
  1121. }
  1122. })
  1123. //hascommission
  1124. form.on('checkbox(has_mb_level_buy)', function(data){
  1125. if (data.elem.checked) {
  1126. $('#mb_level_div').show();
  1127. } else {
  1128. $('#mb_level_div').hide();
  1129. }
  1130. })
  1131. form.on('checkbox(is_hx_member)', function(data){
  1132. if (data.elem.checked) {
  1133. $(this).parent().parent().find('.selectHxMember').show();
  1134. $(this).parent().parent().find('.hx_smember_list').show();
  1135. } else {
  1136. $(this).parent().parent().find('.selectHxMember').hide();
  1137. $(this).parent().parent().find('.hx_smember_list').hide();
  1138. }
  1139. })
  1140. form.on('radio(hexiao_type)', function(data){
  1141. if (data.elem.value == 1) {
  1142. $('#hexiao_type_0').hide();
  1143. $('#hexiao_type_1').show();
  1144. $('#hx_goods_time').show();
  1145. } else {
  1146. $('#hexiao_type_0').show();
  1147. $('#hexiao_type_1').hide();
  1148. $('#hx_goods_time').hide();
  1149. }
  1150. })
  1151. form.on('radio(hx_expire_type)', function(data){
  1152. if (data.elem.value == 1) {
  1153. $('#hx_expire_type_0').hide();
  1154. $('#hx_expire_type_1').show();
  1155. } else {
  1156. $('#hx_expire_type_0').show();
  1157. $('#hx_expire_type_1').hide();
  1158. }
  1159. })
  1160. form.on('radio(hx_assign_salesroom)', function(data){
  1161. if (data.elem.value == 1) {
  1162. $('#hx_assign_salesroom_1').show();
  1163. $('#hx_salesroom_list').show();
  1164. } else {
  1165. $('#hx_assign_salesroom_1').hide();
  1166. $('#hx_salesroom_list').hide();
  1167. }
  1168. })
  1169. //同城配送
  1170. form.on('checkbox(is_only_distribution)', function (data) {
  1171. if (data.elem.checked) {
  1172. $("#is_only_hexiao").removeAttr("checked");
  1173. $("#is_only_express").removeAttr("checked");
  1174. }
  1175. form.render('checkbox');
  1176. });
  1177. //仅快递
  1178. form.on('checkbox(is_only_express)', function (data) {
  1179. if (data.elem.checked) {
  1180. $("#is_only_distribution").removeAttr("checked");
  1181. $("#is_only_hexiao").removeAttr("checked");
  1182. }
  1183. form.render('checkbox');
  1184. });
  1185. //核销
  1186. form.on('checkbox(is_only_hexiao)', function (data) {
  1187. if (data.elem.checked) {
  1188. $("#is_only_distribution").removeAttr("checked");
  1189. $("#is_only_express").removeAttr("checked");
  1190. }
  1191. form.render('checkbox');
  1192. });
  1193. $('#chose_salesroom_id').click(function(){
  1194. var supply_id = $('input[name="supply_id"]').val();
  1195. cur_open_div = $(this).attr('data-input');
  1196. $.post("{:U('salesroom/query', array('template' => 'mult_goods'))}", {supply_id:supply_id}, function(shtml){
  1197. layer.open({
  1198. type: 1,
  1199. area: '930px',
  1200. content: shtml //注意,如果str是object,那么需要字符拼接。
  1201. });
  1202. });
  1203. })
  1204. $('.chose_smember_id').live('click',function(){
  1205. var room_id = $(this).parent().parent().parent().find('.mult_choose_roomid').attr('data-roomid');
  1206. cur_open_div = $(this).attr('data-input');
  1207. var post_url = "{:U('salesroom_member/query', array('template' => 'mult_goods'))}";
  1208. $.post(post_url, {room_id:room_id}, function(shtml){
  1209. layer.open({
  1210. type: 1,
  1211. area: '930px',
  1212. content: shtml //注意,如果str是object,那么需要字符拼接。
  1213. });
  1214. });
  1215. })
  1216. /**
  1217. <?php if($delivery_type_express == 2){?>
  1218. form.on('checkbox(is_only_express111)', function(data){
  1219. if (data.elem.checked) {
  1220. $('#is_only_express').removeAttr("checked");
  1221. layer.msg("启用仅快递配送模式,请在物流设置开启快递配送方式!",{icon: 2,time: 3000});
  1222. }
  1223. form.render('checkbox');
  1224. })
  1225. <?php } ?>
  1226. **/
  1227. $('#chose_label_id').click(function(){
  1228. cur_open_div = $(this).attr('data-input');
  1229. $.post("{:U('goods/labelquery', array('ok' => 1))}", {}, function(shtml){
  1230. layer.open({
  1231. type: 1,
  1232. area: '930px',
  1233. content: shtml //注意,如果str是object,那么需要字符拼接。
  1234. });
  1235. });
  1236. })
  1237. $('#chose_member_id').click(function(){
  1238. cur_open_div = $(this).attr('data-input');
  1239. $.post("{:U('supply/zhenquery', array('ok' => 1))}", {}, function(shtml){
  1240. layer.open({
  1241. type: 1,
  1242. area: '930px',
  1243. content: shtml //注意,如果str是object,那么需要字符拼接。
  1244. });
  1245. });
  1246. })
  1247. $('#chose_agent_id').click(function(){
  1248. cur_open_div = $(this).attr('data-input');
  1249. $.post("{:U('communityhead/query_head_user', array('ok' => 1))}", {}, function(shtml){
  1250. layer.open({
  1251. type: 1,
  1252. area: '930px',
  1253. content: shtml //注意,如果str是object,那么需要字符拼接。
  1254. });
  1255. });
  1256. })
  1257. $('#chose_link').click(function(){
  1258. cur_open_div = $(this).attr('data-input');
  1259. $.post("{:U('util.selecturl', array('ok' => 1))}", {}, function(shtml){
  1260. layer.open({
  1261. type: 1,
  1262. area: '930px',
  1263. content: shtml //注意,如果str是object,那么需要字符拼接。
  1264. });
  1265. });
  1266. })
  1267. $('.layui-tab-title li').click(function(){
  1268. form.render('radio');
  1269. form.render('checkbox');
  1270. })
  1271. //监听提交
  1272. form.on('submit(formDemo)', function(data){
  1273. var loadingIndex = layer.load();
  1274. $('input').blur(function () {
  1275. $(this).css('border','#e7e7eb 1px solid');
  1276. })
  1277. var goodsname = $.trim($('#goodsname').val());
  1278. if(goodsname == ''){
  1279. layer.msg('商品名称必须填写',{icon: 1,time: 2000});
  1280. $('#goodsname').focus();
  1281. $('#goodsname').css('border','red 2px solid');
  1282. layer.close(loadingIndex);
  1283. return false;
  1284. }
  1285. var price = $.trim($('#price').val());
  1286. if(price == ''){
  1287. layer.msg('售价必须填写',{icon: 1,time: 2000});
  1288. $('#price').focus();
  1289. $('#price').css('border','red 2px solid');
  1290. layer.close(loadingIndex);
  1291. return false;
  1292. }
  1293. var productprice = $.trim($('#productprice').val());
  1294. if(productprice == ''){
  1295. layer.msg('原价必须填写',{icon: 1,time: 2000});
  1296. $('#productprice').focus();
  1297. $('#productprice').css('border','red 2px solid');
  1298. layer.close(loadingIndex);
  1299. return false;
  1300. }
  1301. if($('#hasoption').get(0).checked == false){
  1302. console.log(222);
  1303. var total =$('#total').val();
  1304. if(total == ''){
  1305. layer.msg('库存必须填写',{icon: 1,time: 2000});
  1306. $('#total').focus();
  1307. $('#total').css('border','red 2px solid');
  1308. layer.close(loadingIndex);
  1309. return false;
  1310. }
  1311. }
  1312. var goods_start_count = $.trim($('input[name="goods_start_count"]').val());
  1313. var r = /^\+?[1-9][0-9]*$/;  //正整数
  1314. if(r.test(goods_start_count)){
  1315. var oneday_limit_count = $.trim($('input[name="oneday_limit_count"]').val());
  1316. if(parseInt(oneday_limit_count) > 0){
  1317. if(parseInt(goods_start_count) > parseInt(oneday_limit_count)){
  1318. layer.msg('起购数量必须小于每天限购',{icon: 1,time: 2000});
  1319. $('input[name="goods_start_count"]').focus();
  1320. layer.close(loadingIndex);
  1321. return false;
  1322. }
  1323. }
  1324. var one_limit_count = $.trim($('input[name="one_limit_count"]').val());
  1325. if(parseInt(one_limit_count) > 0){
  1326. if(parseInt(goods_start_count) > parseInt(one_limit_count)){
  1327. layer.msg('起购数量必须小于单次限购',{icon: 1,time: 2000});
  1328. $('input[name="goods_start_count"]').focus();
  1329. layer.close(loadingIndex);
  1330. return false;
  1331. }
  1332. }
  1333. var total_limit_count = $.trim($('input[name="total_limit_count"]').val());
  1334. if(parseInt(total_limit_count) > 0){
  1335. if(parseInt(goods_start_count) > parseInt(total_limit_count)){
  1336. layer.msg('起购数量必须小于历史限购',{icon: 1,time: 2000});
  1337. $('input[name="goods_start_count"]').focus();
  1338. layer.close(loadingIndex);
  1339. return false;
  1340. }
  1341. }
  1342. }
  1343. //判断付费会员价
  1344. var is_take_vipcard = $('input[name="is_take_vipcard"]').prop('checked');
  1345. if(is_take_vipcard){
  1346. var card_price = $.trim($('#card_price').val());
  1347. var price = $.trim($('#price').val());
  1348. var fix_amountTest=/^(([1-9]\d*)|\d)(\.\d{1,2})?$/;
  1349. if(card_price == '' || fix_amountTest.test(card_price)==false){
  1350. layer.msg('请填写正确的商品付费会员专享价');
  1351. layer.close(loadingIndex);
  1352. return false;
  1353. }
  1354. if(price == '' || fix_amountTest.test(price)==false){
  1355. layer.msg('请填写正确的商品价格售价');
  1356. layer.close(loadingIndex);
  1357. return false;
  1358. }
  1359. if(parseFloat(card_price) > parseFloat(price)){
  1360. layer.msg('付费会员专享价不能大于售价');
  1361. layer.close(loadingIndex);
  1362. return false;
  1363. }
  1364. var check_cardprice = true;
  1365. var check_market_price = true;
  1366. var check_card_market = true;
  1367. $('.option_cardprice').each(function(){
  1368. var cardprice = $.trim($(this).val());
  1369. var marketprice = $.trim($(this).parent().parent().find('.option_marketprice').val());
  1370. if(cardprice == '' || fix_amountTest.test(cardprice) == false || parseFloat(cardprice) < 0.01){
  1371. check_cardprice = false;
  1372. }
  1373. if(marketprice == '' || fix_amountTest.test(marketprice) == false || parseFloat(marketprice) < 0.01){
  1374. check_market_price = false;
  1375. }
  1376. if(parseFloat(cardprice) > parseFloat(marketprice)){
  1377. check_card_market = false;
  1378. }
  1379. })
  1380. if(!check_cardprice){
  1381. layer.msg('多规格付费会员专享价不能为空且最低0.01元');
  1382. layer.close(loadingIndex);
  1383. return false;
  1384. }
  1385. if(!check_market_price){
  1386. layer.msg('多规格商品售价不能为空且最低0.01元');
  1387. layer.close(loadingIndex);
  1388. return false;
  1389. }
  1390. if(!check_card_market){
  1391. layer.msg('多规格付费会员专享价不能大于售价');
  1392. layer.close(loadingIndex);
  1393. return false;
  1394. }
  1395. }
  1396. var s_cates = $('#cates').val();
  1397. var cate_mult = [];
  1398. for(var i in s_cates)
  1399. {
  1400. cate_mult.push(s_cates[i]);
  1401. }
  1402. data.field.cate_mult = cate_mult;
  1403. <?php if( !empty($is_open_goods_relative_goods) && $is_open_goods_relative_goods == 1 ){ ?>
  1404. var gd_ar = [];
  1405. var gd_str = '';
  1406. $('.mult_choose_goodsid').each(function(){
  1407. gd_ar.push( $(this).attr('data-gid') );
  1408. })
  1409. gd_str = gd_ar.join(',');
  1410. data.field.limit_goods_list = gd_str;
  1411. <?php } ?>
  1412. var is_mult_option = $('input[name=hasoption]').is(':checked');
  1413. if( is_mult_option )
  1414. {
  1415. var spec_item_all_count = 0;
  1416. var spec_item_all = false;
  1417. $('.spec_item').each(function(){
  1418. spec_item_all_count++;
  1419. });
  1420. if(spec_item_all || spec_item_all_count == 0)
  1421. {
  1422. layer.msg('请填写商品的规格名称');
  1423. layer.close(loadingIndex);
  1424. return false;
  1425. }
  1426. var is_spec_break = false;
  1427. $('.spec_item').each(function(){
  1428. spec_item_all_count++;
  1429. //检测商品规格是否配置
  1430. var spec_val;
  1431. var spec_item_val;
  1432. var is_spec = false;
  1433. var is_spec_item = false;
  1434. var spec_count = 0;
  1435. var spec_item_count = 0;
  1436. $(this).find('.spec_title').each(function(){
  1437. spec_val = $(this).val();
  1438. spec_count++;
  1439. if( spec_val == '' )
  1440. {
  1441. is_spec = true;
  1442. }
  1443. if(is_spec || spec_count == 0)
  1444. {
  1445. is_spec_break = true;
  1446. layer.msg('请填写商品的规格名称',{icon:2});
  1447. $(this).focus();
  1448. $(this).css('border','2px solid #FF0000');
  1449. layer.close(loadingIndex);
  1450. return false;
  1451. }
  1452. })
  1453. $(this).find('.spec_item_title').each(function(){
  1454. spec_item_val = $(this).val();
  1455. spec_item_count++;
  1456. if( spec_item_val == '' )
  1457. {
  1458. is_spec_item = true;
  1459. }
  1460. if(is_spec_item || spec_item_count == 0){
  1461. is_spec_break = true;
  1462. $(this).focus();
  1463. $(this).css('border','2px solid #FF0000');
  1464. //$('.hasoption').focus();
  1465. layer.msg('请填写商品的具体规格值',{icon:2});
  1466. layer.close(loadingIndex);
  1467. return false;
  1468. }
  1469. })
  1470. })
  1471. if(is_spec_break){
  1472. layer.close(loadingIndex);
  1473. return false;
  1474. }
  1475. var t_val;
  1476. var is_pos = false;
  1477. var s_total = 0;
  1478. var is_break = false;
  1479. $('.option_stock').each(function(){
  1480. t_val = $(this).val();
  1481. if(!(/(^[1-9]\d*$)/.test(t_val)) && t_val != 0){
  1482. layer.msg('多规格商品库存输入错误,请输入正确的数字!',{icon:2});
  1483. $(this).focus();
  1484. $(this).css('border','red 2px solid');
  1485. layer.close(loadingIndex);
  1486. is_break = true;
  1487. return false;
  1488. }
  1489. if( t_val == '' )
  1490. {
  1491. is_pos = true;
  1492. }
  1493. if(is_pos)
  1494. {
  1495. layer.msg('多规格商品库存未填写',{icon:2});
  1496. $(this).focus();
  1497. $(this).css('border','red 2px solid');
  1498. console.log(888);
  1499. layer.close(loadingIndex);
  1500. is_break = true;
  1501. return false;
  1502. }
  1503. s_total += parseInt( t_val );
  1504. })
  1505. if(is_break){
  1506. return false;
  1507. }
  1508. var t_val2;
  1509. var is_pos2 = false;
  1510. $('.option_marketprice').each(function(){
  1511. t_val2 = $(this).val();
  1512. if( t_val2 == '' )
  1513. {
  1514. is_pos2 = true;
  1515. }
  1516. console.log(is_pos2);
  1517. if(is_pos2)
  1518. {
  1519. layer.msg('多规格商品价格未填写',{icon:2});
  1520. $(this).focus();
  1521. $(this).css('border','red 2px solid');
  1522. layer.close(loadingIndex);
  1523. is_break = true;
  1524. return false;
  1525. }
  1526. })
  1527. if(is_break){
  1528. return false;
  1529. }
  1530. var t_val3;
  1531. var is_pos3 = false;
  1532. $('.option_productprice').each(function(){
  1533. t_val3 = $(this).val();
  1534. if( t_val3 == '' )
  1535. {
  1536. is_pos3 = true;
  1537. }
  1538. })
  1539. if(is_pos3)
  1540. {
  1541. layer.msg('多规格商品原价未填写',{icon:2});
  1542. layer.close(loadingIndex);
  1543. return false;
  1544. }
  1545. if( s_total > 100000 || s_total< 0 )
  1546. {
  1547. layer.msg('商品库存值的取值范围是1~100000',{icon:2});
  1548. layer.close(loadingIndex);
  1549. return false;
  1550. }
  1551. if(!(/(^[1-9]\d*$)/.test(s_total)) && s_total != 0){
  1552. layer.msg('多规格商品库存输入错误,请输入正确的数字!',{icon:2});
  1553. layer.close(loadingIndex);
  1554. return false;
  1555. }
  1556. }else{
  1557. var g_total = $('#total').val();
  1558. if( g_total > 100000 || g_total< 0 )
  1559. {
  1560. layer.msg('商品库存值的取值范围是1~100000',{icon:2});
  1561. layer.close(loadingIndex);
  1562. return false;
  1563. }
  1564. if(!(/(^[1-9]\d*$)/.test(g_total)) && g_total != 0){
  1565. layer.msg('商品库存输入错误,请输入正确的数字!',{icon:2});
  1566. layer.close(loadingIndex);
  1567. return false;
  1568. }
  1569. }
  1570. /**
  1571. var supply_id = $('input[name=supply_id]').val();
  1572. var is_only_distribution = $('input[name=is_only_distribution]').is(':checked');
  1573. if(supply_id != '' && supply_id > 0){
  1574. if(is_only_distribution){
  1575. layer.msg('独立供应商不能开启同城配送');
  1576. layer.close(loadingIndex);
  1577. return false;
  1578. }
  1579. }**/
  1580. //商品核销
  1581. var is_only_hexiao = $('input[name=is_only_hexiao]').is(':checked');
  1582. if(is_only_hexiao){
  1583. var hx_expire_type = $('input:radio[name="hx_expire_type"]:checked').val();
  1584. if(hx_expire_type == 1){
  1585. if($.trim($('#hx_expire_end_time').val()) == ''){
  1586. layer.msg('指定过期时间不能为空');
  1587. layer.close(loadingIndex);
  1588. return false;
  1589. }
  1590. }
  1591. var goods_room = [];
  1592. var goods_room_smember = {};
  1593. var goods_is_hx_member = {};
  1594. var goods_room_ids = "";
  1595. $('#hx_salesroom_list').find('.mult_choose_room_list').each(function(){
  1596. var goods_room_sid = [];
  1597. var room_id = $(this).find('.mult_choose_roomid').attr('data-roomid');
  1598. $(this).find('.mult_choose_smemberid').each(function(){
  1599. var smember_id = $(this).attr('data-smemberid');
  1600. goods_room_sid.push(smember_id);
  1601. });
  1602. goods_room_smember[room_id] = goods_room_sid.join(',');
  1603. goods_room.push(room_id);
  1604. $(this).find('.is_hx_member').each(function(){
  1605. if($(this).is(':checked')){
  1606. goods_is_hx_member[room_id] = 1;
  1607. }else{
  1608. goods_is_hx_member[room_id] = 0;
  1609. }
  1610. });
  1611. });
  1612. goods_room_ids = goods_room.join(',');
  1613. data.field.goods_room_ids = goods_room_ids;
  1614. data.field.goods_room_smember = goods_room_smember;
  1615. data.field.goods_is_hx_member = goods_is_hx_member;
  1616. var hx_assign_salesroom = $('input:radio[name="hx_assign_salesroom"]:checked').val();
  1617. if(hx_assign_salesroom == 1){
  1618. if(goods_room_ids == ''){
  1619. layer.msg('请选择指定门店');
  1620. layer.close(loadingIndex);
  1621. return false;
  1622. }
  1623. }
  1624. }
  1625. $.ajax({
  1626. url: data.form.action,
  1627. type: data.form.method,
  1628. data: data.field,
  1629. dataType:'json',
  1630. success: function (info) {
  1631. if(info.status == 0)
  1632. {
  1633. layer.msg(info.result.message,{icon: 1,time: 2000});
  1634. layer.close(loadingIndex);
  1635. }else if(info.status == 1){
  1636. var go_url = location.href;
  1637. if( info.result.hasOwnProperty("url") )
  1638. {
  1639. go_url = info.result.url;
  1640. }
  1641. layer.msg('操作成功',{time: 1000,
  1642. end:function(){
  1643. location.href = info.result.url;
  1644. }
  1645. });
  1646. }
  1647. }
  1648. });
  1649. return false;
  1650. });
  1651. form.on('checkbox(hasoption)', function(data){
  1652. if(data.elem.checked)
  1653. {
  1654. $('#goodssn').attr('readonly',true);
  1655. $('#productsn').attr('readonly',true);
  1656. $('#weight').attr('readonly',true);
  1657. $('#total').attr('readonly',true);
  1658. $("#tboption").show();
  1659. $("#tbdiscount").show();
  1660. $("#isdiscount_discounts").show();
  1661. $("#isdiscount_discounts_default").hide();
  1662. $("#commission").show();
  1663. $("#commission_default").hide();
  1664. $("#discounts_type1").show().parent().show();
  1665. refreshOptions();
  1666. }else{
  1667. $('#weight').removeAttr('readonly');
  1668. $('#total').removeAttr('readonly');
  1669. $("#tboption").hide();
  1670. refreshOptions();
  1671. $("#isdiscount_discounts").hide();
  1672. var isdiscount_discounts = $("#isdiscount_discounts").html();
  1673. $("#isdiscount_discounts").html('');
  1674. $("#isdiscount_discounts").html(isdiscount_discounts);
  1675. $("#tbdiscount").hide();
  1676. $("#isdiscount_discounts_default").show();
  1677. $("#commission_default").show();
  1678. $('#goodssn').removeAttr('readonly');
  1679. $('#productsn').removeAttr('readonly');
  1680. $("#discounts_type1").hide().parent().hide();
  1681. $("#discounts_type0").click();
  1682. $(this).prop("checked", false);
  1683. }
  1684. form.render('checkbox');
  1685. });
  1686. $('#chose_agent_id2').click(function(){
  1687. cur_open_div = $(this).attr('data-input');
  1688. $.post("{:U('goods/query_normal', array('template' => 'mult', 'unselect_goodsid' => $id))}", {}, function(shtml){
  1689. layer.open({
  1690. type: 1,
  1691. area: '930px',
  1692. content: shtml //注意,如果str是object,那么需要字符拼接。
  1693. });
  1694. });
  1695. })
  1696. form.on('checkbox(is_modify_head_commission)', function(data){
  1697. if(data.elem.checked)
  1698. {
  1699. $("#head_commission_div").show();
  1700. }else{
  1701. $("#head_commission_div").hide();
  1702. }
  1703. form.render('checkbox');
  1704. });
  1705. form.on('checkbox(is_community_head_commission)', function(data){
  1706. if(data.elem.checked)
  1707. {
  1708. $("#head_commission_div2").show();
  1709. }else{
  1710. $("#head_commission_div2").hide();
  1711. }
  1712. form.render('checkbox');
  1713. });
  1714. form.on('checkbox(is_take_vipcard)', function(data){
  1715. if(data.elem.checked)
  1716. {
  1717. $(".card_price_txt").show();
  1718. }else{
  1719. $(".card_price_txt").hide();
  1720. }
  1721. form.render('checkbox');
  1722. refreshOptions();
  1723. });
  1724. })
  1725. function cancle_bind(obj,sdiv)
  1726. {
  1727. $('#'+sdiv).val('');
  1728. $(obj).parent().parent().remove();
  1729. }
  1730. function cancle_room_bind(obj){
  1731. $(obj).parent().parent().parent().remove();
  1732. }
  1733. </script>
  1734. <script>
  1735. $(function () {
  1736. // 拖拽时开始滚动的间距
  1737. var scrollingSensitivity = 20
  1738. // 拖拽时滚动速度
  1739. let scrollingSpeed = 20
  1740. // 拖拽前的父级节点
  1741. let dragBeforeParentNode = null
  1742. // 初始化拖拽函数
  1743. $('.multi-img-details').sortable({
  1744. // 自适应placeholder的大小
  1745. forceHelperSize: true,
  1746. // 拖拽时的鼠标形状
  1747. cursor: '-webkit-grabbing',
  1748. // 拖拽的父级节点(该节点一定要注意,配置错误会导致当前屏幕外的元素没法自动滚动拖拽,两列之间拖拽的滚动也会出问题)
  1749. appendTo: '.layui-form-item',
  1750. // 拖拽时的倾斜度
  1751. rotate: '5deg',
  1752. // 延迟时间(毫秒),避免和click同时操作时出现的冲突
  1753. delay: 0,
  1754. // 以clone方式拖拽
  1755. helper: 'clone',
  1756. // 拖拽到边框出现滚动的间距,
  1757. scrollSensitivity: scrollingSensitivity,
  1758. // 应用于拖拽空白区域的样式
  1759. placeholder: 'portlet-placeholder ui-state-highlight',
  1760. // 允许拖拽预留空白区域
  1761. forcePlaceholderSize: false,
  1762. // 多个列表之间的拖拽的dom元素
  1763. connectWith: '.multi-img-details',
  1764. // 鼠标到区域则填充
  1765. tolerance: "pointer",
  1766. // 可以拖拽的项
  1767. items: '.multi-item',
  1768. // 填充动画
  1769. revert: 0,
  1770. // 拖拽结束函数
  1771. stop: (e, ui) => {
  1772. // 当前拽入的元素
  1773. let item = $(ui.item)
  1774. // 当前拽入元素的下标
  1775. let index = item.index()
  1776. let kid = ''
  1777. // xxxx 这里面可以操作数据更新
  1778. },
  1779. // 开始拖拽时的函数
  1780. start: (e, ui) => {
  1781. // 拖拽前的父级节点
  1782. dragBeforeParentNode = ui.item[0].parentNode
  1783. // 让placeholder和源高度一致
  1784. ui.helper.addClass('item').width(110)
  1785. // xxxx 这里可以记录一些拖拽前的元素属性
  1786. },
  1787. // 处理两列滚动条问题
  1788. sort: function (event, ui) {
  1789. var scrollContainer = ui.placeholder[0].parentNode
  1790. // 设置拽入的列表的滚动位置
  1791. var overflowOffset = $(scrollContainer).offset()
  1792. if ((overflowOffset.top + scrollContainer.offsetHeight) - event.pageY <
  1793. scrollingSensitivity) {
  1794. scrollContainer.scrollTop = scrollContainer.scrollTop + scrollingSpeed
  1795. } else if (event.pageY - overflowOffset.top < scrollingSensitivity) {
  1796. scrollContainer.scrollTop = scrollContainer.scrollTop - scrollingSpeed
  1797. }
  1798. }
  1799. }).disableSelection()
  1800. })
  1801. </script>
  1802. <script language="javascript">
  1803. var chose_cate = -1;
  1804. var chose_cate_id_arr = [];
  1805. $(function(){
  1806. $('#cates2').on('change',function(){
  1807. var s_length = $("#cates2 option:selected").length -1;
  1808. var options_name = $("#cates2 option:selected:eq("+s_length+")").text();
  1809. var options_str = $("#cates2 option:selected:eq("+s_length+")").attr('data-names');
  1810. if(s_length > chose_cate)
  1811. {
  1812. chose_cate++;
  1813. var cur_cate_id = '';
  1814. $("#cates2 option:selected").each(function(){
  1815. var tmp_cate_id = parseInt($(this).val());
  1816. if( $.inArray( tmp_cate_id, chose_cate_id_arr ) == -1)
  1817. {
  1818. chose_cate_id_arr.push( parseInt(tmp_cate_id) );
  1819. cur_cate_id = tmp_cate_id;
  1820. }
  1821. })
  1822. addSpecList(options_name,options_str,cur_cate_id);
  1823. }else{
  1824. chose_cate--;
  1825. var new_chose_cate_id_arr = [];
  1826. if(chose_cate_id_arr.length == 1)
  1827. {
  1828. $('.spec_class_'+chose_cate_id_arr[0]).remove();
  1829. }
  1830. $("#cates2 option:selected").each(function(){
  1831. var tmp_cate_id = parseInt( $(this).val() );
  1832. if( $.inArray( tmp_cate_id, chose_cate_id_arr ) != -1)
  1833. {
  1834. new_chose_cate_id_arr.push( parseInt(tmp_cate_id) );
  1835. chose_cate_id_arr.splice($.inArray( tmp_cate_id, chose_cate_id_arr ), 1);
  1836. }
  1837. })
  1838. if(chose_cate_id_arr.length == 1)
  1839. {
  1840. $('.spec_class_'+chose_cate_id_arr[0]).remove();
  1841. }
  1842. chose_cate_id_arr = new_chose_cate_id_arr;
  1843. refreshOptions();
  1844. }
  1845. })
  1846. $(document).on('input propertychange change', '#specs input', function () {
  1847. window.optionchanged = true;
  1848. $('#optiontip').show();
  1849. });
  1850. $(document).on('input propertychange change', '#specs input', function () {
  1851. window.optionchanged = true;
  1852. $('#optiontip').show();
  1853. });
  1854. $(".spec_item_thumb").find('i').click(function(){
  1855. var group =$(this).parent();
  1856. group.find('img').attr('src',"{SNAILFISH_LOCAL}static/images/nopic100.jpg");
  1857. group.find(':hidden').val('');
  1858. $(this).hide();
  1859. group.find('img').popover('destroy');
  1860. });
  1861. });
  1862. function selectSpecItemImage(obj){
  1863. util.image('',function(val){
  1864. $(obj).attr('src',val.url).popover({
  1865. trigger: 'hover',
  1866. html: true,
  1867. container: $(document.body),
  1868. content: "<img src='" + val.url + "' style='width:100px;height:100px;' />",
  1869. placement: 'top'
  1870. });
  1871. var group =$(obj).parent();
  1872. group.find(':hidden').val(val.attachment), group.find('i').show().unbind('click').click(function(){
  1873. $(obj).attr('src',"{SNAILFISH_LOCAL}static/images/nopic100.jpg");
  1874. group.find(':hidden').val('');
  1875. group.find('i').hide();
  1876. $(obj).popover('destroy');
  1877. });
  1878. });
  1879. }
  1880. function addSpecList(options_name,spec_str, cur_cate_id)
  1881. {
  1882. var len = $(".spec_item").length;
  1883. $("#add-spec").html("正在处理...").attr("disabled", "true").toggleClass("btn-primary");
  1884. var url = "{:U('goods/mult_tpl',array('tpl'=>'spec'))}";
  1885. $.ajax({
  1886. "url": url,
  1887. type:'post',
  1888. data:{options_name:options_name,spec_str:spec_str,cur_cate_id:cur_cate_id},
  1889. success:function(data){
  1890. $("#add-spec").html('<i class="fa fa-plus"></i> 新建规格').removeAttr("disabled").toggleClass("btn-primary"); ;
  1891. $('#specs').append(data);
  1892. var len = $(".add-specitem").length -1;
  1893. $(".add-specitem:eq(" +len+ ")").focus();
  1894. refreshOptions();
  1895. }
  1896. });
  1897. }
  1898. function addSpec(){
  1899. var len = $(".spec_item").length;
  1900. $("#add-spec").html("正在处理...").attr("disabled", "true").toggleClass("btn-primary");
  1901. var url = "{:U('goods/tpl',array('tpl'=>'spec'))}";
  1902. $.ajax({
  1903. "url": url,
  1904. success:function(data){
  1905. $("#add-spec").html('<i class="fa fa-plus"></i> 新建规格').removeAttr("disabled").toggleClass("btn-primary"); ;
  1906. $('#specs').append(data);
  1907. var len = $(".add-specitem").length -1;
  1908. $(".add-specitem:eq(" +len+ ")").focus();
  1909. refreshOptions();
  1910. }
  1911. });
  1912. }
  1913. function removeSpec(specid){
  1914. if (confirm('确认要删除此规格?')){
  1915. $("#spec_" + specid).remove();
  1916. refreshOptions();
  1917. }
  1918. }
  1919. function addSpecItem(specid){
  1920. $("#add-specitem-" + specid).html("正在处理...").attr("disabled", "true");
  1921. var url = "{:U('goods/tpl',array('tpl'=>'specitem'))}" + "&specid=" + specid;
  1922. $.ajax({
  1923. "url": url,
  1924. success:function(data){
  1925. $("#add-specitem-" + specid).html('<i class="fa fa-plus"></i> 添加规格项').removeAttr("disabled");
  1926. $('#spec_item_' + specid).append(data);
  1927. var len = $("#spec_" + specid + " .spec_item_title").length -1;
  1928. $("#spec_" + specid + " .spec_item_title:eq(" +len+ ")").focus();
  1929. refreshOptions
  1930. if(type==3 && virtual==0){
  1931. $(".choosetemp").show();
  1932. }
  1933. }
  1934. });
  1935. }
  1936. function removeSpecItem(obj){
  1937. $(obj).closest('.spec_item_item').remove();
  1938. refreshOptions();
  1939. }
  1940. function refreshOptions(){
  1941. // 刷新后重置
  1942. window.optionchanged = false;
  1943. $('#optiontip').hide();
  1944. var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
  1945. var specs = [];
  1946. if($('.spec_item').length<=0){
  1947. $("#options").html('');
  1948. $("#discount").html('');
  1949. $("#isdiscount_discounts").html('');
  1950. $("#commission").html('');
  1951. return;
  1952. }
  1953. $(".spec_item").each(function(i){
  1954. var _this = $(this);
  1955. var spec = {
  1956. id: _this.find(".spec_id").val(),
  1957. title: _this.find(".spec_title").val()
  1958. };
  1959. var items = [];
  1960. _this.find(".spec_item_item").each(function(){
  1961. var __this = $(this);
  1962. var item = {
  1963. id: __this.find(".spec_item_id").val(),
  1964. title: __this.find(".spec_item_title").val(),
  1965. virtual: __this.find(".spec_item_virtual").val(),
  1966. show:__this.find(".spec_item_show").get(0).checked?"1":"0"
  1967. }
  1968. items.push(item);
  1969. });
  1970. spec.items = items;
  1971. specs.push(spec);
  1972. });
  1973. specs.sort(function(x,y){
  1974. if (x.items.length > y.items.length){
  1975. return 1;
  1976. }
  1977. if (x.items.length < y.items.length) {
  1978. return -1;
  1979. }
  1980. });
  1981. var len = specs.length;
  1982. var newlen = 1;
  1983. var h = new Array(len);
  1984. var rowspans = new Array(len);
  1985. for(var i=0;i<len;i++){
  1986. html+="<th>" + specs[i].title + "</th>";
  1987. var itemlen = specs[i].items.length;
  1988. if(itemlen<=0) { itemlen = 1 };
  1989. newlen*=itemlen;
  1990. h[i] = new Array(newlen);
  1991. for(var j=0;j<newlen;j++){
  1992. h[i][j] = new Array();
  1993. }
  1994. var l = specs[i].items.length;
  1995. rowspans[i] = 1;
  1996. for(j=i+1;j<len;j++){
  1997. rowspans[i]*= specs[j].items.length;
  1998. }
  1999. }
  2000. var is_take_vipcard = $('input[name="is_take_vipcard"]').prop('checked');
  2001. html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">库存<label style="color:red;font-size:16px;font-weight:900">*</label></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>';
  2002. html += '<th class="type-4"><div class=""><div style="padding-bottom:10px;text-align:center;">售价<label style="color:red;font-size:16px;font-weight:900">*</label></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>';
  2003. html+='<th class="type-4"><div class=""><div style="padding-bottom:10px;text-align:center;">原价<label style="color:red;font-size:16px;font-weight:900">*</label></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>';
  2004. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1){ ?>
  2005. html += '<th class="type-4 cardprice_title"><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>';
  2006. <?php } ?>
  2007. 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>';
  2008. 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>';
  2009. 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>';
  2010. html+='</tr></thead>';
  2011. for(var m=0;m<len;m++){
  2012. var k = 0,kid = 0,n=0;
  2013. for(var j=0;j<newlen;j++){
  2014. var rowspan = rowspans[m];
  2015. if( j % rowspan==0){
  2016. 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};
  2017. }
  2018. else{
  2019. h[m][j]={title:specs[m].items[kid].title,virtual: specs[m].items[kid].virtual, html: "",id: specs[m].items[kid].id};
  2020. }
  2021. n++;
  2022. if(n==rowspan){
  2023. kid++; if(kid>specs[m].items.length-1) { kid=0; }
  2024. n=0;
  2025. }
  2026. }
  2027. }
  2028. var hh = "";
  2029. for(var i=0;i<newlen;i++){
  2030. hh+="<tr>";
  2031. var ids = [];
  2032. var titles = [];
  2033. var virtuals = [];
  2034. /*for(var j=0;j<len;j++){
  2035. hh+=h[j][i].html;
  2036. ids.push( h[j][i].id);
  2037. titles.push( h[j][i].title);
  2038. virtuals.push( h[j][i].virtual);
  2039. }*/
  2040. for(var j=len-1;j >= 0;j--){
  2041. hh+=h[j][i].html;
  2042. ids.push( h[j][i].id);
  2043. titles.push( h[j][i].title);
  2044. virtuals.push( h[j][i].virtual);
  2045. }
  2046. ids =ids.join('_');
  2047. titles= titles.join('+');
  2048. 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 };
  2049. if( $(".option_id_" + ids).length>0){
  2050. val ={
  2051. id : $(".option_id_" + ids+":eq(0)").val(),
  2052. title: titles,
  2053. stock : $(".option_stock_" + ids+":eq(0)").val(),
  2054. presell : $(".option_presell_" + ids+":eq(0)").val(),
  2055. costprice : $(".option_costprice_" + ids+":eq(0)").val(),
  2056. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1){ ?>
  2057. cardprice : $(".option_cardprice_" + ids+":eq(0)").val(),
  2058. cardprice_hi : $(".option_cardprice_hi_" + ids+":eq(0)").val(),
  2059. <?php } ?>
  2060. productprice : $(".option_productprice_" + ids+":eq(0)").val(),
  2061. marketprice : $(".option_marketprice_" + ids +":eq(0)").val(),
  2062. goodssn : $(".option_goodssn_" + ids +":eq(0)").val(),
  2063. productsn : $(".option_productsn_" + ids +":eq(0)").val(),
  2064. weight : $(".option_weight_" + ids+":eq(0)").val(),
  2065. virtual : virtuals
  2066. }
  2067. }
  2068. hh += '<td>'
  2069. hh += '<input name="option_stock_' + ids +'" type="text" class="form-control option_stock option_stock_' + ids +'" value="' +(val.stock=='undefined'?'':val.stock )+'"/></td>';
  2070. hh += '<input name="option_id_' + ids+'" type="hidden" class="form-control option_id option_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
  2071. hh += '<input name="option_ids[]" type="hidden" class="form-control option_ids option_ids_' + ids +'" value="' + ids +'"/>';
  2072. hh += '<input name="option_title_' + ids +'" type="hidden" class="form-control option_title option_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
  2073. hh += '<input name="option_virtual_' + ids +'" type="hidden" class="form-control option_virtual option_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
  2074. hh += '<input name="option_cardprice_hi_' + ids +'" type="hidden" class="form-control option_virtual option_cardprice_hi_' + ids +'" value="' +(val.cardprice=='undefined'?'':val.cardprice )+'"/></td>';
  2075. hh += '</td>';
  2076. //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>';
  2077. 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>';
  2078. 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>';
  2079. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1){ ?>
  2080. if(typeof(val.cardprice) == "undefined" || val.cardprice == 'undefined' || val.cardprice == null){
  2081. val.cardprice = "";
  2082. }
  2083. if(val.cardprice == ""){
  2084. if(typeof(val.cardprice_hi) == "undefined" || val.cardprice_hi == 'undefined' || val.cardprice_hi == null){
  2085. val.cardprice = "";
  2086. }else{
  2087. val.cardprice = val.cardprice_hi;
  2088. }
  2089. }
  2090. console.log(val.cardprice+'=='+val.cardprice_hi);
  2091. hh += '<td class="type-4 cardprice_td"><input name="option_cardprice_' + ids + '" type="text" class="form-control option_cardprice option_cardprice_' + ids + '" " value="' + (val.cardprice=='undefined' ? '' : val.cardprice ) + '"/></td>';
  2092. <?php } ?>
  2093. 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>';
  2094. hh += '<td><input name="option_goodssn_' +ids+'" type="text" class="form-control option_goodssn option_goodssn_' + ids +'" " value="' +(val.goodssn=='undefined'?'':val.goodssn )+'"/></td>';
  2095. //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>';
  2096. hh += '<td><input name="option_weight_' + ids +'" type="text" class="form-control option_weight option_weight_' + ids +'" " value="' +(val.weight=='undefined'?'':val.weight )+'"/></td>';
  2097. hh += "</tr>";
  2098. }
  2099. html+=hh;
  2100. html+="</table>";
  2101. $("#options").html(html);
  2102. refreshDiscount();
  2103. refreshIsDiscount();
  2104. if(window.type=='4'){
  2105. $('.type-4').hide();
  2106. }else{
  2107. $('.type-4').show();
  2108. }
  2109. if(is_take_vipcard) {
  2110. $('.cardprice_td').show();
  2111. $('.cardprice_title').show();
  2112. }else{
  2113. $('.cardprice_td').hide();
  2114. $('.cardprice_title').hide();
  2115. }
  2116. }
  2117. function refreshDiscount() {
  2118. var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
  2119. var specs = [];
  2120. $(".spec_item").each(function (i) {
  2121. var _this = $(this);
  2122. var spec = {
  2123. id: _this.find(".spec_id").val(),
  2124. title: _this.find(".spec_title").val()
  2125. };
  2126. var items = [];
  2127. _this.find(".spec_item_item").each(function () {
  2128. var __this = $(this);
  2129. var item = {
  2130. id: __this.find(".spec_item_id").val(),
  2131. title: __this.find(".spec_item_title").val(),
  2132. virtual: __this.find(".spec_item_virtual").val(),
  2133. show: __this.find(".spec_item_show").get(0).checked ? "1" : "0"
  2134. }
  2135. items.push(item);
  2136. });
  2137. spec.items = items;
  2138. specs.push(spec);
  2139. });
  2140. specs.sort(function (x, y) {
  2141. if (x.items.length > y.items.length) {
  2142. return 1;
  2143. }
  2144. if (x.items.length < y.items.length) {
  2145. return -1;
  2146. }
  2147. });
  2148. var len = specs.length;
  2149. var newlen = 1;
  2150. var h = new Array(len);
  2151. var rowspans = new Array(len);
  2152. for (var i = 0; i < len; i++) {
  2153. html += "<th>" + specs[i].title + "</th>";
  2154. var itemlen = specs[i].items.length;
  2155. if (itemlen <= 0) {
  2156. itemlen = 1
  2157. }
  2158. ;
  2159. newlen *= itemlen;
  2160. h[i] = new Array(newlen);
  2161. for (var j = 0; j < newlen; j++) {
  2162. h[i][j] = new Array();
  2163. }
  2164. var l = specs[i].items.length;
  2165. rowspans[i] = 1;
  2166. for (j = i + 1; j < len; j++) {
  2167. rowspans[i] *= specs[j].items.length;
  2168. }
  2169. }
  2170. <?php foreach( $levels as $level ){ ?>
  2171. <?php if( $level['key']=='default'){ ?>
  2172. 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>';
  2173. <?php }else{ ?>
  2174. 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>';
  2175. <?php } ?>
  2176. <?php } ?>
  2177. html += '</tr></thead>';
  2178. for (var m = 0; m < len; m++) {
  2179. var k = 0, kid = 0, n = 0;
  2180. for (var j = 0; j < newlen; j++) {
  2181. var rowspan = rowspans[m];
  2182. if (j % rowspan == 0) {
  2183. h[m][j] = {
  2184. title: specs[m].items[kid].title,
  2185. virtual: specs[m].items[kid].virtual,
  2186. html: "<td class='full' rowspan='" + rowspan + "'>" + specs[m].items[kid].title + "</td>\r\n",
  2187. id: specs[m].items[kid].id
  2188. };
  2189. }
  2190. else {
  2191. h[m][j] = {
  2192. title: specs[m].items[kid].title,
  2193. virtual: specs[m].items[kid].virtual,
  2194. html: "",
  2195. id: specs[m].items[kid].id
  2196. };
  2197. }
  2198. n++;
  2199. if (n == rowspan) {
  2200. kid++;
  2201. if (kid > specs[m].items.length - 1) {
  2202. kid = 0;
  2203. }
  2204. n = 0;
  2205. }
  2206. }
  2207. }
  2208. var hh = "";
  2209. for (var i = 0; i < newlen; i++) {
  2210. hh += "<tr>";
  2211. var ids = [];
  2212. var titles = [];
  2213. var virtuals = [];
  2214. for (var j = 0; j < len; j++) {
  2215. hh += h[j][i].html;
  2216. ids.push(h[j][i].id);
  2217. titles.push(h[j][i].title);
  2218. virtuals.push(h[j][i].virtual);
  2219. }
  2220. ids = ids.join('_');
  2221. titles = titles.join('+');
  2222. var val = {
  2223. id: "",
  2224. title: titles,
  2225. <?php foreach( $levels as $level ){ ?>
  2226. <?php if( $level['key']=='default'){ ?>
  2227. level{$level['key']}: '',
  2228. <?php }else{ ?>
  2229. level{$level['id']}: '',
  2230. <?php } ?>
  2231. <?php } ?>
  2232. costprice: "",
  2233. presell: "",
  2234. productprice: "",
  2235. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1){ ?>
  2236. cardprice: "",
  2237. <?php } ?>
  2238. marketprice: "",
  2239. weight: "",
  2240. productsn: "",
  2241. goodssn: "",
  2242. virtual: virtuals
  2243. };
  2244. 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 };
  2245. if ($(".discount_id_" + ids).length > 0) {
  2246. val = {
  2247. id: $(".discount_id_" + ids + ":eq(0)").val(),
  2248. title: titles,
  2249. <?php foreach( $levels as $level ){ ?>
  2250. <?php if( $level['key']=='default'){ ?>
  2251. level{$level['key']}: $(".discount_{$level['key']}_" + ids + ":eq(0)").val(),
  2252. <?php }else{ ?>
  2253. level{$level['id']}: $(".discount_level{$level['id']}_" + ids + ":eq(0)").val(),
  2254. <?php } ?>
  2255. <?php } ?>
  2256. costprice: $(".discount_costprice_" + ids + ":eq(0)").val(),
  2257. presell: $(".discount_presell_" + ids + ":eq(0)").val(),
  2258. productprice: $(".discount_productprice_" + ids + ":eq(0)").val(),
  2259. <?php if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1){ ?>
  2260. cardprice: $(".discount_cardprice_" + ids + ":eq(0)").val(),
  2261. <?php } ?>
  2262. marketprice: $(".discount_marketprice_" + ids + ":eq(0)").val(),
  2263. presell: $(".discount_presell_" + ids + ":eq(0)").val(),
  2264. goodssn: $(".discount_goodssn_" + ids + ":eq(0)").val(),
  2265. productsn: $(".discount_productsn_" + ids + ":eq(0)").val(),
  2266. weight: $(".discount_weight_" + ids + ":eq(0)").val(),
  2267. virtual: virtuals
  2268. }
  2269. }
  2270. <?php foreach( $levels as $level ){ ?>
  2271. hh += '<td>'
  2272. <?php if( $level['key']=='default'){ ?>
  2273. 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']} )+'"/>';
  2274. <?php }else{ ?>
  2275. 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']} )+'"/>';
  2276. <?php } ?>
  2277. hh += '</td>';
  2278. <?php } ?>
  2279. hh += '<input data-name="discount_id_' + ids+'"type="hidden" class="form-control discount_id discount_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
  2280. hh += '<input data-name="discount_ids"type="hidden" class="form-control discount_ids discount_ids_' + ids +'" value="' + ids +'"/>';
  2281. hh += '<input data-name="discount_title_' + ids +'"type="hidden" class="form-control discount_title discount_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
  2282. hh += '<input data-name="discount_virtual_' + ids +'"type="hidden" class="form-control discount_virtual discount_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
  2283. hh += "</tr>";
  2284. }
  2285. html += hh;
  2286. html += "</table>";
  2287. $("#discount").html(html);
  2288. }
  2289. function refreshIsDiscount() {
  2290. var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
  2291. var specs = [];
  2292. $(".spec_item").each(function (i) {
  2293. var _this = $(this);
  2294. var spec = {
  2295. id: _this.find(".spec_id").val(),
  2296. title: _this.find(".spec_title").val()
  2297. };
  2298. var items = [];
  2299. _this.find(".spec_item_item").each(function () {
  2300. var __this = $(this);
  2301. var item = {
  2302. id: __this.find(".spec_item_id").val(),
  2303. title: __this.find(".spec_item_title").val(),
  2304. virtual: __this.find(".spec_item_virtual").val(),
  2305. show: __this.find(".spec_item_show").get(0).checked ? "1" : "0"
  2306. }
  2307. items.push(item);
  2308. });
  2309. spec.items = items;
  2310. specs.push(spec);
  2311. });
  2312. specs.sort(function (x, y) {
  2313. if (x.items.length > y.items.length) {
  2314. return 1;
  2315. }
  2316. if (x.items.length < y.items.length) {
  2317. return -1;
  2318. }
  2319. });
  2320. var len = specs.length;
  2321. var newlen = 1;
  2322. var h = new Array(len);
  2323. var rowspans = new Array(len);
  2324. for (var i = 0; i < len; i++) {
  2325. html += "<th>" + specs[i].title + "</th>";
  2326. var itemlen = specs[i].items.length;
  2327. if (itemlen <= 0) {
  2328. itemlen = 1
  2329. }
  2330. ;
  2331. newlen *= itemlen;
  2332. h[i] = new Array(newlen);
  2333. for (var j = 0; j < newlen; j++) {
  2334. h[i][j] = new Array();
  2335. }
  2336. var l = specs[i].items.length;
  2337. rowspans[i] = 1;
  2338. for (j = i + 1; j < len; j++) {
  2339. rowspans[i] *= specs[j].items.length;
  2340. }
  2341. }
  2342. <?php foreach( $levels as $level ){ ?>
  2343. <?php if( $level['key']=='default'){ ?>
  2344. 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>';
  2345. <?php }else{ ?>
  2346. 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>';
  2347. <?php } ?>
  2348. <?php } ?>
  2349. html += '</tr></thead>';
  2350. for (var m = 0; m < len; m++) {
  2351. var k = 0, kid = 0, n = 0;
  2352. for (var j = 0; j < newlen; j++) {
  2353. var rowspan = rowspans[m];
  2354. if (j % rowspan == 0) {
  2355. h[m][j] = {
  2356. title: specs[m].items[kid].title,
  2357. virtual: specs[m].items[kid].virtual,
  2358. html: "<td class='full' rowspan='" + rowspan + "'>" + specs[m].items[kid].title + "</td>\r\n",
  2359. id: specs[m].items[kid].id
  2360. };
  2361. }
  2362. else {
  2363. h[m][j] = {
  2364. title: specs[m].items[kid].title,
  2365. virtual: specs[m].items[kid].virtual,
  2366. html: "",
  2367. id: specs[m].items[kid].id
  2368. };
  2369. }
  2370. n++;
  2371. if (n == rowspan) {
  2372. kid++;
  2373. if (kid > specs[m].items.length - 1) {
  2374. kid = 0;
  2375. }
  2376. n = 0;
  2377. }
  2378. }
  2379. }
  2380. var hh = "";
  2381. for (var i = 0; i < newlen; i++) {
  2382. hh += "<tr>";
  2383. var ids = [];
  2384. var titles = [];
  2385. var virtuals = [];
  2386. for (var j = 0; j < len; j++) {
  2387. hh += h[j][i].html;
  2388. ids.push(h[j][i].id);
  2389. titles.push(h[j][i].title);
  2390. virtuals.push(h[j][i].virtual);
  2391. }
  2392. ids = ids.join('_');
  2393. titles = titles.join('+');
  2394. var val = {
  2395. id: "",
  2396. title: titles,
  2397. <?php foreach( $levels as $level ){ ?>
  2398. <?php if( $level['key']=='default'){ ?>
  2399. level{$level['key']}: '',
  2400. <?php }else{ ?>
  2401. level{$level['if']}: '',
  2402. <?php } ?>
  2403. <?php } ?>
  2404. costprice: "",
  2405. presell: "",
  2406. productprice: "",
  2407. marketprice: "",
  2408. weight: "",
  2409. productsn: "",
  2410. goodssn: "",
  2411. virtual: virtuals
  2412. };
  2413. 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 };
  2414. if ($(".isdiscount_discounts_id_" + ids).length > 0) {
  2415. val = {
  2416. id: $(".isdiscount_discounts_id_" + ids + ":eq(0)").val(),
  2417. title: titles,
  2418. <?php foreach( $levels as $level ){ ?>
  2419. <?php if( $level['key']=='default'){ ?>
  2420. level{$level['key']}: $(".isdiscount_discounts_{$level['key']}_" + ids + ":eq(0)").val(),
  2421. <?php }else{ ?>
  2422. level{$level['id']}: $(".isdiscount_discounts_level{$level['id']}_" + ids + ":eq(0)").val(),
  2423. <?php } ?>
  2424. <?php } ?>
  2425. costprice: $(".isdiscount_discounts_costprice_" + ids + ":eq(0)").val(),
  2426. productprice: $(".isdiscount_discounts_productprice_" + ids + ":eq(0)").val(),
  2427. marketprice: $(".isdiscount_discounts_marketprice_" + ids + ":eq(0)").val(),
  2428. presell: $(".isdiscount_discounts_presell_" + ids + ":eq(0)").val(),
  2429. goodssn: $(".isdiscount_discounts_goodssn_" + ids + ":eq(0)").val(),
  2430. productsn: $(".isdiscount_discounts_productsn_" + ids + ":eq(0)").val(),
  2431. weight: $(".isdiscount_discounts_weight_" + ids + ":eq(0)").val(),
  2432. virtual: virtuals
  2433. }
  2434. }
  2435. <?php foreach( $levels as $level ){ ?>
  2436. hh += '<td>'
  2437. <?php if( $level['key']=='default'){ ?>
  2438. 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']} )+'"/>';
  2439. <?php }else{ ?>
  2440. 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']} )+'"/>';
  2441. <?php } ?>
  2442. hh += '</td>';
  2443. <?php } ?>
  2444. 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 )+'"/>';
  2445. hh += '<input data-name="isdiscount_discounts_ids"type="hidden" class="form-control isdiscount_discounts_ids isdiscount_discounts_ids_' + ids +'" value="' + ids +'"/>';
  2446. 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>';
  2447. 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>';
  2448. hh += "</tr>";
  2449. }
  2450. html += hh;
  2451. html += "</table>";
  2452. $("#isdiscount_discounts").html(html);
  2453. }
  2454. function refreshCommission() {
  2455. var commission_level = {:json_encode($commission_level)};
  2456. var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
  2457. var specs = [];
  2458. $(".spec_item").each(function (i) {
  2459. var _this = $(this);
  2460. var spec = {
  2461. id: _this.find(".spec_id").val(),
  2462. title: _this.find(".spec_title").val()
  2463. };
  2464. var items = [];
  2465. _this.find(".spec_item_item").each(function () {
  2466. var __this = $(this);
  2467. var item = {
  2468. id: __this.find(".spec_item_id").val(),
  2469. title: __this.find(".spec_item_title").val(),
  2470. virtual: __this.find(".spec_item_virtual").val(),
  2471. show: __this.find(".spec_item_show").get(0).checked ? "1" : "0"
  2472. }
  2473. items.push(item);
  2474. });
  2475. spec.items = items;
  2476. specs.push(spec);
  2477. });
  2478. specs.sort(function (x, y) {
  2479. if (x.items.length > y.items.length) {
  2480. return 1;
  2481. }
  2482. if (x.items.length < y.items.length) {
  2483. return -1;
  2484. }
  2485. });
  2486. var len = specs.length;
  2487. var newlen = 1;
  2488. var h = new Array(len);
  2489. var rowspans = new Array(len);
  2490. for (var i = 0; i < len; i++) {
  2491. html += "<th>" + specs[i].title + "</th>";
  2492. var itemlen = specs[i].items.length;
  2493. if (itemlen <= 0) {
  2494. itemlen = 1
  2495. }
  2496. ;
  2497. newlen *= itemlen;
  2498. h[i] = new Array(newlen);
  2499. for (var j = 0; j < newlen; j++) {
  2500. h[i][j] = new Array();
  2501. }
  2502. var l = specs[i].items.length;
  2503. rowspans[i] = 1;
  2504. for (j = i + 1; j < len; j++) {
  2505. rowspans[i] *= specs[j].items.length;
  2506. }
  2507. }
  2508. $.each(commission_level,function (key,level) {
  2509. html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">'+level.levelname+'</div></div></th>';
  2510. })
  2511. html += '</tr></thead>';
  2512. for (var m = 0; m < len; m++) {
  2513. var k = 0, kid = 0, n = 0;
  2514. for (var j = 0; j < newlen; j++) {
  2515. var rowspan = rowspans[m];
  2516. if (j % rowspan == 0) {
  2517. h[m][j] = {
  2518. title: specs[m].items[kid].title,
  2519. virtual: specs[m].items[kid].virtual,
  2520. html: "<td class='full' rowspan='" + rowspan + "'>" + specs[m].items[kid].title + "</td>\r\n",
  2521. id: specs[m].items[kid].id
  2522. };
  2523. }
  2524. else {
  2525. h[m][j] = {
  2526. title: specs[m].items[kid].title,
  2527. virtual: specs[m].items[kid].virtual,
  2528. html: "",
  2529. id: specs[m].items[kid].id
  2530. };
  2531. }
  2532. n++;
  2533. if (n == rowspan) {
  2534. kid++;
  2535. if (kid > specs[m].items.length - 1) {
  2536. kid = 0;
  2537. }
  2538. n = 0;
  2539. }
  2540. }
  2541. }
  2542. var hh = "";
  2543. for (var i = 0; i < newlen; i++) {
  2544. hh += "<tr>";
  2545. var ids = [];
  2546. var titles = [];
  2547. var virtuals = [];
  2548. for (var j = 0; j < len; j++) {
  2549. hh += h[j][i].html;
  2550. ids.push(h[j][i].id);
  2551. titles.push(h[j][i].title);
  2552. virtuals.push(h[j][i].virtual);
  2553. }
  2554. ids = ids.join('_');
  2555. titles = titles.join('+');
  2556. var val = {
  2557. id: "",
  2558. title: titles,
  2559. <?php foreach( $commission_level as $level ){ ?>
  2560. <?php if( $level["key"] == "default"){ ?>
  2561. level{$level['key']}: '',
  2562. <?php }else{ ?>
  2563. level{$level['id']}: '',
  2564. <?php } ?>
  2565. <?php } ?>
  2566. costprice: "",
  2567. presell: "",
  2568. productprice: "",
  2569. marketprice: "",
  2570. weight: "",
  2571. productsn: "",
  2572. goodssn: "",
  2573. virtual: virtuals
  2574. };
  2575. 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 };
  2576. <?php foreach( $commission_level as $level ){ ?>
  2577. <?php if( $level["key"] == "default"){ ?>
  2578. var level{$level['key']} = new Array(3);
  2579. $(".commission_{$level['key']}_"+ ids).each(function(index,val){
  2580. level{$level['key']}[index] = val;
  2581. })
  2582. <?php }else{ ?>
  2583. var level{$level['id']} = new Array(3);
  2584. $(".commission_level{$level['id']}_"+ ids).each(function(index,val){
  2585. level{$level['id']}[index] = val;
  2586. })
  2587. <?php } ?>
  2588. <?php } ?>
  2589. if ($(".commission_id_" + ids).length > 0) {
  2590. val = {
  2591. id: $(".commission_id_" + ids + ":eq(0)").val(),
  2592. title: titles,
  2593. costprice: $(".commission_costprice_" + ids + ":eq(0)").val(),
  2594. presell: $(".commission_presell_" + ids + ":eq(0)").val(),
  2595. productprice: $(".commission_productprice_" + ids + ":eq(0)").val(),
  2596. marketprice: $(".commission_marketprice_" + ids + ":eq(0)").val(),
  2597. goodssn: $(".commission_goodssn_" + ids + ":eq(0)").val(),
  2598. productsn: $(".commission_productsn_" + ids + ":eq(0)").val(),
  2599. weight: $(".commission_weight_" + ids + ":eq(0)").val(),
  2600. virtual: virtuals
  2601. }
  2602. }
  2603. <?php foreach( $commission_level as $level ){ ?>
  2604. hh += '<td>';
  2605. var level_temp = <?php if( $level['key'] == 'default'){ ?>level{$level['key']}<?php }else{ ?>level{$level['id']}<?php } ?>;
  2606. if (len >= i && typeof (level_temp) != 'undefined')
  2607. {
  2608. if('{$level['key']}' == 'default')
  2609. {
  2610. for (var li = 0; li<{$shopset_level};li++)
  2611. {
  2612. if (typeof (level_temp[li])!= "undefined")
  2613. {
  2614. 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})+'%;"/> ';
  2615. }
  2616. else
  2617. {
  2618. 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})+'%;"/> ';
  2619. }
  2620. }
  2621. }
  2622. else
  2623. {
  2624. for (var li = 0; li<{$shopset_level};li++)
  2625. {
  2626. if (typeof (level_temp[li])!= "undefined")
  2627. {
  2628. 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})+'%;"/> ';
  2629. }
  2630. else
  2631. {
  2632. 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})+'%;"/> ';
  2633. }
  2634. }
  2635. }
  2636. }
  2637. else
  2638. {
  2639. if('{$level['key']}' == 'default')
  2640. {
  2641. for (var li = 0; li<{$shopset_level};li++)
  2642. {
  2643. if (typeof (level_temp[li])!= "undefined")
  2644. {
  2645. 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})+'%;"/> ';
  2646. }
  2647. else
  2648. {
  2649. 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})+'%;"/> ';
  2650. }
  2651. }
  2652. }
  2653. else
  2654. {
  2655. for (var li = 0; li<{$shopset_level};li++)
  2656. {
  2657. if (typeof (level_temp[li])!= "undefined")
  2658. {
  2659. 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})+'%;"/> ';
  2660. }
  2661. else
  2662. {
  2663. 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})+'%;"/> ';
  2664. }
  2665. }
  2666. }
  2667. }
  2668. hh += '</td>';
  2669. <?php } ?>
  2670. hh += '<input data-name="commission_id_' + ids+'"type="hidden" class="form-control commission_id commission_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
  2671. hh += '<input data-name="commission_ids"type="hidden" class="form-control commission_ids commission_ids_' + ids +'" value="' + ids +'"/>';
  2672. hh += '<input data-name="commission_title_' + ids +'"type="hidden" class="form-control commission_title commission_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
  2673. hh += '<input data-name="commission_virtual_' + ids +'"type="hidden" class="form-control commission_virtual commission_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
  2674. hh += "</tr>";
  2675. }
  2676. html += hh;
  2677. html += "</table>";
  2678. $("#commission").html(html);
  2679. }
  2680. function setCol(cls){
  2681. $("."+cls).val( $("."+cls+"_all").val());
  2682. }
  2683. function showItem(obj){
  2684. var show = $(obj).get(0).checked?"1":"0";
  2685. $(obj).parents('.spec_item_item').find('.spec_item_show:eq(0)').val(show);
  2686. }
  2687. function nofind(){
  2688. var img=event.srcElement;
  2689. img.src="./resource/image/module-nopic-small.jpg";
  2690. img.onerror=null;
  2691. }
  2692. function choosetemp(id){
  2693. $('#modal-module-chooestemp').modal();
  2694. $('#modal-module-chooestemp').data("temp",id);
  2695. }
  2696. function addtemp(){
  2697. var id = $('#modal-module-chooestemp').data("temp");
  2698. var temp_id = $('#modal-module-chooestemp').find("select").val();
  2699. var temp_name = $('#modal-module-chooestemp option[value='+temp_id+']').text();
  2700. //alert(temp_id+":"+temp_name);
  2701. $("#temp_name_"+id).val(temp_name);
  2702. $("#temp_id_"+id).val(temp_id);
  2703. $('#modal-module-chooestemp .close').click();
  2704. refreshOptions()
  2705. }
  2706. function setinterval(type)
  2707. {
  2708. var intervalfloor =$('#intervalfloor').val();
  2709. if(intervalfloor=="")
  2710. {
  2711. intervalfloor=0;
  2712. }
  2713. intervalfloor = parseInt(intervalfloor);
  2714. if(type=='plus')
  2715. {
  2716. if(intervalfloor==3)
  2717. {
  2718. tip.msgbox.err("最多添加三个区间价格");
  2719. return;
  2720. }
  2721. intervalfloor=intervalfloor+1;
  2722. }
  2723. else if(type=='minus')
  2724. {
  2725. if(intervalfloor==0)
  2726. {
  2727. tip.msgbox.err("请最少添加一个区间价格");
  2728. return;
  2729. }
  2730. intervalfloor=intervalfloor-1;
  2731. }else
  2732. {
  2733. return;
  2734. }
  2735. if(intervalfloor<1)
  2736. {
  2737. $('#interval1').hide();
  2738. $('#intervalnum1').val("");
  2739. $('#intervalprice1').val("");
  2740. }else
  2741. {
  2742. $('#interval1').show();
  2743. }
  2744. if(intervalfloor<2)
  2745. {
  2746. $('#interval2').hide();
  2747. $('#intervalnum2').val("");
  2748. $('#intervalprice2').val("");
  2749. }else
  2750. {
  2751. $('#interval2').show();
  2752. }
  2753. if(intervalfloor<3)
  2754. {
  2755. $('#interval3').hide();
  2756. $('#intervalnum3').val("");
  2757. $('#intervalprice3').val("");
  2758. }else
  2759. {
  2760. $('#interval3').show();
  2761. }
  2762. $('#intervalfloor').val(intervalfloor);
  2763. }
  2764. </script>
  2765. <script language="javascript">
  2766. $(function() {
  2767. })
  2768. </script>
  2769. <script>
  2770. var heads_page = 1;
  2771. $("body").delegate("#batchheads_page .pagination a","click",function(){
  2772. heads_page = $(this).attr('page');
  2773. search_heads_do();
  2774. })
  2775. function search_heads()
  2776. {
  2777. heads_page = 1;
  2778. search_heads_do();
  2779. }
  2780. function search_heads_do()
  2781. {
  2782. var province_name = $('#sel-provance').val();
  2783. var city_name = $('#sel-city').val();
  2784. var area_name = $('#sel-area').val();
  2785. var country_name = $('#sel-street').val();
  2786. var keyword = $('#supply_id_input').val();
  2787. $.post("{:U('communityhead/query_head')}",{page:heads_page,'province_name':province_name,'city_name': city_name,'area_name':area_name,'country_name':country_name,'keyword':keyword},
  2788. function (ret) {
  2789. if (ret.status == 1) {
  2790. $('#batchheads_content').html(ret.html);
  2791. $('#batchheads_page').html(ret.page_html);
  2792. return
  2793. } else {
  2794. layer.msg('修改失败');
  2795. }
  2796. }, 'json');
  2797. }
  2798. //显示批量分类
  2799. $('#batchcatesbut').click(function () {
  2800. // var index = layer.load(1);
  2801. var index = layer.open({
  2802. type: 1,
  2803. area: '500px',
  2804. title: '选取分类'
  2805. ,content: $('#batchcates_html').html(),
  2806. yes: function(index, layero){
  2807. //do something
  2808. layer.close(index); //如果设定了yes回调,需进行手工关闭
  2809. }
  2810. });
  2811. })
  2812. $('#batch_head_group').click(function () {
  2813. // var index = layer.load(1);
  2814. var index = layer.open({
  2815. type: 1,
  2816. area: '500px',
  2817. title: '选取团长分组'
  2818. ,content: $('#batchcates_headgroup_html').html(),
  2819. yes: function(index, layero){
  2820. //do something
  2821. layer.close(index); //如果设定了yes回调,需进行手工关闭
  2822. }
  2823. });
  2824. })
  2825. $('#batch_head_group2').click(function () {
  2826. // var index = layer.load(1);
  2827. var index = layer.open({
  2828. type: 1,
  2829. area: '500px',
  2830. title: '选取团长分组'
  2831. ,content: $('#batchcates_headgroup_html').html(),
  2832. yes: function(index, layero){
  2833. //do something
  2834. layer.close(index); //如果设定了yes回调,需进行手工关闭
  2835. }
  2836. });
  2837. })
  2838. $('.check_heads_all').click(function(){
  2839. //head_id
  2840. if($(this).is(':checked')){
  2841. $('.head_id').prop('checked',true);
  2842. }else{
  2843. $('.head_id').prop('checked',false);
  2844. }
  2845. })
  2846. $(".radio_sale").click(function(){
  2847. var checkedvalue = $("input[name='is_all_sale']:checked").val();
  2848. if(checkedvalue == 1){
  2849. }else{
  2850. cascdeInit("1","1","","","","");
  2851. search_heads_do();
  2852. var offs_lf = ( $(window).width() -720 )/2;
  2853. var offs_ht = ( $(window).height() -690 )/2;
  2854. $('#batchheads .modal-dialog').css('top',offs_ht+'px');
  2855. $('#batchheads .modal-dialog').css('margin-top','0px');
  2856. $('#batchheads .modal-dialog').css('left',offs_lf+'px');
  2857. $('#batchheads .modal-dialog').css('margin-left','0px');
  2858. $('#batchheads').show();
  2859. }
  2860. })
  2861. $('#batchcatesbut2').click(function () {
  2862. var index = layer.open({
  2863. type: 1,
  2864. area: '500px',
  2865. title: '选取分类'
  2866. ,content: $('#batchcates_html').html(),
  2867. yes: function(index, layero){
  2868. //do something
  2869. layer.close(index); //如果设定了yes回调,需进行手工关闭
  2870. }
  2871. });
  2872. })
  2873. //关闭批量分类
  2874. $('.modal-header .close').click(function () {
  2875. $('#batchcates').hide();
  2876. $('#batchheads').hide();
  2877. $('#batch_time').hide();
  2878. })
  2879. // 取消批量分类
  2880. $('.modal-footer .btn.btn-default').click(function () {
  2881. $('#batchcates').hide();
  2882. $('#batchheads').hide();
  2883. $('#batch_time').hide();
  2884. })
  2885. $('.model_heads').click(function(){
  2886. var head_id_arr = [];
  2887. $('.head_id').each(function(){
  2888. if($(this).is(':checked')) {
  2889. head_id_arr.push( $(this).val() )
  2890. }
  2891. })
  2892. //modal-group-head
  2893. var is_clear_old = 0;
  2894. if( $('#is_cancle_old').is(':checked') )
  2895. {
  2896. is_clear_old = 1;
  2897. }
  2898. var is_cancle_allhead2 = 0;
  2899. if( $('#is_cancle_allhead').is(':checked') )
  2900. {
  2901. is_cancle_allhead2 = 1;
  2902. }
  2903. is_cancle_allhead2 = 1;
  2904. //is_cancle_allhead2
  2905. if(head_id_arr.length > 0)
  2906. {
  2907. var goodsids = [];
  2908. var goods_id = $('#goods_id').val();
  2909. goodsids.push(goods_id);
  2910. if(goods_id != '')
  2911. {
  2912. $.post("{:U('goods/ajax_batchheads')}",{'goodsids':goodsids,'head_id_arr': head_id_arr,'is_cancle_allhead':is_cancle_allhead2,'is_clear_old':is_clear_old}, function (ret) {
  2913. if (ret.status == 1) {
  2914. $('#batchheads').hide();
  2915. layer.msg('分配成功', {
  2916. time: 1000
  2917. }, function(){
  2918. window.location.reload();
  2919. });
  2920. return
  2921. } else {
  2922. layer.msg('修改失败');
  2923. }
  2924. }, 'json');
  2925. }else{
  2926. $('#head_id_arr').val(head_id_arr);
  2927. $('#batchheads').hide();
  2928. layer.msg('团长选择成功', {
  2929. time: 1000
  2930. });
  2931. }
  2932. }else{
  2933. layer.msg('请选择团长');
  2934. }
  2935. })
  2936. //确认
  2937. var cates2 = 0;
  2938. $("body").delegate("#cates2","click",function(){
  2939. cates2 = $(this).val() ;
  2940. })
  2941. var group_heads2 = 'default';
  2942. $("body").delegate("#group_heads","click",function(){
  2943. group_heads2 = $(this).val() ;
  2944. })
  2945. $("body").delegate(".cancle","click",function(){
  2946. layer.closeAll();
  2947. })
  2948. $("body").delegate(".modal-group-head","click",function(){
  2949. var group_heads=$('#group_heads').val();
  2950. if(group_heads2 != 'default')
  2951. {
  2952. group_heads = group_heads2;
  2953. }
  2954. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  2955. var goodsids = selected_checkboxs.map(function () {
  2956. return $(this).val()
  2957. }).get();
  2958. if(goodsids.length <=0 )
  2959. {
  2960. layer.msg('请先选择商品');
  2961. return false;
  2962. }
  2963. var is_clear_old = 0;
  2964. $('.is_cancle_old2').each(function(){
  2965. if( $(this).is(':checked') )
  2966. {
  2967. is_clear_old = 1;
  2968. }
  2969. })
  2970. var is_cancle_allhead = 0;
  2971. $('.is_cancle_allhead2').each(function(){
  2972. if( $(this).is(':checked') )
  2973. {
  2974. is_cancle_allhead = 1;
  2975. }
  2976. })
  2977. var iscover=$('input[name="iscover"]:checked').val();
  2978. $.post("{:U('goods/ajax_batchcates_headgroup')}",{'goodsids':goodsids,'groupid': group_heads,'is_cancle_allhead':is_cancle_allhead,'is_clear_old' : is_clear_old }, function (ret) {
  2979. if (ret.status == 1) {
  2980. layer.msg('分配成功', {
  2981. time: 1000
  2982. }, function(){
  2983. window.location.reload();
  2984. });
  2985. return
  2986. } else {
  2987. layer.msg('分配失败');
  2988. }
  2989. }, 'json');
  2990. })
  2991. $('.layui-table-sort').click(function(){
  2992. $(this).attr('lay-sort','asc');
  2993. })
  2994. $("body").delegate(".modal-fenlei","click",function(){
  2995. var cates=$('#cates2').val();
  2996. if(cates2 != 0)
  2997. {
  2998. cates = cates2;
  2999. }
  3000. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  3001. var goodsids = selected_checkboxs.map(function () {
  3002. return $(this).val()
  3003. }).get();
  3004. //id="cates"
  3005. var iscover=$('input[name="iscover"]:checked').val();
  3006. $.post("{:U('goods/ajax_batchcates')}",{'goodsids':goodsids,'cates': cates,'iscover':iscover}, function (ret) {
  3007. if (ret.status == 1) {
  3008. $('#batchcates').hide();
  3009. layer.msg('修改成功', {
  3010. time: 1000
  3011. }, function(){
  3012. window.location.reload();
  3013. });
  3014. return
  3015. } else {
  3016. layer.msg('修改失败');
  3017. }
  3018. }, 'json');
  3019. })
  3020. //----
  3021. //显示时间设置
  3022. $('#batchtime,#batchtime2').click(function () {
  3023. var offs_lf = ( $(window).width() -720 )/2;
  3024. var offs_ht = ( $(window).height() -290 )/2;
  3025. $('#batch_time .modal-dialog').css('top',offs_ht+'px');
  3026. $('#batch_time .modal-dialog').css('margin-top','0px');
  3027. $('#batch_time .modal-dialog').css('left',offs_lf+'px');
  3028. $('#batch_time .modal-dialog').css('margin-left','0px');
  3029. $('#batch_time').show();
  3030. })
  3031. $('.modal-time').click(function () {
  3032. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  3033. var goodsids = selected_checkboxs.map(function () {
  3034. return $(this).val()
  3035. }).get();
  3036. var begin_time=$('#batch_time input[name="setsametime[start]"]').val();
  3037. var end_time=$('#batch_time input[name="setsametime[end]"]').val();
  3038. $.post("{:U('goods/ajax_batchtime')}",{'goodsids':goodsids,'begin_time': begin_time,'end_time':end_time}, function (ret) {
  3039. if (ret.status == 1) {
  3040. $('#batch_time').hide();
  3041. layer.msg('设置成功');
  3042. window.location.reload();
  3043. return
  3044. } else {
  3045. layer.msg('设置失败');
  3046. }
  3047. }, 'json');
  3048. })
  3049. $(document).on("click", '[data-toggle="ajaxEdit"]', function(e) {
  3050. var obj = $(this),
  3051. url = obj.data('href') || obj.attr('href'),
  3052. data = obj.data('set') || {},
  3053. html = $.trim(obj.text()),
  3054. required = obj.data('required') || true,
  3055. edit = obj.data('edit') || 'input';
  3056. var oldval = $.trim($(this).text());
  3057. e.preventDefault();
  3058. submit = function() {
  3059. e.preventDefault();
  3060. var val = $.trim(input.val());
  3061. if (required) {
  3062. if (val == '') {
  3063. layer.msg(tip.lang.empty);
  3064. return
  3065. }
  3066. }
  3067. if (val == html) {
  3068. input.remove(), obj.html(val).show();
  3069. return
  3070. }
  3071. if (url) {
  3072. $.post(url, {
  3073. value: val
  3074. }, function(ret) {
  3075. ret = eval("(" + ret + ")");
  3076. if (ret.status == 1) {
  3077. obj.html(val).show()
  3078. } else {
  3079. layer.msg(ret.result.message, ret.result.url)
  3080. }
  3081. input.remove()
  3082. }).fail(function() {
  3083. input.remove(), layer.msg(tip.lang.exception)
  3084. })
  3085. } else {
  3086. input.remove();
  3087. obj.html(val).show()
  3088. }
  3089. obj.trigger('valueChange', [val, oldval])
  3090. }, obj.hide().html('<i class="fa fa-spinner fa-spin"></i>');
  3091. var input = $('<input type="text" class="form-control input-sm" style="width: 80%;display: inline;" />');
  3092. if (edit == 'textarea') {
  3093. input = $('<textarea type="text" class="form-control" style="resize:none" rows=3 ></textarea>')
  3094. }
  3095. obj.after(input);
  3096. input.val(html).select().blur(function() {
  3097. submit(input)
  3098. }).keypress(function(e) {
  3099. if (e.which == 13) {
  3100. submit(input)
  3101. }
  3102. })
  3103. })
  3104. </script>
  3105. </body>