1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447 |
- {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/add')}" 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="" id="title" class="input-txt" maxlength="200" {eq name="$channelRow.is_repeat_title" value="0"} oninput="check_title_repeat(this,0);" {/eq}>
-
- 副标题:<input type="text" name="subtitle" value="" id="subtitle" class="w200">
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label><em>*</em>栏目分类</label> </dt>
- <dd class="opt">
- <select name="typeid" id="typeid">
- <option value="0">请选择栏目…</option>
- {$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="" class="input-txt" onkeyup="this.value=this.value.replace(/[^\d\,]/g,'');" onpaste="this.value=this.value.replace(/[^\d\,]/g,'');">
- <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"></div>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label>文档属性</label> </dt>
- <dd class="opt">
- {volist name="archives_flags" id="vo"}
- <label><input type="checkbox" name="{$vo.flag_fieldname}" value="1">{$vo.flag_name}<!-- [{$vo.flag_attr}] --></label>
- {/volist}
- <span class="err"></span>
- <p class="notic">如需管理,请点击右上角设置与帮助按钮</p>
- </dd>
- </dl>
- <dl class="row none dl_jump">
- <dt class="tit"> <label for="jumplinks">跳转网址</label> </dt>
- <dd class="opt">
- <input type="text" value="" 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="" 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="add" 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="$Request.param.province_id" value="$vo.id" } selected="true" {/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">
- <span class="show">
- <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="javascript:void(0);">
- <i id="img_i" class="fa fa-picture-o" onmouseover="" onmouseout="layer.close(layer_tips);"></i>
- </a>
- </span>
- <span class="type-file-box">
- <input type="text" id="litpic_local" name="litpic_local" value="" 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="" placeholder="http://" class="input-txt" onKeyup="keyupRemote(this, 'litpic');" style="display: none;">
-
- <label><input type="checkbox" name="is_remote" id="is_remote" value="1" 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"> <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']"}
- {empty name="$shopConfig['shop_type']"}<input type="hidden" name="prom_type" value="0"/>{/empty}
-
- {eq name="$shopConfig['shop_type']" value="1"}
- <input type="hidden" name="prom_type" value="1"/>
- <dl class="row" id="fahuoxingshi" >
- <dt class="tit"> <label for="fahuo">发货形式</label> </dt>
- <dd class="opt">
- <label> <input type="radio" name="prom_type_vir" value="1" onclick="change_prom_type(2)" checked="checked" />手动发货 </label>
-
- <label> <input type="radio" name="prom_type_vir" value="2" onclick="change_prom_type(3)"/>网盘下载 </label>
-
- <label> <input type="radio" name="prom_type_vir" value="3" onclick="change_prom_type(4)"/>文本内容 </label>
- </dd>
- </dl>
- <div id="wangpanxiazai" class="none">
- <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" 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" 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" id="unzip_pwd" class="input-txt"> </dd>
- </dl>
- </div>
- <dl class="row none" id="wenbenneirong">
- <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;"></textarea>
- </dd>
- </dl>
- {/eq}
-
- {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)" checked="checked"/>普通产品 </label>
-
- <label> <input type="radio" name="prom_type" value="1" onclick="change_prom_type(1)"/>虚拟产品 </label>
- </dd>
- </dl>
- <dl class="row none" id="fahuoxingshi">
- <dt class="tit"> <label for="fahuo">发货形式</label> </dt>
- <dd class="opt">
- <label> <input type="radio" name="prom_type_vir" value="1" onclick="change_prom_type(2)" checked="checked"/>手动发货 </label>
-
- <label> <input type="radio" name="prom_type_vir" value="2" onclick="change_prom_type(3)"/>网盘下载 </label>
-
- <label> <input type="radio" name="prom_type_vir" value="3" onclick="change_prom_type(4)"/>文本内容 </label>
- </dd>
- </dl>
- <div id="wangpanxiazai" class="none">
- <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" class="input-txt" placeholder="http://">
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label for="netdisk_pwd">提取码</label> </dt>
- <dd class="opt"> <input type="text" name="netdisk_pwd" 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" id="unzip_pwd" class="input-txt"> </dd>
- </dl>
- </div>
- <dl class="row none" id="wenbenneirong">
- <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;"></textarea>
- </dd>
- </dl>
- {/eq}
- {/if}
-
- {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" checked="checked" onclick="SpecTypeSelect(1);">单规格</label>
- <label><input type="radio" id="spec_type2" name="spec_type" value="2" onclick="SpecTypeSelect(2);">多规格</label>
- </dd>
- </dl>
- <dl class="row spec_type_2" style="display: none;">
- <dt class="tit"> <label for="users_price"></label> </dt>
- <dd class="opt">
- <div>
- <div id='SpecSelectName'></div>
- <input type="hidden" id="spec_mark_id_arr">
- <input type="hidden" id="maxPresetMarkID" value="{$maxPresetMarkID}">
- <div id="addSpecButton">
- <a href="JavaScript:void(0);" id="addCustomSpec" data-value="0" onclick="addCustomSpec(this);" class="ncap-btn ncap-btn-green ml15">新增规格</a>
-
- <select class="preset-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><br/>
- </div>
- </dd>
- </dl>
- <dl class="row spec_type_2" style="display: none;">
- <dt class="tit"> <label for="users_price">价格/库存</label> </dt>
- <dd class="opt"> <div id='SpecTempLateDiv'></div> </dd>
- </dl>
- {/if}
- {/if}
-
- {if condition="!empty($ifcontrolRow['users_price'])"}
- <dl class="row spec_type_1">
- <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" style="width: 10%;" placeholder="原价" 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">
- <dt class="tit"> <label>会员折扣价</label> </dt>
- <dd class="opt">
- <label> <input type="radio" name="users_discount_type" value="0" onclick="selectDiscountType(0)" checked="checked"/>系统默认 </label>
-
- <label> <input type="radio" name="users_discount_type" value="1" onclick="selectDiscountType(1)"/>指定会员级别 </label>
-
- <label> <input type="radio" name="users_discount_type" value="2" onclick="selectDiscountType(2)"/>不参与 </label>
-
- <!-- 会员折扣模板框架 -->
- <div id="usersDiscountPrice" style="display: none; padding-top: 10px;"></div>
- </dd>
- </dl>
- <script type="text/javascript">
- var usersDiscountAid = 0;
- var usersDiscountType = 0;
- // 选择会员折扣方式
- function selectDiscountType(value) {
- if (1 === parseInt(value)) {
- if (parseInt(usersDiscountType) !== parseInt(value)) {
- getUsersDiscountPriceTpl();
- }
- } else {
- usersDiscountType = value;
- $('#usersDiscountPrice').hide();
- }
- }
-
- // 获取会员折扣价格模板
- 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').show().html(res.data);
- } 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">
- <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="99999">
- <label> <input type="checkbox" name="stock_show" value="1" checked="checked"> 页面显示商品库存 </label>
- </dd>
- </dl>
- {if condition="!isset($shopConfig['shop_open_spec']) || 0 == $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 RefreshPresetUrl = "{:url('Shop/refresh_preset_value')}";
-
- // 初始化规格,清除多余规格数据
- AjaxInitializationSpec();
- function AjaxInitializationSpec() {
- $.ajax({
- type: 'post',
- url : GetHtmlUrl,
- data: {initialization: true, _ajax: 1},
- dataType : 'json',
- });
- }
-
- // 自定增加一个自定义规格
- $('#addCustomSpec').click();
- // 自定义规格
- 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: {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: {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: {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: {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: {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: {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();
- }
- }
- });
- }
-
- // 规格库删除规格值时,同步更新页面上的规格信息
- function RefreshPresetValue(preset_id, preset_mark_id) {
- $.ajax({
- type : 'post',
- url : RefreshPresetUrl,
- data : {preset_id:preset_id, preset_mark_id:preset_mark_id, _ajax:1},
- dataType : 'json',
- success : function(res){
- if (1 == res.code) {
- // 删除规格值
- $('#preset-bt2_'+preset_id).remove();
- if (res.data.DelAllPreset) {
- // 删除整个规格名称
- $('#preset_'+preset_mark_id).remove();
- }
- if (res.data.HtmlTable) {
- // 加载规格框架
- $('#SpecTempLateDiv').html(res.data.HtmlTable);
- // 合并单元格
- MergeCells();
- }
- }
- },
- error : function(e) {
- layer.closeAll();
- layer.alert(e.responseText, {icon: 5});
- }
- });
- }
-
- // 生成选中规格名称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: {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: {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: {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: {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 BulkSetPrice(obj) {
- layer.prompt({
- title: false,
- shade: layer_shade,
- formType: 3,
- id: 'BulkSetPrice',
- btn: ['确定', '关闭'],
- closeBtn: 0,
- 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());
- });
- // 取出最小值
- var MinValue = Math.min.apply(Math, UsersPriceArray);
- $('#users_price').val(MinValue);
- }
-
- // 批量设置价格
- function BulkSetStock(obj) {
- layer.prompt({
- title: false,
- shade: layer_shade,
- formType: 3,
- id: 'BulkSetStock',
- btn: ['确定', '关闭'],
- closeBtn: 0,
- 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);
- $('#stock_count').attr('readonly','readonly');
- }
-
- // 合并单元格
- 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";
- }
- }
- }
- }
- }
- </script>
- {/if}
- <dl class="row" 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="" 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_add" /}
- {else /}
- <!-- <dl class="row">
- <dt class="tit"> <label>参数类型</label> </dt>
- <dd class="opt">
- <label><input type="radio" name="param_type" value="1" checked="checked" onclick="paramType(1);">系统参数</label>
-
- <label><input type="radio" name="param_type" value="2" onclick="paramType(2);">自定义参数</label>
- </dd>
- </dl> -->
- <dl class="row">
- <dt class="tit"> <label>商品参数</label> </dt>
- <dd class="opt">
- <div id="system_param" style="display: block;">
- <div class="selectPro_arg">
- <select name="attrlist_id" id="attrlist_id" onchange="AttrListSelect(this);">
- <option value="0">请选择参数</option>
- {volist name="AttrList" id="vo"}
- <option value="{$vo.list_id}">{$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;"></div>
- <div id='customParam' style="margin: 1px;"></div>
- </div>
-
- <!-- <div id="custom_param" style="display: none;">
- <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">
- <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>
- </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+']" placeholder="输入参数名称"> </dt>'+
- '<dd class="opt pl5">'+
- '<input type="text" size="40" name="attr_value['+maxAttrID+']" placeholder="输入参数值">'+
- '<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" 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;"></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();"></textarea>
- <span class="err"></span>
- <p class="notic">一般不超过100个字符,不填写时系统自动提取正文的前100个字符</p>
- <p class="notic2 none" id="beenWritten">你已输入<span id="beenWrittenStr">0</span>个字符</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="text" value="{$Think.session.admin_info.pen_name|default='小编'}" 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="{$system_originlist_0}" 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="{$rand_arcclick}" name="click" id="click" class="input-txt"> </dd>
- </dl>
- <dl class="row">
- <dt class="tit"> <label>阅读权限</label> </dt>
- <dd class="opt">
- <select name="arcrank" id="arcrank" {if $admin_info.role_id>0&&$auth_role_info.check_oneself<1} disabled="disabled" {/if}>
- {volist name="arcrank_list" id="vo"}
- <option value="{$vo.rank}" {if $admin_info.role_id>0&&$auth_role_info.check_oneself<1&&$vo.rank==-1} selected="selected" {/if}>{$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="{php}echo date('Y-m-d H:i:s'){/php}" 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 for="htmlfilename">自定义文件名</label> </dt>
- <dd class="opt">
- <input type="text" {notin name='$seo_pseudo' value='2,3'}readonly="readonly" title="动态模式下不支持自定义文档url"{/notin} value="" 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="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};
- var site_province_id = {$site_province_id|default=0};
- var site_city_id = {$site_city_id|default=0};
- var site_area_id = {$site_area_id|default=0};
- if (web_citysite_open > 0 && site_province_id > 0) {
- $('select[name=province_id]').val(site_province_id);
- set_city_list(site_city_id);
- set_area_list(site_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 = {$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();
- }
- GetAddonextitem(1, $(this).val(), {$channeltype}, 0, true);
- });
-
- $(document).click(function(){
- $('#often_tags').hide();
- $('#often_tags_input').hide();
- event.stopPropagation();
- });
-
- $('#often_tags').click(function(){
- $('#often_tags').show();
- event.stopPropagation();
- });
-
- $('input[name=tags]').keyup(function(){
- var tags = $.trim($(this).val());
- $('#seo_keywords').val(tags);
- });
- });
-
- 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)
- {
- $(obj).parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
- $.ajax({
- type:'POST',
- url:"{:url('Uploadimgnew/delupload')}",
- data:{action:"del", filename:path,_ajax:1},
- success:function(){}
- });
- }
-
- /** 以下 产品相册的拖动排序相关 js*/
- $( ".sort-list-img" ).sortable({
- start: function( event, ui) {
- }
- ,stop: function( event, ui ) {
- }
- });
- //因为他们要拖动,所以尽量设置他们的文字不能选择。
- // $( ".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" /}
|