Memberpointorder.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. * DSMall多用户商城
  8. * ============================================================================
  9. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  10. * 网站地址: http://www.csdeshang.com
  11. * ----------------------------------------------------------------------------
  12. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  13. * 不允许对程序代码以任何形式任何目的的再发布。
  14. * ============================================================================
  15. * 控制器
  16. */
  17. class Memberpointorder extends BaseMember
  18. {
  19. public function initialize()
  20. {
  21. parent::initialize(); // TODO: Change the autogenerated stub
  22. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/memberpoints.lang.php');
  23. }
  24. public function index()
  25. {
  26. //兑换信息列表
  27. $condition = array();
  28. $condition[] = array('point_buyerid','=',session('member_id'));
  29. $pointorder_model = model('pointorder');
  30. $order_list = $pointorder_model->getPointorderList($condition, '*', 10, 0, 'point_orderid desc');
  31. $order_idarr = array();
  32. $order_listnew = array();
  33. if (is_array($order_list) && count($order_list) > 0) {
  34. foreach ($order_list as $k => $v) {
  35. $order_listnew[$v['point_orderid']] = $v;
  36. $order_idarr[] = $v['point_orderid'];
  37. }
  38. }
  39. //查询兑换商品
  40. if (is_array($order_idarr) && count($order_idarr) > 0) {
  41. $prod_list = $pointorder_model->getPointordergoodsList(array(array('pointog_orderid','in',$order_idarr)));
  42. if (is_array($prod_list) && count($prod_list) > 0) {
  43. foreach ($prod_list as $v) {
  44. if (isset($order_listnew[$v['pointog_orderid']])) {
  45. $order_listnew[$v['pointog_orderid']]['prodlist'][] = $v;
  46. }
  47. }
  48. }
  49. }
  50. //信息输出
  51. View::assign('order_list', $order_listnew);
  52. View::assign('show_page', $pointorder_model->page_info->render());
  53. /* 设置买家当前菜单 */
  54. $this->setMemberCurMenu('member_pointorder');
  55. /* 设置买家当前栏目 */
  56. $this->setMemberCurItem('orderlist');
  57. return View::fetch($this->template_dir.'index');
  58. }
  59. /**
  60. * 取消兑换
  61. */
  62. public function cancel_order()
  63. {
  64. $pointorder_model = model('pointorder');
  65. //取消订单
  66. $data = $pointorder_model->cancelPointorder(input('param.order_id'), session('member_id'));
  67. if ($data['state']) {
  68. ds_json_encode(10000,lang('member_pointorder_cancel_success'));
  69. } else {
  70. ds_json_encode(10001,$data['msg']);
  71. }
  72. }
  73. /**
  74. * 确认收货
  75. */
  76. public function receiving_order()
  77. {
  78. $data = model('pointorder')->receivingPointorder(input('param.order_id'));
  79. if ($data['state']) {
  80. ds_json_encode(10000,lang('member_pointorder_confirmreceiving_success'));
  81. } else {
  82. ds_json_encode(10001,$data['msg']);
  83. }
  84. }
  85. /**
  86. * 兑换信息详细
  87. */
  88. public function order_info()
  89. {
  90. $order_id = intval(input('order_id'));
  91. if ($order_id <= 0) {
  92. $this->error(lang('member_pointorder_parameter_error'));
  93. }
  94. $pointorder_model = model('pointorder');
  95. //查询兑换订单信息
  96. $where = array();
  97. $where[] = array('point_orderid','=',$order_id);
  98. $where[] = array('point_buyerid','=',session('member_id'));
  99. $order_info = $pointorder_model->getPointorderInfo($where);
  100. if (!$order_info) {
  101. $this->error(lang('member_pointorder_record_error'));
  102. }
  103. //获取订单状态
  104. $pointorderstate_arr = $pointorder_model->getPointorderStateBySign();
  105. View::assign('pointorderstate_arr', $pointorderstate_arr);
  106. //查询兑换订单收货人地址
  107. $orderaddress_info = $pointorder_model->getPointorderAddressInfo(array('pointoa_orderid' => $order_id));
  108. View::assign('orderaddress_info', $orderaddress_info);
  109. //兑换商品信息
  110. $prod_list = $pointorder_model->getPointordergoodsList(array('pointog_orderid' => $order_id));
  111. View::assign('prod_list', $prod_list);
  112. //物流公司信息
  113. if ($order_info['point_shipping_ecode'] != '') {
  114. $data = model('express')->getExpressInfoByECode($order_info['point_shipping_ecode']);
  115. if ($data['state']) {
  116. $express_info = $data['data']['express_info'];
  117. }
  118. View::assign('express_info', $express_info);
  119. }
  120. View::assign('order_info', $order_info);
  121. View::assign('left_show', 'order_view');
  122. /* 设置买家当前菜单 */
  123. $this->setMemberCurMenu('member_pointorder');
  124. /* 设置买家当前栏目 */
  125. $this->setMemberCurItem('order_info');
  126. return View::fetch($this->template_dir.'member_pointorder_info');
  127. }
  128. /**
  129. * 用户中心右边,小导航
  130. *
  131. * @param string $menu_type 导航类型
  132. * @param string $menu_key 当前导航的menu_key
  133. * @return
  134. */
  135. public function getMemberItemList() {
  136. $menu_array = array(
  137. array(
  138. 'name' => 'orderlist',
  139. 'text' => lang('member_pointorder_list_title'),
  140. 'url' => (string)url('Memberpointorder/index')
  141. )
  142. );
  143. if (request()->action() == 'order_info') {
  144. $menu_array = array(
  145. array(
  146. 'name' => 'orderinfo',
  147. 'text' => lang('ds_member_path_pointorder_info'),
  148. 'url'=>'javascript:void(0)'
  149. )
  150. );
  151. }
  152. return $menu_array;
  153. }
  154. }