58c25f822b10e189075bc1744720d94a.php 139 KB

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