/** * 查看订单详情 * @author 李东 * @date 2015-06-30 */ public function detail() { $order_id = I('get.id'); if (!$order_id) { $this->error('错误操作'); } $map['order_id'] = $order_id; $order_info = get_info(D($this->model), $map); if ($order_info['order_status'] == 1) { redirect(U('/Home/Buy/confirm_quote/', array('order_id' => $order_id))); } $files = get_result($this->files_complete, array('order_id' => $order_id)); // print_r($files);exit; $order_info['files'] = $files; /*获取格式为 id=>title 的语言分类数组*/ $language_text = id_and_text(get_language_cache()); /*获取格式为 id=>title 的领域分类数组*/ $industry_text = id_and_text(get_industry_cache()); /*获取格式为 id=>title 的属性分类数组*/ $ability_text = id_and_text(get_ability_cache()); /*获取格式为 id=>title 的产品分类数组*/ $product_type = id_and_text($this->product_type); /*暂时将一维数组转化为二维数组*/ $temp[] = $order_info; $temp = int_to_string($temp, array("order_status" => $this->order_status, 'is_need_invoice' => array('0' => '否', '1' => '是'), 'product_type' => $product_type, 'pay_type' => array('0' => '余额支付', '1' => '支付宝支付'), "product_language_id" => $language_text, "product_to_language_id" => $language_text)); /*将Json中所有ID转换成文字字符串*/ $temp = json_to_chars($temp, array('product_industry_id' => $industry_text, 'product_ability_id' => $ability_text)); $order_info = $temp[0]; /*将二维数组还原成一维数组*/ /*获取买家信息*/ $buyer_info = get_info('member', array('id' => $order_info['member_id'])); /*获取下单地址信息*/ $user_address = get_area_pid($order_info['address_path'] . $order_info['address_id']); /*获取发票信息*/ if ($order_info['is_need_invoice'] == 1) { $invoice = get_address_detail($order_info['address_id']); } $address_text = ''; foreach ($user_address as $row) { $address_text .= $row['title'] . ' '; } $buyer_info['address_text'] = $address_text; $map = array(); $map['order_id'] = $order_id; $order_result = get_result('order_history', $map); $order_result = int_to_string($order_result, array('order_status' => $this->order_status)); if ($order_info['order_status'] == 4) { /*如果订单状态为待退款状态,查询退款原因描述*/ $map['order_id'] = $order_id; $refund_result = get_result(D($this->refund_model), $map); // print_r($refund_result);exit; foreach ($refund_result as $k => $row) { if ($row['type'] == 1) { /*如果是下单用户的信息,查询是否上传凭证文件*/ $refund_result[$k]['ask_name'] = $row['username']; $files = get_result($this->refund_files, array('refund_id' => $row['id'])); $files = get_file_type($files); $refund_result[$k]['files'] = $files; } elseif ($row['type']) { $refund_result[$k]['ask_name'] = $row['shop_title']; } } } $data['invoice'] = $invoice; $data['info'] = $order_info; $data['result'] = $order_result; $data['buyer_info'] = $buyer_info; $data['refund_result'] = $refund_result; $this->assign($data); $this->display(); }
/** * 获取地址详情 * * @param int $id * @return array 处理后的地址信息 */ function get_address_detail($id) { $info = get_info('address', array('id' => $id)); /*获取地址信息,并将地址ID转换成文字形式*/ $invoice_address = get_area_pid($info['area_path']); $address_text = ''; foreach ($invoice_address as $row) { $address_text .= $row['title'] . ' '; } $info['area_text'] = $address_text . $info['detailed_address']; return $info; }