You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
228 lines
8.3 KiB
228 lines
8.3 KiB
<?php
|
|
|
|
include_once(dirname(dirname(__FILE__))."/library/publicBase.php");
|
|
include_once(SERVER_ROOT."/model/mPage.php");
|
|
|
|
class index extends publicBase {
|
|
|
|
public function home() {
|
|
$shopinfo = $this->get_shopinfo();
|
|
$uid = $shopinfo['uid'];
|
|
$shop_id = $shopinfo['id'];
|
|
|
|
$obj = new mOrder();
|
|
$this->view['today_data'] = $obj->getTodayData($uid, $shop_id);
|
|
$this->view['total_data'] = $obj->getToalData($uid, $shop_id);
|
|
$this->view['menu_page'] = 'home';
|
|
}
|
|
|
|
public function ajax_get_charts_data() {
|
|
$shopinfo = $this->get_shopinfo();
|
|
$uid = $shopinfo['uid'];
|
|
$shop_id = $shopinfo['id'];
|
|
|
|
$type = $this->post('type');
|
|
$day = $this->post('day');
|
|
|
|
$obj = new mOrder();
|
|
if ($type == 'sales_volume') {
|
|
$list = $obj->getSumData($uid, $shop_id, $day);
|
|
} elseif ($type == 'refund') {
|
|
$list = $obj->getRefundCountData($uid, $shop_id, $day);
|
|
}
|
|
|
|
$this->ajax_json(true, 'succ', $list);
|
|
}
|
|
|
|
public function order_list() {
|
|
$this->view['menu_page'] = 'order_list';
|
|
}
|
|
|
|
public function ajax_get_order_list() {
|
|
$shopinfo = $this->get_shopinfo();
|
|
|
|
$page = $this->get('page')+0;
|
|
$pagesize = $this->get('limit')+0;
|
|
|
|
$obj = new mOrder();
|
|
$list = $obj->getOrderList($shopinfo['uid'], $shopinfo['id'], 0, 0, $page, $pagesize);
|
|
if (empty($list)) $this->ajax_json(false, 'empty list');
|
|
|
|
$order_status2class = array(
|
|
ORDER_STATUS_WAIT_DELIVER_GOODS => 'list_status_grey01',
|
|
ORDER_STATUS_DELIVERED => 'list_status_grey01',
|
|
ORDER_STATUS_SIGNED_FOR => 'list_status_yellow01',
|
|
);
|
|
|
|
$refund_status2class = array(
|
|
REFUND_STATUS_NO_AFTER_SALES => 'list_status_grey01',
|
|
REFUND_STATUS_ING => 'list_status_red01',
|
|
REFUND_STATUS_AFTER_SALE_ING => 'list_status_yellow01',
|
|
REFUND_STATUS_SUCC => 'list_status_green01',
|
|
);
|
|
|
|
$nlist['data'] = $this->get_nlist($list, $order_status2class, $refund_status2class);
|
|
$nlist['total'] = $obj->getOrdersCount($shopinfo['uid'], $shopinfo['id'])+0;
|
|
|
|
$this->ajax_json(true, 'succ', $nlist);
|
|
}
|
|
|
|
public function after_sale_list() {
|
|
$this->view['menu_page'] = 'after_sale_list';
|
|
}
|
|
|
|
public function ajax_get_after_sale_order_list() {
|
|
$shopinfo = $this->get_shopinfo();
|
|
|
|
$page = $this->get('page')+0;
|
|
$pagesize = $this->get('limit')+0;
|
|
|
|
$obj = new mOrder();
|
|
$list = $obj->getOrderList($shopinfo['uid'], $shopinfo['id'], 0, REFUND_STATUS_AFTER_SALE_ING, $page, $pagesize);
|
|
if (empty($list)) $this->ajax_json(false, 'empty list');
|
|
|
|
$order_status2class = array(
|
|
ORDER_STATUS_WAIT_DELIVER_GOODS => 'list_status_grey01',
|
|
ORDER_STATUS_DELIVERED => 'list_status_red01',
|
|
ORDER_STATUS_SIGNED_FOR => 'list_status_yellow01',
|
|
);
|
|
|
|
$refund_status2class = array(
|
|
REFUND_STATUS_NO_AFTER_SALES => 'list_status_grey01',
|
|
REFUND_STATUS_ING => 'list_status_red01',
|
|
REFUND_STATUS_AFTER_SALE_ING => 'list_status_yellow01',
|
|
REFUND_STATUS_SUCC => 'list_status_green01',
|
|
);
|
|
|
|
$nlist['data'] = $this->get_nlist($list, $order_status2class, $refund_status2class);
|
|
$nlist['total'] = $obj->getOrdersCount($shopinfo['uid'], $shopinfo['id'], 0, REFUND_STATUS_AFTER_SALE_ING)+0;
|
|
|
|
$this->ajax_json(true, 'succ', $nlist);
|
|
}
|
|
|
|
public function export_wait_deliver_goods_tids() {
|
|
$shopinfo = $this->get_shopinfo();
|
|
$uid = $shopinfo['uid'];
|
|
$shop_id = $shopinfo['id'];
|
|
|
|
$obj = new mOrder();
|
|
|
|
$filedir = APP_TMEPPATH_WAIT_DELIVER_GOODS_CSV;
|
|
if(!is_dir($filedir)) {
|
|
mkdir($filedir, 0755, true);
|
|
chown($filedir, 'nobody');
|
|
chgrp($filedir, 'nobody');
|
|
}
|
|
$filepath = $filedir."{$uid}_{$shop_id}_".date("YmdHis").".xlsx";
|
|
|
|
ob_get_clean();
|
|
ob_start();
|
|
echo "订单号\t\n";
|
|
echo "order_sn\t\n";
|
|
|
|
for ($page=1;;$page++) {
|
|
$list = $obj->getOrderList($uid, $shop_id, ORDER_STATUS_WAIT_DELIVER_GOODS, REFUND_STATUS_NO_AFTER_SALES, $page, 1000);
|
|
if (empty($list)) break;
|
|
|
|
foreach ($list as $info) {
|
|
if ($info['risk_control_status'] == ORDER_RISK_YES) continue;
|
|
echo $info['order_sn']."\t\n";
|
|
}
|
|
}
|
|
header('Content-Disposition: attachment; filename='.$shopinfo['name'].'_待发货订单.xlsx');
|
|
header('Accept-Ranges:bytes');
|
|
header('Content-Length:' . ob_get_length());
|
|
header('Content-Type:application/vnd.ms-excel');
|
|
ob_end_flush();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
public function wait_deliver_list() {
|
|
$this->view['menu_page'] = 'wait_deliver_list';
|
|
}
|
|
|
|
public function ajax_get_wait_deliver_list() {
|
|
$shopinfo = $this->get_shopinfo();
|
|
|
|
$page = $this->get('page')+0;
|
|
$pagesize = $this->get('limit')+0;
|
|
|
|
$obj = new mOrder();
|
|
$list = $obj->getWaitDeliverOrderList($shopinfo['uid'], $shopinfo['id'], $page, $pagesize);
|
|
if (empty($list)) $this->ajax_json(false, 'empty list');
|
|
|
|
$order_status2class = array(
|
|
ORDER_STATUS_WAIT_DELIVER_GOODS => 'list_status_grey01',
|
|
ORDER_STATUS_DELIVERED => 'list_status_red01',
|
|
ORDER_STATUS_SIGNED_FOR => 'list_status_yellow01',
|
|
);
|
|
|
|
$refund_status2class = array(
|
|
REFUND_STATUS_NO_AFTER_SALES => 'list_status_grey01',
|
|
REFUND_STATUS_ING => 'list_status_red01',
|
|
REFUND_STATUS_AFTER_SALE_ING => 'list_status_yellow01',
|
|
REFUND_STATUS_SUCC => 'list_status_green01',
|
|
);
|
|
|
|
$nlist['data'] = $this->get_nlist($list, $order_status2class, $refund_status2class);
|
|
$nlist['total'] = $obj->getOrdersCount($shopinfo['uid'], $shopinfo['id'], ORDER_STATUS_WAIT_DELIVER_GOODS, REFUND_STATUS_NO_AFTER_SALES)+0;
|
|
|
|
$this->ajax_json(true, 'succ', $nlist);
|
|
}
|
|
|
|
private function get_nlist($list, $order_status2class, $refund_status2class) {
|
|
$goods_ids = array_unique(array_column($list, 'goods_id'));
|
|
|
|
$gobj = new mGoods();
|
|
$goods_list = $gobj->getGoodsByGoodsids($goods_ids);
|
|
if (empty($goods_list)) return true;
|
|
|
|
$goodsid2skuid2info = array();
|
|
foreach ($goods_list as $goods) {
|
|
$goodsid2skuid2info[$goods['goods_id']][$goods['sku_id']] = $goods;
|
|
}
|
|
|
|
$nlist = array();
|
|
foreach ($list as $info) {
|
|
|
|
$ninfo = array();
|
|
$ninfo['order_sn'] = $info['order_sn'];
|
|
$ninfo['pay_time'] = $info['pay_time'];
|
|
$ninfo['pay_amount'] = $info['pay_amount'];
|
|
$ninfo['order_status_desc'] = $GLOBALS['order_status'][$info['order_status']];
|
|
$ninfo['refund_status_desc'] = $GLOBALS['refund_status'][$info['refund_status']];
|
|
$ninfo['after_sales_status_desc'] = $GLOBALS['after_sales_status'][$info['after_sales_status']];
|
|
|
|
$ninfo['goods_name'] = $goodsid2skuid2info[$info['goods_id']][$info['sku_id']]['goods_name'].' '.$goodsid2skuid2info[$info['goods_id']][$info['sku_id']]['sku_name'];
|
|
$ninfo['goods_id'] = $info['goods_id'];
|
|
$ninfo['sku_id'] = $info['sku_id'];
|
|
|
|
$ninfo['order_status_class'] = $order_status2class[$info['order_status']];
|
|
$ninfo['refund_status_class'] = $refund_status2class[$info['refund_status']];
|
|
|
|
$ninfo['urge_shipping_time'] = $info['urge_shipping_time'];
|
|
$ninfo['is_urge'] = $info['urge_shipping_time'] == '0000-00-00 00:00:00' ? false : true;
|
|
|
|
$ninfo['is_show_count_down'] = $is_show_count_down = strtotime($info['last_ship_time'])-time()>0 ? true : false;
|
|
if ($is_show_count_down) {
|
|
$count_down = $gobj->getHourMinuteSecondCountDown(date("Y-m-d H:i:s"), $info['last_ship_time']);
|
|
$count_down_str = $count_down ? $count_down['hour'].':'.$count_down['minute'].':'.$count_down['second'] : '';
|
|
}
|
|
$ninfo['count_down'] = $is_show_count_down ? $count_down_str : '';
|
|
|
|
$nlist[] = $ninfo;
|
|
}
|
|
|
|
return $nlist;
|
|
}
|
|
|
|
public function logout() {
|
|
unset($_SESSION['app_uid']);
|
|
unset($_SESSION['app_name']);
|
|
header('Location:/index');
|
|
exit();
|
|
}
|
|
|
|
}
|
|
|