?> </td> <td><?php echo $order['buyer_name']; ?> </td> <td class="nowrap align-center"><?php echo date('Y-m-d H:i:s', $order['add_time']); ?> </td> <td class="align-center"><?php echo $order['order_amount']; ?> </td> <td class="align-center"><?php echo orderPaymentName($order['payment_code']); ?> </td> <td class="align-center"><?php echo $order['state_desc']; ?> </td> <td class="w144 align-center"><a href="index.php?act=vr_order&op=show_order&order_id=<?php echo $order['order_id']; ?> "><?php echo $lang['nc_view']; ?> </a> <!-- 取消订单 -->
/** * 生成excel * * @param array $data */ private function createExcel($data = array()) { Language::read('export'); import('libraries.excel'); $excel_obj = new Excel(); $excel_data = array(); //设置样式 $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1'))); //header $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_no')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_store')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_buyer')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_xtimd')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_count')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_yfei')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_paytype')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_state')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_storeid')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_buyerid')); $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_bemail')); //data foreach ((array) $data as $k => $v) { $tmp = array(); $tmp[] = array('data' => 'NC' . $v['order_sn']); $tmp[] = array('data' => $v['store_name']); $tmp[] = array('data' => $v['buyer_name']); $tmp[] = array('data' => date('Y-m-d H:i:s', $v['add_time'])); $tmp[] = array('format' => 'Number', 'data' => ncPriceFormat($v['order_amount'])); $tmp[] = array('format' => 'Number', 'data' => ncPriceFormat($v['shipping_fee'])); $tmp[] = array('data' => orderPaymentName($v['payment_code'])); $tmp[] = array('data' => orderState($v)); $tmp[] = array('data' => $v['store_id']); $tmp[] = array('data' => $v['buyer_id']); $tmp[] = array('data' => $v['buyer_email']); $excel_data[] = $tmp; } $excel_data = $excel_obj->charset($excel_data, CHARSET); $excel_obj->addArray($excel_data); $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET)); $excel_obj->generateXML($excel_obj->charset(L('exp_od_order'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time())); }
"><i class="icon-mobile-phone"></i>重新发送</a> <?php } ?> </dd> </dl> <dl class="line"> <dt>虚拟单号:</dt> <dd><?php echo $output['order_info']['order_sn']; ?> <a href="javascript:void(0);">更多<i class="icon-angle-down"></i> <div class="more"><span class="arrow"></span> <ul> <li>支付方式:<span><?php echo orderPaymentName($output['order_info']['payment_code']); ?> </span></li> <li>下单时间:<span><?php echo date("Y-m-d H:i:s", $output['order_info']['add_time']); ?> </span></li> <?php if (!empty($output['order_info']['payment_time'])) { ?> <li>付款时间:<span><?php echo date("Y-m-d H:i:s", $output['order_info']['payment_time']); ?> </span></li> <?php }
/** * 取得订单列表(所有) * @param unknown $condition * @param string $pagesize * @param string $field * @param string $order * @param string $limit * @param unknown $extend 追加返回那些表的信息,如array('order_common','order_goods','store') * @return Ambigous <multitype:boolean Ambigous <string, mixed> , unknown> */ public function getOrderList($condition, $pagesize = '', $field = '*', $order = 'order_id desc', $limit = '', $extend = array(), $master = false) { $list = $this->table('order')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->master($master)->select(); if (empty($list)) { return array(); } $order_list = array(); foreach ($list as $order) { if (isset($order['order_state'])) { $order['state_desc'] = orderState($order); } if (isset($order['payment_code'])) { $order['payment_name'] = orderPaymentName($order['payment_code']); } if (!empty($extend)) { $order_list[$order['order_id']] = $order; } } if (empty($order_list)) { $order_list = $list; } //追加返回订单扩展表信息 if (in_array('order_common', $extend)) { $order_common_list = $this->getOrderCommonList(array('order_id' => array('in', array_keys($order_list)))); foreach ($order_common_list as $value) { $order_list[$value['order_id']]['extend_order_common'] = $value; $order_list[$value['order_id']]['extend_order_common']['reciver_info'] = @unserialize($value['reciver_info']); $order_list[$value['order_id']]['extend_order_common']['invoice_info'] = @unserialize($value['invoice_info']); } } //追加返回店铺信息 if (in_array('store', $extend)) { $store_id_array = array(); foreach ($order_list as $value) { if (!in_array($value['store_id'], $store_id_array)) { $store_id_array[] = $value['store_id']; } } $store_list = Model('store')->getStoreList(array('store_id' => array('in', $store_id_array))); $store_new_list = array(); foreach ($store_list as $store) { $store_new_list[$store['store_id']] = $store; } foreach ($order_list as $order_id => $order) { $order_list[$order_id]['extend_store'] = $store_new_list[$order['store_id']]; } } //追加返回买家信息 if (in_array('member', $extend)) { foreach ($order_list as $order_id => $order) { $order_list[$order_id]['extend_member'] = Model('member')->getMemberInfoByID($order['buyer_id']); } } //追加返回商品信息 if (in_array('order_goods', $extend)) { //取商品列表 $order_goods_list = $this->getOrderGoodsList(array('order_id' => array('in', array_keys($order_list)))); if (!empty($order_goods_list)) { foreach ($order_goods_list as $value) { $order_list[$value['order_id']]['extend_order_goods'][] = $value; } } else { $order_list[$value['order_id']]['extend_order_goods'] = array(); } } return $order_list; }
/** * 取得订单列表(所有) * @param unknown $condition * @param string $pagesize * @param string $field * @param string $order * @return array */ public function getOrderList($condition, $pagesize = '', $field = '*', $order = 'order_id desc', $limit = '') { $list = $this->table('vr_order')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select(); if (empty($list)) { return array(); } foreach ($list as $key => $order) { if (isset($order['order_state'])) { list($list[$key]['state_desc'], $list[$key]['order_state_text']) = $this->_orderState($order['order_state']); } if (isset($order['payment_code'])) { $list[$key]['payment_name'] = orderPaymentName($order['payment_code']); } } return $list; }
<li> <strong>店铺<?php echo $lang['nc_colon']; ?> </strong> <?php echo $output['live_order']['store_name']; ?> </li> <li> <strong>支付方式<?php echo $lang['nc_colon']; ?> </strong> <?php echo orderPaymentName($output['live_order']['payment_code']); ?> </li> <li> <strong>下单时间<?php echo $lang['nc_colon']; ?> </strong> <?php echo date('Y-m-d H:i:s', $output['live_order']['add_time']); ?> </li> <?php if (intval($output['live_order']['payment_time'])) { ?> <li>
?> </td> <td><?php echo $val['member_name']; ?> </td> <td class="align-center"><?php echo date("Y-m-d", $val['add_time']); ?> </td> <td class="align-center"><?php echo $val['price']; ?> </td> <td class="align-center"><?php echo orderPaymentName($val['payment_code']); ?> </td> <td class="align-center"> <?php if ($val['state'] == 1) { echo '待付款'; } elseif ($val['state'] == 2) { echo '兑换使用'; } elseif ($val['state'] == 3) { echo '使用完成'; } elseif ($val['state'] == 4) { echo '取消订单'; } ?> </td>
<?php defined('InShopNC') or exit('Access Invalid!');?> <div class="ncsc-oredr-show"> <div class="ncsc-order-info"> <div class="ncsc-order-details"> <div class="title">虚拟订单信息</div> <div class="content"> <dl> <dt>虚拟单号:</dt> <dd><?php echo $output['order_info']['order_sn'];?><a href="javascript:void(0);">更多<i class="icon-angle-down"></i> <div class="more"><span class="arrow"></span> <ul> <li>支付方式:<?php echo orderPaymentName($output['order_info']['payment_code']);?></li> <li>下单时间:<span><?php echo date("Y-m-d H:i:s",$output['order_info']['add_time']);?></span></li> <?php if(!empty($output['order_info']['payment_time'])){?> <li>付款时间:<span><?php echo date("Y-m-d H:i:s",$output['order_info']['payment_time']);?></span></li> <?php } ?> </ul> </div> </a></dd> </dl> <dl class="line"> <dt>买  家:</dt> <dd><?php echo $output['order_info']['buyer_name'];?></dd> </dl> <dl class="line"> <dt>接收手机:</dt> <dd><?php echo $output['order_info']['buyer_phone'];?></dd> </dl> <dl class="line"> <dt>买家留言:</dt>
<dl> <dt><i class="icon-ok-circle green"></i>订单状态:</dt> <dd> <?php if ($output['order_info']['payment_code'] == 'offline') { ?> 订单已提交,等待发货 <?php } else { ?> 已支付成功 <?php } ?> </dd> </dl> <ul> <?php if ($output['order_info']['payment_code'] == 'offline') { ?> <li>1. 买家已经选择货到付款方式下单成功。</li> <li>2. 订单已提交商家进行备货发货准备。</li> <?php } else { ?> <li>1. 买家已使用“<?php echo orderPaymentName($output['order_info']['payment_code']);?>”方式成功对订单进行支付,支付单号 “<?php echo $output['order_info']['pay_sn'];?>”。</li> <li>2. 订单已提交商家进行备货发货准备。</li> <?php } ?> </ul> </div> <?php } ?> <?php if ($output['order_info']['order_state'] == ORDER_STATE_SEND) { ?> <div class="ncsc-order-condition"> <dl> <dt><i class="icon-ok-circle green"></i>订单状态:</dt> <dd>已发货</dd> </dl> <ul> <li>1. 商品已发出; <?php if ($output['order_info']['shipping_code'] != '') { ?> 物流公司:<?php echo $output['order_info']['express_info']['e_name']?>;单号:<?php echo $output['order_info']['shipping_code'];?>。
/** * 取得订单列表 * @param unknown $condition * @param string $pagesize * @param string $field * @param string $order * @param string $limit * @param unknown $extend 追加返回那些表的信息,如array('order_common','order_goods','store') * @return Ambigous <multitype:boolean Ambigous <string, mixed> , unknown> */ public function getOrderList($condition, $pagesize = '', $field = '*', $order = 'order_id desc', $limit = '', $extend = array()) { $list = $this->table('order')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select(); if (empty($list)) { return array(); } $order_list = array(); foreach ($list as $order) { $order['state_desc'] = orderState($order); $order['payment_name'] = orderPaymentName($order['payment_code']); if (!empty($extend)) { $order_list[$order['order_id']] = $order; } } if (empty($order_list)) { $order_list = $list; } //追加返回订单扩展表信息 if (in_array('order_common', $extend)) { $order_common_list = $this->getOrderCommonList(array('order_id' => array('in', array_keys($order_list)))); foreach ($order_common_list as $value) { $order_list[$value['order_id']]['extend_order_common'] = $value; $order_list[$value['order_id']]['extend_order_common']['reciver_info'] = @unserialize($value['reciver_info']); $order_list[$value['order_id']]['extend_order_common']['invoice_info'] = @unserialize($value['invoice_info']); } } //追加返回店铺信息 if (in_array('store', $extend)) { $store_id_array = array(); foreach ($order_list as $value) { if (!in_array($value['store_id'], $store_id_array)) { $store_id_array[] = $value['store_id']; } } $store_list = Model('store')->getStoreList(array('store_id' => array('in', $store_id_array))); $store_new_list = array(); foreach ($store_list as $store) { $store_new_list[$store['store_id']] = $store; } foreach ($order_list as $order_id => $order) { $order_list[$order_id]['extend_store'] = $store_new_list[$order['store_id']]; } } //追加返回买家信息 if (in_array('member', $extend)) { $member_id_array = array(); foreach ($order_list as $value) { if (!in_array($value['buyer_id'], $member_id_array)) { $member_id_array[] = $value['buyer_id']; } } $member_list = Model()->table('member')->where(array('member_id' => array('in', $member_id_array)))->limit($pagesize)->key('member_id')->select(); foreach ($order_list as $order_id => $order) { $order_list[$order_id]['extend_member'] = $member_list[$order['buyer_id']]; } } //追加返回商品信息 if (in_array('order_goods', $extend)) { //取商品列表 $order_goods_list = $this->getOrderGoodsList(array('order_id' => array('in', array_keys($order_list)))); foreach ($order_goods_list as $value) { $value['goods_image_url'] = cthumb($value['goods_image'], 240, $value['store_id']); $order_list[$value['order_id']]['extend_order_goods'][] = $value; } } //追加返回商品goods_serial if (in_array('goods', $extend)) { $goods_id_list = $this->getGoodsList(array('goods_id' => array('in', array_keys($order_lis['extend_order_goods'])))); $field = 'goods_serial'; $where = array('goods_id' => array('in', self::array_column($order_list, 'goods_id'))); $goods_storage_array = Model('goods')->getGoodsList($where, $field); foreach ($goods_storage_array as $value) { $order_list[$order_id]['extend_order_common']['goods_serial'] = $value['goods_serial']; } } return $order_list; }
/** * 更新订单状态 */ private function _update_order($out_trade_no, $trade_no) { $model_order = Model('order'); $logic_payment = Logic('payment'); $tmp = explode('_', $out_trade_no); $out_trade_no = $tmp[0]; if (!empty($tmp[1])) { $order_type = $tmp[1]; } else { $order_pay_info = Model('order')->getOrderPayInfo(array('pay_sn' => $out_trade_no)); if (empty($order_pay_info)) { $order_type = 'v'; } else { $order_type = 'r'; } } // wxpay_jsapi $paymentCode = $this->payment_code; if ($paymentCode == 'wxpay_jsapi') { $paymentCode = 'wx_jsapi'; } elseif ($paymentCode == 'wxpay3') { $paymentCode = 'wxpay'; } if ($order_type == 'r') { $result = $logic_payment->getRealOrderInfo($out_trade_no); if (intval($result['data']['api_pay_state'])) { return array('state' => true); } $order_list = $result['data']['order_list']; $result = $logic_payment->updateRealOrder($out_trade_no, $paymentCode, $order_list, $trade_no); $api_pay_amount = 0; if (!empty($order_list)) { foreach ($order_list as $order_info) { $api_pay_amount += $order_info['order_amount'] - $order_info['pd_amount'] - $order_info['rcb_amount']; } } $log_buyer_id = $order_list[0]['buyer_id']; $log_buyer_name = $order_list[0]['buyer_name']; $log_desc = '实物订单使用' . orderPaymentName($paymentCode) . '成功支付,支付单号:' . $out_trade_no; } elseif ($order_type == 'v') { $result = $logic_payment->getVrOrderInfo($out_trade_no); $order_info = $result['data']; if (!in_array($result['data']['order_state'], array(ORDER_STATE_NEW, ORDER_STATE_CANCEL))) { return array('state' => true); } $result = $logic_payment->updateVrOrder($out_trade_no, $paymentCode, $result['data'], $trade_no); $api_pay_amount = $order_info['order_amount'] - $order_info['pd_amount'] - $order_info['rcb_amount']; $log_buyer_id = $order_info['buyer_id']; $log_buyer_name = $order_info['buyer_name']; $log_desc = '虚拟订单使用' . orderPaymentName($paymentCode) . '成功支付,支付单号:' . $out_trade_no; } elseif ($order_type == 'p') { $result = $logic_payment->getPdOrderInfo($out_trade_no); if (intval($result['data']['pdr_payment_state'])) { return array('state' => true); } $payment_info = $logic_payment->getPaymentInfo($paymentCode); $result = $logic_payment->updatePdOrder($out_trade_no, $trade_no, $payment_info, $result['data']); $api_pay_amount = $result['data']['pdr_amount']; $log_buyer_id = $order_pay_info['buyer_id']; $log_buyer_name = $order_pay_info['buyer_name']; $log_desc = '预存款充值成功,使用' . orderPaymentName($payment_info['payment_code']) . '成功支付,充值单号:' . $out_trade_no; } if ($result['state']) { //记录消费日志 QueueClient::push('addConsume', array('member_id' => $log_buyer_id, 'member_name' => $log_buyer_name, 'consume_amount' => ncPriceFormat($api_pay_amount), 'consume_time' => TIMESTAMP, 'consume_remark' => $log_desc)); } return $result; }