Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

edit.htm 107KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781
  1. {include file="public/layout" /}
  2. {eq name="$editor.editor_select" value="1"}
  3. {load href="__PUBLIC__/plugins/Ueditor/ueditor.config.js" /}
  4. {load href="__PUBLIC__/plugins/Ueditor/ueditor.all.min.js" /}
  5. {load href="__PUBLIC__/plugins/Ueditor/lang/zh-cn/zh-cn.js" /}
  6. {else/}
  7. {load href="__PUBLIC__/plugins/ckeditor/ckeditor.js" /}
  8. {/eq}
  9. <body class="bodysy-w">
  10. <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
  11. <div id="append_parent"></div>
  12. <div id="ajaxwaitid"></div>
  13. <div id="geduan_div" class="h10"></div>
  14. <div id="page_div" class="page min-hg-c mb-20" style="min-width:auto;box-shadow:none;">
  15. <div class="fixed-bar">
  16. <div class="item-title">
  17. {include file="public/callback_page_1" /}<!-- 返回箭头 -->
  18. <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>
  19. <ul class="tab-base nc-row">
  20. <li><a href="javascript:void(0);" data-index='1' class="tab current"><span>基础内容</span></a></li>
  21. <li><a href="javascript:void(0);" data-index='2' class="tab"><span>产品参数</span></a></li>
  22. <li><a href="javascript:void(0);" data-index='3' class="tab"><span>SEO优化</span></a></li>
  23. <li><a href="javascript:void(0);" data-index='4' class="tab"><span>更多设置</span></a></li>
  24. <!-- #weapp_demontrate_li# -->
  25. <!-- #weapp_li# -->
  26. </ul>
  27. </div>
  28. </div>
  29. <form class="form-horizontal" id="post_form" action="{:url('Product/edit')}" method="post">
  30. <!-- 常规信息 -->
  31. <div class="ncap-form-default tab_div_1">
  32. <dl class="row">
  33. <dt class="tit"> <label for="title"><em>*</em>文档标题</label> </dt>
  34. <dd class="opt">
  35. <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}>
  36. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  37. 副标题:<input type="text" name="subtitle" value="{$field.subtitle}" id="subtitle" class="w200">
  38. </dd>
  39. </dl>
  40. <dl class="row">
  41. <dt class="tit"> <label for="typeid"><em>*</em>栏目分类</label> </dt>
  42. <dd class="opt">
  43. <input type="hidden" name="attr[typeid]" id="attr_typeid" value="{$field.typeid}">
  44. <select name="typeid" id="typeid">{$arctype_html}</select>
  45. <span class="err"></span>
  46. <p class="notic">谨慎切换,自定义字段的内容会随着栏目切换而清空,在保存之前不受影响!</p>
  47. </dd>
  48. </dl>
  49. <dl class="row {empty name='$global.web_stypeid_open'} none {/empty}">
  50. <dt class="tit"> <label for="stypeid">副栏目分类</label> </dt>
  51. <dd class="opt">
  52. <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="">
  53. &nbsp;<a href="javascript:void(0);" data-channel="{$channeltype}" onclick="select_stypeid(this);" class="ncap-btn ncap-btn-green">选择副栏目</a>
  54. <span class="err"></span>
  55. <p class="notic">支持同频道模型的栏目</p>
  56. <div id="stypeid_txt" class="pt5">
  57. {volist name='$stypeid_arr' id='vo'}{gt name='$key' value='0'}&nbsp;&nbsp;|&nbsp;&nbsp;{/gt}<span>{$vo.typename}</span>{/volist}
  58. </div>
  59. </dd>
  60. </dl>
  61. <dl class="row">
  62. <dt class="tit"> <label>文档属性</label> </dt>
  63. <dd class="opt">
  64. {volist name="archives_flags" id="vo"}
  65. <input type="hidden" name="attr[{$vo.flag_fieldname}]" {if $field[$vo.flag_fieldname] == 1}value="1"{else/}value="0"{/if}>
  66. <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>&nbsp;
  67. {/volist}
  68. <span class="err"></span>
  69. <p class="notic">如需管理,请点击右上角设置与帮助按钮</p>
  70. </dd>
  71. </dl>
  72. <dl class="row {if condition='$field.is_jump != 1'}none{/if} dl_jump">
  73. <dt class="tit"> <label for="jumplinks">跳转网址</label> </dt>
  74. <dd class="opt">
  75. <input type="text" value="{$field.jumplinks}" name="jumplinks" id="jumplinks" class="input-txt" placeholder="http://">
  76. <span class="err"></span>
  77. <p class="notic">请输入完整的URL网址(包含http或https),设置后访问该条信息将直接跳转到设置的网址</p>
  78. </dd>
  79. </dl>
  80. <dl class="row" style="z-index: 2;">
  81. <dt class="tit"> <label>文档标签</label> </dt>
  82. <dd class="opt">
  83. <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,',');">&nbsp;
  84. <a href="javascript:void(0);" onclick="get_common_tagindex(this);">显示常用标签</a>&nbsp;<img id="tag_loading" src="__STATIC__/common/images/loading.gif" style="display: none;" />
  85. <div class="often_tags" id="often_tags" data-opt="edit" style="display: none;"></div>
  86. <div class="often_tags" id="often_tags_input" style="display: none;"></div>
  87. <input type="hidden" id="tags_click_count">
  88. </dd>
  89. </dl>
  90. <dl class="row {empty name='$global.web_citysite_open'} none {/empty} ">
  91. <dt class="tit"> <label>所属区域</label> </dt>
  92. <dd class="opt">
  93. <select name="province_id" id="province_id" onchange="set_city_list(0);">
  94. <option value="0">全国</option>
  95. {volist name=':get_site_province_list()' id='vo'}
  96. <option value="{$vo.id}" {eq name="$field.province_id" value="$vo.id" } selected {/eq} >{$vo.name}</option>
  97. {/volist}
  98. </select>
  99. <select name="city_id" id="city_id" class="none ml5" onchange="set_area_list(0);">
  100. <option value="">--请选择--</option>
  101. </select>
  102. <select name="area_id" id="area_id" class="none ml5">
  103. <option value="">--请选择--</option>
  104. </select>
  105. </dd>
  106. </dl>
  107. <dl class="row">
  108. <dt class="tit"> <label>封面图片</label> </dt>
  109. <dd class="opt">
  110. <div class="input-file-show div_litpic_local" {neq name="$field.is_remote" value="0"}style="display: none;"{/neq}>
  111. <span class="show">
  112. <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="{$field.litpic_local|default='javascript:void(0);'}">
  113. <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>
  114. </a>
  115. </span>
  116. <span class="type-file-box">
  117. <input type="text" id="litpic_local" name="litpic_local" value="{$field.litpic_local|default=''}" class="type-file-text" autocomplete="off">
  118. <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
  119. <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图,点击按钮选择文件并提交表单后上传生效">
  120. </span>
  121. </div>
  122. <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}>
  123. &nbsp;
  124. <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>
  125. <span class="err"></span>
  126. <p class="notic">当没有手动上传图片时候,会自动提取正文的第一张图片作为缩略图</p>
  127. </dd>
  128. </dl>
  129. <dl class="row <!-- #weapp_diy911873092_product_none# -->">
  130. <dt class="tit"> <label>图片集</label> </dt>
  131. <dd class="opt">
  132. <div class="tab-pane pics" id="tab_proimg">
  133. <table class="table table-bordered">
  134. <tbody>
  135. <tr>
  136. <td >
  137. <div class="sort-list-img">
  138. {volist name="proimg_list" id="vo" key="k"}
  139. <div class="images_upload images_upload_html" style="display:inline-block;">
  140. <div class="images_upload_box">
  141. <input type="hidden" name="proimg[]" value="{$vo['image_url']}">
  142. <a href="{$vo['image_url']}" onclick="" class="upimg" target="_blank" title="拖动修改排序">
  143. <img data-original="{$vo['image_url']}">
  144. </a>
  145. <a href="javascript:void(0)" onclick="ClearPicArr2(this,'{$vo['image_url']}')" class="delect" title="删除"></a>
  146. </div>
  147. <textarea rows="5" cols="60" name="imgintro[]" placeholder="图片注释">{$vo.intro}</textarea>
  148. </div>
  149. {/volist}
  150. <div class="images_upload"></div>
  151. </div>
  152. <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>
  153. </td>
  154. </tr>
  155. </tbody>
  156. </table>
  157. </div>
  158. <!-- 上传图片显示的样板 start -->
  159. <div class="images_upload_tpl none">
  160. <div class="images_upload images_upload_html">
  161. <div class="images_upload_box">
  162. <input type="hidden" name="proimg[]" value="" />
  163. <a href="javascript:void(0);" onClick="" class="upimg" title="拖动修改排序">
  164. <img src="__STATIC__/admin/images/add-button.jpg"/>
  165. </a>
  166. <a href="javascript:void(0)" class="delect" title="删除">&nbsp;&nbsp;</a>
  167. </div>
  168. <textarea rows="5" cols="60" name="imgintro[]" placeholder="图片注释"></textarea>
  169. </div>
  170. </div>
  171. <!-- 上传图片显示的样板 end -->
  172. </dd>
  173. </dl>
  174. {if condition="!empty($shopConfig['shop_open']) && 1 == $shopConfig['shop_open']"}
  175. <!-- 产品价格属性 -->
  176. {eq name="$shopConfig['shop_type']" value="2"}
  177. <dl class="row">
  178. <dt class="tit"> <label>产品类型</label> </dt>
  179. <dd class="opt">
  180. <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>
  181. &nbsp;
  182. <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>
  183. </dd>
  184. </dl>
  185. {else/}
  186. {empty name="$IsSame"}
  187. <input type="hidden" name="prom_type" value="{$field.prom_type}"/>
  188. {else/}
  189. <dl class="row">
  190. <dt class="tit"> <label>产品类型</label> </dt>
  191. <dd class="opt">
  192. <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>
  193. &nbsp;
  194. <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>
  195. </dd>
  196. </dl>
  197. {/empty}
  198. {/eq}
  199. {/if}
  200. <dl class="row" id="fahuoxingshi" {empty name="$field.prom_type"} style="display: none;" {/empty}>
  201. <dt class="tit"> <label>发货形式</label> </dt>
  202. <dd class="opt">
  203. <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>
  204. &nbsp;
  205. <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>
  206. &nbsp;
  207. <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>
  208. </dd>
  209. </dl>
  210. <div id="wangpanxiazai" {neq name="$field.prom_type" value="2"} style="display: none;" {/neq}>
  211. <dl class="row">
  212. <dt class="tit"> <label for="netdisk_url"><em>*</em>网盘地址</label> </dt>
  213. <dd class="opt">
  214. <input type="text" name="netdisk_url" id="netdisk_url" value="{$netdisk.netdisk_url|default=''}" class="input-txt" placeholder="http://">
  215. <span class="err"></span>
  216. <p class="notic">输入完整的URL网址(包含http或https)</p>
  217. </dd>
  218. </dl>
  219. <dl class="row">
  220. <dt class="tit"> <label for="netdisk_pwd">提取码</label> </dt>
  221. <dd class="opt">
  222. <input type="text" name="netdisk_pwd" value="{$netdisk.netdisk_pwd|default=''}" id="netdisk_pwd" class="input-txt">
  223. </dd>
  224. </dl>
  225. <dl class="row">
  226. <dt class="tit"> <label for="unzip_pwd">解压密码</label> </dt>
  227. <dd class="opt">
  228. <input type="text" name="unzip_pwd" value="{$netdisk.unzip_pwd|default=''}" id="unzip_pwd" class="input-txt">
  229. </dd>
  230. </dl>
  231. </div>
  232. <dl class="row" id="wenbenneirong" {neq name="$field.prom_type" value="3"} style="display: none;" {/neq}>
  233. <dt class="tit"> <label for="text_content"><em>*</em>文本内容</label> </dt>
  234. <dd class="opt">
  235. <textarea rows="5" cols="80" id="text_content" name="text_content" style="width: 375px; height: 160px;">{$netdisk.text_content|default=''}</textarea>
  236. </dd>
  237. </dl>
  238. {if condition="1 == $shopConfig['shop_open'] && !empty($ifcontrolRow['users_price'])"}
  239. {if condition="!isset($shopConfig['shop_open_spec']) || 0 == $shopConfig['shop_open_spec']"}
  240. <!-- 待添加后续逻辑... -->
  241. {else/}
  242. <dl class="row">
  243. <dt class="tit"> <label>商品规格</label> </dt>
  244. <dd class="opt">
  245. <label> <input type="radio" id="spec_type1" name="spec_type" value="1" {empty name="$useSpecNum"}checked="checked"{/empty} onclick="SpecTypeSelect(1);">单规格 </label>
  246. &nbsp;
  247. <label> <input type="radio" id="spec_type2" name="spec_type" value="2" {notempty name="$useSpecNum"}checked="checked"{/notempty} onclick="SpecTypeSelect(2);">多规格 </label>
  248. </dd>
  249. </dl>
  250. <dl class="row spec_type_2" {empty name="$useSpecNum"}style="display: none;"{/empty}>
  251. <dt class="tit"> <label></label> </dt>
  252. <dd class="opt">
  253. <div>
  254. <div id='SpecSelectName'>{volist name="SpecSelectName" id="vo"}{$vo}{/volist}</div>
  255. <input type="hidden" id="spec_mark_id_arr" value="{$spec_mark_id_arr}">
  256. <input type="hidden" id="maxPresetMarkID" value="{$maxPresetMarkID}">
  257. <div id="addSpecButton">
  258. <a href="JavaScript:void(0);" id="addCustomSpec" data-value="{$useSpecNum}" onclick="addCustomSpec(this);" class="ncap-btn ncap-btn-green ml15">新增规格</a>
  259. <select name="spec_value" id="spec_value" onchange="addPresetSpec(this)">
  260. <option value="0">从规格库提取</option>
  261. {volist name="preset_value" id="vo"}
  262. <option value="{$vo.preset_mark_id}">{$vo.preset_name}</option>
  263. {/volist}
  264. </select>
  265. </div>
  266. </div>
  267. </dd>
  268. </dl>
  269. <dl class="row spec_type_2" {empty name="$useSpecNum"}style="display: none;"{/empty}>
  270. <dt class="tit"> <label for="users_price">价格/库存</label> </dt>
  271. <dd class="opt"> <div id='SpecTempLateDiv'>{$HtmlTable}</div> </dd>
  272. </dl>
  273. {/if}
  274. {/if}
  275. {if condition="!empty($ifcontrolRow['users_price'])"}
  276. <dl class="row spec_type_1" {notempty name="$useSpecNum"}style="display: none;"{/notempty}>
  277. <dt class="tit"> <label for="users_price">{if condition="1 == $shopConfig['shop_open']"}<em>*</em>{/if}价格</label> </dt>
  278. <dd class="opt">
  279. <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,'')">
  280. </dd>
  281. </dl>
  282. {/if}
  283. {if condition="1 == $shopConfig['shop_open'] && !empty($ifcontrolRow['users_price'])"}
  284. <!-- 会员折扣价 -->
  285. <dl class="row spec_type_1" {notempty name="$useSpecNum"}style="display: none;"{/notempty}>
  286. <dt class="tit"> <label>会员折扣价</label> </dt>
  287. <dd class="opt">
  288. <label> <input type="radio" name="users_discount_type" value="0" onclick="selectDiscountType(0)" {if condition="empty($field.users_discount_type)"} checked="checked" {/if}/>系统默认 </label>
  289. &nbsp;
  290. <label> <input type="radio" name="users_discount_type" value="1" onclick="selectDiscountType(1)" {if condition="1 === $field.users_discount_type"} checked="checked" {/if}/>指定会员级别 </label>
  291. &nbsp;
  292. <label> <input type="radio" name="users_discount_type" value="2" onclick="selectDiscountType(2)" {if condition="2 === $field.users_discount_type"} checked="checked" {/if}/>不参与 </label>
  293. &nbsp;
  294. <!-- 会员折扣模板框架 -->
  295. <div id="usersDiscountPrice" style="display: none; padding-top: 10px;"></div>
  296. </dd>
  297. </dl>
  298. <script type="text/javascript">
  299. var usersDiscountAid = {$field.aid|default='0'};
  300. var usersDiscountType = {$field.users_discount_type|default='0'};
  301. // 选择会员折扣方式
  302. function selectDiscountType(value) {
  303. if (1 === parseInt(value)) {
  304. if (parseInt(usersDiscountType) !== parseInt(value)) {
  305. getUsersDiscountPriceTpl();
  306. }
  307. } else {
  308. usersDiscountType = value;
  309. $('#usersDiscountPrice').hide();
  310. }
  311. }
  312. // 如果选择的是指定会员级别则自动执行
  313. if (1 === parseInt(usersDiscountType)) getUsersDiscountPriceTpl();
  314. // 获取会员折扣价格模板
  315. function getUsersDiscountPriceTpl() {
  316. var users_price = $('#users_price').val() ? $('#users_price').val() : 0;
  317. $.ajax({
  318. type: 'post',
  319. url : "{:url('ShopProduct/get_users_discount_price_tpl', ['_ajax'=>1])}",
  320. data: {aid: usersDiscountAid, users_price: users_price},
  321. dataType: 'json',
  322. success: function(res) {
  323. if (1 === parseInt(res.code)) {
  324. usersDiscountType = 1;
  325. $('#usersDiscountPrice').html(res.data);
  326. $('#usersDiscountPrice').show();
  327. } else {
  328. showErrorAlert(res.msg);
  329. }
  330. },
  331. error: function(e) {
  332. showErrorAlert(e.responseText);
  333. }
  334. });
  335. }
  336. // 批量设置价格
  337. function bulkSetUsersDiscountPrice() {
  338. layer.prompt({
  339. title: false,
  340. shade: layer_shade,
  341. formType: 3,
  342. id: 'usersDiscountPriceID',
  343. btn: ['确定', '关闭'],
  344. closeBtn: 0,
  345. success: function(layero, index){
  346. $("#usersDiscountPriceID").find('input').attr('placeholder', '批量设置价格');
  347. $("#usersDiscountPriceID").find('input').attr('onkeyup', "this.value=this.value.replace(/[^\\d.]/g,'')");
  348. $("#usersDiscountPriceID").find('input').attr('onpaste', "this.value=this.value.replace(/[^\\d.]/g,'')");
  349. }
  350. }, function(price, index){
  351. layer.close(index);
  352. $('.users_discount_price').val(price);
  353. });
  354. }
  355. </script>
  356. <dl class="row spec_type_1" {notempty name="$useSpecNum"}style="display: none;"{/notempty}>
  357. <dt class="tit"> <label for="stock_count">库存</label> </dt>
  358. <dd class="opt">
  359. <input type="text" name="stock_count" id="stock_count" style="width: 10%;" value="{$field.stock_count}" {notempty name="$useSpecNum"}readonly="readonly"{/notempty}>
  360. <label>
  361. <input type="checkbox" name="stock_show" value='1' {eq name="$field.stock_show" value="1"}checked{/eq}>页面显示商品库存
  362. </label>
  363. </dd>
  364. </dl>
  365. {if condition="empty($shopConfig['shop_open_spec'])"}
  366. <!-- 待添加后续逻辑... -->
  367. {else /}
  368. <script type="text/javascript">
  369. function SpecTypeSelect(spec_type) {
  370. var IsSpecData = $('#SpecTempLateDiv').html();
  371. if (1 == spec_type) {
  372. $('.spec_type_1').show();
  373. $('.spec_type_2').hide();
  374. $('#dl_virtual_sales').show();
  375. $('#users_price, #stock_count').removeAttr("readonly");
  376. if (IsSpecData && IsSpecData != ' ') {
  377. layer.confirm('<span style="color: red;">请注意:您已添加多规格,若切换单规格并保存商品,则清空多规格数据!</span>', {
  378. shade: layer_shade,
  379. area: ['480px', '190px'],
  380. move: false,
  381. title: '提示',
  382. btnAlign:'r',
  383. closeBtn: 3,
  384. btn: ['确定', '取消'] ,//按钮
  385. success: function () {
  386. $(".layui-layer-content").css('text-align', 'left');
  387. }
  388. }, function (index) {
  389. $('#spec_type1').attr('checked', 'checked');
  390. $('#spec_type2').removeAttr('checked');
  391. layer.close(index);
  392. }, function (index) {
  393. $('.spec_type_1').hide();
  394. $('.spec_type_2').show();
  395. $('#users_price, #stock_count').attr("readonly", "readonly");
  396. $('#spec_type1').removeAttr('checked');
  397. $('#spec_type2').attr('checked', 'checked');
  398. layer.close(index);
  399. });
  400. }
  401. } else {
  402. $('.spec_type_1').hide();
  403. $('.spec_type_2').show();
  404. $('#dl_virtual_sales').hide();
  405. $('#users_price, #stock_count').attr("readonly", "readonly");
  406. }
  407. }
  408. </script>
  409. <script type="text/javascript">
  410. // 规格列表管理
  411. var TemplateUrl = "{:url('Shop/spec_template')}";
  412. // 规格选择
  413. var SelectUrl = "{:url('Shop/spec_select')}";
  414. // 获取规格名称规格值框架URL
  415. var GetHtmlUrl = "{:url('Shop/assemble_spec_data')}";
  416. // 当规格库更新后,调用此方式及时更新选择规格名称的下拉框信息
  417. var GetPresetSpecUrl = "{:url('Shop/update_spec_info')}";
  418. // 同步更新规格库数据到产品规格中,单条操作
  419. var RefreshSpecUrl = "{:url('Shop/refresh_spec_value')}";
  420. var aid = "{$field.aid}";
  421. $(function () {
  422. var stock_count = 0;
  423. $('.stock_count').each(function(){
  424. stock_count +=+ $(this).val();
  425. })
  426. if (0 === stock_count) {
  427. stock_count = '{$field.stock_count}';
  428. }
  429. $('#stock_count').val(stock_count);
  430. // 取最小值价格
  431. UpPrice();
  432. // 合并单元格
  433. MergeCells();
  434. });
  435. // 自定义规格
  436. function addCustomSpec(obj) {
  437. // 本次使用的规格数量
  438. var specValue = $(obj).attr('data-value');
  439. if (3 <= specValue) {
  440. showErrorMsg('最多使用三种商品规格大类');
  441. return false;
  442. }
  443. // 自定义规格数量+1覆盖原值
  444. $(obj).attr('data-value', ++specValue);
  445. // if (3 == specValue) $('#addSpecButton').hide();
  446. // 创建一个自定义规格空数据和表格
  447. layer_loading('正在处理');
  448. $.ajax({
  449. type: 'post',
  450. data: {aid: aid, action: 'name', _ajax: 1},
  451. url : "{:url('ShopProduct/add_product_custom_spec')}",
  452. dataType: 'json',
  453. success: function(res) {
  454. layer.closeAll();
  455. if (1 == res.code) {
  456. // 最大的规格标记ID
  457. var maxSpecMarkID = res.data.spec_mark_id;
  458. // 规格框
  459. var html = [
  460. '<div class="prset-box">'+
  461. '<span class="set-preset-bt mr10" style="display: block;">'+
  462. '<input type="text" name="set_spec_name" class="zdy-ggname w150" placeholder="规格名称.." onchange="setSpecName(this, ' + maxSpecMarkID + ');">'+
  463. '<em onclick="setSpecNameClear(this, ' + maxSpecMarkID + ');">'+
  464. '<i class="fa fa-times-circle" title="关闭" style="margin-left: -20px; margin-top: 8px;"></i>'+
  465. '</em>'+
  466. '</span>'+
  467. '<span class="set-preset-box"></span>'+
  468. '<span class="set-preset-con">'+
  469. '<span class="set-preset-bt mr10">'+
  470. '<input type="hidden" value="' + res.data.spec_value_id + '">'+
  471. '<input type="text" class="zdy-ggshuzi w150" placeholder="规格值.." onchange="setSpecValue(this, ' + maxSpecMarkID + ');">'+
  472. '</span>'+
  473. '<a href="javascript:void(0);" onclick="addCustomSpecValue(this, ' + maxSpecMarkID + ');" class="preset-bt-shuzi mr10">+增加规格值</a>'+
  474. '</span>'+
  475. '</div>'
  476. ];
  477. $('#SpecSelectName').show().append(html);
  478. // 价格/库存HTML
  479. if (res.data.htmlTable) {
  480. // 加载规格框架
  481. $('#SpecTempLateDiv').html(res.data.htmlTable);
  482. // 合并单元格
  483. MergeCells();
  484. }
  485. } else {
  486. showErrorMsg(res.msg);
  487. }
  488. },
  489. error: function(e) {
  490. layer.closeAll();
  491. showErrorAlert(e.responseText);
  492. }
  493. });
  494. }
  495. // 输入完规格名称后执行
  496. function setSpecName(obj, spec_mark_id) {
  497. var set_spec_name = $(obj).val();
  498. if (spec_mark_id && set_spec_name) {
  499. $.ajax({
  500. type: 'post',
  501. dataType: 'json',
  502. data: {aid: aid, spec_mark_id: spec_mark_id, set_spec_name: set_spec_name},
  503. url : "{:url('ShopProduct/add_product_custom_spec_name', ['_ajax'=>1])}",
  504. success: function(res) {
  505. if (1 == res.code) {
  506. // 价格/库存HTML
  507. if (res.data.htmlTable) {
  508. // 加载规格框架
  509. $('#SpecTempLateDiv').html(res.data.htmlTable);
  510. // 合并单元格
  511. MergeCells();
  512. }
  513. } else {
  514. showErrorMsg(res.msg);
  515. }
  516. },
  517. error: function(e) {
  518. layer.closeAll();
  519. showErrorAlert(e.responseText);
  520. }
  521. });
  522. }
  523. }
  524. // 清除数据库指定数据
  525. function setSpecNameClear(obj, spec_mark_id) {
  526. if (spec_mark_id) {
  527. // 执行处理
  528. $.ajax({
  529. type: 'post',
  530. url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
  531. data: {aid: aid, spec_mark_id: spec_mark_id, del: 'name'},
  532. dataType: 'json',
  533. success: function(res) {
  534. // 删除当前点击规格块的顶级html
  535. $(obj).parent().parent().remove();
  536. // 如果存在则执行覆盖新的规格列表框
  537. if (res.data.htmlTable) {
  538. // 加载规格框架
  539. $('#SpecTempLateDiv').html(res.data.htmlTable);
  540. // 合并单元格
  541. MergeCells();
  542. }
  543. // 使用规格数量-1覆盖原值
  544. var specValue = $('#addCustomSpec').attr('data-value');
  545. $('#addCustomSpec').attr('data-value', --specValue);
  546. // 显示添加按钮
  547. // $('#addSpecButton').show();
  548. }
  549. });
  550. }
  551. }
  552. // 规格规格值
  553. function addCustomSpecValue(obj, spec_mark_id) {
  554. if (spec_mark_id) {
  555. layer_loading('正在处理');
  556. $.ajax({
  557. type: 'post',
  558. data: {aid: aid, spec_mark_id: spec_mark_id, action: 'value', _ajax: 1},
  559. url : "{:url('ShopProduct/add_product_custom_spec')}",
  560. dataType: 'json',
  561. success: function(res) {
  562. layer.closeAll();
  563. if (1 == res.code) {
  564. // 规格值HTML
  565. var html = [
  566. '<span class="set-preset-bt mr10">'+
  567. '<input type="hidden" value="' + res.data.spec_value_id + '">'+
  568. '<input type="text" class="zdy-ggshuzi w150" placeholder="规格值.." onchange="setSpecValue(this, ' + res.data.spec_mark_id + ');">'+
  569. '<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>'+
  570. '</span>'
  571. ];
  572. // 加载一个规格值 input
  573. $(obj).before(html);
  574. // 价格/库存HTML
  575. if (res.data.htmlTable) {
  576. // 加载规格框架
  577. $('#SpecTempLateDiv').html(res.data.htmlTable);
  578. // 合并单元格
  579. MergeCells();
  580. }
  581. } else {
  582. showErrorMsg(res.msg);
  583. }
  584. },
  585. error: function(e) {
  586. layer.closeAll();
  587. showErrorAlert(e.responseText);
  588. }
  589. });
  590. }
  591. }
  592. // 输入完规格值后执行
  593. function setSpecValue(obj, spec_mark_id) {
  594. // 指定的FormID
  595. var set_spec_value = $(obj).val();
  596. var spec_value_id = $(obj).prev().val();
  597. if (set_spec_value && spec_value_id && spec_mark_id) {
  598. $.ajax({
  599. type: 'post',
  600. dataType: 'json',
  601. data: {aid: aid, set_spec_value: set_spec_value, spec_value_id: spec_value_id, spec_mark_id: spec_mark_id},
  602. url : "{:url('ShopProduct/add_product_custom_spec_value', ['_ajax'=>1])}",
  603. success: function(res) {
  604. if (1 == res.code) {
  605. // 价格/库存HTML
  606. if (res.data.htmlTable) {
  607. // 加载规格框架
  608. $('#SpecTempLateDiv').html(res.data.htmlTable);
  609. // 合并单元格
  610. MergeCells();
  611. }
  612. } else {
  613. showErrorMsg(res.msg);
  614. }
  615. },
  616. error: function(e) {
  617. layer.closeAll();
  618. showErrorAlert(e.responseText);
  619. }
  620. });
  621. }
  622. }
  623. // 清除数据库指定数据
  624. function setSpecValueClear(obj) {
  625. // 当选对象
  626. var spec_mark_id = $(obj).attr('data-spec_mark_id');
  627. var spec_value_id = $(obj).attr('data-spec_value_id');
  628. // 执行处理
  629. $.ajax({
  630. type: 'post',
  631. url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
  632. data: {aid: aid, spec_mark_id: spec_mark_id, spec_value_id: spec_value_id, del: 'value'},
  633. dataType: 'json',
  634. success: function(res) {
  635. // 删除当前点击规格块的顶级html
  636. $(obj).parent().remove();
  637. // 如果存在则执行覆盖新的规格列表框
  638. if (res.data.htmlTable) {
  639. // 加载规格框架
  640. $('#SpecTempLateDiv').html(res.data.htmlTable);
  641. // 合并单元格
  642. MergeCells();
  643. }
  644. }
  645. });
  646. }
  647. // 生成选中规格名称html并更新加载规格值
  648. function addPresetSpec(obj) {
  649. var preset_mark_id = $(obj).val();
  650. if (0 === parseInt(preset_mark_id)) return false;
  651. // 本次使用的规格数量
  652. var specValue = $('#addCustomSpec').attr('data-value');
  653. if (3 <= specValue) {
  654. showErrorMsg('最多使用三种商品规格大类');
  655. return false;
  656. }
  657. // 自定义规格数量+1覆盖原值
  658. $('#addCustomSpec').attr('data-value', ++specValue);
  659. // if (3 == specValue) $('#addSpecButton').hide();
  660. layer_loading('正在处理');
  661. $.ajax({
  662. type: 'post',
  663. url : "{:url('ShopProduct/add_product_custom_spec')}",
  664. data: {aid: aid, preset_mark_id: preset_mark_id, action: 'specName', _ajax: 1},
  665. dataType: 'json',
  666. success: function(res) {
  667. layer.closeAll();
  668. if (0 == res.code) {
  669. showErrorMsg(res.msg);
  670. } else {
  671. // 主DIV加载
  672. var html = [
  673. '<div class="prset-box" id="preset_'+preset_mark_id+'">'+
  674. '<div id="div_'+preset_mark_id+'">'+
  675. '<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>'+
  676. '<span class="set-preset-box"></span>'+
  677. '<span class="set-preset-con">'+
  678. '<span id="SelectEd_'+preset_mark_id+'"></span>'+
  679. '<select class="preset-select" name="spec_value" id="spec_value_'+preset_mark_id+'" onchange="addPresetSpecValue(this, '+preset_mark_id+')">'+
  680. '</select>'+
  681. '</span>'+
  682. '</div>'+
  683. '</div>'+
  684. '</div>'
  685. ];
  686. $('#SpecSelectName').append(html);
  687. // 规格值加载
  688. if (res.data.spec_value_option) $('#spec_value_' + preset_mark_id).empty().html(res.data.spec_value_option);
  689. // 更新预设名称下拉框
  690. if (res.data.preset_name_option) $('#spec_value').empty().html(res.data.preset_name_option);
  691. // 价格/库存HTML
  692. if (res.data.htmlTable) {
  693. // 加载规格框架
  694. $('#SpecTempLateDiv').html(res.data.htmlTable);
  695. // 合并单元格
  696. MergeCells();
  697. }
  698. }
  699. }
  700. });
  701. }
  702. // 清除数据库指定数据
  703. function clearPresetSpec(obj, spec_mark_id) {
  704. if (spec_mark_id) {
  705. // 执行处理
  706. $.ajax({
  707. type: 'post',
  708. url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
  709. data: {aid: aid, spec_mark_id: spec_mark_id, del: 'specName'},
  710. dataType: 'json',
  711. success: function(res) {
  712. // 删除当前点击规格块的顶级html
  713. $(obj).parent().parent().parent().parent().remove();
  714. // 如果存在则执行覆盖新的规格列表框
  715. if (res.data.htmlTable) {
  716. // 加载规格框架
  717. $('#SpecTempLateDiv').html(res.data.htmlTable);
  718. // 合并单元格
  719. MergeCells();
  720. }
  721. // 更新预设名称下拉框
  722. if (res.data.preset_name_option) $('#spec_value').empty().html(res.data.preset_name_option);
  723. // 使用规格数量+1覆盖原值
  724. var specValue = $('#addCustomSpec').attr('data-value');
  725. $('#addCustomSpec').attr('data-value', --specValue);
  726. // 显示添加按钮
  727. // $('#addSpecButton').show();
  728. }
  729. });
  730. }
  731. }
  732. // 追加预设规格名称和规格值
  733. function addPresetSpecValue(obj, spec_mark_id) {
  734. var spec_value_id = $(obj).val();
  735. layer_loading('正在处理');
  736. $.ajax({
  737. type: 'post',
  738. url : "{:url('ShopProduct/add_product_custom_spec')}",
  739. data: {aid: aid, spec_value_id: spec_value_id, spec_mark_id: spec_mark_id, action: 'specValue', _ajax: 1},
  740. dataType : 'json',
  741. success : function(res){
  742. layer.closeAll();
  743. if (0 == res.code) {
  744. showErrorMsg(res.msg);
  745. }else{
  746. // 追加选中的值
  747. $('#SelectEd_'+spec_mark_id).append(
  748. '<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> &nbsp; </span>'
  749. );
  750. // 规格值加载
  751. if (res.data.spec_value_option) $('#spec_value_'+spec_mark_id).empty().html(res.data.spec_value_option);
  752. // 价格/库存HTML
  753. if (res.data.htmlTable) {
  754. // 加载规格框架
  755. $('#SpecTempLateDiv').html(res.data.htmlTable);
  756. // 合并单元格
  757. MergeCells();
  758. }
  759. }
  760. }
  761. });
  762. }
  763. // 清除数据库指定数据
  764. function clearPresetSpecValue(obj) {
  765. // 当选对象
  766. var spec_mark_id = $(obj).attr('data-spec_mark_id');
  767. var spec_value_id = $(obj).attr('data-spec_value_id');
  768. // 执行处理
  769. $.ajax({
  770. type: 'post',
  771. url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
  772. data: {aid: aid, spec_mark_id: spec_mark_id, spec_value_id: spec_value_id, del: 'specValue'},
  773. dataType: 'json',
  774. success: function(res) {
  775. // 删除当前点击规格块的顶级html
  776. $(obj).parent().remove();
  777. // 规格值加载
  778. if (res.data.spec_value_option) $('#spec_value_'+spec_mark_id).empty().html(res.data.spec_value_option);
  779. // 如果存在则执行覆盖新的规格列表框
  780. if (res.data.htmlTable) {
  781. // 加载规格框架
  782. $('#SpecTempLateDiv').html(res.data.htmlTable);
  783. // 合并单元格
  784. MergeCells();
  785. }
  786. }
  787. });
  788. }
  789. // 更新同步规格值信息
  790. function RefreshSpecValue(obj) {
  791. layer.confirm('此操作将会把规格库<span style="color:red;">'+$(obj).data('name')+'</span>的规格数据同步更新!操作不可逆,确认同步?', {
  792. shade: layer_shade,
  793. area: ['480px', '190px'],
  794. move: false,
  795. title: '提示',
  796. btnAlign:'r',
  797. closeBtn: 3,
  798. btn: ['确定', '取消'] ,//按钮
  799. success: function () {
  800. $(".layui-layer-content").css('text-align', 'left');
  801. }
  802. }, function () {
  803. layer_loading('正在处理');
  804. var mark_id = $(obj).data('mark_id');
  805. if (mark_id) {
  806. var aid = $("input[name=aid]").val();
  807. $.ajax({
  808. type : 'post',
  809. url : RefreshSpecUrl,
  810. data : {spec_mark_id:mark_id, aid:aid, _ajax:1},
  811. dataType : 'json',
  812. success : function(res){
  813. layer.closeAll();
  814. if (res.data) {
  815. // 更新规格值下拉框
  816. if (res.data.ValueOption) {
  817. $('#spec_value_'+mark_id).empty().html(res.data.ValueOption);
  818. }
  819. // 更新页面上已选的规格名称及规格值
  820. if (res.data.UpData) {
  821. for (var i = 0; i < res.data.UpData.length; i++) {
  822. /*替换已选商品规格名称及规格值*/
  823. // 替换规格名称
  824. $('.spec_name_span_'+res.data.UpData[i]['spec_mark_id']).html(res.data.UpData[i]['spec_name']);
  825. $('.spec_name_input_'+res.data.UpData[i]['spec_mark_id']).val(res.data.UpData[i]['spec_name']);
  826. if (res.data.UpData[i]['spec_value_id']) {
  827. // 替换规格值
  828. $('.spec_value_span_'+res.data.UpData[i]['spec_value_id']).html(res.data.UpData[i]['spec_value']);
  829. $('.spec_value_input_'+res.data.UpData[i]['spec_value_id']).val(res.data.UpData[i]['spec_value']);
  830. }
  831. /* END */
  832. }
  833. }
  834. // 清除页面上已选的规格数据
  835. if (res.data.SpecIds) {
  836. if (res.data.DelAllSpec) {
  837. $('#spec_'+res.data.DelAllSpec).remove();
  838. }else{
  839. for (var i = 0; i < res.data.SpecIds.length; i++) {
  840. $('#preset-bt2_'+res.data.SpecIds[i]).remove();
  841. }
  842. }
  843. }
  844. // 重新加载规格价格库存填写栏
  845. if (res.data.HtmlTable && res.data.SpecMarks) {
  846. // 加载规格框架
  847. $('#SpecTempLateDiv').html(res.data.HtmlTable);
  848. // 合并单元格
  849. MergeCells();
  850. $('#spec_mark_id_arr').val(res.data.SpecMarks);
  851. }
  852. }
  853. layer.msg(res.msg, {time:1500, icon: 1});
  854. },
  855. error : function(e) {
  856. layer.closeAll();
  857. layer.alert(e.responseText, {icon: 5});
  858. }
  859. });
  860. }else{
  861. layer.closeAll();
  862. layer.msg('数据有误,同步失败,请刷新重试!', {time:2000, icon: 2});
  863. }
  864. }, function (index) {
  865. // 取消
  866. layer.closeAll(index);
  867. });
  868. }
  869. // 加载下拉框
  870. function SpecSelectName(obj) {
  871. // 本次使用的规格数量
  872. var specValue = $('#addCustomSpec').attr('data-value');
  873. if (3 <= specValue) {
  874. showErrorMsg('最多使用三种商品规格大类');
  875. return false;
  876. }
  877. var aid = $("input[name=aid]").val();
  878. var spec_mark_id = $(obj).val();
  879. var spec_mark_id_arr = $('#spec_mark_id_arr').val();
  880. $.ajax({
  881. type: 'post',
  882. url : SelectUrl,
  883. 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},
  884. dataType: 'json',
  885. success: function(res){
  886. if (0 == res.code) {
  887. showErrorMsg(res.msg);
  888. } else {
  889. var html = [];
  890. // 主DIV加载
  891. html += [
  892. '<div class="prset-box" id="preset_'+spec_mark_id+'">'+
  893. '<div id="div_'+spec_mark_id+'">'+
  894. '<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>'+
  895. '<span id="SelectEd_'+spec_mark_id+'"></span> &nbsp; &nbsp;'+
  896. '<select name="spec_value" id="spec_value_'+spec_mark_id+'" onchange="AppEndPreset(this,'+spec_mark_id+')">'+
  897. '</select> &nbsp; <span title="同步规格值" data-mark_id="'+spec_mark_id+'" data-name="'+res.data.preset_name+'" onclick="RefreshSpecValue(this);"><i class="fa fa-refresh"></i></span>'+
  898. '</div>'+
  899. '</div>'+
  900. '</div>'
  901. ];
  902. $('#SpecSelectName').append(html);
  903. // 预设值加载
  904. $('#spec_value_'+spec_mark_id).empty().html(res.data.preset_value_option);
  905. // 更新预设名称下拉框
  906. res.data.preset_name_option = '<option value="0">选择规格名称</option>' + res.data.preset_name_option;
  907. $('#spec_value').empty().html(res.data.preset_name_option);
  908. $('#spec_mark_id_arr').val(res.data.spec_mark_id_arr);
  909. // 自定义规格数量+1覆盖原值
  910. $('#addCustomSpec').attr('data-value', ++specValue);
  911. }
  912. }
  913. });
  914. }
  915. // 追加预设规格名称和规格值
  916. function AppEndPreset(obj, spec_mark_id) {
  917. var spec_value_id = $(obj).val();
  918. var aid = $("input[name=aid]").val();
  919. $.ajax({
  920. type: 'post',
  921. url : "{:url('ShopProduct/spec_value_select')}",
  922. data: {aid: aid, spec_value_id: spec_value_id, spec_mark_id: spec_mark_id, _ajax: 1},
  923. dataType: 'json',
  924. success: function(res){
  925. if (0 == res.code) {
  926. showErrorMsg(res.msg);
  927. } else {
  928. // 追加选中的值
  929. $('#SelectEd_'+spec_mark_id).append(
  930. '<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> &nbsp; </span>'
  931. );
  932. // 加载规格值下拉框
  933. if (res.data.Option) $('#spec_value_'+spec_mark_id).empty().html(res.data.Option);
  934. // 加载规格框架
  935. if (res.data.htmlTable) {
  936. // 合并单元格
  937. $('#SpecTempLateDiv').html(res.data.htmlTable);
  938. MergeCells();
  939. if (res.data.htmlTable != ' ') {
  940. $("#users_price").attr("readonly", "readonly");
  941. $("#stock_count").attr("readonly", "readonly");
  942. } else {
  943. $("#users_price").removeAttr("readonly");
  944. $("#stock_count").removeAttr("readonly");
  945. }
  946. } else {
  947. $("#users_price").removeAttr("readonly");
  948. $("#stock_count").removeAttr("readonly");
  949. }
  950. }
  951. }
  952. });
  953. }
  954. // 清除session中的指定数据,同时对数据库进行操作
  955. function DelDiv(obj) {
  956. var spec_mark_id = $(obj).attr('data-mark_id');
  957. var spec_mark_id_arr = $('#spec_mark_id_arr').val();
  958. var aid = $("input[name=aid]").val();
  959. // 执行处理
  960. $.ajax({
  961. type: 'post',
  962. url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
  963. data: {aid: aid, spec_mark_id: spec_mark_id, spec_mark_id_arr: spec_mark_id_arr, del: 'name'},
  964. dataType: 'json',
  965. success: function(res) {
  966. // 关闭所有弹出层
  967. layer.closeAll();
  968. // 删除当前点击规格块的顶级html
  969. $(obj).parent().parent().parent().parent().remove();
  970. // 加载选中的规格名称ID
  971. if (res.data.spec_mark_id_arr) $('#spec_mark_id_arr').val(res.data.spec_mark_id_arr);
  972. // 如果存在则执行覆盖新的规格列表框
  973. if (res.data.htmlTable) {
  974. // 加载规格框架
  975. $('#SpecTempLateDiv').html(res.data.htmlTable);
  976. // 合并单元格
  977. MergeCells();
  978. }
  979. // 使用规格数量+1覆盖原值
  980. var specValue = $('#addCustomSpec').attr('data-value');
  981. $('#addCustomSpec').attr('data-value', --specValue);
  982. // 更新预设名称下拉框
  983. res.data.Option = '<option value="0">选择规格名称</option>' + res.data.Option;
  984. if (res.data.Option) $('#spec_value').empty().html(res.data.Option);
  985. }
  986. });
  987. // 使用规格数量+1覆盖原值
  988. var specValue = $('#addCustomSpec').attr('data-value');
  989. $('#addCustomSpec').attr('data-value', --specValue);
  990. }
  991. // 清除session中的指定数据,同时对数据库进行操作
  992. function DelValue(obj) {
  993. var spec_mark_id = $(obj).attr('data-mark_id');
  994. var spec_value_id = $(obj).attr('data-preset_id');
  995. var aid = $("input[name=aid]").val();
  996. $.ajax({
  997. type: 'post',
  998. url : "{:url('ShopProduct/del_product_custom_spec', ['_ajax'=>1])}",
  999. data: {aid: aid, spec_value_id: spec_value_id, spec_mark_id: spec_mark_id, del: 'value'},
  1000. dataType: 'json',
  1001. success: function(res) {
  1002. layer.closeAll();
  1003. // 清除页面html
  1004. $(obj).parent().remove();
  1005. if (res.data.Option) $('#spec_value_'+spec_mark_id).empty().html(res.data.Option);
  1006. // 加载规格框架
  1007. if (res.data.htmlTable) {
  1008. // 合并单元格
  1009. $('#SpecTempLateDiv').html(res.data.htmlTable);
  1010. MergeCells();
  1011. if (res.data.htmlTable != ' ') {
  1012. $("#users_price").attr("readonly", "readonly");
  1013. $("#stock_count").attr("readonly", "readonly");
  1014. } else {
  1015. $("#users_price").removeAttr("readonly");
  1016. $("#stock_count").removeAttr("readonly");
  1017. }
  1018. } else {
  1019. $("#users_price").removeAttr("readonly");
  1020. $("#stock_count").removeAttr("readonly");
  1021. }
  1022. }
  1023. });
  1024. }
  1025. // 批量设置价格
  1026. function BulkSetPrice(obj) {
  1027. layer.prompt({
  1028. formType: 3,
  1029. shade: layer_shade,
  1030. id: 'BulkSetPrice',
  1031. title: '提示',
  1032. btn: ['确定', '关闭'],
  1033. btnAlign:'r',
  1034. closeBtn: 3,
  1035. success: function(layero, index){
  1036. $("#BulkSetPrice").find('input').attr('placeholder', '批量设置价格');
  1037. $("#BulkSetPrice").find('input').attr('onkeyup', "this.value=this.value.replace(/[^\\d.]/g,'')");
  1038. $("#BulkSetPrice").find('input').attr('onpaste', "this.value=this.value.replace(/[^\\d.]/g,'')");
  1039. }
  1040. }, function(price, index){
  1041. layer.close(index);
  1042. // 规格中的价格
  1043. $('.users_price').val(price);
  1044. // 产品价格
  1045. $('#users_price').val(price);
  1046. });
  1047. }
  1048. // 更新价格,取出最小的值赋值到价格中
  1049. function UpPrice(obj) {
  1050. var UsersPriceArray = new Array();
  1051. $('.users_price').each(function(){
  1052. UsersPriceArray.push($(this).val());
  1053. });
  1054. if (UsersPriceArray.length != 0) {
  1055. // 取出最小值
  1056. var MinValue = Math.min.apply(Math, UsersPriceArray);
  1057. // 禁用库存框
  1058. $('#users_price').attr('readonly','readonly');
  1059. }else{
  1060. var MinValue = '{$field.users_price}';
  1061. }
  1062. $('#users_price').val(MinValue);
  1063. }
  1064. // 批量设置库存
  1065. function BulkSetStock(obj) {
  1066. layer.prompt({
  1067. formType: 3,
  1068. shade: layer_shade,
  1069. id: 'BulkSetStock',
  1070. title: '提示',
  1071. btn: ['确定', '关闭'],
  1072. btnAlign:'r',
  1073. closeBtn: 3,
  1074. success: function(layero, index){
  1075. $("#BulkSetStock").find('input').attr('placeholder', '批量设置库存');
  1076. $("#BulkSetStock").find('input').attr('onkeyup', "this.value=this.value.replace(/[^\\d.]/g,'')");
  1077. $("#BulkSetStock").find('input').attr('onpaste', "this.value=this.value.replace(/[^\\d.]/g,'')");
  1078. }
  1079. }, function(stock, index){
  1080. layer.close(index);
  1081. // 单个库存
  1082. $('.stock_count').val(stock);
  1083. $('.stock_count').attr('data-old_stock',stock);
  1084. stock_count = Number($('.stock_count').length) * Number(stock);
  1085. $('#stock_count').val(stock_count);
  1086. // 禁用库存框
  1087. $('#stock_count').attr('readonly','readonly');
  1088. });
  1089. }
  1090. // 更新库存量
  1091. function UpStock(obj) {
  1092. var stock_count = $('#stock_count').val();
  1093. var new_stock = $(obj).val();
  1094. var old_stock = $(obj).attr('data-old_stock');
  1095. $(obj).attr('data-old_stock',new_stock);
  1096. if (Number(old_stock) > Number(new_stock)) {
  1097. new_stock = Number(old_stock) - Number(new_stock);
  1098. stock_count = Number(stock_count) - Number(new_stock);
  1099. }else{
  1100. new_stock = Number(new_stock) - Number(old_stock);
  1101. stock_count = Number(stock_count) + Number(new_stock);
  1102. }
  1103. $('#stock_count').val(stock_count);
  1104. }
  1105. // 合并单元格
  1106. function MergeCells() {
  1107. var tab = document.getElementById("spec_input_tab");
  1108. var maxCol = 2, val, count, start;
  1109. if (tab != null) {
  1110. for (var col = maxCol - 1; col >= 0; col--) {
  1111. count = 1;
  1112. val = "";
  1113. for (var i = 0; i < tab.rows.length; i++) {
  1114. if (val == tab.rows[i].cells[col].innerHTML) {
  1115. count++;
  1116. } else {
  1117. if (count > 1) { //合并
  1118. start = i - count;
  1119. tab.rows[start].cells[col].rowSpan = count;
  1120. for (var j = start + 1; j < i; j++) {
  1121. tab.rows[j].cells[col].style.display = "none";
  1122. }
  1123. count = 1;
  1124. }
  1125. val = tab.rows[i].cells[col].innerHTML;
  1126. }
  1127. }
  1128. if (count > 1) { //合并,最后几行相同的情况下
  1129. start = i - count;
  1130. tab.rows[start].cells[col].rowSpan = count;
  1131. for (var j = start + 1; j < i; j++) {
  1132. tab.rows[j].cells[col].style.display = "none";
  1133. }
  1134. }
  1135. }
  1136. }
  1137. }
  1138. // 规格列表管理
  1139. function SpecTempLate() {
  1140. //iframe窗
  1141. layer.open({
  1142. type: 2,
  1143. title: '规格模板库',
  1144. shade:layer_shade,
  1145. shadeClose: false,
  1146. maxmin: false, //开启最大化最小化按钮
  1147. area: ['90%', '90%'],
  1148. content: TemplateUrl
  1149. });
  1150. }
  1151. // 当规格库更新后,调用此方式及时更新选择规格名称的下拉框信息及规格框信息
  1152. function UpPresetSpecData(preset_mark_id) {
  1153. var spec_mark_id_arr = $('#spec_mark_id_arr').val();
  1154. var aid = $("input[name=aid]").val();
  1155. $.ajax({
  1156. type: 'post',
  1157. url : GetPresetSpecUrl,
  1158. 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},
  1159. dataType: 'json',
  1160. success: function(res){
  1161. // 更新规格名称下拉框
  1162. res.data.spec_name_option = '<option value="0">选择规格名称</option>' + res.data.spec_name_option;
  1163. $('#spec_value').empty().html(res.data.spec_name_option);
  1164. }
  1165. });
  1166. }
  1167. </script>
  1168. {/if}
  1169. <dl class="row {notempty name="$useSpecNum"} none {/notempty}" id="dl_virtual_sales">
  1170. <dt class="tit"> <label for="virtual_sales">虚拟销量</label> </dt>
  1171. <dd class="opt">
  1172. <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,'')">
  1173. <p class="notic">只适用单规格商品,前台展示时是实际销量+虚拟销量</p>
  1174. </dd>
  1175. </dl>
  1176. {/if}
  1177. {include file="archives/get_field_addonextitem" /}
  1178. </div>
  1179. <!-- 常规信息 -->
  1180. <!-- 产品参数 -->
  1181. <div class="ncap-form-default tab_div_2" style="display: none;">
  1182. <input type="hidden" name="is_old_product_attr" value="{$is_old_product_attr|default='0'}">
  1183. {notempty name='$is_old_product_attr'}
  1184. {include file="product/old_product_attr_edit" /}
  1185. {else /}
  1186. <!-- <dl class="row">
  1187. <dt class="tit"> <label>参数类型</label> </dt>
  1188. <dd class="opt">
  1189. <label><input type="radio" name="param_type" value="1" {notempty name="$field.attrlist_id"} checked="checked" {/notempty} onclick="paramType(1);">系统参数</label>
  1190. &nbsp;
  1191. <label><input type="radio" name="param_type" value="2" {empty name="$field.attrlist_id"} checked="checked" {/empty} onclick="paramType(2);">自定义参数</label>
  1192. </dd>
  1193. </dl> -->
  1194. <dl class="row">
  1195. <dt class="tit"> <label>商品参数</label> </dt>
  1196. <dd class="opt">
  1197. <div id="system_param">
  1198. <div>
  1199. <select name="attrlist_id" id="attrlist_id" onchange="AttrListSelect(this);">
  1200. <option value="0">请选择参数</option>
  1201. {volist name="AttrList" id="vo"}
  1202. <option value="{$vo.list_id}" {eq name="$vo.list_id" value="$field.attrlist_id"}selected{/eq}>{$vo.list_name}</option>
  1203. {/volist}
  1204. </select>
  1205. &nbsp; &nbsp; &nbsp;
  1206. <a href="JavaScript:void(0);" id="addCustomParam" data-attr_id="{$maxAttrID}" onclick="addCustomParam(this);" class="ncap-btn ncap-btn-green">自定义参数</a>
  1207. &nbsp;<a href="JavaScript:void(0);" onclick="attrlistLayer(this)" style="font-size: 12px;padding-left: 10px;">[管理]</a>
  1208. </div>
  1209. <dl class="row">
  1210. <dt class="sort-e lh40 pl0 text-l10" style=" background: #f4f6f8;">排序</dt>
  1211. <dt class="tit lh40 pl5 text-l10" style=" background: #f4f6f8;"> 参数名称</dt>
  1212. <dd class="opt w350 lh40 text-l10" style=" background: #f4f6f8;">参数值</dd>
  1213. </dl>
  1214. <div id='AttrSelectName' style="margin: 1px;">{$canshu}</div>
  1215. <div id='customParam' style="margin: 1px;">
  1216. <input type="hidden" name="del_attr_id" value="{$delAttrID}">
  1217. {volist name="$customParam" id="vo"}
  1218. <dl class="row">
  1219. <dt class="sort-e pl0"> <input type="text" size="4" name="sort_order[{$vo.attr_id}]" value="{$vo.sort_order}"> </dt>
  1220. <dt class="tit pl5"> <input type="text" size="10" name="attr_name[{$vo.attr_id}]" value="{$vo.attr_name}"> </dt>
  1221. <dd class="opt pl5">
  1222. <input type="text" size="40" name="attr_value[{$vo.attr_id}]" value="{$vo.attr_value}">
  1223. <a class="text_a" href="javascript:void(0);" onClick="delCustomParam(this);">删除</a>
  1224. </dd>
  1225. </dl>
  1226. {/volist}
  1227. </div>
  1228. </div>
  1229. <!-- <div id="custom_param" {empty name="$field.attrlist_id"} style="display: block;" {else/} style="display: none;" {/empty}>
  1230. <div class="copybtn"><a class="ncap-btn ncap-btn-green" href="javascript:void(0);" onclick="addCustomParam();">新增</a></div><br>
  1231. <div class="itemInfo">
  1232. <table cellspacing="0" cellpadding="0" border="0" class="normTbe tabInfo">
  1233. <thead>
  1234. <tr>
  1235. <th class="w350">参数名称</th>
  1236. <th class="w350">参数值</th>
  1237. <th>操作</th>
  1238. </tr>
  1239. </thead>
  1240. <tbody class="tbody1" id="attr_tbody">
  1241. {volist name="$customParam" id="vo"}
  1242. <tr>
  1243. <td class="w350"><input type="text" name="param_name[]" value="{$vo.param_name}"></td>
  1244. <td class="w350"><input type="text" name="param_value[]" value="{$vo.param_value}"></td>
  1245. <td> <a class="text_a" href="javascript:void(0);" onclick="delCustomParam(this);">删除</a> </td>
  1246. </tr>
  1247. {/volist}
  1248. </tbody>
  1249. </table>
  1250. </div>
  1251. </div> -->
  1252. </dd>
  1253. </dl>
  1254. <script type="text/javascript">
  1255. // 商品参数切换
  1256. // function paramType(param_type) {
  1257. // if (1 == param_type) {
  1258. // $('#system_param').show();
  1259. // $('#custom_param').hide();
  1260. // } else {
  1261. // $('#system_param').hide();
  1262. // $('#custom_param').show();
  1263. // }
  1264. // }
  1265. // 添加自定义参数
  1266. function addCustomParam(obj) {
  1267. var maxAttrID = $(obj).attr('data-attr_id');
  1268. // 规格值HTML
  1269. var html = [
  1270. '<dl class="row">'+
  1271. '<dt class="sort-e pl0"> <input type="text" size="4" name="sort_order['+maxAttrID+']" placeholder="100"> </dt>'+
  1272. '<dt class="tit pl5"> <input type="text" size="10" name="attr_name['+maxAttrID+']"> </dt>'+
  1273. '<dd class="opt pl5">'+
  1274. '<input type="text" size="40" name="attr_value['+maxAttrID+']"> '+
  1275. '<a class="text_a" href="javascript:void(0);" onClick="delCustomParam(this);">删除</a>'+
  1276. '</dd>'+
  1277. '</dl>'
  1278. // '<tr>'+
  1279. // '<td class="w350"><input type="text" name="param_name[]" /></td>'+
  1280. // '<td class="w350"><input type="text" name="param_value[]" /></td>'+
  1281. // '<td> <a class="text_a" href="javascript:void(0);" onClick="delCustomParam(this);">删除</a> </td>'+
  1282. // '</tr>'
  1283. ];
  1284. // 加载一个规格值 input
  1285. $('#customParam').append(html);
  1286. // 自定义参数数量+1覆盖原值
  1287. $(obj).attr('data-attr_id', ++maxAttrID);
  1288. }
  1289. // 删除自定义参数
  1290. function delCustomParam(obj) {
  1291. $(obj).parent().parent().remove();
  1292. // var length = $("#attr_tbody>tr").length;
  1293. // if (parseInt(length) <= 1) {
  1294. // showErrorMsg("至少保留一行");
  1295. // } else {
  1296. // $(obj).parent().parent().remove();
  1297. // }
  1298. }
  1299. // 参数选择
  1300. function AttrListSelect(obj) {
  1301. var aid = '';
  1302. var list_id = $(obj).val();
  1303. if (parseInt(list_id) < 1) {
  1304. $("#AttrSelectName").empty();
  1305. return false;
  1306. }
  1307. $('#AttrSelectName').html('<div style="color: red;font-size: 12px;text-align: center;">加载中……</div>');
  1308. // 商品栏目切换时 ajax 调用 返回不同的属性输入框
  1309. $.ajax({
  1310. type:'GET',
  1311. data:{aid:aid, list_id:list_id, _ajax:1},
  1312. url :"{:url('ShopProduct/ajax_get_shop_attr_input')}",
  1313. success:function(data) {
  1314. $("#AttrSelectName").empty().append(data);
  1315. }
  1316. });
  1317. }
  1318. function attrlistLayer(obj) {
  1319. var url = "{:url('ShopProduct/attrlist_index', ['oldinlet'=>1])}";
  1320. //iframe窗
  1321. var iframes = layer.open({
  1322. type: 2,
  1323. title: '商品参数管理',
  1324. fixed: true, //不固定
  1325. shadeClose: false,
  1326. shade: layer_shade,
  1327. area: ['95%', '95%'],
  1328. content: url,
  1329. end: function(index){
  1330. var list_id = $('#attrlist_id').val();
  1331. $.ajax({
  1332. url:"{:url('Product/ajax_get_shop_attrlist')}",
  1333. type:'GET',
  1334. data:{list_id:list_id, _ajax:1},
  1335. success:function(res) {
  1336. var html = "<option value='0'>请选择参数</option>";
  1337. html += res;
  1338. $("#attrlist_id").empty().append(html);
  1339. // 删掉选中的参数之后,默认不选中,参数属性同时要清空掉
  1340. if ($('#attrlist_id').val() < 1) {
  1341. $("#AttrSelectName").empty();
  1342. }
  1343. },
  1344. error: function(e){
  1345. showErrorAlert(e.responseText);
  1346. }
  1347. });
  1348. }
  1349. });
  1350. // layer.full(iframes);
  1351. }
  1352. </script>
  1353. {/notempty}
  1354. </div>
  1355. <!-- 产品参数 -->
  1356. <!-- SEO参数 -->
  1357. <div class="ncap-form-default tab_div_3" style="display: none;">
  1358. <dl class="row">
  1359. <dt class="tit"> <label for="seo_title">SEO标题</label> </dt>
  1360. <dd class="opt">
  1361. <input type="text" value="{$field.seo_title}" name="seo_title" id="seo_title" class="input-txt">
  1362. <span class="err"></span>
  1363. <p class="notic">一般不超过80个字符,为空时系统自动构成,可以到 <a href="{:url('Seo/index', array('inc_type'=>'seo'))}">SEO设置 - SEO基础</a> 中设置构成规则。</p>
  1364. </dd>
  1365. </dl>
  1366. <dl class="row">
  1367. <dt class="tit"> <label for="seo_keywords">SEO关键词</label> </dt>
  1368. <dd class="opt">
  1369. <textarea rows="5" cols="60" id="seo_keywords" name="seo_keywords" style="height:20px;">{$field.seo_keywords}</textarea>
  1370. <span class="err"></span>
  1371. <p class="notic">一般不超过100个字符,多个关键词请用英文逗号(,)隔开,建议3到5个关键词。</p>
  1372. </dd>
  1373. </dl>
  1374. <dl class="row">
  1375. <dt class="tit"> <label for="seo_description">SEO描述</label> </dt>
  1376. <dd class="opt">
  1377. <textarea rows="5" cols="60" id="seo_description" name="seo_description" style="height:54px;" class="keywordsTextarea" onkeyup="monitorInputStr();" onkeypress="monitorInputStr();">{$field.seo_description}</textarea>
  1378. <span class="err"></span>
  1379. <p class="notic">一般不超过100个字符,不填写时系统自动提取正文的前100个字符</p>
  1380. <p class="notic2 {empty name='$field.seo_description'}none{/empty}" id="beenWritten">你已输入<span id="beenWrittenStr">0</span>个字符</p>
  1381. <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>
  1382. </dd>
  1383. </dl>
  1384. </div>
  1385. <!-- SEO参数 -->
  1386. <!-- 其他参数 -->
  1387. <div class="ncap-form-default tab_div_4" style="display: none;">
  1388. <dl class="row">
  1389. <dt class="tit"> <label for="author">作者</label> </dt>
  1390. <dd class="opt">
  1391. <input type="hidden" value="{$field.users_id}" name="users_id" class="input-txt">
  1392. <input type="text" value="{$field.author}" name="author" id="author" class="input-txt">
  1393. <span class="err"></span>
  1394. <p class="notic">设置作者默认名称(将同步至管理员笔名)</p>
  1395. </dd>
  1396. </dl>
  1397. <dl class="row dl_origin">
  1398. <dt class="tit"> <label for="origin">来源</label> </dt>
  1399. <dd class="opt origin-hot">
  1400. <input type="text" value="{$field.origin}" name="origin" id="origin" class="input-txt" onclick="searchOrigin(this);" autocomplete="off">
  1401. <div class="origin-hot-list" style="display: none;" id="search_keywords_list_origin"></div>
  1402. <textarea id="system_originlist_str" style="display: none;">{$system_originlist_str}</textarea>
  1403. <span class="setting" onclick="set_originlist();">设置</span>
  1404. <span class="err"></span>
  1405. <p class="notic">为空时默认“网络”</p>
  1406. </dd>
  1407. </dl>
  1408. <dl class="row">
  1409. <dt class="tit"> <label for="click">点击数</label> </dt>
  1410. <dd class="opt">
  1411. <input type="text" value="{$field.click}" name="click" id="click" class="input-txt">
  1412. </dd>
  1413. </dl>
  1414. <dl class="row">
  1415. <dt class="tit"> <label>阅读权限</label> </dt>
  1416. <dd class="opt">
  1417. <input type="hidden" value="{$field.arcrank}" name="old_arcrank" class="input-txt">
  1418. <select name="arcrank" id="arcrank" {if $field.arcrank < 0 && $admin_info.role_id > 0 && $auth_role_info.check_oneself < 1} disabled="disabled" {/if}>
  1419. {volist name="arcrank_list" id="vo"}
  1420. <option value="{$vo.rank}" {eq name="$vo.rank" value="$field.arcrank"}selected{/eq}>{$vo.name}</option>
  1421. {/volist}
  1422. </select>
  1423. </dd>
  1424. </dl>
  1425. <!-- #weapp_UsersGroup_content_users_id={$field.users_id}#--><!-- #weapp_UsersGroup_content# -->
  1426. <dl class="row">
  1427. <dt class="tit"> <label for="add_time">发布时间</label> </dt>
  1428. <dd class="opt">
  1429. <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">
  1430. <span class="add-on input-group-addon"> <i class="glyphicon glyphicon-calendar fa fa-calendar"></i></span>
  1431. </dd>
  1432. </dl>
  1433. <dl class="row">
  1434. <dt class="tit"> <label for="tempview">文档模板</label> </dt>
  1435. <dd class="opt">
  1436. <select name="tempview" id="tempview">
  1437. {volist name='$templateList' id='vo'}
  1438. <option value="{$vo}" {eq name='$vo' value='$tempview'}selected{/eq}>{$vo}</option>
  1439. {/volist}
  1440. </select>
  1441. <input type="hidden" name="type_tempview" value="{$tempview}" />
  1442. </dd>
  1443. </dl>
  1444. <dl class="row {notin name='$seo_pseudo' value='2,3'}no-grey{/notin}">
  1445. <dt class="tit"> <label>自定义文件名</label> </dt>
  1446. <dd class="opt">
  1447. <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
  1448. <span class="err"></span>
  1449. <p class="notic">自定义文件名可由字母、数字、下划线(_)、连接符(-)等符号组成,除此之外其他字符将自动转为连接符(-)</p>
  1450. </dd>
  1451. </dl>
  1452. </div>
  1453. <!-- 其他参数 -->
  1454. <!-- #weapp_demontrate_div# -->
  1455. <!-- #weapp_div# -->
  1456. <div class="ncap-form-default">
  1457. <div class="bot2">
  1458. <input type="hidden" name="gourl" value="{$gourl|default=''}">
  1459. <input type="hidden" name="aid" value="{$field.aid|default='0'}">
  1460. <input type="hidden" name="editor_addonFieldExt" id="editor_addonFieldExt" value="">
  1461. <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
  1462. {include file="public/callback_page_2" /}<!-- 返回按钮 -->
  1463. </div>
  1464. </div>
  1465. </form>
  1466. </div>
  1467. <script type="text/javascript">
  1468. layui.use('laydate', function() {
  1469. var laydate = layui.laydate;
  1470. laydate.render({
  1471. elem: '#add_time'
  1472. ,type: 'datetime'
  1473. });
  1474. })
  1475. $(function () {
  1476. try {
  1477. var web_citysite_open = {$global['web_citysite_open']|default=0};
  1478. if (web_citysite_open > 0) {
  1479. var province_id = {$field.province_id|default=0};
  1480. var city_id = {$field.city_id|default=0};
  1481. var area_id = {$field.area_id|default=0};
  1482. if (province_id > 0) {
  1483. set_city_list(city_id);
  1484. }
  1485. if (city_id > 0) {
  1486. set_area_list(area_id);
  1487. }
  1488. }
  1489. }catch(e){}
  1490. //选项卡切换列表
  1491. $('.tab-base').find('.tab').click(function(){
  1492. $('.tab-base').find('.tab').each(function(){
  1493. $(this).removeClass('current');
  1494. });
  1495. $(this).addClass('current');
  1496. var tab_index = $(this).data('index');
  1497. $(".tab_div_1, .tab_div_2, .tab_div_3, .tab_div_4").hide();
  1498. $(".tab_div_"+tab_index).show();
  1499. layer.closeAll();
  1500. });
  1501. $('input[name=is_jump]').click(function(){
  1502. if ($(this).is(':checked')) {
  1503. $('.dl_jump').show();
  1504. } else {
  1505. $('.dl_jump').hide();
  1506. }
  1507. });
  1508. var dftypeid = {$field.typeid|default='0'};
  1509. $('#typeid').change(function(){
  1510. var current_channel = $(this).find('option:selected').data('current_channel');
  1511. if (0 < $(this).val() && {$channeltype} != current_channel) {
  1512. showErrorMsg('请选择对应模型的栏目!');
  1513. $(this).val(dftypeid);
  1514. } else if ({$channeltype} == current_channel) {
  1515. layer.closeAll();
  1516. }
  1517. var aid = $("input[name=aid]").val();
  1518. GetAddonextitem(1, $(this).val(), {$channeltype}, aid, true);
  1519. });
  1520. $(document).click(function(){
  1521. $('#often_tags').hide();
  1522. $('#often_tags_input').hide();
  1523. event.stopPropagation();
  1524. });
  1525. $('#often_tags').click(function(){
  1526. $('#often_tags').show();
  1527. event.stopPropagation();
  1528. });
  1529. });
  1530. function change_prom_type(val) {
  1531. if ( val == 1 ){
  1532. $("input[name=prom_type_vir]:eq(0)").attr("checked",'checked');
  1533. $("#fahuoxingshi").show();
  1534. } else if ( val == 2 ){
  1535. $("#wangpanxiazai").hide();
  1536. $("#wenbenneirong").hide();
  1537. } else if ( val == 3 ){
  1538. $("#wangpanxiazai").show();
  1539. $("#wenbenneirong").hide();
  1540. } else if( val == 4 ){
  1541. $("#wangpanxiazai").hide();
  1542. $("#wenbenneirong").show();
  1543. }
  1544. else {
  1545. $("#wangpanxiazai").hide();
  1546. $("#wenbenneirong").hide();
  1547. $("#fahuoxingshi").hide();
  1548. }
  1549. }
  1550. // 判断输入框是否为空
  1551. function check_submit(){
  1552. if($.trim($('input[name=title]').val()) == ''){
  1553. $($('.tab-base').find('.tab')[0]).trigger('click');
  1554. showErrorMsg('标题不能为空!');
  1555. $('input[name=title]').focus();
  1556. return false;
  1557. }
  1558. if ($('#typeid').val() == 0) {
  1559. $($('.tab-base').find('.tab')[0]).trigger('click');
  1560. showErrorMsg('请选择栏目…!');
  1561. $('#typeid').focus();
  1562. return false;
  1563. }
  1564. if ($('input[name=prom_type]:checked').val() == 1) {
  1565. if($('input[name=prom_type_vir]:checked').val() == 2 && $.trim($('input[name=netdisk_url]').val()) == ''){
  1566. $($('.tab-base').find('.tab')[0]).trigger('click');
  1567. showErrorMsg('网盘地址不能为空!');
  1568. $('input[name=netdisk_url]').focus();
  1569. return false;
  1570. }
  1571. if($('input[name=prom_type_vir]:checked').val() == 3 && $.trim($('textarea[name=text_content]').val()) == ''){
  1572. $($('.tab-base').find('.tab')[0]).trigger('click');
  1573. showErrorMsg('虚拟文本内容不能为空!');
  1574. $('textarea[name=text_content]').focus();
  1575. return false;
  1576. }
  1577. }
  1578. var htmlfilename = $.trim($('input[name=htmlfilename]').val());
  1579. if (htmlfilename != '') {
  1580. var exp = /^\d{1,}$/;
  1581. if (exp.test(htmlfilename)) {
  1582. showErrorAlert('自定义文件名不能纯数字,会与文档ID冲突!');
  1583. $('input[name=htmlfilename]').focus();
  1584. return false;
  1585. }
  1586. }
  1587. layer_loading('正在处理');
  1588. if(!ajax_check_htmlfilename())
  1589. {
  1590. layer.closeAll();
  1591. showErrorMsg('同栏目下,自定义文件名已存在!');
  1592. $('input[name=htmlfilename]').focus();
  1593. return false;
  1594. }
  1595. setTimeout(function (){
  1596. editor_auto_210607();
  1597. $('#post_form').submit();
  1598. }, 1);
  1599. }
  1600. function img_call_back(fileurl_tmp)
  1601. {
  1602. $("#litpic_local").val(fileurl_tmp);
  1603. $("#img_a").attr('href', fileurl_tmp);
  1604. $("#img_i").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
  1605. $("input[name=is_litpic]").attr('checked', true); // 自动勾选属性[图片]
  1606. }
  1607. // 上传产品相册回调函数
  1608. function proimg_call_back(paths){
  1609. var last_div = $(".images_upload_tpl").html();
  1610. for (var i=0;i<paths.length ;i++ )
  1611. {
  1612. if ($(".sort-list-img .images_upload_html").length > 0) {
  1613. $(".sort-list-img .images_upload_html:last").after(last_div); // 插入一个 新图片
  1614. } else {
  1615. $(".sort-list-img .images_upload:last").before(last_div); // 插入一个 新图片
  1616. }
  1617. $(".sort-list-img .images_upload_html:last").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
  1618. $(".sort-list-img .images_upload_html:last").find('img').attr('src',paths[i]);// 修改他的图片路径
  1619. $(".sort-list-img .images_upload_html:last").find('a:eq(1)').attr('onclick',"ClearPicArr2(this,'"+paths[i]+"')").text('');
  1620. $(".sort-list-img .images_upload_html:last").find('input').val(paths[i]); // 设置隐藏域 要提交的值
  1621. }
  1622. }
  1623. /*
  1624. * 上传之后删除组图input
  1625. * @access public
  1626. * @val string 删除的图片input
  1627. */
  1628. function ClearPicArr2(obj,path)
  1629. {
  1630. var aid = "{$field.aid|default='0'}";
  1631. // 删除数据库记录
  1632. $.ajax({
  1633. type:'POST',
  1634. url:"{:url('Product/del_proimg')}",
  1635. data:{filename:path,_ajax:1,aid:aid},
  1636. success:function(){
  1637. $(obj).parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
  1638. $.ajax({
  1639. type:'POST',
  1640. url:"{:url('Uploadimgnew/delupload')}",
  1641. data:{action:"del", filename:path,_ajax:1},
  1642. success:function(){}
  1643. });
  1644. }
  1645. });
  1646. }
  1647. /** 以下 产品参数相关 js*/
  1648. $(document).ready(function(){
  1649. // 产品栏目切换时 ajax 调用 返回不同的属性输入框
  1650. $("#typeid").change(function(){
  1651. get_attr_input();
  1652. });
  1653. // 触发产品栏目
  1654. // $("#typeid").trigger('change');
  1655. });
  1656. // 产品栏目切换时 ajax 调用 返回不同的属性输入框
  1657. function get_attr_input()
  1658. {
  1659. var aid = $("input[name=aid]").val();
  1660. var typeid = $("#typeid").val();
  1661. if (parseInt(typeid) < 1) {
  1662. return false;
  1663. }
  1664. $('#product_attr_table').html('<div style="color: red;font-size: 12px;text-align: center;">加载中……</div>');
  1665. // 产品栏目切换时 ajax 调用 返回不同的属性输入框
  1666. $.ajax({
  1667. type:'GET',
  1668. data:{aid:aid,typeid:typeid,_ajax:1},
  1669. url:"{:url('Product/ajax_get_attr_input')}",
  1670. success:function(data){
  1671. $("#product_attr_table").html('').append(data);
  1672. },
  1673. error: function(e){
  1674. $('#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>');
  1675. }
  1676. });
  1677. }
  1678. /** 以下 图集相册的拖动排序相关 js*/
  1679. $( ".sort-list-img" ).sortable({
  1680. start: function( event, ui) {
  1681. }
  1682. ,stop: function( event, ui ) {
  1683. // var rdata = '', url="{:url('Product/ajax_sort_proimg')}";
  1684. // var container = $(ui.item).closest("TB");
  1685. // var LIs = $(container).find("DIV");
  1686. // $(LIs).each(function(){
  1687. // console.log($(this))
  1688. // rdata += $(this).attr('rel') + ',' + $(this).index() + '|';
  1689. // });
  1690. // rdata = rdata.substr(0, (rdata.length-1));
  1691. // console.log(rdata)
  1692. // $.post(url, {str:rdata}, function(){
  1693. // });
  1694. }
  1695. });
  1696. //因为他们要拖动,所以尽量设置他们的文字不能选择。
  1697. // $( ".sort-list-img" ).disableSelection();
  1698. </script>
  1699. <script>
  1700. try{
  1701. var mt20_1649209614 = sessionStorage.getItem("mt20_1649209614");
  1702. if (mt20_1649209614 == 1){
  1703. $("#geduan_div").removeClass("h10");
  1704. }else{
  1705. $("#geduan_div").addClass("h10");
  1706. }
  1707. }catch(e){}
  1708. </script>
  1709. {include file="public/footer" /}