GoodsOrderAction.class.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Fanwe 方维直播系统
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: 云淡风轻(1956838968@qq.com)
  8. // +----------------------------------------------------------------------
  9. class GoodsOrderAction extends CommonAction
  10. {
  11. public function index()
  12. {
  13. //列表过滤器,生成查询Map对象
  14. $map = $this->_search();
  15. if (!isset($_REQUEST['order_status'])) {
  16. $_REQUEST['order_status'] = -1;
  17. }
  18. $order_sn = $param['order_sn'] = strim($_REQUEST['order_sn']);
  19. $order_status = $param['order_status'] = intval($_REQUEST['order_status']);
  20. $begin_time = $param['begin_time'] = strim($_REQUEST['begin_time']);
  21. $end_time = $param['end_time'] = strim($_REQUEST['end_time']);
  22. $this->assign('param', $param);
  23. //追加默认参数
  24. if ($this->get("default_map")) {
  25. $map = array_merge($map, $this->get("default_map"));
  26. }
  27. if ($order_sn != '') {
  28. $map['order_sn'] = $order_sn;
  29. }
  30. if (isset($_REQUEST['order_status']) && $order_status >= 0) {
  31. $map['order_status'] = $order_status;
  32. }
  33. $begin_time_span = to_timespan($begin_time);
  34. $end_time_span = to_timespan($end_time);
  35. if ($begin_time != '' && $end_time == '') {
  36. $map['_string'] = "create_time >=" . $begin_time_span . " and order_type != 'shop'";
  37. } elseif ($begin_time != '' && $end_time != '') {
  38. $map['_string'] = "create_time >=" . $begin_time_span . " and create_time <=" . $end_time_span . " and order_type != 'shop'";
  39. } elseif ($begin_time == '' && $end_time != '') {
  40. $map['_string'] = "create_time <=" . $end_time_span . " and order_type != 'shop'";
  41. }else{
  42. $map['_string'].="order_type != 'shop'";
  43. }
  44. if ($order_status == -1) {
  45. unset($map['order_status']);
  46. }
  47. if (method_exists($this, '_filter')) {
  48. $this->_filter($map);
  49. }
  50. // $map['_string'].="order_type != 'shop'";
  51. $model = D("goods_order");
  52. if (!empty($model)) {
  53. $this->_list($model, $map);
  54. }
  55. $list = $this->get("list");
  56. $result = array();
  57. $row = 0;
  58. foreach ($list as $k => $v) {
  59. $list[$k]['order_source'] = $v['order_source'] == 'local' ? "本地" : "远程";
  60. if($v['order_type'] == 'shop'){
  61. $list[$k]['order_type'] = '购物单';
  62. }elseif($v['order_type'] == 'pai_goods'){
  63. $list[$k]['order_type'] = '实物竞拍';
  64. }else{
  65. $list[$k]['order_type'] = '虚拟竞拍';
  66. }
  67. //$list[$k]['order_type'] = $v['order_type'] == 'shop' ? "购物单" : "竞拍单";
  68. $list[$k]['no_refund_format'] = $v['no_refund'] ? "否" : "是";
  69. switch ($v['order_status']) {
  70. case '1':
  71. $list[$k]['order_status_format'] = "待付款";
  72. break;
  73. case '2':
  74. $list[$k]['order_status_format'] = "待发货";
  75. break;
  76. case '3':
  77. $list[$k]['order_status_format'] = "待收货";
  78. break;
  79. case '4':
  80. $list[$k]['order_status_format'] = "已收货";
  81. break;
  82. case '5':
  83. $list[$k]['order_status_format'] = "已退货";
  84. break;
  85. case '6':
  86. $list[$k]['order_status_format'] = "超时关闭";
  87. break;
  88. case '7':
  89. $list[$k]['order_status_format'] = "结单";
  90. break;
  91. }
  92. $list[$k]['podcast_name'] = emoji_decode(M("user")->where("id=" . $v['podcast_id'] . " ")->getField("nick_name"));
  93. $list[$k]['pai_name'] = emoji_decode(M("user")->where("id=" . $v['viewer_id'] . " ")->getField("nick_name"));
  94. }
  95. $this->assign("list", $list);
  96. $this->display();
  97. return;
  98. }
  99. /**
  100. *
  101. * 订单详情
  102. */
  103. public function edit()
  104. {
  105. $this->assign("type_list", $this->type_list);
  106. $id = intval($_REQUEST['id']);
  107. if (!isset($id) || empty($id)) {
  108. $this->error('系统繁忙,参数不存在!');
  109. }
  110. $vo = M('goods_order')->where(array('id' => $id))->find();
  111. if ($vo['order_source'] == 'local') {
  112. $vo['order_source'] = '本地';
  113. } else {
  114. $vo['order_source'] = '远程';
  115. }
  116. if ($vo['order_type'] == 'shop') {
  117. $vo['order_type'] = '购物单';
  118. } else {
  119. $vo['order_type'] = '竞拍单';
  120. }
  121. $vo['no_refund_format'] = $vo['no_refund'] ? '否' : '是';
  122. if ($vo['order_status'] == 1) {
  123. $vo['order_status_format'] = "待付款";
  124. } elseif ($vo['order_status'] == 2) {
  125. $vo['order_status_format'] = "待发货";
  126. } elseif ($vo['order_status'] == 3) {
  127. $vo['order_status_format'] = "待收货";
  128. } elseif ($vo['order_status'] == 4) {
  129. $vo['order_status_format'] = "已收货";
  130. } elseif ($vo['order_status'] == 5) {
  131. $vo['order_status_format'] = "已退货";
  132. }
  133. if ($vo['refund_buyer_delivery'] == 0) {
  134. $vo['delivery_status_format'] = "无";
  135. } elseif ($vo['refund_buyer_delivery'] == 1) {
  136. $vo['delivery_status_format'] = "未发货";
  137. } else {
  138. $vo['delivery_status_format'] = "已发货";
  139. }
  140. if ($vo['refund_buyer_status'] == 0) {
  141. $vo['refund_buyer_status'] = "无";
  142. } elseif ($vo['refund_buyer_status'] == 1) {
  143. $vo['refund_buyer_status'] = "退款中";
  144. } elseif ($vo['refund_buyer_status'] == 2) {
  145. $vo['refund_buyer_status'] = "退货中";
  146. } elseif ($vo['refund_buyer_status'] == 3) {
  147. $vo['refund_buyer_status'] = "退款成功";
  148. } elseif ($vo['refund_buyer_status'] == 4) {
  149. $vo['refund_buyer_status'] = "主动撤销退款";
  150. } else {
  151. $vo['refund_buyer_status'] = "被动关闭";
  152. }
  153. if ($vo['refund_seller_status'] == 0) {
  154. $vo['refund_seller_status'] = "无";
  155. } else {
  156. $vo['refund_seller_status'] = "退款成功";
  157. }
  158. if ($vo['refund_platform'] == 0) {
  159. $vo['refund_platform'] = "无";
  160. } elseif ($vo['refund_platform'] == 1) {
  161. $vo['refund_platform'] = "申诉中";
  162. } else {
  163. $vo['refund_platform'] = "申诉完成";
  164. }
  165. $vo['podcast_name'] = emoji_decode(M("user")->where("id=" . $vo['podcast_id'] . " ")->getField("nick_name"));
  166. $vo['pai_name'] = emoji_decode(M("user")->where("id=" . $vo['viewer_id'] . " ")->getField("nick_name"));
  167. $vo['goods_name'] = M("pai_goods")->where("id=" . $vo['pai_id'] . " ")->getField("name");
  168. if($vo['order_type'] == '购物单'){
  169. $vo['goods_name'] = M("goods")->where("id=" . $vo['goods_id'] . " ")->getField("name");
  170. }
  171. if (!empty($vo['consignee_district'])) {
  172. $arr = json_decode(htmlspecialchars_decode($vo['consignee_district']), true);
  173. //按数组方式调用里面的数据
  174. $vo['consignee_district'] = $arr['province'].$arr['city'].$arr['area'];
  175. }
  176. $vo['pay_time'] = $vo['pay_time'] == '0000-00-00 00:00:00' ? '未付款' : $vo['pay_time'];
  177. switch ($vo['order_status']) {
  178. case '1':
  179. $vo['order_status_format'] = '待付款';
  180. break;
  181. case '2':
  182. $vo['order_status_format'] = '待发货';
  183. break;
  184. case '3':
  185. $vo['order_status_format'] = '待收货';
  186. break;
  187. case '4':
  188. $vo['order_status_format'] = '已收货';
  189. break;
  190. case '5':
  191. $vo['order_status_format'] = '退款成功';
  192. break;
  193. case '6':
  194. $vo['order_status_format'] = '未付款';
  195. break;
  196. case '7':
  197. $vo['order_status_format'] = '结单';
  198. break;
  199. }
  200. $this->assign('vo', $vo);
  201. $this->display();
  202. }
  203. }