1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
- <title><?php echo $shoname; ?></title>
- <link rel="shortcut icon" href="" />
-
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
-
- <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
- <!--[if lt IE 9]>
- <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
- <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
- <![endif]-->
- <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
- <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
- <script type="text/javascript">
- window.sysinfo = {
- <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
-
- <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
-
- <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
-
- <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
-
- 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
-
- 'siteroot': '{$_W['siteroot']}',
- 'siteurl': '{$_W['siteurl']}',
- 'attachurl': '{$_W['attachurl']}',
- 'attachurl_local': '{$_W['attachurl_local']}',
- 'attachurl_remote': '{$_W['attachurl_remote']}',
- 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
- 'cookie' : {'pre': ''},
- 'account' : {:json_encode($_W['account'])},
- };
- </script>
-
- <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
- <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
- <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
- <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
- <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
- <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
- <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
- <link href="/static/css/snailfish.css" rel="stylesheet">
-
- <script type="text/javascript" src="/static/js/dist/area/cascade.js"></script>
- <script type="text/javascript" src="/static/js/dist/select2/select2.min.js"></script>
- <link rel="stylesheet" href="/static/js/dist/select2/select2-bootstrap.css">
- <link rel="stylesheet" href="/static/js/dist/select2/select2.css">
- <script type="text/javascript" src="/web/resource/js/lib/moment.js"></script>
- <link rel="stylesheet" href="/web/resource/components/datetimepicker/jquery.datetimepicker.css">
- <link rel="stylesheet" href="/web/resource/components/daterangepicker/daterangepicker.css">
- <style type='text/css'>
- .tabs-container .layui-form-item {overflow: hidden;}
- .tabs-container .tabs-left > .nav-tabs {}
- .tab-goods .nav li {float:left;}
- .spec_item_thumb {position: relative; width: 30px; height: 20px; padding: 0; border-left: none;}
- .spec_item_thumb i {position: absolute; top: -5px; right: -5px;}
- .input-group .spec_item_thumb{padding:0px;}
-
- .multi-img-details, .multi-audio-details {margin-top:.5em;max-width: 700px; padding:0; }
- .multi-audio-details .multi-audio-item {width:155px; height: 40px; position:relative; float: left; margin-right: 5px;}
- .region-goods-details {
- background: #f8f8f8;
- margin-bottom: 10px;
- padding: 0 10px;
- }
- .region-goods-left{
- text-align: center;
- font-weight: bold;
- color: #333;
- font-size: 14px;
- padding: 20px 0;
- }
- .region-goods-right{
- border-left: 3px solid #fff;
- padding: 10px 10px;
- }
- .input-group .input-group-btn .btn:hover{background-color:#5bc0de}
- .layui-form-select{display:none;}
- .daterangepicker select.ampmselect, .daterangepicker select.hourselect, .daterangepicker select.minuteselect {
- width: auto!important;
- }
- .input-group .input-group-addon{}
- </style>
- </head>
- <body layadmin-themealias="default">
- <div class="layui-fluid">
- <div class="layui-card">
- <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text"><?php if( !empty($item['id'])){ ?>编辑<?php }else{ ?>添加<?php } ?>商品 <small><?php if( !empty($item['id'])){ ?>修改【<span class="text-info">{$item['goodsname']}</span>】<?php } ?></small></span></div>
- <div class="layui-card-body" style="padding:15px;">
- <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
-
-
- <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
- <ul class="layui-tab-title">
- <li <?php if( empty($_GPC['tab']) || $_GPC['tab']=='basic'){ ?>class="layui-this"<?php } ?>>基本信息</li>
- <li <?php if( $_GPC['tab']=='option'){ ?>class="layui-this"<?php } ?> >规格库存</li>
- <li <?php if( $_GPC['tab']=='des'){ ?>class="layui-this"<?php } ?> >商品详情</li>
-
-
- </ul>
- <div class="layui-tab-content" >
-
- <div class="layui-tab-item <?php if( empty($_GPC['tab']) || $_GPC['tab']=='basic'){ ?>layui-show<?php } ?>" >
- <!---- 基本信息begin --->
- <div class="region-goods-details layui-row">
-
- <div class="layui-form-item">
- <div class="layui-form-item" style="padding-top:10px;">
- <label class="layui-form-label must">商品名称</label>
-
- <div class="layui-input-block" style="padding-right:0;" >
- <input type="text" name="goodsname" id="goodsname" class="form-control" value="{$item['goodsname']}" data-rule-required="true" />
- </div>
-
- </div>
- <div class="layui-form-item" style="display:none;">
- <label class="layui-form-label">商品分类</label>
- <div class="layui-input-block">
- <select id="cates" multiple="multiple" name='cates[]' class="form-control select2" >
- <?php foreach( $category as $c ){ ?>
- <option value="{$c['id']}" <?php if( is_array($item['cates']) && in_array($c['id'],$item['cates'])){ ?>selected<?php } ?> >{$c['name']}</option>
- <?php } ?>
- </select>
-
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">商品简介</label>
- <div class="layui-input-block">
- <textarea name="subtitle" id="subtitle" rows="5" class="form-control" data-parent=".subtitle" maxlength="100" data-rule-maxlength="100">{$item['subtitle']}</textarea>
- <div class="layui-form-mid layui-word-aux">副标题的长度请控制在100字以内</div>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label must">商品视频</label>
- <div class="layui-input-block gimgs">
- {:tpl_form_field_video('video',$item['video'] );}
- <span class="layui-form-mid layui-word-aux image-block">
- 请输入视频源地址或者选择上传视频
- </span>
- </div>
- </div>
-
- <div class="layui-form-item">
- <label class="layui-form-label must">首页商品(大图)</label>
- <div class="layui-input-block gimgs">
- {:tpl_form_field_image2('big_img',$item['big_img'])}
- <span class="layui-form-mid layui-word-aux image-block">此图为首页商品大图模式封面图,最佳尺寸:710*400</span>
- </div>
- </div>
-
- <div class="layui-form-item">
- <label class="layui-form-label must">商品图片<label style="color:red;font-size:16px;font-weight:900">*</label></label>
- <div class="layui-input-block gimgs" id="gimgs_mult">
- {:tpl_form_field_multi_image3('thumbs',$item['piclist'])}
-
- <span class="layui-form-mid layui-word-aux image-block">第一张为缩略图,建议为正方型图片,其他为详情页面图片,尺寸建议宽度为640,并保持图片大小一致,可拖拽改变图片顺序</span>
-
- </div>
- </div>
-
-
- <div class="layui-form-item">
- <label class="layui-form-label">分享标题</label>
- <div class="layui-input-block">
- <input type="text" name="share_title" class="form-control" value="{$item['share_title']}" />
- <div class="layui-form-mid layui-word-aux"></div>
- </div>
- </div>
-
- <div class="layui-form-item">
- <label class="layui-form-label ">分享图片</label>
- <div class="layui-input-block gimgs">
- {:tpl_form_field_image2('goods_share_image',$item['goods_share_image'])}
- <span class="layui-form-mid layui-word-aux image-block">此图为商品详情页分享图片(比例为长宽比5:4)</span>
- </div>
- </div>
-
- <div class="layui-form-item">
- <label class="layui-form-label">商品状态</label>
- <div class="layui-input-block">
- <label class="radio-inline"><input type="radio" name="grounding" value="1" <?php if( !isset($item['grounding']) || $item['grounding'] == 1){ ?>checked="true"<?php } ?> title="上架" /> </label>
- <label class="radio-inline"><input type="radio" name="grounding" value="0" <?php if( isset($item['grounding']) && $item['grounding'] == 0){ ?>checked="true"<?php } ?> title="下架" /> </label>
- </div>
- </div>
-
- <div class="layui-form-item" style="display:none;">
- <label class="layui-form-label">首页推荐</label>
- <div class="layui-input-block">
- <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>
- <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>
- </div>
- </div>
-
-
- <div class="layui-form-item price" >
- <label class="layui-form-label">兑换积分<label style="color:red;font-size:16px;font-weight:900">*</label></label>
- <div class="layui-input-block">
-
- <div class="input-group">
-
-
- <input type="text" name="price" id="price" class="form-control" value="{$item['price']}" <?php if( $item['hasoption']!=1 ){ ?>lay-verify="required"<?php } ?> placeholder=""/>
- <span class="input-group-addon">分 </span>
- <span class="input-group-addon">原价(市场价、划线价)</span>
- <input type="text" name="productprice" id="productprice" class="form-control" value="{$item['productprice']}" <?php if( $item['hasoption']!=1 ){ ?>lay-verify="required"<?php } ?> placeholder=""/>
- <span class="input-group-addon">元 </span>
- <span class="input-group-addon">成本价</span>
- <input type="text" name="costprice" id="costpriceprice" class="form-control" value="{$item['costprice']}" placeholder=""/>
- <span class="input-group-addon">元 </span>
- </div>
- <span class='layui-form-mid layui-word-aux'>如未启用商品规格,请填写商品价格</span>
-
- </div>
- </div>
-
-
-
- <?php if($is_vir_count){ ?>
- <div class="layui-form-item" >
- <label class="layui-form-label">已兑换数</label>
- <div class="layui-input-block">
- <div class="input-group">
- <input type="text" name="sales" id="sales" class="form-control" value="{$item['sales']}" />
- <span class="input-group-addon">备注:前台销量=虚拟销量+实际销量</span>
- </div>
- </div>
- </div>
- <?php } ?>
-
-
-
-
- <input type="hidden" name="is_only_express" value="1" />
-
-
-
- <div class="layui-form-item dispatch_info">
- <label class="layui-form-label">运费设置</label>
- <div class="layui-input-block" style='padding-left:0'>
-
- <div class="input-group">
- <span class='input-group-addon' style='border:none;padding:0px;'><label class="radio-inline" style='margin-top:-7px;' ><input type="radio" name="dispatchtype" value="0" <?php if( empty($item['dispatchtype'])){ ?>checked="true"<?php } ?> title="运费模板" /> </label></span>
- <select class="form-control tpl-category-parent select2" id="dispatchid" name="dispatchid">
-
- <?php foreach( $dispatch_data as $dispatch_item ){ ?>
- <option value="{$dispatch_item['id']}" <?php if( $item['dispatchid'] == $dispatch_item['id']){ ?>selected="true"<?php } ?>>{$dispatch_item['name']}</option>
- <?php } ?>
- </select>
- </div>
-
- </div>
- </div>
- <div class="layui-form-item dispatch_info">
- <label class="layui-form-label"></label>
- <div class="layui-input-block" style='padding-left:0'>
- <div class="input-group">
- <span class='input-group-addon' style='border:none;padding:0px;'><label class="radio-inline" style='margin-top:-7px;' >
- <input type="radio"name="dispatchtype" value="1" <?php if( $item['dispatchtype'] == 1){ ?>checked="true"<?php } ?> title="统一邮费" /> </label></span>
- <input type="text" name="dispatchprice" id="dispatchprice" class="form-control" value="{$item['dispatchprice']}" />
- <span class="input-group-addon">元</span>
- </div>
- </div>
- </div>
-
-
-
-
- <div class="layui-form-item" style="display:none;">
- <label class="layui-form-label">下单送积分</label>
- <div class="col-sm-10 col-xs-12" id="send_score_div">
-
- <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" />
-
- <input class="form-control " id="send_score_divTip" name="send_socre" style="vertical-align: sub; <?php if(isset($item['is_modify_sendscore']) && $item['is_modify_sendscore'] ==1){ ?>display:inline;<?php }else{ ?>display: none;<?php } ?>width: 120px;" type="text" value="{$item['send_socre']}">
-
- <div style="clear:both;"></div>
- <span class="layui-form-mid layui-word-aux">赠送数量 = 商品数量 * 下单送积分数量(未开启,则使用系统全局设置)</span>
- </div>
- </div>
-
-
- <?php if($index_sort_method == 1){ ?>
- <div class="layui-form-item" >
- <label class="layui-form-label">首页排序</label>
- <div class="layui-input-block">
- <div class="input-group">
- <input type="text" name="index_sort" id="index_sort" class="form-control" value="{$item['index_sort']}" />
- <span class="input-group-addon">备注:排序越大显示越靠前</span>
- </div>
- </div>
- </div>
- <?php } ?>
-
- </div>
-
-
- </div>
- <div class="region-goods-details ">
-
- <div class="layui-form-item">
- <div class="layui-form-item">
- <label class="layui-form-label">兑换时间</label>
- <div class="layui-input-block">
- {: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);}
- </div>
- </div>
-
- </div>
- </div>
- <div class="region-goods-details ">
- <div class="layui-form-item">
-
- <div class="layui-form-item">
- <label class="layui-form-label">单次兑换</label>
- <div class="layui-input-block">
-
- <input type="text" name="one_limit_count" class="form-control " value="{$item['one_limit_count']}" />
-
- <div class="layui-form-mid layui-word-aux">用户单次提交订单最多可兑换数,默认为0表示不限制</div>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">历史兑换</label>
- <div class="layui-input-block">
-
- <input type="text" name="total_limit_count" class="form-control" value="{$item['total_limit_count']}" />
-
- <div class="layui-form-mid layui-word-aux">用户历史累积最多可兑换数,默认为0表示不限制</div>
- </div>
- </div>
-
-
- </div>
- </div>
-
- <script language="javascript">
-
- $(function () {
- $('#price').blur(function(){
- var price = parseFloat( $("#price").val() );
- var community_head_commission = parseFloat( $("#community_head_commission").val() );
- if(price > 0 && community_head_commission >0)
- {
- $('#precommiss_head_money_tip').html( ( (price * community_head_commission) /100 ).toFixed(2) );
- }else{
- $('#precommiss_head_money_tip').html('0.00');
- }
- })
-
- $("#community_head_commission").blur(function(){
- var price = parseFloat( $("#price").val() );
- var community_head_commission = parseFloat( $(this).val() );
- if(price > 0 && community_head_commission >0)
- {
- $('#precommiss_head_money_tip').html( ( (price * community_head_commission) /100 ).toFixed(2) );
- }else{
- $('#precommiss_head_money_tip').html('0.00');
- }
-
- });
-
- $('#radPickupDateTip input[type=radio]').click(function(){
- var s_val = $(this).val();
- if(s_val == 3)
- {
- $('#txtPickupDateTip').css('display','inline-block');
- }else{
- $('#txtPickupDateTip').css('display', 'none');
- }
- })
- $("input[name=isstatustime]").off('click').on('click',function () {
- if($(this).val()==1){
- $("#shelves").show()
- }else{
- $("#shelves").hide();
- }
- })
- })
- </script>
- <!--- 基本信息 end -->
- </div>
- <div class="layui-tab-item <?php if( $_GPC['tab']=='option'){ ?>layui-show<?php } ?>" >
- <!--规格begin-->
-
- <div class="region-goods-details ">
- <div class="region-goods-left col-sm-2">规格库存</div>
- <div class="region-goods-right col-sm-10">
- <div class="layui-form-item">
- <label class="layui-form-label">商品编码</label>
- <div class="layui-input-block">
- <input type="text" name="codes" class="form-control" value="{$item['codes']}" />
- <div class="help-block">商品编码 用部分商家用于统计</div>
- </div>
- </div>
-
- <div class="layui-form-item">
- <label class="layui-form-label">重量</label>
- <div class="layui-input-block">
- <div class="input-group fixsingle-input-group">
- <input type="text" name="weight" id="weight" <?php if( $item['hasoption']){ ?>readonly<?php } ?> class="form-control hasoption" value="{$item['weight']}"/>
- <span class="input-group-addon">克</span>
- </div>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">库存</label>
- <div class="layui-input-block">
- <input type="text" name="total" id="total" class="form-control hasoption" value="{$item['total']}" style="width:150px;display: inline;margin-right: 20px;" <?php if( $item['hasoption']){ ?>readonly<?php } ?>/>
- <span class="help-block">商品的剩余数量, 如启用多规格,则此处设置无效.</span>
- </div>
- </div>
-
- </div>
- </div>
- <div class="region-goods-details ">
- <div class="region-goods-left col-sm-2">
- 规格
- </div>
- <div class="region-goods-right col-sm-10">
- <div class="layui-form-item">
- <div class="layui-row" style=''>
-
-
-
- <input type="checkbox" lay-skin="primary" title="启用商品规格" id="hasoption" lay-filter="hasoption" value="1" name="hasoption" <?php if( $item['hasoption']==1){ ?>checked<?php } ?> />
-
- <span class="help-block">启用商品规格后,商品的价格及库存以商品规格为准,库存设置为0则会到”已售罄“中,手机也不会显示</span>
-
- </div>
- </div>
- <div id='tboption' style="padding-left:15px;<?php if( $item['hasoption']!=1){ ?>display:none<?php } ?>" >
- <div class="alert alert-info" style="display:none;">
- 1. 拖动规格可调整规格显示顺序, 更改规格及规格项后请点击下方的【刷新规格项目表】来更新数据。<br/>
- 2. 每一种规格代表不同型号,例如颜色为一种规格,尺寸为一种规格,如果设置多规格,手机用户必须每一种规格都选择一个规格项,才能添加购物车或购买。
- </div>
- <div id='specs'>
- <?php foreach( $item['allspecs'] as $spec ){ ?>
- <!--spec-->
- <div class='spec_item spec_class_{$cur_cate_id}' id="spec_{$spec['id']}" >
- <div style='border:1px solid #e7eaec;padding:10px;margin-bottom: 10px;' >
- <input name="spec_id[]" type="hidden" class="form-control spec_id" value="{$spec['id']}"/>
- <div class="form-group">
- <div class="col-sm-12">
- <div class='input-group'>
- <input name="spec_title[{$spec['id']}]" type="text" class="form-control spec_title" value="{$spec['title']}" placeholder="规格名称 (比如: 颜色)"/>
- <div class='input-group-btn'>
- <a href="javascript:;" id="add-specitem-{$spec['id']}" specid='{$spec['id']}' class='btn btn-info add-specitem' onclick="addSpecItem('{$spec['id']}')"><i class="fa fa-plus"></i> 添加规格项</a>
- <a href="javascript:void(0);" class='btn btn-danger' onclick="removeSpec('{$spec['id']}')"><i class="fa fa-remove"></i></a>
- </div>
- </div>
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-12">
- <div id='spec_item_{$spec['id']}' class='spec_item_items'>
- <?php foreach( $spec['items'] as $specitem ){ ?>
- <!--spec_item begin-->
- <div class="spec_item_item" style="float:left;margin:5px;width:250px; position: relative">
- <input type="hidden" class="form-control spec_item_show" name="spec_item_show_{$spec['id']}[]" value="{$specitem['show']}" />
- <input type="hidden" class="form-control spec_item_id" name="spec_item_id_{$spec['id']}[]" value="{$specitem['id']}" />
-
- <div class="input-group">
- <span class="input-group-addon">
- <input type="checkbox" lay-skin="primary" <?php if( $specitem['id']>0){ ?>checked<?php } ?> value="1" onclick='showItem(this)'>
- </span>
- <input type="text" class="form-control spec_item_title" onblur="refreshOptions()" name="spec_item_title_{$spec['id']}[]" VALUE="{$specitem['title']}" />
-
- <span class="input-group-addon spec_item_thumb <?php if( !empty($specitem['thumb'])){ ?>has_thumb<?php } ?>">
- <input type='hidden' name="spec_item_thumb_{$spec['id']}[]" value="{$specitem['thumb']}"
- />
- <img onclick="selectSpecItemImage(this)"
- src="<?php if( empty($specitem['thumb'])){ ?><?php }else{ ?>{:resize($specitem['thumb'],100)}<?php } ?>" style='width:100%;'
- <?php if( !empty($specitem['thumb'])){ ?>
- data-toggle='popover'
- data-html ='true'
- data-placement='top'
- data-trigger ='hover'
- data-content="<img src='{:tomedia($specitem['thumb'])}' style='width:100px;height:100px;' />"
- <?php } ?>
- >
- <i class="fa fa-times-circle" <?php if( empty($specitem['thumb'])){ ?>style="display:none"<?php } ?>></i>
- </span>
-
- <span class="input-group-addon">
- <a href="javascript:;" onclick="removeSpecItem(this)" title='删除'><i class="fa fa-times"></i></a>
- <a href="javascript:;" class="fa fa-arrows" title="拖动调整显示顺序" ></a>
- </span>
- </div>
-
-
- </div>
- <!--spec_item end-->
- <?php } ?>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!--end spec-->
- <?php } ?>
- </div>
-
- <table class="table">
- <tr>
- <td>
- <div class="layui-form-item">
- <label class="col-sm-2 control-label">选择已有规格</label>
- <div class="col-sm-8 col-xs-12">
- <select id="cates2" name='options[]' class="form-control select2" style='width:605px;' multiple='' >
- <?php foreach( $spec_list as $c ){ ?>
- <option value="{$c['id']}" data-names="{$c['value_str']}">{$c['name']}</option>
- <?php } ?>
- </select>
-
- </div>
- </div>
- <td>
- </tr>
- <tr>
- <td>
- <h4>
- <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>
- <a style="display:none;" href="javascript:;" onclick="refreshOptions();" title="刷新规格项目表" class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新规格项目表</a>
- </h4>
- </td>
- </tr>
- <tr style="display: none;" >
- <td>
- <div class="alert alert-danger">警告:规格数据有变动,请重新点击上方 [刷新规格项目表] 按钮!</div>
- </td>
- </tr>
- </table>
-
- <div class="alert alert-info wholesalewarning" style="display:none;">
-
- </div>
- <div id="options" style="padding:0;">{$item['html']}</div>
- </div>
-
- </div>
- </div>
- <input type="hidden" name="optionArray" value=''>
- <input type="hidden" name="isdiscountDiscountsArray" value=''>
- <input type="hidden" name="discountArray" value=''>
- <input type="hidden" name="commissionArray" value=''>
-
- <!--规格end-->
- </div>
-
-
- <div class="layui-tab-item <?php if( $_GPC['tab']=='des'){ ?>layui-show<?php } ?>" >
- <div class="region-goods-details row">
- <div class="region-goods-left col-sm-2">商品详情</div>
- <div class=" region-goods-right col-sm-10">
- <div class="" >
-
- {:tpl_ueditor('content',htmlspecialchars_decode($item['content']),array('height'=>'300'))}
-
- </div>
- </div>
- </div>
- </div>
-
-
-
- <script>
- $(function(){
- $(".select2").select2({
- placeholder:'请选择',
- allowClear:true
- })
- })
- </script>
- <div class="layui-form-item">
- <label class="layui-form-label"> </label>
- <div class="layui-input-block">
- <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
-
- <a class="btn btn-default" style='margin-left:10px;' href="{:U('goods/index' , array( 'ok' => 1))}">返回列表</a>
-
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- <script src="/layuiadmin/layui/layui.js"></script>
- <script type="text/javascript" src="/static/js/jquery-migrate-1.1.1.js"></script>
- <script src="/static/js/jquery-ui.min.js"></script>
- <style>
- .multi-img-details{width:100%;}
- </style>
- <script>
- layui.config({
- base: '/layuiadmin/' //静态资源所在路径
- }).extend({
- index: 'lib/index' //主入口模块
- }).use('index');
- </script>
- <script>
- //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
- var layer = layui.layer;
- var $;
- var cur_open_div;
- var form;
- layui.use(['jquery', 'layer','form'], function(){
- $ = layui.$;
- form = layui.form;
-
- console.log(22);
-
- form.on('radio(linktype)', function(data){
- if (data.value == 2) {
- $('#typeGroup').show();
- } else {
- $('#typeGroup').hide();
- }
- });
-
-
- form.on('checkbox(commissTuan)', function(data){
- if (data.elem.checked) {
-
- $("#zero_opentuan_div").css('display','inline');
- $("#newman_div").css('display','inline');
- $("#commiss_money_div").css('display','inline');
- } else {
- $("#zero_opentuan_div").hide();
- $("#newman_div").hide();
- $("#commiss_money_div").hide();
- }
- form.render('checkbox');
- });
-
-
-
- form.on('checkbox(is_modify_sendscore)', function(data){
- console.log(data.elem.checked)
- if (data.elem.checked) {
- console.log(12);
- $("#send_score_divTip").css('display','inline');
- } else {
- console.log(33);
- $("#send_score_divTip").hide();
- }
- form.render('checkbox');
- });
-
- form.on('checkbox(xinrenckbox)', function(data){
- if (data.elem.checked) {
- $("#xianshickbox").removeAttr("checked");
- } else {
-
- }
- form.render('checkbox');
- });
-
- form.on('checkbox(xianshickbox)', function(data){
- if (data.elem.checked) {
- $("#xinrenckbox").removeAttr("checked");
- } else {
-
- }
- form.render('checkbox');
- });
-
- form.on('checkbox(hascommission)', function(data){
-
- if (data.elem.checked) {
- $('#commission_div').show();
- } else {
- $('#commission_div').hide();
- }
- })
- //hascommission
-
-
- $('#chose_label_id').click(function(){
- cur_open_div = $(this).attr('data-input');
- $.post("{:U('goods/labelquery', array('ok' => 1))}", {}, function(shtml){
- layer.open({
- type: 1,
- area: '930px',
- content: shtml //注意,如果str是object,那么需要字符拼接。
- });
- });
- })
-
- $('#chose_member_id').click(function(){
- cur_open_div = $(this).attr('data-input');
- $.post("{:U('supply/zhenquery', array('ok' => 1))}", {}, function(shtml){
- layer.open({
- type: 1,
- area: '930px',
- content: shtml //注意,如果str是object,那么需要字符拼接。
- });
- });
- })
- $('#chose_agent_id').click(function(){
- cur_open_div = $(this).attr('data-input');
- $.post("{:U('communityhead/query_head_user', array('ok' => 1))}", {}, function(shtml){
- layer.open({
- type: 1,
- area: '930px',
- content: shtml //注意,如果str是object,那么需要字符拼接。
- });
- });
- })
- $('#chose_link').click(function(){
- cur_open_div = $(this).attr('data-input');
- $.post("{:U('util.selecturl', array('ok' => 1))}", {}, function(shtml){
- layer.open({
- type: 1,
- area: '930px',
- content: shtml //注意,如果str是object,那么需要字符拼接。
- });
- });
- })
-
- $('.layui-tab-title li').click(function(){
- form.render('radio');
- form.render('checkbox');
- })
-
-
- //监听提交
- form.on('submit(formDemo)', function(data){
- var loadingIndex = layer.load();
- var goodsname = $.trim($('#goodsname').val());
- if(goodsname == ''){
- layer.msg('商品名称必须填写',{icon: 1,time: 2000});
- $('#goodsname').focus();
- layer.close(loadingIndex);
- return false;
- }
- var price = $.trim($('#price').val());
- if(price == ''){
- layer.msg('兑换积分必须填写',{icon: 1,time: 2000});
- $('#price').focus();
- layer.close(loadingIndex);
- return false;
- }
- if($('#hasoption').get(0).checked == false){
- console.log(222);
- var total =$('#total').val();
- if(total == ''){
- layer.msg('库存必须填写',{icon: 1,time: 2000});
- $('#total').focus();
- layer.close(loadingIndex);
- return false;
- }
- };
- console.log('你看到我了吗');
- var s_cates = $('#cates').val();
- var cate_mult = [];
- for(var i in s_cates)
- {
- cate_mult.push(s_cates[i]);
- }
- data.field.cate_mult = cate_mult;
- <?php if( !empty($is_open_goods_relative_goods) && $is_open_goods_relative_goods == 1 ){ ?>
- var gd_ar = [];
- var gd_str = '';
- $('.mult_choose_goodsid').each(function(){
- gd_ar.push( $(this).attr('data-gid') );
- })
- gd_str = gd_ar.join(',');
-
- data.field.limit_goods_list = gd_str;
- <?php } ?>
- var is_mult_option = $('input[name=hasoption]').is(':checked');
-
- if( is_mult_option )
- {
- var t_val;
- var is_pos = false;
- var s_total = 0;
-
-
- $('.option_stock').each(function(){
- t_val = $(this).val();
- if(!(/(^[1-9]\d*$)/.test(t_val)) && t_val != 0){
- layer.msg('多规格商品库存输入错误,请输入正确的数字!',{icon:2});
- $(this).focus();
- $(this).css('border','red 2px solid');
- layer.close(loadingIndex);
- is_break = true;
- return false;
- }
- if( t_val == '' )
- {
- is_pos = true;
- }
-
- s_total += parseInt( t_val );
- })
- if(is_pos)
- {
- layer.msg('多规格商品库存未填写',{icon:2});
- $(this).focus();
- $(this).css('border','red 2px solid');
- layer.close(loadingIndex);
- is_break = true;
- return false;
- }
-
- var t_val2;
- var is_pos2 = false;
- $('.option_marketprice').each(function(){
- t_val2 = $(this).val();
- if( t_val2 == '' )
- {
- is_pos2 = true;
- }
- })
-
- if(is_pos2)
- {
- layer.msg('多规格兑换积分未填写',{icon:2});
- $(this).focus();
- $(this).css('border','red 2px solid');
- layer.close(loadingIndex);
- is_break = true;
- return false;
- }
-
- if( s_total > 100000 || s_total< 0 )
- {
- layer.msg('商品库存值的取值范围是1~100000',{icon:2});
- $(this).focus();
- $(this).css('border','red 2px solid');
- layer.close(loadingIndex);
- is_break = true;
- return false;
- }
- if(!(/(^[1-9]\d*$)/.test(s_total)) && s_total != 0){
- layer.msg('多规格商品库存输入错误,请输入正确的数字!',{icon:2});
- layer.close(loadingIndex);
- return false;
- }
- }else{
- var g_total = $('#total').val();
-
- if( g_total > 100000 || g_total< 0 )
- {
- layer.msg('商品库存值的取值范围是1~100000',{icon:2});
- layer.close(loadingIndex);
- return false;
- }
- if(!(/(^[1-9]\d*$)/.test(g_total)) && g_total != 0){
- layer.msg('商品库存输入错误,请输入正确的数字!',{icon:2});
- layer.close(loadingIndex);
- return false;
- }
-
- }
-
- $.ajax({
- url: data.form.action,
- type: data.form.method,
- data: data.field,
- dataType:'json',
- success: function (info) {
-
- if(info.status == 0)
- {
- layer.msg(info.result.message,{icon: 1,time: 2000});
- layer.close(loadingIndex);
- }else if(info.status == 1){
- var go_url = location.href;
- if( info.result.hasOwnProperty("url") )
- {
- go_url = info.result.url;
- }
-
- layer.msg('操作成功',{time: 1000,
- end:function(){
- location.href = info.result.url;
- }
- });
- }
- }
- });
-
- return false;
- });
-
-
- form.on('checkbox(hasoption)', function(data){
-
- if(data.elem.checked)
- {
- $('#goodssn').attr('readonly',true);
- $('#productsn').attr('readonly',true);
- $('#weight').attr('readonly',true);
- $('#total').attr('readonly',true);
- $("#tboption").show();
- $("#tbdiscount").show();
- $("#isdiscount_discounts").show();
- $("#isdiscount_discounts_default").hide();
- $("#commission").show();
- $("#commission_default").hide();
- $("#discounts_type1").show().parent().show();
- refreshOptions();
- }else{
- $('#weight').removeAttr('readonly');
- $('#total').removeAttr('readonly');
- $("#tboption").hide();
- refreshOptions();
- $("#isdiscount_discounts").hide();
- var isdiscount_discounts = $("#isdiscount_discounts").html();
- $("#isdiscount_discounts").html('');
-
- $("#isdiscount_discounts").html(isdiscount_discounts);
-
- $("#tbdiscount").hide();
- $("#isdiscount_discounts_default").show();
- $("#commission_default").show();
- $('#goodssn').removeAttr('readonly');
- $('#productsn').removeAttr('readonly');
- $("#discounts_type1").hide().parent().hide();
- $("#discounts_type0").click();
- $(this).prop("checked", false);
- }
-
- form.render('checkbox');
- });
-
- $('#chose_agent_id2').click(function(){
- cur_open_div = $(this).attr('data-input');
- $.post("{:U('goods/query_normal', array('template' => 'mult', 'unselect_goodsid' => $id))}", {}, function(shtml){
- layer.open({
- type: 1,
- area: '930px',
- content: shtml //注意,如果str是object,那么需要字符拼接。
- });
- });
- })
-
-
- form.on('checkbox(is_modify_head_commission)', function(data){
-
- if(data.elem.checked)
- {
- $("#head_commission_div").show();
- }else{
- $("#head_commission_div").hide();
- }
-
- form.render('checkbox');
- });
-
- })
- function cancle_bind(obj,sdiv)
- {
- $('#'+sdiv).val('');
- $(obj).parent().parent().remove();
- }
- </script>
- <script>
- $(function () {
- // 拖拽时开始滚动的间距
- var scrollingSensitivity = 20
- // 拖拽时滚动速度
- let scrollingSpeed = 20
- // 拖拽前的父级节点
- let dragBeforeParentNode = null
- // 初始化拖拽函数
- $('.multi-img-details').sortable({
- // 自适应placeholder的大小
- forceHelperSize: true,
- // 拖拽时的鼠标形状
- cursor: '-webkit-grabbing',
- // 拖拽的父级节点(该节点一定要注意,配置错误会导致当前屏幕外的元素没法自动滚动拖拽,两列之间拖拽的滚动也会出问题)
- appendTo: '.layui-form-item',
- // 拖拽时的倾斜度
- rotate: '5deg',
- // 延迟时间(毫秒),避免和click同时操作时出现的冲突
- delay: 0,
- // 以clone方式拖拽
- helper: 'clone',
- // 拖拽到边框出现滚动的间距,
- scrollSensitivity: scrollingSensitivity,
- // 应用于拖拽空白区域的样式
- placeholder: 'portlet-placeholder ui-state-highlight',
- // 允许拖拽预留空白区域
- forcePlaceholderSize: false,
- // 多个列表之间的拖拽的dom元素
- connectWith: '.multi-img-details',
- // 鼠标到区域则填充
- tolerance: "pointer",
- // 可以拖拽的项
- items: '.multi-item',
- // 填充动画
- revert: 0,
- // 拖拽结束函数
- stop: (e, ui) => {
- // 当前拽入的元素
- let item = $(ui.item)
- // 当前拽入元素的下标
- let index = item.index()
- let kid = ''
- // xxxx 这里面可以操作数据更新
- },
- // 开始拖拽时的函数
- start: (e, ui) => {
- // 拖拽前的父级节点
- dragBeforeParentNode = ui.item[0].parentNode
- // 让placeholder和源高度一致
- ui.helper.addClass('item').width(110)
- // xxxx 这里可以记录一些拖拽前的元素属性
- },
- // 处理两列滚动条问题
- sort: function (event, ui) {
- var scrollContainer = ui.placeholder[0].parentNode
- // 设置拽入的列表的滚动位置
- var overflowOffset = $(scrollContainer).offset()
- if ((overflowOffset.top + scrollContainer.offsetHeight) - event.pageY <
- scrollingSensitivity) {
- scrollContainer.scrollTop = scrollContainer.scrollTop + scrollingSpeed
- } else if (event.pageY - overflowOffset.top < scrollingSensitivity) {
- scrollContainer.scrollTop = scrollContainer.scrollTop - scrollingSpeed
- }
- }
- }).disableSelection()
- })
- </script>
- <script language="javascript">
- var chose_cate = -1;
- var chose_cate_id_arr = [];
- $(function(){
-
- $('#cates2').on('change',function(){
- var s_length = $("#cates2 option:selected").length -1;
- var options_name = $("#cates2 option:selected:eq("+s_length+")").text();
- var options_str = $("#cates2 option:selected:eq("+s_length+")").attr('data-names');
-
- if(s_length > chose_cate)
- {
- chose_cate++;
- var cur_cate_id = '';
- $("#cates2 option:selected").each(function(){
- var tmp_cate_id = parseInt($(this).val());
- if( $.inArray( tmp_cate_id, chose_cate_id_arr ) == -1)
- {
- chose_cate_id_arr.push( parseInt(tmp_cate_id) );
- cur_cate_id = tmp_cate_id;
- }
- })
- addSpecList(options_name,options_str,cur_cate_id);
- }else{
- chose_cate--;
- var new_chose_cate_id_arr = [];
- if(chose_cate_id_arr.length == 1)
- {
- $('.spec_class_'+chose_cate_id_arr[0]).remove();
- }
-
- $("#cates2 option:selected").each(function(){
- var tmp_cate_id = parseInt( $(this).val() );
- if( $.inArray( tmp_cate_id, chose_cate_id_arr ) != -1)
- {
- new_chose_cate_id_arr.push( parseInt(tmp_cate_id) );
- chose_cate_id_arr.splice($.inArray( tmp_cate_id, chose_cate_id_arr ), 1);
- }
- })
- if(chose_cate_id_arr.length == 1)
- {
- $('.spec_class_'+chose_cate_id_arr[0]).remove();
- }
-
- chose_cate_id_arr = new_chose_cate_id_arr;
- refreshOptions();
- }
-
-
- })
- $(document).on('input propertychange change', '#specs input', function () {
-
- window.optionchanged = true;
- $('#optiontip').show();
- });
-
- $(document).on('input propertychange change', '#specs input', function () {
-
- window.optionchanged = true;
- $('#optiontip').show();
- });
- $(".spec_item_thumb").find('i').click(function(){
- var group =$(this).parent();
- group.find('img').attr('src',"{SNAILFISH_LOCAL}static/images/nopic100.jpg");
- group.find(':hidden').val('');
- $(this).hide();
- group.find('img').popover('destroy');
- });
-
-
-
- });
- function selectSpecItemImage(obj){
- util.image('',function(val){
- $(obj).attr('src',val.url).popover({
- trigger: 'hover',
- html: true,
- container: $(document.body),
- content: "<img src='" + val.url + "' style='width:100px;height:100px;' />",
- placement: 'top'
- });
- var group =$(obj).parent();
- group.find(':hidden').val(val.attachment), group.find('i').show().unbind('click').click(function(){
- $(obj).attr('src',"{SNAILFISH_LOCAL}static/images/nopic100.jpg");
- group.find(':hidden').val('');
- group.find('i').hide();
- $(obj).popover('destroy');
- });
- });
- }
- function addSpecList(options_name,spec_str, cur_cate_id)
- {
-
- var len = $(".spec_item").length;
- $("#add-spec").html("正在处理...").attr("disabled", "true").toggleClass("btn-primary");
- var url = "{:U('goods/mult_tpl',array('tpl'=>'spec'))}";
- $.ajax({
- "url": url,
- type:'post',
- data:{options_name:options_name,spec_str:spec_str,cur_cate_id:cur_cate_id},
- success:function(data){
- $("#add-spec").html('<i class="fa fa-plus"></i> 新增规格').removeAttr("disabled").toggleClass("btn-primary"); ;
- $('#specs').append(data);
- var len = $(".add-specitem").length -1;
- $(".add-specitem:eq(" +len+ ")").focus();
- refreshOptions();
- }
- });
- }
-
- function addSpec(){
- var len = $(".spec_item").length;
- $("#add-spec").html("正在处理...").attr("disabled", "true").toggleClass("btn-primary");
- var url = "{:U('goods/tpl',array('tpl'=>'spec'))}";
- $.ajax({
- "url": url,
- success:function(data){
- $("#add-spec").html('<i class="fa fa-plus"></i> 新增规格').removeAttr("disabled").toggleClass("btn-primary"); ;
- $('#specs').append(data);
- var len = $(".add-specitem").length -1;
- $(".add-specitem:eq(" +len+ ")").focus();
- refreshOptions();
- }
- });
- }
- function removeSpec(specid){
- if (confirm('确认要删除此规格?')){
- $("#spec_" + specid).remove();
- refreshOptions();
- }
- }
- function addSpecItem(specid){
- $("#add-specitem-" + specid).html("正在处理...").attr("disabled", "true");
- var url = "{:U('goods/tpl',array('tpl'=>'specitem'))}" + "&specid=" + specid;
- $.ajax({
- "url": url,
- success:function(data){
- $("#add-specitem-" + specid).html('<i class="fa fa-plus"></i> 添加规格项').removeAttr("disabled");
- $('#spec_item_' + specid).append(data);
- var len = $("#spec_" + specid + " .spec_item_title").length -1;
- $("#spec_" + specid + " .spec_item_title:eq(" +len+ ")").focus();
- refreshOptions
- if(type==3 && virtual==0){
- $(".choosetemp").show();
- }
- }
- });
- }
- function removeSpecItem(obj){
- $(obj).closest('.spec_item_item').remove();
- refreshOptions();
- }
- function refreshOptions(){
- // 刷新后重置
- window.optionchanged = false;
- $('#optiontip').hide();
- var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
- var specs = [];
- if($('.spec_item').length<=0){
- $("#options").html('');
- $("#discount").html('');
- $("#isdiscount_discounts").html('');
- $("#commission").html('');
-
- return;
- }
- $(".spec_item").each(function(i){
- var _this = $(this);
- var spec = {
- id: _this.find(".spec_id").val(),
- title: _this.find(".spec_title").val()
- };
- var items = [];
- _this.find(".spec_item_item").each(function(){
- var __this = $(this);
- var item = {
- id: __this.find(".spec_item_id").val(),
- title: __this.find(".spec_item_title").val(),
- virtual: __this.find(".spec_item_virtual").val(),
- show:__this.find(".spec_item_show").get(0).checked?"1":"0"
- }
- items.push(item);
- });
- spec.items = items;
- specs.push(spec);
- });
- specs.sort(function(x,y){
- if (x.items.length > y.items.length){
- return 1;
- }
- if (x.items.length < y.items.length) {
- return -1;
- }
- });
- var len = specs.length;
- var newlen = 1;
- var h = new Array(len);
- var rowspans = new Array(len);
- for(var i=0;i<len;i++){
- html+="<th>" + specs[i].title + "</th>";
- var itemlen = specs[i].items.length;
- if(itemlen<=0) { itemlen = 1 };
- newlen*=itemlen;
- h[i] = new Array(newlen);
- for(var j=0;j<newlen;j++){
- h[i][j] = new Array();
- }
- var l = specs[i].items.length;
- rowspans[i] = 1;
- for(j=i+1;j<len;j++){
- rowspans[i]*= specs[j].items.length;
- }
- }
- html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">库存</div><div class="input-group"><input type="text" class="form-control input-sm option_stock_all" VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_stock\');"></a></span></div></div></th>';
-
- html += '<th class="type-4"><div class=""><div style="padding-bottom:10px;text-align:center;">兑换积分</div><div class="input-group"><input type="text" class="form-control input-sm option_marketprice_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_marketprice\');"></a></span></div></div></th>';
-
- html+='<th class="type-4"><div class=""><div style="padding-bottom:10px;text-align:center;">原价</div><div class="input-group"><input type="text" class="form-control input-sm option_productprice_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'option_productprice\');"></a></span></div></div></th>';
- 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>';
- 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>';
-
- 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>';
- html+='</tr></thead>';
- for(var m=0;m<len;m++){
- var k = 0,kid = 0,n=0;
- for(var j=0;j<newlen;j++){
- var rowspan = rowspans[m];
- if( j % rowspan==0){
- 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};
- }
- else{
-
- h[m][j]={title:specs[m].items[kid].title,virtual: specs[m].items[kid].virtual, html: "",id: specs[m].items[kid].id};
- }
- n++;
- if(n==rowspan){
- kid++; if(kid>specs[m].items.length-1) { kid=0; }
- n=0;
- }
- }
- }
- var hh = "";
- for(var i=0;i<newlen;i++){
- hh+="<tr>";
- var ids = [];
- var titles = [];
- var virtuals = [];
- for(var j=0;j<len;j++){
- hh+=h[j][i].html;
- ids.push( h[j][i].id);
- titles.push( h[j][i].title);
- virtuals.push( h[j][i].virtual);
- }
- ids =ids.join('_');
- titles= titles.join('+');
- var val ={ id : "",title:titles, stock : "",presell : "",costprice : "",productprice : "",marketprice : "",weight:"",productsn:"",goodssn:"",virtual:virtuals };
- if( $(".option_id_" + ids).length>0){
- val ={
- id : $(".option_id_" + ids+":eq(0)").val(),
- title: titles,
- stock : $(".option_stock_" + ids+":eq(0)").val(),
- presell : $(".option_presell_" + ids+":eq(0)").val(),
- costprice : $(".option_costprice_" + ids+":eq(0)").val(),
- productprice : $(".option_productprice_" + ids+":eq(0)").val(),
- marketprice : $(".option_marketprice_" + ids +":eq(0)").val(),
- goodssn : $(".option_goodssn_" + ids +":eq(0)").val(),
- productsn : $(".option_productsn_" + ids +":eq(0)").val(),
- weight : $(".option_weight_" + ids+":eq(0)").val(),
- virtual : virtuals
- }
- }
- hh += '<td>'
-
- hh += '<input name="option_stock_' + ids +'" type="text" class="form-control option_stock option_stock_' + ids +'" value="' +(val.stock=='undefined'?'':val.stock )+'"/></td>';
-
- hh += '<input name="option_id_' + ids+'" type="hidden" class="form-control option_id option_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
- hh += '<input name="option_ids[]" type="hidden" class="form-control option_ids option_ids_' + ids +'" value="' + ids +'"/>';
- hh += '<input name="option_title_' + ids +'" type="hidden" class="form-control option_title option_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
- hh += '<input name="option_virtual_' + ids +'" type="hidden" class="form-control option_virtual option_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
- hh += '</td>';
- 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>';
- 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>';
- 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>';
- hh += '<td><input name="option_goodssn_' +ids+'" type="text" class="form-control option_goodssn option_goodssn_' + ids +'" " value="' +(val.goodssn=='undefined'?'':val.goodssn )+'"/></td>';
- //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>';
- hh += '<td><input name="option_weight_' + ids +'" type="text" class="form-control option_weight option_weight_' + ids +'" " value="' +(val.weight=='undefined'?'':val.weight )+'"/></td>';
- hh += "</tr>";
- }
- html+=hh;
- html+="</table>";
- $("#options").html(html);
- refreshDiscount();
- refreshIsDiscount();
-
- if(window.type=='4'){
- $('.type-4').hide();
- }else{
- $('.type-4').show();
- }
- }
- function refreshDiscount() {
- var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
- var specs = [];
- $(".spec_item").each(function (i) {
- var _this = $(this);
- var spec = {
- id: _this.find(".spec_id").val(),
- title: _this.find(".spec_title").val()
- };
- var items = [];
- _this.find(".spec_item_item").each(function () {
- var __this = $(this);
- var item = {
- id: __this.find(".spec_item_id").val(),
- title: __this.find(".spec_item_title").val(),
- virtual: __this.find(".spec_item_virtual").val(),
- show: __this.find(".spec_item_show").get(0).checked ? "1" : "0"
- }
- items.push(item);
- });
- spec.items = items;
- specs.push(spec);
- });
- specs.sort(function (x, y) {
- if (x.items.length > y.items.length) {
- return 1;
- }
- if (x.items.length < y.items.length) {
- return -1;
- }
- });
- var len = specs.length;
- var newlen = 1;
- var h = new Array(len);
- var rowspans = new Array(len);
- for (var i = 0; i < len; i++) {
- html += "<th>" + specs[i].title + "</th>";
- var itemlen = specs[i].items.length;
- if (itemlen <= 0) {
- itemlen = 1
- }
- ;
- newlen *= itemlen;
- h[i] = new Array(newlen);
- for (var j = 0; j < newlen; j++) {
- h[i][j] = new Array();
- }
- var l = specs[i].items.length;
- rowspans[i] = 1;
- for (j = i + 1; j < len; j++) {
- rowspans[i] *= specs[j].items.length;
- }
- }
- <?php foreach( $levels as $level ){ ?>
- <?php if( $level['key']=='default'){ ?>
- html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">{$level['levelname']}</div><div class="input-group"><input type="text" class="form-control input-sm discount_{$level["key"]}_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'discount_{$level["key"]}\');"></a></span></div></div></th>';
- <?php }else{ ?>
- html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">{$level['levelname']}</div><div class="input-group"><input type="text" class="form-control input-sm discount_level{$level['id']}_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'discount_level{$level['id']}\');"></a></span></div></div></th>';
- <?php } ?>
- <?php } ?>
- html += '</tr></thead>';
- for (var m = 0; m < len; m++) {
- var k = 0, kid = 0, n = 0;
- for (var j = 0; j < newlen; j++) {
- var rowspan = rowspans[m];
- if (j % rowspan == 0) {
- 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
- };
- }
- else {
- h[m][j] = {
- title: specs[m].items[kid].title,
- virtual: specs[m].items[kid].virtual,
- html: "",
- id: specs[m].items[kid].id
- };
- }
- n++;
- if (n == rowspan) {
- kid++;
- if (kid > specs[m].items.length - 1) {
- kid = 0;
- }
- n = 0;
- }
- }
- }
- var hh = "";
- for (var i = 0; i < newlen; i++) {
- hh += "<tr>";
- var ids = [];
- var titles = [];
- var virtuals = [];
- for (var j = 0; j < len; j++) {
- hh += h[j][i].html;
- ids.push(h[j][i].id);
- titles.push(h[j][i].title);
- virtuals.push(h[j][i].virtual);
- }
- ids = ids.join('_');
- titles = titles.join('+');
- var val = {
- id: "",
- title: titles,
- <?php foreach( $levels as $level ){ ?>
- <?php if( $level['key']=='default'){ ?>
- level{$level['key']}: '',
- <?php }else{ ?>
- level{$level['id']}: '',
- <?php } ?>
- <?php } ?>
- costprice: "",
- presell: "",
- productprice: "",
- marketprice: "",
- weight: "",
- productsn: "",
- goodssn: "",
- virtual: virtuals
- };
- var val ={ id : "",title:titles,<?php foreach( $levels as $level ){ ?><?php if( $level['key']=='default'){ ?> level{$level['key']}: '',<?php }else{ ?> level{$level['id']}: '',<?php } ?><?php } ?>costprice : "",productprice : "",marketprice : "",weight:"",productsn:"",goodssn:"",virtual:virtuals };
- if ($(".discount_id_" + ids).length > 0) {
- val = {
- id: $(".discount_id_" + ids + ":eq(0)").val(),
- title: titles,
- <?php foreach( $levels as $level ){ ?>
- <?php if( $level['key']=='default'){ ?>
- level{$level['key']}: $(".discount_{$level['key']}_" + ids + ":eq(0)").val(),
- <?php }else{ ?>
- level{$level['id']}: $(".discount_level{$level['id']}_" + ids + ":eq(0)").val(),
- <?php } ?>
- <?php } ?>
- costprice: $(".discount_costprice_" + ids + ":eq(0)").val(),
- presell: $(".discount_presell_" + ids + ":eq(0)").val(),
- productprice: $(".discount_productprice_" + ids + ":eq(0)").val(),
- marketprice: $(".discount_marketprice_" + ids + ":eq(0)").val(),
- presell: $(".discount_presell_" + ids + ":eq(0)").val(),
- goodssn: $(".discount_goodssn_" + ids + ":eq(0)").val(),
- productsn: $(".discount_productsn_" + ids + ":eq(0)").val(),
- weight: $(".discount_weight_" + ids + ":eq(0)").val(),
- virtual: virtuals
- }
- }
- <?php foreach( $levels as $level ){ ?>
- hh += '<td>'
- <?php if( $level['key']=='default'){ ?>
- hh += '<input data-name="discount_level_{$level['key']}_' + ids +'"type="text" class="form-control discount_{$level['key']} discount_{$level['key']}_' + ids +'" value="' +(val.level{$level['key']}=='undefined'?'':val.level{$level['key']} )+'"/>';
- <?php }else{ ?>
- hh += '<input data-name="discount_level_{$level['id']}_' + ids +'"type="text" class="form-control discount_level{$level['id']} discount_level{$level['id']}_' + ids +'" value="' +(val.level{$level['id']}=='undefined'?'':val.level{$level['id']} )+'"/>';
- <?php } ?>
- hh += '</td>';
- <?php } ?>
- hh += '<input data-name="discount_id_' + ids+'"type="hidden" class="form-control discount_id discount_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
- hh += '<input data-name="discount_ids"type="hidden" class="form-control discount_ids discount_ids_' + ids +'" value="' + ids +'"/>';
- hh += '<input data-name="discount_title_' + ids +'"type="hidden" class="form-control discount_title discount_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
- hh += '<input data-name="discount_virtual_' + ids +'"type="hidden" class="form-control discount_virtual discount_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
- hh += "</tr>";
- }
- html += hh;
- html += "</table>";
- $("#discount").html(html);
- }
- function refreshIsDiscount() {
- var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
- var specs = [];
- $(".spec_item").each(function (i) {
- var _this = $(this);
- var spec = {
- id: _this.find(".spec_id").val(),
- title: _this.find(".spec_title").val()
- };
- var items = [];
- _this.find(".spec_item_item").each(function () {
- var __this = $(this);
- var item = {
- id: __this.find(".spec_item_id").val(),
- title: __this.find(".spec_item_title").val(),
- virtual: __this.find(".spec_item_virtual").val(),
- show: __this.find(".spec_item_show").get(0).checked ? "1" : "0"
- }
- items.push(item);
- });
- spec.items = items;
- specs.push(spec);
- });
- specs.sort(function (x, y) {
- if (x.items.length > y.items.length) {
- return 1;
- }
- if (x.items.length < y.items.length) {
- return -1;
- }
- });
- var len = specs.length;
- var newlen = 1;
- var h = new Array(len);
- var rowspans = new Array(len);
- for (var i = 0; i < len; i++) {
- html += "<th>" + specs[i].title + "</th>";
- var itemlen = specs[i].items.length;
- if (itemlen <= 0) {
- itemlen = 1
- }
- ;
- newlen *= itemlen;
- h[i] = new Array(newlen);
- for (var j = 0; j < newlen; j++) {
- h[i][j] = new Array();
- }
- var l = specs[i].items.length;
- rowspans[i] = 1;
- for (j = i + 1; j < len; j++) {
- rowspans[i] *= specs[j].items.length;
- }
- }
- <?php foreach( $levels as $level ){ ?>
- <?php if( $level['key']=='default'){ ?>
- html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">{$level['levelname']}</div><div class="input-group"><input type="text" class="form-control input-sm isdiscount_discounts_{$level['key']}_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'isdiscount_discounts_{$level['key']}\');"></a></span></div></div></th>';
- <?php }else{ ?>
- html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">{$level['levelname']}</div><div class="input-group"><input type="text" class="form-control input-sm isdiscount_discounts_level{$level['id']}_all"VALUE=""/><span class="input-group-addon"><a href="javascript:;" class="fa fa-angle-double-down" title="批量设置" onclick="setCol(\'isdiscount_discounts_level{$level['id']}\');"></a></span></div></div></th>';
- <?php } ?>
- <?php } ?>
- html += '</tr></thead>';
- for (var m = 0; m < len; m++) {
- var k = 0, kid = 0, n = 0;
- for (var j = 0; j < newlen; j++) {
- var rowspan = rowspans[m];
- if (j % rowspan == 0) {
- 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
- };
- }
- else {
- h[m][j] = {
- title: specs[m].items[kid].title,
- virtual: specs[m].items[kid].virtual,
- html: "",
- id: specs[m].items[kid].id
- };
- }
- n++;
- if (n == rowspan) {
- kid++;
- if (kid > specs[m].items.length - 1) {
- kid = 0;
- }
- n = 0;
- }
- }
- }
- var hh = "";
- for (var i = 0; i < newlen; i++) {
- hh += "<tr>";
- var ids = [];
- var titles = [];
- var virtuals = [];
- for (var j = 0; j < len; j++) {
- hh += h[j][i].html;
- ids.push(h[j][i].id);
- titles.push(h[j][i].title);
- virtuals.push(h[j][i].virtual);
- }
- ids = ids.join('_');
- titles = titles.join('+');
- var val = {
- id: "",
- title: titles,
- <?php foreach( $levels as $level ){ ?>
- <?php if( $level['key']=='default'){ ?>
- level{$level['key']}: '',
- <?php }else{ ?>
- level{$level['if']}: '',
- <?php } ?>
- <?php } ?>
- costprice: "",
- presell: "",
- productprice: "",
- marketprice: "",
- weight: "",
- productsn: "",
- goodssn: "",
- virtual: virtuals
- };
- var val ={ id : "",title:titles,<?php foreach( $levels as $level ){ ?><?php if( $level['key']=='default'){ ?> level{$level['key']}: '',<?php }else{ ?> level{$level['id']}: '',<?php } ?><?php } ?>costprice : "",productprice : "",marketprice : "",weight:"",productsn:"",goodssn:"",virtual:virtuals };
- if ($(".isdiscount_discounts_id_" + ids).length > 0) {
- val = {
- id: $(".isdiscount_discounts_id_" + ids + ":eq(0)").val(),
- title: titles,
- <?php foreach( $levels as $level ){ ?>
- <?php if( $level['key']=='default'){ ?>
- level{$level['key']}: $(".isdiscount_discounts_{$level['key']}_" + ids + ":eq(0)").val(),
- <?php }else{ ?>
- level{$level['id']}: $(".isdiscount_discounts_level{$level['id']}_" + ids + ":eq(0)").val(),
- <?php } ?>
- <?php } ?>
- costprice: $(".isdiscount_discounts_costprice_" + ids + ":eq(0)").val(),
- productprice: $(".isdiscount_discounts_productprice_" + ids + ":eq(0)").val(),
- marketprice: $(".isdiscount_discounts_marketprice_" + ids + ":eq(0)").val(),
- presell: $(".isdiscount_discounts_presell_" + ids + ":eq(0)").val(),
- goodssn: $(".isdiscount_discounts_goodssn_" + ids + ":eq(0)").val(),
- productsn: $(".isdiscount_discounts_productsn_" + ids + ":eq(0)").val(),
- weight: $(".isdiscount_discounts_weight_" + ids + ":eq(0)").val(),
- virtual: virtuals
- }
- }
- <?php foreach( $levels as $level ){ ?>
- hh += '<td>'
- <?php if( $level['key']=='default'){ ?>
- hh += '<input data-name="isdiscount_discounts_level_{$level['key']}_' + ids +'"type="text" class="form-control isdiscount_discounts_{$level['key']} isdiscount_discounts_{$level['key']}_' + ids +'" value="' +(val.level{$level['key']}=='undefined'?'':val.level{$level['key']} )+'"/>';
- <?php }else{ ?>
- hh += '<input data-name="isdiscount_discounts_level_{$level['id']}_' + ids +'"type="text" class="form-control isdiscount_discounts_level{$level['id']} isdiscount_discounts_level{$level['id']}_' + ids +'" value="' +(val.level{$level['id']}=='undefined'?'':val.level{$level['id']} )+'"/>';
- <?php } ?>
- hh += '</td>';
- <?php } ?>
- 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 )+'"/>';
- hh += '<input data-name="isdiscount_discounts_ids"type="hidden" class="form-control isdiscount_discounts_ids isdiscount_discounts_ids_' + ids +'" value="' + ids +'"/>';
- 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>';
- 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>';
- hh += "</tr>";
- }
- html += hh;
- html += "</table>";
- $("#isdiscount_discounts").html(html);
- }
- function refreshCommission() {
- var commission_level = {:json_encode($commission_level)};
- var html = '<table class="table table-bordered table-condensed"><thead><tr class="active">';
- var specs = [];
- $(".spec_item").each(function (i) {
- var _this = $(this);
- var spec = {
- id: _this.find(".spec_id").val(),
- title: _this.find(".spec_title").val()
- };
- var items = [];
- _this.find(".spec_item_item").each(function () {
- var __this = $(this);
- var item = {
- id: __this.find(".spec_item_id").val(),
- title: __this.find(".spec_item_title").val(),
- virtual: __this.find(".spec_item_virtual").val(),
- show: __this.find(".spec_item_show").get(0).checked ? "1" : "0"
- }
- items.push(item);
- });
- spec.items = items;
- specs.push(spec);
- });
- specs.sort(function (x, y) {
- if (x.items.length > y.items.length) {
- return 1;
- }
- if (x.items.length < y.items.length) {
- return -1;
- }
- });
- var len = specs.length;
- var newlen = 1;
- var h = new Array(len);
- var rowspans = new Array(len);
- for (var i = 0; i < len; i++) {
- html += "<th>" + specs[i].title + "</th>";
- var itemlen = specs[i].items.length;
- if (itemlen <= 0) {
- itemlen = 1
- }
- ;
- newlen *= itemlen;
- h[i] = new Array(newlen);
- for (var j = 0; j < newlen; j++) {
- h[i][j] = new Array();
- }
- var l = specs[i].items.length;
- rowspans[i] = 1;
- for (j = i + 1; j < len; j++) {
- rowspans[i] *= specs[j].items.length;
- }
- }
- $.each(commission_level,function (key,level) {
- html += '<th><div class=""><div style="padding-bottom:10px;text-align:center;">'+level.levelname+'</div></div></th>';
- })
- html += '</tr></thead>';
- for (var m = 0; m < len; m++) {
- var k = 0, kid = 0, n = 0;
- for (var j = 0; j < newlen; j++) {
- var rowspan = rowspans[m];
- if (j % rowspan == 0) {
- 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
- };
- }
- else {
- h[m][j] = {
- title: specs[m].items[kid].title,
- virtual: specs[m].items[kid].virtual,
- html: "",
- id: specs[m].items[kid].id
- };
- }
- n++;
- if (n == rowspan) {
- kid++;
- if (kid > specs[m].items.length - 1) {
- kid = 0;
- }
- n = 0;
- }
- }
- }
- var hh = "";
- for (var i = 0; i < newlen; i++) {
- hh += "<tr>";
- var ids = [];
- var titles = [];
- var virtuals = [];
- for (var j = 0; j < len; j++) {
- hh += h[j][i].html;
- ids.push(h[j][i].id);
- titles.push(h[j][i].title);
- virtuals.push(h[j][i].virtual);
- }
- ids = ids.join('_');
- titles = titles.join('+');
- var val = {
- id: "",
- title: titles,
- <?php foreach( $commission_level as $level ){ ?>
- <?php if( $level["key"] == "default"){ ?>
- level{$level['key']}: '',
- <?php }else{ ?>
- level{$level['id']}: '',
- <?php } ?>
- <?php } ?>
- costprice: "",
- presell: "",
- productprice: "",
- marketprice: "",
- weight: "",
- productsn: "",
- goodssn: "",
- virtual: virtuals
- };
- var val ={ id : "",title:titles,<?php foreach( $commission_level as $level ){ ?> <?php if( $level["key"] == "default"){ ?>level{$level['key']}: '',<?php }else{ ?>level{$level['id']}: '',<?php } ?><?php } ?>costprice : "",productprice : "",marketprice : "",weight:"",productsn:"",goodssn:"",virtual:virtuals };
- <?php foreach( $commission_level as $level ){ ?>
- <?php if( $level["key"] == "default"){ ?>
- var level{$level['key']} = new Array(3);
- $(".commission_{$level['key']}_"+ ids).each(function(index,val){
- level{$level['key']}[index] = val;
- })
- <?php }else{ ?>
- var level{$level['id']} = new Array(3);
- $(".commission_level{$level['id']}_"+ ids).each(function(index,val){
- level{$level['id']}[index] = val;
- })
- <?php } ?>
- <?php } ?>
- if ($(".commission_id_" + ids).length > 0) {
- val = {
- id: $(".commission_id_" + ids + ":eq(0)").val(),
- title: titles,
- costprice: $(".commission_costprice_" + ids + ":eq(0)").val(),
- presell: $(".commission_presell_" + ids + ":eq(0)").val(),
- productprice: $(".commission_productprice_" + ids + ":eq(0)").val(),
- marketprice: $(".commission_marketprice_" + ids + ":eq(0)").val(),
- goodssn: $(".commission_goodssn_" + ids + ":eq(0)").val(),
- productsn: $(".commission_productsn_" + ids + ":eq(0)").val(),
- weight: $(".commission_weight_" + ids + ":eq(0)").val(),
- virtual: virtuals
- }
- }
- <?php foreach( $commission_level as $level ){ ?>
- hh += '<td>';
- var level_temp = <?php if( $level['key'] == 'default'){ ?>level{$level['key']}<?php }else{ ?>level{$level['id']}<?php } ?>;
- if (len >= i && typeof (level_temp) != 'undefined')
- {
- if('{$level['key']}' == 'default')
- {
- for (var li = 0; li<{$shopset_level};li++)
- {
- if (typeof (level_temp[li])!= "undefined")
- {
- hh += '<input data-name="commission_level_{$level['key']}_' +ids+ '" type="text" class="form-control commission_{$level['key']} commission_{$level['key']}_' +ids+ '" value="' +$(level_temp[li]).val()+ '" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
- }
- else
- {
- hh += '<input data-name="commission_level_{$level['key']}_' +ids+ '" type="text" class="form-control commission_{$level['key']} commission_{$level['key']}_' +ids+ '" value="" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
- }
- }
- }
- else
- {
- for (var li = 0; li<{$shopset_level};li++)
- {
- if (typeof (level_temp[li])!= "undefined")
- {
- hh += '<input data-name="commission_level_{$level['id']}_' +ids+ '" type="text" class="form-control commission_level{$level['id']} commission_level{$level['id']}_' +ids+ '" value="' +$(level_temp[li]).val()+ '" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
- }
- else
- {
- hh += '<input data-name="commission_level_{$level['id']}_' +ids+ '" type="text" class="form-control commission_level{$level['id']} commission_level{$level['id']}_' +ids+ '" value="" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
- }
- }
- }
- }
- else
- {
- if('{$level['key']}' == 'default')
- {
- for (var li = 0; li<{$shopset_level};li++)
- {
- if (typeof (level_temp[li])!= "undefined")
- {
- hh += '<input data-name="commission_level_{$level['key']}_' +ids+ '" type="text" class="form-control commission_{$level['key']} commission_{$level['key']}_' +ids+ '" value="' +$(level_temp[li]).val()+ '" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
- }
- else
- {
- hh += '<input data-name="commission_level_{$level['key']}_' +ids+ '" type="text" class="form-control commission_{$level['key']} commission_{$level['key']}_' +ids+ '" value="" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
- }
- }
- }
- else
- {
- for (var li = 0; li<{$shopset_level};li++)
- {
- if (typeof (level_temp[li])!= "undefined")
- {
- hh += '<input data-name="commission_level_{$level['id']}_' +ids+ '" type="text" class="form-control commission_level{$level['id']} commission_level{$level['id']}_' +ids+ '" value="' +$(level_temp[li]).val()+ '" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
- }
- else
- {
- hh += '<input data-name="commission_level_{$level['id']}_' +ids+ '" type="text" class="form-control commission_level{$level['id']} commission_level{$level['id']}_' +ids+ '" value="" style="display:inline;width: '+96/parseInt({$shopset_level})+'%;"/> ';
- }
- }
- }
- }
- hh += '</td>';
- <?php } ?>
- hh += '<input data-name="commission_id_' + ids+'"type="hidden" class="form-control commission_id commission_id_' + ids +'" value="' +(val.id=='undefined'?'':val.id )+'"/>';
- hh += '<input data-name="commission_ids"type="hidden" class="form-control commission_ids commission_ids_' + ids +'" value="' + ids +'"/>';
- hh += '<input data-name="commission_title_' + ids +'"type="hidden" class="form-control commission_title commission_title_' + ids +'" value="' +(val.title=='undefined'?'':val.title )+'"/></td>';
- hh += '<input data-name="commission_virtual_' + ids +'"type="hidden" class="form-control commission_virtual commission_virtual_' + ids +'" value="' +(val.virtual=='undefined'?'':val.virtual )+'"/></td>';
- hh += "</tr>";
- }
- html += hh;
- html += "</table>";
- $("#commission").html(html);
- }
- function setCol(cls){
- $("."+cls).val( $("."+cls+"_all").val());
- }
- function showItem(obj){
- var show = $(obj).get(0).checked?"1":"0";
- $(obj).parents('.spec_item_item').find('.spec_item_show:eq(0)').val(show);
- }
- function nofind(){
- var img=event.srcElement;
- img.src="./resource/image/module-nopic-small.jpg";
- img.onerror=null;
- }
- function choosetemp(id){
- $('#modal-module-chooestemp').modal();
- $('#modal-module-chooestemp').data("temp",id);
- }
- function addtemp(){
- var id = $('#modal-module-chooestemp').data("temp");
- var temp_id = $('#modal-module-chooestemp').find("select").val();
- var temp_name = $('#modal-module-chooestemp option[value='+temp_id+']').text();
- //alert(temp_id+":"+temp_name);
- $("#temp_name_"+id).val(temp_name);
- $("#temp_id_"+id).val(temp_id);
- $('#modal-module-chooestemp .close').click();
- refreshOptions()
- }
- function setinterval(type)
- {
- var intervalfloor =$('#intervalfloor').val();
- if(intervalfloor=="")
- {
- intervalfloor=0;
- }
- intervalfloor = parseInt(intervalfloor);
- if(type=='plus')
- {
- if(intervalfloor==3)
- {
- tip.msgbox.err("最多添加三个区间价格");
- return;
- }
- intervalfloor=intervalfloor+1;
- }
- else if(type=='minus')
- {
- if(intervalfloor==0)
- {
- tip.msgbox.err("请最少添加一个区间价格");
- return;
- }
- intervalfloor=intervalfloor-1;
- }else
- {
- return;
- }
- if(intervalfloor<1)
- {
- $('#interval1').hide();
- $('#intervalnum1').val("");
- $('#intervalprice1').val("");
- }else
- {
- $('#interval1').show();
- }
- if(intervalfloor<2)
- {
- $('#interval2').hide();
- $('#intervalnum2').val("");
- $('#intervalprice2').val("");
- }else
- {
- $('#interval2').show();
- }
- if(intervalfloor<3)
- {
- $('#interval3').hide();
- $('#intervalnum3').val("");
- $('#intervalprice3').val("");
- }else
- {
- $('#interval3').show();
- }
- $('#intervalfloor').val(intervalfloor);
- }
- </script>
- <script language="javascript">
- $(function() {
-
-
-
-
- })
- </script>
- </body>
|