Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

add.htm 83KB

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