set(2, 1)->getList($this->id, '4,5,6');
$html = '';
$out_status = Dever::db('shop/buy_order')->config['out_status'];
$excel = Dever::input('excel', 1);
if ($data && $data['order']) {
if ($excel == 2) {
Dever::load('store/admin/factory_excel')->out($this->id, $this->user, $data['order']);
die;
return;
}
foreach ($data['order'] as $k => $v) {
if ($v['ps_info']) {
$ps_date = $v['ps_info']['cdate'];
$ydate = $v['ps_info']['ydate'] ? $v['ps_info']['ydate'] : '-';
} else {
$ps_date = $ydate = '-';
}
$view = Dever::url('order_view?type=3&order_id=' . $v['id'] . '&cash=2', 'store');
$send = Dever::url('order_send?id=' . $v['id'], 'store');
$button = '';
$print = Dever::url('admin/order.print?id=' . $v['id'] . '&type=2', 'store');
$button .= ' ';
if ($v['status'] == 4) {
$url = Dever::url('admin/factory_order.action_commit&order_id='.$v['id'], 'store');
$button .= ' ';
}
if ($v['refund_status'] == 2 && $v['status'] != 8) {
$v['status_name'] .= '[缺货报损中]';
}
$url = Dever::url('lib/buy.excel_one?type='.$v['type'].'&type_id='.$v['type_id'].'&id='.$v['id'], 'mshop');
if ($v['status'] == 5 || $v['status'] == 6 || $v['status'] == 8) {
//$button .= ' ';
}
$v['out_status_name'] = $out_status[$v['out_status']];
$dao_date = '-';
if ($v['out_date']) {
$dao_date = date('Y-m-d H:i', $v['out_date']);
}
$html .= '
'.$v['order_num'].' | '.$ps_date.' | '.$v['source_info']['name'].' | '.$ydate.' | '.$v['num'].' | '.$v['status_name'].' | '.$v['out_status_name'].' | '.$dao_date.' | '.$button.' |
';
}
}
return $html;
}
# 获取列表页搜索信息
public function getSearch()
{
$config = array
(
array('value' => '0', 'name' => '全部'),
array('value' => 4, 'name' => '待收货确认'),
array('value' => '5,6', 'name' => '已完成'),
array('value' => 'refund', 'name' => '缺货与报损'),
);
$status = Dever::input('status');
$html = '';
foreach ($config as $k => $v) {
$selected = '';
if ((!$status && $k == 0) || $status == $v['value']) {
$selected = 'selected=""';
}
$html .= '';
}
return $html;
}
# 获取列表页搜索信息
public function getSearchOutStatus()
{
$config = array
(
array('value' => '0', 'name' => '全部'),
array('value' => 1, 'name' => '未导出'),
array('value' => 2, 'name' => '已导出'),
);
$status = Dever::input('source_out_status');
$html = '';
foreach ($config as $k => $v) {
$selected = '';
if ((!$status && $k == 0) || $status == $v['value']) {
$selected = 'selected=""';
}
$html .= '';
}
return $html;
}
# 获取列表页搜索信息
public function getService()
{
$service = Dever::db('shop/service')->select();
$html = '';
foreach ($service as $k => $v) {
$selected = '';
if ($k == 0) {
$selected = 'selected=""';
}
$html .= '';
}
return $html;
}
# 获取基本信息
public function getConfig()
{
$data['search'] = Dever::url('factory_order', 'store');
# 确认收货
$data['action'] = Dever::url('admin/factory_order.action_commit', 'store');
return $data;
}
# 确认收货
public function action_commit_api()
{
$order_id = Dever::input('order_id');
Dever::load('mshop/lib/buy')->set(2,1)->finish($this->id, $order_id);
return 'reload';
}
}