Merge branch 'master' of http://119.23.72.7/zhujilai/Order into hcy_pcb_20181221-r

parents a6f43a8e 49979369
...@@ -358,8 +358,8 @@ Class OrderController extends Controller ...@@ -358,8 +358,8 @@ Class OrderController extends Controller
$info = $this->getOrderInfo($request, 1); $info = $this->getOrderInfo($request, 1);
$info['title'] = '平台订单'; $info['title'] = '平台订单';
// 若为京东自营、自营客服、财务角色,则跳转到自营列表 // 若为京东自营、自营客服角色,则跳转到自营列表
if (in_array($info['role'], [6, 7, 9])) { if (in_array($info['role'], [6, 7])) {
return redirect('self_order'); return redirect('self_order');
} }
...@@ -1018,6 +1018,48 @@ Class OrderController extends Controller ...@@ -1018,6 +1018,48 @@ Class OrderController extends Controller
return view('detail', $info); return view('detail', $info);
} }
// 退货退款
public function refund(Request $request, $id)
{
if ($request->isMethod('post'))
{
$data['order_id'] = $request->input('order_id');
$data['refund_info'] = $request->input('refund_info');
$data['all_refund_amount'] = $request->input('all_refund_amount');
$data['price_fall'] = $request->input('price_fall');
$data['refund_reason'] = $request->input('refund_reason');
$data['operator_id'] = $request->user->userId;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'refund/refundGoods';
$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/getUnshippedItems';
$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['unshippedItems'] = $res['data'];
return view('detail', $info);
}
//订单物流信息 //订单物流信息
public function changeShipping(Request $request, $id='') public function changeShipping(Request $request, $id='')
{ {
...@@ -1249,6 +1291,8 @@ Class OrderController extends Controller ...@@ -1249,6 +1291,8 @@ Class OrderController extends Controller
'order_temp_info' => $temp['data']['order_temp_info'], 'order_temp_info' => $temp['data']['order_temp_info'],
'order_shipping_inside' => $temp['data']['order_shipping_inside'], 'order_shipping_inside' => $temp['data']['order_shipping_inside'],
'actionLog' => $actionLog, 'actionLog' => $actionLog,
'order_refund_info' => $temp['data']['order_refund_info'],
'order_refund_items' => $temp['data']['order_refund_items'],
]; ];
$response = array_merge($response, $info); $response = array_merge($response, $info);
......
<?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\OrderRefundModel;
use App\Model\OrderRefundItemsModel;
use DB;
use App\Http\Page;
use App\Model\UserMainModel;
// 获取会员账号
function getUserName($user_id)
{
if (!$user_id) return false;
$userMainModel = new UserMainModel;
$user = $userMainModel->find($user_id);
if (!$user) return false;
return $user->mobile ? $user->mobile : $user->email;
}
// 获取订单金额
function getOrderAmount($order_id)
{
if (!$order_id) return false;
$OrderModel = new OrderModel;
$order = $OrderModel->find($order_id);
if (!$order) return false;
return $order->order_amount;
}
class RefundController 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 refundList(Request $request)
{
$info = $this->getPageInfo($request);
$info['title'] = '退款申请列表';
$map['order_sn'] = $request->input('order_sn', '');
$map['sku_name'] = $request->input('sku_name', '');
$map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', '');
$map['apply_status'] = $request->input('apply_status', '');
$map['order_goods_type'] = 1; // 联营退货
//获取订单列表
$url = Config('website.api_domain').'refund/getRefundOrderList';
$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();
$info['condition'] = $map;
$info['list'] = $response['data']['data'];
$info['count'] = $response['data']['count'];
$info['page'] = $show;
return view('refundlist', $info);
}
// 退款导出
public function refundExport(Request $request)
{
$refundModel = new RefundModel();
$refundModel->export($request);
}
// 退货详情
public function refundDetails(Request $request, $id)
{
$info = $this->getPageInfo($request);
$info['title'] = '订单退货详情';
$info['paths'] = [["title" => '联营订单', "href" => '#'], ["title" => '退款申请列表', "href" => '/refund_order'], ["title" => '订单退货详情', "href" => '#']];
$OrderRefundModel = new OrderRefundModel();
$info['refund'] = $OrderRefundModel->find($id);
$info['refundItems'] = $OrderRefundModel->find($id)->hasManyRefundItems;
return view('refundDetails', $info);
}
}
...@@ -105,6 +105,11 @@ Route::group(['middleware' => 'web'], function () { ...@@ -105,6 +105,11 @@ Route::group(['middleware' => 'web'], function () {
Route::match(['get', 'post'],'/web/{key}', 'WebController@info'); Route::match(['get', 'post'],'/web/{key}', 'WebController@info');
Route::match(['get', 'post'],'/api/{key}', 'ApiController@Entrance'); Route::match(['get', 'post'],'/api/{key}', 'ApiController@Entrance');
Route::match(['get', 'post'], '/refund/{id}', 'OrderController@refund');
Route::get('/refund_order', 'RefundController@refundList');
Route::get('/refund_export', 'RefundController@refundExport');
Route::get('/refund_details/{id}', 'RefundController@refundDetails');
}); });
// 不需要登陆态 // 不需要登陆态
......
...@@ -237,7 +237,7 @@ class OrderModel extends Model ...@@ -237,7 +237,7 @@ class OrderModel extends Model
}) })
->where('it.status', '<>', -1) ->where('it.status', '<>', -1)
->where('o.order_goods_type', '=', $map['order_goods_type']) ->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', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'a.consignee', 'a.address', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'c.com_name', 'oe.send_remark', 'oe.is_new as is_new_order') ->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'it.supplier_name', 'it.order_source as items_source', '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', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'a.consignee', 'a.address', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'c.com_name', 'oe.send_remark', 'oe.is_new as is_new_order')
->groupBy('it.rec_id') ->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC') ->orderBy('o.create_time', 'DESC')
->get() ->get()
...@@ -249,9 +249,9 @@ class OrderModel extends Model ...@@ -249,9 +249,9 @@ class OrderModel extends Model
// 标题 // 标题
if ($map['order_goods_type'] == 1) { if ($map['order_goods_type'] == 1) {
$headerCell = ['订单ID', '订单编号', '会员账号', '是否为新订单', '收货人', '下单日期', '下单时间', '客户名称', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注']; $headerCell = ['订单ID', '订单编号', '会员账号', '是否为新订单', '收货人', '下单日期', '下单时间', '客户名称', '明细来源', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注'];
} else { } else {
$headerCell = ['订单ID', '订单编号', '会员账号', '收货人', '下单日期', '下单时间', '客户名称', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注']; $headerCell = ['订单ID', '订单编号', '会员账号', '收货人', '下单日期', '下单时间', '客户名称', '明细来源', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注'];
} }
array_unshift($cellData, $headerCell); array_unshift($cellData, $headerCell);
...@@ -345,6 +345,8 @@ class OrderModel extends Model ...@@ -345,6 +345,8 @@ class OrderModel extends Model
$tmp[$i]['create_time_date'] = date('Y-m-d', $order[$i]['create_time']); $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]['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]['com_name'] = !empty($order[$i]['tax_title']) ? $order[$i]['tax_title'] : $order[$i]['com_name'];
$tmp[$i]['items_source'] = $order[$i]['items_source'];
// 自营商品名称换成商品型号 // 自营商品名称换成商品型号
$tmp[$i]['goods_name'] = $order[$i]['order_goods_type'] == 1 ? $order[$i]['goods_name'] : $this->getGoodsName($order[$i]['goods_id']); $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]['brand_name'] = $order[$i]['brand_name'];
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class OrderRefundItemsModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_refund_items';
protected $primaryKey = 'refund_rec_id';
public $timestamps = false;
}
\ 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 OrderRefundModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_refund';
protected $primaryKey = 'refund_id';
public $timestamps = false;
// 获取联系人信息
public function hasManyRefundItems()
{
return $this->hasMany('App\Model\OrderRefundItemsModel', 'refund_id', 'refund_id');
}
// 订单导出
public function export($request, $type=1) // type: 1-联营,2-自营
{
set_time_limit(0);
ini_set('memory_limit', '512M');
$map = array();
// 页面参数
$map['order_sn'] = $request->input('order_sn', '');
$map['sku_name'] = $request->input('sku_name', '');
$map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', '');
$map['apply_status'] = $request->input('apply_status', '');
$list = $this->from('lie_order_refund_items as it')
->leftJoin('lie_order_refund as r', function($join) use ($type) {
$join->on('it.refund_id', '=', 'r.refund_id')->where('r.refund_type', '=', 2)->where('r.order_goods_type', '=', $type);
})
->leftJoin('lie_user_main as u', 'r.create_uid', '=', 'u.user_id')
->where(function ($query) use ($map) {
// 订单编号
if (!empty($map['order_sn'])) {
$query->where('r.order_sn', '=', $map['order_sn']);
}
})
->where(function ($query) use ($map) {
// sku名称
if (!empty($map['sku_name'])) {
$query->where('it.sku_name', '=', $map['sku_name']);
}
})
->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']));
}
})
->select('it.refund_rec_id', 'it.refund_id', 'it.rec_id', 'it.goods_id', 'it.goods_name', 'it.brand_id', 'it.brand_name', 'it.supplier_id', 'it.supplier_name', 'it.sku_name', 'it.goods_price', 'it.single_pre_price', 'it.refund_num', 'r.order_id', 'r.order_sn', 'r.order_goods_type', 'r.currency', 'r.pay_amount', 'r.price_fall', 'r.create_uid', 'r.status', 'r.refund_reason', 'r.create_time', 'r.refund_time', 'u.mobile', 'u.email')
->groupBy('it.refund_rec_id')
->orderBy('r.create_time', 'DESC')
->get()
->toArray();
if (!empty($list)) {
// 订单数据处理
$cellData = $this->exportList($list);
// 标题
$headerCell = ['订单ID', '订单编号', '会员账号', '商品型号', '制造商', '供应商', '币种', '退货数量', '原始单价', '均摊后单价', '小计', '退货总额', '手动差价', '实际退货总额', '退货原因', '后台操作人', '创建时间', '退货处理状态', '退货处理时间'];
array_unshift($cellData, $headerCell);
$fileName = $type == 1 ? '联营退货订单导出'.date('_YmdHis') : '自营退货订单导出'.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)
{
// 订单类型
$apply_status = array(
'-1' => '已拒绝',
'1' => '待处理',
'10' => '已处理',
);
$tmp = array();
for ($i = 0; $i < count($order); $i++) {
// 推送人
if ($order[$i]['create_uid']) {
$sales = DB::table('user_info')->where(['userId' => $order[$i]['create_uid']])->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]['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]['currency'] = $order[$i]['currency'] == 1 ? 'RMB' : 'USD';
$tmp[$i]['refund_num'] = $order[$i]['refund_num'];
$tmp[$i]['goods_price'] = $order[$i]['goods_price'];
$tmp[$i]['single_pre_price'] = $order[$i]['single_pre_price'];
$tmp[$i]['goods_amount'] = $order[$i]['refund_num'] * $order[$i]['single_pre_price'];
if ($i > 0 && $tmp[$i]['order_id'] == $tmp[$i-1]['order_id']) {
$tmp[$i]['pay_amount'] = $order[$i]['pay_amount'];
$tmp[$i]['price_fall'] = $order[$i]['price_fall'];
$tmp[$i]['final_amount'] = $order[$i]['pay_amount'] - $order[$i]['price_fall'];
} else {
$tmp[$i]['pay_amount'] = '';
$tmp[$i]['price_fall'] = '';
$tmp[$i]['final_amount'] = '';
}
$tmp[$i]['refund_reason'] = $order[$i]['refund_reason'];
$tmp[$i]['sale_name'] = isset($sales) ? $sales->name : ''; // 推送业务员
$tmp[$i]['create_time'] = date('Y-m-d H:i:s', $order[$i]['create_time']);
$tmp[$i]['status'] = $apply_status[$order[$i]['status']];
$tmp[$i]['refund_time'] = $order[$i]['refund_time'] ? date('Y-m-d H:i:s', $order[$i]['refund_time']) : '';
unset($sales);
}
return $tmp;
}
}
\ 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 OrderRefundModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_refund';
protected $primaryKey = 'refund_id';
public $timestamps = false;
// 获取联系人信息
public function hasManyRefundItems()
{
return $this->hasMany('App\Model\RefundItemsModel', 'refund_id', 'refund_id');
}
// 订单导出
public function export($request, $type=1) // type: 1-联营,2-自营
{
set_time_limit(0);
ini_set('memory_limit', '512M');
$map = array();
// 页面参数
$map['order_sn'] = $request->input('order_sn', '');
$map['sku_name'] = $request->input('sku_name', '');
$map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', '');
$map['apply_status'] = $request->input('apply_status', '');
$list = $this->from('lie_order_refund_items as it')
->leftJoin('lie_order_refund as r', function($join) use ($type) {
$join->on('it.refund_id', '=', 'r.refund_id')->where('r.refund_type', '=', 2)->where('r.order_goods_type', '=', $type);
})
->leftJoin('lie_user_main as u', 'r.create_uid', '=', 'u.user_id')
->where(function ($query) use ($map) {
// 订单编号
if (!empty($map['order_sn'])) {
$query->where('r.order_sn', '=', $map['order_sn']);
}
})
->where(function ($query) use ($map) {
// sku名称
if (!empty($map['sku_name'])) {
$query->where('it.sku_name', '=', $map['sku_name']);
}
})
->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']));
}
})
->select('it.refund_rec_id', 'it.refund_id', 'it.rec_id', 'it.goods_id', 'it.goods_name', 'it.brand_id', 'it.brand_name', 'it.supplier_id', 'it.supplier_name', 'it.sku_name', 'it.goods_price', 'it.single_pre_price', 'it.refund_num', 'r.order_id', 'r.order_sn', 'r.order_goods_type', 'r.currency', 'r.pay_amount', 'r.price_fall', 'r.create_uid', 'r.status', 'r.refund_reason', 'r.create_time', 'r.refund_time', 'u.mobile', 'u.email')
->groupBy('it.refund_rec_id')
->orderBy('r.create_time', 'DESC')
->get()
->toArray();
if (!empty($list)) {
// 订单数据处理
$cellData = $this->exportList($list);
// 标题
$headerCell = ['订单ID', '订单编号', '会员账号', '商品型号', '制造商', '供应商', '币种', '退货数量', '原始单价', '均摊后单价', '小计', '退货总额', '手动差价', '实际退货总额', '退货原因', '后台操作人', '创建时间', '退货处理状态', '退货处理时间'];
array_unshift($cellData, $headerCell);
$fileName = $type == 1 ? '联营退货订单导出'.date('_YmdHis') : '自营退货订单导出'.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)
{
// 订单类型
$apply_status = array(
'-1' => '已拒绝',
'1' => '待处理',
'10' => '已处理',
);
$tmp = array();
for ($i = 0; $i < count($order); $i++) {
// 推送人
if ($order[$i]['create_uid']) {
$sales = DB::table('user_info')->where(['userId' => $order[$i]['create_uid']])->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]['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]['currency'] = $order[$i]['currency'] == 1 ? 'RMB' : 'USD';
$tmp[$i]['refund_num'] = $order[$i]['refund_num'];
$tmp[$i]['goods_price'] = $order[$i]['goods_price'];
$tmp[$i]['single_pre_price'] = $order[$i]['single_pre_price'];
$tmp[$i]['goods_amount'] = $order[$i]['refund_num'] * $order[$i]['single_pre_price'];
if ($i > 0 && $tmp[$i]['order_id'] == $tmp[$i-1]['order_id']) {
$tmp[$i]['pay_amount'] = $order[$i]['pay_amount'];
$tmp[$i]['price_fall'] = $order[$i]['price_fall'];
$tmp[$i]['final_amount'] = $order[$i]['pay_amount'] - $order[$i]['price_fall'];
} else {
$tmp[$i]['pay_amount'] = '';
$tmp[$i]['price_fall'] = '';
$tmp[$i]['final_amount'] = '';
}
$tmp[$i]['refund_reason'] = $order[$i]['refund_reason'];
$tmp[$i]['sale_name'] = isset($sales) ? $sales->name : ''; // 推送业务员
$tmp[$i]['create_time'] = date('Y-m-d H:i:s', $order[$i]['create_time']);
$tmp[$i]['status'] = $apply_status[$order[$i]['status']];
$tmp[$i]['refund_time'] = $order[$i]['refund_time'] ? date('Y-m-d H:i:s', $order[$i]['refund_time']) : '';
unset($sales);
}
return $tmp;
}
}
\ No newline at end of file
...@@ -10,7 +10,7 @@ return [ ...@@ -10,7 +10,7 @@ return [
'search'=> 'http://' . env('LOGIN_DOMAIN', '') . '/api/search', 'search'=> 'http://' . env('LOGIN_DOMAIN', '') . '/api/search',
], ],
'domain' => 'liexin.com', 'domain' => 'liexin.net',
// 订单系统 // 订单系统
'order_url' => 'http://order.liexin.net', 'order_url' => 'http://order.liexin.net',
......
...@@ -404,6 +404,7 @@ ...@@ -404,6 +404,7 @@
$('.shop-table').delegate('.goods_num', 'blur', function() { $('.shop-table').delegate('.goods_num', 'blur', function() {
var self = $(this); var self = $(this);
var num = self.val(); var num = self.val();
var min_buy = Number(self.parents('tr').attr('min_buy'));
var cart_id = self.parents('tr').data('cid'); var cart_id = self.parents('tr').data('cid');
var type = self.parents('tr').data('type'); var type = self.parents('tr').data('type');
var user_id = 0; var user_id = 0;
...@@ -415,8 +416,16 @@ ...@@ -415,8 +416,16 @@
user_id = internal_uid ? internal_uid : user_id; user_id = internal_uid ? internal_uid : user_id;
if (num < min_buy) {
num = min_buy;
layer.msg('购买数量低于最小起订量,默认调整为最小起订量');
}
if (goods_type == 1) { // 联营需要选择交货地 if (goods_type == 1) { // 联营需要选择交货地
delivery_place = $('input[name=delivery_place]:checked').val(); delivery_place = $('input[name=delivery_place]:checked').val();
} else { // 自营数量需要结合倍数
var mpl = Number(self.parents('tr').find('.goods_mpl').text()); // 倍数
num = Math.ceil(num / mpl) * mpl;
} }
$.ajax({ $.ajax({
...@@ -724,18 +733,23 @@ ...@@ -724,18 +733,23 @@
if (len > 0) { if (len > 0) {
// 购物车列表 // 购物车列表
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
html += '<tr data-cid="'+list[i].cart_id+'" data-type="'+list[i].type+'">'+ html += '<tr data-cid="'+list[i].cart_id+'" data-type="'+list[i].type+'" min_buy="'+list[i].min_buy+'">'+
'<td>'+(i+1)+'</td>'+ '<td>'+(i+1)+'</td>'+
'<td class="goods_id">'+list[i].goods_id+'</td>'+ '<td class="goods_id">'+list[i].goods_id+'</td>'+
'<td>'+list[i].goods_name+'</td>'+ '<td>'+list[i].goods_name+'</td>'+
'<td>'+list[i].brand_name+'</td>'+ '<td>'+list[i].brand_name+'</td>';
'<td><input type="text" class="goods_num" name="goods_num" value="'+list[i].goods_number+'"></td>'+
'<td class="goods_price">'+list[i].goods_price+'</td>'+ if (goods_type == 2) {
'<td class="goods_amount">'+list[i].goods_amount_format+'</td>'+ html += '<td><span class="goods_mpl">'+list[i].mpl+'</span></td>';
'<td>'+list[i].delivery_time+'</td>'+ }
'<td>'+list[i].supplier_name+'</td>'+
'<td><a class="btn btn-danger btn-xs remove-goods">删除</a></td>'+ html += '<td><input type="text" class="goods_num" name="goods_num" value="'+list[i].goods_number+'"></td>'+
'</tr>'; '<td class="goods_price">'+list[i].goods_price+'</td>'+
'<td class="goods_amount">'+list[i].goods_amount_format+'</td>'+
'<td>'+list[i].delivery_time+'</td>'+
'<td>'+list[i].supplier_name+'</td>'+
'<td><a class="btn btn-danger btn-xs remove-goods">删除</a></td>'+
'</tr>';
cart_ids.push(list[i].cart_id); // 购物车ID集合 cart_ids.push(list[i].cart_id); // 购物车ID集合
} }
...@@ -748,6 +762,41 @@ ...@@ -748,6 +762,41 @@
var address_id = $('.address_id').val(); var address_id = $('.address_id').val();
self.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息 self.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息
} }
// 自营商品检查数量
if (goods_type == 2) {
var changeGoods = [];
$('.shop-table tbody tr').each(function() {
var goods_id = $(this).find('.goods_id').text();
var num = Number($(this).find('.goods_num').val());
var mpl = Number($(this).find('.goods_mpl').text());
var cart_id = $(this).data('cid');
var type = $(this).data('type');
if (num % mpl != 0) {
num = Math.ceil(num / mpl) * mpl;
$.ajax({
type: "POST",
url: '/ajax/changeNum',
data: {uid: user_id, num: num, cart_id: cart_id, type: type, goods_type: goods_type},
dataType: "json",
async: false,
success: function(resp){
if (resp.errcode == 0) {
changeGoods.push(goods_id);
}
},
})
}
})
if (changeGoods.length > 0) {
layer.alert('已按倍数调整购买数量,商品ID:'+changeGoods.join(', '));
self.lists(user_id, goods_type, is_online, delivery_place); // 加载购物车列表
}
}
} else { } else {
$('.shop-lists').hide(); $('.shop-lists').hide();
......
...@@ -339,6 +339,7 @@ ...@@ -339,6 +339,7 @@
case 2: title = '取消订单'; break; case 2: title = '取消订单'; break;
case 3: title = '订单审核不通过'; break; case 3: title = '订单审核不通过'; break;
case 4: title = '填写订单取消原因'; break; case 4: title = '填写订单取消原因'; break;
case 5: title = '填写退货退款原因'; break;
default: title = '填写订单取消原因'; break; default: title = '填写订单取消原因'; break;
} }
...@@ -381,7 +382,7 @@ ...@@ -381,7 +382,7 @@
title: title, title: title,
content: content, content: content,
btn:['确认', '取消'], btn:['确认', '取消'],
btn1:function(){ btn1:function(index){
var cancel_reason = $('input[name=cancel_reason]:checked').val(); var cancel_reason = $('input[name=cancel_reason]:checked').val();
var other_reason = $('textarea[name=input-other-reason]').val(); var other_reason = $('textarea[name=input-other-reason]').val();
...@@ -397,6 +398,15 @@ ...@@ -397,6 +398,15 @@
} }
} }
// 退货退款弹出层
if (type == 5) {
self.siblings('.refund_reason').val(cancel_reason);
self.siblings('.refund_reason_val').empty().text(cancel_reason);
layer.close(index);
return false; // 阻止继续执行
}
$.ajax({ $.ajax({
url:'/ajaxCancel', url:'/ajaxCancel',
data: {order_id: order_id, cancel_reason: cancel_reason, type: type}, data: {order_id: order_id, cancel_reason: cancel_reason, type: type},
...@@ -462,6 +472,9 @@ ...@@ -462,6 +472,9 @@
if(action_type=='changeOrder'){ if(action_type=='changeOrder'){
self.changeOrder(); self.changeOrder();
} }
if(action_type=='refund'){
self.refund();
}
self.selfOrder(); self.selfOrder();
self.cancelorder(); self.cancelorder();
...@@ -1755,6 +1768,175 @@ ...@@ -1755,6 +1768,175 @@
}) })
}, },
// 退货退款
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));
}
});
// 浮点数输入框限制
$('.float_num').off().on('keyup', function(){
var val = $(this).val();
if(!val) return false;
if(!(/^\d{0,7}(\.\d{0,4})?$/g.test(val))){//判断输入是否合法,不合法强制转换
if(isNaN(parseFloat(val))){
layer.msg('只能是数字');
$(this).val('');
}else{
$(this).val(parseFloat(val).toFixed(4));
}
}
if(val > 999999.9999){
$(this).val(999999.9999);
}
if(val.length > 11){
$(this).val(val.slice(0,11));
}
});
// 填写退货数量
$('.refund_num').keyup(function() {
var unshipped_num = parseInt($(this).parents('tr').find('.unshipped_num').val()); // 未发货数量
var single_pre_price = parseFloat($(this).parents('tr').find('.single_pre_price').val()); // 均摊单价
var val = $(this).val(); // 退货数量
if (val > unshipped_num) {
layer.msg('不能超过未发货数量');
$(this).val('');
}
// 退款小计
var single_amount = parseFloat(single_pre_price * val).toFixed(4);
$(this).parents('tr').find('.single_refund_amount').text(currency_sign + single_amount);
// 退款总额
var refund_total = 0;
$('.refund-table').find('tbody tr').each(function(){
var num = parseInt($(this).find('.refund_num').val()) || 0;
var price = parseFloat($(this).find('.single_pre_price').val()) || 0;
refund_total += parseFloat(num * price);
});
// 差价
var price_fall = $('.price_fall').val();
refund_amount = parseFloat(refund_total - price_fall).toFixed(2);
refund_total = refund_total.toFixed(2);
$('.all_refund_amount').val(refund_total);
$('.all_refund_amount_val').text(currency_sign + refund_total);
$('.refund_amount').text(currency_sign + refund_amount);
})
// 调整差价
$('.price_fall').keyup(function() {
var val = $(this).val();
var all_refund_amount = $('.all_refund_amount').val();
var refund_total = parseFloat(all_refund_amount - val).toFixed(2);
// 退款总额不存在,则差价设置为0
if (!all_refund_amount) {
$(this).val(0);
return false;
}
// 若差价大于或等于退款总额,则差价设置为0
if (parseFloat(val) >= parseFloat(all_refund_amount)) {
$(this).val(0);
$('.refund_amount').text(currency_sign + all_refund_amount);
return false;
}
$('.refund_amount').text(currency_sign + refund_total);
})
// 提交表单
$('.refundApply').click(function() {
var goods_count = 0; // 商品数量
var refund_eq_true = []; // 退货数量与未发货数量相等
var refund_empty = []; // 退货数量为空
// 表单退货数量
$('.refund-table').find('tbody tr').each(function(){
var num = parseInt($(this).find('.refund_num').val());
var unshipped_num = parseInt($(this).find('.unshipped_num').val());
// 为空标记
if (!num) refund_empty.push(0);
// 数量等于未发货数量标记
if (num == unshipped_num) refund_eq_true.push(1);
goods_count++;
});
if (refund_empty.length == goods_count) {
layer.msg('请填写退货数量');
return false;
}
if (refund_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;
}
layer.open({
title: '提示信息',
content: '确认提交退货申请?',
btn: ['确认', '取消'],
yes: function(index, layero){
$.ajax({
url : '/refund/' + order_id,
type: 'post',
data: $('#refundForm').serialize(),
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.href = '/details/' + order_id; // 退款列表
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
},
btn2: function(index, layero){
layer.close(index);
}
});
})
}
} }
}); });
......
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
refund:{
index: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(),
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
apply_status = $('#apply_status').val() ? $('#apply_status').val() : '';
if (url == '/refund_export') {
if (!order_sn && !sku_name && !time_start && !time_end && !apply_status) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
}
var listUrl = url;
listUrl += '?order_sn=' + order_sn;
if (sku_name) {
listUrl += '&sku_name=' + specialStr(sku_name);
}
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;
}
if (apply_status) {
listUrl += '&apply_status=' + apply_status;
}
if (!order_sn && !sku_name && !time_start && !time_end && !apply_status) {
listUrl = '/refund_order';
}
location.href = listUrl;
}
// 搜索
$('.search_refund_order').click(function(){
refundCommon('/refund_order');
})
// 导出订单
$('.refund_order_export').click(function() {
refundCommon('/refund_export');
})
}
}
});
})(jQuery)
\ No newline at end of file
...@@ -186,10 +186,11 @@ ...@@ -186,10 +186,11 @@
<th width="15%">SKUID</th> <th width="15%">SKUID</th>
<th width="20%">商品名称</th> <th width="20%">商品名称</th>
<th width="10%">制造商</th> <th width="10%">制造商</th>
<th width="5%">倍数</th>
<th width="10%">采购数量</th> <th width="10%">采购数量</th>
<th width="10%">采购单价</th> <th width="10%">采购单价</th>
<th width="10%">小计</th> <th width="10%">小计</th>
<th width="10%">货期</th> <th width="6%">货期</th>
<th width="10%">供应商</th> <th width="10%">供应商</th>
<th width="5%">操作</th> <th width="5%">操作</th>
</tr> </tr>
...@@ -202,7 +203,7 @@ ...@@ -202,7 +203,7 @@
<!-- 订单金额 --> <!-- 订单金额 -->
<div class="amount-section"> <div class="amount-section">
<p>应付金额:<span class="text-danger order_amount"></span></p> <p>(95折后)应付金额:<span class="text-danger order_amount"></span></p>
</div> </div>
</div> </div>
......
...@@ -322,10 +322,11 @@ ...@@ -322,10 +322,11 @@
<th width="15%">SKUID</th> <th width="15%">SKUID</th>
<th width="20%">商品名称</th> <th width="20%">商品名称</th>
<th width="10%">制造商</th> <th width="10%">制造商</th>
<th width="5%">倍数</th>
<th width="10%">采购数量</th> <th width="10%">采购数量</th>
<th width="10%">采购单价</th> <th width="10%">采购单价</th>
<th width="10%">小计</th> <th width="10%">小计</th>
<th width="10%">货期</th> <th width="6%">货期</th>
<th width="10%">供应商</th> <th width="10%">供应商</th>
<th width="5%">操作</th> <th width="5%">操作</th>
</tr> </tr>
......
...@@ -467,11 +467,43 @@ ...@@ -467,11 +467,43 @@
@if ($order_info['order_remark']) @if ($order_info['order_remark'])
<tr> <tr>
<td>订单备注信息:</td> <td>订单备注信息:</td>
<td colspan="8">{{$order_info['order_remark']}}</td> <td colspan="10">{{$order_info['order_remark']}}</td>
</tr> </tr>
@endif @endif
</tfoot> </tfoot>
</table> </table>
<!-- 退款已处理 -->
@if ($order_refund_info['status'] == 10 && $order_price_info['refund_price'] != 0)
<hr>
<table class="table">
<thead>
<tr class="caption">
<th>退款型号</th>
<th>退款数量</th>
<th>价格</th>
<th>小计</th>
</tr>
</thead>
<tbody>
@foreach ($order_refund_items as $k=>$v)
<tr>
<td>{{$v['goods_name']}}</td>
<td>{{$v['refund_num']}}</td>
<td>{{$currency . $v['single_pre_price']}}</td>
<td>{{$currency . number_format($v['refund_num'] * $v['single_pre_price'], 4)}}</td>
</tr>
@endforeach
<tr>
<td>手动差价</td>
<td></td>
<td></td>
<td>{{'-' . $order_refund_info['price_fall']}}</td>
</tr>
</tbody>
</table>
@endif
</div> </div>
<div class="tabs-box order-total table-responsive"> <div class="tabs-box order-total table-responsive">
...@@ -502,13 +534,22 @@ ...@@ -502,13 +534,22 @@
@if ($order_price_info['discount_amount'] != 0) @if ($order_price_info['discount_amount'] != 0)
<tr> <tr>
<td>优惠</td> <td>优惠金额</td>
<td class="edit-parent-td"> <td class="edit-parent-td">
{{$currency}}<span id="other_money">{{$order_price_info['discount_amount']}}</span> {{$currency}}<span id="other_money">{{$order_price_info['discount_amount']}}</span>
</td> </td>
</tr> </tr>
@endif @endif
@if (isset($order_price_info['refund_price']) && $order_price_info['refund_price'] != 0)
<tr>
<td>退款金额:</td>
<td class="edit-parent-td">
{{$currency}}<span id="other_money">{{$order_price_info['refund_price']}}</span>
</td>
</tr>
@endif
<tr> <tr>
<td>{{ isset($order_temp_info) && $order_temp_info['order_type'] == 3 ? '(自营内部采购下单享95折优惠)' : '' }}订单总额:</td> <td>{{ isset($order_temp_info) && $order_temp_info['order_type'] == 3 ? '(自营内部采购下单享95折优惠)' : '' }}订单总额:</td>
<td> <td>
...@@ -587,6 +628,11 @@ ...@@ -587,6 +628,11 @@
<!--自营对账--> <!--自营对账-->
@include('detail.selfCheckPay') @include('detail.selfCheckPay')
@endif @endif
@if ($action_name == 'refund')
<!--自营对账-->
@include('detail.refund')
@endif
<!-- 人工审单时去掉操作按钮 --> <!-- 人工审单时去掉操作按钮 -->
@if (!isset($_REQUEST['tags']) && $action_name != 'changeOrder' && $action_name != 'sendSales') @if (!isset($_REQUEST['tags']) && $action_name != 'changeOrder' && $action_name != 'sendSales')
...@@ -614,6 +660,10 @@ ...@@ -614,6 +660,10 @@
@if (in_array($order_info['status'], array(4, 7, 8, 10)) && in_array('order_send', $userPerms)) @if (in_array($order_info['status'], array(4, 7, 8, 10)) && in_array('order_send', $userPerms))
<!-- <a href="{{URL('send', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">订单发货</a> --> <!-- <a href="{{URL('send', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">订单发货</a> -->
@endif @endif
@if (in_array($order_info['status'], array(3, 4, 7)) && in_array('order_refund', $userPerms))
<a href="{{URL('refund', ['order_id'=>$order_info['order_id']])}}" class="btn btn-info order_refund">退货退款</a>
@endif
<!-- 已发货之后的状态 --> <!-- 已发货之后的状态 -->
@if ($order_info['status'] == 10) @if ($order_info['status'] == 10)
...@@ -768,7 +818,14 @@ ...@@ -768,7 +818,14 @@
</div> </div>
</div> </div>
<script> <script>
// 退款申请已处理或已拒绝,则隐藏退款按钮
var refund = "{{!empty($order_refund_info) && ($order_refund_info['status'] == -1 || $order_refund_info['status'] == 10) ? false : true}}";
if (refund) {
$('.order_refund').show();
} else {
$('.order_refund').hide();
}
$.lie.order.details(); $.lie.order.details();
</script> </script>
\ No newline at end of file
<p style="padding-left: 5px;">退货申请</p>
<div class="tabs-box">
<div class="order-change-main">
<form id="refundForm" class="form-horizontal table-responsive">
<input type="hidden" name="order_id" value="{{$order_info['order_id']}}">
<input type="hidden" name="goods_amount" value="{{$order_price_info['goods_price']}}">
<input type="hidden" name="order_amount" value="{{$order_info['order_amount']}}">
<!-- 退款型号 -->
<p>退款型号</p>
<table class="table table-bordered table-hover refund-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>
</thead>
<tbody>
@foreach ($unshippedItems as $v)
<tr>
<!-- <td><input type="checkbox" name="refund_info[{{$v['rec_id']}}]" value="{{$v['rec_id']}}"></td> -->
<td>
<span>{{$v['supplier_name']}}</span>
</td>
<td>
<span>{{$v['goods_name']}}</span>
</td>
<td>
<input type="hidden" name="refund_info[{{$v['rec_id']}}][unshipped_num]" class="unshipped_num" value="{{ $v['goods_number'] }}">
<span>{{$v['goods_number']}}</span>
</td>
<td>
<input type="hidden" name="refund_info[{{$v['rec_id']}}][single_pre_price]" class="single_pre_price" value="{{ $v['single_pre_price'] }}">
<span>{{$v['single_pre_price_format']}}</span>
</td>
<td>
<input class="only_number int_num refund_num" name="refund_info[{{$v['rec_id']}}][refund_num]" value="">
</td>
<td>
<span class="single_refund_amount"></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']}}</span></p>
</td>
</tr>
<tr>
<th>退款小计</th>
<td>
<input type="hidden" name="all_refund_amount" class="all_refund_amount" value="">
<span class="all_refund_amount_val"></span>
</td>
</tr>
<tr>
<th>调整差价</th>
<td><span> - </span><input class="only_number float_num price_fall" name="price_fall" value="0"></td>
</tr>
<tr>
<th>退款总额</th>
<td><span class="refund_amount"></span></td>
</tr>
<tr>
<th>退款原因</th>
<td>
<input type="hidden" class="refund_reason" name="refund_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>
</table>
<a class="btn btn-primary refundApply">提交</a>
</form>
</div>
</div>
<script>
var currency_sign = "{{$currency}}";
</script>
\ No newline at end of file
...@@ -11,3 +11,4 @@ ...@@ -11,3 +11,4 @@
<script src="/js/order.js"></script> <script src="/js/order.js"></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>
<!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">
<!-- layouts.navigation -->
<?php $isPage = false; ?>
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
<div class="row">
@include('refundDetails.content')
</div>
</div>
</div>
</body>
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<div class="tabs-box table-responsive">
<table class="table table-bordered order-express">
<tr>
<th width="10%">订单编号</th>
<td>{{$refund->order_sn}} <a href="/details/{{$refund->order_id}}" target="_blank" style="margin-left: 20px;">查看订单</a></td>
</tr>
<tr>
<th>用户账号</th>
<td>{{ App\Http\Controllers\getUserName($refund->create_uid) }}</td>
</tr>
<tr>
<th>申请时间</th>
<td>{{$refund->create_time ? date('Y-m-d H:i:s') : ''}}</td>
</tr>
<tr>
<th>申请状态</th>
<td>
<?php
switch ($refund->status) {
case -1: echo '已拒绝'; break;
case 1: echo '待处理'; break;
case 10: echo '已处理'; break;
}
?>
</td>
</tr>
<?php
$currencySign = $refund->currency == 1 ? '¥' : '$';
?>
<tr>
<th>订单金额</th>
<td>{{$currencySign}} {{ App\Http\Controllers\getOrderAmount($refund->order_id) }}</td>
</tr>
<tr>
<th>退款金额</th>
<td>{{$currencySign.$refund->pay_amount}}</td>
</tr>
<tr>
<th>手动差价</th>
<td>{{$currencySign.$refund->price_fall}}</td>
</tr>
<tr>
<th>最终退款总额</th>
<td>{{$currencySign.($refund->pay_amount - $refund->price_fall)}}</td>
</tr>
<tr>
<th>退款原因</th>
<td>{{$refund->refund_reason}}</td>
</tr>
<tr>
<th>退款型号</th>
<td>
@if ($refundItems)
<table class="table">
<thead>
<tr>
<th>退款型号</th>
<th>退款数量</th>
<th>价格</th>
<th>小计</th>
</tr>
</thead>
<tbody>
@foreach ($refundItems as $k=>$v)
<tr>
<td>{{$v->goods_name}}</td>
<td>{{$v->refund_num}}</td>
<td>{{$v->single_pre_price}}</td>
<td>{{number_format($v->refund_num * $v->single_pre_price, 4)}}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</td>
</tr>
</table>
</div>
</div>
</div>
<!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('refundlist.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>
<dl>
<dt>SKU名称:</dt>
<dd>
<input type="text" id="sku_name" name="sku_name" value="{{$condition['sku_name']}}" placeholder="请输入SKU名称">
</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>
<dl>
<dt>处理状态:</dt>
<dd>
<select id="apply_status" name="apply_status" class="form-control apply_status selectpicker" title="全部" multiple>
<option value="-1">已拒绝</option>
<option value="1">待处理</option>
<option value="10">已处理</option>
</select>
</dd>
</dl>
</td>
</tr>
</table>
<div class="text-center">
<div class="search-btn">
<button class="nbtn search_refund_order">搜索</button>
<button class="nbtn refund_order_export" 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['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['pay_amount']}}</td>
<td class="show-list">{{$currencySign.$v['price_fall']}}</td>
<td class="show-list">{{$currencySign.number_format($v['pay_amount'] - $v['price_fall'], 2)}}</td>
<td class="show-list">
<?php
switch ($v['status']) {
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 10: echo '<span class="list-text-success"><b>已处理</b></span>';break;
}
?>
</td>
<td class="show-list">{{$v['refund_time'] ? date('Y-m-d H:i:s', $v['refund_time']) : ''}}</td>
<td>
<div class="btn-group btn-group-xs">
<a class="btn btn-primary" href="/refund_details/{{$v['refund_id']}}" target="_blank">查看申请</a>
</div>
</td>
</tr>
@endforeach
</tbody>
@endif
</table>
</div>
<div class="row-fluid pagination">
<?php echo $page; ?>
</div>
</div>
</div>
<script>
var apply_status = "{{$condition['apply_status']}}";
$(".apply_status").selectpicker({
actionsBox:true, //在下拉选项添加选中所有和取消选中的按钮
countSelectedText:"已选中{0}项",
selectedTextFormat:"count > 5",
selectAllText: '全选',
deselectAllText: '取消全选',
})
$('.apply_status').selectpicker('val', apply_status.split(',')).trigger("change");
$.lie.refund.index();
</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