1d7fe2216b1edaff8c774efa7a9be1cb.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <?php /*a:3:{s:73:"D:\project\gyx\gaoyixia\application\operate\view\supplier_goods\form.html";i:1711355489;s:56:"D:\project\gyx\gaoyixia\application\admin\view\main.html";i:1699858976;s:73:"D:\project\gyx\gaoyixia\application\mall\view\store_goods\form_style.html";i:1699858976;}*/ ?>
  2. <div class="layui-card layui-bg-gray"><?php if(!(empty($title) || (($title instanceof \think\Collection || $title instanceof \think\Paginator ) && $title->isEmpty()))): ?><div class="layui-card-header layui-anim layui-anim-fadein notselect"><span class="layui-icon layui-icon-next font-s10 color-desc margin-right-5"></span><?php echo htmlentities((isset($title) && ($title !== '')?$title:'')); ?><div class="pull-right"></div></div><?php endif; ?><div class="layui-card-body layui-anim layui-anim-upbit"><style> .inner-input {
  3. width: 80px;
  4. height: 14px;
  5. padding: 1px 5px;
  6. line-height: 12px;
  7. }
  8. .goods-spec-box {
  9. position: relative;
  10. margin: 0 10px 10px 0;
  11. vertical-align: middle;
  12. }
  13. .goods-spec-title {
  14. z-index: 2;
  15. width: 40px;
  16. color: #fff;
  17. height: 28px;
  18. position: absolute;
  19. background: #999;
  20. line-height: 28px;
  21. }
  22. .goods-spec-close {
  23. right: 8px;
  24. z-index: 2;
  25. line-height: 28px;
  26. position: absolute;
  27. display: inline-block
  28. }
  29. .goods-spec-btn {
  30. height: 28px;
  31. margin-left: 5px !important;
  32. line-height: 26px !important;
  33. }
  34. .goods-spec-box input {
  35. z-index: 1;
  36. width: 120px;
  37. position: relative;
  38. border: 1px solid #999;
  39. padding: 5px 0 5px 45px;
  40. display: inline-block !important;
  41. }
  42. .goods-spec-box input[type=checkbox] {
  43. z-index: 2;
  44. width: 40px;
  45. height: 28px;
  46. border: none;
  47. cursor: pointer;
  48. appearance: none;
  49. position: absolute;
  50. -webkit-appearance: none;
  51. }
  52. .goods-spec-box input[type=checkbox]:before {
  53. top: 1px;
  54. left: 1px;
  55. width: 40px;
  56. height: 26px;
  57. content: ' ';
  58. position: absolute;
  59. background: #c9c9c9;
  60. }
  61. .goods-spec-box input[type=checkbox]:after {
  62. top: 1px;
  63. left: 1px;
  64. color: #999;
  65. width: 40px;
  66. height: 26px;
  67. content: '\e63f';
  68. font-size: 16px;
  69. line-height: 26px;
  70. position: absolute;
  71. text-align: center;
  72. font-family: 'layui-icon';
  73. }
  74. .goods-spec-box input[type=checkbox]:checked:after {
  75. color: #333;
  76. content: '\e605';
  77. }
  78. </style><style> .layui-form-radio{
  79. margin: 0 !important;
  80. padding-right:0 !important;
  81. }
  82. .layui-form-select{
  83. margin-right: 10px !important;
  84. }
  85. .layui-col-xs9{
  86. width: 90%;
  87. }
  88. </style><form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off"><div class="layui-card-body think-box-shadow padding-left-40"><div class="layui-tab"><ul class="layui-tab-title"><li class="layui-this">产品设置</li></ul><div class="layui-tab-content"><!--基础设置--><div class="layui-tab-item layui-show"><!--基础设置start--><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative"><span class="color-green">名称</span><input name="name" required class="layui-input" placeholder="请输入产品名称" value="<?php echo htmlentities((isset($vo['name']) && ($vo['name'] !== '')?$vo['name']:'')); ?>"></label></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative"><span class="color-green">标签</span><span class="margin-left-10 color-gray">多个半角逗号(,)隔开</span><textarea placeholder="请输入标签" class="layui-textarea" name="label"><?php echo htmlentities((isset($vo['label']) && ($vo['label'] !== '')?$vo['label']:'')); ?></textarea></label></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative"><span class="color-green">描述</span><textarea placeholder="请输入描述内容" class="layui-textarea" name="desc"><?php echo htmlentities((isset($vo['desc']) && ($vo['desc'] !== '')?$vo['desc']:'')); ?></textarea></label></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative" style="width: 100%;"><span class="color-green">产品分类</span></label><div style="width: 100%"><div style="width: 15%;float: left;"><select class="layui-select" id="first_classify" name="first_classify" lay-filter="first_classify" lay-search><option selected data-first_key="-1" selected value="0">请选择</option><?php if(!empty($goods_cate)): foreach($goods_cate as $ck=>$cv): if(isset_full_check($vo,'first_classify',$cv['id'])): ?><option selected data-first_key="<?php echo htmlentities($ck); ?>" value="<?php echo htmlentities($cv['id']); ?>"><?php echo htmlentities($cv['title']); ?></option><?php else: ?><option data-first_key="<?php echo htmlentities($ck); ?>" value="<?php echo htmlentities($cv['id']); ?>"><?php echo htmlentities($cv['title']); ?></option><?php endif; ?><?php endforeach; ?><?php endif; ?></select></div><div style="width: 15%;float: left"><select class="layui-select" id="second_classify" name="second_classify" lay-filter="second_classify" lay-search></select></div><div style="width: 15%;float: left"><select class="layui-select" id="third_classify" name="third_classify" lay-filter="third_classify" lay-search></select></div><input type="hidden" id="first" value="<?php echo htmlentities((isset($vo['first_classify']) && ($vo['first_classify'] !== '')?$vo['first_classify']:'-1')); ?>"/><input type="hidden" id="second" value="<?php echo htmlentities((isset($vo['second_classify']) && ($vo['second_classify'] !== '')?$vo['second_classify']:'-1')); ?>"/><input type="hidden" id="third" value="<?php echo htmlentities((isset($vo['third_classify']) && ($vo['third_classify'] !== '')?$vo['third_classify']:'-1')); ?>"/></div></div><div class="layui-form-item layui-row layui-col-space15" ><label class="layui-col-xs3 relative"><span class="color-green">供应商</span><select name="supplier_id" lay-filter ="supplier_id" lay-search><option value="0">请选择</option><?php foreach($supplier_list as $dk=>$dv): ?><option <?php if(isset($vo['supplier_id']) && $vo['supplier_id'] == $dv['id']): ?>selected<?php endif; ?> value="<?php echo htmlentities($dv['id']); ?>"><?php echo htmlentities($dv['title']); ?></option><?php endforeach; ?></select></label><label class="layui-col-xs3 relative"><span class="color-green">评论开关</span><select class="layui-select" name="comment_switch" id="comment_switch" lay-filter="comment_switch" lay-search><option <?php if(isset($vo['comment_switch']) && $vo['comment_switch'] == 1): ?>selected<?php endif; ?> value="1">开启</option><option <?php if(isset($vo['comment_switch']) && $vo['comment_switch'] == 0): ?>selected<?php endif; ?> value="0">关闭</option></select></label></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative"><span class="color-green">关联资料</span></label><div class="layui-inline" style="top: -15px;margin-bottom: -25px"><div class="layui-input-inline"><select name="datum_id" lay-filter ="datum_id" lay-search><option value="0">请选择</option><?php foreach($datum_list as $dk=>$dv): ?><option <?php if(isset($vo['datum_id']) && $vo['datum_id'] == $dv['id']): ?>selected<?php endif; ?> data-dl_key="<?php echo htmlentities($dk); ?>" value="<?php echo htmlentities($dv['id']); ?>"><?php echo htmlentities($dv['title']); ?></option><?php endforeach; ?></select></div><div class="layui-input-inline"><select name="datum_item" lay-filter ="datum_item" lay-search><option value="0">请选择</option><?php foreach($datum_list as $vk=>$vv): if(isset($vo['datum_id']) && $vo['datum_id'] == $vv['id']): foreach($vv['url_arr'] as $cln): ?><option <?php if(isset($vo['datum_item']) && $vo['datum_item'] == $cln['id']): ?> selected <?php endif; ?> value="<?php echo htmlentities($cln['id']); ?>"><?php echo htmlentities($cln['title']); ?></option><?php endforeach; ?><?php endif; ?><?php endforeach; ?></select></div></div></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative"><span class="color-green">关联视频</span></label><div class="layui-inline" style="top: -15px;margin-bottom: -25px"><div class="layui-input-inline"><select name="video_id" lay-filter ="video_id" lay-search><option value="0">请选择</option><?php foreach($video_list as $vk=>$vv): ?><option <?php if(isset($vo['video_id']) && $vo['video_id'] == $vv['id']): ?>selected<?php endif; ?> data-vl_key="<?php echo htmlentities($vk); ?>" value="<?php echo htmlentities($vv['id']); ?>"><?php echo htmlentities($vv['title']); ?></option><?php endforeach; ?></select></div><div class="layui-input-inline"><select name="video_item" lay-filter ="video_item" lay-search><option value="0">请选择</option><?php foreach($video_list as $vk=>$vv): if(isset($vo['video_id']) && $vo['video_id'] == $vv['id']): foreach($vv['video_arr'] as $cln): ?><option <?php if(isset($vo['video_item']) && $vo['video_item'] == $cln['id']): ?> selected <?php endif; ?> value="<?php echo htmlentities($cln['id']); ?>"><?php echo htmlentities($cln['title']); ?></option><?php endforeach; ?><?php endif; ?><?php endforeach; ?></select></div></div></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative"><span class="color-green">关联文章</span></label><div class="layui-inline" style="top: -15px;margin-bottom: -25px"><div class="layui-input-inline"><select name="article_id" lay-filter ="article_id" lay-search><option value="0">请选择</option><?php foreach($article_list as $vk=>$vv): ?><option <?php if(isset($vo['article_id']) && $vo['article_id'] == $vv['id']): ?>selected<?php endif; ?> data-vl_key="<?php echo htmlentities($vk); ?>" value="<?php echo htmlentities($vv['id']); ?>"><?php echo htmlentities($vv['title']); ?></option><?php endforeach; ?></select></div><div class="layui-input-inline"><select name="article_item" lay-filter ="article_item" lay-search><option value="0">请选择</option><?php foreach($article_list as $vk=>$vv): if(isset($vo['article_id']) && $vo['article_id'] == $vv['id']): foreach($vv['item_children'] as $cln): ?><option <?php if(isset($vo['article_item']) && $vo['article_item'] == $cln['id']): ?> selected <?php endif; ?> value="<?php echo htmlentities($cln['id']); ?>"><?php echo htmlentities($cln['title']); ?></option><?php endforeach; ?><?php endif; ?><?php endforeach; ?></select></div></div></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative"><span class="color-green">会员账号</span><input name="phone" value='<?php echo htmlentities((isset($vo['phone']) && ($vo['phone'] !== '')?$vo['phone']:"")); ?>' placeholder="请输入会员会员账号" class="layui-input"></label></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative"><span class="color-green">上架时间</span><input name="release_time" value='<?php echo htmlentities((isset($vo['release_time']) && ($vo['release_time'] !== '')?$vo['release_time']:"")); ?>' class="layui-input"></label></div><div class="layui-form-item"><span class="color-green label-required-prev">图片</span><table class="layui-table"><thead><tr><td width="auto" class="text-left"><input name="cover" type="hidden" value="<?php echo htmlentities((isset($vo['cover']) && ($vo['cover'] !== '')?$vo['cover']:'')); ?>"></td></tr></thead></table><script>$('[name="cover"]').uploadMultipleImage()</script></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs2 relative"><span class="color-green">排序</span><input name="sort" required class="layui-input" placeholder="请输入排序号" value="<?php echo htmlentities((isset($vo['sort']) && ($vo['sort'] !== '')?$vo['sort']:'0')); ?>"></label><label class="layui-col-xs2 relative"><span class="color-green">阅读量</span><input name="read_num" required class="layui-input" placeholder="请输入阅读量" value="<?php echo htmlentities((isset($vo['read_num']) && ($vo['read_num'] !== '')?$vo['read_num']:'0')); ?>"></label><label class="layui-col-xs2 relative"><span class="color-green">转发量</span><input name="transmit_num" required class="layui-input" placeholder="请输入转发量" value="<?php echo htmlentities((isset($vo['transmit_num']) && ($vo['transmit_num'] !== '')?$vo['transmit_num']:'0')); ?>"></label><label class="layui-col-xs2 relative"><span class="color-green">热搜阅读量</span><input name="hot_num" value='<?php echo htmlentities((isset($vo['hot_num']) && ($vo['hot_num'] !== '')?$vo['hot_num']:"")); ?>' placeholder="请输入热搜阅读量" class="layui-input"><input name="hot_num_old" type="hidden" value='<?php echo htmlentities((isset($vo['hot_num']) && ($vo['hot_num'] !== '')?$vo['hot_num']:"")); ?>' class="layui-input"></label></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs3 relative"><span class="color-green">热搜定时时间</span><input name="regular_hot_end_time" value='<?php echo htmlentities((isset($vo['regular_hot_end_time']) && ($vo['regular_hot_end_time'] !== '')?$vo['regular_hot_end_time']:"")); ?>' class="layui-input"></label><label class="layui-col-xs3 relative"><span class="color-green">目标热搜阅读量</span><input name="hot_target_num" value='<?php echo htmlentities((isset($vo['hot_target_num']) && ($vo['hot_target_num'] !== '')?$vo['hot_target_num']:"")); ?>' placeholder="请输入目标热搜阅读量" class="layui-input"></label></div><div class="layui-form-item layui-row layui-col-space15"><label class="layui-col-xs9 relative"><span class="color-green">产品详情</span><textarea name="content"><?php echo htmlentities((isset($vo['content']) && ($vo['content'] !== '')?$vo['content']:"")); ?></textarea></label></div><div class="layui-form-item text-center"><?php if(!(empty($vo['id']) || (($vo['id'] instanceof \think\Collection || $vo['id'] instanceof \think\Paginator ) && $vo['id']->isEmpty()))): ?><input type="hidden" name="id" value="<?php echo htmlentities($vo['id']); ?>"><?php endif; ?><!-- <input type='hidden' value='<?php echo htmlentities((isset($supplier_id) && ($supplier_id !== '')?$supplier_id:"0")); ?>' name='supplier_id'><input type='hidden' value='<?php echo htmlentities((isset($company_id) && ($company_id !== '')?$company_id:"0")); ?>' name='company_id'>--><button class="layui-btn" type="submit">保存</button><button class="layui-btn layui-btn-danger" type='button' onclick="history.go(-1)" data-close>返回</button></div></div></div></div></div></form></div><script> window.form.render();
  89. laydate.render({type: 'datetime', elem: '[name="release_time"]'})
  90. laydate.render({type: 'datetime', elem: '[name="regular_hot_end_time"]'})
  91. layui.use('element', function(){
  92. var $ = layui.jquery
  93. ,element = layui.element;
  94. var active = {
  95. tabAdd: function(){
  96. element.tabAdd('demo', {
  97. title: '新选项'+ (Math.random()*1000|0)
  98. ,content: '内容'+ (Math.random()*1000|0)
  99. ,id: new Date().getTime()
  100. })
  101. }
  102. ,tabDelete: function(othis){
  103. element.tabDelete('demo', '44');
  104. othis.addClass('layui-btn-disabled');
  105. }
  106. ,tabChange: function(){
  107. element.tabChange('demo', '22');
  108. }
  109. };
  110. $('.site-demo-active').on('click', function(){
  111. var othis = $(this), type = othis.data('type');
  112. active[type] ? active[type].call(this, othis) : '';
  113. });
  114. //Hash地址的定位
  115. var layid = location.hash.replace(/^#test=/, '');
  116. element.tabChange('test', layid);
  117. element.on('tab(test)', function(elem){
  118. location.hash = 'test='+ $(this).attr('lay-id');
  119. });
  120. });
  121. require(['ckeditor', 'angular'], function () {
  122. window.createEditor('[name="content"]', {
  123. height: 500,
  124. });
  125. })
  126. // 关联视频监听
  127. form.on('select(video_id)', function(data){
  128. var cl_html = '<option value="0">请选择</option>';
  129. if(data.value == 0) {
  130. $("select[name='video_item']").html(cl_html);
  131. }else{
  132. var vl_key = data.elem[data.elem.selectedIndex].dataset.vl_key;
  133. var video_list = <?php echo json_encode($video_list); ?>;
  134. $.each(video_list[vl_key]['video_arr'],function (ck,cv) {
  135. cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
  136. })
  137. $("select[name='video_item']").html(cl_html);
  138. }
  139. window.form.render();
  140. });
  141. // 关联资料监听
  142. form.on('select(datum_id)', function(data){
  143. var cl_html = '<option value="0">请选择</option>';
  144. if(data.value == 0) {
  145. $("select[name='datum_item']").html(cl_html);
  146. }else{
  147. var dl_key = data.elem[data.elem.selectedIndex].dataset.dl_key;
  148. var datum_list = <?php echo json_encode($datum_list); ?>;
  149. $.each(datum_list[dl_key]['url_arr'],function (ck,cv) {
  150. cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
  151. })
  152. $("select[name='datum_item']").html(cl_html);
  153. }
  154. window.form.render();
  155. });
  156. // 文章监听
  157. form.on('select(article_id)', function(data){
  158. var cl_html = '<option value="0">请选择</option>';
  159. if(data.value == 0) {
  160. $("select[name='article_item']").html(cl_html);
  161. }else{
  162. var vl_key = data.elem[data.elem.selectedIndex].dataset.vl_key;
  163. var article_list = <?php echo json_encode($article_list); ?>;
  164. $.each(article_list[vl_key]['item_children'],function (ck,cv) {
  165. cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
  166. })
  167. $("select[name='article_item']").html(cl_html);
  168. }
  169. window.form.render();
  170. });
  171. // 三级分类联动 start
  172. var sel_second = <?php echo isset($vo['second_classify']) ? $vo['second_classify']:0; ?>;
  173. var sel_third = <?php echo isset($vo['third_classify']) ? $vo['third_classify']:0; ?>;
  174. var goods_spec = <?php echo json_encode($goods_cate); ?>;
  175. first(1);
  176. function first(source){
  177. // 将其他选择框置空
  178. var first_key = $("select[name='first_classify']").find("option:selected").data("first_key")
  179. $("#first").val(first_key);
  180. $("select[name='second_classify']").html('');
  181. $("select[name='third_classify']").html('');
  182. $("select[name='fourth_classify']").html('');
  183. // 没有下级不继续
  184. if(first_key == -1 || !("children" in goods_spec[first_key])){
  185. $("#second").val(-1);
  186. $("#third").val(-1);
  187. window.form.render();
  188. return true;
  189. }else{
  190. var second_html = '<option data-second_key="-1" selected value="0">请选择分类</option>';
  191. var to_each = goods_spec[first_key]['children'];
  192. $.each(to_each,function (ck,cv) {
  193. if(source == 1 && sel_second == cv.id){
  194. second_html +='<option selected data-second_key="'+ck+'" value="'+cv.id+'">'+cv.title+'</option>';
  195. $("#second").val(ck);
  196. }else{
  197. second_html +='<option data-second_key="'+ck+'" value="'+cv.id+'">'+cv.title+'</option>';
  198. }
  199. })
  200. $("select[name='second_classify']").html(second_html);
  201. window.form.render();
  202. second(source);
  203. }
  204. }
  205. function second(source){
  206. var first_key = $("select[name='first_classify']").find("option:selected").data("first_key");
  207. var second_key = $("select[name='second_classify']").find("option:selected").data("second_key");
  208. // 将其他选择框置空
  209. $("#second").val(second_key);
  210. $("select[name='third_classify']").html('');
  211. $("select[name='fourth_classify']").html('');
  212. // 没有下级不继续
  213. if(second_key == -1 || !("children" in goods_spec[first_key]['children'][second_key])){
  214. $("#third").val(-1);
  215. window.form.render();
  216. return true;
  217. }
  218. var to_each = goods_spec[first_key]['children'][second_key]['children'];
  219. var third_html = '<option data-third_key="-1" selected value="0">请选择分类</option>';
  220. $.each(to_each,function (ck,cv) {
  221. if(source == 1 && sel_third == cv.id){
  222. third_html +='<option selected data-third_key="'+ck+'" value="'+cv.id+'">'+cv.title+'</option>';
  223. $("#third").val(ck);
  224. }else{
  225. third_html +='<option data-third_key="'+ck+'" value="'+cv.id+'">'+cv.title+'</option>';
  226. }
  227. })
  228. $("select[name='third_classify']").html(third_html);
  229. $("select[name='fourth_classify']").html('');
  230. window.form.render();
  231. }
  232. // 一级分类监听
  233. form.on('select(first_classify)', function(data){
  234. var first_key = data.elem[data.elem.selectedIndex].dataset.first_key;
  235. //与之前选择的一样不处理
  236. if($("#first").val() == first_key){
  237. return true;
  238. }
  239. first(2);
  240. })
  241. // 二级分类监听
  242. form.on('select(second_classify)', function(data){
  243. var second_key = data.elem[data.elem.selectedIndex].dataset.second_key;
  244. //与之前选择的一样不处理
  245. if($("#second").val() == second_key){
  246. return true;
  247. }
  248. second(2)
  249. })
  250. // 三级分类end
  251. </script></div>