Commit 6ec8f2ca by 朱继来

Merge branch 'zjl_self_refund_20190605'

parents 6913840d 310e1932
...@@ -15,6 +15,7 @@ use Excel; ...@@ -15,6 +15,7 @@ use Excel;
use App\Model\OrderModel; use App\Model\OrderModel;
use App\Model\UserMainModel; use App\Model\UserMainModel;
use App\Model\OrderActionLogModel; use App\Model\OrderActionLogModel;
use App\Model\OrderReturnModel;
// 获取订单优惠券金额 // 获取订单优惠券金额
function getCoupon($order_id) function getCoupon($order_id)
...@@ -997,7 +998,7 @@ Class OrderController extends Controller ...@@ -997,7 +998,7 @@ Class OrderController extends Controller
return view('detail', $info); return view('detail', $info);
} }
// 退货退款 // 联营退货退款
public function refund(Request $request, $id) public function refund(Request $request, $id)
{ {
if ($request->isMethod('post')) if ($request->isMethod('post'))
...@@ -1039,6 +1040,95 @@ Class OrderController extends Controller ...@@ -1039,6 +1040,95 @@ Class OrderController extends Controller
return view('detail', $info); return view('detail', $info);
} }
// 自营退货申请
public function orderReturn(Request $request, $id)
{
if ($request->isMethod('post')) {
$data['order_id'] = $id;
$data['return_info'] = $request->input('return_info');
$data['return_items_info'] = $request->input('return_items_info');
$data['operator_id'] = $request->user->userId;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'return/returnGoods';
$temp = json_decode(curlApi($url, $data, 'POST'), true);
return array('errcode'=>$temp['err_code'], 'errmsg'=>$temp['err_msg']);
}
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '退货申请', ["title" => '退货申请', "href" => '#']);
// 未发货明细
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$data['order_id'] = $id;
$url = Config('website.api_domain').'removal/getRemovalItems';
$res = json_decode(curlApi($url, $data, 'POST'), true);
if ($res['err_code'] != 0) return redirect('/prompt')->with(['message'=>'退货无法操作,原因:'.$res['err_msg'], 'url' =>$_SERVER['HTTP_REFERER'], 'jumpTime'=>3,'status'=>false]);
$info['removalItems'] = $res['data'];
return view('detail', $info);
}
// 退货申请编辑
public function orderReturnEdit(Request $request, $id)
{
if ($request->isMethod('post')) {
$data['return_id'] = $request->input('return_id');
$data['return_info'] = $request->input('return_info');
$data['return_items_info'] = $request->input('return_items_info');
$data['operator_id'] = $request->user->userId;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'return/editReturnGoods';
$temp = json_decode(curlApi($url, $data, 'POST'), true);
return array('errcode'=>$temp['err_code'], 'errmsg'=>$temp['err_msg']);
}
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '编辑退货申请', ["title" => '编辑退货申请', "href" => '#']);
$return_id = $request->input('return_id', '');
$redirect_url = $info['order_info']['order_goods_type'] == 1 ? '/return_list' : '/self_return_list';
if (!$return_id) return redirect($redirect_url);
$OrderReturnModel = new OrderReturnModel();
$info['return'] = $OrderReturnModel->find($return_id);
$info['returnItems'] = $OrderReturnModel->find($return_id)->hasManyReturnItems;
if (!in_array($info['return']['status'], [-2, 1])) return redirect('/prompt')->with(['message'=>'status为'.$info['return']['status'].',无法编辑退货单', 'url' =>$redirect_url, 'jumpTime'=>3,'status'=>false]);
// 补充退货明细
foreach ($info['returnItems'] as $k=>&$v) {
$map = array();
$map['order_id'] = $v['order_id'];
$map['rec_id'] = $v['rec_id'];
$map['goods_id'] = $v['goods_id'];
// 获取出库数量
$removal = DB::connection('order')->table('lie_removal_items')->where($map)->select('removal_number')->first();
$v['removal_number'] = $removal ? $removal->removal_number : 0;
// 获取已申请退货数量
$v['already_return_num'] = DB::connection('order')->table('lie_order_return_items')->where($map)->sum('return_num');
}
return view('detail', $info);
}
//订单物流信息 //订单物流信息
public function changeShipping(Request $request, $id='') public function changeShipping(Request $request, $id='')
{ {
...@@ -1249,7 +1339,9 @@ Class OrderController extends Controller ...@@ -1249,7 +1339,9 @@ Class OrderController extends Controller
$mobile = isset($temp['data']['order_info']['user_info']['msg_mobile']) ? $temp['data']['order_info']['user_info']['msg_mobile'] : ''; $mobile = isset($temp['data']['order_info']['user_info']['msg_mobile']) ? $temp['data']['order_info']['user_info']['msg_mobile'] : '';
if (!$mobile) { if (!$mobile) {
$mobile = isset($temp['data']['order_info']['user_info']['mobile']) ? $temp['data']['order_info']['user_info']['mobile'] : ''; // $mobile = isset($temp['data']['order_info']['user_info']['mobile']) ? $temp['data']['order_info']['user_info']['mobile'] : '';
$user = DB::connection('order')->table('lie_user_main')->where('user_id', $temp['data']['order_info']['user_id'])->select('mobile')->first();
$mobile = $user ? $user->mobile : '';
} }
// 获取操作记录 // 获取操作记录
......
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Model\OrderModel;
use App\Model\OrderReturnModel;
use App\Model\OrderReturnItemsModel;
use DB;
use App\Http\Page;
use App\Model\UserMainModel;
// 获取支付名称
function getPayName($order_id)
{
$payLog = DB::connection('order')
->table('lie_pay_log')
->where(['order_id' => $order_id])
->select('pay_name')
->get();
if (!empty($payLog)) {
foreach ($payLog as $v) {
$payName[] = $v->pay_name;
}
return implode(',', $payName);
}
return false;
}
// 获取物流名称
function getShippingName($shipping_id)
{
$shipping = DB::connection('order')->table('lie_shipping')->where('shipping_id', $shipping_id)->select('shipping_name')->first();
return $shipping ? $shipping->shipping_name : '';
}
class ReturnController extends Controller
{
// 页面用户、菜单信息
public function getPageInfo(Request $request)
{
$uri = '/' . $request->path();
if ($request->path() == '/') $uri = '/list';
$username = $request->user->email;
$useremail= $request->user->email;
// 菜单
$menuconfig = DB::table('config')->where('config_title', '订单系统')->first();
$menus = [];
if ($menuconfig && !($menus = json_decode($menuconfig->config_data)))
$menus = [];
$perm = new PermController;
// 用户角色
$role = $perm->getUserRole($request);
// 获取权限菜单
if ($role != 1) {
$menus = $perm->getPermMenu($menus, $request->user->userId);
}
$userPerms = $perm->getUserAllPerms($request->user->userId, $role); // 用户权限
$data = [
'header' => $request->user->header,
'uri' => $uri,
'username' => $username,
'useremail' => $useremail,
'menus' => $menus,
'userPerms' => $userPerms,
'role' => $role,
];
return $data;
}
// 联营退货列表
public function jointReturnList(Request $request)
{
$info = $this->ReturnList($request, 1);
return view('returnlist', $info);
}
// 自营退货列表
public function selfReturnList(Request $request)
{
$info = $this->returnList($request, 2);
return view('returnlist', $info);
}
// 退货申请列表
public function returnList(Request $request, $type)
{
$info = $this->getPageInfo($request);
$info['title'] = $type == 1 ? '联营退货申请列表' : '自营退货申请列表';
$map['order_sn'] = $request->input('order_sn', '');
$map['sku_name'] = $request->input('sku_name', '');
$map['order_payment_mode'] = $request->input('order_payment_mode', '');
$map['apply_status'] = $request->input('apply_status', '');
$map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', '');
$map['order_goods_type'] = $type; // 类型
//获取订单列表
$url = Config('website.api_domain').'return/getReturnList';
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$data['p'] = $request->input('p', 1); // 当前页码
$data['size'] = 10; // 当前页条数
$data['map'] = $map;
$response = json_decode(curlApi($url, $data), true);
// 分页
$page = new Page($response['data']['count'], 10);
$page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
$show = $page->show();
// 获取配送方式
$shippings = DB::connection('order')->table('lie_shipping')->get();
$ship_type = [];
foreach ($shippings as $k => $v) {
$ship_type[$v->shipping_id] = $v->shipping_name;
}
$info['shippings'] = $ship_type;
$info['condition'] = $map;
$info['list'] = $response['data']['data'];
$info['count'] = $response['data']['count'];
$info['page'] = $show;
return $info;
}
// 联营退货单导出
public function returnExport(Request $request)
{
$ReturnModel = new OrderReturnModel();
return $ReturnModel->export($request);
}
// 自营退货单导出
public function selfReturnExport(Request $request)
{
$ReturnModel = new OrderReturnModel();
return $ReturnModel->export($request);
}
// 退货详情
public function returnDetails(Request $request, $id)
{
$info = $this->getPageInfo($request);
$OrderReturnModel = new OrderReturnModel();
$info['return'] = $OrderReturnModel->find($id);
$info['returnItems'] = $OrderReturnModel->find($id)->hasManyReturnItems;
$info['returnLog'] = $OrderReturnModel->find($id)->hasManyReturnLog;
if ($info['return']['order_goods_type'] == 1) {
$title = '联营订单';
$return_url = '/return_list';
} else {
$title = '自营订单';
$return_url = '/self_return_list';
}
$info['title'] = '订单退货详情';
$info['paths'] = [["title" => $title, "href" => '#'], ["title" => '退货申请列表', "href" => $return_url], ["title" => '订单退货详情', "href" => '#']];
return view('returnDetails', $info);
}
// 退货单审核
public function returnCheck(Request $request)
{
if ($request->isMethod('post')) {
$OrderReturnModel = new OrderReturnModel();
return $OrderReturnModel->check($request);
}
}
// 退货物流信息
public function returnShipping(Request $request)
{
if ($request->isMethod('post')) {
$OrderReturnModel = new OrderReturnModel();
return $OrderReturnModel->shipping($request);
}
}
}
...@@ -122,6 +122,16 @@ Route::group(['middleware' => 'web'], function () { ...@@ -122,6 +122,16 @@ Route::group(['middleware' => 'web'], function () {
Route::post('/ajax/offlinePaid', 'OrderController@offlinePaid'); Route::post('/ajax/offlinePaid', 'OrderController@offlinePaid');
Route::post('/ajax/editContract', 'OrderController@editContract'); Route::post('/ajax/editContract', 'OrderController@editContract');
Route::match(['get', 'post'], '/return/{id}', 'OrderController@orderReturn');
Route::get('/self_return_list', 'ReturnController@selfReturnList');
Route::get('/return_details/{id}', 'ReturnController@returnDetails');
Route::post('/ajax/returnCheck', 'ReturnController@returnCheck');
Route::post('/ajax/returnShipping', 'ReturnController@returnShipping');
Route::get('/self_return_export', 'ReturnController@selfReturnExport');
Route::match(['get', 'post'], '/return_edit/{id}', 'OrderController@orderReturnEdit');
}); });
// 不需要登陆态 // 不需要登陆态
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class CmsModel extends Model
{
protected $table = 'user_info';
protected $primaryKey = 'userId';
public $timestamps = false;
// 获取用户名称
public function getUserName($userId)
{
$user = $this->where(['userId' => $userId])->select('name')->first();
return $user ? $user->name : '';
}
}
\ No newline at end of file
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class OrderReturnItemsModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_return_items';
protected $primaryKey = 'return_items_id';
public $timestamps = false;
}
\ No newline at end of file
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class OrderReturnLogModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_return_log';
protected $primaryKey = 'return_log_id';
public $timestamps = false;
/**
* 创建退货记录
* @param [type] $return_id [退货单ID]
* @param [type] $operator_id [操作人ID]
* @param [type] $event [操作事件]
*/
public function addLog($return_id, $operator_id, $event)
{
$operator = DB::table('user_info')->where('userId', $operator_id)->select('name')->first(); // 操作人名称
$return_log['return_id'] = $return_id;
$return_log['operator_id'] = $operator_id;
$return_log['operator_name'] = $operator->name;
$return_log['event'] = $event;
$return_log['ip'] = get_client_ip(0, true);
$return_log['create_time'] = time();
return $this->insert($return_log);
}
}
\ No newline at end of file
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Redis;
use Request;
use Excel;
use DB;
class OrderReturnModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_return';
protected $primaryKey = 'return_id';
public $timestamps = false;
// 获取退货单明细
public function hasManyReturnItems()
{
return $this->hasMany('App\Model\OrderReturnItemsModel', 'return_id', 'return_id');
}
// 获取退货单记录
public function hasManyReturnLog()
{
return $this->hasMany('App\Model\OrderReturnLogModel', 'return_id', 'return_id')->orderBy('create_time', 'desc');
}
// 退货导出
public function export($request)
{
set_time_limit(0);
ini_set('memory_limit', '512M');
$map = array();
// 页面参数
$map['order_sn'] = $request->input('order_sn', '');
$map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', '');
$map['apply_status'] = $request->input('apply_status', '');
$map['order_payment_mode'] = $request->input('order_payment_mode', '');
$map['order_goods_type'] = $request->input('order_goods_type', 1);
$list = $this->from('lie_order_return as r')
->leftJoin('lie_pay_log as p', 'r.order_id', '=', 'p.order_id')
->where(function ($query) use ($map) {
// 订单编号
if (!empty($map['order_sn'])) {
$query->where('r.order_sn', '=', $map['order_sn']);
}
})
->where(function ($query) use ($map) {
// 创建时间
if (!empty($map['time_start']) && !empty($map['time_end'])) {
$query->whereBetween('r.create_time', [$map['time_start'], $map['time_end']]);
} else if (!empty($map['time_start'])) {
$query->where('r.create_time', '>', $map['time_start']);
} else if (!empty($map['time_end'])) {
$query->where('r.create_time', '<', $map['time_end']);
}
})
->where(function ($query) use ($map) {
// 订单状态
if (!empty($map['apply_status'])) {
$query->whereIn('r.status', explode(',', $map['apply_status']));
}
})
->where(function ($query) use ($map) {
// 支付方式
if (!empty($map['order_payment_mode'])) {
$pay_name = explode(',', $map['order_payment_mode']);
$order_payment_mode = [];
foreach ($pay_name as $v) {
switch ($v) {
case '1': $order_payment_mode[] = '微信支付';break;
case '2': $order_payment_mode[] = '支付宝';break;
case '3': $order_payment_mode[] = '银联支付(B2B)';break;
case '4': $order_payment_mode[] = '银联支付(B2C)';break;
case '5': $order_payment_mode[] = '账期支付';break;
case '6': $order_payment_mode[] = '京东支付';break;
case '7': $order_payment_mode[] = '交通银行';break;
case '8': $order_payment_mode[] = '恒生银行';break;
case '9': $order_payment_mode[] = '钱包支付';break;
}
}
$query->whereIn('p.pay_name', $order_payment_mode);
}
})
->where('r.order_goods_type', $map['order_goods_type'])
->select('r.return_id', 'r.return_sn', 'r.order_id', 'r.order_sn', 'r.removal_sn', 'r.user_id', 'r.mobile', 'r.email', 'r.company_name', 'r.order_goods_type', 'r.currency', 'r.return_way', 'r.pay_amount', 'r.return_amount', 'r.return_reason', 'r.bank_account', 'r.bank_name', 'r.bank_sub_name', 'r.bank_user', 'r.shipping_id', 'r.shipping_sn', 'r.status', 'r.cancel_reason', 'r.refuse_reason', 'r.create_uid', 'r.audit_uid', 'r.create_time', 'r.audit_time', 'r.putaway_time')
->orderBy('r.create_time', 'DESC')
->get()
->toArray();
if (!empty($list)) {
// 订单数据处理
$cellData = $this->exportList($list);
// 标题
$headerCell = ['退货单ID', '退货单号', '订单ID', '订单编号', '出库单号', '会员账号', '公司名称', '币种', '支付金额', '退货总额', '退货原因', '退货方式', '快递名称', '快递单号', '银行账号', '银行名称', '银行支行名称', '银行开户人', '取消原因', '驳回原因', '创建人', '创建时间', '审核人', '退货处理状态', '审核时间', '退货入库时间'];
array_unshift($cellData, $headerCell);
$fileName = $map['order_goods_type'] == 1 ? '联营退货单导出' : '自营退货单导出'.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($return)
{
$tmp = array();
$CmsModel = new CmsModel();
for ($i = 0; $i < count($return); $i++) {
$tmp[$i]['return_id'] = $return[$i]['return_id'];
$tmp[$i]['return_sn'] = "\t".$return[$i]['return_sn']."\t";
$tmp[$i]['order_id'] = $return[$i]['order_id'];
$tmp[$i]['order_sn'] = "\t".$return[$i]['order_sn']."\t";
$tmp[$i]['removal_sn'] = "\t".$return[$i]['removal_sn']."\t";
$tmp[$i]['user_account'] = $return[$i]['mobile'] ? $return[$i]['mobile'] : $return[$i]['email'];
$tmp[$i]['company_name'] = $return[$i]['company_name'];
$tmp[$i]['currency'] = $return[$i]['currency'] == 1 ? '人民币' : '美元';
$tmp[$i]['pay_amount'] = $return[$i]['pay_amount'];
$tmp[$i]['return_amount'] = $return[$i]['return_amount'];
$tmp[$i]['return_reason'] = $return[$i]['return_reason'];
$tmp[$i]['return_way'] = $return[$i]['return_way'] == 1 ? '快递' : '自送';
$tmp[$i]['shipping_id'] = $this->getShippingName($return[$i]['shipping_id']);
$tmp[$i]['shipping_sn'] = $return[$i]['shipping_sn'];
$tmp[$i]['bank_account'] = $return[$i]['bank_account'];
$tmp[$i]['bank_name'] = $return[$i]['bank_name'];
$tmp[$i]['bank_sub_name'] = $return[$i]['bank_sub_name'];
$tmp[$i]['bank_user'] = $return[$i]['bank_user'];
$tmp[$i]['cancel_reason'] = $return[$i]['cancel_reason'];
$tmp[$i]['refuse_reason'] = $return[$i]['refuse_reason'];
$tmp[$i]['create_uid'] = $CmsModel->getUserName($return[$i]['create_uid']);
$tmp[$i]['create_time'] = date('Y-m-d H:i:s', $return[$i]['create_time']);
$tmp[$i]['audit_uid'] = $CmsModel->getUserName($return[$i]['audit_uid']);
$tmp[$i]['status'] = Config('params.return_status')[$return[$i]['status']];
$tmp[$i]['audit_time'] = $return[$i]['audit_time'] ? date('Y-m-d H:i:s', $return[$i]['audit_time']) : '';
$tmp[$i]['putaway_time'] = $return[$i]['putaway_time'] ? date('Y-m-d H:i:s', $return[$i]['putaway_time']) : '';
}
return $tmp;
}
// 获取物流名称
public function getShippingName($shipping_id)
{
$shipping = DB::connection('order')->table('lie_shipping')->where('shipping_id', $shipping_id)->select('shipping_name')->first();
return $shipping ? $shipping->shipping_name : '';
}
// 审核
public function check($request)
{
$return_id = $request->input('return_id');
$type = $request->input('type');
$operator_id = $request->user->userId;
if ($type == 2) {
$event = '审核通过退货单';
} else {
$update['refuse_reason'] = $request->input('refuse_reason');
$event = '驳回退货单,原因:'.$update['refuse_reason'];
}
$update['status'] = $type;
$update['audit_uid'] = $operator_id;
$update['audit_time'] = time();
try {
DB::connection('order')->beginTransaction(); // 开启事务
$OrderReturnLogModel = new OrderReturnLogModel();
$this->where('return_id', $return_id)->update($update);
$OrderReturnLogModel->addLog($return_id, $operator_id, $event);
DB::connection('order')->commit(); // 提交事务
return ['err_code'=>0, 'err_msg'=>'操作成功'];
} catch(Exception $e) {
DB::connection('order')->rollback(); // 回滚
return ['err_code'=>1, 'err_msg'=>'操作失败,原因:'.$e->getMessage()];
}
}
// 物流信息
public function shipping($request)
{
$return_id = $request->input('return_id');
$operator_id = $request->user->userId;
$data['shipping_id'] = $request->input('shipping_id');
$data['shipping_sn'] = $request->input('shipping_sn');
$data['status'] = 7; // 待收货
$data['syn_sign'] = 1; // 标记wms同步
try {
DB::connection('order')->beginTransaction(); // 开启事务
$OrderReturnLogModel = new OrderReturnLogModel();
$this->where('return_id', $return_id)->update($data);
$OrderReturnLogModel->addLog($return_id, $operator_id, '填写物流信息,快递名称:'.$this->getShippingName($data['shipping_id']).',快递单号:'.$data['shipping_sn']);
DB::connection('order')->commit(); // 提交事务
return ['err_code'=>0, 'err_msg'=>'操作成功'];
} catch(Exception $e) {
DB::connection('order')->rollback(); // 回滚
return ['err_code'=>1, 'err_msg'=>'操作失败,原因:'.$e->getMessage()];
}
}
}
\ No newline at end of file
...@@ -76,4 +76,14 @@ ...@@ -76,4 +76,14 @@
'test_mobile' => [ 'test_mobile' => [
'15989573440', '15989573440',
], ],
// 退货状态
'return_status' => [
-2 => '驳回',
-1 => '取消',
1 => '待审核',
2 => '审核通过',
7 => '待收货',
10 => '已完成',
],
]; ];
\ No newline at end of file
(function($) {
var printAreaCount = 0;
$.fn.printArea = function() {
var ele = $(this);
var idPrefix = "printArea_";
removePrintArea(idPrefix + printAreaCount);
printAreaCount++;
var iframeId = idPrefix + printAreaCount;
var iframeStyle = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
iframe = document.createElement('IFRAME');
$(iframe).attr({
style: iframeStyle,
id: iframeId
});
document.body.appendChild(iframe);
var doc = iframe.contentWindow.document;
$(document).find("link").filter(function() {
return $(this).attr("rel").toLowerCase() == "stylesheet";
}).each(
function() {
// 这里是在将网页中的所有css引入,即打印区域的css如果是link进来的,可以设置在网页的任何位置
doc.write('<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" >');
});
doc.write($(ele).prop('outerHTML')); // 将待打印元素原封不动的引入
doc.close();
var frameWindow = iframe.contentWindow;
frameWindow.close();
frameWindow.focus();
// 必须等待frame加载完成后再打印,否则可能在某些浏览器中打印不出东西。
frameWindow.onload = function() {
frameWindow.print();
};
}
var removePrintArea = function(id) {
$("iframe#" + id).remove();
};
})(jQuery);
\ No newline at end of file
...@@ -132,31 +132,6 @@ ...@@ -132,31 +132,6 @@
} }
}) })
// // 钱包退款
// $('.wallet-refund').click(function(){
// var order_id = $(this).data('oid');
// var amount = $(this).data('amount');
// $.ajax({
// url : 'ajax/wallet_refund',
// type: 'post',
// data: {order_id: order_id, amount: amount},
// dataType: 'json',
// success: function (resp) {
// if (resp.errcode == 0) {
// window.href =
// return false;
// }
// layer.msg(resp.errmsg);
// },
// error: function (err) {
// console.log(err)
// }
// })
// })
// 自营退款列表取消申请 // 自营退款列表取消申请
$('.cancel-refund').click(function() { $('.cancel-refund').click(function() {
var rid = $(this).data('rid'); var rid = $(this).data('rid');
...@@ -190,7 +165,429 @@ ...@@ -190,7 +165,429 @@
}) })
}) })
},
index_new:function(){
$.lie.droplist($('.droplist'));
// 特殊字符编码
function specialCode(chr)
{
switch (chr) {
case '!': return '%21'; break;
case '"': return '%22'; break;
case '#': return '%23'; break;
case '$': return '%24'; break;
case '%': return '%25'; break;
case '&': return '%26'; break;
case '\'': return '%27'; break;
case '(': return '%28'; break;
case ')': return '%29'; break;
case '*': return '%2A'; break;
case '+': return '%2B'; break;
case ',': return '%2C'; break;
case '/': return '%2F'; break;
case ':': return '%3A'; break;
case ';': return '%3B'; break;
case '<': return '%3C'; break;
case '=': return '%3D'; break;
case '>': return '%3E'; break;
case '?': return '%3F'; break;
case '@': return '%40'; break;
case '[': return '%5B'; break;
case ']': return '%5D'; break;
case '\\': return '%5C'; break;
case '|': return '%7C'; break;
default: return ''; break;
}
}
// 查找特殊字符
function specialStr(str)
{
var reg = new RegExp("[!\"#$%&'()*+,/:;<=>?@\\[\\]\\|]");
var len = str.length;
var rs = '';
for (var i = 0; i < len; i++) {
var val = str.substr(i, 1);
if (reg.test(val)) {
rs = rs + specialCode(val);;
} else {
rs = rs + val;
}
}
return rs;
}
// 搜索、导出条件
function refundCommon(url) {
var order_sn = $('input[name="order_sn"]').val(),
sku_name = $('input[name="sku_name"]').val(),
apply_status = $('#apply_status').val() ? $('#apply_status').val() : '',
order_payment_mode = $('#order_payment_mode').val() ? $('#order_payment_mode').val() : '',
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
order_goods_type = $('input[name="order_goods_type"]').val();
if (url == '/return_export' || url == '/self_return_export') {
if (!order_sn && !sku_name && !apply_status && !order_payment_mode && !time_start && !time_end) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
}
if (!order_sn && !sku_name && !apply_status && !order_payment_mode && !time_start && !time_end) {
location.href = url;
}
var listUrl = url;
listUrl += '?order_sn=' + order_sn;
if (sku_name) {
listUrl += '&sku_name=' + specialStr(sku_name);
}
if (order_payment_mode) {
listUrl += '&order_payment_mode=' + order_payment_mode;
}
if (apply_status) {
listUrl += '&apply_status=' + apply_status;
}
if(time_start){
time_start = Date.parse(time_start) / 1000;
listUrl += '&time_start='+time_start;
}
if(time_end){
time_end = Date.parse(time_end) / 1000 + (24*60*60-1);
listUrl += '&time_end='+time_end;
}
listUrl += '&order_goods_type='+order_goods_type;
location.href = listUrl;
}
// 搜索
$('.search_return_order').click(function(){
var order_goods_type = $('input[name="order_goods_type"]').val();
if (order_goods_type == 1) {
refundCommon('/return_list');
} else {
refundCommon('/self_return_list');
}
})
// 导出订单
$('.export_return_order').click(function() {
var order_goods_type = $('input[name="order_goods_type"]').val();
if (order_goods_type == 1) {
refundCommon('/return_export');
} else {
refundCommon('/self_return_export');
}
})
// 填写物流信息
$('.return-shipping').click(function() {
var return_id = $(this).data('id');
var shipping_section = '';
shipping_section += '<div class="form-group">'+
'<select name="shipping_id" class="shipping_id" style="width: 100%;margin-bottom: 20px;">'+
'<option value="">请选择快递公司</option>';
for(var i in shippings_info) {
shipping_section += '<option value="'+i+'">'+shippings_info[i]+'</option>';
}
shipping_section += '<input type="text" class="express_no" name="express_no" value="" style="width:100%;" placeholder="请填写快递单号" />'+
'</select>'+
'</div>';
layer.open({
area: ['400px']
,title: '填写物流信息'
,content: shipping_section
,btn:['确定', '取消']
,yes: function(index, layero){
var shipping_id = $('.shipping_id').val();
var express_no = $('.express_no').val();
if(!shipping_id){
layer.tips('请选择快递公司',$('.shipping_id'));
return false;
}
if(!express_no){
layer.tips('快递单号不能为空',$('.express_no'));
return false;
}
$.ajax({
url: '/ajax/returnShipping',
type: 'post',
data: {return_id:return_id, shipping_id:shipping_id, shipping_sn:express_no},
dataType:'json',
success: function(resp) {
if(resp.err_code === 0){
layer.msg(resp.err_msg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.err_msg || '网络异常');
}
},
error: function(err) {
console.log(err)
}
})
}
,btn2: function(index, layero){
layer.close(index);
}
});
})
},
refund:function() {
// 正整数输入框限制
$('.int_num').off().on('keyup', function(){
var val = $(this).val();
if(!val) return false;
if (!(/^[1-9]\d*$/g.test(val))) {
layer.msg('只能是正整数');
$(this).val('');
}
if($(this).val().length > 9){
$(this).val($(this).val().slice(0, 9));
}
});
// 填写退货数量
$('.return_num').keyup(function() {
var removal_number = parseInt($(this).parents('tr').find('.removal_number').val()); // 出库数量
var single_pre_price = parseFloat($(this).parents('tr').find('.single_pre_price').val()); // 均摊单价
var val = $(this).val(); // 退货数量
if (val > removal_number) {
layer.msg('不能超过出库数量');
$(this).val('');
}
// 退款小计
var single_amount = parseFloat(single_pre_price * val).toFixed(4);
$(this).parents('tr').find('.single_return_amount').text(currency_sign + single_amount);
// 退款总额
var return_total = 0;
$('.return-table').find('tbody tr').each(function(){
var num = parseInt($(this).find('.return_num').val()) || 0;
var price = parseFloat($(this).find('.single_pre_price').val()) || 0;
return_total += parseFloat(num * price);
});
return_total = return_total.toFixed(2);
$('.return_amount').val(return_total);
$('.return_amount_val').text(currency_sign + return_total);
})
// 提交表单
$('.returnApply').click(function() {
var return_way = $('.return_way:checked').val();
var goods_count = 0; // 商品数量
// var return_eq_true = []; // 退货数量与出库数量相等
var return_empty = []; // 退货数量为空
// 判断是否选择退货方式
if (return_way == null) {
layer.msg('请选择退货方式');
return false;
}
// 表单退货数量
$('.return-table').find('tbody tr').each(function(){
var num = parseInt($(this).find('.return_num').val());
var removal_number = parseInt($(this).find('.removal_number').val());
// 为空标记
if (!num) return_empty.push(0);
// 数量等于出库数量标记
// if (num == removal_number) return_eq_true.push(1);
goods_count++;
});
if (return_empty.length == goods_count) {
layer.msg('请填写退货数量');
return false;
}
// if (return_eq_true.length == goods_count) {
// layer.msg('不能选择全部退货数量,请检查数量');
// return false;
// }
var order_id = $('input[name=order_id]').val();
var refund_reason = $('.refund_reason').val();
if (!refund_reason) {
layer.msg('请选择退货原因');
return false;
}
var pay_id = $('input[name=pay_id]').val();
// 若为线下转账,则银行信息必填
if (pay_id == 0) {
var bank_account = $('.bank_account').val();
var bank_name = $('.bank_name').val();
var bank_sub_name = $('.bank_sub_name').val();
var bank_user = $('.bank_user').val();
if(!bank_account || !bank_name || !bank_sub_name || !bank_user) {
layer.msg('订单为线下转账,银行信息必填');
return false;
}
}
// 判断创建或编辑
var return_id = $('.return_id').val();
if (return_id) {
var content = '确认修改退货申请?';
var url = '/return_edit/' + order_id + '?return_id=' + return_id;
} else {
var content = '确认提交退货申请?';
var url = '/return/' + order_id;
}
layer.open({
title: '提示信息',
content: content,
btn: ['确认', '取消'],
yes: function(index, layero){
$.ajax({
url : url,
type: 'post',
data: $('#returnForm').serialize(),
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
// 跳转地址
var order_goods_type = $('.order_goods_type').val();
if (order_goods_type == 1) {
var redirect_url = '/return_list';
} else {
var redirect_url = '/self_return_list';
}
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.href = redirect_url; // 退货列表
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
},
btn2: function(index, layero){
layer.close(index);
}
});
})
},
details:function() {
// 打印退货单
$('.return-print').click(function() {
console.log(11)
$('#return-info').printArea();
})
// 审核通过 / 驳回
$('.return-check').click(function() {
var return_id = $(this).data('id');
var type = $(this).data('type');
var title = '';
var content = '';
var data = {return_id: return_id, type: type};
if (type == 2) { // 审核通过
title = '审核退货单';
content = '确定审核通过吗?';
} else { // 驳回
title = '驳回退货单';
content = '<div><textarea name="refuse_reason" class="form-control" id="refuse_reason" cols="30" rows="5" placeholder="填写驳回原因"></textarea></div>';
}
layer.open({
title: title,
content: content,
btn: ['确定', '取消'],
yes: function() {
if (type == -2) {
var refuse_reason = $('#refuse_reason').val();
if (!refuse_reason) {
layer.tips('驳回原因不能为空', $('#refuse_reason'));
return false;
}
data.refuse_reason = refuse_reason;
}
$.ajax({
url: '/ajax/returnCheck',
type: 'post',
data: data,
success: function(resp){
if (resp.err_code == 0) {
layer.msg(resp.err_msg);
setTimeout(function(){
location.reload();
}, 1000);
return false;
}
layer.alert(resp.err_msg);
},
error: function(err) {
console.log(err)
}
})
}
})
})
} }
} }
}); });
})(jQuery) })(jQuery)
\ No newline at end of file
...@@ -481,8 +481,13 @@ ...@@ -481,8 +481,13 @@
<th>采购数量</th> <th>采购数量</th>
<th>采购单价</th> <th>采购单价</th>
@elseif ($username != 'vpadmin@ichunt.com') @elseif ($username != 'vpadmin@ichunt.com')
<th>采购数量</th> @if ($order_info['order_goods_type'] == 2)
<th>采购单价</th> <th>购买数量</th>
<th>购买时单价</th>
@else
<th>采购数量</th>
<th>采购单价</th>
@endif
<th>均摊后单价</th> <th>均摊后单价</th>
@else @else
<th>商品数量</th> <th>商品数量</th>
...@@ -721,9 +726,19 @@ ...@@ -721,9 +726,19 @@
@endif @endif
@if ($action_name == 'refund') @if ($action_name == 'refund')
<!--自营对账--> <!--退货申请-->
@include('detail.refund') @include('detail.refund')
@endif @endif
@if ($action_name == 'orderReturn')
<!--退货申请-->
@include('detail.return')
@endif
@if ($action_name == 'orderReturnEdit')
<!--编辑退货申请-->
@include('detail.return_edit')
@endif
<!-- 人工审单时去掉操作按钮 --> <!-- 人工审单时去掉操作按钮 -->
@if (!isset($_REQUEST['tags']) && $action_name != 'changeOrder' && $action_name != 'sendSales') @if (!isset($_REQUEST['tags']) && $action_name != 'changeOrder' && $action_name != 'sendSales')
...@@ -792,6 +807,10 @@ ...@@ -792,6 +807,10 @@
@if ($order_info['status'] == 4 && in_array('self_order_express', $userPerms)) @if ($order_info['status'] == 4 && in_array('self_order_express', $userPerms))
<!-- <a class="btn btn-default self_express" href="javascript:;" data-id="{{$order_info['order_id']}}">填写快递单</a> --> <!-- <a class="btn btn-default self_express" href="javascript:;" data-id="{{$order_info['order_id']}}">填写快递单</a> -->
@endif @endif
@if (in_array($order_info['status'], [7, 8, 10]) && in_array('self_order_refund', $userPerms))
<a href="/return/{{$order_info['order_id']}}?tags=self" class="btn btn-info order_refund">退货申请</a>
@endif
<!-- 订单状态大于4,且处于开票状态,且存在权限 --> <!-- 订单状态大于4,且处于开票状态,且存在权限 -->
@if ($order_info['status'] >= 4 && $order_invoice_info['inv_type'] > 1 && in_array('self_order_invoice_express', $userPerms)) @if ($order_info['status'] >= 4 && $order_invoice_info['inv_type'] > 1 && in_array('self_order_invoice_express', $userPerms))
......
<style>
.bank-input{
width: 400px !important;
}
</style>
<p style="padding-left: 5px;">退货申请</p>
<div class="tabs-box">
<div class="order-change-main">
<form id="returnForm" class="form-horizontal table-responsive">
<input type="hidden" name="return_info[order_id]" value="{{$order_info['order_id']}}">
<input type="hidden" name="return_info[order_sn]" value="{{$order_info['order_sn']}}">
<input type="hidden" name="return_info[user_id]" value="{{$order_info['user_id']}}">
<input type="hidden" class="order_goods_type" name="return_info[order_goods_type]" value="{{$order_info['order_goods_type']}}">
<input type="hidden" name="return_info[currency]" value="{{$order_info['currency']}}">
<input type="hidden" name="return_info[mobile]" value="{{isset($user_info['mobile']) ? $user_info['mobile'] : $user_mobile}}">
<input type="hidden" name="return_info[email]" value="{{isset($user_info['email']) ? $user_info['email'] : ''}}">
<input type="hidden" name="return_info[company_name]" value="{{ isset($company_info['com_name']) ? $company_info['com_name'] : '' }}">
<input type="hidden" name="return_info[pay_amount]" value="{{ $order_info['order_amount'] + $order_price_info['pay_preferential'] }}">
<input type="hidden" name="pay_id" value="{{$order_pay_log[0]['pay_id']}}">
<!-- 退货方式 -->
<table class="table table-bordered table-hover">
<tr>
<th width="20%">退货方式</th>
<td>
<label style="margin-right: 20px;"><input type="radio" class="return_way" name="return_info[return_way]" value="1">快递寄送</label>
<label><input type="radio" class="return_way" name="return_info[return_way]" value="2">自送</label>
</td>
</tr>
</table>
<!-- 退货型号 -->
<p>退货型号</p>
<table class="table table-bordered table-hover return-table">
<thead>
<!-- <th width="7%"><input type="checkbox" class="all-select" >全选</th> -->
<th width="20%">供应商</th>
<th>型号</th>
<th>出库数量</th>
<th>均摊后单价(包含支付优惠)</th>
<th>退货数量</th>
<th width="10%">小计</th>
<th>已申请数量</th>
</thead>
<tbody>
@foreach ($removalItems as $v)
<tr>
<input type="hidden" name="return_items_info[{{$v['rec_id']}}][brand_id]" value="{{ $v['brand_id'] }}">
<input type="hidden" name="return_items_info[{{$v['rec_id']}}][brand_name]" value="{{ $v['brand_name'] }}">
<td>
<input type="hidden" name="return_items_info[{{$v['rec_id']}}][supplier_id]" value="{{ $v['supplier_id'] }}">
<input type="hidden" name="return_items_info[{{$v['rec_id']}}][supplier_name]" value="{{ $v['supplier_name'] }}">
<span>{{$v['supplier_name']}}</span>
</td>
<td>
<input type="hidden" name="return_items_info[{{$v['rec_id']}}][goods_id]" value="{{ $v['goods_id'] }}">
<input type="hidden" name="return_items_info[{{$v['rec_id']}}][goods_name]" value="{{ $v['goods_name'] }}">
<span>{{$v['goods_name']}}</span>
</td>
<td>
<input type="hidden" class="removal_number" name="removal_number" value="{{ $v['removal_number'] }}">
<span>{{$v['removal_number']}}</span>
</td>
<td>
<input type="hidden" name="return_items_info[{{$v['rec_id']}}][single_price]" class="single_pre_price" value="{{ $v['single_pre_price'] }}">
<span>{{$v['single_pre_price']}}</span>
</td>
<td>
<input class="only_number int_num return_num" name="return_items_info[{{$v['rec_id']}}][return_num]" value="">
</td>
<td>
<span class="single_return_amount"></span>
</td>
<td><span>{{ $v['already_return_num'] }}</span></td>
</tr>
@endforeach
</tbody>
</table>
<hr/>
<table class="table table-bordered table-hover">
<tr>
<th width="20%">支付金额</th>
<td>
<p class="text-danger">{{$currency}}<span class="total">{{ $order_info['order_amount'] + $order_price_info['pay_preferential'] }}</span></p>
</td>
</tr>
<tr>
<th>退款总额</th>
<td>
<input type="hidden" class="return_amount" name="return_info[return_amount]" value="">
<span class="return_amount_val"></span>
</td>
</tr>
<tr>
<th>退货原因</th>
<td>
<input type="hidden" class="refund_reason" name="return_info[return_reason]" value="">
<a href="javascript:;" class="btn btn-default input-cancel-reason" data-oid="{{$order_info['order_id']}}" data-type="5">点击选择</a>
<span class="refund_reason_val"></span>
</td>
</tr>
<tr>
<th>退款账号(线下转账必填)</th>
<td><input type="text" name="return_info[bank_account]" class="bank-input bank_account" value="" placeholder="请填写银行账号"></td>
</tr>
<tr>
<th>退款银行名称(线下转账必填)</th>
<td><input type="text" name="return_info[bank_name]" class="bank-input bank_name" value="" placeholder="请填写银行名称"></td>
</tr>
<tr>
<th>退款支行名称(线下转账必填)</th>
<td><input type="text" name="return_info[bank_sub_name]" class="bank-input bank_sub_name" value="" placeholder="请填写支行名称"></td>
</tr>
<tr>
<th>开户人名称(线下转账必填)</th>
<td><input type="text" name="return_info[bank_user]" class="bank-input bank_user" value="" placeholder="请填写开户人名称"></td>
</tr>
</table>
<a class="btn btn-primary returnApply">提交申请</a>
</form>
</div>
</div>
<script>
var currency_sign = "{{$currency}}";
$.lie.refund.refund();
</script>
\ No newline at end of file
<style>
.bank-input{
width: 400px !important;
}
</style>
<p style="padding-left: 5px;">编辑退货申请</p>
<div class="tabs-box">
<div class="order-change-main">
<form id="returnForm" class="form-horizontal table-responsive">
<input type="hidden" class="return_id" name="return_id" value="{{$return['return_id']}}">
<input type="hidden" class="order_goods_type" name="order_goods_type" value="{{$return['order_goods_type']}}">
<input type="hidden" name="pay_id" value="{{$order_pay_log[0]['pay_id']}}">
<!-- 退货方式 -->
<table class="table table-bordered table-hover">
<tr>
<th width="20%">退货方式</th>
<td>
<label style="margin-right: 20px;"><input type="radio" class="return_way" name="return_info[return_way]" value="1">快递寄送</label>
<label><input type="radio" class="return_way" name="return_info[return_way]" value="2">自送</label>
</td>
</tr>
</table>
<!-- 退货型号 -->
<p>退货型号</p>
<table class="table table-bordered table-hover return-table">
<thead>
<th width="20%">供应商</th>
<th>型号</th>
<th>出库数量</th>
<th>均摊后单价</th>
<th>退货数量</th>
<th width="10%">小计</th>
<th>已申请数量</th>
</thead>
<tbody>
@foreach ($returnItems as $v)
<tr>
<td>
<span>{{$v['supplier_name']}}</span>
</td>
<td>
<span>{{$v['goods_name']}}</span>
</td>
<td>
<input type="hidden" class="removal_number" name="removal_number" value="{{ $v['removal_number'] }}">
<span>{{$v['removal_number']}}</span>
</td>
<td>
<input type="hidden" name="return_items_info[{{$v['return_items_id']}}][single_price]" class="single_pre_price" value="{{ $v['single_price'] }}">
<span>{{$v['single_price']}}</span>
</td>
<td>
<input class="only_number int_num return_num" name="return_items_info[{{$v['return_items_id']}}][return_num]" value="{{$v['return_num']}}">
</td>
<td>
<span class="single_return_amount">{{ $v['single_price'] * $v['return_num'] }}</span>
</td>
<td><span>{{ $v['already_return_num'] }}</span></td>
</tr>
@endforeach
</tbody>
</table>
<hr/>
<table class="table table-bordered table-hover">
<tr>
<th width="20%">支付金额</th>
<td>
<p class="text-danger">{{$currency}}<span class="total">{{ $return['pay_amount'] }}</span></p>
</td>
</tr>
<tr>
<th>退款总额</th>
<td>
<input type="hidden" class="return_amount" name="return_info[return_amount]" value="{{ $return['return_amount'] }}">
<span class="return_amount_val">{{ $currency.$return['return_amount'] }}</span>
</td>
</tr>
<tr>
<th>退货原因</th>
<td>
<input type="hidden" class="refund_reason" name="return_info[return_reason]" value="{{ $return['return_reason'] }}">
<a href="javascript:;" class="btn btn-default input-cancel-reason" data-oid="{{$order_info['order_id']}}" data-type="5">点击选择</a>
<span class="refund_reason_val">{{ $return['return_reason'] }}</span>
</td>
</tr>
<tr>
<th>退款账号(线下转账必填)</th>
<td><input type="text" name="return_info[bank_account]" class="bank-input bank_account" value="{{ $return['bank_account'] }}" placeholder="请填写银行账号"></td>
</tr>
<tr>
<th>退款银行名称(线下转账必填)</th>
<td><input type="text" name="return_info[bank_name]" class="bank-input bank_name" value="{{ $return['bank_name'] }}" placeholder="请填写银行名称"></td>
</tr>
<tr>
<th>退款支行名称(线下转账必填)</th>
<td><input type="text" name="return_info[bank_sub_name]" class="bank-input bank_sub_name" value="{{ $return['bank_sub_name'] }}" placeholder="请填写支行名称"></td>
</tr>
<tr>
<th>开户人名称(线下转账必填)</th>
<td><input type="text" name="return_info[bank_user]" class="bank-input bank_user" value="{{ $return['bank_user'] }}" placeholder="请填写开户人名称"></td>
</tr>
</table>
<a class="btn btn-primary returnApply">提交申请</a>
</form>
</div>
</div>
<script>
var currency_sign = "{{$currency}}";
// 选中退货方式
var return_way = "{{$return['return_way']}}";
$('.return_way[value='+return_way+']').prop('checked', true);
$.lie.refund.refund();
</script>
\ No newline at end of file
<div class="row wrapper border-bottom white-bg page-heading"> <div class="row wrapper border-bottom white-bg page-heading">
<a class="navbar-minimalize minimalize-styl-2 btn btn-primary pull-left" style="margin-left:0px;margin-top:18px;" href="#"><i class="fa fa-bars"></i> </a> <a class="navbar-minimalize minimalize-styl-2 btn btn-primary pull-left" style="margin-left:0px;margin-top:18px;" href="#"><i class="fa fa-bars"></i> </a>
<div class="col-lg-10 side-section" style="padding-left:0px;"> <div class="col-lg-10 side-section" style="padding-left:0px;">
<h2>{{ $title }}</h2> <h2 style="margin-top: 20px !important; margin-bottom: 10px !important;">{{ $title }}</h2>
<ol class="breadcrumb"> <ol class="breadcrumb">
@if (!empty($paths)) @if (!empty($paths))
@for ($i = 0; $i < count($paths); $i++) @for ($i = 0; $i < count($paths); $i++)
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
<script src="/js/inspinia.min.js"></script> <script src="/js/inspinia.min.js"></script>
<script src="/js/common.js"></script> <script src="/js/common.js"></script>
<script src="/js/layui/layui.js"></script>
<script src="/js/order.js?v=<?= time() ?>"></script> <script src="/js/order.js?v=<?= time() ?>"></script>
<script src="/js/orderamount.js"></script> <script src="/js/orderamount.js"></script>
<script src="/js/plugins/DatePicker/WdatePicker.js"></script> <script src="/js/plugins/DatePicker/WdatePicker.js"></script>
<script src="/js/refund.js"></script> <script src="/js/refund.js?v=<?= time() ?>"></script>
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
@include('orderlist.css') @include('orderlist.css')
@include('orderlist.js') @include('orderlist.js')
<link href="/js/layui/css/layui.css" rel="stylesheet">
</head> </head>
<body class=""> <body class="">
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单管理后台 | {{$title}}</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
@include('orderlist.css')
@include('orderlist.js')
<link href="/js/layui/css/layui.css" rel="stylesheet">
</head>
<body class="">
<div id="wrapper">
<!-- layouts.navigation -->
<?php $isPage = false; ?>
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
<div class="row">
@include('returnDetails.content')
</div>
</div>
</div>
</body>
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<div class="tabs-box table-responsive">
<div class="layui-row">
<a href="javascript:;" class="btn btn-info return-print" style="float: right; margin-right: 20px;">打印预览</a>
</div>
<div id="return-info" style="padding: 30px 10px;">
<style>
.return-content{ margin:20px auto; width: 1000px; }
.return-content label, .return-content span{ font-size: 14px; }
.return-content label { width: 140px; font-weight: 600; }
.return-content span { line-height: 38px; }
.return-items{ margin-top: 20px; }
.return-items tr.active, .return-items .return-items-first-tr th{ background: #23c6c8 !important; }
</style>
<div class="layui-row">
<h2 class="text-center">深圳猎芯科技有限公司退货单详情</h2>
</div>
<div class="layui-row">
<span style="float: right; margin-right: 20px;">退货单号:{{ $return['return_sn'] }}</span>
</div>
<!-- 退货单信息 -->
<div class="return-content">
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">订单编号:</label>
<span class="layui-text">{{ $return['order_sn'] }}</span>
</div>
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">会员账号:</label>
<span class="layui-text">{{ $return['mobile'] ? $return['mobile'] : $return['email'] }}</span>
</div>
</div>
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">退货申请时间:</label>
<span class="layui-text">{{ date('Y-m-d H:i:s', $return['create_time']) }}</span>
</div>
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">公司名称:</label>
<span class="layui-text">{{ $return['company_name'] }}</span>
</div>
</div>
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">支付金额:</label>
<span class="layui-text">{{ $return['pay_amount'] }}</span>
</div>
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">支付方式:</label>
<span class="layui-text">{{ $return['mobile'] }}</span>
</div>
</div>
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">退款金额:</label>
<span class="layui-text">{{ $return['return_amount'] }}</span>
</div>
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">银行账号:</label>
<span class="layui-text">{{ $return['bank_account'] }}</span>
</div>
</div>
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">退货原因:</label>
<span class="layui-text">{{ $return['return_reason'] }}</span>
</div>
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">银行名称:</label>
<span class="layui-text">{{ $return['bank_name'] }}</span>
</div>
</div>
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">退货物流:</label>
<span class="layui-text">{{ App\Http\Controllers\getShippingName($return['shipping_id']) }}</span>
</div>
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">支行名称:</label>
<span class="layui-text">{{ $return['bank_sub_name'] }}</span>
</div>
</div>
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">物流单号:</label>
<span class="layui-text">{{ $return['shipping_sn'] }}</span>
</div>
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<label class="layui-form-label">开户人:</label>
<span class="layui-text">{{ $return['bank_user'] }}</span>
</div>
</div>
</div>
<!-- 退货单明细 -->
<div class="return-items">
<h3 style="margin-bottom: 10px;">退货型号</h3>
<table class="table table-bordered">
<tr class="return-items-first-tr">
<th width="5%">序号</th>
<th>供应商</th>
<th>型号</th>
<th>均摊后单价</th>
<th>退货数量</th>
<th>小计</th>
</tr>
@foreach ($returnItems as $k=>$v)
<tr>
<td>{{ $k + 1 }}</td>
<td>{{ $v['supplier_name'] }}</td>
<td>{{ $v['goods_name'] }}</td>
<td>{{ $v['single_price'] }}</td>
<td>{{ $v['return_num'] }}</td>
<td>{{ $v['single_price'] * $v['return_num'] }}</td>
</tr>
@endforeach
</table>
</div>
</div>
<!-- 管理员、经理、自营客服主管审核 && 待审核状态 -->
@if (in_array($role, [1, 2, 10]) && $return['status'] == 1)
<div class="text-center" style="margin-bottom: 10px;">
<button class="btn btn-info return-check" style="margin-right: 10px;" data-type="2" data-id="{{ $return['return_id'] }}">审核通过</button>
<button class="btn btn-danger return-check" data-type="-2" data-id="{{ $return['return_id'] }}">驳回</button>
</div>
@endif
</div>
<p>操作记录</p>
<div class="tabs-box table-responsive">
<table class="table table-bordered">
<tr>
<th width="15%">操作时间</th>
<th width="10%">操作人</th>
<th>操作事件</th>
</tr>
@foreach ($returnLog as $log)
<tr>
<td>{{ date('Y-m-d H:i:s', $log['create_time']) }}</td>
<td>{{ $log['operator_name'] }}</td>
<td>{{ $log['event'] }}</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
<script src="/js/jquery.PrintArea.min.js"></script>
<script>
$.lie.refund.details();
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单管理后台 | {{ $title }}</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
@include('orderlist.css')
@include('orderlist.js')
</head>
<body class="">
<div id="wrapper">
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
<div class="row">
@include('returnlist.content')
</div>
</div>
</div>
</body>
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<div class="tabs-box">
<div class="row-fluid search-box">
<div class="span12">
<table style="width:100%">
<tr>
<td>
<dl>
<dt>订单编号:</dt>
<dd>
<input type="text" id="order_sn" name="order_sn" value="{{$condition['order_sn']}}" placeholder="请输入订单编号">
</dd>
</dl>
@if ($condition['order_goods_type'] == 1)
<dl>
<dt>SKU名称:</dt>
<dd>
<input type="text" id="sku_name" name="sku_name" value="{{$condition['sku_name']}}" placeholder="请输入SKU名称">
</dd>
</dl>
@endif
<dl>
<dt>支付方式:</dt>
<dd>
<select id="order_payment_mode" name="order_payment_mode" class="form-control order_payment_mode selectpicker" title="全部" multiple>
@if (Config('params.order_paid_name'))
@foreach (Config('params.order_paid_name') as $k=>$v)
<option value="{{$k}}">{{$v}}</option>
@endforeach
@endif
</select>
</dd>
</dl>
<dl>
<dt>处理状态:</dt>
<dd>
<select id="apply_status" name="apply_status" class="form-control apply_status selectpicker" title="全部" multiple>
@if (Config('perms.return_status'))
@foreach (Config('perms.return_status') as $k=>$v)
<option value="{{$k}}">{{$v}}</option>
@endforeach
@endif
</select>
</dd>
</dl>
<dl>
<dt>创建日期: </dt>
<dd style="width:auto !important;">
<input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" />
</dd>
<dd style="width:auto !important;">
<input type="text" name="time_end" value="{{ !empty($condition['time_end']) ? date('Y/m/d', $condition['time_end']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="结束时间" autocomplete="off" />
</dd>
</dl>
</td>
</tr>
</table>
<div class="text-center" style="margin-top: 10px;">
<input type="hidden" name="order_goods_type" value="{{$condition['order_goods_type']}}">
<div class="search-btn">
<button class="nbtn search_return_order">搜索</button>
<button class="nbtn export_return_order" style="margin-left: 20px; background: #23c6c8 !important;">导出</button>
</div>
</div>
</div>
</div>
</div>
<div class="row-fluid table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th class="pl30">创建时间</th>
<th class="pl30">退货单号</th>
<th class="pl30">会员账号</th>
<th class="pl30">订单编号</th>
<th class="pl30">退款金额</th>
<th class="pl30">申请状态</th>
<th class="pl30">支付方式</th>
<th class="pl30">处理时间</th>
<th class="pl30">操作</th>
</tr>
</thead>
@if (empty($list))
<tr>
<td class="text-center" colspan="9">没有查询到相关记录~</td>
</tr>
@else
<tbody>
@foreach ($list as $v)
<tr>
<td class="show-list">{{$v['create_time'] ? date('Y-m-d H:i:s', $v['create_time']) : ''}}</td>
<td class="show-list">{{ $v['return_sn'] }}</td>
<td class="show-list">{{ $v['mobile'] ? $v['mobile'] : $v['email'] }}</td>
<td class="show-list">{{$v['order_sn']}}</td>
<?php
$currencySign = $v['currency'] == 1 ? '¥' : '$';
?>
<td class="show-list">{{$currencySign.$v['return_amount']}}</td>
<td class="show-list">
<?php
switch ($v['status']) {
case -2: echo '<span class="list-text-no-check"><b>驳回</b></span>';break;
case -1: echo '<span class="list-text-cancel"><b>取消</b></span>';break;
case 1: echo '<span class="list-text-checking"><b>待审核</b></span>';break;
case 2: echo '<span class="list-text-confirm"><b>审核通过</b></span>';break;
case 7: echo '<span class="list-text-send"><b>待收货</b></span>';break;
case 10: echo '<span class="list-text-success"><b>已完成</b></span>';break;
}
?>
</td>
<?php $pay_name = App\Http\Controllers\getPayName($v['order_id']); ?>
<td class="show-list"><?php print_r($pay_name); ?></td>
<td class="show-list">{{$v['audit_time'] ? date('Y-m-d H:i:s', $v['audit_time']) : ''}}</td>
<td>
<div class="btn-group btn-group-xs">
<a class="btn btn-primary" href="/return_details/{{$v['return_id']}}" target="_blank">查看申请</a>
<!-- 驳回和待审核 可编辑退货单 -->
@if (in_array($v['status'], [-2, 1]))
<a class="btn btn-info" href="/return_edit/{{$v['order_id']}}?return_id={{$v['return_id']}}" target="_blank">编辑</a>
@endif
<!-- 审核通过后填写物流信息 -->
@if ($v['status'] == 2)
<a class="btn btn-success return-shipping" href="javascript:;" data-id="{{$v['return_id']}}">填写物流</a>
@endif
</div>
</td>
</tr>
@endforeach
</tbody>
@endif
</table>
</div>
<div class="row-fluid pagination">
<?php echo $page; ?>
</div>
</div>
</div>
<script>
var shippings = '{!! json_encode($shippings) !!}';
var shippings_info = eval('('+shippings+')');
var apply_status = "{{$condition['apply_status']}}";
var order_payment_mode = "{{$condition['order_payment_mode']}}";
$(".apply_status, .order_payment_mode").selectpicker({
actionsBox:true, //在下拉选项添加选中所有和取消选中的按钮
countSelectedText:"已选中{0}项",
selectedTextFormat:"count > 5",
selectAllText: '全选',
deselectAllText: '取消全选',
})
$('.apply_status').selectpicker('val', apply_status.split(',')).trigger("change");
$('.order_payment_mode').selectpicker('val', order_payment_mode.split(',')).trigger("change");
$.lie.refund.index_new();
</script>
\ No newline at end of file
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