pointorder.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. /**
  3. * 积分兑换订单管理
  4. ***/
  5. defined('InShopNC') or exit('Access Invalid!');
  6. class pointorderControl extends SystemControl{
  7. public function __construct(){
  8. parent::__construct();
  9. Language::read('pointorder');
  10. }
  11. /**
  12. * 积分兑换列表
  13. */
  14. public function pointorder_listOp(){
  15. $model_pointorder = Model('pointorder');
  16. //获取兑换订单状态
  17. $pointorderstate_arr = $model_pointorder->getPointOrderStateBySign();
  18. $where = array();
  19. //兑换单号
  20. $pordersn = trim($_GET['pordersn']);
  21. if ($pordersn){
  22. $where['point_ordersn'] = array('like',"%{$pordersn}%");
  23. }
  24. //兑换会员名称
  25. $pbuyname = trim($_GET['pbuyname']);
  26. if (trim($_GET['pbuyname'])){
  27. $where['point_buyername'] = array('like',"%{$pbuyname}%");
  28. }
  29. //订单状态
  30. if (trim($_GET['porderstate'])){
  31. $where['point_orderstate'] = $pointorderstate_arr[$_GET['porderstate']][0];
  32. }
  33. //查询兑换订单列表
  34. $order_list = $model_pointorder->getPointOrderList($where, '*', 10, 0, 'point_orderid desc');
  35. //信息输出
  36. Tpl::output('pointorderstate_arr',$pointorderstate_arr);
  37. Tpl::output('order_list',$order_list);
  38. Tpl::output('show_page',$model_pointorder->showpage());
  39. Tpl::showpage('pointorder.list');
  40. }
  41. /**
  42. * 删除兑换订单信息
  43. */
  44. public function order_dropOp(){
  45. $data = Model('pointorder')->delPointOrderByOrderID($_GET['order_id']);
  46. if ($data['state']){
  47. showDialog(L('admin_pointorder_del_success'),'index.php?act=pointorder&op=pointorder_list','succ');
  48. } else {
  49. showDialog($data['msg'],'index.php?act=pointorder&op=pointorder_list','error');
  50. }
  51. }
  52. /**
  53. * 取消兑换
  54. */
  55. public function order_cancelOp(){
  56. $model_pointorder = Model('pointorder');
  57. //取消订单
  58. $data = $model_pointorder->cancelPointOrder($_GET['id']);
  59. if ($data['state']){
  60. showDialog(L('admin_pointorder_cancel_success'),'index.php?act=pointorder&op=pointorder_list','succ');
  61. }else {
  62. showDialog($data['msg'],'index.php?act=pointorder&op=pointorder_list','error');
  63. }
  64. }
  65. /**
  66. * 发货
  67. */
  68. public function order_shipOp(){
  69. $order_id = intval($_GET['id']);
  70. if ($order_id <= 0){
  71. showDialog(L('admin_pointorder_parameter_error'),'index.php?act=pointorder&op=pointorder_list','error');
  72. }
  73. $model_pointorder = Model('pointorder');
  74. //获取订单状态
  75. $pointorderstate_arr = $model_pointorder->getPointOrderStateBySign();
  76. //查询订单信息
  77. $where = array();
  78. $where['point_orderid'] = $order_id;
  79. $where['point_orderstate'] = array('in',array($pointorderstate_arr['waitship'][0],$pointorderstate_arr['waitreceiving'][0]));//待发货和已经发货状态
  80. $order_info = $model_pointorder->getPointOrderInfo($where);
  81. if (!$order_info){
  82. showDialog(L('admin_pointorderd_record_error'),'index.php?act=pointorder&op=pointorder_list','error');
  83. }
  84. if (chksubmit()){
  85. $obj_validate = new Validate();
  86. $validate_arr[] = array("input"=>$_POST["shippingcode"],"require"=>"true","message"=>L('admin_pointorder_ship_code_nullerror'));
  87. $obj_validate->validateparam = $validate_arr;
  88. $error = $obj_validate->validate();
  89. if ($error != ''){
  90. showDialog(L('error').$error,'index.php?act=pointorder&op=pointorder_list','error');
  91. }
  92. //发货
  93. $data = $model_pointorder->shippingPointOrder($order_id, $_POST, $order_info);
  94. if ($data['state']){
  95. showDialog('发货修改成功','index.php?act=pointorder&op=pointorder_list','succ');
  96. }else {
  97. showDialog($data['msg'],'index.php?act=pointorder&op=pointorder_list','error');
  98. }
  99. } else {
  100. $express_list = Model('express')->getExpressList();
  101. Tpl::output('express_list',$express_list);
  102. Tpl::output('order_info',$order_info);
  103. Tpl::showpage('pointorder.ship');
  104. }
  105. }
  106. /**
  107. * 兑换信息详细
  108. */
  109. public function order_infoOp(){
  110. $order_id = intval($_GET['order_id']);
  111. if ($order_id <= 0){
  112. showDialog(L('admin_pointorder_parameter_error'),'index.php?act=pointorder&op=pointorder_list','error');
  113. }
  114. //查询订单信息
  115. $model_pointorder = Model('pointorder');
  116. $order_info = $model_pointorder->getPointOrderInfo(array('point_orderid'=>$order_id));
  117. if (!$order_info){
  118. showDialog(L('admin_pointorderd_record_error'),'index.php?act=pointorder&op=pointorder_list','error');
  119. }
  120. $orderstate_arr = $model_pointorder->getPointOrderState($order_info['point_orderstate']);
  121. $order_info['point_orderstatetext'] = $orderstate_arr[1];
  122. //查询兑换订单收货人地址
  123. $orderaddress_info = $model_pointorder->getPointOrderAddressInfo(array('point_orderid'=>$order_id));
  124. Tpl::output('orderaddress_info',$orderaddress_info);
  125. //兑换商品信息
  126. $prod_list = $model_pointorder->getPointOrderGoodsList(array('point_orderid'=>$order_id));
  127. Tpl::output('prod_list',$prod_list);
  128. //物流公司信息
  129. if ($order_info['point_shipping_ecode'] != ''){
  130. $data = Model('express')->getExpressInfoByECode($order_info['point_shipping_ecode']);
  131. if ($data['state']){
  132. $express_info = $data['data']['express_info'];
  133. }
  134. Tpl::output('express_info',$express_info);
  135. }
  136. Tpl::output('order_info',$order_info);
  137. Tpl::showpage('pointorder.info');
  138. }
  139. }