vr_refund.php 4.3 KB

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