index.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
  2. <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/js/fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
  3. <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  4. <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/js/fancybox/source/helpers/jquery.fancybox-buttons.css?v=201401161314" type="text/css" media="screen" />
  5. <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/fancybox/source/helpers/jquery.fancybox-buttons.js?v=201401161314"></script>
  6. <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/js/fancybox/source/helpers/jquery.fancybox-textarea.css?v=1.0.7" type="text/css" media="screen" />
  7. <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/fancybox/source/helpers/jquery.fancybox-textarea.js?v=1.0.5"></script>
  8. <!--<script type="text/javascript" src="--><?php //echo Yii::app()->request->baseUrl; ?><!--/js/www/type_selector.js?v=201905243259"></script>-->
  9. <div id="main">
  10. <div region="west" border="false" style="width: 550px;">
  11. <table id="dg_content"></table>
  12. <div id="tb_content">
  13. <div class="tb_line">
  14. <input id="ss"/>
  15. <div id="mm">
  16. <!-- <div data-options="name:'0'">用户名</div> -->
  17. <div data-options="name:'1'">模糊搜</div>
  18. <div data-options="name:'2'">精确搜索</div>
  19. </div>
  20. <span class="tb_label">服务类型: </span>
  21. <input id="filter_type" />
  22. <div class="right" style="display: none;">
  23. <a href="#" class='easyui-linkbutton' iconCls="icon-search" plain="true" onclick="search_content();return false;">查询</a>
  24. </div>
  25. <span class="tb_label">状态: </span>
  26. <input id="filter_status" />
  27. <div class="right" style="display: none;">
  28. <a href="#" class='easyui-linkbutton' iconCls="icon-search" plain="true" onclick="search_content();return false;">查询</a>
  29. </div>
  30. </div>
  31. <div class="tb_line">
  32. <div class="tb_box">
  33. <span class="tb_label">批量操作: </span>
  34. <select id="multi_options" style="width:80px;">
  35. <option value=100 selected="selected">批量操作</option>
  36. <option value=1>正常</option>
  37. <option value=0>删除</option>
  38. </select>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <div region="center" title="信息">
  44. <div class="easyui-layout detail_layout">
  45. <div data-options="region:'center'" class="detail_center">
  46. <div class="detail_main">
  47. <form id="content_form" method="post">
  48. <ul>
  49. <li class="f_item">
  50. <div class="box">
  51. <div class="f_label">
  52. <span>ID: </span>
  53. </div>
  54. <div class="box_flex f_content">
  55. <input type="hidden" name="id" id="post_id" value='' />
  56. <span id="id_str"></span>
  57. </div>
  58. </div>
  59. </li>
  60. <li class="f_item">
  61. <div class="box">
  62. <div class="f_label">
  63. <span>服务种类: </span>
  64. </div>
  65. <div class="box_flex f_content">
  66. <span id="jq_type" name="type"></span>
  67. </div>
  68. </div>
  69. </li>
  70. <li class="f_item" id="content_area">
  71. <div class="box">
  72. <div class="f_label">
  73. <span>时间: </span>
  74. </div>
  75. <div class="box_flex f_content">
  76. <span id="time_str"></span>
  77. </div>
  78. </div>
  79. </li>
  80. <li class="f_item" id="content_area">
  81. <div class="box">
  82. <div class="f_label">
  83. <span>内容: </span>
  84. </div>
  85. <div class="box_flex f_content">
  86. <textarea name="content" disabled="disabled" style="width: 250px;min-height: 200px"></textarea>
  87. </div>
  88. </div>
  89. </li>
  90. <li class="f_item" id="content_area">
  91. <div class="box">
  92. <div class="f_label">
  93. <span>图片: </span>
  94. </div>
  95. <div class="box_flex f_content">
  96. <ul id="image_list"></ul>
  97. </div>
  98. </div>
  99. </li>
  100. <li class="f_item">
  101. <div class="box">
  102. <div class="f_label">
  103. <span>权重:</span>
  104. </div>
  105. <div class="box_flex f_content">
  106. <input id="setWeight" name="weight" />
  107. </div>
  108. </div>
  109. </li>
  110. <li class="f_item">
  111. <div class="box">
  112. <div class="f_label">
  113. <span>状态:</span>
  114. </div>
  115. <div class="box_flex f_content">
  116. <input id="setStatus" name="status" />
  117. </div>
  118. </div>
  119. </li>
  120. <li class="f_item">
  121. <div class="box">
  122. <div class="f_label">
  123. <span>保洁师:</span>
  124. </div>
  125. <div class="box_flex f_content" id="technician_name">
  126. </div>
  127. </div>
  128. </li>
  129. <li class="f_item">
  130. <div class="box">
  131. <div class="f_label">
  132. <span>回复:</span>
  133. </div>
  134. <div class="box_flex f_content">
  135. <textarea name="reply" style="width: 250px; height: 120px;"></textarea>
  136. </div>
  137. </div>
  138. </li>
  139. <li class="f_item">
  140. <div class="box">
  141. <div class="f_label">
  142. </div>
  143. <div class="box_flex f_content">
  144. <span id="action_info" style="color:green;"></span>
  145. </div>
  146. </div>
  147. </li>
  148. </ul>
  149. </form>
  150. </div>
  151. </div>
  152. <div data-options="region:'south'" class="detail_south">
  153. <div class="detail_toolbar">
  154. <a href="#" class="easyui-linkbutton set_button" iconCls="icon-save" onclick="save_content();return false;">保存</a>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. <style type="text/css">
  161. #image_list .img_list{
  162. float:left;
  163. margin:5px;
  164. }
  165. .clear {
  166. clear: both;
  167. }
  168. </style>
  169. <script type="text/javascript">
  170. var jq_dg_content = $('#dg_content');
  171. var temp = new Date();
  172. var today = temp.getFullYear() + '-' + (temp.getMonth() + 1) + '-' + temp.getDate();
  173. var w_width = $(window).width();
  174. var w_height = $(window).height();
  175. var jq_content_form = $('#content_form');
  176. var jq_content_id = $('#post_id');
  177. var jq_set_button = $('.set_button');
  178. var jq_multi_options = $('#multi_options');
  179. var jq_filter_status = $('#filter_status');
  180. var jq_filter_type = $('#filter_type');
  181. var jq_setStatus = $('#setStatus');
  182. var jq_setWeight = $('#setWeight');
  183. var jq_topic = $('#jq_topic');
  184. var jq_type = $('#jq_type');
  185. var jq_image_list = $('#image_list');
  186. var jq_ss = $('#ss');
  187. var jq_action_info = $('#action_info');
  188. var status_data = <?php echo json_encode($status); ?>;
  189. var type_data = <?php echo json_encode($type); ?>;
  190. var module_router = site_root + '/index.php?r=comment';
  191. $(function(){
  192. // $.fn.group_selector('init',{
  193. // container:"group_selector",
  194. // onselected:function(value){
  195. // search_content(value);
  196. // }
  197. // });
  198. $('#main').css({width: w_width - 25, height: w_height - 18}).layout();
  199. jq_ss.searchbox({
  200. width: 200,
  201. menu: '#mm',
  202. searcher:function(value){
  203. search_content();
  204. },
  205. prompt: '请输入关键字'
  206. });
  207. jq_filter_type.combobox({
  208. width: 90,
  209. editable: false,
  210. data: type_data,
  211. onSelect: function(){
  212. search_content();
  213. }
  214. });
  215. jq_filter_status.combobox({
  216. width: 90,
  217. editable: false,
  218. data: status_data,
  219. onSelect: function(){
  220. search_content();
  221. }
  222. });
  223. jq_setStatus.combobox({
  224. editable: false,
  225. data: status_data
  226. });
  227. jq_multi_options.combobox({
  228. editable: false,
  229. onSelect: function(){
  230. var ids = [];
  231. var rows = jq_dg_content.datagrid('getChecked');
  232. for(var i=0;i<rows.length;i++){
  233. ids.push(rows[i].id);
  234. }
  235. var multi_options = jq_multi_options.combobox('getValue');
  236. if(ids.length){
  237. $.ajax({
  238. url: site_root + '/index.php?r=comment/SetStatus',
  239. type: 'POST',
  240. data: {status: multi_options, ids: ids.join(',')},
  241. success: function(res) {
  242. if (res.success) {
  243. jq_dg_content.datagrid('reload');
  244. jq_dg_content.datagrid('clearChecked');
  245. jq_dg_content.datagrid('clearSelections');
  246. $('#multi_options').combobox('setValue',100);
  247. $.messager.show({
  248. title: '提示',
  249. msg: '批量修改成功',
  250. timeout: 3500,
  251. showType: 'slide'
  252. });
  253. } else {
  254. $.messager.show({
  255. title: '提示',
  256. msg: res.message,
  257. timeout: 3500,
  258. showType: 'slide'
  259. });
  260. }
  261. }
  262. });
  263. }
  264. }
  265. });
  266. jq_dg_content.datagrid({
  267. url: module_router + '/list',
  268. title: '评价列表',
  269. width: 530,
  270. height: w_height - 18,
  271. fitColumns: true,
  272. autoRowHeight: true,
  273. striped: true,
  274. toolbar: '#tb_content',
  275. singleSelect: true,
  276. selectOnCheck: false,
  277. checkOnSelect: false,
  278. pagination: true,
  279. pageList: [20, 30, 50],
  280. pageSize: 20,
  281. nowrap: false,
  282. idField: 'id',
  283. sortName: 'time',
  284. sortOrder: 'desc',
  285. queryParams: get_param_obj(),
  286. frozenColumns:[[
  287. {field:'ck',checkbox:true}
  288. ]],
  289. columns:[[
  290. {field:'user', title:'用户', width:40,
  291. formatter: function(value, row){
  292. var username = value.user_name;
  293. if(value.is_fake_user){
  294. username = '<span style="color:red;">'+value.user_name+'</span>';
  295. }
  296. return '<a href="javascript:;" onclick="parent.load_url(\'<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=rUser&id='+value.id+'\');">'+ username +'</a>';
  297. }
  298. },
  299. {field:'type', title:'服务种类', width:50, sortable: true,
  300. formatter: function(value, row){
  301. return get_filed_text(value, type_data);
  302. }
  303. },
  304. {field:'time', title:'时间', width:50, sortable: true,
  305. formatter: function(value, row){
  306. return row.time_str;
  307. }
  308. },
  309. {field:'status', title:'状态', width:25, sortable: true,
  310. formatter: function(value, row){
  311. return get_filed_text(value, status_data);
  312. }
  313. },
  314. {field:'weight', title:'权重', width:25, sortable: true,
  315. },
  316. {field:'score', title:'评分', width:25, sortable: true,
  317. },
  318. {field:'content', title:'内容', width:70,
  319. formatter: function(value, row){
  320. if(value){
  321. return value.substring(0,20);
  322. }
  323. }
  324. },
  325. {field:'order', title:'订单', width:25,
  326. formatter: function(value, row){
  327. if(value){
  328. return '<a href="javascript:;" onclick="parent.load_url(\'<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=rOrder&id='+value+'\');">'+ '订单' +'</a>';
  329. }
  330. }
  331. }
  332. ]],
  333. onSelect: function(index, row){
  334. var data = $.extend({}, row);
  335. jq_content_form.form('load', data);
  336. jq_set_button.linkbutton('enable');
  337. $('#id_str').html(data.id);
  338. $('#time_str').html(format_time_stamp(data.time,true));
  339. $('#jq_type').html(data.type);
  340. $('#weight').html(data.weight);
  341. if(data.content){
  342. $('#content_area').show();
  343. $('#voice_li').hide();
  344. }
  345. if (data['action_user'] != ''){
  346. jq_action_info.html('信息已被编辑: ' + data['action_user'] + ' ' + data['action_time']);
  347. } else {
  348. jq_action_info.html('');
  349. }
  350. if (data.pics) {
  351. if (data.pics.length > 0 && data.pics[0] != '') {
  352. var pic_count = 0;
  353. $('#image_list').empty();
  354. $.each(data.pics, function(key, row){
  355. pic_count++;
  356. var obj = '{"url":'+row.url+',"width":'+row.width+',"height":'+row.height+'}';
  357. $('#image_list').append('<div class="img_list"><img src="'+row.url+'" width="150" height="150"><input type="hidden" name="pics[]" value="'+obj+'" /></div>');
  358. if (pic_count % 3 == 0) {
  359. $('#image_list').append('<div class="clear"></div>');
  360. }
  361. });
  362. } else {
  363. $('#image_list').empty();
  364. $('#image_list').append('<span>无图片</span>');
  365. }
  366. }
  367. var $output = '';
  368. for(var j in data.technicians) {
  369. $output += '<a href="javascript:;" onclick="parent.load_url(\'<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=o2o/tech&id=' + data.technicians[j].technician_id + '\');">' + data.technicians[j].technician_name + '</a>&nbsp';
  370. }
  371. $('#technician_name').html($output);
  372. },
  373. onLoadSuccess: function(){
  374. $(this).datagrid('clearChecked');
  375. jq_content_form.form('clear');
  376. // console.log(data);
  377. jq_set_button.linkbutton('disable');
  378. $('#id_str').html('');
  379. /*$('#pics').val();*/
  380. $('#voice_li').hide();
  381. $('#time_str').html('');
  382. $('#video_li').hide();
  383. $('#image_list').empty();
  384. /* $('#pics_li').hide();*/
  385. jq_setStatus.combobox('setValue', 100);
  386. jq_image_list.empty();
  387. jq_action_info.html('');
  388. $('#technician_name').empty();
  389. }
  390. });
  391. jq_content_form.form({
  392. url: module_router + '/update',
  393. onSubmit: function(param){
  394. if (jq_content_id.val() <= 0){
  395. return false;
  396. }
  397. var isValid = $(this).form('validate');
  398. if (!isValid){
  399. $.messager.progress('close');
  400. }
  401. return isValid;
  402. },
  403. success: function(res){
  404. $.messager.progress('close');
  405. var res = JSON.parse(res);
  406. if (res.success){
  407. jq_topic.html('');
  408. jq_dg_content.datagrid('clearSelections');
  409. jq_dg_content.datagrid('reload');
  410. $.messager.show({
  411. title: '提示',
  412. msg: '保存成功',
  413. timeout: 3500,
  414. showType: 'slide'
  415. });
  416. }else{
  417. $.messager.show({
  418. title: '提示',
  419. msg: res.message,
  420. timeout: 3500,
  421. showType: 'slide'
  422. });
  423. }
  424. }
  425. });
  426. $('.fancybox').fancybox({
  427. prevEffect: 'none',
  428. nextEffect: 'none',
  429. type: 'image',
  430. helpers : {
  431. buttons : {}
  432. },
  433. closeBtn: false
  434. });
  435. })
  436. function search_content(){
  437. var filter_type = jq_filter_type.combobox('getValue');
  438. var filter_status = jq_filter_status.combobox('getValue');
  439. var search = jq_ss.searchbox('getValue');
  440. var search_type = jq_ss.searchbox('getName');
  441. var param = {type : filter_type, status : filter_status};
  442. if (search != ''){
  443. param['search'] = search;
  444. param['search_type'] = search_type;
  445. }
  446. jq_dg_content.datagrid({
  447. queryParams: param,
  448. pageNum: 1
  449. });
  450. }
  451. function save_content(){
  452. var a_id = jq_content_id.val();
  453. if (!a_id){
  454. return false;
  455. }
  456. if (jq_setStatus.combobox('getValue') != 1){
  457. $.messager.confirm('注意', '确认删除该条回复吗?', function(r){
  458. if (r){
  459. $.messager.progress();
  460. jq_content_form.submit();
  461. }
  462. });
  463. } else {
  464. $.messager.progress();
  465. jq_content_form.submit();
  466. }
  467. }
  468. </script>