订单售后
parent
7f847e73b8
commit
ca68fd02de
|
|
@ -1257,6 +1257,9 @@ function ParamsChecked($data, $params)
|
|||
continue;
|
||||
}
|
||||
|
||||
// 数据类型,默认字符串类型
|
||||
$data_type = empty($v['data_type']) ? 'string' : $v['data_type'];
|
||||
|
||||
// 验证规则,默认isset
|
||||
$checked_type = isset($v['checked_type']) ? $v['checked_type'] : 'isset';
|
||||
switch($checked_type)
|
||||
|
|
@ -1311,7 +1314,12 @@ function ParamsChecked($data, $params)
|
|||
{
|
||||
return $v['error_msg'];
|
||||
}
|
||||
$length = mb_strlen($data[$v['key_name']], 'utf-8');
|
||||
if($data_type == 'array')
|
||||
{
|
||||
$length = count($data[$v['key_name']]);
|
||||
} else {
|
||||
$length = mb_strlen($data[$v['key_name']], 'utf-8');
|
||||
}
|
||||
$rule = explode(',', $v['checked_data']);
|
||||
if(count($rule) == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ namespace app\index\controller;
|
|||
use app\service\OrderService;
|
||||
use app\service\PaymentService;
|
||||
use app\service\GoodsCommentsService;
|
||||
use app\service\OrderAftersaleService;
|
||||
|
||||
/**
|
||||
* 订单管理
|
||||
|
|
@ -211,36 +212,13 @@ class Order extends Common
|
|||
{
|
||||
// 参数
|
||||
$params = input();
|
||||
$params['user'] = $this->user;
|
||||
$params['user_type'] = 'user';
|
||||
|
||||
// 条件
|
||||
$where = OrderService::OrderListWhere($params);
|
||||
|
||||
// 获取列表
|
||||
$data_params = array(
|
||||
'm' => 0,
|
||||
'n' => 1,
|
||||
'where' => $where,
|
||||
);
|
||||
$data = OrderService::OrderList($data_params);
|
||||
if(!empty($data['data'][0]))
|
||||
$order_id = isset($params['id']) ? intval($params['id']) : 0;
|
||||
$goods_id = isset($params['gid']) ? intval($params['gid']) : 0;
|
||||
$ret = OrderAftersaleService::OrdferGoodsRow($order_id, $goods_id, $this->user['id']);
|
||||
if($ret['code'] == 0)
|
||||
{
|
||||
// 商品处理
|
||||
$goods = [];
|
||||
if(!empty($data['data'][0]['items']))
|
||||
{
|
||||
foreach($data['data'][0]['items'] as $v)
|
||||
{
|
||||
if(isset($params['gid']) && $params['gid'] == $v['goods_id'])
|
||||
{
|
||||
$goods = $v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assign('goods', $goods);
|
||||
$this->assign('order', $data['data'][0]);
|
||||
$this->assign('goods', $ret['data']['items']);
|
||||
$this->assign('order', $ret['data']);
|
||||
|
||||
// 仅退款原因
|
||||
$return_only_money_reason = MyC('home_order_aftersale_return_only_money_reason');
|
||||
|
|
@ -250,14 +228,57 @@ class Order extends Common
|
|||
$return_money_goods_reason = MyC('home_order_aftersale_return_money_goods_reason');
|
||||
$this->assign('return_money_goods_reason_list', empty($return_money_goods_reason) ? [] : explode("\n", $return_money_goods_reason));
|
||||
|
||||
// 获取当前订单商品售后最新的一条纪录
|
||||
$data_params = [
|
||||
'm' => 0,
|
||||
'n' => 1,
|
||||
'where' => [
|
||||
['order_id', '=', $order_id],
|
||||
['goods_id', '=', $goods_id],
|
||||
['user_id', '=', $this->user['id']],
|
||||
],
|
||||
];
|
||||
$new_aftersale = OrderAftersaleService::OrderGoodsAftersaleList($data_params);
|
||||
$this->assign('new_aftersale_data', empty($new_aftersale['data'][0]) ? [] : $new_aftersale['data'][0]);
|
||||
|
||||
$this->assign('params', $params);
|
||||
return $this->fetch();
|
||||
} else {
|
||||
$this->assign('msg', '没有相关数据');
|
||||
$this->assign('msg', $ret['msg']);
|
||||
return $this->fetch('public/tips_error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请售后创建
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-05-23
|
||||
* @desc description
|
||||
*/
|
||||
public function AftersaleCreate()
|
||||
{
|
||||
$params = input();
|
||||
$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 AftersaleDelivery()
|
||||
{
|
||||
$params = input();
|
||||
$params['user'] = $this->user;
|
||||
return OrderAftersaleService::AftersaleDelivery($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
* @author Devil
|
||||
|
|
|
|||
|
|
@ -22,83 +22,101 @@
|
|||
<!-- content start -->
|
||||
<div class="user-content">
|
||||
<div class="user-content-body">
|
||||
{{if true }}
|
||||
<!-- 商品列表 -->
|
||||
{{if !empty($goods)}}
|
||||
<div class="am-panel am-panel-default order-base-panel">
|
||||
<div class="am-panel-bd">
|
||||
<table class="am-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="row-base">商品信息</th>
|
||||
<th class="row-price">单价</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="goods-detail">
|
||||
<a href="{{$goods.goods_url}}" target="_blank">
|
||||
<img src="{{$goods.images}}">
|
||||
</a>
|
||||
<div class="goods-base">
|
||||
<a href="{{$goods.goods_url}}" target="_blank" class="goods-title">{{$goods.title}}</a>
|
||||
{{if !empty($goods.spec)}}
|
||||
<ul class="goods-attr">
|
||||
{{foreach $goods.spec as $spec}}
|
||||
<li>{{$spec.type}}:{{$spec.value}}</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</div>
|
||||
<!-- 商品列表 -->
|
||||
{{if !empty($goods)}}
|
||||
<div class="am-panel am-panel-default order-base-panel">
|
||||
<div class="am-panel-bd">
|
||||
<table class="am-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="row-base">商品信息</th>
|
||||
<th class="row-price">单价</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="goods-detail">
|
||||
<a href="{{$goods.goods_url}}" target="_blank">
|
||||
<img src="{{$goods.images}}">
|
||||
</a>
|
||||
<div class="goods-base">
|
||||
<a href="{{$goods.goods_url}}" target="_blank" class="goods-title">{{$goods.title}}</a>
|
||||
{{if !empty($goods.spec)}}
|
||||
<ul class="goods-attr">
|
||||
{{foreach $goods.spec as $spec}}
|
||||
<li>{{$spec.type}}:{{$spec.value}}</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{if $goods['original_price'] gt 0}}
|
||||
<p class="original-price">¥{{$goods.original_price}}</p>
|
||||
{{/if}}
|
||||
<p class="line-price">¥{{$goods.price}} x {{$goods.buy_number}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="am-alert am-alert-secondary">
|
||||
{{if !empty($order.price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">商品总价:</div>
|
||||
<div class="items-detail am-fl">¥{{$order.price}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.increase_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">增加金额:</div>
|
||||
<div class="items-detail am-fl">+¥{{$order.increase_price}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.preferential_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">优惠金额:</div>
|
||||
<div class="items-detail am-fl">-¥{{$order.preferential_price}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.total_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">订单总价:</div>
|
||||
<div class="items-detail am-fl line-price">¥{{$order.total_price}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.pay_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">支付金额:</div>
|
||||
<div class="items-detail am-fl">
|
||||
<strong class="total-price-content">¥{{$order.pay_price}}</strong>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{if $goods['original_price'] gt 0}}
|
||||
<p class="original-price">¥{{$goods.original_price}}</p>
|
||||
{{/if}}
|
||||
<p class="line-price">¥{{$goods.price}} x {{$goods.buy_number}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="am-alert am-alert-secondary">
|
||||
{{if !empty($order.price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">商品总价:</div>
|
||||
<div class="items-detail am-fl">¥{{$order.price}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.increase_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">增加金额:</div>
|
||||
<div class="items-detail am-fl">+¥{{$order.increase_price}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.preferential_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">优惠金额:</div>
|
||||
<div class="items-detail am-fl">-¥{{$order.preferential_price}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.total_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">订单总价:</div>
|
||||
<div class="items-detail am-fl line-price">¥{{$order.total_price}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.pay_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">支付金额:</div>
|
||||
<div class="items-detail am-fl">
|
||||
<strong class="total-price-content">¥{{$order.pay_price}}</strong>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 是否存在进行中的数据 -->
|
||||
{{if empty($new_aftersale_data) or (isset($new_aftersale_data['status']) and in_array($new_aftersale_data['status'], [4,5]))}}
|
||||
<!-- 拒绝/关闭 -->
|
||||
{{if isset($new_aftersale_data['status']) and in_array($new_aftersale_data['status'], [3,4])}}
|
||||
{{switch $new_aftersale_data.status}}
|
||||
{{case 4}}
|
||||
<div class="am-alert am-alert-danger">
|
||||
当前订单商品售后申请已被拒绝!<a href="#">详情查看</a>
|
||||
</div>
|
||||
{{/case}}
|
||||
|
||||
{{case 5}}
|
||||
<div class="am-alert am-alert-warning">
|
||||
当前订单商品售后申请已关闭!<a href="#">详情查看</a>
|
||||
</div>
|
||||
{{/case}}
|
||||
{{/switch}}
|
||||
{{/if}}
|
||||
|
||||
<!-- 类型 -->
|
||||
<div class="am-cf aftersale-type">
|
||||
|
|
@ -128,12 +146,42 @@
|
|||
<!-- 表单 -->
|
||||
<div class="am-panel am-panel-default aftersale-form-panel none">
|
||||
<div class="am-panel-bd">
|
||||
{{include file="order/aftersale_form" /}}
|
||||
{{include file="order/aftersale_create" /}}
|
||||
</div>
|
||||
</div>
|
||||
{{else /}}
|
||||
<!-- 步骤 -->
|
||||
{{include file="order/aftersale_step" /}}
|
||||
|
||||
<!-- 状态环节 -->
|
||||
{{switch $new_aftersale_data.status}}
|
||||
{{case 0}}
|
||||
<div class="am-alert">
|
||||
当前订单商品售后已提交申请,等待管理员确认中!<a href="#">详情查看</a>
|
||||
</div>
|
||||
{{/case}}
|
||||
|
||||
{{case 1}}
|
||||
<div class="am-panel am-panel-default aftersale-form-panel">
|
||||
<div class="am-panel-bd">
|
||||
{{include file="order/aftersale_delivery" /}}
|
||||
</div>
|
||||
</div>
|
||||
{{/case}}
|
||||
|
||||
{{case 2}}
|
||||
<div class="am-alert">
|
||||
当前订单商品售后已退货,等待管理员审核中!<a href="#">详情查看</a>
|
||||
</div>
|
||||
{{/case}}
|
||||
|
||||
{{case 3}}
|
||||
<div class="am-alert am-alert-success">
|
||||
当前订单商品售后已处理结束!<a href="#">详情查看</a>
|
||||
</div>
|
||||
{{/case}}
|
||||
{{/switch}}
|
||||
{{/if}}
|
||||
{{else /}}
|
||||
<div class="table-no"><i class="am-icon-warning"></i> 你已进行过评论</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<form class="am-form form-validation view-save" action="{{:PluginsHomeUrl('answers', 'index', 'answer')}}" method="POST" request-type="ajax-reload">
|
||||
<form class="am-form form-validation view-save" action="{{:MyUrl('index/order/aftersalecreate')}}" method="POST" request-type="ajax-reload">
|
||||
<div class="am-form-group">
|
||||
<label>退款原因<span class="am-form-group-label-tips-must">必选</span></label>
|
||||
<select name="reason" class="chosen-select" data-placeholder="退款原因..." data-validation-message="请选择退款原因" data-only-json='{{:json_encode($return_only_money_reason_list)}}' data-goods-json='{{:json_encode($return_money_goods_reason_list)}}' required>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<form class="am-form form-validation view-save" action="{{:MyUrl('index/order/aftersaledelivery')}}" method="POST" request-type="ajax-reload">
|
||||
<div class="am-form-group">
|
||||
<label>快递名称<span class="am-form-group-label-tips-must">必选</span></label>
|
||||
<input type="text" name="express_name" class="am-radius" placeholder="快递名称" minlength="1" maxlength="60" data-validation-message="快递名称格式 1~60 个字符之间" required />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label>快递单号<span class="am-form-group-label-tips-must">必填</span></label>
|
||||
<input type="text" name="express_number" class="am-radius" placeholder="快递单号" minlength="1" maxlength="60" data-validation-message="快递单号格式 1~60 个字符之间" required />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-form-group-refreshing">
|
||||
<input type="hidden" name="id" value="{{$new_aftersale_data.id}}" />
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">提交</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -1,43 +1,57 @@
|
|||
<ul class="aftersale-step am-cf am-text-center return-only-money-step none">
|
||||
<li class="am-text-truncate selected">
|
||||
<ul class="aftersale-step am-cf am-text-center return-only-money-step {{if empty($new_aftersale_data) or $new_aftersale_data['status'] gt 3 or $new_aftersale_data['type'] eq 1}}none{{/if}}">
|
||||
<li class="am-text-truncate selected {{if empty($new_aftersale_data) or $new_aftersale_data['status'] gt 3}} selected-end{{/if}}">
|
||||
<span class="number">1</span>
|
||||
<span class="text">用户申请仅退款</span>
|
||||
<span class="text">申请仅退款</span>
|
||||
<i class="am-icon-caret-right"></i>
|
||||
<i class="am-icon-angle-right"></i>
|
||||
</li>
|
||||
<li class="am-text-truncate selected selected-end">
|
||||
<li class="am-text-truncate {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] elt 3 and $new_aftersale_data['status'] egt 0}} selected{{/if}} {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] eq 0}} selected-end{{/if}}">
|
||||
<span class="number">2</span>
|
||||
<span class="text">管理员处理退款申请</span>
|
||||
<i class="am-icon-caret-right"></i>
|
||||
<span class="text">管理员审核</span>
|
||||
{{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] elt 3 and $new_aftersale_data['status'] egt 0}}
|
||||
<i class="am-icon-caret-right"></i>
|
||||
{{/if}}
|
||||
<i class="am-icon-angle-right"></i>
|
||||
</li>
|
||||
<li class="am-text-truncate">
|
||||
<li class="am-text-truncate {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] elt 3 and $new_aftersale_data['status'] eq 3}} selected{{/if}}">
|
||||
<span class="number">3</span>
|
||||
<span class="text">退款完毕</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="aftersale-step am-cf am-text-center return-money-goods-step none">
|
||||
<li class="am-text-truncate selected">
|
||||
<ul class="aftersale-step am-cf am-text-center return-money-goods-step {{if empty($new_aftersale_data) or $new_aftersale_data['status'] gt 3 or $new_aftersale_data['type'] eq 0}}none{{/if}}">
|
||||
<li class="am-text-truncate selected {{if empty($new_aftersale_data) or $new_aftersale_data['status'] gt 3}} selected-end{{/if}}">
|
||||
<span class="number">1</span>
|
||||
<span class="text">用户申请退货退款</span>
|
||||
<span class="text">申请退货退款</span>
|
||||
<i class="am-icon-caret-right"></i>
|
||||
<i class="am-icon-angle-right"></i>
|
||||
</li>
|
||||
<li class="am-text-truncate selected">
|
||||
<li class="am-text-truncate {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] elt 2 and $new_aftersale_data['status'] egt 0}} selected{{/if}} {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] eq 0}} selected-end{{/if}}">
|
||||
<span class="number">2</span>
|
||||
<span class="text">管理员处理退货申请</span>
|
||||
<i class="am-icon-caret-right"></i>
|
||||
<span class="text">管理员确认</span>
|
||||
{{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] elt 2 and $new_aftersale_data['status'] egt 0}}
|
||||
<i class="am-icon-caret-right"></i>
|
||||
{{/if}}
|
||||
<i class="am-icon-angle-right"></i>
|
||||
</li>
|
||||
<li class="am-text-truncate selected selected-end">
|
||||
<li class="am-text-truncate {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] elt 3 and $new_aftersale_data['status'] egt 1}} selected{{/if}} {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] eq 1}} selected-end{{/if}}">
|
||||
<span class="number">3</span>
|
||||
<span class="text">用户退货</span>
|
||||
<i class="am-icon-caret-right"></i>
|
||||
{{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] elt 3 and $new_aftersale_data['status'] egt 1}}
|
||||
<i class="am-icon-caret-right"></i>
|
||||
{{/if}}
|
||||
<i class="am-icon-angle-right"></i>
|
||||
</li>
|
||||
<li class="am-text-truncate">
|
||||
<li class="am-text-truncate {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] elt 3 and $new_aftersale_data['status'] egt 2}} selected{{/if}} {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] eq 2}} selected-end{{/if}}">
|
||||
<span class="number">4</span>
|
||||
<span class="text">管理员审核</span>
|
||||
{{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] elt 3 and $new_aftersale_data['status'] egt 2}}
|
||||
<i class="am-icon-caret-right"></i>
|
||||
{{/if}}
|
||||
<i class="am-icon-angle-right"></i>
|
||||
</li>
|
||||
<li class="am-text-truncate {{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] eq 3}} selected{{/if}}">
|
||||
<span class="number">5</span>
|
||||
<span class="text">退款完毕</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -38,6 +38,7 @@
|
|||
<script type='text/javascript' src="{{$Think.__MY_ROOT_PUBLIC__}}static/common/lib/amazeui-switch/amazeui.switch.min.js?v={{:MyC('home_static_cache_version')}}"></script>
|
||||
<script type='text/javascript' src="{{$Think.__MY_ROOT_PUBLIC__}}static/common/lib/amazeui-chosen/amazeui.chosen.min.js?v={{:MyC('home_static_cache_version')}}"></script>
|
||||
<script type='text/javascript' src="{{$Think.__MY_ROOT_PUBLIC__}}static/common/lib/amazeui-dialog/amazeui.dialog.min.js?v={{:MyC('home_static_cache_version')}}"></script>
|
||||
<script type='text/javascript' src="{{$Think.__MY_ROOT_PUBLIC__}}static/common/lib/amazeui-tagsinput/amazeui.tagsinput.min.js?v={{:MyC('home_static_cache_version')}}"></script>
|
||||
|
||||
<!-- 图像裁剪插件 -->
|
||||
<script type='text/javascript' src="{{$Think.__MY_ROOT_PUBLIC__}}static/common/lib/cropper/cropper.min.js?v={{:MyC('home_static_cache_version')}}"></script>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
<link rel="stylesheet" type="text/css" href="{{$Think.__MY_ROOT_PUBLIC__}}static/common/lib/amazeui-switch/amazeui.switch.css?v={{:MyC('home_static_cache_version')}}" />
|
||||
<link rel="stylesheet" type="text/css" href="{{$Think.__MY_ROOT_PUBLIC__}}static/common/lib/amazeui-chosen/amazeui.chosen.css?v={{:MyC('home_static_cache_version')}}" />
|
||||
<link rel="stylesheet" type="text/css" href="{{$Think.__MY_ROOT_PUBLIC__}}static/common/lib/cropper/cropper.min.css?v={{:MyC('home_static_cache_version')}}" />
|
||||
<link rel="stylesheet" type="text/css" href="{{$Think.__MY_ROOT_PUBLIC__}}static/common/lib/amazeui-tagsinput/amazeui.tagsinput.css?v={{:MyC('home_static_cache_version')}}" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{{$Think.__MY_ROOT_PUBLIC__}}static/common/css/common.css?v={{:MyC('home_static_cache_version')}}" />
|
||||
<link rel="stylesheet" type="text/css" href="{{$Think.__MY_ROOT_PUBLIC__}}static/index/{{$default_theme}}/css/common.css?v={{:MyC('home_static_cache_version')}}" />
|
||||
|
|
|
|||
|
|
@ -99,10 +99,7 @@ class Hook
|
|||
];
|
||||
|
||||
// 金额
|
||||
if($params['data']['base']['increase_price'] > 0)
|
||||
{
|
||||
$params['data']['base']['increase_price'] -= $price;
|
||||
}
|
||||
$params['data']['base']['preferential_price'] += $price;
|
||||
if($params['data']['base']['actual_price'] > 0)
|
||||
{
|
||||
$params['data']['base']['actual_price'] -= $price;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
namespace app\plugins\touristbuy;
|
||||
|
||||
use think\Controller;
|
||||
use app\plugins\touristbuy\Service;
|
||||
use app\plugins\touristbuy\service\Service;
|
||||
use app\service\PluginsService;
|
||||
use app\service\UserService;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,338 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Devil
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\service;
|
||||
|
||||
use think\Db;
|
||||
use think\facade\Hook;
|
||||
|
||||
/**
|
||||
* 订单售后服务层
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class OrderAftersaleService
|
||||
{
|
||||
// 订单售后状态
|
||||
public static $order_aftersale_status_list = [
|
||||
0 => '待确认',
|
||||
1 => '待退货',
|
||||
2 => '待审核',
|
||||
3 => '已完成',
|
||||
4 => '已拒绝',
|
||||
5 => '已取消',
|
||||
];
|
||||
|
||||
/**
|
||||
* 获取一条订单,附带一条指定商品
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-05-23
|
||||
* @desc description
|
||||
* @param [int] $order_id [订单id]
|
||||
* @param [int] $goods_id [商品id]
|
||||
* @param [int] $user_id [用户id]
|
||||
*/
|
||||
public static function OrdferGoodsRow($order_id, $goods_id, $user_id)
|
||||
{
|
||||
// 获取列表
|
||||
$data_params = array(
|
||||
'm' => 0,
|
||||
'n' => 1,
|
||||
'where' => [
|
||||
'id' => intval($order_id),
|
||||
'user_id' => intval($user_id),
|
||||
'is_delete_time' => 0,
|
||||
],
|
||||
);
|
||||
$ret = OrderService::OrderList($data_params);
|
||||
if($ret['code'] == 0 && !empty($ret['data'][0]))
|
||||
{
|
||||
// 商品处理
|
||||
$goods = [];
|
||||
if(!empty($ret['data'][0]['items']))
|
||||
{
|
||||
foreach($ret['data'][0]['items'] as $v)
|
||||
{
|
||||
if($goods_id == $v['goods_id'])
|
||||
{
|
||||
$goods = $v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$ret['data'][0]['items'] = $goods;
|
||||
$ret['data'] = $ret['data'][0];
|
||||
|
||||
return $ret;
|
||||
}
|
||||
return DataReturn('没有相关数据', -100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 售后创建
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-05-23
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function AftersaleCreate($params = [])
|
||||
{
|
||||
// 请求参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'order_id',
|
||||
'error_msg' => '订单id有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'goods_id',
|
||||
'error_msg' => '商品id有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'in',
|
||||
'key_name' => 'type',
|
||||
'checked_data' => [0,1],
|
||||
'error_msg' => '操作类型有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'fun',
|
||||
'key_name' => 'price',
|
||||
'checked_data' => 'CheckPrice',
|
||||
'error_msg' => '退款金额格式有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'length',
|
||||
'key_name' => 'reason',
|
||||
'checked_data' => '180',
|
||||
'error_msg' => '退款原因最多 180 个字符',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'length',
|
||||
'key_name' => 'msg',
|
||||
'checked_data' => '5,200',
|
||||
'error_msg' => '退款说明 5~200 个字符之间',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'length',
|
||||
'key_name' => 'images',
|
||||
'data_type' => 'array',
|
||||
'is_checked' => 1,
|
||||
'checked_data' => '3',
|
||||
'error_msg' => '凭证图片不能超过3张',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'user',
|
||||
'error_msg' => '用户信息有误',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 获取订单数据
|
||||
$order = self::OrdferGoodsRow($params['order_id'], $params['goods_id'], $params['user']['id']);
|
||||
if($order['code'] != 0)
|
||||
{
|
||||
return $order;
|
||||
}
|
||||
|
||||
// 当前是否存在进行中
|
||||
$where = [
|
||||
['order_id', '=', intval($params['order_id'])],
|
||||
['goods_id', '=', intval($params['goods_id'])],
|
||||
['user_id', '=', $params['user']['id']],
|
||||
['status', '<=', 1],
|
||||
];
|
||||
$count = (int) Db::name('OrderAftersale')->where($where)->count();
|
||||
if($count > 0)
|
||||
{
|
||||
return DataReturn('当前订单商品售后正在进行中,请勿重复申请', -1);
|
||||
}
|
||||
|
||||
// 获取历史申请售后条件
|
||||
$where = [
|
||||
['order_id', '=', intval($params['order_id'])],
|
||||
['goods_id', '=', intval($params['goods_id'])],
|
||||
['user_id', '=', $params['user']['id']],
|
||||
['status', '<=', 2],
|
||||
];
|
||||
|
||||
// 退款金额
|
||||
$price = PriceNumberFormat($params['price']);
|
||||
|
||||
// 历史退款金额
|
||||
$history_price = PriceNumberFormat(Db::name('OrderAftersale')->where($where)->sum('price'));
|
||||
if($price+$history_price > $order['data']['pay_price'])
|
||||
{
|
||||
return DataReturn('退款金额大于支付金额[ 历史退款 '.$history_price.' ]', -1);
|
||||
}
|
||||
|
||||
// 退货数量
|
||||
$number = isset($params['number']) ? intval($params['number']) : 0;
|
||||
|
||||
// 历史退货数量
|
||||
$history_number = (int) Db::name('OrderAftersale')->where($where)->sum('number');
|
||||
if($params['type'] == 1)
|
||||
{
|
||||
if($number+$history_number > $order['data']['items']['buy_number'])
|
||||
{
|
||||
return DataReturn('退货数量大于购买数量[ 历史退货数量 '.$history_number.' ]', -1);
|
||||
}
|
||||
}
|
||||
|
||||
// 附件处理
|
||||
$images = [];
|
||||
if(!empty($params['images']) && is_array($params['images']))
|
||||
{
|
||||
foreach($params['images'] as $v)
|
||||
{
|
||||
$images[] = ResourcesService::AttachmentPathHandle($v);
|
||||
}
|
||||
}
|
||||
|
||||
// 数据
|
||||
$data = [
|
||||
'type' => intval($params['type']),
|
||||
'order_id' => intval($params['order_id']),
|
||||
'goods_id' => intval($params['goods_id']),
|
||||
'user_id' => $params['user']['id'],
|
||||
'number' => ($params['type'] == 0) ? 0 : $number,
|
||||
'price' => $price,
|
||||
'reason' => $params['reason'],
|
||||
'msg' => $params['msg'],
|
||||
'images' => json_encode($images),
|
||||
'add_time' => time(),
|
||||
'apply_time' => time(),
|
||||
];
|
||||
if(Db::name('OrderAftersale')->insertGetId($data) > 0)
|
||||
{
|
||||
return DataReturn('申请成功', 0);
|
||||
}
|
||||
return DataReturn('申请失败', -100);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-05-23
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function AftersaleDelivery($params = [])
|
||||
{
|
||||
// 请求参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'id',
|
||||
'error_msg' => '操作id有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'length',
|
||||
'key_name' => 'express_name',
|
||||
'checked_data' => '1,60',
|
||||
'error_msg' => '快递名称格式 1~60 个字符之间',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'length',
|
||||
'key_name' => 'express_number',
|
||||
'checked_data' => '1,60',
|
||||
'error_msg' => '快递单号格式 1~60 个字符之间',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'user',
|
||||
'error_msg' => '用户信息有误',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 获取申请数据
|
||||
$where = [
|
||||
'id' => intval($params['id']),
|
||||
'user_id' => $params['user']['id'],
|
||||
];
|
||||
$aftersale = Db::name('OrderAftersale')->where($where)->find();
|
||||
if(empty($aftersale))
|
||||
{
|
||||
return DataReturn('数据不存在或已删除', -1);
|
||||
}
|
||||
|
||||
// 状态
|
||||
if($aftersale['type'] == 0)
|
||||
{
|
||||
return DataReturn('该售后订单为仅退款,不能操作退货操作', -1);
|
||||
}
|
||||
if($aftersale['status'] != 1)
|
||||
{
|
||||
return DataReturn('该售后订单状态不可操作['.self::$order_aftersale_status_list[$aftersale['status']].']', -10);
|
||||
}
|
||||
|
||||
// 数据
|
||||
$data = [
|
||||
'status' => 2,
|
||||
'express_name' => $params['express_name'],
|
||||
'express_number' => $params['express_number'],
|
||||
'delivery_time' => time(),
|
||||
'upd_time' => time(),
|
||||
];
|
||||
if(Db::name('OrderAftersale')->where($where)->update($data))
|
||||
{
|
||||
return DataReturn('操作成功', 0);
|
||||
}
|
||||
return DataReturn('操作失败', -100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单商品售后纪录列表
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-05-23
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function OrderGoodsAftersaleList($params = [])
|
||||
{
|
||||
$where = empty($params['where']) ? [] : $params['where'];
|
||||
$m = isset($params['m']) ? intval($params['m']) : 0;
|
||||
$n = isset($params['n']) ? intval($params['n']) : 10;
|
||||
$field = empty($params['field']) ? '*' : $params['field'];
|
||||
$order_by = empty($params['order_by']) ? 'id desc' : $params['order_by'];
|
||||
|
||||
// 获取数据列表
|
||||
$data = Db::name('OrderAftersale')->field($field)->where($where)->limit($m, $n)->order($order_by)->select();
|
||||
if(!empty($data))
|
||||
{
|
||||
foreach($data as &$v)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
return DataReturn('获取成功', 0, $data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -258,6 +258,12 @@ ul.plug-file-upload-view-video li {
|
|||
border-color: #fff0e4;
|
||||
color: #f37b1d;
|
||||
}
|
||||
.am-alert a {
|
||||
color: #d2354c;
|
||||
}
|
||||
.am-alert-danger a {
|
||||
color: #136ed9;
|
||||
}
|
||||
.am-input-radius input.am-form-field {
|
||||
border-bottom-left-radius: 2px;
|
||||
border-top-left-radius: 2px;
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@
|
|||
width: 33.33%;
|
||||
}
|
||||
.return-money-goods-step li {
|
||||
width: 25%;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ ul.progress li.current .title {
|
|||
.original-price { color: #9c9c9c; text-decoration: line-through; }
|
||||
.line-price { color: #3c3c3c; }
|
||||
.line-price, strong.total-price-content, strong.total-price-content { font-weight: 700; font-family: Verdana,Tahoma,arial; }
|
||||
strong.total-price-content { color: #d2364c; font-size: 16px; }
|
||||
strong.total-price-content { color: #d2364c; }
|
||||
.am-table { margin-bottom: 10px; }
|
||||
.am-table > tbody > tr > td { border-top: 1px solid #F5F5F5; }
|
||||
.am-table > thead > tr > th { border-bottom: 1px solid #f7f7f7; }
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ ul.progress li.current .title {
|
|||
.original-price { color: #9c9c9c; text-decoration: line-through; }
|
||||
.line-price { color: #3c3c3c; }
|
||||
.line-price, strong.total-price-content, strong.total-price-content { font-weight: 700; font-family: Verdana,Tahoma,arial; }
|
||||
strong.total-price-content { color: #d2364c; font-size: 16px; }
|
||||
strong.total-price-content { color: #d2364c; }
|
||||
.am-table { margin-bottom: 10px; }
|
||||
.am-table > tbody > tr > td { border-top: 1px solid #F5F5F5; }
|
||||
.am-table > thead > tr > th { border-bottom: 1px solid #f7f7f7; }
|
||||
|
|
@ -11,7 +11,6 @@
|
|||
line-height: 24px;
|
||||
}
|
||||
.user-content-body .wallet-cash-auth-tips ul li a {
|
||||
color: #0085ef;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue