form.html 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. {extend name='admin@main'}
  2. {block name="content"}
  3. {include file='mall@store_goods/form_style'}
  4. <style>
  5. .layui-form-radio{
  6. margin: 0 !important;
  7. padding-right:0 !important;
  8. }
  9. .layui-form-select{
  10. margin-right: 10px !important;
  11. }
  12. </style>
  13. <form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
  14. <div class="layui-card-body think-box-shadow padding-left-40">
  15. <div class="layui-tab">
  16. <ul class="layui-tab-title">
  17. <li class="layui-this">基础设置</li>
  18. <li>规格设置</li>
  19. </ul>
  20. <div class="layui-tab-content">
  21. <!--基础设置-->
  22. <div class="layui-tab-item layui-show">
  23. <!--基础设置start-->
  24. <div class="layui-form-item layui-row layui-col-space15">
  25. <label class="layui-col-xs9 relative">
  26. <span class="color-green">商品名称</span>
  27. <input name="name" required class="layui-input" placeholder="请输入商品名称" value="{$vo.name|default=''}">
  28. </label>
  29. </div>
  30. <div class="layui-form-item layui-row layui-col-space15">
  31. <label class="layui-col-xs9 relative">
  32. <span class="color-green">副标题</span>
  33. <input name="desc" required class="layui-input" placeholder="请输入商品副标题" value="{$vo.desc|default=''}">
  34. </label>
  35. </div>
  36. <div class="layui-form-item layui-row layui-col-space15">
  37. <label class="layui-col-xs9 relative">
  38. <span class="color-green">会员账号</span>
  39. <input name="phone" class="layui-input" placeholder="请输入会员账号" value="{$vo.phone|default=''}">
  40. </label>
  41. </div>
  42. <!-- 商品分类-->
  43. <div class="layui-form-item layui-row layui-col-space15">
  44. <label class="layui-col-xs9 relative" style="width: 100%;">
  45. <span class="color-green">商品分类</span>
  46. </label>
  47. <div style="width: 100%">
  48. <div style="width: 15%;float: left;">
  49. <select class="layui-select" id="first_classify" name="first_classify" lay-filter="first_classify" lay-search>
  50. <option selected data-first_key="-1" selected value="0">请选择</option>
  51. {if !empty($goods_cate)}
  52. {foreach $goods_cate as $ck=>$cv}
  53. {if isset_full_check($vo,'first_classify',$cv['id'])}
  54. <option selected data-first_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
  55. {else}
  56. <option data-first_key="{$ck}" value="{$cv['id']}">{$cv['title']}</option>
  57. {/if}
  58. {/foreach}
  59. {/if}
  60. </select>
  61. </div>
  62. <div style="width: 15%;float: left">
  63. <select class="layui-select" id="second_classify" name="second_classify" lay-filter="second_classify" lay-search>
  64. </select>
  65. </div>
  66. <input type="hidden" id="first" value="{$vo.first_classify|default='-1'}"/>
  67. <input type="hidden" id="second" value="{$vo.second_classify|default='-1'}"/>
  68. </div>
  69. </div>
  70. <div class="layui-form-item">
  71. <span class="color-green label-required-prev">商品LOGO及轮播展示图片</span>
  72. <table class="layui-table">
  73. <thead>
  74. <tr>
  75. <th class="text-center">LOGO</th>
  76. <th class="text-left">展示图片</th>
  77. </tr>
  78. <tr>
  79. <td width="90px" class="text-center"><input name="cover" type="hidden" value="{$vo.cover|default=''}"></td>
  80. <td width="auto" class="text-left"><input name="image" type="hidden" value="{$vo.image|default=''}"></td>
  81. </tr>
  82. </thead>
  83. </table>
  84. <script>$('[name="cover"]').uploadOneImage(), $('[name="image"]').uploadMultipleImage()</script>
  85. </div>
  86. <div class="layui-form-item">
  87. <span class="color-green label-required-prev">商品详情图</span>
  88. <table class="layui-table">
  89. <thead>
  90. <tr>
  91. <th class="text-left">展示图片</th>
  92. </tr>
  93. <tr>
  94. <td width="auto" class="text-left"><input name="content" type="hidden" value="{$vo.content|default=''}"></td>
  95. </tr>
  96. </thead>
  97. </table>
  98. <script>$('[name="content"]').uploadMultipleImage()</script>
  99. </div>
  100. <!-- 运费设置-->
  101. <div class="freight_box">
  102. <div class="layui-form-item layui-row layui-col-space15">
  103. <label class="layui-col-xs9 relative" style="width: 100%;">
  104. <span class="color-green">模板开关</span>
  105. <div class="layui-input-block margin-left-0 margin-top-15">
  106. <label >
  107. <input type="radio" class="layui-input" value="0" name="freight_type" lay-filter="freight_type" {if !isset($vo.freight_type) || !$vo.freight_type}checked{/if} >
  108. </label>
  109. <span class="margin-right-10">固定运费</span>
  110. <label>
  111. <input type="radio" class="layui-input" value="1" name="freight_type" lay-filter="freight_type" {if isset($vo.freight_type) && $vo.freight_type}checked{/if} >
  112. </label>
  113. <span class="margin-right-10">运费模板</span>
  114. </div>
  115. </label>
  116. </div>
  117. <div class="layui-form-item layui-row layui-col-space15 freight_mud" {if !isset($vo.freight_type) || !$vo.freight_type}style="display:none"{/if}>
  118. <label class="layui-col-xs9 relative" style="width: 100%;">
  119. <span class="color-green">运费模板</span>
  120. <select name="freight_id" class="layui-select" lay-filter ="freight_id">
  121. <option value="0" >请选择</option>
  122. {if !empty($express)}
  123. {foreach $express as $tk=>$tv}
  124. {if isset($vo.freight_id) && $vo.freight_id ==$tv['id'] }
  125. <option selected value="{$tv['id']}">{$tv['name']}</option>
  126. {else}
  127. <option value="{$tv['id']}">{$tv['name']}</option>
  128. {/if}
  129. {/foreach}
  130. {/if}
  131. </select>
  132. </label>
  133. </div>
  134. <div class="layui-form-item layui-row layui-col-space15 postage" {if isset($vo.freight_type) && $vo.freight_type}style="display:none"{/if}>
  135. <label class="layui-col-xs9 relative" style="width: 100%;">
  136. <span class="color-green">运费金额</span>
  137. <input type="number" step="1" min="0" name="postage" value="{$vo.postage|default=''}" class="layui-input">
  138. </label>
  139. <div class="layui-form-mid layui-word-aux" style="margin-left: 10px">不填(或0)表示包邮</div>
  140. </div>
  141. </div>
  142. <!-- 运费设置 end-->
  143. </div>
  144. <!--规格设置start-->
  145. <div class="layui-tab-item">
  146. <div class="layui-form-item">
  147. <span class="color-green label-required-prev">商品规格及商品SKU绑定<span class="color-red font-s12">(规格填写后不允许再次修改)</span></span>
  148. <div ng-repeat="x in specs track by $index" style="display:none" class="margin-bottom-10" ng-class="{true:'layui-show'}[isAddMode&&specs.length>0]">
  149. <div class="goods-spec-box padding-10 margin-0 relative" style="background:#ddd">
  150. <span class="text-center goods-spec-title">分组</span>
  151. <label class="label-required-null inline-block"><input ng-blur="x.name=trimSpace(x.name)" ng-model="x.name" required placeholder="请输入分组名称"></label>
  152. <div class="pull-right">
  153. <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-click="addSpecVal(x.list)">增加</a>
  154. <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-class="{false:'layui-bg-gray'}[$index>0]" ng-click="upSpecRow(specs,$index)">上移</a>
  155. <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-class="{false:'layui-bg-gray'}[$index<specs.length-1]" ng-click="dnSpecRow(specs,$index)">下移</a>
  156. <a class="layui-btn layui-btn-sm layui-btn-primary goods-spec-btn" ng-click="delSpecRow(specs,$index)" ng-if="specs.length>1">删除</a>
  157. </div>
  158. </div>
  159. <div class="goods-spec-box padding-10 margin-0 layui-bg-gray block relative" ng-if="x.list && x.list.length > 0">
  160. <label class="label-required-null inline-block margin-right-10 margin-bottom-5 relative nowrap" ng-repeat="xx in x.list">
  161. <input type="checkbox" lay-ignore ng-model="xx.check" ng-click="xx.check=checkListChecked(x.list,$event.target.checked)">
  162. <input type="text" ng-blur="xx.name=trimSpace(xx.name)" ng-model="xx.name" ng-keyup="xx.name=$event.target.value" required placeholder="请输入规格">
  163. <a ng-if="x.list.length>1" ng-click="x.list=delSpecVal(x.list,$index)" class="layui-icon layui-icon-close font-s12 goods-spec-close"></a>
  164. </label>
  165. </div>
  166. </div>
  167. <!-- <a ng-if="isAddMode&&specs.length<3" class="layui-btn layui-btn-sm layui-btn-primary" ng-click="addSpecRow(specs)">增加分组</a>
  168. -->
  169. <table class="layui-table margin-top-10">
  170. <thead>
  171. <tr>
  172. <th ng-repeat="x in specsTreeNava track by $index" class="nowrap" ng-bind="x"></th>
  173. <th width="10%" class="text-center nowrap">商品SKU <a ng-click="batchSet('sku',null)" data-tips-text="批量设置" class="layui-icon">&#xe63c;</a></th>
  174. <th width="10%" class="text-center nowrap">市场价格 <a ng-click="batchSet('original_price',2)" data-tips-text="批量设置" class="layui-icon">&#xe63c;</a></th>
  175. <th width="10%" class="text-center nowrap">销售价格 <a ng-click="batchSet('sell_price',2)" data-tips-text="批量设置" class="layui-icon">&#xe63c;</a></th>
  176. <th width="10%" class="text-center nowrap">虚拟销量 <a ng-click="batchSet('virtual',0)" data-tips-text="批量设置" class="layui-icon">&#xe63c;</a></th>
  177. <th width="10%" class="text-center nowrap">重量(KG)<a ng-click="batchSet('weight',2)" data-tips-text="批量设置" class="layui-icon">&#xe63c;</a></th>
  178. <th width="10%" class="text-center nowrap">销售状态</th>
  179. </tr>
  180. </thead>
  181. <tbody>
  182. <tr ng-repeat="rows in specsTreeData track by $index">
  183. <td class="layui-bg-gray" ng-if="td.show" rowspan="{{td.span}}" ng-repeat="td in rows" ng-bind="td.name"></td>
  184. <td class="padding-0">
  185. <label class="padding-0 margin-0">
  186. <input ng-blur="rows[0].sku=setValue(rows[0].key,'sku',$event.target.value)" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].sku">
  187. </label>
  188. </td>
  189. <td class="padding-0">
  190. <label class="padding-0 margin-0">
  191. <input ng-blur="rows[0].original_price=setValue(rows[0].key,'original_price',$event.target.value,'(parseFloat(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].original_price">
  192. </label>
  193. </td>
  194. <td class="padding-0">
  195. <label class="padding-0 margin-0">
  196. <input ng-blur="rows[0].sell_price=setValue(rows[0].key,'sell_price',$event.target.value,'(parseFloat(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].sell_price">
  197. </label>
  198. </td>
  199. <td class="padding-0">
  200. <label class="padding-0 margin-0">
  201. <input ng-blur="rows[0].virtual=setValue(rows[0].key,'virtual',$event.target.value,'(parseInt(_)||0)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].virtual">
  202. </label>
  203. </td>
  204. <td class="padding-0">
  205. <label class="padding-0 margin-0">
  206. <input ng-blur="rows[0].weight=setValue(rows[0].key,'weight',$event.target.value,'(parseInt(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].weight">
  207. </label>
  208. </td>
  209. <td class="text-center layui-bg-gray">
  210. <label class="think-checkbox margin-0 full-width full-height block"><input lay-ignore type="checkbox" ng-model="rows[0].status"></label>
  211. </td>
  212. </tr>
  213. </tbody>
  214. </table>
  215. <p class="color-desc">请从仓储平台获取商品SKU与商品条码,请注意尽量不要重复,也不能产生订单后再修改!</p>
  216. <textarea class="layui-textarea layui-hide" name="specs">{{specs}}</textarea>
  217. <textarea class="layui-textarea layui-hide" name="lists">{{specsTreeData}}</textarea>
  218. </div>
  219. <div class="layui-form-item layui-row layui-col-space15">
  220. <label class="layui-col-xs15 relative">
  221. <span class="color-green">详情</span>
  222. <textarea name="detail">{$vo.detail|default=""}</textarea>
  223. </label>
  224. </div>
  225. <div class="layui-form-item text-center">
  226. {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
  227. <button class="layui-btn" type="submit">保存商品</button>
  228. <button class="layui-btn layui-btn-danger" type='button' onclick="history.go(-1)" data-close>返回</button>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. </div>
  234. </form>
  235. {/block}
  236. {block name='script'}
  237. <textarea class="layui-hide" id="goods-specs">{$vo.specs|raw|default=''}</textarea>
  238. <textarea class="layui-hide" id="goods-value">{$defaultValues|raw|default=''}</textarea>
  239. <script>
  240. window.form.render();
  241. layui.use('form', function () {
  242. var form = layui.form;
  243. //日期时间范围
  244. laydate.render({
  245. elem: '#sell_time'
  246. ,type: 'datetime'
  247. });
  248. //监听指定开关
  249. form.on('radio(freight_type)', function(data) {
  250. if (data.value == 1) {
  251. $(".freight_mud").show();
  252. $(".postage").hide();
  253. } else {
  254. $(".freight_mud").hide();
  255. $(".postage").show();
  256. }
  257. })
  258. //监听指定开关
  259. })
  260. require(['ckeditor', 'angular'], function () {
  261. //window.createEditor('[name="content"]', {height: 500});
  262. var app = angular.module("GoodsForm", []).run(callback);
  263. angular.bootstrap(document.getElementById(app.name), [app.name]);
  264. function getRand(length, prefix) {
  265. return (function (time, code) {
  266. code += parseInt(time.substr(0, 1)) + parseInt(time.substr(1, 1)) + time.substr(2, 8);
  267. while (code.length < length) code += Math.round(Math.random() * 10);
  268. return code;
  269. })(Date.now().toString(), prefix || '' + '')
  270. }
  271. function callback($rootScope) {
  272. $rootScope.isAddMode = parseInt('{$isAddMode|default=0}');
  273. $rootScope.maps = JSON.parse(angular.element('#goods-value').val() || '[]') || {};
  274. $rootScope.specs = JSON.parse(angular.element('#goods-specs').val() || '[{"name":"默认分组","list":[{"name":"默认规格","check":true}]}]');
  275. // 批量设置数值
  276. $rootScope.batchSet = function (type, fixed) {
  277. layer.prompt({title: '请输入数值', formType: 0}, function (value, index) {
  278. $rootScope.$apply(function () {
  279. var val = (parseFloat(value) || 0).toFixed(fixed);
  280. for (var i in $rootScope.specsTreeData) for (var j in $rootScope.specsTreeData[i]) {
  281. $rootScope.specsTreeData[i][j][type] = val;
  282. }
  283. });
  284. layer.close(index);
  285. });
  286. };
  287. // 返回商品列表
  288. $rootScope.hsitoryBack = function () {
  289. $.msg.confirm('确定要取消编辑吗?', function (index) {
  290. history.back(), $.msg.close(index);
  291. });
  292. };
  293. // 设置默认值
  294. $rootScope.setValue = function (key, type, value, call) {
  295. $rootScope.maps[key] || ($rootScope.maps[key] = {});
  296. return $rootScope.maps[key][type] = eval(call.replace('_', "'" + value + "'"));
  297. };
  298. // 读取默认值
  299. $rootScope.getValue = function (key, callback) {
  300. if (typeof callback === 'function') {
  301. return callback($rootScope.maps[key] || {});
  302. }
  303. return {};
  304. };
  305. // 去除空白字符
  306. $rootScope.trimSpace = function (value) {
  307. return (value + '').replace(/\s*/ig, '');
  308. };
  309. // 生成交叉表格数据
  310. $rootScope.specsTreeData = [];
  311. $rootScope.specsTreeNava = [];
  312. // 当前商品规格发生变化时重新计算规格列表
  313. $rootScope.$watch('specs', function () {
  314. var data = $rootScope.specs, list = [], navs = [], table = [[]];
  315. // 过滤无效记录
  316. for (var i in data) {
  317. var tmp = [];
  318. for (var j in data[i].list) if (data[i].list[j].check && data[i].list[j].name.length > 0) {
  319. data[i].list[j].span = 1, data[i].list[j].show = true, data[i].list[j].group = data[i].name;
  320. tmp.push(data[i].list[j]);
  321. }
  322. list.push(tmp), navs.push(data[i].name);
  323. }
  324. $rootScope.specsTreeNava = navs;
  325. // 表格交叉
  326. for (var i in list) {
  327. var tmp = [];
  328. for (var j in table) for (var k in list[i]) tmp.push(table[j].concat(list[i][k]));
  329. table = tmp;
  330. }
  331. // 表格合并
  332. list = angular.fromJson(angular.toJson(table));
  333. for (var i in list) {
  334. var key = [], _key = '';
  335. for (var td in list[i]) key.push(list[i][td].group + '::' + list[i][td].name);
  336. for (var td in list[i]) if (_key.length === 0) {
  337. list[i][0].key = _key = key.join(';;');
  338. list[i][0].sku = $rootScope.getValue(_key, function (data) {
  339. return data.sku || getRand(14, 'D')
  340. });
  341. list[i][0].virtual = $rootScope.getValue(_key, function (data) {
  342. return data.virtual || '0';
  343. });
  344. list[i][0].express = $rootScope.getValue(_key, function (data) {
  345. return data.express || '1';
  346. });
  347. list[i][0].original_price = $rootScope.getValue(_key, function (data) {
  348. return data.original_price || '0.00';
  349. });
  350. list[i][0].sell_price = $rootScope.getValue(_key, function (data) {
  351. return data.sell_price || '0.00';
  352. });
  353. list[i][0].status = $rootScope.getValue(_key, function (data) {
  354. return !!(typeof data.status !== 'undefined' ? data.status : true);
  355. });
  356. list[i][0].weight = $rootScope.getValue(_key, function (data) {
  357. return data.weight || '0.00';
  358. });
  359. list[i][0].goods_no = $rootScope.getValue(_key, function (data) {
  360. return data.goods_no || '';
  361. });
  362. }
  363. }
  364. $rootScope.specsTreeData = list;
  365. }, true);
  366. // 判断规则是否能取消选择
  367. $rootScope.checkListChecked = function (list, check) {
  368. for (var i in list) if (list[i].check) return check;
  369. return true;
  370. };
  371. // 增加整行规格分组
  372. $rootScope.addSpecRow = function (data) {
  373. data.push({name: '规格分组', list: [{name: '规格属性', check: true}]})
  374. };
  375. // 下移整行规格分组
  376. $rootScope.dnSpecRow = function (data, $index) {
  377. var tmp = [], cur = data[$index];
  378. if ($index > data.length - 2) return false;
  379. for (var i in data) {
  380. (parseInt(i) !== parseInt($index)) && tmp.push(data[i]);
  381. (parseInt(i) === parseInt($index) + 1) && tmp.push(cur);
  382. }
  383. return $rootScope.specs = tmp;
  384. };
  385. // 上移整行规格分组
  386. $rootScope.upSpecRow = function (data, $index) {
  387. var tmp = [], cur = data[$index];
  388. if ($index < 1) return false;
  389. for (var i in data) {
  390. (parseInt(i) === parseInt($index) - 1) && tmp.push(cur);
  391. (parseInt(i) !== parseInt($index)) && tmp.push(data[i]);
  392. }
  393. return $rootScope.specs = tmp;
  394. };
  395. // 移除整行规格分组
  396. $rootScope.delSpecRow = function (data, $index) {
  397. var tmp = [];
  398. for (var i in data) if (parseInt(i) !== parseInt($index)) tmp.push(data[i]);
  399. return $rootScope.specs = tmp;
  400. };
  401. // 增加分组的属性
  402. $rootScope.addSpecVal = function (list) {
  403. list.push({name: '规格属性', check: true});
  404. };
  405. // 移除分组的属性
  406. $rootScope.delSpecVal = function (data, $index) {
  407. var temp = [];
  408. for (var i in data) if (parseInt(i) !== parseInt($index)) temp.push(data[i]);
  409. return temp;
  410. };
  411. }
  412. })
  413. layui.use('element', function(){
  414. var $ = layui.jquery
  415. ,element = layui.element;
  416. var active = {
  417. tabAdd: function(){
  418. element.tabAdd('demo', {
  419. title: '新选项'+ (Math.random()*1000|0)
  420. ,content: '内容'+ (Math.random()*1000|0)
  421. ,id: new Date().getTime()
  422. })
  423. }
  424. ,tabDelete: function(othis){
  425. element.tabDelete('demo', '44');
  426. othis.addClass('layui-btn-disabled');
  427. }
  428. ,tabChange: function(){
  429. element.tabChange('demo', '22');
  430. }
  431. };
  432. $('.site-demo-active').on('click', function(){
  433. var othis = $(this), type = othis.data('type');
  434. active[type] ? active[type].call(this, othis) : '';
  435. });
  436. //Hash地址的定位
  437. var layid = location.hash.replace(/^#test=/, '');
  438. element.tabChange('test', layid);
  439. element.on('tab(test)', function(elem){
  440. location.hash = 'test='+ $(this).attr('lay-id');
  441. });
  442. });
  443. // 分类联动 start
  444. var sel_second = {:isset($vo['second_classify']) ? $vo['second_classify']:0};
  445. var goods_spec = {:json_encode($goods_cate)};
  446. first(1);
  447. function first(source){
  448. // 将其他选择框置空
  449. var first_key = $("select[name='first_classify']").find("option:selected").data("first_key")
  450. $("#first").val(first_key);
  451. $("select[name='second_classify']").html('');
  452. // 没有下级不继续
  453. if(first_key == -1 || !("children" in goods_spec[first_key])){
  454. $("#second").val(-1);
  455. window.form.render();
  456. return true;
  457. }else{
  458. var second_html = '<option data-second_key="-1" selected value="0">请选择分类</option>';
  459. var to_each = goods_spec[first_key]['children'];
  460. $.each(to_each,function (ck,cv) {
  461. if(source == 1 && sel_second == cv.id){
  462. second_html +='<option selected data-second_key="'+ck+'" value="'+cv.id+'">'+cv.title+'</option>';
  463. $("#second").val(ck);
  464. }else{
  465. second_html +='<option data-second_key="'+ck+'" value="'+cv.id+'">'+cv.title+'</option>';
  466. }
  467. })
  468. $("select[name='second_classify']").html(second_html);
  469. window.form.render();
  470. }
  471. }
  472. // 一级分类监听
  473. form.on('select(first_classify)', function(data){
  474. var first_key = data.elem[data.elem.selectedIndex].dataset.first_key;
  475. //与之前选择的一样不处理
  476. if($("#first").val() == first_key){
  477. return true;
  478. }
  479. first(2);
  480. })
  481. // 分类end
  482. require(['ckeditor', 'angular'], function () {
  483. window.createEditor('[name="detail"]', {
  484. height: 500,
  485. });
  486. })
  487. </script>
  488. {/block}