diff --git a/control/index.php b/control/index.php index 22dfac8..f5b4504 100644 --- a/control/index.php +++ b/control/index.php @@ -45,48 +45,20 @@ class index extends publicBase { $list = $obj->getOrderList($shopinfo['uid'], $shopinfo['id'], 0, 0, $page, $pagesize); if (empty($list)) $this->ajax_json(false, 'empty list'); - $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; - } - - $GLOBALS['order_status2class'] = array( + $order_status2class = array( ORDER_STATUS_WAIT_DELIVER_GOODS => 'list_status_grey01', ORDER_STATUS_DELIVERED => 'list_status_grey01', ORDER_STATUS_SIGNED_FOR => 'list_status_yellow01', ); - $GLOBALS['refund_status2class'] = array( + $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 = 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['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'] = $GLOBALS['order_status2class'][$info['order_status']]; - $ninfo['refund_status_class'] = $GLOBALS['refund_status2class'][$info['refund_status']]; - - $nlist['data'][] = $ninfo; - } - + $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); @@ -104,49 +76,20 @@ class index extends publicBase { $list = $obj->getOrderList($shopinfo['uid'], $shopinfo['id'], 0, REFUND_STATUS_AFTER_SALE_ING, $page, $pagesize); if (empty($list)) $this->ajax_json(false, 'empty list'); - $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; - } - - $GLOBALS['order_status2class'] = array( + $order_status2class = array( ORDER_STATUS_WAIT_DELIVER_GOODS => 'list_status_grey01', ORDER_STATUS_DELIVERED => 'list_status_red01', ORDER_STATUS_SIGNED_FOR => 'list_status_yellow01', ); - $GLOBALS['refund_status2class'] = array( + $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 = 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'] = $GLOBALS['order_status2class'][$info['order_status']]; - $ninfo['refund_status_class'] = $GLOBALS['refund_status2class'][$info['refund_status']]; - - $nlist['data'][] = $ninfo; - } - + $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); @@ -190,4 +133,78 @@ class index extends publicBase { } + public function 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->getOrderList($shopinfo['uid'], $shopinfo['id'], ORDER_STATUS_WAIT_DELIVER_GOODS, REFUND_STATUS_NO_AFTER_SALES, $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($info['last_ship_time'], date("Y-m-d H:i:s")); + $count_down_str = $count_down['hour'].':'.$count_down['minute'].':'.$count_down['second']; + } + $ninfo['count_down'] = $is_show_count_down ? $count_down_str : 0; + + $nlist[] = $ninfo; + } + + return $nlist; + } + } diff --git a/model/mBase.php b/model/mBase.php index fac5eb4..5a0c312 100644 --- a/model/mBase.php +++ b/model/mBase.php @@ -1423,6 +1423,11 @@ class mBase extends publicBase { return shell_exec($cmd); } + /** + * 获取周的开始日期和结束日期 + * @param unknown $default_date + * @return string[] + */ public function getWeekStartEndDate($default_date) { //$first =1 表示每周星期一为开始日期 0表示每周日为开始日期 $first=1; @@ -1439,4 +1444,22 @@ class mBase extends publicBase { ); } + /** + * 获取时分秒倒计时 + * @param unknown $start_time + * @param unknown $end_time + * @return array|number[]|mixed[] + */ + public function getHourMinuteSecondCountDown($start_time, $end_time) { + $count_down = strtotime($end_time) - strtotime($start_time); + if ($count_down <= 0) return array(); + + $data = array(); + $data['hour'] = $h = floor($count_down/3600); + $data['minute'] = $m = floor(($count_down - $h*3600)/60); + $data['second'] = $count_down - $h*3600 - $m*60; + + return $data; + } + } diff --git a/view/templates/index/after_sale_list.html b/view/templates/index/after_sale_list.html index 703ae30..7442c7f 100644 --- a/view/templates/index/after_sale_list.html +++ b/view/templates/index/after_sale_list.html @@ -30,7 +30,7 @@
售后监控/
售后列表
-
导出列表
+
diff --git a/view/templates/index/order_list.html b/view/templates/index/order_list.html index 7c25cb2..2bda965 100644 --- a/view/templates/index/order_list.html +++ b/view/templates/index/order_list.html @@ -30,7 +30,7 @@
订单列表/
订单列表
-
导出列表
+
diff --git a/view/templates/index/wait_deliver_list.html b/view/templates/index/wait_deliver_list.html index c725e00..104d603 100644 --- a/view/templates/index/wait_deliver_list.html +++ b/view/templates/index/wait_deliver_list.html @@ -6,7 +6,7 @@ - 首页 + 发货提醒 @@ -30,7 +30,7 @@
发货提醒/
发货列表
-
导出列表
+
导出列表
@@ -70,26 +70,29 @@ layui.use(['element', 'layer', 'util', 'table'], function(){ var showTips = null; table.render({ elem: '#deliver_remind_list' - ,url:'/tpl/ajax_get_deliver_remind_list' + ,url:'/index/ajax_get_wait_deliver_list' ,toolbar: false ,title: '用户数据表' ,totalRow: false ,className:'deliver_remind_list_table_class' ,cols: [[ - {field:'goods_name', title:'商品名称'} - ,{field:'tid', title:'订单号' + {field:'goods_name', title:'商品名称', + templet: function(d){ + return ''+d.goods_name+''; + }} + ,{field:'order_sn', title:'订单号' ,templet: function(d){ - return ''+ d.tid +' '; + return ''+ d.order_sn +' '; }} - ,{field:'count_down', title:'销售时间/倒计时' + ,{field:'pay_time', title:'销售时间/倒计时' ,templet: function(d){ - if(d.count_down.indexOf('倒计时') > -1) return ''; - return ''+d.count_down+''; + if(d.is_show_count_down == true) return ''; + return ''+d.pay_time+''; }} - ,{field:'income', title:'收入'} + ,{field:'pay_amount', title:'支付金额(元)'} ,{field:'status', title:'顾客催发' ,templet: function(d){ - if(d.status == 1) return ' 已催'; + if(d.is_urge) return ' 已催'; return ' 未催'; }} ]] @@ -117,7 +120,7 @@ layui.use(['element', 'layer', 'util', 'table'], function(){ e.clearSelection(); }); - if(data[i].count_down.indexOf('倒计时') > -1){ + if(data[i].is_show_count_down == true){ $('#count_down_wait_'+data[i].tid).hover(function(){ var hid = $(this).attr('id'); var hcontent = $(this).attr('content'); @@ -133,7 +136,7 @@ layui.use(['element', 'layer', 'util', 'table'], function(){ } - if(data[i].status == 1){ + if(data[i].is_urge == true){ $('#remind_time_'+data[i].tid).hover(function(){ var hcontent = $(this).attr('content'); var hid = $(this).attr('id');