return.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. /**
  3. * 退货管理
  4. *
  5. *
  6. *
  7. ***/
  8. defined('InShopNC') or exit('Access Invalid!');
  9. class returnControl extends SystemControl{
  10. public function __construct(){
  11. parent::__construct();
  12. $model_refund = Model('refund_return');
  13. $model_refund->getRefundStateArray();
  14. }
  15. /**
  16. * 待处理列表
  17. */
  18. public function return_manageOp() {
  19. $model_refund = Model('refund_return');
  20. $condition = array();
  21. $condition['refund_state'] = '2';//状态:1为处理中,2为待管理员处理,3为已完成
  22. $keyword_type = array('order_sn','refund_sn','store_name','buyer_name','goods_name');
  23. if (trim($_GET['key']) != '' && in_array($_GET['type'],$keyword_type)) {
  24. $type = $_GET['type'];
  25. $condition[$type] = array('like','%'.$_GET['key'].'%');
  26. }
  27. if (trim($_GET['add_time_from']) != '' || trim($_GET['add_time_to']) != '') {
  28. $add_time_from = strtotime(trim($_GET['add_time_from']));
  29. $add_time_to = strtotime(trim($_GET['add_time_to']));
  30. if ($add_time_from !== false || $add_time_to !== false) {
  31. $condition['add_time'] = array('time',array($add_time_from,$add_time_to));
  32. }
  33. }
  34. $return_list = $model_refund->getReturnList($condition,10);
  35. Tpl::output('return_list',$return_list);
  36. Tpl::output('show_page',$model_refund->showpage());
  37. Tpl::showpage('return_manage.list');
  38. }
  39. /**
  40. * 所有记录
  41. */
  42. public function return_allOp() {
  43. $model_refund = Model('refund_return');
  44. $condition = array();
  45. $keyword_type = array('order_sn','refund_sn','store_name','buyer_name','goods_name');
  46. if (trim($_GET['key']) != '' && in_array($_GET['type'],$keyword_type)) {
  47. $type = $_GET['type'];
  48. $condition[$type] = array('like','%'.$_GET['key'].'%');
  49. }
  50. if (trim($_GET['add_time_from']) != '' || trim($_GET['add_time_to']) != '') {
  51. $add_time_from = strtotime(trim($_GET['add_time_from']));
  52. $add_time_to = strtotime(trim($_GET['add_time_to']));
  53. if ($add_time_from !== false || $add_time_to !== false) {
  54. $condition['add_time'] = array('time',array($add_time_from,$add_time_to));
  55. }
  56. }
  57. $return_list = $model_refund->getReturnList($condition,10);
  58. Tpl::output('return_list',$return_list);
  59. Tpl::output('show_page',$model_refund->showpage());
  60. Tpl::showpage('return_all.list');
  61. }
  62. /**
  63. * 退货处理页
  64. *
  65. */
  66. public function editOp() {
  67. $model_refund = Model('refund_return');
  68. $condition = array();
  69. $condition['refund_id'] = intval($_GET['return_id']);
  70. $return_list = $model_refund->getReturnList($condition);
  71. $return = $return_list[0];
  72. if (chksubmit()) {
  73. if ($return['refund_state'] != '2') {//检查状态,防止页面刷新不及时造成数据错误
  74. showMessage(Language::get('nc_common_save_fail'));
  75. }
  76. $order_id = $return['order_id'];
  77. $refund_array = array();
  78. $refund_array['admin_time'] = time();
  79. $refund_array['refund_state'] = '3';//状态:1为处理中,2为待管理员处理,3为已完成
  80. $refund_array['admin_message'] = $_POST['admin_message'];
  81. $state = $model_refund->editOrderRefund($return);
  82. if ($state) {
  83. $model_refund->editRefundReturn($condition, $refund_array);
  84. $this->log('退货确认,退货编号'.$return['refund_sn']);
  85. // 发送买家消息
  86. $param = array();
  87. $param['code'] = 'refund_return_notice';
  88. $param['member_id'] = $return['buyer_id'];
  89. $param['param'] = array(
  90. 'refund_url' => urlShop('return_id', 'view', array('return_id' => $return['refund_id'])),
  91. 'refund_sn' => $return['refund_sn']
  92. );
  93. QueueClient::push('sendMemberMsg', $param);
  94. showMessage(Language::get('nc_common_save_succ'),'index.php?act=return&op=return_manage');
  95. } else {
  96. showMessage(Language::get('nc_common_save_fail'));
  97. }
  98. }
  99. Tpl::output('return',$return);
  100. $info['buyer'] = array();
  101. if(!empty($return['pic_info'])) {
  102. $info = unserialize($return['pic_info']);
  103. }
  104. Tpl::output('pic_list',$info['buyer']);
  105. Tpl::showpage('return.edit');
  106. }
  107. /**
  108. * 退货记录查看页
  109. *
  110. */
  111. public function viewOp() {
  112. $model_refund = Model('refund_return');
  113. $condition = array();
  114. $condition['refund_id'] = intval($_GET['return_id']);
  115. $return_list = $model_refund->getReturnList($condition);
  116. $return = $return_list[0];
  117. Tpl::output('return',$return);
  118. $info['buyer'] = array();
  119. if(!empty($return['pic_info'])) {
  120. $info = unserialize($return['pic_info']);
  121. }
  122. Tpl::output('pic_list',$info['buyer']);
  123. Tpl::showpage('return.view');
  124. }
  125. }