officialTable.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <title>财务订单</title>
  7. <meta name="description" content="">
  8. <meta name="keywords" content="">
  9. <link href="/css/ims/base.css" rel="stylesheet">
  10. <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css"/>
  11. <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css"/>
  12. <style>
  13. .red {
  14. color: red;
  15. }
  16. .yellow {
  17. color: #FF9900;
  18. }
  19. .ims-box {
  20. margin: 20px;
  21. }
  22. .screen > div {
  23. margin-right: 5px;
  24. }
  25. .screen button {
  26. padding: 4px 12px;
  27. }
  28. .table-box {
  29. margin-top: 30px;
  30. }
  31. .table-box table,
  32. .table-box table th {
  33. text-align: center;
  34. }
  35. .table-box button {
  36. margin-right: 5px;
  37. }
  38. .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
  39. line-height: 140px;
  40. text-align: center;
  41. }
  42. .resubmit-layer-box input {
  43. line-height: 20px;
  44. }
  45. .urge-layer-box {
  46. margin-top: 30px;
  47. margin-left: 30px;
  48. }
  49. .urge-layer-box textarea {
  50. margin-left: 15px;
  51. vertical-align: top;
  52. }
  53. .alert-msg {
  54. text-align: center;
  55. vertical-align: top;
  56. }
  57. </style>
  58. </head>
  59. <body>
  60. <div class="ims-box">
  61. <form action="<?php echo Yii::app()->createUrl('imsSale/officialTable'); ?>" method="get">
  62. <div class="screen">
  63. <div class="diy_select select-goods">
  64. <input type="hidden" id="goodsId" name="goodsId" class="diy_select_input" value="0">
  65. <div class="diy_select_txt">请选择商品</div>
  66. <div class="diy_select_btn"></div>
  67. <ul class="diy_select_list" style="display: none;width:570px">
  68. <li val="0">请选择商品</li>
  69. <?php if ($goodList): ?>
  70. <?php foreach ($goodList as $item): ?>
  71. <li val="<?php echo $item['goodsId'] ?>"><?php echo $item['goodsName'] ?></li>
  72. <?php endforeach; ?>
  73. <?php else: ?>
  74. <li val="0">暂无商品</li>
  75. <?php endif; ?>
  76. </ul>
  77. </div>
  78. <div class="diy_select select-package">
  79. <input type="hidden" id="packageId" name="packageId" class="diy_select_input" value="0">
  80. <div class="diy_select_txt">请选择套餐</div>
  81. <div class="diy_select_btn"></div>
  82. <ul class="diy_select_list" style="display: none;">
  83. <li val="0">请选择套餐</li>
  84. </ul>
  85. </div>
  86. <div class="diy_select select-status">
  87. <input type="hidden" id="status" name="status" class="diy_select_input" value="0">
  88. <div class="diy_select_txt">审批状态</div>
  89. <div class="diy_select_btn"></div>
  90. <ul class="diy_select_list" style="display: none;">
  91. <li val="0">审批状态</li>
  92. <?php foreach ($applyStatus as $as): ?>
  93. <li val="<?php echo ($as['dictCode']+1); ?>"><?php echo $as['name']; ?></li>
  94. <?php endforeach; ?>
  95. </ul>
  96. </div>
  97. <div class="diy_select select-orderType">
  98. <input type="hidden" id="orderType" name="orderType" class="diy_select_input" value="0">
  99. <div class="diy_select_txt">订单类型</div>
  100. <div class="diy_select_btn"></div>
  101. <ul class="diy_select_list" style="display: none;">
  102. <li val="0">订单类型</li>
  103. <li val="1">线上订单</li>
  104. <li val="2">线下订单</li>
  105. </ul>
  106. </div>
  107. <button type="submit" class="label-primary-s bth-s">查询</button>
  108. </div>
  109. </form>
  110. <div class="table-box">
  111. <table id="formalOrderTable"
  112. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable"
  113. style="font-size:12px">
  114. <thead>
  115. <!--<tr>
  116. <th>正式订单编号</th>
  117. <th>商品名称</th>
  118. <th>套餐</th>
  119. <th>下单年级</th>
  120. <th>下单时间</th>
  121. <th>关联销售订单</th>
  122. <th>本次申请人数</th>
  123. <th>退订数(含审核中)</th>
  124. <th>已订购人数</th>
  125. <th>剩余名额</th>
  126. <th>审批状态</th>
  127. <th>状态</th>
  128. <th>操作</th>
  129. </tr>
  130. -->
  131. <tr>
  132. <th>财务订单编号</th>
  133. <th>订单类型</th>
  134. <th>商品名称</th>
  135. <th>套餐</th>
  136. <th>使用年级</th>
  137. <th>使用时长</th>
  138. <th>下单时间</th>
  139. <th>关联销售订单</th>
  140. <th>申请人数</th>
  141. <th>退订人数</th>
  142. <th>退订中</th>
  143. <th>审批状态</th>
  144. <th>操作</th>
  145. </tr>
  146. </thead>
  147. <tbody>
  148. <?php if ($list): ?>
  149. <?php foreach ($list as $item): ?>
  150. <tr id="<?php echo $item['orderId']; ?>">
  151. <td><?php echo $item['orderNo']; ?></td>
  152. <td><?php echo $item['orderTypeName']; ?></td>
  153. <td><?php echo $item['goodsName']; ?></td>
  154. <td><?php echo $item['goodsPackageName']; ?></td>
  155. <td><?php echo isset($item['gradeText'])?$item['gradeText']:'';?></td>
  156. <td><?php echo isset($item['useTime'])?$item['useTime'].'月':'';?></td>
  157. <td><?php echo $item['createTime']; ?></td>
  158. <td>
  159. <?php if($item['orderType'] == 1){?>
  160. <a href="<?php echo Yii::app()->createUrl('imsSale/purposeTable',array('purposeOrderNo'=>$item['purposeOrderNo']))?>">
  161. <?php echo $item['purposeOrderNo']; ?>
  162. </a>
  163. <?php } else { ?>
  164. <?php echo $item['purposeOrderNo']; ?>
  165. <?php } ?>
  166. </td>
  167. <td><?php echo $item['quantity']; ?></td>
  168. <!-- <td><?php echo $item['refundNum']; ?></td>
  169. <td><?php echo $item['orderedNum']; ?></td>
  170. <td><?php echo $item['quantity'] - $item['orderedNum']-$item['refundNum']; ?></td>-->
  171. <td><?php if(isset($item['refundNum'])) echo $item['refundNum'];?></td>
  172. <td><?php if(isset($item['refundCheckNum'])) echo $item['refundCheckNum'];?></td>
  173. <td class="subject-type"
  174. status="<?php echo $item['status']; ?>"><?php echo $item['statusName']; ?></td>
  175. <td businessKey="<?php if(isset($item['processInfo'])) echo $item['processInfo']['businessKey']; ?>">
  176. <?php if ($item['status']!=1): ?>
  177. <a href="<?php echo $this->createUrl('imsSale/viewTurnOrder?orderId='.$item['orderId'].'&quantity='.$item['quantity'].'&orderNo='.$item['orderNo'].'&goodsName='.$item['goodsName'].'&gradeText='.$item['gradeText'].'&surplus='.($item['quantity'] - $item['orderedNum']-$item['refundNum']))?>" class="btn-view">查看</a>
  178. <?php endif; ?>
  179. <?php if (isset($item['processInfo']) && $item['processInfo']['showUrge']): ?>
  180. <a href="#" class="btn-urge">催办</a>
  181. <?php endif; ?>
  182. <?php if (isset($item['processInfo']) && $item['processInfo']['showStop']): ?>
  183. <a href="#" class="btn-stop">取消</a>
  184. <?php endif; ?>
  185. <?php if (isset($item['processInfo']) && $item['processInfo']['showDelete']): ?>
  186. <a href="#" class="btn-delete">删除</a>
  187. <?php endif; ?>
  188. <?php if (($item['status'] == 1 && ($item['quantity'] - $item['orderedNum']-$item['refundNum']) == 0) || ($item['status'] == 8 && $item['orderType'] == 0)): ?>
  189. <a href="<?php echo Yii::app()->createUrl('imsSale/detailOrder',array('orderNo'=>$item['orderNo']));?>" class="btn-review">查看明细订单</a>
  190. <?php endif; ?>
  191. <?php if ($item['status'] == 1 && $item['orderType'] == 1 && ($item['quantity'] - $item['orderedNum']-$item['refundNum']) > 0): ?>
  192. <a href="<?php echo Yii::app()->createUrl('imsSale/orderOfficial', array('orderId' => $item['orderId'], 'remainNum' => $item['quantity'] - $item['orderedNum'])); ?>"
  193. class="btn-order">订购</a>
  194. <?php endif; ?>
  195. </td>
  196. </tr>
  197. <?php endforeach; ?>
  198. <?php endif; ?>
  199. </tbody>
  200. </table>
  201. <?php if ($page): ?>
  202. <div class="col-sm-12">
  203. <ul class="pagination">
  204. <?php
  205. $params = array();
  206. if (isset($_GET['goodsId']) && $_GET['goodsId']) {
  207. $params['goodsId'] = $_GET['goodsId'];
  208. }
  209. if (isset($_GET['packageId']) && $_GET['packageId']) {
  210. $params['packageId'] = $_GET['packageId'];
  211. }
  212. if (isset($_GET['status']) && $_GET['status']>0) {
  213. $params['status'] = $_GET['status'];
  214. }
  215. if (isset($_GET['orderType']) && $_GET['orderType']>0) {
  216. $params['orderType'] = $_GET['orderType'];
  217. }
  218. if (isset($_GET['page'])) {
  219. $params['page'] = $_GET['page'];
  220. }else{
  221. $params['page'] = 1;
  222. }
  223. echo formatPage($page, 'imsSale/officialTable', $params)
  224. ?>
  225. </ul>
  226. </div>
  227. <?php endif; ?>
  228. </div>
  229. </div>
  230. <script src="/js/productset/jquery.min.js"></script>
  231. <script src="/js/ims/layer/layer.js"></script>
  232. <script src="/js/ims/xsgl.js"></script>
  233. <script>
  234. $(document).ready(function () {
  235. function studentType() {
  236. $(".student-type").each(function (index) {
  237. if ($(this).attr('status') == 1) {
  238. $(this).addClass("green");
  239. } else {
  240. $(this).addClass("red");
  241. }
  242. })
  243. }
  244. function setSubjectType() {
  245. $(".subject-type").each(function (index) {
  246. if ($(this).attr('status') == '1') {
  247. $(this).addClass("green");
  248. } else if ($(this).attr('status') == '2') {
  249. $(this).addClass("red");
  250. } else if ($(this).attr('status') == '3') {
  251. $(this).addClass("grey");
  252. } else {
  253. $(this).addClass("yellow");
  254. }
  255. })
  256. }
  257. studentType();
  258. setSubjectType();
  259. //筛选条件赋值
  260. <?php if(isset($_GET['goodsId']) && $_GET['goodsId']>0):?>
  261. var goodsId = "<?php echo $_GET['goodsId'];?>";
  262. $('#goodsId').val(goodsId);
  263. var txt = $('.select-goods li[val=' + goodsId + ']').html();
  264. $('.select-goods .diy_select_txt').html(txt);
  265. getPackage(goodsId);
  266. <?php endif;?>
  267. <?php if(isset($_GET['status']) && $_GET['status']>0):?>
  268. var status = "<?php echo $_GET['status'];?>";
  269. $('#status').val(status);
  270. var txt = $('.select-status li[val=' + status + ']').html();
  271. $('.select-status .diy_select_txt').html(txt);
  272. <?php endif;?>
  273. <?php if(isset($_GET['orderType']) && $_GET['orderType']>0):?>
  274. var orderType = "<?php echo $_GET['orderType'];?>";
  275. $('#orderType').val(orderType);
  276. var txt = $('.select-orderType li[val=' + orderType + ']').html();
  277. $('.select-orderType .diy_select_txt').html(txt);
  278. <?php endif;?>
  279. //获取套餐
  280. $('.select-goods li').click(function () {
  281. var goodsId = $('#goodsId').val();
  282. var currentGoodsId = $(this).attr('val');
  283. if (currentGoodsId > 0 && currentGoodsId != goodsId) {
  284. getPackage(currentGoodsId);
  285. }else{
  286. $('.select-package .diy_select_txt').val("请选择套餐");
  287. $('#packageId').val(0);
  288. $('.select-package ul').html('<li val="0">请选择套餐</li>');
  289. }
  290. });
  291. function getPackage(goodsId) {
  292. $.ajax({
  293. type: 'post',
  294. url: "<?php echo Yii::app()->createUrl('imsSale/getPackages');?>",
  295. data: {goodsId: goodsId},
  296. dataType: 'json',
  297. success: function (data) {
  298. console.log(data);
  299. if (data.status) {
  300. var html = '<li val="0">请选择套餐</li>';
  301. for (var i = 0; i < data.data.length; i++) {
  302. var item = data.data[i];
  303. if (item['packageId']) {
  304. html += '<li val="' + item['packageId'] + '">';
  305. html += item['packageName'];
  306. html += '</li>'
  307. }
  308. }
  309. } else {
  310. var html = '<li val="0">暂无套餐</li>';
  311. }
  312. $('.select-package ul').html(html);
  313. <?php if(isset($_GET['packageId'])):?>
  314. var packageId = "<?php echo $_GET['packageId'];?>";
  315. $('#packageId').val(packageId);
  316. var txt = $('.select-package li[val=' + packageId + ']').html();
  317. $('.select-package .diy_select_txt').html(txt);
  318. <?php endif;?>
  319. },
  320. error: function () {
  321. return;
  322. }
  323. })
  324. }
  325. //催办
  326. $(".table-box").on("click", ".btn-urge", function () {
  327. // var $(this)
  328. var flag = true;
  329. var businessKey = $(this).parent().attr('businessKey');
  330. layer.open({
  331. type: 1,
  332. title: '催办',
  333. btn: ['确定', '取消'],
  334. area: ['600px', '400px'], //宽高
  335. btnAlign: 'c',
  336. content: '<p style="color: red;display: none;" class="alert-msg"></p><div class="urge-layer-box"><span>内容:</span><textarea rows="10" cols="60" id="urgeText" /></div>',
  337. yes: function (index, layero) {
  338. //提交
  339. var text = $('#urgeText').val();
  340. var data = {
  341. 'smeDesc': text,
  342. 'businessKey': businessKey
  343. };
  344. if ($.trim(text)) {
  345. if (flag) {
  346. flag = false;
  347. $.ajax({
  348. type: 'post',
  349. url: "<?php echo Yii::app()->createUrl('imsSale/urge');?>",
  350. data: data,
  351. dataType: 'json',
  352. success: function (data) {
  353. if (data.status) {
  354. layer.closeAll();
  355. location.reload();
  356. } else {
  357. flag = true;
  358. $('.alert-msg').html(data.msg).fadeIn();
  359. }
  360. },
  361. error: function () {
  362. flag = true;
  363. $('.alert-msg').html("异常错误").fadeIn();
  364. }
  365. });
  366. }
  367. } else {
  368. $('.alert-msg').html("请填写内容").fadeIn();
  369. }
  370. },
  371. btn2: function (index, layero) {
  372. //取消按钮
  373. console.log(111)
  374. //return false 开启该代码可禁止点击该按钮关闭
  375. }
  376. });
  377. });
  378. //取消
  379. $(".table-box").on("click", ".btn-stop", function () {
  380. // var $(this)
  381. var businessKey = $(this).parent().attr('businessKey');
  382. layer.confirm('确认取消流程吗?', {
  383. btn: ['确定', '取消'] //按钮
  384. }, function () {
  385. $.ajax({
  386. type: 'post',
  387. url: "<?php echo Yii::app()->createUrl('imsSale/stop');?>",
  388. data: {'businessKey': businessKey,'title':"财务订单-取消"},
  389. dataType: 'json',
  390. success: function (data) {
  391. if (data.status) {
  392. layer.alert("取消成功", {icon:1,closeBtn:0},function () {
  393. location.reload();
  394. })
  395. } else {
  396. layer.alert(data.msg, {icon: 7});
  397. }
  398. },
  399. error: function () {
  400. layer.msg("网络异常");
  401. }
  402. });
  403. });
  404. });
  405. //重新提交
  406. $(".table-box").on("click", ".btn-reset", function () {
  407. // var $(this)
  408. var quantity = $(this).attr('quantity');
  409. var orderedNum = $(this).attr('orderedNum');
  410. var orderId = $(this).attr('orderId');
  411. var flag = true;
  412. layer.open({
  413. type: 1,
  414. title: '重新提交',
  415. btn: ['确定', '取消'],
  416. area: ['420px', '240px'], //宽高
  417. btnAlign: 'c',
  418. content: '<p style="color: red;" class="alert-msg"></p><div class="resubmit-layer-box"><span>申请人数</span> <input type="number" id="resubmitNumber" ></div>',
  419. yes: function (index, layero) {
  420. //提交
  421. var officialNum = $('#resubmitNumber').val();
  422. if (officialNum > 0) {
  423. if (flag) {
  424. flag = false;
  425. $.ajax({
  426. type: 'post',
  427. url: "<?php echo Yii::app()->createUrl('imsSale/reToOfficial');?>",
  428. data: {'orderId': orderId, 'officialNum': officialNum},
  429. dataType: 'json',
  430. success: function (data) {
  431. if (data.status) {
  432. layer.closeAll();
  433. location.reload();
  434. } else {
  435. flag = true;
  436. $('.alert-msg').html(data.msg).fadeIn();
  437. }
  438. },
  439. error: function () {
  440. flag = true;
  441. $('.alert-msg').html("异常错误").fadeIn();
  442. }
  443. });
  444. }
  445. } else {
  446. $('.alert-msg').html("请填写数量").fadeIn();
  447. }
  448. },
  449. btn2: function (index, layero) {
  450. //取消按钮
  451. console.log(111)
  452. //return false 开启该代码可禁止点击该按钮关闭
  453. }
  454. });
  455. });
  456. //删除
  457. $(".table-box").on("click", ".btn-delete", function () {
  458. // var $(this)
  459. var businessKey = $(this).parent().attr('businessKey');
  460. layer.confirm('确认删除该订单吗?', {
  461. btn: ['确定', '取消'] //按钮
  462. }, function () {
  463. $.ajax({
  464. type: 'post',
  465. url: "<?php echo Yii::app()->createUrl('imsSale/delete');?>",
  466. data: {'businessKey': businessKey,'title':"财务订单-删除"},
  467. dataType: 'json',
  468. success: function (data) {
  469. if (data.status) {
  470. layer.alert("删除成功", {icon:1,closeBtn:0},function () {
  471. location.reload();
  472. })
  473. } else {
  474. layer.msg(data.msg);
  475. }
  476. },
  477. error: function () {
  478. layer.msg("网络异常");
  479. }
  480. });
  481. });
  482. });
  483. $('body').on('focus', 'textarea', function () {
  484. $('.alert-msg').css("display", 'none');
  485. });
  486. $('body').on('focus', 'input', function () {
  487. $('.alert-msg').css("display", 'none');
  488. });
  489. });
  490. </script>
  491. </body>
  492. </html>