订单售后优化
parent
fb2bffffa0
commit
a495a8df8f
|
|
@ -106,6 +106,9 @@ class Order extends Common
|
|||
// 评价状态
|
||||
$this->assign('common_comments_status_list', lang('common_comments_status_list'));
|
||||
|
||||
// 平台
|
||||
$this->assign('common_platform_type', lang('common_platform_type'));
|
||||
|
||||
// Excel地址
|
||||
$this->assign('excel_url', MyUrl('admin/order/excelexport', input()));
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class Orderaftersale extends Common
|
|||
'total' => $total,
|
||||
'where' => $params,
|
||||
'page' => isset($params['page']) ? intval($params['page']) : 1,
|
||||
'url' => MyUrl('index/orderaftersale/index'),
|
||||
'url' => MyUrl('admin/orderaftersale/index'),
|
||||
);
|
||||
$page = new \base\Page($page_params);
|
||||
$this->assign('page_html', $page->GetPageHtml());
|
||||
|
|
|
|||
|
|
@ -65,9 +65,18 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>来源:</span>
|
||||
<select name="client_type" class="chosen-select" data-placeholder="来源客户端...">
|
||||
<option value="">来源客户端...</option>
|
||||
{{foreach $common_platform_type as $v}}
|
||||
<option value="{{$v.value}}" {{if isset($params['client_type']) and $params['client_type'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
|
||||
{{/foreach}}
|
||||
</select>
|
||||
</td>
|
||||
<td class="time">
|
||||
<span>时间:</span>
|
||||
<span>时间:</span>
|
||||
<span>
|
||||
<input type="text" autocomplete="off" name="time_start" class="am-form-field am-input-sm am-radius Wdate" placeholder="起始时间" value="{{if !empty($params.time_start)}}{{$params.time_start}}{{/if}}" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
|
||||
</span>
|
||||
|
|
@ -76,6 +85,9 @@
|
|||
<input type="text" autocomplete="off" name="time_end" class="am-form-field am-input-sm am-radius Wdate" placeholder="结束时间" value="{{if !empty($params.time_end)}}{{$params.time_end}}{{/if}}" pattern="^[0-9]{4}-[0-9]{2}-[0-9]{2}$" data-validation-message="日期格式有误" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" autocomplete="off" /><i class="am-icon-calendar"></i>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">搜索</button>
|
||||
<a href="{{:MyUrl('admin/order/index')}}" class="am-btn am-btn-warning am-radius am-btn-sm reset-submit">清除条件</a>
|
||||
|
|
@ -128,7 +140,10 @@
|
|||
{{$vs.spec_text}}
|
||||
{{/if}}
|
||||
</span>
|
||||
<span class="fr">{{$vs.price}}x{{$vs.buy_number}}</span>
|
||||
{{if $vs['returned_quantity'] gt 0 or $vs['refund_price'] gt 0}}
|
||||
<span class="am-text-danger am-fr am-margin-left-sm">已退 {{$vs.returned_quantity}} / {{$vs.refund_price}}</span>
|
||||
{{/if}}
|
||||
<span class="am-fr">{{$vs.price}}x{{$vs.buy_number}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/foreach}}
|
||||
|
|
@ -153,14 +168,14 @@
|
|||
<span class="block">{{$v.status_name}}</span>
|
||||
|
||||
{{if $v['pay_status'] eq 1}}
|
||||
<span class="block cr-green fs-12">{{$v.pay_status_name}}</span>
|
||||
<span class="block am-text-success fs-12">{{$v.pay_status_name}}</span>
|
||||
{{elseif $v['pay_status'] gt 1 /}}
|
||||
<span class="block cr-yellow fs-12">{{$v.pay_status_name}}</span>
|
||||
<span class="block am-text-danger fs-12">{{$v.pay_status_name}}</span>
|
||||
{{else /}}
|
||||
<span class="block fs-12">{{$v.pay_status_name}}</span>
|
||||
{{/if}}
|
||||
{{if $v['user_is_delete_time'] neq 0}}
|
||||
<span class="block cr-red fs-12">用户已删除</span>
|
||||
<span class="block am-text-warning fs-12">用户已删除</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
|
|
@ -217,6 +232,9 @@
|
|||
<span class="fl fs-12">
|
||||
编码:{{$vs.spec_coding}}
|
||||
</span>
|
||||
{{if $vs['returned_quantity'] gt 0 or $vs['refund_price'] gt 0}}
|
||||
<span class="am-text-danger am-fr am-margin-left-sm">已退 {{$vs.returned_quantity}} / {{$vs.refund_price}}</span>
|
||||
{{/if}}
|
||||
<span class="fr">{{$vs.price}}x{{$vs.buy_number}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -241,6 +259,9 @@
|
|||
<dt>快递信息</dt>
|
||||
<dd>{{if empty($v['express_name'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.express_name}}<br />{{$v.express_number}}{{/if}}</dd>
|
||||
|
||||
<dt>客户端类型</dt>
|
||||
<dd>{{if empty($v['client_type_name'])}}<span class="cr-ddd">未知</span>{{else /}}<span class="am-badge am-badge-secondary am-radius">{{$v.client_type_name}}{{/if}}</span></dd>
|
||||
|
||||
<dt>支付状态</dt>
|
||||
<dd>{{if empty($v['pay_status_name'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.pay_status_name}}{{/if}}</dd>
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@
|
|||
类型:{{$v.type_text}}<br />
|
||||
原因:{{$v.reason}}<br />
|
||||
数量:{{$v.number}}<br />
|
||||
金额:<span class="am-text-warning">¥{{$v.price}}</span><br />
|
||||
金额:<span class="am-text-danger">¥{{$v.price}}</span><br />
|
||||
说明:{{$v.msg}}<br />
|
||||
时间:{{$v.apply_time_time}}
|
||||
</td>
|
||||
|
|
@ -147,7 +147,7 @@
|
|||
<td class="am-hide-sm-only">
|
||||
<p>{{$v.status_text}}</p>
|
||||
{{if $v['status'] eq 3 and !empty($v['refundment_text'])}}
|
||||
<span class="am-badge am-badge-success am-margin-top-xs">{{$v.refundment_text}}</span>
|
||||
<span class="am-badge am-badge-success am-radius am-margin-top-xs">{{$v.refundment_text}}</span>
|
||||
{{/if}}
|
||||
{{if $v['status'] eq 4 and !empty($v['refuse_reason'])}}
|
||||
<span class="am-text-danger">{{$v.refuse_reason}}</span>
|
||||
|
|
@ -214,7 +214,7 @@
|
|||
类型:{{$v.type_text}}<br />
|
||||
原因:{{$v.reason}}<br />
|
||||
数量:{{$v.number}}<br />
|
||||
金额:<span class="am-text-warning">¥{{$v.price}}</span><br />
|
||||
金额:<span class="am-text-danger">¥{{$v.price}}</span><br />
|
||||
说明:{{$v.msg}}<br />
|
||||
时间:{{$v.apply_time_time}}
|
||||
</dd>
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@
|
|||
<th class="am-hide-sm-only">业务订单id</th>
|
||||
<th class="am-hide-sm-only">支付平台交易号</th>
|
||||
<th class="am-hide-sm-only">支付平台用户帐号</th>
|
||||
<th>退款方式</th>
|
||||
<th>退款金额</th>
|
||||
<th>订单支付金额</th>
|
||||
<th class="am-hide-sm-only">描述</th>
|
||||
|
|
@ -137,6 +138,9 @@
|
|||
<td class="am-hide-sm-only">
|
||||
{{if empty($v['buyer_user'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.buyer_user}}{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
{{if empty($v['refundment_text'])}}<span class="cr-ddd">未填写</span>{{else /}}<span class="am-text-success">¥{{$v.refundment_text}}</span>{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
{{if empty($v['refund_price'])}}<span class="cr-ddd">未填写</span>{{else /}}<span class="am-text-danger">¥{{$v.refund_price}}</span>{{/if}}
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -131,6 +131,11 @@ class Orderaftersale extends Common
|
|||
$new_aftersale = OrderAftersaleService::OrderAftersaleList($data_params);
|
||||
$this->assign('new_aftersale_data', empty($new_aftersale['data'][0]) ? [] : $new_aftersale['data'][0]);
|
||||
|
||||
// 可退款退货
|
||||
$returned = OrderAftersaleService::OrderAftersaleCalculation($order_id, $order_detail_id);
|
||||
$this->assign('returned_data', $returned['data']);
|
||||
//print_r($returned);
|
||||
|
||||
// 静态数据
|
||||
$this->assign('common_order_aftersale_type_list', lang('common_order_aftersale_type_list'));
|
||||
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@
|
|||
<!-- 商品列表 -->
|
||||
{{if !empty($data.items)}}
|
||||
<div class="order-goods">
|
||||
<table class="am-table">
|
||||
<table class="am-table am-table-centered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>商品信息</th>
|
||||
|
|
@ -274,7 +274,7 @@
|
|||
<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">
|
||||
<ul class="am-margin-top-xs am-text-left goods-attr">
|
||||
{{foreach $goods.spec as $spec}}
|
||||
<li>{{$spec.type}}:{{$spec.value}}</li>
|
||||
{{/foreach}}
|
||||
|
|
@ -288,6 +288,9 @@
|
|||
{{/if}}
|
||||
<strong class="total-price-content">¥{{$goods.price}}</strong>
|
||||
<span class="wap-number">x{{$goods.buy_number}}</span>
|
||||
{{if isset($goods['returned_quantity']) and $goods['returned_quantity'] gt 0}}
|
||||
<span class="am-badge am-round am-badge-warning">已退 {{$goods.returned_quantity}}</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="price am-hide-sm-only">
|
||||
|
|
@ -297,10 +300,16 @@
|
|||
<p class="line-price">¥{{$goods.price}}</p>
|
||||
</td>
|
||||
<td class="number am-hide-sm-only">
|
||||
x{{$goods.buy_number}}
|
||||
<span>x{{$goods.buy_number}}</span>
|
||||
{{if isset($goods['returned_quantity']) and $goods['returned_quantity'] gt 0}}
|
||||
<br /><span class="am-badge am-round am-badge-warning">已退 {{$goods.returned_quantity}}</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
<td class="total-price am-hide-sm-only">
|
||||
<strong class="total-price-content">¥{{$goods.total_price}}</strong>
|
||||
{{if isset($goods['refund_price']) and $goods['refund_price'] gt 0}}
|
||||
<br /><span class="am-badge am-round am-badge-warning">已退 {{$goods.refund_price}}</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
|
|
|
|||
|
|
@ -174,6 +174,9 @@
|
|||
{{/if}}
|
||||
<strong class="line-price">¥{{$goods.price}}</strong>
|
||||
<span class="wap-number">x{{$goods.buy_number}}</span>
|
||||
{{if isset($goods['returned_quantity']) and $goods['returned_quantity'] gt 0}}
|
||||
<span class="am-badge am-round am-badge-warning">已退 {{$goods.returned_quantity}}</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="row-price am-hide-sm-only">
|
||||
|
|
@ -183,7 +186,10 @@
|
|||
<p class="line-price">¥{{$goods.price}}</p>
|
||||
</td>
|
||||
<td class="row-number am-hide-sm-only">
|
||||
x{{$goods.buy_number}}
|
||||
<span>x{{$goods.buy_number}}</span>
|
||||
{{if isset($goods['returned_quantity']) and $goods['returned_quantity'] gt 0}}
|
||||
<br /><span class="am-badge am-round am-badge-warning">已退 {{$goods.returned_quantity}}</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
<td class="row-number">
|
||||
<a href="{{:MyUrl('index/orderaftersale/aftersale', ['oid'=>$order['id'], 'did'=>$goods['id']])}}" target="_blank">
|
||||
|
|
@ -195,12 +201,11 @@
|
|||
<span class="am-text-secondary">查看进度</span>
|
||||
{{/if}}
|
||||
{{/case}}
|
||||
{{case 4}}
|
||||
申请售后
|
||||
{{/case}}
|
||||
{{case 6}}
|
||||
{{if empty($goods['orderaftersale']) or $goods['orderaftersale'] eq 5}}
|
||||
申请售后
|
||||
{{case 4|6}}
|
||||
{{if empty($goods['orderaftersale'])}}
|
||||
{{if $order['status'] eq 4}}
|
||||
申请售后
|
||||
{{/if}}
|
||||
{{else /}}
|
||||
{{if $goods['orderaftersale']['status'] eq 3}}
|
||||
<span class="am-text-success">查看退款</span>
|
||||
|
|
@ -215,6 +220,9 @@
|
|||
{{if $keys eq 0}}
|
||||
<td class="row-total-price am-hide-sm-only" rowspan="{{$order.items_count}}">
|
||||
<strong class="total-price-content">¥{{$order.total_price}}</strong>
|
||||
{{if isset($order['refund_price']) and $order['refund_price'] gt 0}}
|
||||
<br /><span class="am-badge am-round am-badge-warning">已退 {{$order.refund_price}}</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
<td class="row-status" rowspan="{{$order.items_count}}">
|
||||
{{$order.status_name}}
|
||||
|
|
@ -225,7 +233,7 @@
|
|||
<td class="row-operate" rowspan="{{$order.items_count}}">
|
||||
<!-- 0待确认, 1已确认/待支付, 2已支付/待发货, 3已发货/待收货, 4已完成, 5已取消, 6已关闭 -->
|
||||
{{if in_array($order['status'], [0,1])}}
|
||||
<button type="button" class="am-btn am-btn-danger am-btn-xs am-radius am-icon-paint-brush am-btn-block submit-ajax submit-cancel" data-url="{{:MyUrl('index/order/cancel')}}" data-id="{{$order.id}}" data-view="reload"> 取消</button>
|
||||
<button type="button" class="am-btn am-btn-warning am-btn-xs am-radius am-icon-paint-brush am-btn-block submit-ajax submit-cancel" data-url="{{:MyUrl('index/order/cancel')}}" data-id="{{$order.id}}" data-view="reload"> 取消</button>
|
||||
{{/if}}
|
||||
{{if in_array($order['status'], [1])}}
|
||||
<a class="am-btn am-btn-primary am-btn-xs am-radius am-icon-paypal am-btn-block" href="{{:MyUrl('index/order/detail', ['id'=>$order['id'], 'is_pay_auto'=>1])}}" target="_blank"> 支付</a>
|
||||
|
|
|
|||
|
|
@ -81,6 +81,14 @@
|
|||
<div class="items-detail am-fl">-¥{{$order.preferential_price}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.refund_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">退款金额:</div>
|
||||
<div class="items-detail am-fl">
|
||||
<span class="am-text-danger">-¥{{$order.refund_price}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($order.total_price)}}
|
||||
<div class="items am-cf">
|
||||
<div class="items-title am-fl">订单总价:</div>
|
||||
|
|
@ -146,11 +154,11 @@
|
|||
|
||||
{{case 1}}
|
||||
{{if $new_aftersale_data['type'] eq 1}}
|
||||
<div class="am-panel am-panel-default aftersale-form-panel">
|
||||
<div class="am-panel-bd">
|
||||
{{include file="orderaftersale/delivery" /}}
|
||||
</div>
|
||||
<div class="am-alert">
|
||||
当前订单商品售后,管理员已确认,请尽快完成退货!<a href="{{:MyUrl('index/orderaftersale/index', ['keywords'=>$new_aftersale_data['order_no']])}}">详情查看</a>
|
||||
<button type="button" class="am-btn am-btn-primary am-radius am-margin-left-sm orderaftersale-delivery-submit" data-am-modal="{target: '#popup-orderaftersale-delivery'}" data-is-auto-delivery="{{if isset($params['is_auto_delivery'])}}{{$params.is_auto_delivery}}{{else /}}0{{/if}}">立即退货</button>
|
||||
</div>
|
||||
{{include file="orderaftersale/delivery" /}}
|
||||
{{else /}}
|
||||
<div class="am-alert">
|
||||
当前订单商品售后已提交申请,等待管理员确认中!<a href="{{:MyUrl('index/orderaftersale/index', ['keywords'=>$new_aftersale_data['order_no']])}}">详情查看</a>
|
||||
|
|
@ -199,11 +207,11 @@
|
|||
</div>
|
||||
<div class="am-cf am-padding-vertical-xs">
|
||||
<span>退货数量:</span>
|
||||
<span>{{$new_aftersale_data.number}}</span>
|
||||
<span {{if $new_aftersale_data['number'] gt 0}}class="am-text-danger"{{/if}}>{{$new_aftersale_data.number}}</span>
|
||||
</div>
|
||||
<div class="am-cf am-padding-vertical-xs">
|
||||
<span>退款金额:</span>
|
||||
<span class="am-text-warning">¥{{$new_aftersale_data.price}}</span>
|
||||
<span class="am-text-danger">¥{{$new_aftersale_data.price}}</span>
|
||||
</div>
|
||||
<div class="am-cf am-padding-vertical-xs">
|
||||
<span>退款说明:</span>
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
<label>商品件数<span class="am-form-group-label-tips-must">必填</span></label>
|
||||
<div class="am-input-group am-input-group-sm number-container">
|
||||
<span class="am-input-group-label" data-type="0">-</span>
|
||||
<input type="number" name="number" class="am-form-field" value="1" min="1" max="{{$goods.buy_number}}" data-validation-message="请填写有效的商品件数,最小1,最大{{$goods.buy_number}}" required />
|
||||
<input type="number" name="number" class="am-form-field" value="{{$returned_data.returned_quantity}}" min="1" max="{{$returned_data.returned_quantity}}" data-validation-message="请填写有效的商品件数,最小1,最大{{$returned_data.returned_quantity}}" required />
|
||||
<span class="am-input-group-label" data-type="1">+</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label>退款金额<span class="am-form-group-label-tips-must">必填</span></label>
|
||||
<input type="number" name="price" value="{{$order.pay_price-$order.refund_price}}" step="0.01" min="0.00" max="{{$order.pay_price-$order.refund_price}}" class="am-radius" placeholder="退款金额" data-validation-message="请输入有效的退款金额,最高{{$order.pay_price-$order.refund_price}}元" required />
|
||||
<input type="number" name="price" value="{{$returned_data.refund_price}}" step="0.01" min="0.00" max="{{$returned_data.refund_price}}" class="am-radius" placeholder="退款金额" data-validation-message="请输入有效的退款金额,最高{{$returned_data.refund_price}}元" required />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
|
|
|
|||
|
|
@ -1,16 +1,26 @@
|
|||
<form class="am-form form-validation view-save" action="{{:MyUrl('index/orderaftersale/delivery')}}" 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-popup" id="popup-orderaftersale-delivery">
|
||||
<div class="am-popup-inner">
|
||||
<div class="am-popup-hd">
|
||||
<h4 class="am-popup-title">退货操作</h4>
|
||||
<span data-am-modal-close class="am-close">×</span>
|
||||
</div>
|
||||
<div class="am-popup-bd">
|
||||
<form class="am-form form-validation view-save" action="{{:MyUrl('index/orderaftersale/delivery')}}" 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">
|
||||
<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 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>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
类型:{{$v.type_text}}<br />
|
||||
原因:{{$v.reason}}<br />
|
||||
数量:{{$v.number}}<br />
|
||||
金额:<span class="am-text-warning">¥{{$v.price}}</span><br />
|
||||
金额:<span class="am-text-danger">¥{{$v.price}}</span><br />
|
||||
说明:{{$v.msg}}<br />
|
||||
时间:{{$v.apply_time_time}}
|
||||
</td>
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
</td>
|
||||
<td>
|
||||
{{if $v['status'] eq 1 and $v['type'] eq 1}}
|
||||
<a href="{{:MyUrl('index/orderaftersale/aftersale', ['id'=>$v['order_id'], 'gid'=>$v['goods_id']])}}" target="_blank" class="am-btn am-btn-secondary am-btn-xs am-radius am-icon-send am-btn-block"> 发货</a>
|
||||
<a href="{{:MyUrl('index/orderaftersale/aftersale', ['oid'=>$v['order_id'], 'did'=>$v['order_detail_id'], 'is_auto_delivery'=>1])}}" target="_blank" class="am-btn am-btn-primary am-btn-xs am-radius am-icon-send am-btn-block"> 退货</a>
|
||||
{{/if}}
|
||||
{{if !in_array($v['status'], [3,5])}}
|
||||
<button type="button" class="am-btn am-btn-warning am-btn-xs am-radius am-icon-paint-brush am-btn-block submit-ajax submit-cancel" data-url="{{:MyUrl('index/orderaftersale/cancel')}}" data-id="{{$v.id}}" data-view="reload"> 取消</button>
|
||||
|
|
|
|||
|
|
@ -752,6 +752,7 @@ class BuyService
|
|||
'extension_data' => empty($buy['data']['extension_data']) ? '' : json_encode($buy['data']['extension_data']),
|
||||
'payment_id' => isset($params['payment_id']) ? intval($params['payment_id']) : 0,
|
||||
'buy_number_count' => array_sum(array_column($buy['data']['goods'], 'stock')),
|
||||
'client_type' => (APPLICATION_CLIENT_TYPE == 'pc' && IsMobile()) ? 'h5' : APPLICATION_CLIENT_TYPE,
|
||||
'add_time' => time(),
|
||||
];
|
||||
if($order['status'] == 1)
|
||||
|
|
@ -777,6 +778,7 @@ class BuyService
|
|||
'images' => $v['images_old'],
|
||||
'original_price' => $v['original_price'],
|
||||
'price' => $v['price'],
|
||||
'total_price' => PriceNumberFormat($v['stock']*$v['price']),
|
||||
'spec' => empty($v['spec']) ? '' : json_encode($v['spec']),
|
||||
'spec_weight' => empty($v['spec_weight']) ? 0.00 : (float) $v['spec_weight'],
|
||||
'spec_coding' => empty($v['spec_coding']) ? '' : $v['spec_coding'],
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class OrderAftersaleService
|
|||
|
||||
// 历史退款金额
|
||||
$history_price = PriceNumberFormat(Db::name('OrderAftersale')->where($where)->sum('price'));
|
||||
if($price+$history_price > $order['data']['pay_price'])
|
||||
if(PriceNumberFormat($price+$history_price) > $order['data']['pay_price'])
|
||||
{
|
||||
return DataReturn('退款金额大于支付金额[ 历史退款'.$history_price.'元, 订单金额'.$order['data']['pay_price'].'元 ]', -1);
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ class OrderAftersaleService
|
|||
$history_number = (int) Db::name('OrderAftersale')->where($where)->sum('number');
|
||||
if($params['type'] == 1)
|
||||
{
|
||||
if($number+$history_number > $order['data']['items']['buy_number'])
|
||||
if(intval($number+$history_number) > $order['data']['items']['buy_number'])
|
||||
{
|
||||
return DataReturn('退货数量大于购买数量[ 历史退货数量 '.$history_number.', 订单商品数量 '.$order['data']['items']['buy_number'].' ]', -1);
|
||||
}
|
||||
|
|
@ -681,7 +681,7 @@ class OrderAftersaleService
|
|||
|
||||
// 历史退款金额
|
||||
$history_price = PriceNumberFormat(Db::name('OrderAftersale')->where($where)->sum('price'));
|
||||
if($aftersale['price']+$history_price > $order['data']['pay_price'])
|
||||
if(PriceNumberFormat($aftersale['price']+$history_price) > $order['data']['pay_price'])
|
||||
{
|
||||
return DataReturn('退款金额大于支付金额[ 历史退款'.$history_price.'元, 订单金额'.$order['data']['pay_price'].'元 ]', -1);
|
||||
}
|
||||
|
|
@ -691,7 +691,7 @@ class OrderAftersaleService
|
|||
$history_number = (int) Db::name('OrderAftersale')->where($where)->sum('number');
|
||||
if($aftersale['type'] == 1)
|
||||
{
|
||||
if($aftersale['number']+$history_number > $order['data']['items']['buy_number'])
|
||||
if(intval($aftersale['number']+$history_number) > $order['data']['items']['buy_number'])
|
||||
{
|
||||
return DataReturn('退货数量大于购买数量[ 历史退货数量 '.$history_number.', 订单商品数量 '.$order['data']['items']['buy_number'].' ]', -1);
|
||||
}
|
||||
|
|
@ -770,8 +770,8 @@ class OrderAftersaleService
|
|||
|
||||
// 更新主订单
|
||||
$refund_price = PriceNumberFormat($order['data']['refund_price']+$aftersale['price']);
|
||||
$returned_quantity = $order['data']['returned_quantity']+$aftersale['number'];
|
||||
$upd_data = [
|
||||
$returned_quantity = intval($order['data']['returned_quantity']+$aftersale['number']);
|
||||
$order_upd_data = [
|
||||
'pay_status' => ($refund_price >= $order['data']['pay_price']) ? 2 : 3,
|
||||
'refund_price' => $refund_price,
|
||||
'returned_quantity' => $returned_quantity,
|
||||
|
|
@ -781,18 +781,30 @@ class OrderAftersaleService
|
|||
// 如果退款金额和退款数量到达订单实际是否金额和购买数量则关闭订单
|
||||
if($refund_price >= $order['data']['pay_price'] && $returned_quantity >= $order['data']['buy_number_count'])
|
||||
{
|
||||
$upd_data['status'] = 6;
|
||||
$order_upd_data['status'] = 6;
|
||||
}
|
||||
if(!Db::name('Order')->where(['id'=>$order['data']['id']])->update($upd_data))
|
||||
if(!Db::name('Order')->where(['id'=>$order['data']['id']])->update($order_upd_data))
|
||||
{
|
||||
Db::rollback();
|
||||
return DataReturn('主订单更新失败', -1);
|
||||
}
|
||||
|
||||
// 订单详情
|
||||
$detail_upd_data = [
|
||||
'refund_price' => PriceNumberFormat($order['data']['items']['refund_price']+$aftersale['price']),
|
||||
'returned_quantity' => intval($order['data']['items']['returned_quantity']+$aftersale['number']),
|
||||
'upd_time' => time(),
|
||||
];
|
||||
if(!Db::name('OrderDetail')->where(['id'=>$aftersale['order_detail_id']])->update($detail_upd_data))
|
||||
{
|
||||
Db::rollback();
|
||||
return DataReturn('订单详情更新失败', -1);
|
||||
}
|
||||
|
||||
// 库存回滚
|
||||
if($aftersale['type'] == 1)
|
||||
{
|
||||
$ret = BuyService::OrderInventoryRollback(['order_id'=>$order['data']['id'], 'order_data'=>$upd_data, 'appoint_order_detail_id'=>$aftersale['order_detail_id'], 'appoint_buy_number'=>$aftersale['number']]);
|
||||
$ret = BuyService::OrderInventoryRollback(['order_id'=>$order['data']['id'], 'order_data'=>$order_upd_data, 'appoint_order_detail_id'=>$aftersale['order_detail_id'], 'appoint_buy_number'=>$aftersale['number']]);
|
||||
if($ret['code'] != 0)
|
||||
{
|
||||
Db::rollback();
|
||||
|
|
@ -805,21 +817,21 @@ class OrderAftersaleService
|
|||
MessageService::MessageAdd($order['data']['user_id'], '订单退款', $detail, 1, $order['data']['id']);
|
||||
|
||||
// 订单状态日志
|
||||
if(isset($upd_data['status']))
|
||||
if(isset($order_upd_data['status']))
|
||||
{
|
||||
$creator = isset($params['creator']) ? intval($params['creator']) : 0;
|
||||
$creator_name = isset($params['creator_name']) ? htmlentities($params['creator_name']) : '';
|
||||
OrderService::OrderHistoryAdd($order['data']['id'], $upd_data['status'], $order['data']['status'], '关闭', $creator, $creator_name);
|
||||
OrderService::OrderHistoryAdd($order['data']['id'], $order_upd_data['status'], $order['data']['status'], '关闭', $creator, $creator_name);
|
||||
}
|
||||
|
||||
// 更新退款状态
|
||||
$upd_data = [
|
||||
$aftersale_upd_data = [
|
||||
'status' => 3,
|
||||
'refundment' => $params['refundment'],
|
||||
'audit_time' => time(),
|
||||
'upd_time' => time(),
|
||||
];
|
||||
if(!Db::name('OrderAftersale')->where(['id'=>$aftersale['id']])->update($upd_data))
|
||||
if(!Db::name('OrderAftersale')->where(['id'=>$aftersale['id']])->update($aftersale_upd_data))
|
||||
{
|
||||
Db::rollback();
|
||||
return DataReturn('售后订单更新失败', -60);
|
||||
|
|
@ -887,6 +899,7 @@ class OrderAftersaleService
|
|||
'msg' => $pay_params['refund_reason'],
|
||||
'payment' => $pay_log['payment'],
|
||||
'payment_name' => $pay_log['payment_name'],
|
||||
'refundment' => $params['refundment'],
|
||||
'business_type' => 1,
|
||||
'return_params' => isset($ret['data']['return_params']) ? $ret['data']['return_params'] : '',
|
||||
];
|
||||
|
|
@ -954,6 +967,7 @@ class OrderAftersaleService
|
|||
'msg' => $msg,
|
||||
'payment' => $pay_log['payment'],
|
||||
'payment_name' => $pay_log['payment_name'],
|
||||
'refundment' => $params['refundment'],
|
||||
'business_type' => 1,
|
||||
'return_params' => '',
|
||||
];
|
||||
|
|
@ -1070,5 +1084,104 @@ class OrderAftersaleService
|
|||
}
|
||||
return DataReturn('删除失败', -100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单售后退款退货计算
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-05-30
|
||||
* @desc description
|
||||
* @param [int] $order_id [订单id]
|
||||
* @param [int] $order_detail_id [订单详情id]
|
||||
*/
|
||||
public static function OrderAftersaleCalculation($order_id, $order_detail_id)
|
||||
{
|
||||
// 可退数量/金额
|
||||
$returned_quantity = 0;
|
||||
$refund_price = 0.00;
|
||||
|
||||
// 历史退货数量/金额
|
||||
$history_returned_quantity = 0;
|
||||
$history_refund_price = 0.00;
|
||||
|
||||
// 未发生退货数量/金额
|
||||
$not_returned_quantity = 0;
|
||||
$not_refund_price = 0.00;
|
||||
|
||||
// 获取订单数据
|
||||
$order = Db::name('Order')->where(['id'=>$order_id])->field('id,status,pay_status,buy_number_count,increase_price,preferential_price,price,total_price,pay_price,refund_price,returned_quantity')->find();
|
||||
if(!empty($order))
|
||||
{
|
||||
$dateil = Db::name('OrderDetail')->where(['order_id'=>$order_id])->field('id,price,total_price,buy_number,refund_price,returned_quantity')->select();
|
||||
if(!empty($dateil))
|
||||
{
|
||||
foreach($dateil as $v)
|
||||
{
|
||||
// 从订单售后中获取进行中的数据
|
||||
$where = [
|
||||
['order_detail_id', '=', $v['id']],
|
||||
['status', '<=', 2],
|
||||
];
|
||||
$aftersale = Db::name('OrderAftersale')->where($where)->field('sum(number) as number, sum(price) as price')->find();
|
||||
if(!empty($aftersale['number']))
|
||||
{
|
||||
$v['returned_quantity'] += $aftersale['number'];
|
||||
}
|
||||
if(!empty($aftersale['price']))
|
||||
{
|
||||
$v['refund_price'] += $aftersale['price'];
|
||||
}
|
||||
|
||||
// 累计
|
||||
$history_returned_quantity += $v['returned_quantity'];
|
||||
$history_refund_price += $v['refund_price'];
|
||||
|
||||
// 当前指定详情
|
||||
if($v['id'] == $order_detail_id)
|
||||
{
|
||||
$returned_quantity = $v['buy_number']-$v['returned_quantity'];
|
||||
$refund_price = $v['price']*$returned_quantity;
|
||||
if($refund_price+$v['refund_price'] > $v['total_price'])
|
||||
{
|
||||
$refund_price = $v['total_price']-$v['refund_price'];
|
||||
}
|
||||
} else {
|
||||
// 未发生
|
||||
if($v['returned_quantity'] <= 0 && $v['refund_price'] <= 0.00)
|
||||
{
|
||||
$not_returned_quantity += $v['buy_number'];
|
||||
$not_refund_price += $v['total_price'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 未发生售后
|
||||
if($not_returned_quantity > 0)
|
||||
{
|
||||
if(PriceNumberFormat($refund_price+$not_refund_price) > $order['price'])
|
||||
{
|
||||
$refund_price -= $not_refund_price;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果最后一件退款则加上增加的金额,减去优惠家呢
|
||||
if(PriceNumberFormat($history_refund_price+$refund_price) >= $order['price'])
|
||||
{
|
||||
$refund_price += $order['increase_price'];
|
||||
$refund_price -= $order['preferential_price'];
|
||||
}
|
||||
|
||||
// 如果退款金额大于支付金额,则支付金额减去已退款金额
|
||||
$temp_price = PriceNumberFormat($refund_price+$history_refund_price);
|
||||
if($temp_price > $order['pay_price'])
|
||||
{
|
||||
$refund_price = $order['pay_price']-$history_refund_price;
|
||||
}
|
||||
}
|
||||
|
||||
return DataReturn('操作成功', 0, ['returned_quantity'=>$returned_quantity, 'refund_price'=>PriceNumberFormat($refund_price)]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -144,6 +144,7 @@ class OrderService
|
|||
'order_no' => $order['order_no'],
|
||||
'name' => '订单支付',
|
||||
'total_price' => $order['total_price'],
|
||||
'client_type' => $order['client_type'],
|
||||
'notify_url' => $url.'_notify.php',
|
||||
'call_back_url' => $call_back_url,
|
||||
'site_name' => MyC('home_site_name', 'ShopXO', true),
|
||||
|
|
@ -154,16 +155,19 @@ class OrderService
|
|||
if(isset($ret['code']) && $ret['code'] == 0)
|
||||
{
|
||||
// 非线上支付处理
|
||||
$params['user']['user_name_view'] = '用户-'.$params['user']['user_name_view'];
|
||||
$pay_result = self::OrderPaymentUnderLine([
|
||||
'order' => $order,
|
||||
'payment' => $payment[0],
|
||||
'user' => $params['user'],
|
||||
'subject' => $params,
|
||||
]);
|
||||
if($pay_result['code'] != 0)
|
||||
if(in_array($payment[0]['payment'], config('shopxo.under_line_list')))
|
||||
{
|
||||
return $pay_result;
|
||||
$params['user']['user_name_view'] = '用户-'.$params['user']['user_name_view'];
|
||||
$pay_result = self::OrderPaymentUnderLine([
|
||||
'order' => $order,
|
||||
'payment' => $payment[0],
|
||||
'user' => $params['user'],
|
||||
'subject' => $params,
|
||||
]);
|
||||
if($pay_result['code'] != 0)
|
||||
{
|
||||
return $pay_result;
|
||||
}
|
||||
}
|
||||
|
||||
// 支付信息返回
|
||||
|
|
@ -547,6 +551,10 @@ class OrderService
|
|||
{
|
||||
$where[] = ['pay_status', '=', intval($params['pay_status'])];
|
||||
}
|
||||
if(!empty($params['client_type']))
|
||||
{
|
||||
$where[] = ['client_type', '=', $params['client_type']];
|
||||
}
|
||||
if(isset($params['status']) && $params['status'] != -1)
|
||||
{
|
||||
// 多个状态,字符串以半角逗号分割
|
||||
|
|
@ -631,6 +639,7 @@ class OrderService
|
|||
{
|
||||
$order_status_list = lang('common_order_user_status');
|
||||
$order_pay_status = lang('common_order_pay_status');
|
||||
$common_platform_type = lang('common_platform_type');
|
||||
foreach($data as &$v)
|
||||
{
|
||||
// 订单处理前钩子
|
||||
|
|
@ -647,6 +656,9 @@ class OrderService
|
|||
return $ret;
|
||||
}
|
||||
|
||||
// 客户端
|
||||
$v['client_type_name'] = isset($common_platform_type[$v['client_type']]) ? $common_platform_type[$v['client_type']]['name'] : '';
|
||||
|
||||
// 状态
|
||||
$v['status_name'] = $order_status_list[$v['status']]['name'];
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class RefundLogService
|
|||
* @param [string] $msg [描述]
|
||||
* @param [string] $payment [支付方式标记]
|
||||
* @param [string] $payment_name [支付方式名称]
|
||||
* @param [int] $refundment [退款类型(0原路退回, 1退至钱包, 2手动处理)]
|
||||
* @param [int] $business_type [业务类型(0默认, 1订单, 2充值, ...)]
|
||||
* @param [string] $return_params [支付平台返回参数]
|
||||
* @return [boolean] [成功true, 失败false]
|
||||
|
|
@ -53,6 +54,7 @@ class RefundLogService
|
|||
'msg' => isset($params['msg']) ? $params['msg'] : '',
|
||||
'payment' => isset($params['payment']) ? $params['payment'] : '',
|
||||
'payment_name' => isset($params['payment_name']) ? $params['payment_name'] : '',
|
||||
'refundment' => isset($params['refundment']) ? intval($params['refundment']) : 0,
|
||||
'business_type' => isset($params['business_type']) ? intval($params['business_type']) : 0,
|
||||
'return_params' => empty($params['return_params']) ? '' : json_encode($params['return_params'], JSON_UNESCAPED_UNICODE),
|
||||
'add_time' => time(),
|
||||
|
|
@ -97,6 +99,7 @@ class RefundLogService
|
|||
{
|
||||
$common_business_type_list = lang('common_business_type_list');
|
||||
$common_gender_list = lang('common_gender_list');
|
||||
$common_order_aftersale_refundment_list = lang('common_order_aftersale_refundment_list');
|
||||
foreach($data as &$v)
|
||||
{
|
||||
// 业务类型
|
||||
|
|
@ -105,6 +108,9 @@ class RefundLogService
|
|||
// 性别
|
||||
$v['gender_text'] = $common_gender_list[$v['gender']]['name'];
|
||||
|
||||
// 退款方式
|
||||
$v['refundment_text'] = $common_order_aftersale_refundment_list[$v['refundment']]['name'];
|
||||
|
||||
// 时间
|
||||
$v['add_time_time'] = date('Y-m-d H:i:s', $v['add_time']);
|
||||
$v['add_time_date'] = date('Y-m-d', $v['add_time']);
|
||||
|
|
|
|||
|
|
@ -49,9 +49,10 @@ return array (
|
|||
'plugins_css' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\commonrightnavigation\\Hook',
|
||||
1 => 'app\\plugins\\share\\Hook',
|
||||
2 => 'app\\plugins\\footercustomerservice\\Hook',
|
||||
3 => 'app\\plugins\\membershiplevel\\Hook',
|
||||
1 => 'app\\plugins\\freightfee\\Hook',
|
||||
2 => 'app\\plugins\\share\\Hook',
|
||||
3 => 'app\\plugins\\footercustomerservice\\Hook',
|
||||
4 => 'app\\plugins\\membershiplevel\\Hook',
|
||||
),
|
||||
'plugins_js' =>
|
||||
array (
|
||||
|
|
@ -116,9 +117,13 @@ return array (
|
|||
),
|
||||
'plugins_service_buy_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\newuserreduction\\Hook',
|
||||
0 => 'app\\plugins\\freightfee\\Hook',
|
||||
1 => 'app\\plugins\\membershiplevel\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_title' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\freightfee\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_photo_bottom' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\share\\Hook',
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -486,8 +486,8 @@ class Weixin
|
|||
// 退款原因
|
||||
$refund_reason = empty($params['refund_reason']) ? $params['order_no'].'订单退款'.$params['refund_price'].'元' : $params['refund_reason'];
|
||||
|
||||
// appid
|
||||
$appid = (APPLICATION == 'app') ? $this->config['mini_appid'] : $this->config['appid'];
|
||||
// appid,默认使用公众号appid
|
||||
$appid = (!isset($params['client_type']) || in_array($params['client_type'], ['pc', 'h5'])) ? $this->config['appid'] : $this->config['mini_appid'];
|
||||
|
||||
// 请求参数
|
||||
$data = [
|
||||
|
|
|
|||
|
|
@ -193,12 +193,11 @@ ul.progress li.current .title {
|
|||
* 商品列表
|
||||
*/
|
||||
.order-goods { margin-top: 20px; }
|
||||
.goods-detail img { width: 80px; height: 80px; position: absolute; }
|
||||
.goods-detail img { width: 80px; height: 80px; position: absolute; left: 0; top: 0; }
|
||||
.goods-detail { position: relative; min-height: 80px; }
|
||||
.goods-title { display: block; max-height: 36px; overflow: hidden; text-overflow: ellipsis; }
|
||||
.goods-title:hover { text-decoration: underline; }
|
||||
.goods-base { float: left; top: 0; margin-left: 85px; }
|
||||
.goods-attr { margin-top: 5px; }
|
||||
.goods-attr li { color: #888; line-height: 16px; }
|
||||
.original-price, .line-price { font-family: Verdana,Tahoma,arial; }
|
||||
.original-price { color: #9c9c9c; text-decoration: line-through; }
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ form.form-validation .number-container .am-input-group-label {
|
|||
/**
|
||||
* 详情信息
|
||||
*/
|
||||
.user-content-body .detail .am-u-md-6 .am-panel, .user-content-body .aftersale-form-panel {
|
||||
.user-content-body .detail .am-u-md-6 .am-panel {
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
$(function()
|
||||
{
|
||||
// 自动开启退货窗口
|
||||
if($('.orderaftersale-delivery-submit').length > 0)
|
||||
{
|
||||
if($('.orderaftersale-delivery-submit').data('is-auto-delivery') == 1)
|
||||
{
|
||||
$('#popup-orderaftersale-delivery').modal('open');
|
||||
}
|
||||
}
|
||||
|
||||
// 表单面板
|
||||
var $form_panel = $('.aftersale-form-panel');
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,7 @@ $(function()
|
|||
if($this.data('verify') == 1)
|
||||
{
|
||||
// 开启图片验证码窗口
|
||||
var $verify_win = $('#verify-win');
|
||||
$verify_win.modal('open');
|
||||
$('#verify-win').modal('open');
|
||||
$verify_img.trigger("click");
|
||||
$verify.focus();
|
||||
return false;
|
||||
|
|
@ -104,7 +103,10 @@ $(function()
|
|||
$this.text(send_msg);
|
||||
}
|
||||
}, 1000);
|
||||
$verify_win.modal('close');
|
||||
if($('#verify-win').length > 0)
|
||||
{
|
||||
$('#verify-win').modal('close');
|
||||
}
|
||||
} else {
|
||||
$this.button('reset');
|
||||
if(is_win == 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue