12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781 |
- {include file="public/layout" /}
-
- {eq name="$editor.editor_select" value="1"}
- {load href="__PUBLIC__/plugins/Ueditor/ueditor.config.js" /}
- {load href="__PUBLIC__/plugins/Ueditor/ueditor.all.min.js" /}
- {load href="__PUBLIC__/plugins/Ueditor/lang/zh-cn/zh-cn.js" /}
- {else/}
- {load href="__PUBLIC__/plugins/ckeditor/ckeditor.js" /}
- {/eq}
-
- <body class="bodysy-w">
- <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
- <div id="append_parent"></div>
- <div id="ajaxwaitid"></div>
- <div id="geduan_div" class="h10"></div>
- <div id="page_div" class="page min-hg-c mb-20" style="min-width:auto;box-shadow:none;">
- <div class="fixed-bar">
- <div class="item-title">
- {include file="public/callback_page_1" /}<!-- 返回箭头 -->
- <a class="back_sz" href="javascript:void(0);" data-href="{:url('Product/help')}" onclick="openHelpframe(this, '设置与帮助', '500px', '100%', 'r');" title="设置与帮助"><i class="iconfont e-shezhi-tongyong"></i></a>
- <ul class="tab-base nc-row">
- <li><a href="javascript:void(0);" data-index='1' class="tab current"><span>基础内容</span></a></li>
- <li><a href="javascript:void(0);" data-index='2' class="tab"><span>产品参数</span></a></li>
- <li><a href="javascript:void(0);" data-index='3' class="tab"><span>SEO优化</span></a></li>
- <li><a href="javascript:void(0);" data-index='4' class="tab"><span>更多设置</span></a></li>
- <!-- #weapp_demontrate_li# -->
- <!-- #weapp_li# -->
- </ul>
- </div>
- </div>
- <form class="form-horizontal" id="post_form" action="{:url('Product/edit')}" method="post">
- <!-- 常规信息 -->
- <div class="ncap-form-default tab_div_1">
- <dl class="row">
- <dt class="tit"> <label for="title"><em>*</em>文档标题</label> </dt>
- <dd class="opt">
- <input type="text" name="title" value="{$field.title}" id="title" class="input-txt" maxlength="200" {eq name="$channelRow.is_repeat_title" value="0"} oninput="check_title_repeat(this,'{$field.aid}');" {/eq}>
-
- 副标题:<input type="text" name="subtitle" value="{$field.subtitle}" id="subtitle" class="w200">
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label for="typeid"><em>*</em>栏目分类</label> </dt>
- <dd class="opt">
- <input type="hidden" name="attr[typeid]" id="attr_typeid" value="{$field.typeid}">
- <select name="typeid" id="typeid">{$arctype_html}</select>
- <span class="err"></span>
- <p class="notic">谨慎切换,自定义字段的内容会随着栏目切换而清空,在保存之前不受影响!</p>
- </dd>
- </dl>
- <dl class="row {empty name='$global.web_stypeid_open'} none {/empty}">
- <dt class="tit"> <label for="stypeid">副栏目分类</label> </dt>
- <dd class="opt">
- <input type="hidden" name="stypeid" id="stypeid" value="{$field.stypeid}" class="input-txt" onkeyup="this.value=this.value.replace(/[^\d\,]/g,'');" onpaste="this.value=this.value.replace(/[^\d\,]/g,'');" placeholder="">
- <a href="javascript:void(0);" data-channel="{$channeltype}" onclick="select_stypeid(this);" class="ncap-btn ncap-btn-green">选择副栏目</a>
- <span class="err"></span>
- <p class="notic">支持同频道模型的栏目</p>
- <div id="stypeid_txt" class="pt5">
- {volist name='$stypeid_arr' id='vo'}{gt name='$key' value='0'} | {/gt}<span>{$vo.typename}</span>{/volist}
- </div>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label>文档属性</label> </dt>
- <dd class="opt">
- {volist name="archives_flags" id="vo"}
- <input type="hidden" name="attr[{$vo.flag_fieldname}]" {if $field[$vo.flag_fieldname] == 1}value="1"{else/}value="0"{/if}>
- <label><input type="checkbox" name="{$vo.flag_fieldname}" value="1" {if $field[$vo.flag_fieldname] == 1}checked{/if}>{$vo.flag_name}<!-- [{$vo.flag_attr}] --></label>
- {/volist}
- <span class="err"></span>
- <p class="notic">如需管理,请点击右上角设置与帮助按钮</p>
- </dd>
- </dl>
- <dl class="row {if condition='$field.is_jump != 1'}none{/if} dl_jump">
- <dt class="tit"> <label for="jumplinks">跳转网址</label> </dt>
- <dd class="opt">
- <input type="text" value="{$field.jumplinks}" name="jumplinks" id="jumplinks" class="input-txt" placeholder="http://">
- <span class="err"></span>
- <p class="notic">请输入完整的URL网址(包含http或https),设置后访问该条信息将直接跳转到设置的网址</p>
- </dd>
- </dl>
- <dl class="row" style="z-index: 2;">
- <dt class="tit"> <label>文档标签</label> </dt>
- <dd class="opt">
- <input type="text" value="{$field.tags}" name="tags" id="tags" class="input-txt" placeholder="多个标签之间以逗号隔开" autocomplete="off" oninput="get_common_tagindex_input(this);" onfocus="$('#often_tags').hide();" onkeyup="this.value=this.value.replace(/[\,]/g,',');" onpaste="this.value=this.value.replace(/[\,]/g,',');">
- <a href="javascript:void(0);" onclick="get_common_tagindex(this);">显示常用标签</a> <img id="tag_loading" src="__STATIC__/common/images/loading.gif" style="display: none;" />
- <div class="often_tags" id="often_tags" data-opt="edit" style="display: none;"></div>
- <div class="often_tags" id="often_tags_input" style="display: none;"></div>
- <input type="hidden" id="tags_click_count">
- </dd>
- </dl>
- <dl class="row {empty name='$global.web_citysite_open'} none {/empty} ">
- <dt class="tit"> <label>所属区域</label> </dt>
- <dd class="opt">
- <select name="province_id" id="province_id" onchange="set_city_list(0);">
- <option value="0">全国</option>
- {volist name=':get_site_province_list()' id='vo'}
- <option value="{$vo.id}" {eq name="$field.province_id" value="$vo.id" } selected {/eq} >{$vo.name}</option>
- {/volist}
- </select>
- <select name="city_id" id="city_id" class="none ml5" onchange="set_area_list(0);">
- <option value="">--请选择--</option>
- </select>
- <select name="area_id" id="area_id" class="none ml5">
- <option value="">--请选择--</option>
- </select>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label>封面图片</label> </dt>
- <dd class="opt">
- <div class="input-file-show div_litpic_local" {neq name="$field.is_remote" value="0"}style="display: none;"{/neq}>
- <span class="show">
- <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="{$field.litpic_local|default='javascript:void(0);'}">
- <i id="img_i" class="fa fa-picture-o" {notempty name="$field.litpic_local"}onmouseover="layer_tips=layer.tips('<img src={$field.litpic_local|default=''} class=\'layer_tips_img\'>',this,{tips: [1, '#fff']});"{/notempty} onmouseout="layer.close(layer_tips);"></i>
- </a>
- </span>
- <span class="type-file-box">
- <input type="text" id="litpic_local" name="litpic_local" value="{$field.litpic_local|default=''}" class="type-file-text" autocomplete="off">
- <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
- <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图,点击按钮选择文件并提交表单后上传生效">
- </span>
- </div>
- <input type="text" id="litpic_remote" name="litpic_remote" value="{$field.litpic_remote|default=''}" placeholder="http://" class="input-txt" onKeyup="keyupRemote(this, 'litpic');" {neq name="$field.is_remote" value="1"}style="display: none;"{/neq}>
-
- <label><input type="checkbox" name="is_remote" id="is_remote" value="1" {eq name="$field.is_remote" value="1"}checked="checked"{/eq} onClick="clickRemote(this, 'litpic');">远程图片</label>
- <span class="err"></span>
- <p class="notic">当没有手动上传图片时候,会自动提取正文的第一张图片作为缩略图</p>
- </dd>
- </dl>
- <dl class="row <!-- #weapp_diy911873092_product_none# -->">
- <dt class="tit"> <label>图片集</label> </dt>
- <dd class="opt">
- <div class="tab-pane pics" id="tab_proimg">
- <table class="table table-bordered">
- <tbody>
- <tr>
- <td >
- <div class="sort-list-img">
- {volist name="proimg_list" id="vo" key="k"}
- <div class="images_upload images_upload_html" style="display:inline-block;">
- <div class="images_upload_box">
- <input type="hidden" name="proimg[]" value="{$vo['image_url']}">
- <a href="{$vo['image_url']}" onclick="" class="upimg" target="_blank" title="拖动修改排序">
- <img data-original="{$vo['image_url']}">
- </a>
- <a href="javascript:void(0)" onclick="ClearPicArr2(this,'{$vo['image_url']}')" class="delect" title="删除"></a>
- </div>
- <textarea rows="5" cols="60" name="imgintro[]" placeholder="图片注释">{$vo.intro}</textarea>
- </div>
- {/volist}
- <div class="images_upload"></div>
- </div>
- <a href="javascript:void(0);" onClick="GetUploadify(30,'','allimg','proimg_call_back');" class="img-upload mb15" title="点击上传"> <div class="y-line"></div> <div class="x-line"></div> </a>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- 上传图片显示的样板 start -->
- <div class="images_upload_tpl none">
- <div class="images_upload images_upload_html">
- <div class="images_upload_box">
- <input type="hidden" name="proimg[]" value="" />
- <a href="javascript:void(0);" onClick="" class="upimg" title="拖动修改排序">
- <img src="__STATIC__/admin/images/add-button.jpg"/>
- </a>
- <a href="javascript:void(0)" class="delect" title="删除"> </a>
- </div>
- <textarea rows="5" cols="60" name="imgintro[]" placeholder="图片注释"></textarea>
- </div>
- </div>
- <!-- 上传图片显示的样板 end -->
- </dd>
- </dl>
-
- {if condition="!empty($shopConfig['shop_open']) && 1 == $shopConfig['shop_open']"}
- <!-- 产品价格属性 -->
- {eq name="$shopConfig['shop_type']" value="2"}
- <dl class="row">
- <dt class="tit"> <label>产品类型</label> </dt>
- <dd class="opt">
- <label> <input type="radio" name="prom_type" value="0" onclick="change_prom_type(0)" {eq name="$field.prom_type" value="0" } checked="checked" {/eq} />普通产品 </label>
-
- <label> <input type="radio" name="prom_type" value="1" onclick="change_prom_type(1)" {eyou:range name="$field.prom_type" value="1,2,3" type="in"} checked="checked" {/eyou:range}/>虚拟产品 </label>
- </dd>
- </dl>
- {else/}
- {empty name="$IsSame"}
- <input type="hidden" name="prom_type" value="{$field.prom_type}"/>
- {else/}
- <dl class="row">
- <dt class="tit"> <label>产品类型</label> </dt>
- <dd class="opt">
- <label> <input type="radio" name="prom_type" value="0" onclick="change_prom_type(0)" {eq name="$field.prom_type" value="0" } checked="checked" {/eq} />普通产品 </label>
-
- <label> <input type="radio" name="prom_type" value="1" onclick="change_prom_type(1)" {eyou:range name="$field.prom_type" value="1,2,3" type="in"} checked="checked" {/eyou:range}/>虚拟产品 </label>
- </dd>
- </dl>
- {/empty}
- {/eq}
- {/if}
-
- <dl class="row" id="fahuoxingshi" {empty name="$field.prom_type"} style="display: none;" {/empty}>
- <dt class="tit"> <label>发货形式</label> </dt>
- <dd class="opt">
- <label> <input type="radio" name="prom_type_vir" value="1" onclick="change_prom_type(2)" {eq name="$field.prom_type" value="1" } checked="checked" {/eq}/>手动发货 </label>
-
- <label> <input type="radio" name="prom_type_vir" value="2" onclick="change_prom_type(3)" {eq name="$field.prom_type" value="2" } checked="checked" {/eq}/>网盘下载 </label>
-
- <label> <input type="radio" name="prom_type_vir" value="3" onclick="change_prom_type(4)" {eq name="$field.prom_type" value="3" } checked="checked" {/eq}/>文本内容 </label>
- </dd>
- </dl>
- <div id="wangpanxiazai" {neq name="$field.prom_type" value="2"} style="display: none;" {/neq}>
- <dl class="row">
- <dt class="tit"> <label for="netdisk_url"><em>*</em>网盘地址</label> </dt>
- <dd class="opt">
- <input type="text" name="netdisk_url" id="netdisk_url" value="{$netdisk.netdisk_url|default=''}" class="input-txt" placeholder="http://">
- <span class="err"></span>
- <p class="notic">输入完整的URL网址(包含http或https)</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label for="netdisk_pwd">提取码</label> </dt>
- <dd class="opt">
- <input type="text" name="netdisk_pwd" value="{$netdisk.netdisk_pwd|default=''}" id="netdisk_pwd" class="input-txt">
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label for="unzip_pwd">解压密码</label> </dt>
- <dd class="opt">
- <input type="text" name="unzip_pwd" value="{$netdisk.unzip_pwd|default=''}" id="unzip_pwd" class="input-txt">
- </dd>
- </dl>
- </div>
- <dl class="row" id="wenbenneirong" {neq name="$field.prom_type" value="3"} style="display: none;" {/neq}>
- <dt class="tit"> <label for="text_content"><em>*</em>文本内容</label> </dt>
- <dd class="opt">
- <textarea rows="5" cols="80" id="text_content" name="text_content" style="width: 375px; height: 160px;">{$netdisk.text_content|default=''}</textarea>
- </dd>
- </dl>
-
- {if condition="1 == $shopConfig['shop_open'] && !empty($ifcontrolRow['users_price'])"}
- {if condition="!isset($shopConfig['shop_open_spec']) || 0 == $shopConfig['shop_open_spec']"}
- <!-- 待添加后续逻辑... -->
- {else/}
- <dl class="row">
- <dt class="tit"> <label>商品规格</label> </dt>
- <dd class="opt">
- <label> <input type="radio" id="spec_type1" name="spec_type" value="1" {empty name="$useSpecNum"}checked="checked"{/empty} onclick="SpecTypeSelect(1);">单规格 </label>
-
- <label> <input type="radio" id="spec_type2" name="spec_type" value="2" {notempty name="$useSpecNum"}checked="checked"{/notempty} onclick="SpecTypeSelect(2);">多规格 </label>
- </dd>
- </dl>
- <dl class="row spec_type_2" {empty name="$useSpecNum"}style="display: none;"{/empty}>
- <dt class="tit"> <label></label> </dt>
- <dd class="opt">
- <div>
- <div id='SpecSelectName'>{volist name="SpecSelectName" id="vo"}{$vo}{/volist}</div>
- <input type="hidden" id="spec_mark_id_arr" value="{$spec_mark_id_arr}">
- <input type="hidden" id="maxPresetMarkID" value="{$maxPresetMarkID}">
- <div id="addSpecButton">
- <a href="JavaScript:void(0);" id="addCustomSpec" data-value="{$useSpecNum}" onclick="addCustomSpec(this);" class="ncap-btn ncap-btn-green ml15">新增规格</a>
- <select name="spec_value" id="spec_value" onchange="addPresetSpec(this)">
- <option value="0">从规格库提取</option>
- {volist name="preset_value" id="vo"}
- <option value="{$vo.preset_mark_id}">{$vo.preset_name}</option>
- {/volist}
- </select>
- </div>
- </div>
- </dd>
- </dl>
- <dl class="row spec_type_2" {empty name="$useSpecNum"}style="display: none;"{/empty}>
- <dt class="tit"> <label for="users_price">价格/库存</label> </dt>
- <dd class="opt"> <div id='SpecTempLateDiv'>{$HtmlTable}</div> </dd>
- </dl>
- {/if}
- {/if}
-
- {if condition="!empty($ifcontrolRow['users_price'])"}
- <dl class="row spec_type_1" {notempty name="$useSpecNum"}style="display: none;"{/notempty}>
- <dt class="tit"> <label for="users_price">{if condition="1 == $shopConfig['shop_open']"}<em>*</em>{/if}价格</label> </dt>
- <dd class="opt">
- <input type="text" name="users_price" id="users_price" maxlength="100" placeholder="原价" style="width: 10%;" value="{$field.users_price}" onkeyup="this.value=this.value.replace(/[^\.\d]/g,'');" onpaste="this.value=this.value.replace(/[^\.\d]/g,'')">
- </dd>
- </dl>
- {/if}
-
- {if condition="1 == $shopConfig['shop_open'] && !empty($ifcontrolRow['users_price'])"}
- <!-- 会员折扣价 -->
- <dl class="row spec_type_1" {notempty name="$useSpecNum"}style="display: none;"{/notempty}>
- <dt class="tit"> <label>会员折扣价</label> </dt>
- <dd class="opt">
- <label> <input type="radio" name="users_discount_type" value="0" onclick="selectDiscountType(0)" {if condition="empty($field.users_discount_type)"} checked="checked" {/if}/>系统默认 </label>
-
- <label> <input type="radio" name="users_discount_type" value="1" onclick="selectDiscountType(1)" {if condition="1 === $field.users_discount_type"} checked="checked" {/if}/>指定会员级别 </label>
-
- <label> <input type="radio" name="users_discount_type" value="2" onclick="selectDiscountType(2)" {if condition="2 === $field.users_discount_type"} checked="checked" {/if}/>不参与 </label>
-
- <!-- 会员折扣模板框架 -->
- <div id="usersDiscountPrice" style="display: none; padding-top: 10px;"></div>
- </dd>
- </dl>
- <script type="text/javascript">
- var usersDiscountAid = {$field.aid|default='0'};
- var usersDiscountType = {$field.users_discount_type|default='0'};
- // 选择会员折扣方式
- function selectDiscountType(value) {
- if (1 === parseInt(value)) {
- if (parseInt(usersDiscountType) !== parseInt(value)) {
- getUsersDiscountPriceTpl();
- }
- } else {
- usersDiscountType = value;
- $('#usersDiscountPrice').hide();
- }
- }
-
- // 如果选择的是指定会员级别则自动执行
- if (1 === parseInt(usersDiscountType)) getUsersDiscountPriceTpl();
- // 获取会员折扣价格模板
- function getUsersDiscountPriceTpl() {
- var users_price = $('#users_price').val() ? $('#users_price').val() : 0;
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/get_users_discount_price_tpl', ['_ajax'=>1])}",
- data: {aid: usersDiscountAid, users_price: users_price},
- dataType: 'json',
- success: function(res) {
- if (1 === parseInt(res.code)) {
- usersDiscountType = 1;
- $('#usersDiscountPrice').html(res.data);
- $('#usersDiscountPrice').show();
- } else {
- showErrorAlert(res.msg);
- }
- },
- error: function(e) {
- showErrorAlert(e.responseText);
- }
- });
- }
-
- // 批量设置价格
- function bulkSetUsersDiscountPrice() {
- layer.prompt({
- title: false,
- shade: layer_shade,
- formType: 3,
- id: 'usersDiscountPriceID',
- btn: ['确定', '关闭'],
- closeBtn: 0,
- success: function(layero, index){
- $("#usersDiscountPriceID").find('input').attr('placeholder', '批量设置价格');
- $("#usersDiscountPriceID").find('input').attr('onkeyup', "this.value=this.value.replace(/[^\\d.]/g,'')");
- $("#usersDiscountPriceID").find('input').attr('onpaste', "this.value=this.value.replace(/[^\\d.]/g,'')");
- }
- }, function(price, index){
- layer.close(index);
- $('.users_discount_price').val(price);
- });
- }
- </script>
-
- <dl class="row spec_type_1" {notempty name="$useSpecNum"}style="display: none;"{/notempty}>
- <dt class="tit"> <label for="stock_count">库存</label> </dt>
- <dd class="opt">
- <input type="text" name="stock_count" id="stock_count" style="width: 10%;" value="{$field.stock_count}" {notempty name="$useSpecNum"}readonly="readonly"{/notempty}>
- <label>
- <input type="checkbox" name="stock_show" value='1' {eq name="$field.stock_show" value="1"}checked{/eq}>页面显示商品库存
- </label>
- </dd>
- </dl>
- {if condition="empty($shopConfig['shop_open_spec'])"}
- <!-- 待添加后续逻辑... -->
- {else /}
- <script type="text/javascript">
- function SpecTypeSelect(spec_type) {
- var IsSpecData = $('#SpecTempLateDiv').html();
- if (1 == spec_type) {
- $('.spec_type_1').show();
- $('.spec_type_2').hide();
- $('#dl_virtual_sales').show();
- $('#users_price, #stock_count').removeAttr("readonly");
- if (IsSpecData && IsSpecData != ' ') {
- layer.confirm('<span style="color: red;">请注意:您已添加多规格,若切换单规格并保存商品,则清空多规格数据!</span>', {
- shade: layer_shade,
- area: ['480px', '190px'],
- move: false,
- title: '提示',
- btnAlign:'r',
- closeBtn: 3,
- btn: ['确定', '取消'] ,//按钮
- success: function () {
- $(".layui-layer-content").css('text-align', 'left');
- }
- }, function (index) {
- $('#spec_type1').attr('checked', 'checked');
- $('#spec_type2').removeAttr('checked');
- layer.close(index);
- }, function (index) {
- $('.spec_type_1').hide();
- $('.spec_type_2').show();
- $('#users_price, #stock_count').attr("readonly", "readonly");
- $('#spec_type1').removeAttr('checked');
- $('#spec_type2').attr('checked', 'checked');
- layer.close(index);
- });
- }
- } else {
- $('.spec_type_1').hide();
- $('.spec_type_2').show();
- $('#dl_virtual_sales').hide();
- $('#users_price, #stock_count').attr("readonly", "readonly");
- }
- }
- </script>
-
- <script type="text/javascript">
- // 规格列表管理
- var TemplateUrl = "{:url('Shop/spec_template')}";
- // 规格选择
- var SelectUrl = "{:url('Shop/spec_select')}";
- // 获取规格名称规格值框架URL
- var GetHtmlUrl = "{:url('Shop/assemble_spec_data')}";
- // 当规格库更新后,调用此方式及时更新选择规格名称的下拉框信息
- var GetPresetSpecUrl = "{:url('Shop/update_spec_info')}";
- // 同步更新规格库数据到产品规格中,单条操作
- var RefreshSpecUrl = "{:url('Shop/refresh_spec_value')}";
-
- var aid = "{$field.aid}";
-
- $(function () {
- var stock_count = 0;
- $('.stock_count').each(function(){
- stock_count +=+ $(this).val();
- })
- if (0 === stock_count) {
- stock_count = '{$field.stock_count}';
- }
- $('#stock_count').val(stock_count);
- // 取最小值价格
- UpPrice();
- // 合并单元格
- MergeCells();
- });
-
- // 自定义规格
- function addCustomSpec(obj) {
- // 本次使用的规格数量
- var specValue = $(obj).attr('data-value');
- if (3 <= specValue) {
- showErrorMsg('最多使用三种商品规格大类');
- return false;
- }
- // 自定义规格数量+1覆盖原值
- $(obj).attr('data-value', ++specValue);
- // if (3 == specValue) $('#addSpecButton').hide();
- // 创建一个自定义规格空数据和表格
- layer_loading('正在处理');
- $.ajax({
- type: 'post',
- data: {aid: aid, action: 'name', _ajax: 1},
- url : "{:url('ShopProduct/add_product_custom_spec')}",
- dataType: 'json',
- success: function(res) {
- layer.closeAll();
- if (1 == res.code) {
- // 最大的规格标记ID
- var maxSpecMarkID = res.data.spec_mark_id;
- // 规格框
- var html = [
- '<div class="prset-box">'+
- '<span class="set-preset-bt mr10" style="display: block;">'+
- '<input type="text" name="set_spec_name" class="zdy-ggname w150" placeholder="规格名称.." onchange="setSpecName(this, ' + maxSpecMarkID + ');">'+
- '<em onclick="setSpecNameClear(this, ' + maxSpecMarkID + ');">'+
- '<i class="fa fa-times-circle" title="关闭" style="margin-left: -20px; margin-top: 8px;"></i>'+
- '</em>'+
- '</span>'+
- '<span class="set-preset-box"></span>'+
- '<span class="set-preset-con">'+
- '<span class="set-preset-bt mr10">'+
- '<input type="hidden" value="' + res.data.spec_value_id + '">'+
- '<input type="text" class="zdy-ggshuzi w150" placeholder="规格值.." onchange="setSpecValue(this, ' + maxSpecMarkID + ');">'+
- '</span>'+
- '<a href="javascript:void(0);" onclick="addCustomSpecValue(this, ' + maxSpecMarkID + ');" class="preset-bt-shuzi mr10">+增加规格值</a>'+
- '</span>'+
- '</div>'
- ];
- $('#SpecSelectName').show().append(html);
- // 价格/库存HTML
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- } else {
- showErrorMsg(res.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorAlert(e.responseText);
- }
- });
- }
-
- // 输入完规格名称后执行
- function setSpecName(obj, spec_mark_id) {
- var set_spec_name = $(obj).val();
- if (spec_mark_id && set_spec_name) {
- $.ajax({
- type: 'post',
- dataType: 'json',
- data: {aid: aid, spec_mark_id: spec_mark_id, set_spec_name: set_spec_name},
- url : "{:url('ShopProduct/add_product_custom_spec_name', ['_ajax'=>1])}",
- success: function(res) {
- if (1 == res.code) {
- // 价格/库存HTML
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- } else {
- showErrorMsg(res.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorAlert(e.responseText);
- }
- });
- }
- }
-
- // 清除数据库指定数据
- function setSpecNameClear(obj, spec_mark_id) {
- if (spec_mark_id) {
- // 执行处理
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
- data: {aid: aid, spec_mark_id: spec_mark_id, del: 'name'},
- dataType: 'json',
- success: function(res) {
- // 删除当前点击规格块的顶级html
- $(obj).parent().parent().remove();
- // 如果存在则执行覆盖新的规格列表框
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- // 使用规格数量-1覆盖原值
- var specValue = $('#addCustomSpec').attr('data-value');
- $('#addCustomSpec').attr('data-value', --specValue);
- // 显示添加按钮
- // $('#addSpecButton').show();
- }
- });
- }
- }
-
- // 规格规格值
- function addCustomSpecValue(obj, spec_mark_id) {
- if (spec_mark_id) {
- layer_loading('正在处理');
- $.ajax({
- type: 'post',
- data: {aid: aid, spec_mark_id: spec_mark_id, action: 'value', _ajax: 1},
- url : "{:url('ShopProduct/add_product_custom_spec')}",
- dataType: 'json',
- success: function(res) {
- layer.closeAll();
- if (1 == res.code) {
- // 规格值HTML
- var html = [
- '<span class="set-preset-bt mr10">'+
- '<input type="hidden" value="' + res.data.spec_value_id + '">'+
- '<input type="text" class="zdy-ggshuzi w150" placeholder="规格值.." onchange="setSpecValue(this, ' + res.data.spec_mark_id + ');">'+
- '<em data-spec_mark_id="' + res.data.spec_mark_id + '" data-spec_value_id="' + res.data.spec_value_id + '" onclick="setSpecValueClear(this);"><i class="fa fa-times-circle" title="关闭" style="margin-left: -22px;margin-top: 8px;cursor: pointer;"></i></em>'+
- '</span>'
- ];
- // 加载一个规格值 input
- $(obj).before(html);
- // 价格/库存HTML
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- } else {
- showErrorMsg(res.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorAlert(e.responseText);
- }
- });
- }
- }
-
- // 输入完规格值后执行
- function setSpecValue(obj, spec_mark_id) {
- // 指定的FormID
- var set_spec_value = $(obj).val();
- var spec_value_id = $(obj).prev().val();
- if (set_spec_value && spec_value_id && spec_mark_id) {
- $.ajax({
- type: 'post',
- dataType: 'json',
- data: {aid: aid, set_spec_value: set_spec_value, spec_value_id: spec_value_id, spec_mark_id: spec_mark_id},
- url : "{:url('ShopProduct/add_product_custom_spec_value', ['_ajax'=>1])}",
- success: function(res) {
- if (1 == res.code) {
- // 价格/库存HTML
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- } else {
- showErrorMsg(res.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorAlert(e.responseText);
- }
- });
- }
- }
-
- // 清除数据库指定数据
- function setSpecValueClear(obj) {
- // 当选对象
- var spec_mark_id = $(obj).attr('data-spec_mark_id');
- var spec_value_id = $(obj).attr('data-spec_value_id');
- // 执行处理
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
- data: {aid: aid, spec_mark_id: spec_mark_id, spec_value_id: spec_value_id, del: 'value'},
- dataType: 'json',
- success: function(res) {
- // 删除当前点击规格块的顶级html
- $(obj).parent().remove();
- // 如果存在则执行覆盖新的规格列表框
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- }
- });
- }
-
- // 生成选中规格名称html并更新加载规格值
- function addPresetSpec(obj) {
- var preset_mark_id = $(obj).val();
- if (0 === parseInt(preset_mark_id)) return false;
- // 本次使用的规格数量
- var specValue = $('#addCustomSpec').attr('data-value');
- if (3 <= specValue) {
- showErrorMsg('最多使用三种商品规格大类');
- return false;
- }
- // 自定义规格数量+1覆盖原值
- $('#addCustomSpec').attr('data-value', ++specValue);
- // if (3 == specValue) $('#addSpecButton').hide();
- layer_loading('正在处理');
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/add_product_custom_spec')}",
- data: {aid: aid, preset_mark_id: preset_mark_id, action: 'specName', _ajax: 1},
- dataType: 'json',
- success: function(res) {
- layer.closeAll();
- if (0 == res.code) {
- showErrorMsg(res.msg);
- } else {
- // 主DIV加载
- var html = [
- '<div class="prset-box" id="preset_'+preset_mark_id+'">'+
- '<div id="div_'+preset_mark_id+'">'+
- '<div><span class="preset-bt w150 mr10" style="display: block;"><span class="spec_name_span_'+preset_mark_id+'">'+res.data.spec_name+'</span><em data-name="'+res.data.spec_name+'" data-mark_id="'+preset_mark_id+'" onclick="clearPresetSpec(this, '+preset_mark_id+')"><i class="fa fa-times-circle" title="关闭"></i></em></span>'+
- '<span class="set-preset-box"></span>'+
- '<span class="set-preset-con">'+
- '<span id="SelectEd_'+preset_mark_id+'"></span>'+
- '<select class="preset-select" name="spec_value" id="spec_value_'+preset_mark_id+'" onchange="addPresetSpecValue(this, '+preset_mark_id+')">'+
- '</select>'+
- '</span>'+
- '</div>'+
- '</div>'+
- '</div>'
- ];
- $('#SpecSelectName').append(html);
- // 规格值加载
- if (res.data.spec_value_option) $('#spec_value_' + preset_mark_id).empty().html(res.data.spec_value_option);
- // 更新预设名称下拉框
- if (res.data.preset_name_option) $('#spec_value').empty().html(res.data.preset_name_option);
- // 价格/库存HTML
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- }
- }
- });
- }
-
- // 清除数据库指定数据
- function clearPresetSpec(obj, spec_mark_id) {
- if (spec_mark_id) {
- // 执行处理
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
- data: {aid: aid, spec_mark_id: spec_mark_id, del: 'specName'},
- dataType: 'json',
- success: function(res) {
- // 删除当前点击规格块的顶级html
- $(obj).parent().parent().parent().parent().remove();
- // 如果存在则执行覆盖新的规格列表框
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- // 更新预设名称下拉框
- if (res.data.preset_name_option) $('#spec_value').empty().html(res.data.preset_name_option);
- // 使用规格数量+1覆盖原值
- var specValue = $('#addCustomSpec').attr('data-value');
- $('#addCustomSpec').attr('data-value', --specValue);
- // 显示添加按钮
- // $('#addSpecButton').show();
- }
- });
- }
- }
-
- // 追加预设规格名称和规格值
- function addPresetSpecValue(obj, spec_mark_id) {
- var spec_value_id = $(obj).val();
- layer_loading('正在处理');
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/add_product_custom_spec')}",
- data: {aid: aid, spec_value_id: spec_value_id, spec_mark_id: spec_mark_id, action: 'specValue', _ajax: 1},
- dataType : 'json',
- success : function(res){
- layer.closeAll();
- if (0 == res.code) {
- showErrorMsg(res.msg);
- }else{
- // 追加选中的值
- $('#SelectEd_'+spec_mark_id).append(
- '<span class="preset-bt2 mr10" id="preset-bt2_'+spec_value_id+'"><span class="preset_value_span_'+spec_value_id+'">'+res.data.spec_value+'</span><em data-value="'+res.data.spec_value+'" data-spec_mark_id="'+spec_mark_id+'" data-spec_value_id="'+spec_value_id+'" onclick="clearPresetSpecValue(this)"><i class="fa fa-times-circle" title="关闭"></i></em> </span>'
- );
- // 规格值加载
- if (res.data.spec_value_option) $('#spec_value_'+spec_mark_id).empty().html(res.data.spec_value_option);
- // 价格/库存HTML
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- }
- }
- });
- }
-
- // 清除数据库指定数据
- function clearPresetSpecValue(obj) {
- // 当选对象
- var spec_mark_id = $(obj).attr('data-spec_mark_id');
- var spec_value_id = $(obj).attr('data-spec_value_id');
- // 执行处理
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
- data: {aid: aid, spec_mark_id: spec_mark_id, spec_value_id: spec_value_id, del: 'specValue'},
- dataType: 'json',
- success: function(res) {
- // 删除当前点击规格块的顶级html
- $(obj).parent().remove();
- // 规格值加载
- if (res.data.spec_value_option) $('#spec_value_'+spec_mark_id).empty().html(res.data.spec_value_option);
- // 如果存在则执行覆盖新的规格列表框
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- }
- });
- }
-
- // 更新同步规格值信息
- function RefreshSpecValue(obj) {
- layer.confirm('此操作将会把规格库<span style="color:red;">'+$(obj).data('name')+'</span>的规格数据同步更新!操作不可逆,确认同步?', {
- shade: layer_shade,
- area: ['480px', '190px'],
- move: false,
- title: '提示',
- btnAlign:'r',
- closeBtn: 3,
- btn: ['确定', '取消'] ,//按钮
- success: function () {
- $(".layui-layer-content").css('text-align', 'left');
- }
- }, function () {
- layer_loading('正在处理');
- var mark_id = $(obj).data('mark_id');
- if (mark_id) {
- var aid = $("input[name=aid]").val();
- $.ajax({
- type : 'post',
- url : RefreshSpecUrl,
- data : {spec_mark_id:mark_id, aid:aid, _ajax:1},
- dataType : 'json',
- success : function(res){
- layer.closeAll();
- if (res.data) {
- // 更新规格值下拉框
- if (res.data.ValueOption) {
- $('#spec_value_'+mark_id).empty().html(res.data.ValueOption);
- }
-
- // 更新页面上已选的规格名称及规格值
- if (res.data.UpData) {
- for (var i = 0; i < res.data.UpData.length; i++) {
- /*替换已选商品规格名称及规格值*/
- // 替换规格名称
- $('.spec_name_span_'+res.data.UpData[i]['spec_mark_id']).html(res.data.UpData[i]['spec_name']);
- $('.spec_name_input_'+res.data.UpData[i]['spec_mark_id']).val(res.data.UpData[i]['spec_name']);
- if (res.data.UpData[i]['spec_value_id']) {
- // 替换规格值
- $('.spec_value_span_'+res.data.UpData[i]['spec_value_id']).html(res.data.UpData[i]['spec_value']);
- $('.spec_value_input_'+res.data.UpData[i]['spec_value_id']).val(res.data.UpData[i]['spec_value']);
- }
- /* END */
- }
- }
-
- // 清除页面上已选的规格数据
- if (res.data.SpecIds) {
- if (res.data.DelAllSpec) {
- $('#spec_'+res.data.DelAllSpec).remove();
- }else{
- for (var i = 0; i < res.data.SpecIds.length; i++) {
- $('#preset-bt2_'+res.data.SpecIds[i]).remove();
- }
- }
- }
-
- // 重新加载规格价格库存填写栏
- if (res.data.HtmlTable && res.data.SpecMarks) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.HtmlTable);
- // 合并单元格
- MergeCells();
- $('#spec_mark_id_arr').val(res.data.SpecMarks);
- }
- }
- layer.msg(res.msg, {time:1500, icon: 1});
- },
- error : function(e) {
- layer.closeAll();
- layer.alert(e.responseText, {icon: 5});
- }
- });
- }else{
- layer.closeAll();
- layer.msg('数据有误,同步失败,请刷新重试!', {time:2000, icon: 2});
- }
- }, function (index) {
- // 取消
- layer.closeAll(index);
- });
- }
-
- // 加载下拉框
- function SpecSelectName(obj) {
- // 本次使用的规格数量
- var specValue = $('#addCustomSpec').attr('data-value');
- if (3 <= specValue) {
- showErrorMsg('最多使用三种商品规格大类');
- return false;
- }
-
- var aid = $("input[name=aid]").val();
- var spec_mark_id = $(obj).val();
- var spec_mark_id_arr = $('#spec_mark_id_arr').val();
- $.ajax({
- type: 'post',
- url : SelectUrl,
- data: {aid: aid, spec_mark_id: spec_mark_id, spec_mark_id_arr: spec_mark_id_arr, preset_mark_id_arr: spec_mark_id_arr, _ajax: 1},
- dataType: 'json',
- success: function(res){
- if (0 == res.code) {
- showErrorMsg(res.msg);
- } else {
- var html = [];
- // 主DIV加载
- html += [
- '<div class="prset-box" id="preset_'+spec_mark_id+'">'+
- '<div id="div_'+spec_mark_id+'">'+
- '<div><span class="preset-bt"><span class="spec_name_span_'+spec_mark_id+'">'+res.data.preset_name+'</span><em data-name="'+res.data.preset_name+'" data-mark_id="'+spec_mark_id+'" onclick="DelDiv(this)"><i class="fa fa-times-circle" title="关闭"></i></em></span>'+
- '<span id="SelectEd_'+spec_mark_id+'"></span> '+
- '<select name="spec_value" id="spec_value_'+spec_mark_id+'" onchange="AppEndPreset(this,'+spec_mark_id+')">'+
- '</select> <span title="同步规格值" data-mark_id="'+spec_mark_id+'" data-name="'+res.data.preset_name+'" onclick="RefreshSpecValue(this);"><i class="fa fa-refresh"></i></span>'+
- '</div>'+
- '</div>'+
- '</div>'
- ];
- $('#SpecSelectName').append(html);
- // 预设值加载
- $('#spec_value_'+spec_mark_id).empty().html(res.data.preset_value_option);
- // 更新预设名称下拉框
- res.data.preset_name_option = '<option value="0">选择规格名称</option>' + res.data.preset_name_option;
- $('#spec_value').empty().html(res.data.preset_name_option);
- $('#spec_mark_id_arr').val(res.data.spec_mark_id_arr);
-
- // 自定义规格数量+1覆盖原值
- $('#addCustomSpec').attr('data-value', ++specValue);
- }
- }
- });
- }
-
- // 追加预设规格名称和规格值
- function AppEndPreset(obj, spec_mark_id) {
- var spec_value_id = $(obj).val();
- var aid = $("input[name=aid]").val();
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/spec_value_select')}",
- data: {aid: aid, spec_value_id: spec_value_id, spec_mark_id: spec_mark_id, _ajax: 1},
- dataType: 'json',
- success: function(res){
- if (0 == res.code) {
- showErrorMsg(res.msg);
- } else {
- // 追加选中的值
- $('#SelectEd_'+spec_mark_id).append(
- '<span class="preset-bt2" id="preset-bt2_'+spec_value_id+'"><span class="spec_value_span_'+spec_value_id+'">'+res.data.Value+'</span><em data-value="'+res.data.Value+'" data-mark_id="'+spec_mark_id+'" data-preset_id="'+spec_value_id+'" onclick="DelValue(this)"><i class="fa fa-times-circle" title="关闭"></i></em> </span>'
- );
- // 加载规格值下拉框
- if (res.data.Option) $('#spec_value_'+spec_mark_id).empty().html(res.data.Option);
- // 加载规格框架
- if (res.data.htmlTable) {
- // 合并单元格
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- MergeCells();
- if (res.data.htmlTable != ' ') {
- $("#users_price").attr("readonly", "readonly");
- $("#stock_count").attr("readonly", "readonly");
- } else {
- $("#users_price").removeAttr("readonly");
- $("#stock_count").removeAttr("readonly");
- }
- } else {
- $("#users_price").removeAttr("readonly");
- $("#stock_count").removeAttr("readonly");
- }
- }
- }
- });
- }
-
- // 清除session中的指定数据,同时对数据库进行操作
- function DelDiv(obj) {
- var spec_mark_id = $(obj).attr('data-mark_id');
- var spec_mark_id_arr = $('#spec_mark_id_arr').val();
- var aid = $("input[name=aid]").val();
- // 执行处理
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
- data: {aid: aid, spec_mark_id: spec_mark_id, spec_mark_id_arr: spec_mark_id_arr, del: 'name'},
- dataType: 'json',
- success: function(res) {
- // 关闭所有弹出层
- layer.closeAll();
- // 删除当前点击规格块的顶级html
- $(obj).parent().parent().parent().parent().remove();
- // 加载选中的规格名称ID
- if (res.data.spec_mark_id_arr) $('#spec_mark_id_arr').val(res.data.spec_mark_id_arr);
- // 如果存在则执行覆盖新的规格列表框
- if (res.data.htmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- // 合并单元格
- MergeCells();
- }
- // 使用规格数量+1覆盖原值
- var specValue = $('#addCustomSpec').attr('data-value');
- $('#addCustomSpec').attr('data-value', --specValue);
- // 更新预设名称下拉框
- res.data.Option = '<option value="0">选择规格名称</option>' + res.data.Option;
- if (res.data.Option) $('#spec_value').empty().html(res.data.Option);
- }
- });
- // 使用规格数量+1覆盖原值
- var specValue = $('#addCustomSpec').attr('data-value');
- $('#addCustomSpec').attr('data-value', --specValue);
- }
-
- // 清除session中的指定数据,同时对数据库进行操作
- function DelValue(obj) {
- var spec_mark_id = $(obj).attr('data-mark_id');
- var spec_value_id = $(obj).attr('data-preset_id');
- var aid = $("input[name=aid]").val();
- $.ajax({
- type: 'post',
- url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
- data: {aid: aid, spec_value_id: spec_value_id, spec_mark_id: spec_mark_id, del: 'value'},
- dataType: 'json',
- success: function(res) {
- layer.closeAll();
- // 清除页面html
- $(obj).parent().remove();
- if (res.data.Option) $('#spec_value_'+spec_mark_id).empty().html(res.data.Option);
-
- // 加载规格框架
- if (res.data.htmlTable) {
- // 合并单元格
- $('#SpecTempLateDiv').html(res.data.htmlTable);
- MergeCells();
- if (res.data.htmlTable != ' ') {
- $("#users_price").attr("readonly", "readonly");
- $("#stock_count").attr("readonly", "readonly");
- } else {
- $("#users_price").removeAttr("readonly");
- $("#stock_count").removeAttr("readonly");
- }
- } else {
- $("#users_price").removeAttr("readonly");
- $("#stock_count").removeAttr("readonly");
- }
- }
- });
- }
-
- // 批量设置价格
- function BulkSetPrice(obj) {
- layer.prompt({
- formType: 3,
- shade: layer_shade,
- id: 'BulkSetPrice',
- title: '提示',
- btn: ['确定', '关闭'],
- btnAlign:'r',
- closeBtn: 3,
- success: function(layero, index){
- $("#BulkSetPrice").find('input').attr('placeholder', '批量设置价格');
- $("#BulkSetPrice").find('input').attr('onkeyup', "this.value=this.value.replace(/[^\\d.]/g,'')");
- $("#BulkSetPrice").find('input').attr('onpaste', "this.value=this.value.replace(/[^\\d.]/g,'')");
- }
- }, function(price, index){
- layer.close(index);
- // 规格中的价格
- $('.users_price').val(price);
- // 产品价格
- $('#users_price').val(price);
- });
- }
-
- // 更新价格,取出最小的值赋值到价格中
- function UpPrice(obj) {
- var UsersPriceArray = new Array();
- $('.users_price').each(function(){
- UsersPriceArray.push($(this).val());
- });
- if (UsersPriceArray.length != 0) {
- // 取出最小值
- var MinValue = Math.min.apply(Math, UsersPriceArray);
- // 禁用库存框
- $('#users_price').attr('readonly','readonly');
- }else{
- var MinValue = '{$field.users_price}';
- }
- $('#users_price').val(MinValue);
- }
-
- // 批量设置库存
- function BulkSetStock(obj) {
- layer.prompt({
- formType: 3,
- shade: layer_shade,
- id: 'BulkSetStock',
- title: '提示',
- btn: ['确定', '关闭'],
- btnAlign:'r',
- closeBtn: 3,
- success: function(layero, index){
- $("#BulkSetStock").find('input').attr('placeholder', '批量设置库存');
- $("#BulkSetStock").find('input').attr('onkeyup', "this.value=this.value.replace(/[^\\d.]/g,'')");
- $("#BulkSetStock").find('input').attr('onpaste', "this.value=this.value.replace(/[^\\d.]/g,'')");
- }
- }, function(stock, index){
- layer.close(index);
- // 单个库存
- $('.stock_count').val(stock);
- $('.stock_count').attr('data-old_stock',stock);
- stock_count = Number($('.stock_count').length) * Number(stock);
- $('#stock_count').val(stock_count);
- // 禁用库存框
- $('#stock_count').attr('readonly','readonly');
- });
- }
-
- // 更新库存量
- function UpStock(obj) {
- var stock_count = $('#stock_count').val();
- var new_stock = $(obj).val();
- var old_stock = $(obj).attr('data-old_stock');
- $(obj).attr('data-old_stock',new_stock);
- if (Number(old_stock) > Number(new_stock)) {
- new_stock = Number(old_stock) - Number(new_stock);
- stock_count = Number(stock_count) - Number(new_stock);
- }else{
- new_stock = Number(new_stock) - Number(old_stock);
- stock_count = Number(stock_count) + Number(new_stock);
- }
- $('#stock_count').val(stock_count);
- }
-
- // 合并单元格
- function MergeCells() {
- var tab = document.getElementById("spec_input_tab");
- var maxCol = 2, val, count, start;
- if (tab != null) {
- for (var col = maxCol - 1; col >= 0; col--) {
- count = 1;
- val = "";
- for (var i = 0; i < tab.rows.length; i++) {
- if (val == tab.rows[i].cells[col].innerHTML) {
- count++;
- } else {
- if (count > 1) { //合并
- start = i - count;
- tab.rows[start].cells[col].rowSpan = count;
- for (var j = start + 1; j < i; j++) {
- tab.rows[j].cells[col].style.display = "none";
- }
- count = 1;
- }
- val = tab.rows[i].cells[col].innerHTML;
- }
- }
- if (count > 1) { //合并,最后几行相同的情况下
- start = i - count;
- tab.rows[start].cells[col].rowSpan = count;
- for (var j = start + 1; j < i; j++) {
- tab.rows[j].cells[col].style.display = "none";
- }
- }
- }
- }
- }
-
- // 规格列表管理
- function SpecTempLate() {
- //iframe窗
- layer.open({
- type: 2,
- title: '规格模板库',
- shade:layer_shade,
- shadeClose: false,
- maxmin: false, //开启最大化最小化按钮
- area: ['90%', '90%'],
- content: TemplateUrl
- });
- }
-
- // 当规格库更新后,调用此方式及时更新选择规格名称的下拉框信息及规格框信息
- function UpPresetSpecData(preset_mark_id) {
- var spec_mark_id_arr = $('#spec_mark_id_arr').val();
- var aid = $("input[name=aid]").val();
- $.ajax({
- type: 'post',
- url : GetPresetSpecUrl,
- data: {aid: aid, preset_mark_id: preset_mark_id, spec_mark_id_arr: spec_mark_id_arr, preset_mark_id_arr: spec_mark_id_arr, _ajax: 1},
- dataType: 'json',
- success: function(res){
- // 更新规格名称下拉框
- res.data.spec_name_option = '<option value="0">选择规格名称</option>' + res.data.spec_name_option;
- $('#spec_value').empty().html(res.data.spec_name_option);
- }
- });
- }
- </script>
- {/if}
- <dl class="row {notempty name="$useSpecNum"} none {/notempty}" id="dl_virtual_sales">
- <dt class="tit"> <label for="virtual_sales">虚拟销量</label> </dt>
- <dd class="opt">
- <input type="text" name="virtual_sales" id="virtual_sales" maxlength="100" style="width: 10%;" value="{$field.virtual_sales}" onkeyup="this.value=this.value.replace(/[^\d]/g,'');" onpaste="this.value=this.value.replace(/[^\d]/g,'')">
- <p class="notic">只适用单规格商品,前台展示时是实际销量+虚拟销量</p>
- </dd>
- </dl>
- {/if}
-
- {include file="archives/get_field_addonextitem" /}
- </div>
- <!-- 常规信息 -->
-
- <!-- 产品参数 -->
- <div class="ncap-form-default tab_div_2" style="display: none;">
- <input type="hidden" name="is_old_product_attr" value="{$is_old_product_attr|default='0'}">
- {notempty name='$is_old_product_attr'}
- {include file="product/old_product_attr_edit" /}
- {else /}
- <!-- <dl class="row">
- <dt class="tit"> <label>参数类型</label> </dt>
- <dd class="opt">
- <label><input type="radio" name="param_type" value="1" {notempty name="$field.attrlist_id"} checked="checked" {/notempty} onclick="paramType(1);">系统参数</label>
-
- <label><input type="radio" name="param_type" value="2" {empty name="$field.attrlist_id"} checked="checked" {/empty} onclick="paramType(2);">自定义参数</label>
- </dd>
- </dl> -->
- <dl class="row">
- <dt class="tit"> <label>商品参数</label> </dt>
- <dd class="opt">
- <div id="system_param">
- <div>
- <select name="attrlist_id" id="attrlist_id" onchange="AttrListSelect(this);">
- <option value="0">请选择参数</option>
- {volist name="AttrList" id="vo"}
- <option value="{$vo.list_id}" {eq name="$vo.list_id" value="$field.attrlist_id"}selected{/eq}>{$vo.list_name}</option>
- {/volist}
- </select>
-
- <a href="JavaScript:void(0);" id="addCustomParam" data-attr_id="{$maxAttrID}" onclick="addCustomParam(this);" class="ncap-btn ncap-btn-green">自定义参数</a>
- <a href="JavaScript:void(0);" onclick="attrlistLayer(this)" style="font-size: 12px;padding-left: 10px;">[管理]</a>
- </div>
- <dl class="row">
- <dt class="sort-e lh40 pl0 text-l10" style=" background: #f4f6f8;">排序</dt>
- <dt class="tit lh40 pl5 text-l10" style=" background: #f4f6f8;"> 参数名称</dt>
- <dd class="opt w350 lh40 text-l10" style=" background: #f4f6f8;">参数值</dd>
- </dl>
- <div id='AttrSelectName' style="margin: 1px;">{$canshu}</div>
- <div id='customParam' style="margin: 1px;">
- <input type="hidden" name="del_attr_id" value="{$delAttrID}">
- {volist name="$customParam" id="vo"}
- <dl class="row">
- <dt class="sort-e pl0"> <input type="text" size="4" name="sort_order[{$vo.attr_id}]" value="{$vo.sort_order}"> </dt>
- <dt class="tit pl5"> <input type="text" size="10" name="attr_name[{$vo.attr_id}]" value="{$vo.attr_name}"> </dt>
- <dd class="opt pl5">
- <input type="text" size="40" name="attr_value[{$vo.attr_id}]" value="{$vo.attr_value}">
- <a class="text_a" href="javascript:void(0);" onClick="delCustomParam(this);">删除</a>
- </dd>
- </dl>
- {/volist}
- </div>
- </div>
- <!-- <div id="custom_param" {empty name="$field.attrlist_id"} style="display: block;" {else/} style="display: none;" {/empty}>
- <div class="copybtn"><a class="ncap-btn ncap-btn-green" href="javascript:void(0);" onclick="addCustomParam();">新增</a></div><br>
- <div class="itemInfo">
- <table cellspacing="0" cellpadding="0" border="0" class="normTbe tabInfo">
- <thead>
- <tr>
- <th class="w350">参数名称</th>
- <th class="w350">参数值</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody class="tbody1" id="attr_tbody">
- {volist name="$customParam" id="vo"}
- <tr>
- <td class="w350"><input type="text" name="param_name[]" value="{$vo.param_name}"></td>
- <td class="w350"><input type="text" name="param_value[]" value="{$vo.param_value}"></td>
- <td> <a class="text_a" href="javascript:void(0);" onclick="delCustomParam(this);">删除</a> </td>
- </tr>
- {/volist}
- </tbody>
- </table>
- </div>
- </div> -->
- </dd>
- </dl>
- <script type="text/javascript">
- // 商品参数切换
- // function paramType(param_type) {
- // if (1 == param_type) {
- // $('#system_param').show();
- // $('#custom_param').hide();
- // } else {
- // $('#system_param').hide();
- // $('#custom_param').show();
- // }
- // }
-
- // 添加自定义参数
- function addCustomParam(obj) {
- var maxAttrID = $(obj).attr('data-attr_id');
-
- // 规格值HTML
- var html = [
- '<dl class="row">'+
- '<dt class="sort-e pl0"> <input type="text" size="4" name="sort_order['+maxAttrID+']" placeholder="100"> </dt>'+
- '<dt class="tit pl5"> <input type="text" size="10" name="attr_name['+maxAttrID+']"> </dt>'+
- '<dd class="opt pl5">'+
- '<input type="text" size="40" name="attr_value['+maxAttrID+']"> '+
- '<a class="text_a" href="javascript:void(0);" onClick="delCustomParam(this);">删除</a>'+
- '</dd>'+
- '</dl>'
- // '<tr>'+
- // '<td class="w350"><input type="text" name="param_name[]" /></td>'+
- // '<td class="w350"><input type="text" name="param_value[]" /></td>'+
- // '<td> <a class="text_a" href="javascript:void(0);" onClick="delCustomParam(this);">删除</a> </td>'+
- // '</tr>'
- ];
- // 加载一个规格值 input
- $('#customParam').append(html);
-
- // 自定义参数数量+1覆盖原值
- $(obj).attr('data-attr_id', ++maxAttrID);
- }
-
- // 删除自定义参数
- function delCustomParam(obj) {
- $(obj).parent().parent().remove();
- // var length = $("#attr_tbody>tr").length;
- // if (parseInt(length) <= 1) {
- // showErrorMsg("至少保留一行");
- // } else {
- // $(obj).parent().parent().remove();
- // }
- }
-
- // 参数选择
- function AttrListSelect(obj) {
- var aid = '';
- var list_id = $(obj).val();
- if (parseInt(list_id) < 1) {
- $("#AttrSelectName").empty();
- return false;
- }
- $('#AttrSelectName').html('<div style="color: red;font-size: 12px;text-align: center;">加载中……</div>');
- // 商品栏目切换时 ajax 调用 返回不同的属性输入框
- $.ajax({
- type:'GET',
- data:{aid:aid, list_id:list_id, _ajax:1},
- url :"{:url('ShopProduct/ajax_get_shop_attr_input')}",
- success:function(data) {
- $("#AttrSelectName").empty().append(data);
- }
- });
- }
-
- function attrlistLayer(obj) {
- var url = "{:url('ShopProduct/attrlist_index', ['oldinlet'=>1])}";
- //iframe窗
- var iframes = layer.open({
- type: 2,
- title: '商品参数管理',
- fixed: true, //不固定
- shadeClose: false,
- shade: layer_shade,
- area: ['95%', '95%'],
- content: url,
- end: function(index){
- var list_id = $('#attrlist_id').val();
- $.ajax({
- url:"{:url('Product/ajax_get_shop_attrlist')}",
- type:'GET',
- data:{list_id:list_id, _ajax:1},
- success:function(res) {
- var html = "<option value='0'>请选择参数</option>";
- html += res;
- $("#attrlist_id").empty().append(html);
-
- // 删掉选中的参数之后,默认不选中,参数属性同时要清空掉
- if ($('#attrlist_id').val() < 1) {
- $("#AttrSelectName").empty();
- }
- },
- error: function(e){
- showErrorAlert(e.responseText);
- }
- });
- }
- });
- // layer.full(iframes);
- }
- </script>
- {/notempty}
- </div>
- <!-- 产品参数 -->
-
- <!-- SEO参数 -->
- <div class="ncap-form-default tab_div_3" style="display: none;">
- <dl class="row">
- <dt class="tit"> <label for="seo_title">SEO标题</label> </dt>
- <dd class="opt">
- <input type="text" value="{$field.seo_title}" name="seo_title" id="seo_title" class="input-txt">
- <span class="err"></span>
- <p class="notic">一般不超过80个字符,为空时系统自动构成,可以到 <a href="{:url('Seo/index', array('inc_type'=>'seo'))}">SEO设置 - SEO基础</a> 中设置构成规则。</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label for="seo_keywords">SEO关键词</label> </dt>
- <dd class="opt">
- <textarea rows="5" cols="60" id="seo_keywords" name="seo_keywords" style="height:20px;">{$field.seo_keywords}</textarea>
- <span class="err"></span>
- <p class="notic">一般不超过100个字符,多个关键词请用英文逗号(,)隔开,建议3到5个关键词。</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label for="seo_description">SEO描述</label> </dt>
- <dd class="opt">
- <textarea rows="5" cols="60" id="seo_description" name="seo_description" style="height:54px;" class="keywordsTextarea" onkeyup="monitorInputStr();" onkeypress="monitorInputStr();">{$field.seo_description}</textarea>
- <span class="err"></span>
- <p class="notic">一般不超过100个字符,不填写时系统自动提取正文的前100个字符</p>
- <p class="notic2 {empty name='$field.seo_description'}none{/empty}" id="beenWritten">你已输入<span id="beenWrittenStr">0</span>个字符</p>
- <p><label><input type="checkbox" name="basic_update_seo_description" value="1" {if condition="!empty($global['basic_update_seo_description'])"} checked="checked" {/if}>勾选后SEO描述将随正文内容更新</label></p>
- </dd>
- </dl>
- </div>
- <!-- SEO参数 -->
-
- <!-- 其他参数 -->
- <div class="ncap-form-default tab_div_4" style="display: none;">
- <dl class="row">
- <dt class="tit"> <label for="author">作者</label> </dt>
- <dd class="opt">
- <input type="hidden" value="{$field.users_id}" name="users_id" class="input-txt">
- <input type="text" value="{$field.author}" name="author" id="author" class="input-txt">
- <span class="err"></span>
- <p class="notic">设置作者默认名称(将同步至管理员笔名)</p>
- </dd>
- </dl>
- <dl class="row dl_origin">
- <dt class="tit"> <label for="origin">来源</label> </dt>
- <dd class="opt origin-hot">
- <input type="text" value="{$field.origin}" name="origin" id="origin" class="input-txt" onclick="searchOrigin(this);" autocomplete="off">
- <div class="origin-hot-list" style="display: none;" id="search_keywords_list_origin"></div>
- <textarea id="system_originlist_str" style="display: none;">{$system_originlist_str}</textarea>
- <span class="setting" onclick="set_originlist();">设置</span>
- <span class="err"></span>
- <p class="notic">为空时默认“网络”</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label for="click">点击数</label> </dt>
- <dd class="opt">
- <input type="text" value="{$field.click}" name="click" id="click" class="input-txt">
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label>阅读权限</label> </dt>
- <dd class="opt">
- <input type="hidden" value="{$field.arcrank}" name="old_arcrank" class="input-txt">
- <select name="arcrank" id="arcrank" {if $field.arcrank < 0 && $admin_info.role_id > 0 && $auth_role_info.check_oneself < 1} disabled="disabled" {/if}>
- {volist name="arcrank_list" id="vo"}
- <option value="{$vo.rank}" {eq name="$vo.rank" value="$field.arcrank"}selected{/eq}>{$vo.name}</option>
- {/volist}
- </select>
- </dd>
- </dl>
- <!-- #weapp_UsersGroup_content_users_id={$field.users_id}#--><!-- #weapp_UsersGroup_content# -->
- <dl class="row">
- <dt class="tit"> <label for="add_time">发布时间</label> </dt>
- <dd class="opt">
- <input type="text" class="input-txt" id="add_time" name="add_time" value="{$field.add_time|date='Y-m-d H:i:s',###}" autocomplete="off">
- <span class="add-on input-group-addon"> <i class="glyphicon glyphicon-calendar fa fa-calendar"></i></span>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label for="tempview">文档模板</label> </dt>
- <dd class="opt">
- <select name="tempview" id="tempview">
- {volist name='$templateList' id='vo'}
- <option value="{$vo}" {eq name='$vo' value='$tempview'}selected{/eq}>{$vo}</option>
- {/volist}
- </select>
- <input type="hidden" name="type_tempview" value="{$tempview}" />
- </dd>
- </dl>
- <dl class="row {notin name='$seo_pseudo' value='2,3'}no-grey{/notin}">
- <dt class="tit"> <label>自定义文件名</label> </dt>
- <dd class="opt">
- <input type="text" {notin name='$seo_pseudo' value='2,3'}readonly="readonly" title="动态模式下不支持自定义文档url"{/notin} value="{$field.htmlfilename}" name="htmlfilename" id="htmlfilename" autocomplete="off" onkeyup="this.value=this.value.replace(/[^\u4E00-\u9FA5\w\-]/g,'-');" onpaste="this.value=this.value.replace(/[^\u4E00-\u9FA5\w\-]/g,'-');" class="input-txt {notin name='$seo_pseudo' value='2,3'}no-drop{/notin}">.html
- <span class="err"></span>
- <p class="notic">自定义文件名可由字母、数字、下划线(_)、连接符(-)等符号组成,除此之外其他字符将自动转为连接符(-)</p>
- </dd>
- </dl>
- </div>
- <!-- 其他参数 -->
- <!-- #weapp_demontrate_div# -->
- <!-- #weapp_div# -->
- <div class="ncap-form-default">
- <div class="bot2">
- <input type="hidden" name="gourl" value="{$gourl|default=''}">
- <input type="hidden" name="aid" value="{$field.aid|default='0'}">
- <input type="hidden" name="editor_addonFieldExt" id="editor_addonFieldExt" value="">
- <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
- {include file="public/callback_page_2" /}<!-- 返回按钮 -->
- </div>
- </div>
- </form>
- </div>
- <script type="text/javascript">
- layui.use('laydate', function() {
- var laydate = layui.laydate;
-
- laydate.render({
- elem: '#add_time'
- ,type: 'datetime'
- });
- })
- $(function () {
-
- try {
- var web_citysite_open = {$global['web_citysite_open']|default=0};
- if (web_citysite_open > 0) {
- var province_id = {$field.province_id|default=0};
- var city_id = {$field.city_id|default=0};
- var area_id = {$field.area_id|default=0};
- if (province_id > 0) {
- set_city_list(city_id);
- }
- if (city_id > 0) {
- set_area_list(area_id);
- }
- }
- }catch(e){}
-
- //选项卡切换列表
- $('.tab-base').find('.tab').click(function(){
- $('.tab-base').find('.tab').each(function(){
- $(this).removeClass('current');
- });
- $(this).addClass('current');
- var tab_index = $(this).data('index');
- $(".tab_div_1, .tab_div_2, .tab_div_3, .tab_div_4").hide();
- $(".tab_div_"+tab_index).show();
- layer.closeAll();
- });
-
- $('input[name=is_jump]').click(function(){
- if ($(this).is(':checked')) {
- $('.dl_jump').show();
- } else {
- $('.dl_jump').hide();
- }
- });
-
- var dftypeid = {$field.typeid|default='0'};
- $('#typeid').change(function(){
- var current_channel = $(this).find('option:selected').data('current_channel');
- if (0 < $(this).val() && {$channeltype} != current_channel) {
- showErrorMsg('请选择对应模型的栏目!');
- $(this).val(dftypeid);
- } else if ({$channeltype} == current_channel) {
- layer.closeAll();
- }
- var aid = $("input[name=aid]").val();
- GetAddonextitem(1, $(this).val(), {$channeltype}, aid, true);
- });
-
- $(document).click(function(){
- $('#often_tags').hide();
- $('#often_tags_input').hide();
- event.stopPropagation();
- });
-
- $('#often_tags').click(function(){
- $('#often_tags').show();
- event.stopPropagation();
- });
- });
-
- function change_prom_type(val) {
- if ( val == 1 ){
- $("input[name=prom_type_vir]:eq(0)").attr("checked",'checked');
- $("#fahuoxingshi").show();
- } else if ( val == 2 ){
- $("#wangpanxiazai").hide();
- $("#wenbenneirong").hide();
- } else if ( val == 3 ){
- $("#wangpanxiazai").show();
- $("#wenbenneirong").hide();
- } else if( val == 4 ){
- $("#wangpanxiazai").hide();
- $("#wenbenneirong").show();
- }
- else {
- $("#wangpanxiazai").hide();
- $("#wenbenneirong").hide();
- $("#fahuoxingshi").hide();
- }
- }
-
- // 判断输入框是否为空
- function check_submit(){
- if($.trim($('input[name=title]').val()) == ''){
- $($('.tab-base').find('.tab')[0]).trigger('click');
- showErrorMsg('标题不能为空!');
- $('input[name=title]').focus();
- return false;
- }
- if ($('#typeid').val() == 0) {
- $($('.tab-base').find('.tab')[0]).trigger('click');
- showErrorMsg('请选择栏目…!');
- $('#typeid').focus();
- return false;
- }
- if ($('input[name=prom_type]:checked').val() == 1) {
- if($('input[name=prom_type_vir]:checked').val() == 2 && $.trim($('input[name=netdisk_url]').val()) == ''){
- $($('.tab-base').find('.tab')[0]).trigger('click');
- showErrorMsg('网盘地址不能为空!');
- $('input[name=netdisk_url]').focus();
- return false;
- }
- if($('input[name=prom_type_vir]:checked').val() == 3 && $.trim($('textarea[name=text_content]').val()) == ''){
- $($('.tab-base').find('.tab')[0]).trigger('click');
- showErrorMsg('虚拟文本内容不能为空!');
- $('textarea[name=text_content]').focus();
- return false;
- }
- }
-
- var htmlfilename = $.trim($('input[name=htmlfilename]').val());
- if (htmlfilename != '') {
- var exp = /^\d{1,}$/;
- if (exp.test(htmlfilename)) {
- showErrorAlert('自定义文件名不能纯数字,会与文档ID冲突!');
- $('input[name=htmlfilename]').focus();
- return false;
- }
- }
-
- layer_loading('正在处理');
- if(!ajax_check_htmlfilename())
- {
- layer.closeAll();
- showErrorMsg('同栏目下,自定义文件名已存在!');
- $('input[name=htmlfilename]').focus();
- return false;
- }
- setTimeout(function (){
- editor_auto_210607();
- $('#post_form').submit();
- }, 1);
- }
-
- function img_call_back(fileurl_tmp)
- {
- $("#litpic_local").val(fileurl_tmp);
- $("#img_a").attr('href', fileurl_tmp);
- $("#img_i").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
- $("input[name=is_litpic]").attr('checked', true); // 自动勾选属性[图片]
- }
-
- // 上传产品相册回调函数
- function proimg_call_back(paths){
- var last_div = $(".images_upload_tpl").html();
- for (var i=0;i<paths.length ;i++ )
- {
- if ($(".sort-list-img .images_upload_html").length > 0) {
- $(".sort-list-img .images_upload_html:last").after(last_div); // 插入一个 新图片
- } else {
- $(".sort-list-img .images_upload:last").before(last_div); // 插入一个 新图片
- }
- $(".sort-list-img .images_upload_html:last").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
- $(".sort-list-img .images_upload_html:last").find('img').attr('src',paths[i]);// 修改他的图片路径
- $(".sort-list-img .images_upload_html:last").find('a:eq(1)').attr('onclick',"ClearPicArr2(this,'"+paths[i]+"')").text('');
- $(".sort-list-img .images_upload_html:last").find('input').val(paths[i]); // 设置隐藏域 要提交的值
- }
- }
-
- /*
- * 上传之后删除组图input
- * @access public
- * @val string 删除的图片input
- */
- function ClearPicArr2(obj,path)
- {
- var aid = "{$field.aid|default='0'}";
- // 删除数据库记录
- $.ajax({
- type:'POST',
- url:"{:url('Product/del_proimg')}",
- data:{filename:path,_ajax:1,aid:aid},
- success:function(){
- $(obj).parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
- $.ajax({
- type:'POST',
- url:"{:url('Uploadimgnew/delupload')}",
- data:{action:"del", filename:path,_ajax:1},
- success:function(){}
- });
- }
- });
- }
-
- /** 以下 产品参数相关 js*/
- $(document).ready(function(){
- // 产品栏目切换时 ajax 调用 返回不同的属性输入框
- $("#typeid").change(function(){
- get_attr_input();
- });
- // 触发产品栏目
- // $("#typeid").trigger('change');
- });
-
- // 产品栏目切换时 ajax 调用 返回不同的属性输入框
- function get_attr_input()
- {
- var aid = $("input[name=aid]").val();
- var typeid = $("#typeid").val();
- if (parseInt(typeid) < 1) {
- return false;
- }
- $('#product_attr_table').html('<div style="color: red;font-size: 12px;text-align: center;">加载中……</div>');
- // 产品栏目切换时 ajax 调用 返回不同的属性输入框
- $.ajax({
- type:'GET',
- data:{aid:aid,typeid:typeid,_ajax:1},
- url:"{:url('Product/ajax_get_attr_input')}",
- success:function(data){
- $("#product_attr_table").html('').append(data);
- },
- error: function(e){
- $('#product_attr_table').html('<div style="color: red;font-size: 12px;text-align: center;">加载失败,点击此处<a href="javascript:void(0);" onClick="get_attr_input();">刷新</a></div>');
- }
- });
- }
-
- /** 以下 图集相册的拖动排序相关 js*/
-
- $( ".sort-list-img" ).sortable({
- start: function( event, ui) {
-
- }
- ,stop: function( event, ui ) {
- // var rdata = '', url="{:url('Product/ajax_sort_proimg')}";
- // var container = $(ui.item).closest("TB");
- // var LIs = $(container).find("DIV");
- // $(LIs).each(function(){
- // console.log($(this))
- // rdata += $(this).attr('rel') + ',' + $(this).index() + '|';
- // });
- // rdata = rdata.substr(0, (rdata.length-1));
- // console.log(rdata)
- // $.post(url, {str:rdata}, function(){
-
- // });
- }
- });
- //因为他们要拖动,所以尽量设置他们的文字不能选择。
- // $( ".sort-list-img" ).disableSelection();
- </script>
- <script>
- try{
- var mt20_1649209614 = sessionStorage.getItem("mt20_1649209614");
- if (mt20_1649209614 == 1){
- $("#geduan_div").removeClass("h10");
- }else{
- $("#geduan_div").addClass("h10");
- }
- }catch(e){}
- </script>
- {include file="public/footer" /}
|