2019-05-24 13:57:10 +08:00
|
|
|
<?php
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
|
|
|
// +----------------------------------------------------------------------
|
2021-03-16 10:34:52 +08:00
|
|
|
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
|
2019-05-24 13:57:10 +08:00
|
|
|
// +----------------------------------------------------------------------
|
2021-03-16 10:34:52 +08:00
|
|
|
// | Licensed ( https://opensource.org/licenses/mit-license.php )
|
2019-05-24 13:57:10 +08:00
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Author: Devil
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\index\controller;
|
|
|
|
|
|
|
|
use app\service\OrderAftersaleService;
|
2019-12-24 15:18:56 +08:00
|
|
|
use app\service\SeoService;
|
2021-01-27 22:21:04 +08:00
|
|
|
use app\service\ResourcesService;
|
2019-05-24 13:57:10 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 订单售后
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 0.0.1
|
|
|
|
* @datetime 2016-12-01T21:51:08+0800
|
|
|
|
*/
|
|
|
|
class Orderaftersale extends Common
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 构造方法
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2018-11-30
|
|
|
|
* @desc description
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
// 是否登录
|
|
|
|
$this->IsLogin();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-30 23:32:16 +08:00
|
|
|
* 列表
|
2019-05-24 13:57:10 +08:00
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2018-09-28
|
|
|
|
* @desc description
|
|
|
|
*/
|
|
|
|
public function Index()
|
|
|
|
{
|
2020-06-30 23:32:16 +08:00
|
|
|
// 总数
|
|
|
|
$total = OrderAftersaleService::OrderAftersaleTotal($this->form_where);
|
2019-05-24 13:57:10 +08:00
|
|
|
|
|
|
|
// 分页
|
2020-06-30 23:32:16 +08:00
|
|
|
$page_params = [
|
|
|
|
'number' => $this->page_size,
|
|
|
|
'total' => $total,
|
|
|
|
'where' => $this->data_request,
|
|
|
|
'page' => $this->page,
|
|
|
|
'url' => MyUrl('index/orderaftersale/index'),
|
|
|
|
];
|
2019-05-24 13:57:10 +08:00
|
|
|
$page = new \base\Page($page_params);
|
|
|
|
|
2020-06-30 23:32:16 +08:00
|
|
|
// 获取数据列表
|
|
|
|
$data_params = [
|
|
|
|
'where' => $this->form_where,
|
|
|
|
'm' => $page->GetPageStarNumber(),
|
|
|
|
'n' => $this->page_size,
|
2020-10-29 00:33:25 +08:00
|
|
|
'order_by' => $this->form_order_by['data'],
|
2020-06-30 23:32:16 +08:00
|
|
|
'is_public' => 0,
|
|
|
|
];
|
|
|
|
$ret = OrderAftersaleService::OrderAftersaleList($data_params);
|
2019-05-24 13:57:10 +08:00
|
|
|
|
2019-12-24 15:18:56 +08:00
|
|
|
// 浏览器名称
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('订单售后', 1));
|
2019-12-24 15:18:56 +08:00
|
|
|
|
2020-06-30 23:32:16 +08:00
|
|
|
// 基础参数赋值
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('params', $this->data_request);
|
|
|
|
MyViewAssign('page_html', $page->GetPageHtml());
|
|
|
|
MyViewAssign('data_list', $ret['data']);
|
|
|
|
return MyView();
|
2019-05-24 13:57:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-30 23:32:16 +08:00
|
|
|
* 详情
|
2019-05-24 13:57:10 +08:00
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2019-05-21
|
|
|
|
* @desc description
|
|
|
|
*/
|
2020-06-30 23:32:16 +08:00
|
|
|
public function Detail()
|
2019-05-24 13:57:10 +08:00
|
|
|
{
|
|
|
|
// 参数
|
2020-06-30 23:32:16 +08:00
|
|
|
$order_id = isset($this->data_request['oid']) ? intval($this->data_request['oid']) : 0;
|
|
|
|
$order_detail_id = isset($this->data_request['did']) ? intval($this->data_request['did']) : 0;
|
2019-05-28 18:40:01 +08:00
|
|
|
$ret = OrderAftersaleService::OrdferGoodsRow($order_id, $order_detail_id, $this->user['id']);
|
2019-05-24 13:57:10 +08:00
|
|
|
if($ret['code'] == 0)
|
|
|
|
{
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('goods', $ret['data']['items']);
|
|
|
|
MyViewAssign('order', $ret['data']);
|
2019-05-24 13:57:10 +08:00
|
|
|
|
|
|
|
// 仅退款原因
|
|
|
|
$return_only_money_reason = MyC('home_order_aftersale_return_only_money_reason');
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('return_only_money_reason_list', empty($return_only_money_reason) ? [] : explode("\n", $return_only_money_reason));
|
2019-05-24 13:57:10 +08:00
|
|
|
|
|
|
|
// 退款退货原因
|
|
|
|
$return_money_goods_reason = MyC('home_order_aftersale_return_money_goods_reason');
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('return_money_goods_reason_list', empty($return_money_goods_reason) ? [] : explode("\n", $return_money_goods_reason));
|
2019-05-24 13:57:10 +08:00
|
|
|
|
|
|
|
// 获取当前订单商品售后最新的一条纪录
|
|
|
|
$data_params = [
|
|
|
|
'm' => 0,
|
|
|
|
'n' => 1,
|
|
|
|
'where' => [
|
2019-05-28 18:40:01 +08:00
|
|
|
['order_detail_id', '=', $order_detail_id],
|
2019-05-24 13:57:10 +08:00
|
|
|
['user_id', '=', $this->user['id']],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
$new_aftersale = OrderAftersaleService::OrderAftersaleList($data_params);
|
2019-10-04 16:28:59 +08:00
|
|
|
if(!empty($new_aftersale['data'][0]))
|
|
|
|
{
|
|
|
|
$new_aftersale_data = $new_aftersale['data'][0];
|
|
|
|
$new_aftersale_data['tips_msg'] = OrderAftersaleService::OrderAftersaleTipsMsg($new_aftersale_data);
|
|
|
|
} else {
|
|
|
|
$new_aftersale_data = [];
|
|
|
|
}
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('new_aftersale_data', $new_aftersale_data);
|
2019-10-04 16:28:59 +08:00
|
|
|
|
|
|
|
// 进度
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('step_data', OrderAftersaleService::OrderAftersaleStep($new_aftersale_data));
|
2019-05-24 13:57:10 +08:00
|
|
|
|
2019-05-30 16:30:06 +08:00
|
|
|
// 可退款退货
|
|
|
|
$returned = OrderAftersaleService::OrderAftersaleCalculation($order_id, $order_detail_id);
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('returned_data', $returned['data']);
|
2019-05-30 16:30:06 +08:00
|
|
|
|
2021-07-08 19:10:26 +08:00
|
|
|
// 退货地址
|
|
|
|
$return_goods_address = OrderAftersaleService::OrderAftersaleReturnGoodsAddress($order_id);
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('return_goods_address', $return_goods_address);
|
2021-07-08 19:10:26 +08:00
|
|
|
|
2019-05-24 13:57:10 +08:00
|
|
|
// 静态数据
|
2021-08-14 17:17:45 +08:00
|
|
|
MyViewAssign('common_order_aftersale_type_list', MyConst('common_order_aftersale_type_list'));
|
2019-05-24 13:57:10 +08:00
|
|
|
|
2019-06-03 21:35:27 +08:00
|
|
|
// 编辑器文件存放地址
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('editor_path_type', ResourcesService::EditorPathTypeValue(OrderAftersaleService::EditorAttachmentPathType($this->user['id'], $order_id, $order_detail_id)));
|
2019-06-03 21:35:27 +08:00
|
|
|
|
2021-07-08 19:10:26 +08:00
|
|
|
// 浏览器名称
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('订单售后详情', 1));
|
2021-07-08 19:10:26 +08:00
|
|
|
|
2020-08-20 23:38:41 +08:00
|
|
|
// 订单售后搜索form key
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('form_search_keywords_form_key', 'f0p');
|
|
|
|
MyViewAssign('params', $this->data_request);
|
|
|
|
return MyView();
|
2019-05-24 13:57:10 +08:00
|
|
|
} else {
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('msg', $ret['msg']);
|
|
|
|
return MyView('public/tips_error');
|
2019-05-24 13:57:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 申请售后创建
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2019-05-23
|
|
|
|
* @desc description
|
|
|
|
*/
|
|
|
|
public function Create()
|
|
|
|
{
|
2019-05-27 18:40:31 +08:00
|
|
|
// 是否ajax请求
|
|
|
|
if(!IS_AJAX)
|
|
|
|
{
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('msg', '非法访问');
|
|
|
|
return MyView('public/tips_error');
|
2019-05-27 18:40:31 +08:00
|
|
|
}
|
|
|
|
|
2020-06-30 23:32:16 +08:00
|
|
|
$params = $this->data_request;
|
2019-05-24 13:57:10 +08:00
|
|
|
$params['user'] = $this->user;
|
|
|
|
return OrderAftersaleService::AftersaleCreate($params);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户退货
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2019-05-23
|
|
|
|
* @desc description
|
|
|
|
*/
|
|
|
|
public function Delivery()
|
|
|
|
{
|
2019-05-27 18:40:31 +08:00
|
|
|
// 是否ajax请求
|
|
|
|
if(!IS_AJAX)
|
|
|
|
{
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('msg', '非法访问');
|
|
|
|
return MyView('public/tips_error');
|
2019-05-27 18:40:31 +08:00
|
|
|
}
|
|
|
|
|
2020-06-30 23:32:16 +08:00
|
|
|
$params = $this->data_request;
|
2019-05-24 13:57:10 +08:00
|
|
|
$params['user'] = $this->user;
|
|
|
|
return OrderAftersaleService::AftersaleDelivery($params);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 订单取消
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2018-09-30
|
|
|
|
* @desc description
|
|
|
|
*/
|
|
|
|
public function Cancel()
|
|
|
|
{
|
2019-05-27 18:40:31 +08:00
|
|
|
// 是否ajax请求
|
|
|
|
if(!IS_AJAX)
|
2019-05-24 13:57:10 +08:00
|
|
|
{
|
2021-07-18 23:42:10 +08:00
|
|
|
MyViewAssign('msg', '非法访问');
|
|
|
|
return MyView('public/tips_error');
|
2019-05-24 13:57:10 +08:00
|
|
|
}
|
2019-05-27 18:40:31 +08:00
|
|
|
|
2020-06-30 23:32:16 +08:00
|
|
|
$params = $this->data_post;
|
2019-05-27 18:40:31 +08:00
|
|
|
$params['user'] = $this->user;
|
|
|
|
return OrderAftersaleService::AftersaleCancel($params);
|
2019-05-24 13:57:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|