store_order_print.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * 订单打印
  4. ***/
  5. defined('InShopNC') or exit('Access Invalid!');
  6. class store_order_printControl extends BaseSellerControl {
  7. public function __construct() {
  8. parent::__construct();
  9. Language::read('member_printorder');
  10. }
  11. /**
  12. * 查看订单
  13. */
  14. public function indexOp() {
  15. $order_id = intval($_GET['order_id']);
  16. if ($order_id <= 0){
  17. showMessage(Language::get('wrong_argument'),'','html','error');
  18. }
  19. $order_model = Model('order');
  20. $condition['order_id'] = $order_id;
  21. $condition['store_id'] = $_SESSION['store_id'];
  22. $order_info = $order_model->getOrderInfo($condition,array('order_common','order_goods'));
  23. if (empty($order_info)){
  24. showMessage(Language::get('member_printorder_ordererror'),'','html','error');
  25. }
  26. Tpl::output('order_info',$order_info);
  27. //卖家信息
  28. $model_store = Model('store');
  29. $store_info = $model_store->getStoreInfoByID($order_info['store_id']);
  30. if (!empty($store_info['store_label'])){
  31. if (file_exists(BASE_UPLOAD_PATH.DS.ATTACH_STORE.DS.$store_info['store_label'])){
  32. $store_info['store_label'] = UPLOAD_SITE_URL.DS.ATTACH_STORE.DS.$store_info['store_label'];
  33. }else {
  34. $store_info['store_label'] = '';
  35. }
  36. }
  37. if (!empty($store_info['store_stamp'])){
  38. if (file_exists(BASE_UPLOAD_PATH.DS.ATTACH_STORE.DS.$store_info['store_stamp'])){
  39. $store_info['store_stamp'] = UPLOAD_SITE_URL.DS.ATTACH_STORE.DS.$store_info['store_stamp'];
  40. }else {
  41. $store_info['store_stamp'] = '';
  42. }
  43. }
  44. Tpl::output('store_info',$store_info);
  45. //订单商品
  46. $model_order = Model('order');
  47. $condition = array();
  48. $condition['order_id'] = $order_id;
  49. $condition['store_id'] = $_SESSION['store_id'];
  50. $goods_new_list = array();
  51. $goods_all_num = 0;
  52. $goods_total_price = 0;
  53. if (!empty($order_info['extend_order_goods'])){
  54. $goods_count = count($order_goods_list);
  55. $i = 1;
  56. foreach ($order_info['extend_order_goods'] as $k => $v){
  57. $v['goods_name'] = str_cut($v['goods_name'],100);
  58. $goods_all_num += $v['goods_num'];
  59. $v['goods_all_price'] = ncPriceFormat($v['goods_num'] * $v['goods_price']);
  60. $goods_total_price += $v['goods_all_price'];
  61. $goods_new_list[ceil($i/15)][$i] = $v;
  62. $i++;
  63. }
  64. }
  65. //优惠金额
  66. $promotion_amount = $goods_total_price - $order_info['goods_amount'];
  67. //运费
  68. $order_info['shipping_fee'] = $order_info['shipping_fee'];
  69. Tpl::output('promotion_amount',$promotion_amount);
  70. Tpl::output('goods_all_num',$goods_all_num);
  71. Tpl::output('goods_total_price',ncPriceFormat($goods_total_price));
  72. Tpl::output('goods_list',$goods_new_list);
  73. Tpl::showpage('store_order.print',"null_layout");
  74. }
  75. }