Example #1
0
 /**
  * 取得虚拟订单所需支付金额等信息
  * @param int $order_sn
  * @param int $member_id
  * @return array
  */
 public function getVrOrderInfo($order_sn, $member_id = null)
 {
     //验证订单信息
     $model_order = Model('vr_order');
     $condition = array();
     $condition['order_sn'] = $order_sn;
     if (!empty($member_id)) {
         $condition['buyer_id'] = $member_id;
     }
     $order_info = $model_order->getOrderInfo($condition);
     if (empty($order_info)) {
         return callback(false, '该订单不存在');
     }
     $order_info['subject'] = '虚拟订单_' . $order_sn;
     $order_info['order_type'] = 'vr_order';
     $order_info['pay_sn'] = $order_sn;
     //计算所需要支付金额(支付卡+余额支付了)//zmr>v60
     $payed_amount = floatval($order_info['rcb_amount']) + floatval($order_info['pd_amount']);
     $pay_amount += ncPriceFormat(floatval($order_info['order_amount']) - $payed_amount);
     //zmr<v60
     //计算本次需要在线支付的订单总金额
     //$pay_amount = ncPriceFormat(floatval($order_info['order_amount']) - floatval($order_info['pd_amount']));
     $order_info['api_pay_amount'] = $pay_amount;
     return callback(true, '', $order_info);
 }
Example #2
0
 /**
  * 得到虚拟商品购买数据(商品、店铺、会员)
  * @param int $goods_id 商品ID
  * @param int $quantity 购买数量
  * @param int $member_id 会员ID
  * @return array
  */
 public function getBuyStepData($goods_id, $quantity, $member_id)
 {
     $goods_info = Model('goods')->getVirtualGoodsOnlineInfoByID($goods_id);
     if (empty($goods_info)) {
         return callback(false, '该商品不符合购买条件,可能的原因有:下架、不存在、过期等');
     }
     if ($goods_info['virtual_limit'] > $goods_info['goods_storage']) {
         $goods_info['virtual_limit'] = $goods_info['goods_storage'];
     }
     //取得抢购信息
     $goods_info = $this->_getGroupbuyInfo($goods_info);
     $quantity = abs(intval($quantity));
     $quantity = $quantity == 0 ? 1 : $quantity;
     $quantity = $quantity > $goods_info['virtual_limit'] ? $goods_info['virtual_limit'] : $quantity;
     if ($quantity > $goods_info['goods_storage']) {
         return callback(false, '该商品库存不足');
     }
     $goods_info['quantity'] = $quantity;
     $goods_info['goods_total'] = ncPriceFormat($goods_info['goods_price'] * $goods_info['quantity']);
     $goods_info['goods_image_url'] = cthumb($goods_info['goods_image'], 240, $goods_info['store_id']);
     $return = array();
     $return['goods_info'] = $goods_info;
     $return['store_info'] = Model('store')->getStoreOnlineInfoByID($goods_info['store_id'], 'store_name,store_id,member_id');
     $return['member_info'] = Model('member')->getMemberInfoByID($member_id);
     //        $model_payment = Model('payment');
     //        $pd_payment_info = Model('payment')->getPaymentOpenInfo(array('payment_code'=>'predeposit'));
     //        if (empty($pd_payment_info)) {
     //            $return['member_info']['available_predeposit'] = 0;
     //            $return['member_info']['available_rc_balance'] = 0;
     //        }
     return callback(true, '', $return);
 }
Example #3
0
 /**
  * 添加兑换码退款
  *
  */
 public function add_refundOp()
 {
     $model_vr_refund = Model('vr_refund');
     $order_id = intval($_GET['order_id']);
     if ($order_id < 1) {
         //参数验证
         showDialog(Language::get('wrong_argument'), 'index.php?act=member_vr_refund&op=index', 'error');
     }
     $condition = array();
     $condition['buyer_id'] = $_SESSION['member_id'];
     $condition['order_id'] = $order_id;
     $order = $model_vr_refund->getRightOrderList($condition);
     $order_id = $order['order_id'];
     if (!$order['if_refund']) {
         //检查状态,防止页面刷新不及时造成数据错误
         showDialog(Language::get('wrong_argument'), 'index.php?act=member_vr_order&op=index', 'error');
     }
     if (chksubmit() && $order['if_refund']) {
         $code_list = $order['code_list'];
         $refund_array = array();
         $goods_num = 0;
         //兑换码数量
         $refund_amount = 0;
         //退款金额
         $code_sn = '';
         $rec_id_array = $_POST['rec_id'];
         if (!empty($rec_id_array) && is_array($rec_id_array)) {
             //选择退款的兑换码
             foreach ($rec_id_array as $key => $value) {
                 $code = $code_list[$value];
                 if (!empty($code)) {
                     $goods_num += 1;
                     $refund_amount += $code['pay_price'];
                     //实际支付金额
                     $code_sn .= $code['vr_code'] . ',';
                     //兑换码编号
                 }
             }
         }
         if ($goods_num < 1) {
             showDialog(Language::get('wrong_argument'), 'reload', 'error');
         }
         $refund_array['code_sn'] = rtrim($code_sn, ',');
         $refund_array['admin_state'] = '1';
         //状态:1为待审核,2为同意,3为不同意
         $refund_array['refund_amount'] = ncPriceFormat($refund_amount);
         $refund_array['goods_num'] = $goods_num;
         $refund_array['buyer_message'] = $_POST['buyer_message'];
         $refund_array['add_time'] = time();
         $state = $model_vr_refund->addRefund($refund_array, $order);
         if ($state) {
             showDialog(Language::get('nc_common_save_succ'), 'index.php?act=member_vr_refund&op=index', 'succ');
         } else {
             showDialog(Language::get('nc_common_save_fail'), 'reload', 'error');
         }
     }
     Tpl::showpage('member_vr_refund_add');
 }
Example #4
0
 /**
  * 修改运费
  */
 public function order_ship_priceOp()
 {
     $order_id = intval($_POST['order_id']);
     $shipping_fee = ncPriceFormat($_POST['shipping_fee']);
     $model_order = Model('order');
     $condition = array();
     $condition['order_id'] = $order_id;
     $condition['store_id'] = $this->store_info['store_id'];
     $order_info = $model_order->getOrderInfo($condition);
     $if_allow = $model_order->getOrderOperateState('modify_price', $order_info);
     if (!$if_allow) {
         output_error('无权操作');
     }
     $result = Logic('order')->changeOrderShipPrice($order_info, 'seller', $this->seller_info['seller_name'], $shipping_fee);
     if (!$result['state']) {
         output_error($result['msg']);
     }
     output_data('1');
 }
Example #5
0
 /**
  * 取得虚拟订单所需支付金额等信息
  * @param int $order_sn
  * @param int $member_id
  * @return array
  */
 public function getVrOrderInfo($order_sn, $member_id = null)
 {
     //验证订单信息
     $model_order = Model('vr_order');
     $condition = array();
     $condition['order_sn'] = $order_sn;
     if (!empty($member_id)) {
         $condition['buyer_id'] = $member_id;
     }
     $order_info = $model_order->getOrderInfo($condition);
     if (empty($order_info)) {
         return callback(false, '该订单不存在');
     }
     $order_info['subject'] = '虚拟订单_' . $order_sn;
     $order_info['order_type'] = 'vr_order';
     $order_info['pay_sn'] = $order_sn;
     //计算本次需要在线支付的订单总金额
     //$pay_amount = ncPriceFormat(floatval($order_info['order_amount']) - floatval($order_info['pd_amount']));
     //修复 第三方支付时 充值卡没算在内BUG 33 hao .com 好 商城V3
     $pay_amount = ncPriceFormat(floatval($order_info['order_amount']) - floatval($order_info['pd_amount']) - floatval($order_info['rcb_amount']));
     $order_info['api_pay_amount'] = $pay_amount;
     return callback(true, '', $order_info);
 }
        ?>
/images/loading.gif" data-src="<?php 
        echo $image_url;
        ?>
" title="<?php 
        echo $value['commend_goods_name'];
        ?>
" alt="<?php 
        echo $value['commend_goods_name'];
        ?>
" /> </a>
            <div class="price"> <?php 
        echo $lang['currency'];
        ?>
<strong><?php 
        echo ncPriceFormat($value['commend_goods_price']);
        ?>
</strong></div>
            
        </div>
        <div class="handle">
            <span class="like-btn"><a nc_type="microshop_like" like_id="<?php 
        echo $value['commend_id'];
        ?>
" href="javascript:void(0)"><i class="pngFix"></i><span><?php 
        echo $lang['microshop_text_like'];
        ?>
</span><em><?php 
        echo $value['like_count'] <= 999 ? $value['like_count'] : '999+';
        ?>
</em></a></span>
Example #7
0
 /**
  * 变更预存款
  * @param unknown $change_type
  * @param unknown $data
  * @throws Exception
  * @return unknown
  */
 public function changePd($change_type, $data = array())
 {
     $data_log = array();
     $data_pd = array();
     $data_msg = array();
     $data_log['lg_member_id'] = $data['member_id'];
     $data_log['lg_member_name'] = $data['member_name'];
     $data_log['lg_add_time'] = TIMESTAMP;
     $data_log['lg_type'] = $change_type;
     $data_msg['time'] = date('Y-m-d H:i:s');
     $data_msg['pd_url'] = urlShop('predeposit', 'pd_log_list');
     switch ($change_type) {
         case 'order_pay':
             $data_log['lg_av_amount'] = -$data['amount'];
             $data_log['lg_desc'] = '下单,支付预存款,订单号: ' . $data['order_sn'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit-' . $data['amount']);
             $data_msg['av_amount'] = -$data['amount'];
             $data_msg['freeze_amount'] = 0;
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'order_freeze':
             $data_log['lg_av_amount'] = -$data['amount'];
             $data_log['lg_freeze_amount'] = $data['amount'];
             $data_log['lg_desc'] = '下单,冻结预存款,订单号: ' . $data['order_sn'];
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit+' . $data['amount']);
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit-' . $data['amount']);
             $data_msg['av_amount'] = -$data['amount'];
             $data_msg['freeze_amount'] = $data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'order_cancel':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_freeze_amount'] = -$data['amount'];
             $data_log['lg_desc'] = '取消订单,解冻预存款,订单号: ' . $data['order_sn'];
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit-' . $data['amount']);
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = -$data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'order_comb_pay':
             $data_log['lg_freeze_amount'] = -$data['amount'];
             $data_log['lg_desc'] = '下单,支付被冻结的预存款,订单号: ' . $data['order_sn'];
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit-' . $data['amount']);
             $data_msg['av_amount'] = 0;
             $data_msg['freeze_amount'] = $data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'recharge':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_desc'] = '充值,充值单号: ' . $data['pdr_sn'];
             $data_log['lg_admin_name'] = $data['admin_name'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = 0;
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'refund':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_desc'] = '确认退款,订单号: ' . $data['order_sn'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = 0;
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'vr_refund':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_desc'] = '虚拟兑码退款成功,订单号: ' . $data['order_sn'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = 0;
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'cash_apply':
             $data_log['lg_av_amount'] = -$data['amount'];
             $data_log['lg_freeze_amount'] = $data['amount'];
             $data_log['lg_desc'] = '申请提现,冻结预存款,提现单号: ' . $data['order_sn'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit-' . $data['amount']);
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = -$data['amount'];
             $data_msg['freeze_amount'] = $data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'cash_pay':
             $data_log['lg_freeze_amount'] = -$data['amount'];
             $data_log['lg_desc'] = '提现成功,提现单号: ' . $data['order_sn'];
             $data_log['lg_admin_name'] = $data['admin_name'];
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit-' . $data['amount']);
             $data_msg['av_amount'] = 0;
             $data_msg['freeze_amount'] = -$data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'cash_del':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_freeze_amount'] = -$data['amount'];
             $data_log['lg_desc'] = '取消提现申请,解冻预存款,提现单号: ' . $data['order_sn'];
             $data_log['lg_admin_name'] = $data['admin_name'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_pd['freeze_predeposit'] = array('exp', 'freeze_predeposit-' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = -$data['amount'];
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         default:
             throw new Exception('参数错误');
             break;
     }
     $update = Model('member')->editMember(array('member_id' => $data['member_id']), $data_pd);
     if (!$update) {
         throw new Exception('操作失败');
     }
     $insert = $this->table('pd_log')->insert($data_log);
     if (!$insert) {
         throw new Exception('操作失败');
     }
     // 支付成功发送买家消息
     $param = array();
     $param['code'] = 'predeposit_change';
     $param['member_id'] = $data['member_id'];
     $data_msg['av_amount'] = ncPriceFormat($data_msg['av_amount']);
     $data_msg['freeze_amount'] = ncPriceFormat($data_msg['freeze_amount']);
     $param['param'] = $data_msg;
     QueueClient::push('sendMemberMsg', $param);
     return $insert;
 }
Example #8
0
 /**
  * 取得购买车内组合销售信息以及包含的商品及有效状态
  * @param array $cart_list
  */
 private function _getBundlingCartList(&$cart_list)
 {
     if (!C('promotion_allow') || empty($cart_list)) {
         return;
     }
     $model_bl = Model('p_bundling');
     $model_goods = Model('goods');
     foreach ($cart_list as $key => $cart_info) {
         if (!intval($cart_info['bl_id'])) {
             continue;
         }
         $cart_list[$key]['state'] = true;
         $cart_list[$key]['storage_state'] = true;
         $bl_info = $model_bl->getBundlingInfo(array('bl_id' => $cart_info['bl_id']));
         //标志优惠套装是否处于有效状态
         if (empty($bl_info) || !intval($bl_info['bl_state'])) {
             $cart_list[$key]['state'] = false;
         }
         //取得优惠套装商品列表
         $cart_list[$key]['bl_goods_list'] = $model_bl->getBundlingGoodsList(array('bl_id' => $cart_info['bl_id']));
         //取最新在售商品信息
         $goods_id_array = array();
         foreach ($cart_list[$key]['bl_goods_list'] as $goods_info) {
             $goods_id_array[] = $goods_info['goods_id'];
         }
         $goods_list = $model_goods->getGoodsOnlineListAndPromotionByIdArray($goods_id_array);
         $goods_online_list = array();
         foreach ($goods_list as $goods_info) {
             $goods_online_list[$goods_info['goods_id']] = $goods_info;
         }
         unset($goods_list);
         //使用最新的商品名称、图片,如果一旦有商品下架,则整个套装置置为无效状态
         $total_down_price = 0;
         foreach ($cart_list[$key]['bl_goods_list'] as $k => $goods_info) {
             if (array_key_exists($goods_info['goods_id'], $goods_online_list)) {
                 $goods_online_info = $goods_online_list[$goods_info['goods_id']];
                 //如果库存不足,标识false
                 if ($cart_info['goods_num'] > $goods_online_info['goods_storage']) {
                     $cart_list[$key]['storage_state'] = false;
                 }
                 $cart_list[$key]['bl_goods_list'][$k]['goods_id'] = $goods_online_info['goods_id'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_commonid'] = $goods_online_info['goods_commonid'];
                 $cart_list[$key]['bl_goods_list'][$k]['store_id'] = $goods_online_info['store_id'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_name'] = $goods_online_info['goods_name'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_image'] = $goods_online_info['goods_image'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_storage'] = $goods_online_info['goods_storage'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_storage_alarm'] = $goods_online_info['goods_storage_alarm'];
                 $cart_list[$key]['bl_goods_list'][$k]['gc_id'] = $goods_online_info['gc_id'];
                 //每个商品直降多少
                 $total_down_price += $cart_list[$key]['bl_goods_list'][$k]['down_price'] = ncPriceFormat($goods_online_info['goods_price'] - $goods_info['bl_goods_price']);
             } else {
                 //商品已经下架
                 $cart_list[$key]['state'] = false;
                 $cart_list[$key]['storage_state'] = false;
             }
         }
         $cart_list[$key]['down_price'] = ncPriceFormat($total_down_price);
     }
 }
    </tbody>
  </table>
  
  <div class="stat-info"> <span>下单量:
    <strong><?php 
echo intval($output['statcount']['ordernum']);
?>
</strong>
    </span><span>下单商品数:
    <strong><?php 
echo intval($output['statcount']['goodsnum']);
?>
</strong>
    </span><span>下单金额:
    <strong><?php 
echo ncPriceFormat($output['statcount']['orderamount']);
?>
</strong>
    元 </span></div>
  <div id="stat_tabs" class="w100pre close_float ui-tabs">
    <div class="close_float tabmenu">
      <ul class="tab pngFix">
        <li><a href="#ordernum_div" nc_type="showlinelabels" data-param='{"type":"ordernum"}'>下单量</a></li>
        <li><a href="#goodsnum_div" nc_type="showlinelabels" data-param='{"type":"goodsnum"}'>下单商品数</a></li>
        <li><a href="#orderamount_div" nc_type="showlinelabels" data-param='{"type":"orderamount"}'>下单金额</a></li>
      </ul>
    </div>
    <!-- 下单量 -->
    <div id="ordernum_div" class="close_float"></div>
    <!-- 下单商品件数 -->
    <div id="goodsnum_div"></div>
Example #10
0
 /**
  * 更新购物车购买数量
  */
 public function cart_edit_quantityOp()
 {
     $cart_id = intval(abs($_POST['cart_id']));
     $quantity = intval(abs($_POST['quantity']));
     if (empty($cart_id) || empty($quantity)) {
         output_error('参数错误');
     }
     $model_cart = Model('cart');
     $cart_info = $model_cart->getCartInfo(array('cart_id' => $cart_id, 'buyer_id' => $this->member_info['member_id']));
     //检查是否为本人购物车
     if ($cart_info['buyer_id'] != $this->member_info['member_id']) {
         output_error('参数错误');
     }
     //检查库存是否充足
     if (!$this->_check_goods_storage($cart_info, $quantity, $this->member_info['member_id'])) {
         output_error('库存不足');
     }
     $data = array();
     $data['goods_num'] = $quantity;
     $update = $model_cart->editCart($data, array('cart_id' => $cart_id));
     if ($update) {
         $return = array();
         $return['quantity'] = $quantity;
         $return['goods_price'] = ncPriceFormat($cart_info['goods_price']);
         $return['total_price'] = ncPriceFormat($cart_info['goods_price'] * $quantity);
         output_data($return);
     } else {
         output_error('修改失败');
     }
 }
Example #11
0
 /**
  * 添加全部退款即取消订单
  *
  */
 public function add_refund_allOp()
 {
     $model_order = Model('order');
     $model_trade = Model('trade');
     $model_refund = Model('refund_return');
     $order_id = intval($_GET['order_id']);
     $condition = array();
     $condition['buyer_id'] = $_SESSION['member_id'];
     $condition['order_id'] = $order_id;
     $order = $model_refund->getRightOrderList($condition);
     Tpl::output('order', $order);
     $order_amount = $order['order_amount'];
     //订单金额
     $condition = array();
     $condition['buyer_id'] = $order['buyer_id'];
     $condition['order_id'] = $order['order_id'];
     $condition['goods_id'] = '0';
     $condition['seller_state'] = array('lt', '3');
     $refund_list = $model_refund->getRefundReturnList($condition);
     $refund = array();
     if (!empty($refund_list) && is_array($refund_list)) {
         $refund = $refund_list[0];
     }
     $order_paid = $model_trade->getOrderState('order_paid');
     //订单状态20:已付款
     $payment_code = $order['payment_code'];
     //支付方式
     if ($refund['refund_id'] > 0 || $order['order_state'] != $order_paid || $payment_code == 'offline') {
         //检查订单状态,防止页面刷新不及时造成数据错误
         showDialog(Language::get('wrong_argument'), 'index.php?act=member_order&op=index', 'error');
     }
     if (chksubmit()) {
         $refund_array = array();
         $refund_array['refund_type'] = '1';
         //类型:1为退款,2为退货
         $refund_array['seller_state'] = '1';
         //状态:1为待审核,2为同意,3为不同意
         $refund_array['order_lock'] = '2';
         //锁定类型:1为不用锁定,2为需要锁定
         $refund_array['goods_id'] = '0';
         $refund_array['order_goods_id'] = '0';
         $refund_array['reason_id'] = '0';
         $refund_array['reason_info'] = '取消订单,全部退款';
         $refund_array['goods_name'] = '订单商品全部退款';
         $refund_array['refund_amount'] = ncPriceFormat($order_amount);
         $refund_array['buyer_message'] = $_POST['buyer_message'];
         $refund_array['add_time'] = time();
         $pic_array = array();
         $pic_array['buyer'] = $this->upload_pic();
         //上传凭证
         $info = serialize($pic_array);
         $refund_array['pic_info'] = $info;
         $state = $model_refund->addRefundReturn($refund_array, $order);
         if ($state) {
             $model_refund->editOrderLock($order_id);
             showDialog(Language::get('nc_common_save_succ'), 'index.php?act=member_refund&op=index', 'succ');
         } else {
             showDialog(Language::get('nc_common_save_fail'), 'reload', 'error');
         }
     }
     Tpl::showpage('member_refund_all');
 }
Example #12
0
 /**
  * 概况总览
  */
 public function general_listOp()
 {
     //获得子分类ID
     $gc_childid = $gc_childarr = array();
     if ($this->choose_gcid > 0) {
         //如果进行了分类搜索,则统计该分类下的子分类
         $gc_childdepth = $this->gc_arr[$this->choose_gcid]['depth'] + 1;
         $gc_childid = explode(',', $this->gc_arr[$this->choose_gcid]['child']);
         if ($gc_childid) {
             foreach ((array) $this->gc_arr as $k => $v) {
                 if (in_array($v['gc_id'], $gc_childid)) {
                     $gc_childarr[$v['gc_id']] = $v;
                 }
             }
         }
     } else {
         //如果没有搜索分类,则默认统计一级分类
         $gc_childdepth = 1;
         foreach ((array) $this->gc_arr as $k => $v) {
             if ($v['depth'] == 1) {
                 $gc_childarr[$v['gc_id']] = $v;
             }
         }
     }
     $statlist = array();
     if ($gc_childarr) {
         $model = Model('stat');
         //查询订单商品信息
         $where = array();
         $where['order_isvalid'] = 1;
         //计入统计的有效订单
         //计算开始时间和结束时间
         $searchtime_arr[1] = strtotime(date('Y-m-d', time())) - 1;
         //昨天23:59点
         $searchtime_arr[0] = $searchtime_arr[1] - 86400 * 30 + 1;
         //从昨天开始30天前
         $where['order_add_time'] = array('between', $searchtime_arr);
         if ($this->choose_gcid > 0) {
             $where['gc_parentid_' . ($gc_childdepth - 1)] = $this->choose_gcid;
         }
         $field = 'gc_parentid_' . $gc_childdepth . ' as statgc_id,COUNT(DISTINCT goods_id) as ordergcount,SUM(goods_num) as ordergnum,SUM(goods_pay_price) as orderamount';
         $ordergoods_list_tmp = $model->statByStatordergoods($where, $field, 0, 0, '', 'statgc_id');
         foreach ((array) $ordergoods_list_tmp as $k => $v) {
             $ordergoods_list[$v['statgc_id']] = $v;
         }
         //查询商品信息
         $field = 'gc_id_' . $gc_childdepth . ' as statgc_id,COUNT(*) as goodscount,AVG(goods_price) as priceavg';
         $goods_list_tmp = $model->statByGoods(array('is_virtual' => 0), $field, 0, 0, '', 'statgc_id');
         foreach ((array) $goods_list_tmp as $k => $v) {
             $goods_list[$v['statgc_id']] = $v;
         }
         //将订单和商品数组合并
         $statlist_tmp = array();
         foreach ($gc_childarr as $k => $v) {
             $tmp = array();
             $tmp['statgc_id'] = $v['gc_id'];
             $tmp['gc_name'] = $v['gc_name'];
             $tmp['ordergcount'] = ($t = $ordergoods_list[$v['gc_id']]['ordergcount']) ? $t : 0;
             $tmp['ordergnum'] = ($t = $ordergoods_list[$v['gc_id']]['ordergnum']) ? $t : 0;
             $tmp['orderamount'] = ($t = $ordergoods_list[$v['gc_id']]['orderamount']) ? $t : 0;
             $tmp['goodscount'] = ($t = $goods_list[$v['gc_id']]['goodscount']) ? $t : 0;
             $tmp['priceavg'] = ncPriceFormat(($t = $goods_list[$v['gc_id']]['priceavg']) ? $t : 0);
             $tmp['unordergcount'] = intval($goods_list[$v['gc_id']]['goodscount']) - intval($ordergoods_list[$v['gc_id']]['ordergcount']);
             //计算无销量商品数
             $statlist_tmp[] = $tmp;
         }
         $statlist = array();
         //整理排序
         $orderby = trim($this->search_arr['orderby']);
         if (!$orderby) {
             $orderby = 'orderamount desc';
         }
         $orderkeys = explode(' ', $orderby);
         $keysvalue = $new_array = array();
         foreach ($statlist_tmp as $k => $v) {
             $keysvalue[$k] = $v[$orderkeys[0]];
         }
         if ($orderkeys[1] == 'asc') {
             asort($keysvalue);
         } else {
             arsort($keysvalue);
         }
         reset($keysvalue);
         foreach ($keysvalue as $k => $v) {
             $statlist[$k] = $statlist_tmp[$k];
         }
         //导出Excel
         if ($this->search_arr['exporttype'] == 'excel') {
             //列表header
             $statheader = array();
             $statheader[] = array('text' => '类目名称', 'key' => 'gc_name');
             $statheader[] = array('text' => '平均价格(元)', 'key' => 'priceavg', 'isorder' => 1);
             $statheader[] = array('text' => '有销量商品数', 'key' => 'ordergcount', 'isorder' => 1);
             $statheader[] = array('text' => '销量', 'key' => 'ordergnum', 'isorder' => 1);
             $statheader[] = array('text' => '销售额(元)', 'key' => 'orderamount', 'isorder' => 1);
             $statheader[] = array('text' => '商品总数', 'key' => 'goodscount', 'isorder' => 1);
             $statheader[] = array('text' => '无销量商品数', 'key' => 'unordergcount', 'isorder' => 1);
             //导出Excel
             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
             foreach ($statheader as $k => $v) {
                 $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
             }
             //data
             foreach ($statlist as $k => $v) {
                 foreach ($statheader as $h_k => $h_v) {
                     $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
                 }
             }
             $excel_data = $excel_obj->charset($excel_data, CHARSET);
             $excel_obj->addArray($excel_data);
             $excel_obj->addWorksheet($excel_obj->charset('行业概况总览', CHARSET));
             $excel_obj->generateXML($excel_obj->charset('行业概况总览', CHARSET) . date('Y-m-d-H', time()));
             exit;
         }
     }
     //列表header
     $statheader = array();
     $statheader[] = array('text' => '类目名称', 'key' => 'gc_name');
     $statheader[] = array('text' => '<span title="类目下所有商品的平均单价" class="tip icon-question-sign"></span>&nbsp;平均价格(元)', 'key' => 'priceavg', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下从昨天开始最近30天有效订单中有销量的商品总数" class="tip icon-question-sign"></span>&nbsp;有销量商品数', 'key' => 'ordergcount', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下从昨天开始最近30天有效订单中商品总售出件数" class="tip icon-question-sign"></span>&nbsp;销量', 'key' => 'ordergnum', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下从昨天开始最近30天有效订单中商品总销售额" class="tip icon-question-sign"></span>&nbsp;销售额(元)', 'key' => 'orderamount', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下所有商品的数量" class="tip icon-question-sign"></span>&nbsp;商品总数', 'key' => 'goodscount', 'isorder' => 1);
     $statheader[] = array('text' => '<span title="类目下从昨天开始最近30天无销量的商品总数" class="tip icon-question-sign"></span>&nbsp;无销量商品数', 'key' => 'unordergcount', 'isorder' => 1);
     Tpl::output('statheader', $statheader);
     Tpl::output('statlist', $statlist);
     Tpl::output('orderby', $orderby);
     Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&choose_gcid=" . $this->choose_gcid);
     Tpl::showpage('stat.listandorder', 'null_layout');
 }
Example #13
0
        foreach ($output['voucher_list'] as $voucher) {
            ?>
    <div title="<?php 
            echo $lang['cart_step1_voucher_usecondition'] . $voucher['voucher_limit'] . $lang['currency_zh'] . $lang['cart_step1_voucher'] . $lang['nc_colon'] . $voucher['voucher_code'];
            ?>
">
      <input type="radio" value="<?php 
            echo $voucher['voucher_id'];
            ?>
" name="voucher_id" rel="voucher">
      <?php 
            echo $lang['cart_step1_voucher_save'];
            ?>
<span class="cart-goods-price" nc_type="shipping_fee" value="<?php 
            echo $voucher['voucher_price'];
            ?>
"><em><?php 
            echo ncPriceFormat($voucher['voucher_price']);
            ?>
</em></span>&nbsp;(<?php 
            echo $voucher['voucher_desc'];
            ?>
)</div>
    <?php 
        }
    }
    ?>
  </dd>
</dl>
<?php 
}
Example #14
0
 /**
  * 申请续签
  */
 public function reopen_addOp()
 {
     if (!chksubmit()) {
         exit;
     }
     if (intval($_POST['re_grade_id']) <= 0 || intval($_POST['re_year']) <= 0) {
         exit;
     }
     // 店铺信息
     $model_store = Model('store');
     $store_info = $this->store_info;
     if (empty($store_info['store_end_time'])) {
         showDialog('您的店铺使用期限无限制,无须续签');
     }
     $model_store_reopen = Model('store_reopen');
     //如果存在有未上传凭证或审核中的信息,则不能再申请续签
     $condition = array();
     $condition['re_state'] = array('in', array(0, 1));
     $condition['re_store_id'] = $_SESSION['store_id'];
     if ($model_store_reopen->getStoreReopenCount($condition)) {
         showDialog('目前尚存在申请中的续签信息,不能重复申请');
     }
     $data = array();
     //取店铺等级信息
     $grade_list = rkcache('store_grade', true);
     if (empty($grade_list[$_POST['re_grade_id']])) {
         exit;
     }
     //取得店铺信息
     $data['re_grade_id'] = $_POST['re_grade_id'];
     $data['re_grade_name'] = $grade_list[$_POST['re_grade_id']]['sg_name'];
     $data['re_grade_price'] = $grade_list[$_POST['re_grade_id']]['sg_price'];
     $data['re_store_id'] = $_SESSION['store_id'];
     $data['re_store_name'] = $_SESSION['store_name'];
     $data['re_year'] = intval($_POST['re_year']);
     $data['re_pay_amount'] = $data['re_grade_price'] * $data['re_year'];
     $data['re_create_time'] = TIMESTAMP;
     if ($data['re_pay_amount'] == 0) {
         //             $data['re_start_time'] = strtotime(date('Y-m-d 0:0:0',$store_info['store_end_time']))+24*3600;
         //             $data['re_end_time'] = strtotime(date('Y-m-d 23:59:59', $data['re_start_time'])." +".intval($data['re_year'])." year");
         $data['re_state'] = 1;
     }
     $insert = $model_store_reopen->addStoreReopen($data);
     if ($insert) {
         if ($data['re_pay_amount'] == 0) {
             // 	            $model_store->editStore(array('store_end_time'=>$data['re_end_time']),array('store_id'=>$_SESSION['store_id']));
             showDialog('您的申请已经提交,请等待管理员审核', 'reload', 'succ', '', 5);
         } else {
             showDialog(Language::get('nc_common_save_succ') . ',需付款金额' . ncPriceFormat($data['re_pay_amount']) . '元,请尽快完成付款,付款完成后请上传付款凭证', 'reload', 'succ', '', 5);
         }
     } else {
         showDialog(Language::get('nc_common_del_fail'));
     }
 }
Example #15
0
<div class="eject_con">
  <div id="warning"></div>
  <form id="post_form" method="post" action="index.php?act=member_refund&op=add&order_id=<?php 
echo $output['order']['order_id'];
?>
">
    <input type="hidden" name="form_submit" value="ok" />
    <dl>
      <dt><?php 
echo $lang['refund_order_amount'] . $lang['nc_colon'];
?>
</dt>
      <dd><?php 
echo ncPriceFormat($output['order']['order_amount']);
?>
</dd>
    </dl>
    <dl>
      <dt class="required"><em class="pngFix"></em><?php 
echo $lang['refund_order_refund'] . $lang['nc_colon'];
?>
</dt>
      <dd>
        <input type="text" class="text w50" name="order_refund" value="<?php 
echo $output['refund']['order_refund'] > 0 ? $output['refund']['order_refund'] : $output['order']['order_amount'];
?>
"  />
      </dd>
    </dl>
    <dl>
      <dt class="required"><em class="pngFix"></em><?php 
Example #16
0
 /**
  * 取得店铺级优惠 - 跟据商品金额返回每个店铺当前符合的一条活动规则,如果有赠品,则自动追加到购买列表,价格为0
  * @param unknown $store_goods_total 每个店铺的商品金额小计,以店铺ID为下标
  * @return array($premiums_list,$mansong_rule_list) 分别为赠品列表[下标自增],店铺满送规则列表[店铺ID为下标]
  */
 public function getMansongRuleCartListByTotal($store_goods_total)
 {
     if (!C('promotion_allow') || empty($store_goods_total) || !is_array($store_goods_total)) {
         return array(array(), array());
     }
     $model_mansong = Model('p_mansong');
     $model_goods = Model('goods');
     //定义赠品数组,下标为店铺ID
     $premiums_list = array();
     //定义满送活动数组,下标为店铺ID
     $mansong_rule_list = array();
     foreach ($store_goods_total as $store_id => $goods_total) {
         $rule_info = $model_mansong->getMansongRuleByStoreID($store_id, $goods_total);
         if (is_array($rule_info) && !empty($rule_info)) {
             //即不减金额,也找不到促销商品时(已下架),此规则无效
             if (empty($rule_info['discount']) && empty($rule_info['mansong_goods_name'])) {
                 continue;
             }
             $rule_info['desc'] = $this->_parseMansongRuleDesc($rule_info);
             $rule_info['discount'] = ncPriceFormat($rule_info['discount']);
             $mansong_rule_list[$store_id] = $rule_info;
             //如果赠品在售,有库存,则追加到购买列表
             if (!empty($rule_info['mansong_goods_name']) && !empty($rule_info['goods_storage'])) {
                 $data = array();
                 $data['goods_id'] = $rule_info['goods_id'];
                 $data['goods_name'] = $rule_info['mansong_goods_name'];
                 $data['goods_num'] = 1;
                 $data['goods_price'] = 0.0;
                 $data['goods_image'] = $rule_info['goods_image'];
                 $data['goods_image_url'] = cthumb($rule_info['goods_image']);
                 $data['goods_storage'] = $rule_info['goods_storage'];
                 $premiums_list[$store_id][] = $data;
             }
         }
     }
     return array($premiums_list, $mansong_rule_list);
 }
Example #17
0
 /**
  * 下单时支付页面
  */
 public function payOp()
 {
     $pay_sn = $_GET['pay_sn'];
     if (!preg_match('/^\\d{18}$/', $pay_sn)) {
         showMessage(Language::get('cart_order_pay_not_exists'), 'index.php?act=member_order', 'html', 'error');
     }
     //查询支付单信息
     $model_order = Model('order');
     $pay_info = $model_order->getOrderPayInfo(array('pay_sn' => $pay_sn, 'buyer_id' => $_SESSION['member_id']), true);
     if (empty($pay_info)) {
         showMessage(Language::get('cart_order_pay_not_exists'), 'index.php?act=member_order', 'html', 'error');
     }
     Tpl::output('pay_info', $pay_info);
     //取子订单列表
     $condition = array();
     $condition['pay_sn'] = $pay_sn;
     $condition['order_state'] = array('in', array(ORDER_STATE_NEW, ORDER_STATE_PAY));
     $order_list = $model_order->getOrderList($condition, '', 'order_id,order_state,payment_code,order_amount,rcb_amount,pd_amount,order_sn', '', '', array(), true);
     if (empty($order_list)) {
         showMessage('未找到需要支付的订单', 'index.php?act=member_order', 'html', 'error');
     }
     //重新计算在线支付金额
     $pay_amount_online = 0;
     $pay_amount_offline = 0;
     //订单总支付金额(不包含货到付款)
     $pay_amount = 0;
     foreach ($order_list as $key => $order_info) {
         $payed_amount = floatval($order_info['rcb_amount']) + floatval($order_info['pd_amount']);
         //计算相关支付金额
         if ($order_info['payment_code'] != 'offline') {
             if ($order_info['order_state'] == ORDER_STATE_NEW) {
                 $pay_amount_online += ncPriceFormat(floatval($order_info['order_amount']) - $payed_amount);
             }
             $pay_amount += floatval($order_info['order_amount']);
         } else {
             $pay_amount_offline += floatval($order_info['order_amount']);
         }
         //显示支付方式与支付结果
         if ($order_info['payment_code'] == 'offline') {
             $order_list[$key]['payment_state'] = '货到付款';
         } else {
             $order_list[$key]['payment_state'] = '在线支付';
             if ($payed_amount > 0) {
                 $payed_tips = '';
                 if (floatval($order_info['rcb_amount']) > 0) {
                     $payed_tips = '充值卡已支付:¥' . $order_info['rcb_amount'];
                 }
                 if (floatval($order_info['pd_amount']) > 0) {
                     $payed_tips .= ' 预存款已支付:¥' . $order_info['pd_amount'];
                 }
                 $order_list[$key]['order_amount'] .= " ( {$payed_tips} )";
             }
         }
     }
     Tpl::output('order_list', $order_list);
     //如果线上线下支付金额都为0,转到支付成功页
     if (empty($pay_amount_online) && empty($pay_amount_offline)) {
         redirect('index.php?act=buy&op=pay_ok&pay_sn=' . $pay_sn . '&pay_amount=' . ncPriceFormat($pay_amount));
     }
     //输出订单描述
     if (empty($pay_amount_online)) {
         $order_remind = '下单成功,我们会尽快为您发货,请保持电话畅通!';
     } elseif (empty($pay_amount_offline)) {
         $order_remind = '请您及时付款,以便订单尽快处理!';
     } else {
         $order_remind = '部分商品需要在线支付,请尽快付款!';
     }
     Tpl::output('order_remind', $order_remind);
     Tpl::output('pay_amount_online', ncPriceFormat($pay_amount_online));
     Tpl::output('pd_amount', ncPriceFormat($pd_amount));
     //显示支付接口列表
     if ($pay_amount_online > 0) {
         $model_payment = Model('payment');
         $condition = array();
         $payment_list = $model_payment->getPaymentOpenList($condition);
         if (!empty($payment_list)) {
             unset($payment_list['predeposit']);
             unset($payment_list['offline']);
         }
         if (empty($payment_list)) {
             showMessage('暂未找到合适的支付方式', 'index.php?act=member_order', 'html', 'error');
         }
         Tpl::output('payment_list', $payment_list);
     }
     //标识 购买流程执行第几步
     Tpl::output('buy_step', 'step3');
     Tpl::showpage('buy_step2');
 }
Example #18
0
 /**
  * 生成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_selerid'));
     $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
     $cn_state = array(L('exp_od_sta_qx'), L('exp_od_sta_dfk'), L('exp_od_sta_dqr'), L('exp_od_sta_yfk'), L('exp_od_sta_yfh'), L('exp_od_sta_yjs'), L('exp_od_sta_dsh'), L('exp_od_sta_yqr'));
     foreach ((array) $data as $k => $v) {
         if ($v['order_state'] == 0) {
             $v['order_state'] = '00';
         }
         $v['order_state'] = str_replace(array('00', 10, 11, 20, 30, 40, 50, 60), $cn_state, $v['order_state']);
         $tmp = array();
         $tmp[] = array('data' => $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' => $v['payment_name']);
         $tmp[] = array('data' => $v['order_state']);
         $tmp[] = array('data' => $v['store_id']);
         $tmp[] = array('data' => $v['seller_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()));
 }
Example #19
0
    echo $lang['currency'];
    echo $goods['goods_price'];
    ?>
</td>
        <td><?php 
    echo $lang['currency'];
    echo $goods['goods_pay_price'];
    ?>
</td>
        <td><?php 
    echo $goods['commis_rate'];
    ?>
%</td>
        <td><?php 
    echo $lang['currency'];
    echo ncPriceFormat($goods['goods_pay_price'] * $goods['commis_rate'] / 100);
    ?>
</td>
        </tr>
      <?php 
}
?>
    </tbody>
    <tfoot>
      <tr>
        <td colspan="20" class="transportation tl">
     <?php 
if (!empty($output['order_info']['shipping_fee']) && $output['order_info']['shipping_fee'] != '0.00') {
    ?>
        <?php 
    echo $lang['store_show_order_tp_fee'];
Example #20
0
 /**
  * 生成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()));
 }
            echo date('Y-m-d H:i:s', $code_info['vr_usetime']);
            ?>
        <?php 
        }
        ?>
        </td>
        <td class="align-center"><?php 
        echo $output['order_list'][$code_info['order_id']]['order_sn'];
        ?>
</td>
        <td class="align-center"><?php 
        echo $code_info['pay_price'];
        ?>
</td>
        <td class="align-center"><?php 
        echo ncPriceFormat($code_info['pay_price'] * $code_info['commis_rate'] / 100);
        ?>
</td>
        <td class="align-center"><?php 
        echo $output['order_list'][$code_info['order_id']]['buyer_name'];
        ?>
</td>
        <td class="align-center"><?php 
        echo $output['order_list'][$code_info['order_id']]['store_name'];
        ?>
</td>
        <td>
        <a href="index.php?act=vr_order&op=show_order&order_id=<?php 
        echo $code_info['order_id'];
        ?>
"><?php 
        ?>
      <tr class="hover">
        <td class="align-center"><?php 
        echo $order_info['order_sn'];
        ?>
</td>
        <td class="align-center"><?php 
        echo $order_info['order_amount'];
        ?>
</td>
        <td class="align-center"><?php 
        echo $order_info['shipping_fee'];
        ?>
</td>
        <td class="align-center"><?php 
        echo ncPriceFormat($output['commis_list'][$order_info['order_id']]['commis_amount']);
        ?>
</td>
        <td class="align-center"><?php 
        echo date('Y-m-d', $order_info['add_time']);
        ?>
</td>
        <td class="align-center"><?php 
        echo date('Y-m-d', $order_info['finnshed_time']);
        ?>
</td>
        <td class="align-center"><?php 
        echo $order_info['buyer_name'];
        ?>
</rd>
        <td>
                		<span class="infoitem left">团购价:<em class="red_common"><?php 
        echo $v['groupbuy_price'] . $lang['currency_zh'];
        ?>
</em></span>
                	</div>
                	<div class="close_float">
                		<span class="infoitem left">浏览次数:<em class="red_common"><?php 
        echo $v['views'];
        ?>
</em></span>
                		<span class="infoitem left">购买量:<em class="red_common"><?php 
        echo $v['buy_quantity'];
        ?>
</em></span>
                		<span class="infoitem left" style="width:200px;">总金额:<em class="red_common"><?php 
        echo ncPriceFormat($v['buy_quantity'] * $v['groupbuy_price']) . $lang['currency_zh'];
        ?>
</em></span>
                		<span class="infoitem left" style="width:300px;">下单转化率:<em class="red_common"><?php 
        echo $v['views'] > 0 ? round($v['buyer_count'] / $v['views'] * 100, 2) : 0;
        ?>
%</em></span>
                	</div>
            	</div>
            </td>
          </tr>
        <?php 
    }
    ?>
        <?php 
} else {
 /**
  * 查看订单
  */
 public function fapiaoOp()
 {
     $order_id = intval($_GET['order_id']);
     if ($order_id <= 0) {
         showMessage(Language::get('wrong_argument'), '', 'html', 'error');
     }
     $order_model = Model('order');
     $condition['order_id'] = $order_id;
     $condition['store_id'] = $_SESSION['store_id'];
     $order_info = $order_model->getOrderInfo($condition, array('order_common', 'order_goods'));
     if (empty($order_info)) {
         showMessage(Language::get('member_printorder_ordererror'), '', 'html', 'error');
     }
     Tpl::output('order_info', $order_info);
     //卖家信息
     $model_store = Model('store');
     $store_info = $model_store->getStoreInfoByID($order_info['store_id']);
     if (!empty($store_info['store_label'])) {
         if (file_exists(BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $store_info['store_label'])) {
             $store_info['store_label'] = UPLOAD_SITE_URL . DS . ATTACH_STORE . DS . $store_info['store_label'];
         } else {
             $store_info['store_label'] = '';
         }
     }
     if (!empty($store_info['store_stamp'])) {
         if (file_exists(BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $store_info['store_stamp'])) {
             $store_info['store_stamp'] = UPLOAD_SITE_URL . DS . ATTACH_STORE . DS . $store_info['store_stamp'];
         } else {
             $store_info['store_stamp'] = '';
         }
     }
     Tpl::output('store_info', $store_info);
     //订单商品
     $model_order = Model('order');
     $condition = array();
     $condition['order_id'] = $order_id;
     $condition['store_id'] = $_SESSION['store_id'];
     $goods_new_list = array();
     $goods_all_num = 0;
     $goods_total_price = 0;
     if (!empty($order_info['extend_order_goods'])) {
         $goods_count = count($order_goods_list);
         $i = 1;
         foreach ($order_info['extend_order_goods'] as $k => $v) {
             $v['goods_name'] = str_cut($v['goods_name'], 100);
             $goods_all_num += $v['goods_num'];
             $v['goods_all_price'] = ncPriceFormat($v['goods_num'] * $v['goods_price']);
             $goods_total_price += $v['goods_all_price'];
             $goods_new_list[ceil($i / 4)][$i] = $v;
             $i++;
         }
     }
     //优惠金额
     $promotion_amount = $goods_total_price - $order_info['goods_amount'];
     //运费
     $order_info['shipping_fee'] = $order_info['shipping_fee'];
     Tpl::output('promotion_amount', $promotion_amount);
     Tpl::output('goods_all_num', $goods_all_num);
     Tpl::output('goods_total_price', ncPriceFormat($goods_total_price));
     Tpl::output('goods_list', $goods_new_list);
     Tpl::showpage('printer_fapiao', "null_layout");
 }
Example #25
0
File: bill.php Project: noikiy/nc-1
 /**
  * 导出结算退单明细CSV
  *
  */
 public function export_refund_orderOp()
 {
     if (!preg_match('/^20\\d{5,12}$/', $_GET['ob_no'])) {
         showMessage('参数错误', '', 'html', 'error');
     }
     $model_bill = Model('bill');
     $bill_info = $model_bill->getOrderBillInfo(array('ob_no' => $_GET['ob_no']));
     if (!$bill_info) {
         showMessage('参数错误', '', 'html', 'error');
     }
     $model_refund = Model('refund_return');
     $condition = array();
     $condition['seller_state'] = 2;
     $condition['store_id'] = $bill_info['ob_store_id'];
     $condition['goods_id'] = array('gt', 0);
     $if_start_date = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_start_date']);
     $if_end_date = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_end_date']);
     $start_unixtime = $if_end_date ? strtotime($_GET['query_start_date']) : null;
     $end_unixtime = $if_end_date ? strtotime($_GET['query_end_date']) : null;
     if ($if_end_date || $if_end_date) {
         $condition['admin_time'] = array('time', array($start_unixtime, $end_unixtime));
     } else {
         $condition['admin_time'] = array('time', array($bill_info['ob_start_date'], $bill_info['ob_end_date']));
     }
     if (!is_numeric($_GET['curpage'])) {
         $count = $model_refund->getRefundReturn($condition);
         $array = array();
         if ($count > self::EXPORT_SIZE) {
             //显示下载链接
             $page = ceil($count / self::EXPORT_SIZE);
             for ($i = 1; $i <= $page; $i++) {
                 $limit1 = ($i - 1) * self::EXPORT_SIZE + 1;
                 $limit2 = $i * self::EXPORT_SIZE > $count ? $count : $i * self::EXPORT_SIZE;
                 $array[$i] = $limit1 . ' ~ ' . $limit2;
             }
             Tpl::output('list', $array);
             Tpl::output('murl', 'index.php?act=bill&op=show_bill&query_type=refund&ob_no=' . $_GET['ob_no']);
             Tpl::showpage('export.excel');
             exit;
         } else {
             //如果数量小,直接下载
             $data = $model_refund->getRefundReturnList($condition, '', '*,refund_amount*commis_rate/100 as commis_amount', self::EXPORT_SIZE);
         }
     } else {
         //下载
         $limit1 = ($_GET['curpage'] - 1) * self::EXPORT_SIZE;
         $limit2 = self::EXPORT_SIZE;
         $data = $model_refund->getRefundReturnList(condition, '', '*,refund_amount*commis_rate/100 as commis_amount', "{$limit1},{$limit2}");
     }
     if (is_array($data) && count($data) == 1 && $data[0]['refund_id'] == '') {
         $refund_list = array();
     }
     $export_data = array();
     $export_data[0] = array('退单编号', '订单编号', '退单金额', '退单佣金', '类型', '退款日期', '商家', '商家编号', '买家', '买家编号');
     $refund_amount = 0;
     $commis_totals = 0;
     $k = 0;
     foreach ($data as $v) {
         $export_data[$k + 1][] = 'NC' . $v['refund_sn'];
         $export_data[$k + 1][] = 'NC' . $v['order_sn'];
         $refund_amount += $export_data[$k + 1][] = $v['refund_amount'];
         $commis_totals += $export_data[$k + 1][] = ncPriceFormat($v['commis_amount']);
         $export_data[$k + 1][] = str_replace(array(1, 2), array('退款', '退货'), $v['refund_type']);
         $export_data[$k + 1][] = date('Y-m-d', $v['admin_time']);
         $export_data[$k + 1][] = $v['store_name'];
         $export_data[$k + 1][] = $v['store_id'];
         $export_data[$k + 1][] = $v['buyer_name'];
         $export_data[$k + 1][] = $v['buyer_id'];
         $k++;
     }
     $count = count($export_data);
     $export_data[$count][] = '';
     $export_data[$count][] = '合计';
     $export_data[$count][] = $refund_amount;
     $export_data[$count][] = $commis_totals;
     $csv = new Csv();
     $export_data = $csv->charset($export_data, CHARSET, 'gbk');
     $csv->filename = $csv->charset('退单明细-', CHARSET) . $_GET['ob_no'];
     $csv->export($export_data);
 }
 /**
  * 促销分析
  */
 public function generalOp()
 {
     $model = Model('stat');
     //统计的日期0点
     $stat_time = strtotime(date('Y-m-d', time())) - 86400;
     /*
      * 近30天
      */
     $stime = $stat_time - 86400 * 29;
     //30天前
     $etime = $stat_time + 86400 - 1;
     //昨天23:59
     $statnew_arr = array();
     //查询订单表下单量、下单金额、下单客户数
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' COUNT(*) as ordernum, SUM(order_amount) as orderamount, COUNT(DISTINCT buyer_id) as ordermembernum, AVG(order_amount) as avgorderamount ';
     $stat_order = $model->getoneByStatorder($where, $field);
     $statnew_arr['ordernum'] = ($t = $stat_order['ordernum']) ? $t : 0;
     $statnew_arr['orderamount'] = ncPriceFormat(($t = $stat_order['orderamount']) ? $t : 0);
     $statnew_arr['ordermembernum'] = ($t = $stat_order['ordermembernum']) > 0 ? $t : 0;
     $statnew_arr['avgorderamount'] = ncPriceFormat(($t = $stat_order['avgorderamount']) ? $t : 0);
     unset($stat_order);
     //下单高峰期
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' HOUR(FROM_UNIXTIME(order_add_time)) as hourval,COUNT(*) as ordernum ';
     $orderlist = $model->statByStatorder($where, $field, 0, 0, 'ordernum desc,hourval asc', 'hourval');
     foreach ((array) $orderlist as $k => $v) {
         if ($k < 2) {
             //取前两个订单量高的时间段
             if (!$statnew_arr['hothour']) {
                 $statnew_arr['hothour'] = $v['hourval'] . ":00~" . ($v['hourval'] + 1) . ":00";
             } else {
                 $statnew_arr['hothour'] .= "," . ($v['hourval'] . ":00~" . ($v['hourval'] + 1) . ":00");
             }
         }
     }
     unset($orderlist);
     //查询订单商品表下单商品数
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' SUM(goods_num) as ordergoodsnum, AVG(goods_pay_price/goods_num) as avggoodsprice ';
     $stat_ordergoods = $model->getoneByStatordergoods($where, $field);
     $statnew_arr['ordergoodsnum'] = ($t = $stat_ordergoods['ordergoodsnum']) ? $t : 0;
     $statnew_arr['avggoodsprice'] = ncPriceFormat(($t = $stat_ordergoods['avggoodsprice']) ? $t : 0);
     unset($stat_ordergoods);
     //商品总数、收藏量
     $goods_list = $model->statByGoods(array('store_id' => $_SESSION['store_id'], 'is_virtual' => 0), 'COUNT(*) as goodsnum, SUM(goods_collect) as gcollectnum');
     $statnew_arr['goodsnum'] = ($t = $goods_list[0]['goodsnum']) > 0 ? $t : 0;
     $statnew_arr['gcollectnum'] = ($t = $goods_list[0]['gcollectnum']) > 0 ? $t : 0;
     //店铺收藏量
     $store_list = $model->getoneByStore(array('store_id' => $_SESSION['store_id']), 'store_collect');
     $statnew_arr['store_collect'] = ($t = $store_list['store_collect']) > 0 ? $t : 0;
     /*
      * 销售走势
      */
     //构造横轴数据
     for ($i = $stime; $i < $etime; $i += 86400) {
         //当前数据的时间
         $timetext = date('n', $i) . '-' . date('j', $i);
         //统计图数据
         $stat_list[$timetext] = 0;
         //横轴
         $stat_arr['xAxis']['categories'][] = $timetext;
     }
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' order_add_time,SUM(order_amount) as orderamount,MONTH(FROM_UNIXTIME(order_add_time)) as monthval,DAY(FROM_UNIXTIME(order_add_time)) as dayval ';
     $stat_order = $model->statByStatorder($where, $field, 0, 0, '', 'monthval,dayval');
     if ($stat_order) {
         foreach ($stat_order as $k => $v) {
             $stat_list[$v['monthval'] . '-' . $v['dayval']] = floatval($v['orderamount']);
         }
     }
     $stat_arr['legend']['enabled'] = false;
     $stat_arr['series'][0]['name'] = '下单金额';
     $stat_arr['series'][0]['data'] = array_values($stat_list);
     //得到统计图数据
     $stat_arr['title'] = '最近30天销售走势';
     $stat_arr['yAxis'] = '下单金额';
     $stattoday_json = getStatData_LineLabels($stat_arr);
     unset($stat_arr);
     /*
      * 7日内商品销售TOP30
      */
     $stime = $stat_time - 86400 * 6;
     //7天前0点
     $etime = $stat_time + 86400 - 1;
     //今天24点
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' sum(goods_num) as ordergoodsnum, goods_id, goods_name ';
     $goodstop30_arr = $model->statByStatordergoods($where, $field, 0, 30, 'ordergoodsnum desc', 'goods_id');
     /**
      * 7日内同行热卖商品
      */
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', array($stime, $etime));
     $where['store_id'] = array('neq', $_SESSION['store_id']);
     if (!checkPlatformStore()) {
         //如果不是平台店铺,则查询店铺经营类目的同行数据
         //查询店铺经营类目
         $store_bindclass = Model('store_bind_class')->getStoreBindClassList(array('store_id' => $_SESSION['store_id']));
         $goodsclassid_arr = array();
         foreach ((array) $store_bindclass as $k => $v) {
             if (intval($v['class_3']) > 0) {
                 $goodsclassid_arr[3][] = intval($v['class_3']);
             } elseif (intval($v['class_2']) > 0) {
                 $goodsclassid_arr[2][] = intval($v['class_2']);
             } elseif (intval($v['class_1']) > 0) {
                 $goodsclassid_arr[1][] = intval($v['class_1']);
             }
         }
         //拼接商品分类条件
         if ($goodsclassid_arr) {
             ksort($goodsclassid_arr);
             $gc_parentidwhere_keyarr = array();
             $gc_parentidwhere_arr = array();
             foreach ((array) $goodsclassid_arr as $k => $v) {
                 $gc_parentidwhere_keyarr[] = 'gc_parentid_' . $k;
                 $gc_parentidwhere_arr[] = array('in', $goodsclassid_arr[$k]);
             }
             if (count($gc_parentidwhere_keyarr) == 1) {
                 $where[$gc_parentidwhere_keyarr[0]] = $gc_parentidwhere_arr[0];
             } else {
                 $gc_parentidwhere_arr['_multi'] = '1';
                 $where[implode('|', $gc_parentidwhere_keyarr)] = $gc_parentidwhere_arr;
             }
         }
     }
     $field = ' sum(goods_num) as ordergoodsnum, goods_id, goods_name ';
     $othergoodstop30_arr = $model->statByStatordergoods($where, $field, 0, 30, 'ordergoodsnum desc', 'goods_id');
     Tpl::output('goodstop30_arr', $goodstop30_arr);
     Tpl::output('othergoodstop30_arr', $othergoodstop30_arr);
     Tpl::output('stattoday_json', $stattoday_json);
     Tpl::output('statnew_arr', $statnew_arr);
     Tpl::output('stat_time', $stat_time);
     Tpl::showpage('stat.general.index');
 }
                ?>
      <tr>
        <td colspan="19" class="sep-row"></td>
      </tr>
      <?php 
            }
            ?>
      <?php 
            if (!empty($group_info['pay_amount']) && $p == 0) {
                ?>
      <tr>
        <td colspan="19" class="sep-row"></td>
      </tr>
      <tr>
        <td colspan="19" class="pay-td"><span class="ml15">在线支付金额:<em>¥<?php 
                echo ncPriceFormat($group_info['pay_amount']);
                ?>
</em></span> <a class="ncm-btn ncm-btn-orange fr mr15" href="index.php?act=buy&op=pay&pay_sn=<?php 
                echo $order_pay_sn;
                ?>
"><i class="icon-shield"></i>订单支付</a></td>
      </tr>
      <?php 
            }
            ?>
      <?php 
            $p++;
            ?>
      <tr>
        <th colspan="19"> <span class="ml10">
          <!-- order_sn -->
Example #28
0
 /**
  * 抢购保存
  **/
 public function groupbuy_saveOp()
 {
     //获取提交的数据
     $goods_id = intval($_POST['groupbuy_goods_id']);
     if (empty($goods_id)) {
         showDialog(Language::get('param_error'));
     }
     $model_groupbuy = Model('groupbuy');
     $model_goods = Model('goods');
     $model_groupbuy_quota = Model('groupbuy_quota');
     if (!checkPlatformStore()) {
         // 检查套餐
         $current_groupbuy_quota = $model_groupbuy_quota->getGroupbuyQuotaCurrent($_SESSION['store_id']);
         if (empty($current_groupbuy_quota)) {
             showDialog('当前没有可用套餐,请先购买套餐', urlShop('store_groupbuy', 'groupbuy_quota_add'), 'error');
         }
     }
     $goods_info = $model_goods->getGoodsInfoByID($goods_id, 'goods_id,goods_commonid,goods_name,goods_price,store_id,virtual_limit');
     if (empty($goods_info) || $goods_info['store_id'] != $_SESSION['store_id']) {
         showDialog(Language::get('param_error'));
     }
     $param = array();
     $param['groupbuy_name'] = $_POST['groupbuy_name'];
     $param['remark'] = $_POST['remark'];
     $param['start_time'] = strtotime($_POST['start_time']);
     $param['end_time'] = strtotime($_POST['end_time']);
     $param['groupbuy_price'] = floatval($_POST['groupbuy_price']);
     $param['groupbuy_rebate'] = ncPriceFormat(floatval($_POST['groupbuy_price']) / floatval($goods_info['goods_price']) * 10);
     $param['groupbuy_image'] = $_POST['groupbuy_image'];
     $param['groupbuy_image1'] = $_POST['groupbuy_image1'];
     $param['virtual_quantity'] = intval($_POST['virtual_quantity']);
     $param['upper_limit'] = intval($_POST['upper_limit']);
     $param['groupbuy_intro'] = $_POST['groupbuy_intro'];
     $param['class_id'] = intval($_POST['class_id']);
     $param['goods_id'] = $goods_info['goods_id'];
     $param['goods_commonid'] = $goods_info['goods_commonid'];
     $param['goods_name'] = $goods_info['goods_name'];
     $param['goods_price'] = $goods_info['goods_price'];
     $param['store_id'] = $_SESSION['store_id'];
     $param['store_name'] = $_SESSION['store_name'];
     // 虚拟抢购
     if ($_GET['vr']) {
         if ($param['upper_limit'] > 0 && $goods_info['virtual_limit'] > 0 && $param['upper_limit'] > $goods_info['virtual_limit']) {
             showDialog(sprintf('虚拟抢购活动的限购数量(%d)不能大于虚拟商品本身的限购数量(%d)', $param['upper_limit'], $goods_info['virtual_limit']), 'index.php?act=store_groupbuy');
         }
         $param += array('is_vr' => 1, 'vr_class_id' => (int) $_POST['class'], 'vr_s_class_id' => (int) $_POST['s_class'], 'vr_city_id' => (int) $_POST['city'], 'vr_area_id' => (int) $_POST['area'], 'vr_mall_id' => (int) $_POST['mall']);
     }
     //保存
     $result = $model_groupbuy->addGroupbuy($param);
     if ($result) {
         // 自动发布动态
         // group_id,group_name,goods_id,goods_price,groupbuy_price,group_pic,rebate,start_time,end_time
         $data_array = array();
         $data_array['group_id'] = $result;
         $data_array['group_name'] = $param['group_name'];
         $data_array['goods_id'] = $param['goods_id'];
         $data_array['goods_price'] = $param['goods_price'];
         $data_array['groupbuy_price'] = $param['groupbuy_price'];
         $data_array['group_pic'] = $param['groupbuy_image1'];
         $data_array['rebate'] = $param['groupbuy_rebate'];
         $data_array['start_time'] = $param['start_time'];
         $data_array['end_time'] = $param['end_time'];
         $this->storeAutoShare($data_array, 'groupbuy');
         $this->recordSellerLog('发布抢购活动,抢购名称:' . $param['groupbuy_name'] . ',商品名称:' . $param['goods_name']);
         showDialog(Language::get('groupbuy_add_success'), 'index.php?act=store_groupbuy', 'succ');
     } else {
         showDialog(Language::get('groupbuy_add_fail'), 'index.php?act=store_groupbuy');
     }
 }
Example #29
0
	/**
	 * 商品详细
	 */
	public function goodsinfoOp(){
	    $templatesname = 'stat.goods.goodsinfo';
	    $goods_id = intval($_GET['gid']);
	    if ($goods_id <= 0){
	        Tpl::output('stat_msg','参数错误');
    	    Tpl::showpage($templatesname,'null_layout');
	    }
	    //查询商品信息
	    $goods_info = Model('goods')->getGoodsInfoByID($goods_id, 'goods_name');
	    if (!$goods_info){
	        Tpl::output('stat_msg','参数错误');
    	    Tpl::showpage($templatesname,'null_layout');
	    }
	    $model = Model('stat');
	    //统计的日期0点
	    $stat_time = strtotime(date('Y-m-d',time())) - 86400;
	    /*
	     * 近30天
	     */
		$stime = $stat_time - (86400*29);//30天前
		$etime = $stat_time + 86400 - 1;//昨天23:59

		$stat_arr = array();
	    for($i=$stime; $i<$etime; $i+=86400){
		    //当前数据的时间
		    $timetext = date('n',$i).'-'.date('j',$i);
			//统计图数据
			$stat_list['ordergoodsnum'][$timetext] = 0;
			$stat_list['ordergamount'][$timetext] = 0;
			$stat_list['ordernum'][$timetext] = 0;
			//横轴
			$stat_arr['ordergoodsnum']['xAxis']['categories'][] = $timetext;
			$stat_arr['ordergamount']['xAxis']['categories'][] = $timetext;
			$stat_arr['ordernum']['xAxis']['categories'][] = $timetext;
		}
	    //查询订单商品表下单商品数
	    $where = array();
	    $where['goods_id'] = $goods_id;
		$where['order_isvalid'] = 1;//计入统计的有效订单
		$where['store_id'] = $_SESSION['store_id'];
		$where['order_add_time'] = array('between',array($stime,$etime));

		$field = ' goods_id,goods_name,COUNT(DISTINCT order_id) as ordernum,SUM(goods_num) as ordergoodsnum,SUM(goods_pay_price) as ordergamount,MONTH(FROM_UNIXTIME(order_add_time)) as monthval,DAY(FROM_UNIXTIME(order_add_time)) as dayval ';
	    $stat_ordergoods = $model->statByStatordergoods($where, $field, 0, 0, '','monthval,dayval');

	    $stat_count = array();
	    if($stat_ordergoods){
			foreach($stat_ordergoods as $k => $v){
			    $stat_list['ordergoodsnum'][$v['monthval'].'-'.$v['dayval']] = intval($v['ordergoodsnum']);
			    $stat_list['ordergamount'][$v['monthval'].'-'.$v['dayval']] = floatval($v['ordergamount']);
			    $stat_list['ordernum'][$v['monthval'].'-'.$v['dayval']] = intval($v['ordernum']);

			    $stat_count['ordergoodsnum'] = intval($stat_count['ordergoodsnum']) + $v['ordergoodsnum'];
			    $stat_count['ordergamount'] = floatval($stat_count['ordergamount']) + floatval($v['ordergamount']);
			    $stat_count['ordernum'] = intval($stat_count['ordernum']) + $v['ordernum'];
			}
		}

		$stat_count['ordergamount'] = ncPriceFormat($stat_count['ordergamount']);

		$stat_arr['ordergoodsnum']['legend']['enabled'] = false;
		$stat_arr['ordergoodsnum']['series'][0]['name'] = '下单商品数';
		$stat_arr['ordergoodsnum']['series'][0]['data'] = array_values($stat_list['ordergoodsnum']);
		$stat_arr['ordergoodsnum']['title'] = '最近30天下单商品数走势';
        $stat_arr['ordergoodsnum']['yAxis'] = '下单金额';
    	$stat_json['ordergoodsnum'] = getStatData_LineLabels($stat_arr['ordergoodsnum']);

    	$stat_arr['ordergamount']['legend']['enabled'] = false;
		$stat_arr['ordergamount']['series'][0]['name'] = '下单金额';
		$stat_arr['ordergamount']['series'][0]['data'] = array_values($stat_list['ordergamount']);
		$stat_arr['ordergamount']['title'] = '最近30天下单金额走势';
        $stat_arr['ordergamount']['yAxis'] = '下单金额';
    	$stat_json['ordergamount'] = getStatData_LineLabels($stat_arr['ordergamount']);

    	$stat_arr['ordernum']['legend']['enabled'] = false;
		$stat_arr['ordernum']['series'][0]['name'] = '下单量';
		$stat_arr['ordernum']['series'][0]['data'] = array_values($stat_list['ordernum']);
		$stat_arr['ordernum']['title'] = '最近30天下单量走势';
        $stat_arr['ordernum']['yAxis'] = '下单金额';
    	$stat_json['ordernum'] = getStatData_LineLabels($stat_arr['ordernum']);
	    Tpl::output('stat_json',$stat_json);
	    Tpl::output('stat_count',$stat_count);
	    Tpl::output('goods_info',$goods_info);
    	Tpl::showpage($templatesname,'null_layout');
	}
Example #30
0
" /></a></dd>
                  <dd class="ncg-price"><em class="price"><i><?php 
        echo $lang['currency'];
        ?>
</i>
                      <?php 
        if (intval($value['group_flag']) === 1) {
            ?>
                      <?php 
            echo $value['group_price'];
            ?>
                      <?php 
        } elseif (intval($value['xianshi_flag']) === 1) {
            ?>
                      <?php 
            echo ncPriceFormat($value['goods_price'] * $value['xianshi_discount'] / 10);
            ?>
                      <?php 
        } else {
            ?>
                      <?php 
            echo $value['goods_price'];
            ?>
                      <?php 
        }
        ?>
                  </em></dd>
                  <dd class="ncg-sold"><?php 
        echo $lang['show_store_index_be_sold'];
        ?>
<strong><?php