Commit 2166b088 by 朱继来

fix

parent e4c815c6
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Redis;
use Request;
use Excel;
use DB;
class OrderModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order';
protected $primaryKey = 'order_id';
public $timestamps = false;
// 订单导出
public function orderExport($request, $info)
{
$map = array();
$userMainModel = new UserMainModel();
$map['testMobile'] = $userMainModel->testMobile();
// 页面参数
if ($request->isMethod('get')) {
$map['order_type'] = $request->input('order_type', '');
$map['order_contain'] = $request->input('order_contain', '');
$map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', '');
$map['order_status'] = $request->input('order_status', '');
$map['shipping_name'] = $request->input('shipping_name', '');
$map['order_send'] = $request->input('order_send', '');
$map['test_order'] = $request->input('test_order', '');
$map['order_pay_type'] = $request->input('order_pay_type', '');
$map['order_type_a'] = $request->input('order_type_a', '');
$map['order_source_pf'] = $request->input('order_source_pf', '');
$map['order_source_adtag'] = $request->input('order_source_adtag', '');
$map['order_source_ptag'] = $request->input('order_source_ptag', '');
$map['erp_order_id'] = $request->input('erp_order_id', '');
$map['order_payment_mode'] = $request->input('order_payment_mode', '');
$map['order_invoice_status'] = $request->input('order_invoice_status', '');
$map['order_goods_type'] = $request->input('order_goods_type', '');
}
/* 临时添加 所有人只能查看线上订单 */
$map['online_order'] = 1;
if ($map['order_goods_type'] == 1) {
$sale_name = '推送业务员';
} else {
$sale_name = '客服';
}
// 非竞调账号,则查看真实数据
if ($info['username'] != 'vpadmin@ichunt.com') {
$map['is_fake'] = 0;
}
$list = $this->from('lie_order_items as it')
->leftJoin('lie_order as o', 'it.order_id', '=', 'o.order_id')
->leftJoin('lie_pay_log as p', 'it.order_id', '=', 'p.order_id')
->leftJoin('lie_order_invoice as i', 'it.order_id', '=', 'i.order_id')
->leftJoin('lie_order_extend as oe', 'oe.order_id', '=', 'i.order_id')
->leftJoin('lie_order_address as a', function($join) {
$join->on('it.order_id', '=', 'a.order_id')->where('a.address_type', '=', 1);
})
->leftJoin('lie_order_shipping as s', function($join) {
$join->on('it.order_id', '=', 's.order_id')->where('s.shipping_type', '=', 1);
})
->leftJoin('lie_user_main as u', 'it.user_id', '=', 'u.user_id')
->leftJoin('lie_user_company as c', 'it.user_id', '=', 'c.user_id')
->where(function ($query) use ($map) {
// 查询类型
if (!empty($map['order_contain'])) {
if ($map['order_type'] == 1) { // 订单编号
$query->where('o.order_sn', '=', $map['order_contain']);
} else if ($map['order_type'] == 2) { // 型号名称
$query->whereIn('it.goods_name', '=', $map['order_contain']);
} else { // 会员账号
if (preg_match('/@/', $map['order_contain'])) {
$query->where('u.email', '=', $map['order_contain']);
} else {
$query->where('u.mobile', '=', $map['order_contain']);
}
}
}
})
->where(function ($query) use ($map) {
// 创建时间
if (!empty($map['time_start']) && !empty($map['time_end'])) {
$query->whereBetween('o.create_time', [$map['time_start'], $map['time_end']]);
} else if (!empty($map['time_start'])) {
$query->where('o.create_time', '>', $map['time_start']);
} else if (!empty($map['time_end'])) {
$query->where('o.create_time', '<', $map['time_end']);
}
})
->where(function ($query) use ($map) {
// 订单状态
if (!empty($map['order_status'])) {
$query->whereIn('o.status', explode(',', $map['order_status']));
}
})
->where(function ($query) use ($map) {
// 配送方式
if (!empty($map['shipping_name'])) {
$query->where('o.order_shipping_type', '=', $map['shipping_name']);
}
})
->where(function ($query) use ($map) {
// 订单推送业务员
if (!empty($map['order_send'])) {
$query->where('o.sale_id', '=', $map['order_send']);
}
})
->where(function ($query) use ($map) {
// 订单类型
if (!empty($map['order_pay_type'])) {
$query->where('o.order_pay_type', '=', $map['order_pay_type']);
}
})
->where(function ($query) use ($map) {
// 测试订单
if (empty($map['test_order'])) {
$query->whereNotIn('o.user_id', $map['testMobile']);
}
})
->where(function ($query) use ($map) {
// 订单来源
if (!empty($map['order_source_pf'])) {
if ($map['order_source_pf'] == 1) {
$query->whereRaw("FIND_IN_SET('pf=1', o.order_source)");
} else {
$query->whereRaw("FIND_IN_SET('pf=2', o.order_source)");
}
}
})
->where(function ($query) use ($map) {
// adtags来源
if (!empty($map['order_source_adtag'])) {
$query->where('o.order_source', 'like', '%adtag='.$map['order_source_adtag'].'%');
}
})
->where(function ($query) use ($map) {
// ptag来源
if (!empty($map['order_source_ptag'])) {
$query->where('o.order_source', 'like', '%ptag='.$map['order_source_ptag'].'%');
}
})
->where(function ($query) use ($map) {
// 线上订单
if (isset($map['online_order'])) {
$query->where('o.order_type', '=', $map['online_order']);
}
})
->where(function ($query) use ($map) {
// 同步状态
if (!empty($map['erp_order_id'])) {
$query->where('o.erp_order_id', '<>', '');
}
})
->where(function ($query) use ($map) {
// 竞调数据
if (isset($map['is_fake'])) {
$query->where('o.is_type', '=', $map['is_fake']);
}
})
->where(function ($query) use ($map) {
// 支付方式
if (!empty($map['order_payment_mode'])) {
switch ($map['order_payment_mode']) {
case '1': $order_payment_mode = '微信';break;
case '2': $order_payment_mode = '支付宝';break;
case '3': $order_payment_mode = '银联';break;
}
$query->where('p.pay_name', '=', $order_payment_mode);
}
})
->where(function ($query) use ($map) {
// 发票类型
if (!empty($map['order_invoice_status'])) {
$query->where('i.inv_type', '=', $map['order_invoice_status']);
}
})
->where('it.status', '<>', -1)
->where('o.order_goods_type', '=', $map['order_goods_type'])
->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'it.supplier_name', 'o.order_id', 'o.order_sn', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'i.tax_title', 'i.inv_type', 'i.invoice_status', 'a.consignee', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'c.com_name', 'oe.send_remark')
->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC')
->get()
->toArray();
if (!empty($list)) {
// 订单数据处理
$cellData = $this->exportList($list);
// 标题
$headerCell = ['订单ID', '订单编号', '会员账号', '会员标签', '收货人', '下单日期', '下单时间', '客户名称', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '商品总额', '运费', '附加费', '优惠券', '订单总额', '币种', '订单类型', '订单状态', '发货状态', '发票类型', '发票状态', $sale_name, 'adtags来源', '新用户来源', '取消原因', '推送备注'];
array_unshift($cellData, $headerCell);
$fileName = '订单导出'.date('_YmdHis');
Excel::create($fileName, function($excel) use ($cellData){
$excel->sheet('订单导出', function($sheet) use ($cellData){
$sheet->rows($cellData);
});
})->export('xls');
} else {
return redirect('/prompt')->with(['message'=>"数据为空无法导出!",'url' =>$_SERVER['HTTP_REFERER'], 'jumpTime'=>3,'status'=>false]);
}
}
/**
* 导出数据处理
* @param [type] $order [查询出的订单数据]
* @return [type] [description]
*/
public function exportList($order)
{
// 订单类型
$order_type = array(
'1' => '全款',
'2' => '预付款',
'3' => '账期支付',
);
// 订单状态
$order_status = array(
'-1' => '已取消',
'1' => '待审核',
'2' => '待付款',
'3' => '待付尾款',
'4' => '待发货',
'7' => '部分发货',
'8' => '待收货',
'10' => '交易成功',
);
// 订单发货状态
$shipping_status = array(
'-1' => '未配送',
'1' => '配送中',
'2' => '已签',
);
// 发票类型
$inv_type = array(
'1' => '不开发票',
'2' => '普通发票',
'3' => '增值税专用发票',
'4' => '增值税普通发票',
);
// 发票状态
$invoice_status = array(
'-1' => '待确认',
'1' => '已开票',
'2' => '已发货',
'3' => '已签收',
);
// 用户标签
$user_tags = array(
'0' => '用户',
'1' => '新用户',
'2' => '老用户',
);
$tmp = array();
for ($i = 0; $i < count($order); $i++) {
// 推送人
if ($order[$i]['sale_id']) {
$sales = DB::table('user_info')->where(['userId' => $order[$i]['sale_id']])->select('name')->first();
}
$tmp[$i]['order_id'] = $order[$i]['order_id'];
$tmp[$i]['order_sn'] = "\t".$order[$i]['order_sn']."\t";
$tmp[$i]['user_account'] = $order[$i]['mobile'] ? $order[$i]['mobile'] : $order[$i]['email'];
$tmp[$i]['is_new'] = isset($order[$i]['is_new']) ? $user_tags[$order[$i]['is_new']] : '';
$tmp[$i]['consignee'] = isset($order[$i]['consignee']) ? $order[$i]['consignee'] : '';
$tmp[$i]['create_time_date'] = date('Y-m-d', $order[$i]['create_time']);
$tmp[$i]['create_time_sec'] = date('H:i:s', $order[$i]['create_time']);
$tmp[$i]['com_name'] = !empty($order[$i]['tax_title']) ? $order[$i]['tax_title'] : $order[$i]['com_name'];
// 自营商品名称换成商品型号
$tmp[$i]['goods_name'] = $order[$i]['order_goods_type'] == 1 ? $order[$i]['goods_name'] : $this->getGoodsName($order[$i]['goods_id']);
$tmp[$i]['brand_name'] = $order[$i]['brand_name'];
$tmp[$i]['supplier_name'] = $order[$i]['supplier_name'];
$tmp[$i]['goods_number'] = $order[$i]['goods_number'];
$tmp[$i]['goods_price'] = $order[$i]['goods_price'];
$tmp[$i]['single_pre_price'] = $order[$i]['single_pre_price'];
$tmp[$i]['goods_amount'] = $order[$i]['goods_number'] * $order[$i]['goods_price'];
if ($i > 0 && $order[$i]['order_id'] == $order[$i-1]['order_id']) {
// $tmp[$i]['order_sn'] = '';
// $tmp[$i]['user_account'] = '';
// $tmp[$i]['consignee'] = '';
// $tmp[$i]['create_time_date'] = '';
// $tmp[$i]['create_time_sec'] = '';
// $tmp[$i]['com_name'] = '';
$tmp[$i]['goods_sum'] = '';
$tmp[$i]['shipping_fee'] = '';
$tmp[$i]['extra_fee'] = '';
$tmp[$i]['coupon'] = '';
$tmp[$i]['order_amount'] = '';
$tmp[$i]['currency'] = '';
$tmp[$i]['order_type'] = '';
$tmp[$i]['order_status'] = '';
$tmp[$i]['shipping_status'] = ''; // 发货状态
$tmp[$i]['inv_type'] = ''; // 发票类型
$tmp[$i]['invoice_status'] = ''; // 发票状态
$tmp[$i]['sale_name'] = ''; // 推送业务员
$tmp[$i]['adtags'] = '';
$tmp[$i]['client_source'] = '';
$tmp[$i]['cancel_reason'] = '';
$tmp[$i]['send_remark'] = '';
} else {
$tmp[$i]['goods_sum'] = $this->getOrderPrice($order[$i]['order_id'], 1);
$tmp[$i]['shipping_fee'] = $this->getOrderPrice($order[$i]['order_id'], 3);
$tmp[$i]['extra_fee'] = $this->getOrderPrice($order[$i]['order_id'], 2);
$tmp[$i]['coupon'] = $this->getOrderPrice($order[$i]['order_id'], -4);
$tmp[$i]['order_amount'] = $order[$i]['order_amount'];
$tmp[$i]['currency'] = $order[$i]['currency'] == 1 ? 'RMB' : 'USD';
$tmp[$i]['order_type'] = !empty($order[$i]['order_pay_type']) ? $order_type[$order[$i]['order_pay_type']] : '未知';
$tmp[$i]['order_status'] = !empty($order[$i]['status']) ? $order_status[$order[$i]['status']] : '未知';
$tmp[$i]['shipping_status'] = !empty($order[$i]['shipping_status']) ? $shipping_status[$order[$i]['shipping_status']] : '无发货信息'; // 发货状态
$tmp[$i]['inv_type'] = $order[$i]['inv_type'] ? $inv_type[$order[$i]['inv_type']] : '未知'; // 发票类型
$tmp[$i]['invoice_status'] = !empty($order[$i]['invoice_status']) ? $invoice_status[$order[$i]['invoice_status']] : '无发票信息'; // 发票状态
$tmp[$i]['sale_name'] = isset($sales) ? $sales->name : ''; // 推送业务员
$tmp[$i]['adtags'] = $order[$i]['order_source'];
$tmp[$i]['client_source'] = $order[$i]['client_source'];
$tmp[$i]['cancel_reason'] = $order[$i]['cancel_reason'];
$tmp[$i]['send_remark'] = $order[$i]['send_remark'];
}
unset($sales);
}
return $tmp;
}
// 获取自营商品型号
public function getGoodsName($goods_id)
{
$goods_info = json_decode(Redis::hget('Self_SelfGoods', $goods_id), true);
return $goods_info['goods_name'];
}
// 订单金额展示
public function getOrderPrice($order_id, $type)
{
$price = DB::connection('order')->table('lie_order_price')->where('order_id', '=', $order_id)->where('price_type', '=', $type)->select('price')->first();
return $price ? $price->price : 0;
}
}
\ No newline at end of file
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class UserMainModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_user_main';
protected $primaryKey = 'user_id';
public $timestamps = false;
// 测试帐号
public function testMobile()
{
$testId = array();
$user = $this->where(['is_test' => 1])->select('user_id')->get()->toArray();
foreach ($user as $k => $v) {
$testId[$k] = $v['user_id'];
}
return $testId;
}
}
\ No newline at end of file
<?php
return array(
'cache' => array(
/*
|--------------------------------------------------------------------------
| Enable/Disable cell caching
|--------------------------------------------------------------------------
*/
'enable' => true,
/*
|--------------------------------------------------------------------------
| Caching driver
|--------------------------------------------------------------------------
|
| Set the caching driver
|
| Available methods:
| memory|gzip|serialized|igbinary|discISAM|apc|memcache|temp|wincache|sqlite|sqlite3
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Cache settings
|--------------------------------------------------------------------------
*/
'settings' => array(
'memoryCacheSize' => '32MB',
'cacheTime' => 600
),
/*
|--------------------------------------------------------------------------
| Memcache settings
|--------------------------------------------------------------------------
*/
'memcache' => array(
'host' => 'localhost',
'port' => 11211,
),
/*
|--------------------------------------------------------------------------
| Cache dir (for discISAM)
|--------------------------------------------------------------------------
*/
'dir' => storage_path('cache')
),
'properties' => array(
'creator' => 'Maatwebsite',
'lastModifiedBy' => 'Maatwebsite',
'title' => 'Spreadsheet',
'description' => 'Default spreadsheet export',
'subject' => 'Spreadsheet export',
'keywords' => 'maatwebsite, excel, export',
'category' => 'Excel',
'manager' => 'Maatwebsite',
'company' => 'Maatwebsite',
),
/*
|--------------------------------------------------------------------------
| Sheets settings
|--------------------------------------------------------------------------
*/
'sheets' => array(
/*
|--------------------------------------------------------------------------
| Default page setup
|--------------------------------------------------------------------------
*/
'pageSetup' => array(
'orientation' => 'portrait',
'paperSize' => '9',
'scale' => '100',
'fitToPage' => false,
'fitToHeight' => true,
'fitToWidth' => true,
'columnsToRepeatAtLeft' => array('', ''),
'rowsToRepeatAtTop' => array(0, 0),
'horizontalCentered' => false,
'verticalCentered' => false,
'printArea' => null,
'firstPageNumber' => null,
),
),
/*
|--------------------------------------------------------------------------
| Creator
|--------------------------------------------------------------------------
|
| The default creator of a new Excel file
|
*/
'creator' => 'Maatwebsite',
'csv' => array(
/*
|--------------------------------------------------------------------------
| Delimiter
|--------------------------------------------------------------------------
|
| The default delimiter which will be used to read out a CSV file
|
*/
'delimiter' => ',',
/*
|--------------------------------------------------------------------------
| Enclosure
|--------------------------------------------------------------------------
*/
'enclosure' => '"',
/*
|--------------------------------------------------------------------------
| Line endings
|--------------------------------------------------------------------------
*/
'line_ending' => "\r\n"
),
'export' => array(
/*
|--------------------------------------------------------------------------
| Autosize columns
|--------------------------------------------------------------------------
|
| Disable/enable column autosize or set the autosizing for
| an array of columns ( array('A', 'B') )
|
*/
'autosize' => true,
/*
|--------------------------------------------------------------------------
| Autosize method
|--------------------------------------------------------------------------
|
| --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX
| The default is based on an estimate, which does its calculation based
| on the number of characters in the cell value (applying any calculation
| and format mask, and allowing for wordwrap and rotation) and with an
| "arbitrary" adjustment based on the font (Arial, Calibri or Verdana,
| defaulting to Calibri if any other font is used) and a proportional
| adjustment for the font size.
|
| --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT
| The second method is more accurate, based on actual style formatting as
| well (bold, italic, etc), and is calculated by generating a gd2 imagettf
| bounding box and using its dimensions to determine the size; but this
| method is significantly slower, and its accuracy is still dependent on
| having the appropriate fonts installed.
|
*/
'autosize-method' => PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX,
/*
|--------------------------------------------------------------------------
| Auto generate table heading
|--------------------------------------------------------------------------
|
| If set to true, the array indices (or model attribute names)
| will automatically be used as first row (table heading)
|
*/
'generate_heading_by_indices' => true,
/*
|--------------------------------------------------------------------------
| Auto set alignment on merged cells
|--------------------------------------------------------------------------
*/
'merged_cell_alignment' => 'left',
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'calculate' => false,
/*
|--------------------------------------------------------------------------
| Include Charts during export
|--------------------------------------------------------------------------
*/
'includeCharts' => false,
/*
|--------------------------------------------------------------------------
| Default sheet settings
|--------------------------------------------------------------------------
*/
'sheets' => array(
/*
|--------------------------------------------------------------------------
| Default page margin
|--------------------------------------------------------------------------
|
| 1) When set to false, default margins will be used
| 2) It's possible to enter a single margin which will
| be used for all margins.
| 3) Alternatively you can pass an array with 4 margins
| Default order: array(top, right, bottom, left)
|
*/
'page_margin' => false,
/*
|--------------------------------------------------------------------------
| Value in source array that stands for blank cell
|--------------------------------------------------------------------------
*/
'nullValue' => null,
/*
|--------------------------------------------------------------------------
| Insert array starting from this cell address as the top left coordinate
|--------------------------------------------------------------------------
*/
'startCell' => 'A1',
/*
|--------------------------------------------------------------------------
| Apply strict comparison when testing for null values in the array
|--------------------------------------------------------------------------
*/
'strictNullComparison' => false
),
/*
|--------------------------------------------------------------------------
| Store settings
|--------------------------------------------------------------------------
*/
'store' => array(
/*
|--------------------------------------------------------------------------
| Path
|--------------------------------------------------------------------------
|
| The path we want to save excel file to
|
*/
'path' => storage_path('exports'),
/*
|--------------------------------------------------------------------------
| Return info
|--------------------------------------------------------------------------
|
| Whether we want to return information about the stored file or not
|
*/
'returnInfo' => false
),
/*
|--------------------------------------------------------------------------
| PDF Settings
|--------------------------------------------------------------------------
*/
'pdf' => array(
/*
|--------------------------------------------------------------------------
| PDF Drivers
|--------------------------------------------------------------------------
| Supported: DomPDF, tcPDF, mPDF
*/
'driver' => 'DomPDF',
/*
|--------------------------------------------------------------------------
| PDF Driver settings
|--------------------------------------------------------------------------
*/
'drivers' => array(
/*
|--------------------------------------------------------------------------
| DomPDF settings
|--------------------------------------------------------------------------
*/
'DomPDF' => array(
'path' => base_path('vendor/dompdf/dompdf/')
),
/*
|--------------------------------------------------------------------------
| tcPDF settings
|--------------------------------------------------------------------------
*/
'tcPDF' => array(
'path' => base_path('vendor/tecnick.com/tcpdf/')
),
/*
|--------------------------------------------------------------------------
| mPDF settings
|--------------------------------------------------------------------------
*/
'mPDF' => array(
'path' => base_path('vendor/mpdf/mpdf/')
),
)
)
),
'filters' => array(
/*
|--------------------------------------------------------------------------
| Register read filters
|--------------------------------------------------------------------------
*/
'registered' => array(
'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter'
),
/*
|--------------------------------------------------------------------------
| Enable certain filters for every file read
|--------------------------------------------------------------------------
*/
'enabled' => array()
),
'import' => array(
/*
|--------------------------------------------------------------------------
| Has heading
|--------------------------------------------------------------------------
|
| The sheet has a heading (first) row which we can use as attribute names
|
| Options: true|false|slugged|slugged_with_count|ascii|numeric|hashed|trans|original
|
*/
'heading' => 'slugged',
/*
|--------------------------------------------------------------------------
| First Row with data or heading of data
|--------------------------------------------------------------------------
|
| If the heading row is not the first row, or the data doesn't start
| on the first row, here you can change the start row.
|
*/
'startRow' => 1,
/*
|--------------------------------------------------------------------------
| Cell name word separator
|--------------------------------------------------------------------------
|
| The default separator which is used for the cell names
| Note: only applies to 'heading' settings 'true' && 'slugged'
|
*/
'separator' => '_',
/*
|--------------------------------------------------------------------------
| Include Charts during import
|--------------------------------------------------------------------------
*/
'includeCharts' => false,
/*
|--------------------------------------------------------------------------
| Sheet heading conversion
|--------------------------------------------------------------------------
|
| Convert headings to ASCII
| Note: only applies to 'heading' settings 'true' && 'slugged'
|
*/
'to_ascii' => true,
/*
|--------------------------------------------------------------------------
| Import encoding
|--------------------------------------------------------------------------
*/
'encoding' => array(
'input' => 'UTF-8',
'output' => 'UTF-8'
),
/*
|--------------------------------------------------------------------------
| Calculate
|--------------------------------------------------------------------------
|
| By default cells with formulas will be calculated.
|
*/
'calculate' => true,
/*
|--------------------------------------------------------------------------
| Ignore empty cells
|--------------------------------------------------------------------------
|
| By default empty cells are not ignored
|
*/
'ignoreEmpty' => false,
/*
|--------------------------------------------------------------------------
| Force sheet collection
|--------------------------------------------------------------------------
|
| For a sheet collection even when there is only 1 sheets.
| When set to false and only 1 sheet found, the parsed file will return
| a row collection instead of a sheet collection.
| When set to true, it will return a sheet collection instead.
|
*/
'force_sheets_collection' => false,
/*
|--------------------------------------------------------------------------
| Date format
|--------------------------------------------------------------------------
|
| The format dates will be parsed to
|
*/
'dates' => array(
/*
|--------------------------------------------------------------------------
| Enable/disable date formatting
|--------------------------------------------------------------------------
*/
'enabled' => true,
/*
|--------------------------------------------------------------------------
| Default date format
|--------------------------------------------------------------------------
|
| If set to false, a carbon object will return
|
*/
'format' => false,
/*
|--------------------------------------------------------------------------
| Date columns
|--------------------------------------------------------------------------
*/
'columns' => array()
),
/*
|--------------------------------------------------------------------------
| Import sheets by config
|--------------------------------------------------------------------------
*/
'sheets' => array(
/*
|--------------------------------------------------------------------------
| Example sheet
|--------------------------------------------------------------------------
|
| Example sheet "test" will grab the firstname at cell A2
|
*/
'test' => array(
'firstname' => 'A2'
)
)
),
'views' => array(
/*
|--------------------------------------------------------------------------
| Styles
|--------------------------------------------------------------------------
|
| The default styles which will be used when parsing a view
|
*/
'styles' => array(
/*
|--------------------------------------------------------------------------
| Table headings
|--------------------------------------------------------------------------
*/
'th' => array(
'font' => array(
'bold' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Strong tags
|--------------------------------------------------------------------------
*/
'strong' => array(
'font' => array(
'bold' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Bold tags
|--------------------------------------------------------------------------
*/
'b' => array(
'font' => array(
'bold' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Italic tags
|--------------------------------------------------------------------------
*/
'i' => array(
'font' => array(
'italic' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Heading 1
|--------------------------------------------------------------------------
*/
'h1' => array(
'font' => array(
'bold' => true,
'size' => 24,
)
),
/*
|--------------------------------------------------------------------------
| Heading 2
|--------------------------------------------------------------------------
*/
'h2' => array(
'font' => array(
'bold' => true,
'size' => 18,
)
),
/*
|--------------------------------------------------------------------------
| Heading 2
|--------------------------------------------------------------------------
*/
'h3' => array(
'font' => array(
'bold' => true,
'size' => 13.5,
)
),
/*
|--------------------------------------------------------------------------
| Heading 4
|--------------------------------------------------------------------------
*/
'h4' => array(
'font' => array(
'bold' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Heading 5
|--------------------------------------------------------------------------
*/
'h5' => array(
'font' => array(
'bold' => true,
'size' => 10,
)
),
/*
|--------------------------------------------------------------------------
| Heading 6
|--------------------------------------------------------------------------
*/
'h6' => array(
'font' => array(
'bold' => true,
'size' => 7.5,
)
),
/*
|--------------------------------------------------------------------------
| Hyperlinks
|--------------------------------------------------------------------------
*/
'a' => array(
'font' => array(
'underline' => true,
'color' => array('argb' => 'FF0000FF'),
)
),
/*
|--------------------------------------------------------------------------
| Horizontal rules
|--------------------------------------------------------------------------
*/
'hr' => array(
'borders' => array(
'bottom' => array(
'style' => 'thin',
'color' => array('FF000000')
),
)
)
)
)
);
......@@ -72,7 +72,7 @@
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
// order_type_a = $('#order_type_a').data('default'),
order_pay_type = $('#order_pay_type').data('default'),
order_pay_type = $('#order_pay_type').val(),
order_status = $('#order_status').val(),
shipping_name = $('#shipping_name').data('default'),
order_send = $('#order_send').val(),
......@@ -81,7 +81,7 @@
order_source_ptag = $('input[name="order_source_ptag"]').val(),
test_order = $('input[name=test_order]'),
erp_order_id = $('#erp_order_id').data('default'),
is_new = $('#is_new').data('default'),
is_new = $('#is_new').val(),
listUrl = '/list';
listUrl += '?order_type=' + order_type;
......@@ -138,7 +138,7 @@
listUrl += '&erp_order_id=' + erp_order_id;
}
if (is_new !== '') {
if (is_new) {
listUrl += '&is_new=' + is_new;
}
......@@ -160,7 +160,7 @@
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
// order_type_a = $('#order_type_a').data('default'),
order_pay_type = $('#order_pay_type').data('default'),
order_pay_type = $('#order_pay_type').val() ? $('#order_pay_type').val() : '',
order_status = $('#order_status').val(),
shipping_name = $('#shipping_name').data('default'),
order_send = $('#order_send').val(),
......@@ -168,7 +168,8 @@
order_source_adtag = $('input[name="order_source_adtag"]').val(),
order_source_ptag = $('input[name="order_source_ptag"]').val(),
erp_order_id = $('#erp_order_id').data('default'),
test_order = $('input[name=test_order]');
test_order = $('input[name=test_order]'),
is_new = $('#is_new').val() ? $('#is_new').val() : '';
if (test_order.length) {
if (!order_contain && !time_start && !time_end && !order_pay_type && !order_status && !shipping_name && !order_send && !order_source_pf && !order_source_adtag && ! order_source_ptag && !erp_order_id && !test_order.is(':checked')) {
......@@ -200,7 +201,7 @@
test_order = '';
}
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_pay_type='+order_pay_type+'&order_status='+order_status+'&shipping_name='+shipping_name+'&order_send='+order_send+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&erp_order_id='+erp_order_id+'&test_order='+test_order+'&order_goods_type='+1;
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_pay_type='+order_pay_type+'&order_status='+order_status+'&shipping_name='+shipping_name+'&order_send='+order_send+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&erp_order_id='+erp_order_id+'&test_order='+test_order+'&is_new='+is_new+'&order_goods_type='+1;
})
// 选择查看测试订单
......
......@@ -12,7 +12,7 @@
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
order_status = $('#order_status').data('default'),
order_send = $('#order_send').data('default'),
// order_send = $('#order_send').data('default'),
order_source_pf = $('#order_source_pf').data('default'),
order_payment_mode = $('#order_payment_mode').data('default'),
order_invoice_status = $('#order_invoice_status').data('default'),
......@@ -44,9 +44,9 @@
listUrl += '&order_status=' + order_status;
}
if (order_send) {
listUrl += '&order_send=' + order_send;
}
// if (order_send) {
// listUrl += '&order_send=' + order_send;
// }
if (order_source_pf) {
listUrl += '&order_source_pf=' + order_source_pf;
......@@ -90,7 +90,7 @@
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
order_status = $('#order_status').data('default'),
order_send = $('#order_send').data('default'),
// order_send = $('#order_send').data('default'),
order_source_pf = $('#order_source_pf').data('default'),
order_payment_mode = $('#order_payment_mode').data('default'),
order_invoice_status = $('#order_invoice_status').data('default'),
......@@ -99,12 +99,12 @@
test_order = $('input[name=test_order]');
if (test_order.length) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && !test_order.is(':checked')) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag && !test_order.is(':checked')) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
} else {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
......@@ -124,7 +124,7 @@
test_order = '';
}
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_payment_mode='+order_payment_mode+'&order_status='+order_status+'&order_invoice_status='+order_invoice_status+'&order_send='+order_send+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&test_order='+test_order+'&order_goods_type='+2;
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_payment_mode='+order_payment_mode+'&order_status='+order_status+'&order_invoice_status='+order_invoice_status+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&test_order='+test_order+'&order_goods_type='+2;
})
// 选择查看测试订单
......@@ -184,6 +184,72 @@
}
})
})
// 填写订单取消原因
$('.input-cancel-reason').click(function(){
var self = $(this);
var order_id = self.data('oid');
var content = '<div class="form-group">'+
'<div class="input-radio">'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="平台信任度问题">平台信任度问题</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="商品质量不放心">商品质量不放心</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="价格问题">价格问题</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="货期问题">货期问题</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="配套服务问题">配套服务问题</label>'+
'<label class="radio-inline"><input type="radio" name="cancel_reason" value="1">其他</label>'+
'</div>'+
'<div class="input-other-reason">'+
'<textarea class="form-control" name="input-other-reason" placeholder="请填写其他原因"></textarea>'+
'</div>'+
'</div>';
layer.open({
area: ['650px', '220px'],
title: '填写订单取消原因',
content: content,
btn:['确认', '取消'],
btn1:function(){
var cancel_reason = $('input[name=cancel_reason]:checked').val();
var other_reason = $('textarea[name=input-other-reason]').val();
if (cancel_reason == null) {
layer.tips('请选择取消原因', $('.input-radio'));
return false;
} else if (cancel_reason == 1) {
if (other_reason == '') {
layer.tips('请填写其他原因', $('.input-other-reason'));
return false;
} else {
cancel_reason = other_reason;
}
}
$.ajax({
url:'/ajaxInputCancelReason',
data: {order_id : order_id, cancel_reason:cancel_reason},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
self.remove();
layer.msg(resp.errmsg);
layer.close();
} else {
layer.alert(resp.errmsg);
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(index){
layer.close(index);
}
})
})
}
}
});
......
......@@ -41,28 +41,25 @@
<dt>订单状态:</dt>
<dd>
<select id="order_status" name="order_status" class="form-control order_status selectpicker" title="全部" multiple>
<option class="order_status" value="-1">已取消</option>
<option class="order_status" value="1">待审核</option>
<option class="order_status" value="2">待付款</option>
<option class="order_status" value="3">待付尾款</option>
<option class="order_status" value="4">待发货</option>
<option class="order_status" value="7">部分发货</option>
<option class="order_status" value="8">待收货</option>
<option class="order_status" value="10">交易成功</option>
<option value="-1">已取消</option>
<option value="1">待审核</option>
<option value="2">待付款</option>
<option value="3">待付尾款</option>
<option value="4">待发货</option>
<option value="7">部分发货</option>
<option value="8">待收货</option>
<option value="10">交易成功</option>
</select>
</dd>
</dl>
<dl>
<dt>付款类型:</dt>
<dd style="width: 115px;">
<div class="droplist" data-default="{{$condition['order_pay_type']}}" id="order_pay_type" name="order_pay_type" >
<ul class="dropdown-menu">
<li data-val="" class="active">全部</li>
<li data-val="1">全款</li>
<li data-val="2">预付款</li>
<li data-val="3">账期</li>
</ul>
</div>
<select id="order_pay_type" name="order_pay_type" class="form-control order_pay_type selectpicker" title="全部" multiple>
<option value="1">全款</option>
<option value="2">预付款</option>
<option value="3">账期</option>
</select>
</dd>
</dl>
<dl>
......@@ -82,6 +79,7 @@
<dd style="width: 115px;">
<select id="order_send" name="order_send" class="form-control order_send selectpicker" title="全部" data-live-search="true" data-size="7">
<option value="">全部</option>
<option value="0">无推送</option>
<optgroup label="在职">
@foreach ($sale_list as $v)
@if ($v->status != 4)
......@@ -151,14 +149,19 @@
<dl>
<dt>用户标签:</dt>
<dd>
<div class="droplist" data-default="{{$condition['is_new']}}" name="is_new" id="is_new">
<select id="is_new" name="is_new" class="form-control is_new selectpicker" title="全部" multiple>
<option value="0">用户</option>
<option value="1">新客户</option>
<option value="2">老客户</option>
</select>
<!-- <div class="droplist" data-default="{{$condition['is_new']}}" name="is_new" id="is_new">
<ul class="dropdown-menu">
<li data-val="" class="active">全部</li>
<li data-val="0">用户</li>
<li data-val="1">新客户</li>
<li data-val="2">老客户</li>
</ul>
</div>
</div> -->
</dd>
</dl>
......@@ -501,6 +504,8 @@
var test_order = "{{$condition['test_order']}}";
var order_status = "{{$condition['order_status']}}";
var order_send = "{{$condition['order_send']}}";
var order_pay_type = "{{$condition['order_pay_type']}}";
var is_new = "{{$condition['is_new']}}";
if (test_order) {
$('input[name=test_order]').attr('checked', true);
......@@ -516,6 +521,8 @@
$('.order_status').selectpicker('val', order_status.split(',')).trigger("change");
$('#order_send').selectpicker('val', order_send);
$('.order_pay_type').selectpicker('val', order_pay_type.split(',')).trigger("change");
$('.is_new').selectpicker('val', is_new.split(',')).trigger("change");
$.lie.order.index();
......
......@@ -40,6 +40,7 @@
<ul class="dropdown-menu">
<li data-val="" class="active">全部</li>
<li data-val="-1">已取消</li>
<li data-val="1">待审核</li>
<li data-val="2">待付款</li>
<li data-val="4">待发货</li>
<li data-val="8">待收货</li>
......@@ -134,7 +135,7 @@
<dl>
<dt></dt>
<dd>
<input type="checkbox" name="test_order"> 所有订单-包括测试
<label><input type="checkbox" name="test_order"> 所有订单-包括测试</label>
</dd>
</dl>
@endif
......@@ -246,6 +247,10 @@
@if (in_array('self_order_download_contract', $userPerms))
<a class="btn btn-default download-contract" data-id="{{$v['order_id']}}" href="javascript:;">下载合同</a>
@endif
@if ($v['status'] == -1 && !$v['cancel_reason'])
<a class="btn btn-danger input-cancel-reason" href="javascript:;" data-oid="{{$v['order_id']}}">填写取消原因</a>
@endif
</div>
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment